From 9f02e20ac323380eb2ff8eb287f7df646b12469a Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Mon, 15 Feb 2016 23:17:41 +0000 Subject: [PATCH] Bump github.com/ugorji/go/codec/ for performance improvements This caused a dependency chain reaction (sigh): * All the k8s packages had to be fetched again. This in turn required: * Pining github.com/docker/docker/pkg/parsers to 0f5c9d301b9b1cca66b3ea0f9dec3b5317d3686d to cirvumvent https://github.com/kubernetes/kubernetes/issues/18774 * Update github.com/juju/ratelimit * Make probe/kubernetes/client.go comply with API changes. --- probe/kubernetes/client.go | 4 +- vendor/github.com/blang/semver/LICENSE | 22 + vendor/github.com/blang/semver/README.md | 191 + .../github.com/blang/semver/examples/main.go | 83 + vendor/github.com/blang/semver/json.go | 23 + vendor/github.com/blang/semver/json_test.go | 45 + vendor/github.com/blang/semver/range.go | 224 + vendor/github.com/blang/semver/range_test.go | 442 + vendor/github.com/blang/semver/semver.go | 395 + vendor/github.com/blang/semver/semver_test.go | 417 + vendor/github.com/blang/semver/sort.go | 28 + vendor/github.com/blang/semver/sort_test.go | 30 + vendor/github.com/blang/semver/sql.go | 30 + vendor/github.com/blang/semver/sql_test.go | 38 + .../docker/pkg/parsers/filters/parse.go | 116 + .../docker/pkg/parsers/filters/parse_test.go | 218 + .../docker/pkg/parsers/kernel/kernel.go | 95 + .../docker/pkg/parsers/kernel/kernel_test.go | 92 + .../pkg/parsers/kernel/kernel_windows.go | 65 + .../docker/pkg/parsers/kernel/uname_linux.go | 16 + .../pkg/parsers/kernel/uname_unsupported.go | 15 + .../operatingsystem/operatingsystem_linux.go | 40 + .../operatingsystem/operatingsystem_test.go | 124 + .../operatingsystem_windows.go | 47 + .../docker/docker/pkg/parsers/parsers.go | 170 + .../docker/docker/pkg/parsers/parsers_test.go | 210 + .../docker/go-units/CONTRIBUTING.md | 67 + .../github.com/docker/go-units/LICENSE.code | 191 + .../github.com/docker/go-units/LICENSE.docs | 425 + vendor/github.com/docker/go-units/MAINTAINERS | 27 + vendor/github.com/docker/go-units/README.md | 18 + vendor/github.com/docker/go-units/circle.yml | 11 + vendor/github.com/docker/go-units/duration.go | 33 + .../docker/go-units/duration_test.go | 81 + vendor/github.com/docker/go-units/size.go | 95 + .../github.com/docker/go-units/size_test.go | 163 + vendor/github.com/docker/go-units/ulimit.go | 118 + .../github.com/docker/go-units/ulimit_test.go | 74 + vendor/github.com/juju/ratelimit/ratelimit.go | 26 +- .../juju/ratelimit/ratelimit_test.go | 67 +- .../runc/libcontainer/cgroups/cgroups.go | 64 + .../runc/libcontainer/cgroups/cgroups_test.go | 18 + .../cgroups/cgroups_unsupported.go | 3 + .../runc/libcontainer/cgroups/fs/apply_raw.go | 393 + .../runc/libcontainer/cgroups/fs/blkio.go | 237 + .../libcontainer/cgroups/fs/blkio_test.go | 636 + .../runc/libcontainer/cgroups/fs/cpu.go | 94 + .../runc/libcontainer/cgroups/fs/cpu_test.go | 163 + .../runc/libcontainer/cgroups/fs/cpuacct.go | 121 + .../runc/libcontainer/cgroups/fs/cpuset.go | 139 + .../libcontainer/cgroups/fs/cpuset_test.go | 65 + .../runc/libcontainer/cgroups/fs/devices.go | 73 + .../libcontainer/cgroups/fs/devices_test.go | 84 + .../runc/libcontainer/cgroups/fs/freezer.go | 61 + .../libcontainer/cgroups/fs/freezer_test.go | 47 + .../libcontainer/cgroups/fs/fs_unsupported.go | 3 + .../runc/libcontainer/cgroups/fs/hugetlb.go | 71 + .../libcontainer/cgroups/fs/hugetlb_test.go | 154 + .../runc/libcontainer/cgroups/fs/memory.go | 201 + .../libcontainer/cgroups/fs/memory_test.go | 339 + .../runc/libcontainer/cgroups/fs/name.go | 32 + .../runc/libcontainer/cgroups/fs/net_cls.go | 41 + .../libcontainer/cgroups/fs/net_cls_test.go | 38 + .../runc/libcontainer/cgroups/fs/net_prio.go | 41 + .../libcontainer/cgroups/fs/net_prio_test.go | 38 + .../libcontainer/cgroups/fs/perf_event.go | 35 + .../runc/libcontainer/cgroups/fs/pids.go | 57 + .../runc/libcontainer/cgroups/fs/pids_test.go | 83 + .../cgroups/fs/stats_util_test.go | 117 + .../runc/libcontainer/cgroups/fs/util_test.go | 67 + .../runc/libcontainer/cgroups/fs/utils.go | 79 + .../libcontainer/cgroups/fs/utils_test.go | 97 + .../runc/libcontainer/cgroups/stats.go | 100 + .../cgroups/systemd/apply_nosystemd.go | 55 + .../cgroups/systemd/apply_systemd.go | 605 + .../runc/libcontainer/cgroups/utils.go | 378 + .../runc/libcontainer/cgroups/utils_test.go | 138 + .../runc/libcontainer/configs/blkio_device.go | 61 + .../runc/libcontainer/configs/cgroup_unix.go | 121 + .../configs/cgroup_unsupported.go | 6 + .../libcontainer/configs/cgroup_windows.go | 6 + .../runc/libcontainer/configs/config.go | 252 + .../runc/libcontainer/configs/config_unix.go | 51 + .../libcontainer/configs/config_unix_test.go | 156 + .../configs/config_windows_test.go | 3 + .../runc/libcontainer/configs/device.go | 57 + .../libcontainer/configs/device_defaults.go | 125 + .../libcontainer/configs/hugepage_limit.go | 9 + .../configs/interface_priority_map.go | 14 + .../runc/libcontainer/configs/mount.go | 30 + .../runc/libcontainer/configs/namespaces.go | 5 + .../configs/namespaces_syscall.go | 31 + .../configs/namespaces_syscall_unsupported.go | 15 + .../libcontainer/configs/namespaces_unix.go | 89 + .../configs/namespaces_unsupported.go | 8 + .../runc/libcontainer/configs/network.go | 72 + .../libcontainer/configs/validate/config.go | 93 + .../runc/libcontainer/system/linux.go | 114 + .../runc/libcontainer/system/proc.go | 27 + .../runc/libcontainer/system/setns_linux.go | 40 + .../libcontainer/system/syscall_linux_386.go | 25 + .../libcontainer/system/syscall_linux_64.go | 25 + .../libcontainer/system/syscall_linux_arm.go | 25 + .../runc/libcontainer/system/sysconfig.go | 12 + .../libcontainer/system/sysconfig_notcgo.go | 15 + .../runc/libcontainer/system/xattrs_linux.go | 99 + .../runc/libcontainer/utils/utils.go | 81 + .../runc/libcontainer/utils/utils_test.go | 25 + .../runc/libcontainer/utils/utils_unix.go | 33 + vendor/github.com/ugorji/go/codec/0doc.go | 51 +- vendor/github.com/ugorji/go/codec/binc.go | 144 +- vendor/github.com/ugorji/go/codec/cbor.go | 122 +- .../github.com/ugorji/go/codec/codec_test.go | 470 +- .../ugorji/go/codec/codecgen_test.go | 3 +- vendor/github.com/ugorji/go/codec/decode.go | 737 +- vendor/github.com/ugorji/go/codec/encode.go | 367 +- .../ugorji/go/codec/fast-path.generated.go | 10461 +++- .../ugorji/go/codec/fast-path.go.tmpl | 166 +- .../ugorji/go/codec/fast-path.not.go | 32 + .../ugorji/go/codec/gen-dec-array.go.tmpl | 136 +- .../ugorji/go/codec/gen-dec-map.go.tmpl | 28 +- .../ugorji/go/codec/gen-helper.generated.go | 23 +- .../ugorji/go/codec/gen-helper.go.tmpl | 21 +- .../ugorji/go/codec/gen.generated.go | 164 +- vendor/github.com/ugorji/go/codec/gen.go | 266 +- vendor/github.com/ugorji/go/codec/helper.go | 328 +- .../github.com/ugorji/go/codec/helper_test.go | 179 +- vendor/github.com/ugorji/go/codec/json.go | 758 +- vendor/github.com/ugorji/go/codec/msgpack.go | 153 +- vendor/github.com/ugorji/go/codec/noop.go | 96 +- vendor/github.com/ugorji/go/codec/prebuild.sh | 59 +- vendor/github.com/ugorji/go/codec/simple.go | 111 +- vendor/github.com/ugorji/go/codec/test.py | 18 +- vendor/github.com/ugorji/go/codec/tests.sh | 56 +- vendor/github.com/ugorji/go/codec/time.go | 42 +- .../k8s.io/kubernetes/pkg/api/conversion.go | 175 +- .../kubernetes/pkg/api/conversion_test.go | 25 +- vendor/k8s.io/kubernetes/pkg/api/copy_test.go | 19 +- .../kubernetes/pkg/api/deep_copy_generated.go | 2176 +- .../kubernetes/pkg/api/deep_copy_test.go | 8 +- vendor/k8s.io/kubernetes/pkg/api/doc.go | 2 +- .../kubernetes/pkg/api/endpoints/util.go | 6 +- .../kubernetes/pkg/api/errors/errors.go | 128 +- .../kubernetes/pkg/api/errors/errors_test.go | 45 +- .../kubernetes/pkg/api/errors/etcd/etcd.go | 56 +- vendor/k8s.io/kubernetes/pkg/api/helpers.go | 57 +- .../k8s.io/kubernetes/pkg/api/helpers_test.go | 122 + .../kubernetes/pkg/api/install/install.go | 108 +- .../pkg/api/install/install_test.go | 51 +- .../kubernetes/pkg/api/latest/latest.go | 149 - vendor/k8s.io/kubernetes/pkg/api/mapper.go | 12 +- vendor/k8s.io/kubernetes/pkg/api/meta.go | 20 + .../k8s.io/kubernetes/pkg/api/meta/errors.go | 72 + vendor/k8s.io/kubernetes/pkg/api/meta/help.go | 133 + .../kubernetes/pkg/api/meta/help_test.go | 253 + .../kubernetes/pkg/api/meta/interfaces.go | 76 +- vendor/k8s.io/kubernetes/pkg/api/meta/meta.go | 124 +- .../kubernetes/pkg/api/meta/meta_test.go | 273 +- .../pkg/api/meta/multirestmapper.go | 121 + .../pkg/api/meta/multirestmapper_test.go | 238 + .../kubernetes/pkg/api/meta/restmapper.go | 560 +- .../pkg/api/meta/restmapper_test.go | 515 +- vendor/k8s.io/kubernetes/pkg/api/meta_test.go | 3 + vendor/k8s.io/kubernetes/pkg/api/pod/util.go | 47 + .../kubernetes/pkg/api/pod/util_test.go | 110 + vendor/k8s.io/kubernetes/pkg/api/ref.go | 71 +- vendor/k8s.io/kubernetes/pkg/api/ref_test.go | 4 +- vendor/k8s.io/kubernetes/pkg/api/register.go | 153 +- .../pkg/api/registered/registered.go | 80 - .../kubernetes/pkg/api/resource/quantity.go | 150 +- .../pkg/api/resource/quantity_proto.go | 80 + .../pkg/api/resource/quantity_test.go | 295 +- .../kubernetes/pkg/api/resource/scale_int.go | 95 + .../pkg/api/resource/scale_int_test.go | 85 + .../kubernetes/pkg/api/resource/suffix.go | 2 + .../kubernetes/pkg/api/resource_helpers.go | 37 +- .../pkg/api/resource_helpers_test.go | 10 + .../k8s.io/kubernetes/pkg/api/rest/create.go | 37 +- .../kubernetes/pkg/api/rest/create_test.go | 41 - .../k8s.io/kubernetes/pkg/api/rest/export.go | 28 + vendor/k8s.io/kubernetes/pkg/api/rest/rest.go | 40 +- .../pkg/api/rest/resttest/resttest.go | 181 +- .../k8s.io/kubernetes/pkg/api/rest/types.go | 51 - .../k8s.io/kubernetes/pkg/api/rest/update.go | 43 +- .../kubernetes/pkg/api/rest/update_test.go | 110 - .../pkg/api/serialization_proto_test.go | 95 + .../kubernetes/pkg/api/serialization_test.go | 313 +- .../kubernetes/pkg/api/testapi/testapi.go | 178 +- .../pkg/api/testapi/testapi_test.go | 83 +- .../testing/compat/compatibility_tester.go | 16 +- .../kubernetes/pkg/api/testing/conversion.go | 72 + .../kubernetes/pkg/api/testing/fuzzer.go | 161 +- .../kubernetes/pkg/api/types.generated.go | 51765 +++++++++------ vendor/k8s.io/kubernetes/pkg/api/types.go | 475 +- .../pkg/api/unversioned/duration.go | 2 +- .../pkg/api/unversioned/group_version.go | 266 + .../pkg/api/unversioned/group_version_test.go | 78 + .../kubernetes/pkg/api/unversioned/helpers.go | 94 + .../unversioned}/helpers_test.go | 28 +- .../pkg/api/unversioned/register.go | 42 + .../kubernetes/pkg/api/unversioned/time.go | 4 +- .../pkg/api/unversioned/time_proto.go | 80 + .../kubernetes/pkg/api/unversioned/types.go | 99 +- .../types_swagger_doc_generated.go | 39 +- .../api/unversioned/validation/validation.go | 53 + .../pkg/api/unversioned/well_known_labels.go | 21 + .../pkg/api/v1/backward_compatibility_test.go | 71 +- .../kubernetes/pkg/api/v1/conversion.go | 219 +- .../pkg/api/v1/conversion_generated.go | 4210 +- .../kubernetes/pkg/api/v1/conversion_test.go | 55 + .../pkg/api/v1/deep_copy_generated.go | 302 +- .../k8s.io/kubernetes/pkg/api/v1/defaults.go | 58 +- .../kubernetes/pkg/api/v1/defaults_test.go | 134 +- .../k8s.io/kubernetes/pkg/api/v1/register.go | 116 +- .../kubernetes/pkg/api/v1/types.generated.go | 52167 +++++++++------- vendor/k8s.io/kubernetes/pkg/api/v1/types.go | 524 +- .../pkg/api/v1/types_swagger_doc_generated.go | 291 +- .../kubernetes/pkg/api/validation/events.go | 19 +- .../kubernetes/pkg/api/validation/name.go | 34 +- .../kubernetes/pkg/api/validation/schema.go | 15 +- .../pkg/api/validation/schema_test.go | 9 +- .../pkg/api/validation/validation.go | 1932 +- .../pkg/api/validation/validation_test.go | 1492 +- .../k8s.io/kubernetes/pkg/apimachinery/doc.go | 20 + .../pkg/apimachinery/registered/registered.go | 203 + .../registered/registered_test.go} | 43 +- .../kubernetes/pkg/apimachinery/types.go | 52 + .../apis/authorization/deep_copy_generated.go | 29 + .../pkg/apis/authorization/install/install.go | 128 + .../pkg/apis/authorization/register.go | 54 + .../pkg/apis/authorization/types.generated.go | 2281 + .../pkg/apis/authorization/types.go | 121 + .../apis/authorization/v1beta1/conversion.go | 30 + .../v1beta1/conversion_generated.go | 29 + .../v1beta1/deep_copy_generated.go | 29 + .../apis/authorization/v1beta1/defaults.go | 25 + .../apis/authorization/v1beta1/register.go | 48 + .../authorization/v1beta1/types.generated.go | 2414 + .../pkg/apis/authorization/v1beta1/types.go | 120 + .../v1beta1/types_swagger_doc_generated.go | 117 + .../authorization/validation/validation.go | 64 + .../validation/validation_test.go | 135 + .../componentconfig/deep_copy_generated.go | 29 + .../pkg/apis/componentconfig/helpers.go | 97 + .../pkg/apis/componentconfig/helpers_test.go | 71 + .../apis/componentconfig/install/install.go | 129 + .../componentconfig/install/install_test.go | 89 + .../pkg/apis/componentconfig/register.go | 53 + .../apis/componentconfig/types.generated.go | 8253 +++ .../pkg/apis/componentconfig/types.go | 516 + .../v1alpha1/conversion_generated.go | 234 + .../v1alpha1/deep_copy_generated.go | 131 + .../apis/componentconfig/v1alpha1/defaults.go | 99 + .../apis/componentconfig/v1alpha1/register.go | 43 + .../apis/componentconfig/v1alpha1/types.go | 129 + .../apis/extensions/deep_copy_generated.go | 1652 +- .../kubernetes/pkg/apis/extensions/helpers.go | 74 +- .../pkg/apis/extensions/install/install.go | 103 +- .../apis/extensions/install/install_test.go | 40 +- .../pkg/apis/extensions/register.go | 77 +- .../pkg/apis/extensions/types.generated.go | 21414 ++++--- .../kubernetes/pkg/apis/extensions/types.go | 411 +- .../pkg/apis/extensions/v1beta1/conversion.go | 387 +- .../v1beta1/conversion_generated.go | 3436 +- .../extensions/v1beta1/deep_copy_generated.go | 546 +- .../pkg/apis/extensions/v1beta1/defaults.go | 80 +- .../apis/extensions/v1beta1/defaults_test.go | 545 +- .../pkg/apis/extensions/v1beta1/register.go | 70 +- .../extensions/v1beta1/types.generated.go | 22646 ++++--- .../pkg/apis/extensions/v1beta1/types.go | 517 +- .../v1beta1/types_swagger_doc_generated.go | 265 +- .../apis/extensions/validation/validation.go | 810 +- .../extensions/validation/validation_test.go | 1166 +- .../pkg/apis/metrics/deep_copy_generated.go | 29 + .../pkg/apis/metrics/install/install.go | 129 + .../kubernetes/pkg/apis/metrics/register.go | 55 + .../pkg/apis/metrics/types.generated.go | 500 + .../kubernetes/pkg/apis/metrics/types.go | 29 + .../metrics/v1alpha1/conversion_generated.go | 96 + .../metrics/v1alpha1/deep_copy_generated.go | 57 + .../pkg/apis/metrics/v1alpha1/register.go | 46 + .../apis/metrics/v1alpha1/types.generated.go | 500 + .../pkg/apis/metrics/v1alpha1/types.go | 29 + .../kubernetes/pkg/client/cache/delta_fifo.go | 27 + .../pkg/client/cache/delta_fifo_test.go | 56 + .../pkg/client/cache/expiration_cache.go | 3 +- .../pkg/client/cache/expiration_cache_test.go | 7 +- .../kubernetes/pkg/client/cache/fifo.go | 30 + .../kubernetes/pkg/client/cache/fifo_test.go | 56 + .../kubernetes/pkg/client/cache/index.go | 2 +- .../kubernetes/pkg/client/cache/listers.go | 282 +- .../pkg/client/cache/listers_test.go | 224 +- .../kubernetes/pkg/client/cache/listwatch.go | 30 +- .../pkg/client/cache/listwatch_test.go | 26 +- .../kubernetes/pkg/client/cache/reflector.go | 101 +- .../pkg/client/cache/reflector_test.go | 86 +- .../kubernetes/pkg/client/cache/store.go | 8 +- .../pkg/client/cache/thread_safe_store.go | 2 +- .../internalclientset/clientset.go | 94 + .../internalclientset/clientset_adaption.go | 42 + .../kubernetes/pkg/client/metrics/metrics.go | 10 + .../kubernetes/pkg/client/transport/cache.go | 83 + .../pkg/client/transport/cache_test.go | 114 + .../kubernetes/pkg/client/transport/config.go | 81 + .../pkg/client/transport/round_trippers.go | 305 + .../client/transport/round_trippers_test.go | 101 + .../pkg/client/transport/transport.go | 138 + .../pkg/client/transport/transport_test.go | 204 + .../core/unversioned/componentstatus.go | 126 + .../generated/core/unversioned/configmap.go | 135 + .../generated/core/unversioned/core_client.go | 165 + .../typed/generated/core/unversioned/doc.go | 18 + .../generated/core/unversioned/endpoints.go | 135 + .../typed/generated/core/unversioned/event.go | 135 + .../core/unversioned/event_expansion.go | 157 + .../generated/core/unversioned/fake/doc.go | 18 + .../unversioned/fake/fake_componentstatus.go | 95 + .../core/unversioned/fake/fake_configmap.go | 102 + .../core/unversioned/fake/fake_core_client.go | 90 + .../core/unversioned/fake/fake_endpoints.go | 102 + .../core/unversioned/fake/fake_event.go | 102 + .../unversioned/fake/fake_event_expansion.go | 88 + .../core/unversioned/fake/fake_limitrange.go | 102 + .../core/unversioned/fake/fake_namespace.go | 104 + .../fake/fake_namespace_expansion.go | 37 + .../core/unversioned/fake/fake_node.go | 104 + .../unversioned/fake/fake_persistentvolume.go | 104 + .../fake/fake_persistentvolumeclaim.go | 112 + .../core/unversioned/fake/fake_pod.go | 112 + .../unversioned/fake/fake_pod_expansion.go | 46 + .../core/unversioned/fake/fake_podtemplate.go | 102 + .../fake/fake_replicationcontroller.go | 112 + .../unversioned/fake/fake_resourcequota.go | 112 + .../core/unversioned/fake/fake_secret.go | 102 + .../core/unversioned/fake/fake_service.go | 112 + .../fake/fake_service_expansion.go | 26 + .../unversioned/fake/fake_serviceaccount.go | 102 + .../core/unversioned/generated_expansion.go | 41 + .../generated/core/unversioned/limitrange.go | 135 + .../generated/core/unversioned/namespace.go | 139 + .../core/unversioned/namespace_expansion.go | 31 + .../typed/generated/core/unversioned/node.go | 139 + .../core/unversioned/persistentvolume.go | 139 + .../core/unversioned/persistentvolumeclaim.go | 149 + .../typed/generated/core/unversioned/pod.go | 149 + .../core/unversioned/pod_expansion.go | 38 + .../generated/core/unversioned/podtemplate.go | 135 + .../core/unversioned/replicationcontroller.go | 149 + .../core/unversioned/resourcequota.go | 149 + .../generated/core/unversioned/secret.go | 135 + .../generated/core/unversioned/service.go | 149 + .../core/unversioned/service_expansion.go | 41 + .../core/unversioned/serviceaccount.go | 135 + .../extensions/unversioned/daemonset.go | 150 + .../extensions/unversioned/deployment.go | 150 + .../unversioned/deployment_expansion.go | 29 + .../generated/extensions/unversioned/doc.go | 18 + .../unversioned/extensions_client.go | 125 + .../extensions/unversioned/fake/doc.go | 18 + .../unversioned/fake/fake_daemonset.go | 113 + .../unversioned/fake/fake_deployment.go | 113 + .../fake/fake_deployment_expansion.go | 33 + .../fake/fake_extensions_client.go | 58 + .../fake/fake_horizontalpodautoscaler.go | 113 + .../unversioned/fake/fake_ingress.go | 113 + .../extensions/unversioned/fake/fake_job.go | 113 + .../unversioned/fake/fake_replicaset.go | 113 + .../extensions/unversioned/fake/fake_scale.go | 23 + .../unversioned/fake/fake_scale_expansion.go | 46 + .../fake/fake_thirdpartyresource.go | 103 + .../unversioned/generated_expansion.go | 29 + .../unversioned/horizontalpodautoscaler.go | 150 + .../extensions/unversioned/ingress.go | 150 + .../generated/extensions/unversioned/job.go | 150 + .../extensions/unversioned/replicaset.go | 150 + .../generated/extensions/unversioned/scale.go | 42 + .../extensions/unversioned/scale_expansion.go | 65 + .../unversioned/thirdpartyresource.go | 136 + .../pkg/client/unversioned/client.go | 111 +- .../pkg/client/unversioned/client_test.go | 343 +- .../unversioned/clientcmd/api/helpers.go | 8 + .../clientcmd/api/latest/latest.go | 19 +- .../unversioned/clientcmd/api/register.go | 15 +- .../client/unversioned/clientcmd/api/types.go | 22 +- .../unversioned/clientcmd/api/types_test.go | 8 +- .../clientcmd/api/v1/conversion.go | 10 +- .../unversioned/clientcmd/api/v1/register.go | 17 +- .../unversioned/clientcmd/client_config.go | 53 +- .../clientcmd/client_config_test.go | 34 +- .../client/unversioned/clientcmd/loader.go | 31 +- .../unversioned/clientcmd/loader_test.go | 33 +- .../client/unversioned/clientcmd/overrides.go | 2 +- .../unversioned/clientcmd/validation.go | 30 +- .../unversioned/clientcmd/validation_test.go | 21 +- .../client/unversioned/componentstatuses.go | 11 +- .../pkg/client/unversioned/conditions.go | 114 +- .../pkg/client/unversioned/conditions_test.go | 71 + .../pkg/client/unversioned/configmap.go | 122 + .../client/unversioned/containerinfo_test.go | 6 +- .../pkg/client/unversioned/daemon_sets.go | 17 +- .../client/unversioned/daemon_sets_test.go | 70 +- .../pkg/client/unversioned/debugging.go | 142 - .../pkg/client/unversioned/deployment.go | 42 +- .../pkg/client/unversioned/deployment_test.go | 156 +- .../client/unversioned/discovery_client.go | 169 +- .../pkg/client/unversioned/endpoints.go | 21 +- .../pkg/client/unversioned/endpoints_test.go | 31 +- .../pkg/client/unversioned/events.go | 54 +- .../pkg/client/unversioned/events_test.go | 56 +- .../pkg/client/unversioned/extensions.go | 65 +- .../pkg/client/unversioned/fake/fake.go | 33 +- .../pkg/client/unversioned/helper.go | 411 +- .../unversioned/helper_blackbox_test.go | 82 +- .../pkg/client/unversioned/helper_test.go | 359 +- .../unversioned/horizontalpodautoscaler.go | 26 +- .../horizontalpodautoscaler_test.go | 68 +- .../unversioned/import_known_versions.go | 12 + .../pkg/client/unversioned/ingress.go | 36 +- .../pkg/client/unversioned/ingress_test.go | 72 +- .../kubernetes/pkg/client/unversioned/jobs.go | 27 +- .../pkg/client/unversioned/jobs_test.go | 70 +- .../pkg/client/unversioned/kubelet.go | 100 - .../pkg/client/unversioned/kubelet_test.go | 102 - .../pkg/client/unversioned/limit_ranges.go | 22 +- .../client/unversioned/limit_ranges_test.go | 93 +- .../pkg/client/unversioned/namespaces.go | 21 +- .../pkg/client/unversioned/namespaces_test.go | 62 +- .../pkg/client/unversioned/nodes.go | 26 +- .../pkg/client/unversioned/nodes_test.go | 68 +- .../unversioned/persistentvolume_test.go | 70 +- .../unversioned/persistentvolumeclaim.go | 23 +- .../unversioned/persistentvolumeclaim_test.go | 70 +- .../client/unversioned/persistentvolumes.go | 23 +- .../pkg/client/unversioned/pod_templates.go | 26 +- .../client/unversioned/pod_templates_test.go | 61 +- .../kubernetes/pkg/client/unversioned/pods.go | 32 +- .../pkg/client/unversioned/pods_test.go | 109 +- .../client/unversioned/podsecuritypolicy.go | 111 + .../unversioned/podsecuritypolicy_test.go | 138 + .../unversioned/portforward/portforward.go | 23 +- .../portforward/portforward_test.go | 83 +- .../remotecommand/remotecommand.go | 197 +- .../remotecommand/remotecommand_test.go | 71 +- .../client/unversioned/remotecommand/v1.go | 156 + .../client/unversioned/remotecommand/v2.go | 166 + .../pkg/client/unversioned/replica_sets.go | 100 + .../client/unversioned/replica_sets_test.go | 197 + .../unversioned/replication_controllers.go | 16 +- .../replication_controllers_test.go | 60 +- .../pkg/client/unversioned/request.go | 352 +- .../pkg/client/unversioned/request_test.go | 478 +- .../pkg/client/unversioned/resource_quotas.go | 16 +- .../unversioned/resource_quotas_test.go | 70 +- .../pkg/client/unversioned/restclient.go | 81 +- .../pkg/client/unversioned/restclient_test.go | 248 +- .../pkg/client/unversioned/scale.go | 17 +- .../pkg/client/unversioned/secrets.go | 17 +- .../client/unversioned/service_accounts.go | 17 +- .../pkg/client/unversioned/services.go | 32 +- .../pkg/client/unversioned/services_test.go | 143 +- .../client/unversioned/testclient/actions.go | 113 +- .../testclient/fake_componentstatuses.go | 6 +- .../unversioned/testclient/fake_configmaps.go | 78 + .../testclient/fake_daemon_sets.go | 11 +- .../testclient/fake_deployments.go | 33 +- .../unversioned/testclient/fake_endpoints.go | 10 +- .../unversioned/testclient/fake_events.go | 28 +- .../fake_horizontal_pod_autoscalers.go | 13 +- .../unversioned/testclient/fake_ingress.go | 20 +- .../unversioned/testclient/fake_jobs.go | 10 +- .../testclient/fake_limit_ranges.go | 10 +- .../unversioned/testclient/fake_namespaces.go | 10 +- .../unversioned/testclient/fake_nodes.go | 10 +- .../fake_persistent_volume_claims.go | 10 +- .../testclient/fake_persistent_volumes.go | 10 +- .../testclient/fake_pod_templates.go | 10 +- .../unversioned/testclient/fake_pods.go | 26 +- .../testclient/fake_podsecuritypolicy.go | 73 + .../testclient/fake_replica_sets.go | 83 + .../fake_replication_controllers.go | 10 +- .../testclient/fake_resource_quotas.go | 10 +- .../unversioned/testclient/fake_secrets.go | 10 +- .../testclient/fake_service_accounts.go | 10 +- .../unversioned/testclient/fake_services.go | 25 +- .../testclient/fake_thirdpartyresources.go | 83 + .../client/unversioned/testclient/fixture.go | 55 +- .../testclient/simple/simple_testclient.go | 228 + .../unversioned/testclient/testclient.go | 62 +- .../unversioned/testclient/testclient_test.go | 20 +- .../client/unversioned/thirdpartyresources.go | 100 + .../unversioned/thirdpartyresources_test.go | 185 + .../pkg/client/unversioned/transport.go | 217 +- .../pkg/client/unversioned/transport_test.go | 167 - .../pkg/client/unversioned/urlbackoff.go | 97 + .../pkg/client/unversioned/urlbackoff_test.go | 78 + .../kubernetes/pkg/conversion/converter.go | 152 +- .../pkg/conversion/converter_test.go | 220 +- .../kubernetes/pkg/conversion/decode.go | 152 - .../k8s.io/kubernetes/pkg/conversion/doc.go | 9 +- .../kubernetes/pkg/conversion/encode.go | 147 - .../k8s.io/kubernetes/pkg/conversion/error.go | 91 - .../kubernetes/pkg/conversion/helper.go | 39 + .../kubernetes/pkg/conversion/helper_test.go | 38 + .../k8s.io/kubernetes/pkg/conversion/meta.go | 133 - .../kubernetes/pkg/conversion/meta_test.go | 285 - .../pkg/conversion/queryparams/convert.go | 10 +- .../conversion/queryparams/convert_test.go | 15 +- .../kubernetes/pkg/conversion/scheme.go | 418 - .../credentialprovider/aws/aws_credentials.go | 163 + .../aws/aws_credentials_test.go | 108 + .../pkg/credentialprovider/config.go | 255 + .../pkg/credentialprovider/config_test.go | 225 + .../pkg/{tools => credentialprovider}/doc.go | 6 +- .../pkg/credentialprovider/gcp/doc.go | 19 + .../pkg/credentialprovider/gcp/jwt.go | 111 + .../pkg/credentialprovider/gcp/jwt_test.go | 127 + .../pkg/credentialprovider/gcp/metadata.go | 202 + .../credentialprovider/gcp/metadata_test.go | 347 + .../pkg/credentialprovider/keyring.go | 306 + .../pkg/credentialprovider/keyring_test.go | 476 + .../pkg/credentialprovider/plugins.go | 62 + .../pkg/credentialprovider/provider.go | 95 + .../pkg/credentialprovider/provider_test.go | 62 + .../kubernetes/pkg/fieldpath/fieldpath.go | 16 +- .../k8s.io/kubernetes/pkg/fields/selector.go | 10 + vendor/k8s.io/kubernetes/pkg/kubectl/apply.go | 44 +- .../kubernetes/pkg/kubectl/autoscale.go | 2 - .../kubernetes/pkg/kubectl/cmd/annotate.go | 64 +- .../pkg/kubectl/cmd/annotate_test.go | 37 +- .../kubernetes/pkg/kubectl/cmd/apiversions.go | 22 +- .../kubernetes/pkg/kubectl/cmd/apply.go | 59 +- .../kubernetes/pkg/kubectl/cmd/apply_test.go | 73 +- .../kubernetes/pkg/kubectl/cmd/attach.go | 58 +- .../kubernetes/pkg/kubectl/cmd/attach_test.go | 76 +- .../kubernetes/pkg/kubectl/cmd/autoscale.go | 52 +- .../kubernetes/pkg/kubectl/cmd/clusterinfo.go | 15 +- .../k8s.io/kubernetes/pkg/kubectl/cmd/cmd.go | 26 +- .../kubernetes/pkg/kubectl/cmd/cmd_test.go | 330 +- .../pkg/kubectl/cmd/config/config.go | 8 +- .../pkg/kubectl/cmd/config/config_test.go | 21 +- .../pkg/kubectl/cmd/config/create_authinfo.go | 3 +- .../pkg/kubectl/cmd/config/create_cluster.go | 6 +- .../pkg/kubectl/cmd/config/current_context.go | 67 + .../cmd/config/current_context_test.go | 90 + .../cmd/config/navigation_step_parser.go | 2 +- .../kubernetes/pkg/kubectl/cmd/config/view.go | 31 +- .../kubernetes/pkg/kubectl/cmd/convert.go | 24 +- .../kubernetes/pkg/kubectl/cmd/create.go | 106 +- .../pkg/kubectl/cmd/create_namespace.go | 76 + .../pkg/kubectl/cmd/create_namespace_test.go | 53 + .../pkg/kubectl/cmd/create_secret.go | 192 + .../pkg/kubectl/cmd/create_secret_test.go | 85 + .../kubernetes/pkg/kubectl/cmd/create_test.go | 12 +- .../kubernetes/pkg/kubectl/cmd/delete.go | 6 +- .../kubernetes/pkg/kubectl/cmd/delete_test.go | 32 +- .../kubernetes/pkg/kubectl/cmd/describe.go | 7 +- .../pkg/kubectl/cmd/describe_test.go | 2 +- .../kubernetes/pkg/kubectl/cmd/drain.go | 373 + .../kubernetes/pkg/kubectl/cmd/drain_test.go | 494 + .../k8s.io/kubernetes/pkg/kubectl/cmd/edit.go | 324 +- .../k8s.io/kubernetes/pkg/kubectl/cmd/exec.go | 2 +- .../kubernetes/pkg/kubectl/cmd/exec_test.go | 9 +- .../kubernetes/pkg/kubectl/cmd/explain.go | 58 +- .../kubernetes/pkg/kubectl/cmd/expose.go | 70 +- .../kubernetes/pkg/kubectl/cmd/expose_test.go | 96 +- .../k8s.io/kubernetes/pkg/kubectl/cmd/get.go | 88 +- .../kubernetes/pkg/kubectl/cmd/get_test.go | 99 +- .../kubernetes/pkg/kubectl/cmd/label.go | 36 +- .../kubernetes/pkg/kubectl/cmd/label_test.go | 10 +- .../k8s.io/kubernetes/pkg/kubectl/cmd/log.go | 243 - .../k8s.io/kubernetes/pkg/kubectl/cmd/logs.go | 206 + .../kubectl/cmd/{log_test.go => logs_test.go} | 59 +- .../kubernetes/pkg/kubectl/cmd/patch.go | 41 +- .../kubernetes/pkg/kubectl/cmd/patch_test.go | 4 +- .../pkg/kubectl/cmd/portforward_test.go | 13 +- .../kubernetes/pkg/kubectl/cmd/replace.go | 41 +- .../pkg/kubectl/cmd/replace_test.go | 8 +- .../pkg/kubectl/cmd/rollingupdate.go | 39 +- .../pkg/kubectl/cmd/rollout/rollout.go | 54 + .../kubectl/cmd/rollout/rollout_history.go | 122 + .../pkg/kubectl/cmd/rollout/rollout_pause.go | 118 + .../pkg/kubectl/cmd/rollout/rollout_resume.go | 116 + .../pkg/kubectl/cmd/rollout/rollout_undo.go | 111 + .../k8s.io/kubernetes/pkg/kubectl/cmd/run.go | 179 +- .../kubernetes/pkg/kubectl/cmd/run_test.go | 79 +- .../kubernetes/pkg/kubectl/cmd/scale.go | 49 +- .../k8s.io/kubernetes/pkg/kubectl/cmd/stop.go | 12 +- .../pkg/kubectl/cmd/util/clientcache.go | 69 +- .../pkg/kubectl/cmd/util/editor/editor.go | 41 +- .../pkg/kubectl/cmd/util/factory.go | 467 +- .../pkg/kubectl/cmd/util/factory_test.go | 12 +- .../pkg/kubectl/cmd/util/helpers.go | 164 +- .../pkg/kubectl/cmd/util/helpers_test.go | 64 +- .../pkg/kubectl/cmd/util/printing.go | 22 +- .../pkg/kubectl/custom_column_printer.go | 23 +- .../pkg/kubectl/custom_column_printer_test.go | 6 +- .../k8s.io/kubernetes/pkg/kubectl/describe.go | 593 +- .../kubernetes/pkg/kubectl/describe_test.go | 87 +- .../k8s.io/kubernetes/pkg/kubectl/explain.go | 30 +- .../k8s.io/kubernetes/pkg/kubectl/generate.go | 59 + .../k8s.io/kubernetes/pkg/kubectl/history.go | 134 + .../k8s.io/kubernetes/pkg/kubectl/kubectl.go | 87 +- .../kubernetes/pkg/kubectl/namespace.go | 79 + .../kubernetes/pkg/kubectl/namespace_test.go | 61 + .../pkg/kubectl/proxy_server_test.go | 12 +- .../pkg/kubectl/resource/builder.go | 158 +- .../pkg/kubectl/resource/builder_test.go | 257 +- .../kubernetes/pkg/kubectl/resource/helper.go | 75 +- .../pkg/kubectl/resource/helper_test.go | 68 +- .../pkg/kubectl/resource/interfaces.go | 2 +- .../kubernetes/pkg/kubectl/resource/mapper.go | 54 +- .../kubernetes/pkg/kubectl/resource/result.go | 20 +- .../pkg/kubectl/resource/selector.go | 8 +- .../pkg/kubectl/resource/visitor.go | 17 +- .../pkg/kubectl/resource_printer.go | 775 +- .../pkg/kubectl/resource_printer_test.go | 177 +- .../k8s.io/kubernetes/pkg/kubectl/rollback.go | 118 + .../kubernetes/pkg/kubectl/rolling_updater.go | 88 +- .../pkg/kubectl/rolling_updater_test.go | 370 +- vendor/k8s.io/kubernetes/pkg/kubectl/run.go | 453 +- .../k8s.io/kubernetes/pkg/kubectl/run_test.go | 256 + vendor/k8s.io/kubernetes/pkg/kubectl/scale.go | 287 +- .../kubernetes/pkg/kubectl/scale_test.go | 326 +- .../k8s.io/kubernetes/pkg/kubectl/secret.go | 238 + .../pkg/kubectl/secret_for_docker_registry.go | 131 + .../secret_for_docker_registry_test.go | 81 + .../kubernetes/pkg/kubectl/secret_test.go | 109 + .../k8s.io/kubernetes/pkg/kubectl/service.go | 80 +- .../kubernetes/pkg/kubectl/service_test.go | 121 +- .../pkg/kubectl/sorted_event_list_test.go | 3 + .../kubernetes/pkg/kubectl/sorting_printer.go | 78 +- .../pkg/kubectl/sorting_printer_test.go | 67 +- vendor/k8s.io/kubernetes/pkg/kubectl/stop.go | 291 +- .../kubernetes/pkg/kubectl/stop_test.go | 316 +- .../pkg/kubectl/testing/types.generated.go | 572 +- .../kubernetes/pkg/kubectl/testing/types.go | 2 +- .../k8s.io/kubernetes/pkg/kubectl/version.go | 2 +- .../k8s.io/kubernetes/pkg/kubelet/qos/doc.go | 25 + .../pkg/kubelet/qos/memory_policy.go | 75 + .../pkg/kubelet/qos/memory_policy_test.go | 187 + .../kubernetes/pkg/kubelet/qos/util/qos.go | 9 +- .../k8s.io/kubernetes/pkg/labels/selector.go | 145 +- .../kubernetes/pkg/labels/selector_test.go | 132 +- .../k8s.io/kubernetes/pkg/master/ports/doc.go | 19 + .../kubernetes/pkg/master/ports/ports.go | 40 + vendor/k8s.io/kubernetes/pkg/runtime/codec.go | 165 +- .../pkg/runtime/conversion_generator.go | 211 +- .../kubernetes/pkg/runtime/conversion_test.go | 26 +- .../pkg/runtime/deep_copy_generator.go | 5 +- .../k8s.io/kubernetes/pkg/runtime/embedded.go | 124 + .../kubernetes/pkg/runtime/embedded_test.go | 176 +- vendor/k8s.io/kubernetes/pkg/runtime/error.go | 73 +- .../kubernetes/pkg/runtime/extension.go | 16 +- .../k8s.io/kubernetes/pkg/runtime/helper.go | 185 +- .../kubernetes/pkg/runtime/helper_test.go | 201 +- .../kubernetes/pkg/runtime/interfaces.go | 158 +- .../kubernetes/pkg/runtime/protobuf/doc.go | 18 + .../pkg/runtime/protobuf/protobuf.go | 158 + .../k8s.io/kubernetes/pkg/runtime/register.go | 64 + .../k8s.io/kubernetes/pkg/runtime/scheme.go | 725 +- .../kubernetes/pkg/runtime/scheme_test.go | 583 +- .../pkg/runtime/serializer/codec_factory.go | 176 + .../serializer/codec_test.go} | 305 +- .../pkg/runtime/serializer/json/json.go | 191 + .../pkg/runtime/serializer/json/json_test.go | 268 + .../pkg/runtime/serializer/json/meta.go | 61 + .../pkg/runtime/serializer/json/meta_test.go | 45 + .../serializer/recognizer/recognizer.go | 79 + .../serializer/recognizer/recognizer_test.go | 57 + .../serializer/versioning/versioning.go | 251 + .../serializer/versioning/versioning_test.go | 300 + .../pkg/runtime/serializer/yaml/yaml.go | 46 + .../pkg/runtime/swagger_doc_generator.go | 9 +- vendor/k8s.io/kubernetes/pkg/runtime/types.go | 55 +- .../kubernetes/pkg/runtime/unstructured.go | 69 +- .../pkg/runtime/unstructured_test.go | 12 +- .../unversioned_test.go | 16 +- .../k8s.io/kubernetes/pkg/storage/cacher.go | 195 +- .../kubernetes/pkg/storage/cacher_test.go | 549 +- .../k8s.io/kubernetes/pkg/storage/errors.go | 45 + .../pkg/storage/etcd/etcd_helper.go | 252 +- .../pkg/storage/etcd/etcd_helper_test.go | 755 +- .../pkg/storage/etcd/etcd_watcher.go | 181 +- .../pkg/storage/etcd/etcd_watcher_test.go | 617 +- .../{tools => storage/etcd}/etcdtest/doc.go | 0 .../etcd}/etcdtest/etcdtest.go | 0 .../etcd}/metrics/metrics.go | 9 + .../{etcd_test_util.go => testing/utils.go} | 54 +- .../kubernetes/pkg/storage/etcd/util/doc.go | 19 + .../pkg/storage/etcd/{ => util}/etcd_util.go | 66 +- .../pkg/storage/etcd/util/etcd_util_test.go | 122 + .../kubernetes/pkg/storage/interfaces.go | 24 +- .../pkg/storage/testing/types.generated.go | 340 +- .../kubernetes/pkg/storage/testing/types.go | 2 +- .../kubernetes/pkg/storage/testing/utils.go | 61 + vendor/k8s.io/kubernetes/pkg/storage/util.go | 36 +- .../kubernetes/pkg/storage/util_test.go | 7 +- .../kubernetes/pkg/storage/watch_cache.go | 55 +- .../pkg/storage/watch_cache_test.go | 90 +- .../kubernetes/pkg/tools/fake_etcd_client.go | 352 - .../k8s.io/kubernetes/pkg/tools/interfaces.go | 48 - .../util/{atomic_value.go => atomic/value.go} | 26 +- .../value_test.go} | 43 +- vendor/k8s.io/kubernetes/pkg/util/backoff.go | 12 +- .../kubernetes/pkg/util/backoff_test.go | 20 +- .../kubernetes/pkg/util/bandwidth/linux.go | 6 + .../pkg/util/bandwidth/linux_test.go | 16 +- .../k8s.io/kubernetes/pkg/util/bool_flag.go | 5 +- .../k8s.io/kubernetes/pkg/util/chmod/chmod.go | 39 + .../k8s.io/kubernetes/pkg/util/chmod/doc.go | 19 + .../k8s.io/kubernetes/pkg/util/chown/chown.go | 39 + .../k8s.io/kubernetes/pkg/util/chown/doc.go | 18 + vendor/k8s.io/kubernetes/pkg/util/clock.go | 116 +- .../k8s.io/kubernetes/pkg/util/clock_test.go | 62 +- .../kubernetes/pkg/util/config/config.go | 4 +- vendor/k8s.io/kubernetes/pkg/util/crlf.go | 57 + .../k8s.io/kubernetes/pkg/util/dbus/dbus.go | 2 +- .../kubernetes/pkg/util/deadlock-detector.go | 120 + .../pkg/util/deadlock-detector_test.go | 127 + .../pkg/util/deployment/deployment.go | 248 +- .../pkg/util/deployment/deployment_test.go | 344 + vendor/k8s.io/kubernetes/pkg/util/env.go | 51 + vendor/k8s.io/kubernetes/pkg/util/env_test.go | 68 + .../k8s.io/kubernetes/pkg/util/exec/exec.go | 35 +- .../kubernetes/pkg/util/exec/exec_test.go | 9 + .../kubernetes/pkg/util/exec/fake_exec.go | 6 +- .../pkg/util/fielderrors/fielderrors.go | 207 - .../pkg/util/fielderrors/fielderrors_test.go | 180 - .../kubernetes/pkg/util/flock/flock_other.go | 24 + .../kubernetes/pkg/util/flock/flock_unix.go | 51 + .../kubernetes/pkg/util/{ => hash}/hash.go | 2 +- .../pkg/util/{ => hash}/hash_test.go | 2 +- .../pkg/util/httpstream/httpstream.go | 61 +- .../pkg/util/httpstream/httpstream_test.go | 120 + .../pkg/util/httpstream/spdy/connection.go | 4 +- .../pkg/util/httpstream/spdy/roundtripper.go | 5 +- .../util/httpstream/spdy/roundtripper_test.go | 21 +- .../pkg/util/httpstream/spdy/upgrade.go | 10 +- .../pkg/util/httpstream/spdy/upgrade_test.go | 3 +- .../kubernetes/pkg/util/integer/integer.go | 45 + .../pkg/util/integer/integer_test.go | 143 + .../kubernetes/pkg/util/intstr/intstr.go | 115 + .../kubernetes/pkg/util/intstr/intstr_test.go | 111 + vendor/k8s.io/kubernetes/pkg/util/io/io.go | 9 +- .../k8s.io/kubernetes/pkg/util/io/io_test.go | 14 +- .../k8s.io/kubernetes/pkg/util/io/writer.go | 9 +- .../kubernetes/pkg/util/iptables/iptables.go | 34 +- .../pkg/util/iptables/iptables_test.go | 6 +- .../pkg/util/iptables/testing/fake.go | 75 + .../kubernetes/pkg/util/jsonpath/jsonpath.go | 21 +- .../pkg/util/jsonpath/jsonpath_test.go | 29 +- .../kubernetes/pkg/util/jsonpath/node.go | 4 +- .../kubernetes/pkg/util/jsonpath/parser.go | 14 +- .../pkg/util/jsonpath/parser_test.go | 40 +- .../kubernetes/pkg/util/keymutex/keymutex.go | 82 + .../pkg/util/keymutex/keymutex_test.go | 111 + .../k8s.io/kubernetes/pkg/util/labels/doc.go | 18 + .../kubernetes/pkg/util/labels/labels.go | 95 + .../kubernetes/pkg/util/labels/labels_test.go | 60 + vendor/k8s.io/kubernetes/pkg/util/logs.go | 3 +- .../k8s.io/kubernetes/pkg/util/mount/fake.go | 58 +- .../k8s.io/kubernetes/pkg/util/mount/mount.go | 61 +- .../kubernetes/pkg/util/mount/mount_linux.go | 74 + .../pkg/util/mount/mount_unsupported.go | 8 + .../pkg/util/mount/nsenter_mount.go | 1 + .../util/mount/safe_format_and_mount_test.go | 102 +- .../kubernetes/pkg/util/{ => net}/http.go | 22 +- .../kubernetes/pkg/util/net/interface.go | 278 + .../kubernetes/pkg/util/net/interface_test.go | 300 + .../pkg/util/{ => net}/port_range.go | 10 +- .../pkg/util/{ => net}/port_range_test.go | 2 +- .../pkg/util/{ => net}/port_split.go | 2 +- .../pkg/util/{ => net}/port_split_test.go | 2 +- .../kubernetes/pkg/util/oom/oom_linux.go | 40 +- .../util/operationmanager/operationmanager.go | 103 - .../operationmanager/operationmanager_test.go | 159 - .../kubernetes/pkg/util/parsers/parsers.go | 36 + vendor/k8s.io/kubernetes/pkg/util/pod/doc.go | 18 + vendor/k8s.io/kubernetes/pkg/util/pod/pod.go | 30 + .../kubernetes/pkg/util/procfs/procfs.go | 12 +- .../kubernetes/pkg/util/procfs/procfs_fake.go | 10 +- .../pkg/util/procfs/procfs_interface.go | 4 +- .../k8s.io/kubernetes/pkg/util/proxy/dial.go | 6 +- .../kubernetes/pkg/util/proxy/transport.go | 4 +- .../pkg/util/proxy/transport_test.go | 3 +- .../k8s.io/kubernetes/pkg/util/rand/rand.go | 25 +- .../kubernetes/pkg/util/rand/rand_test.go | 21 + .../pkg/util/resource_container_linux.go | 11 +- .../kubernetes/pkg/util/runtime/runtime.go | 78 + .../pkg/util/runtime/runtime_test.go | 69 + .../k8s.io/kubernetes/pkg/util/selinux/doc.go | 18 + .../latest/doc.go => util/selinux/selinux.go} | 16 +- .../pkg/util/selinux/selinux_linux.go | 34 + .../pkg/util/selinux/selinux_unsupported.go | 26 + .../k8s.io/kubernetes/pkg/util/sets/byte.go | 194 + vendor/k8s.io/kubernetes/pkg/util/sets/doc.go | 20 + .../k8s.io/kubernetes/pkg/util/sets/empty.go | 23 + vendor/k8s.io/kubernetes/pkg/util/sets/int.go | 194 + .../k8s.io/kubernetes/pkg/util/sets/int64.go | 194 + .../pkg/util/sets/{set.go => string.go} | 76 +- .../kubernetes/pkg/util/sets/types/types.go | 30 + vendor/k8s.io/kubernetes/pkg/util/ssh.go | 365 - vendor/k8s.io/kubernetes/pkg/util/ssh_test.go | 245 - .../pkg/util/strategicpatch/patch.go | 241 +- .../pkg/util/strategicpatch/patch_test.go | 634 +- .../pkg/util/{ => strings}/escape.go | 15 +- .../kubernetes/pkg/util/strings/strings.go | 47 + .../pkg/util/strings/strings_test.go | 54 + .../kubernetes/pkg/util/sysctl/sysctl.go | 5 + .../pkg/util/{ => testing}/fake_handler.go | 4 +- .../util/{ => testing}/fake_handler_test.go | 20 +- .../kubernetes/pkg/util/testing/tmpdir.go | 44 + vendor/k8s.io/kubernetes/pkg/util/throttle.go | 82 +- .../kubernetes/pkg/util/throttle_test.go | 72 +- vendor/k8s.io/kubernetes/pkg/util/util.go | 474 +- .../k8s.io/kubernetes/pkg/util/util_test.go | 513 - vendor/k8s.io/kubernetes/pkg/util/uuid.go | 21 +- .../pkg/util/validation/field/errors.go | 228 + .../pkg/util/validation/field/errors_test.go | 134 + .../pkg/util/validation/field/path.go | 91 + .../pkg/util/validation/field/path_test.go | 123 + .../pkg/util/validation/validation.go | 30 + .../pkg/util/validation/validation_test.go | 59 + .../k8s.io/kubernetes/pkg/util/wait/wait.go | 95 +- .../kubernetes/pkg/util/wait/wait_test.go | 219 +- .../kubernetes/pkg/util/wsstream/conn.go | 10 +- .../kubernetes/pkg/util/wsstream/conn_test.go | 12 +- .../kubernetes/pkg/util/wsstream/stream.go | 4 +- .../pkg/util/wsstream/stream_test.go | 45 +- .../kubernetes/pkg/util/yaml/decoder.go | 10 +- .../kubernetes/pkg/util/yaml/decoder_test.go | 2 +- vendor/k8s.io/kubernetes/pkg/version/base.go | 2 +- .../k8s.io/kubernetes/pkg/version/semver.go | 50 + .../kubernetes/pkg/version/semver_test.go | 47 + .../kubernetes/pkg/version/verflag/verflag.go | 2 + .../k8s.io/kubernetes/pkg/watch/iowatcher.go | 7 +- .../kubernetes/pkg/watch/json/decoder.go | 2 +- .../kubernetes/pkg/watch/json/decoder_test.go | 6 +- .../kubernetes/pkg/watch/json/encoder.go | 4 +- .../k8s.io/kubernetes/pkg/watch/json/types.go | 4 +- vendor/k8s.io/kubernetes/pkg/watch/mux.go | 5 +- .../k8s.io/kubernetes/pkg/watch/mux_test.go | 7 +- .../k8s.io/kubernetes/pkg/watch/watch_test.go | 4 +- vendor/manifest | 216 +- 844 files changed, 191879 insertions(+), 82566 deletions(-) create mode 100644 vendor/github.com/blang/semver/LICENSE create mode 100644 vendor/github.com/blang/semver/README.md create mode 100644 vendor/github.com/blang/semver/examples/main.go create mode 100644 vendor/github.com/blang/semver/json.go create mode 100644 vendor/github.com/blang/semver/json_test.go create mode 100644 vendor/github.com/blang/semver/range.go create mode 100644 vendor/github.com/blang/semver/range_test.go create mode 100644 vendor/github.com/blang/semver/semver.go create mode 100644 vendor/github.com/blang/semver/semver_test.go create mode 100644 vendor/github.com/blang/semver/sort.go create mode 100644 vendor/github.com/blang/semver/sort_test.go create mode 100644 vendor/github.com/blang/semver/sql.go create mode 100644 vendor/github.com/blang/semver/sql_test.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/filters/parse.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/filters/parse_test.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/kernel/kernel.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/kernel/kernel_test.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/kernel/kernel_windows.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/kernel/uname_linux.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/kernel/uname_unsupported.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_linux.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_test.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_windows.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/parsers.go create mode 100644 vendor/github.com/docker/docker/pkg/parsers/parsers_test.go create mode 100644 vendor/github.com/docker/go-units/CONTRIBUTING.md create mode 100644 vendor/github.com/docker/go-units/LICENSE.code create mode 100644 vendor/github.com/docker/go-units/LICENSE.docs create mode 100644 vendor/github.com/docker/go-units/MAINTAINERS create mode 100644 vendor/github.com/docker/go-units/README.md create mode 100644 vendor/github.com/docker/go-units/circle.yml create mode 100644 vendor/github.com/docker/go-units/duration.go create mode 100644 vendor/github.com/docker/go-units/duration_test.go create mode 100644 vendor/github.com/docker/go-units/size.go create mode 100644 vendor/github.com/docker/go-units/size_test.go create mode 100644 vendor/github.com/docker/go-units/ulimit.go create mode 100644 vendor/github.com/docker/go-units/ulimit_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_unsupported.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/apply_raw.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuacct.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/fs_unsupported.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/name.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/perf_event.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/pids.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/pids_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/stats_util_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/util_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/stats.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_nosystemd.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_systemd.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/utils.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/cgroups/utils_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/blkio_device.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_unix.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_unsupported.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_windows.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/config.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/config_unix.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/config_unix_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/config_windows_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/device.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/device_defaults.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/hugepage_limit.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/interface_priority_map.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/mount.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall_unsupported.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_unix.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_unsupported.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/network.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/configs/validate/config.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/proc.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/setns_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_arm.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/utils/utils_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/utils/utils_unix.go create mode 100644 vendor/github.com/ugorji/go/codec/fast-path.not.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/api/latest/latest.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/meta/errors.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/meta/help.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/meta/help_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/meta/multirestmapper.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/meta/multirestmapper_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/pod/util.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/pod/util_test.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/api/registered/registered.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/resource/quantity_proto.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/resource/scale_int.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/resource/scale_int_test.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/api/rest/create_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/rest/export.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/api/rest/update_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/serialization_proto_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/testing/conversion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/unversioned/group_version.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/unversioned/group_version_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/unversioned/helpers.go rename vendor/k8s.io/kubernetes/pkg/{apis/extensions => api/unversioned}/helpers_test.go (70%) create mode 100644 vendor/k8s.io/kubernetes/pkg/api/unversioned/register.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/unversioned/time_proto.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/unversioned/validation/validation.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/unversioned/well_known_labels.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apimachinery/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apimachinery/registered/registered.go rename vendor/k8s.io/kubernetes/pkg/{api/latest/latest_test.go => apimachinery/registered/registered_test.go} (57%) create mode 100644 vendor/k8s.io/kubernetes/pkg/apimachinery/types.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/deep_copy_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/install/install.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/register.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/types.generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/types.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/conversion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/conversion_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/deep_copy_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/defaults.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/register.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types.generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/validation/validation.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/authorization/validation/validation_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/deep_copy_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/install/install.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/install/install_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/register.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/types.generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/types.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/conversion_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/deep_copy_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/defaults.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/register.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/types.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/deep_copy_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/install/install.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/register.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/types.generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/types.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/conversion_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/deep_copy_generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/register.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/types.generated.go create mode 100644 vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/types.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/clientset.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/clientset_adaption.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/transport/cache.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/transport/cache_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/transport/config.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/transport/round_trippers.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/transport/round_trippers_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/transport/transport.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/transport/transport_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/componentstatus.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/configmap.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/core_client.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/endpoints.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_componentstatus.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_configmap.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_core_client.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_endpoints.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_event.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_event_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_limitrange.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_namespace.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_namespace_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_node.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_persistentvolume.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_persistentvolumeclaim.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_pod.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_pod_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_podtemplate.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_replicationcontroller.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_resourcequota.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_secret.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_service.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_service_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_serviceaccount.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/generated_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/limitrange.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/namespace.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/namespace_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/node.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/persistentvolume.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/persistentvolumeclaim.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/pod.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/pod_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/podtemplate.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/replicationcontroller.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/resourcequota.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/secret.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/service.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/service_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/serviceaccount.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/daemonset.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/deployment.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/deployment_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/extensions_client.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_daemonset.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_deployment.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_deployment_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_extensions_client.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_ingress.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_job.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_replicaset.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_scale.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_scale_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_thirdpartyresource.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/generated_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/ingress.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/job.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/replicaset.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/scale.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/scale_expansion.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/thirdpartyresource.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/conditions_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/configmap.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/debugging.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/kubelet.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/kubelet_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/podsecuritypolicy.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/podsecuritypolicy_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/v1.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/v2.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/replica_sets.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/replica_sets_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_configmaps.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_podsecuritypolicy.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_replica_sets.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_thirdpartyresources.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/simple/simple_testclient.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/thirdpartyresources.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/thirdpartyresources_test.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/transport_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/urlbackoff.go create mode 100644 vendor/k8s.io/kubernetes/pkg/client/unversioned/urlbackoff_test.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/conversion/decode.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/conversion/encode.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/conversion/error.go create mode 100644 vendor/k8s.io/kubernetes/pkg/conversion/helper.go create mode 100644 vendor/k8s.io/kubernetes/pkg/conversion/helper_test.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/conversion/meta.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/conversion/meta_test.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/conversion/scheme.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/aws/aws_credentials.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/aws/aws_credentials_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/config.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/config_test.go rename vendor/k8s.io/kubernetes/pkg/{tools => credentialprovider}/doc.go (77%) create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/jwt.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/jwt_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/metadata.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/metadata_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/keyring.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/keyring_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/plugins.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/provider.go create mode 100644 vendor/k8s.io/kubernetes/pkg/credentialprovider/provider_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/current_context.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/current_context_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_namespace.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_namespace_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_secret.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_secret_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/drain.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/drain_test.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/log.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs.go rename vendor/k8s.io/kubernetes/pkg/kubectl/cmd/{log_test.go => logs_test.go} (58%) create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_history.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_pause.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_resume.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_undo.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/history.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/namespace.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/namespace_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/rollback.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/secret.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/secret_for_docker_registry.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/secret_for_docker_registry_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubectl/secret_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubelet/qos/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy.go create mode 100644 vendor/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/master/ports/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/master/ports/ports.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/embedded.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/protobuf/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/protobuf/protobuf.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/register.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/codec_factory.go rename vendor/k8s.io/kubernetes/pkg/{conversion/scheme_test.go => runtime/serializer/codec_test.go} (55%) create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/json.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/json_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/meta.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/meta_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/recognizer/recognizer.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/recognizer/recognizer_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/versioning/versioning.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/versioning/versioning_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/runtime/serializer/yaml/yaml.go rename vendor/k8s.io/kubernetes/pkg/{conversion => runtime}/unversioned_test.go (87%) create mode 100644 vendor/k8s.io/kubernetes/pkg/storage/errors.go rename vendor/k8s.io/kubernetes/pkg/{tools => storage/etcd}/etcdtest/doc.go (100%) rename vendor/k8s.io/kubernetes/pkg/{tools => storage/etcd}/etcdtest/etcdtest.go (100%) rename vendor/k8s.io/kubernetes/pkg/{tools => storage/etcd}/metrics/metrics.go (93%) rename vendor/k8s.io/kubernetes/pkg/storage/etcd/{etcd_test_util.go => testing/utils.go} (71%) create mode 100644 vendor/k8s.io/kubernetes/pkg/storage/etcd/util/doc.go rename vendor/k8s.io/kubernetes/pkg/storage/etcd/{ => util}/etcd_util.go (61%) create mode 100644 vendor/k8s.io/kubernetes/pkg/storage/etcd/util/etcd_util_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/storage/testing/utils.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/tools/fake_etcd_client.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/tools/interfaces.go rename vendor/k8s.io/kubernetes/pkg/util/{atomic_value.go => atomic/value.go} (64%) rename vendor/k8s.io/kubernetes/pkg/util/{atomic_value_test.go => atomic/value_test.go} (62%) create mode 100644 vendor/k8s.io/kubernetes/pkg/util/chmod/chmod.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/chmod/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/chown/chown.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/chown/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/crlf.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/deadlock-detector.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/deadlock-detector_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/deployment/deployment_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/env.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/env_test.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/util/fielderrors/fielderrors.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/util/fielderrors/fielderrors_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/flock/flock_other.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/flock/flock_unix.go rename vendor/k8s.io/kubernetes/pkg/util/{ => hash}/hash.go (98%) rename vendor/k8s.io/kubernetes/pkg/util/{ => hash}/hash_test.go (99%) create mode 100644 vendor/k8s.io/kubernetes/pkg/util/httpstream/httpstream_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/integer/integer.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/integer/integer_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/intstr/intstr.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/intstr/intstr_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/iptables/testing/fake.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/keymutex/keymutex.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/keymutex/keymutex_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/labels/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/labels/labels.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/labels/labels_test.go rename vendor/k8s.io/kubernetes/pkg/util/{ => net}/http.go (86%) create mode 100644 vendor/k8s.io/kubernetes/pkg/util/net/interface.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/net/interface_test.go rename vendor/k8s.io/kubernetes/pkg/util/{ => net}/port_range.go (92%) rename vendor/k8s.io/kubernetes/pkg/util/{ => net}/port_range_test.go (99%) rename vendor/k8s.io/kubernetes/pkg/util/{ => net}/port_split.go (99%) rename vendor/k8s.io/kubernetes/pkg/util/{ => net}/port_split_test.go (99%) delete mode 100644 vendor/k8s.io/kubernetes/pkg/util/operationmanager/operationmanager.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/util/operationmanager/operationmanager_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/parsers/parsers.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/pod/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/pod/pod.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/runtime/runtime.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/runtime/runtime_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/selinux/doc.go rename vendor/k8s.io/kubernetes/pkg/{api/latest/doc.go => util/selinux/selinux.go} (65%) create mode 100644 vendor/k8s.io/kubernetes/pkg/util/selinux/selinux_linux.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/selinux/selinux_unsupported.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/sets/byte.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/sets/doc.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/sets/empty.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/sets/int.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/sets/int64.go rename vendor/k8s.io/kubernetes/pkg/util/sets/{set.go => string.go} (70%) create mode 100644 vendor/k8s.io/kubernetes/pkg/util/sets/types/types.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/util/ssh.go delete mode 100644 vendor/k8s.io/kubernetes/pkg/util/ssh_test.go rename vendor/k8s.io/kubernetes/pkg/util/{ => strings}/escape.go (73%) create mode 100644 vendor/k8s.io/kubernetes/pkg/util/strings/strings.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/strings/strings_test.go rename vendor/k8s.io/kubernetes/pkg/util/{ => testing}/fake_handler.go (96%) rename vendor/k8s.io/kubernetes/pkg/util/{ => testing}/fake_handler_test.go (91%) create mode 100644 vendor/k8s.io/kubernetes/pkg/util/testing/tmpdir.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/validation/field/errors_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/validation/field/path.go create mode 100644 vendor/k8s.io/kubernetes/pkg/util/validation/field/path_test.go create mode 100644 vendor/k8s.io/kubernetes/pkg/version/semver.go create mode 100644 vendor/k8s.io/kubernetes/pkg/version/semver_test.go diff --git a/probe/kubernetes/client.go b/probe/kubernetes/client.go index 4f527c315..db8ba601b 100644 --- a/probe/kubernetes/client.go +++ b/probe/kubernetes/client.go @@ -9,7 +9,7 @@ import ( "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/wait" ) // These constants are keys used in node metadata @@ -41,7 +41,7 @@ func runReflectorUntil(r *cache.Reflector, resyncPeriod time.Duration, stopCh <- log.Errorf("Kubernetes reflector: %v", err) } } - go util.Until(loggingListAndWatch, resyncPeriod, stopCh) + go wait.Until(loggingListAndWatch, resyncPeriod, stopCh) } // NewClient returns a usable Client. Don't forget to Stop it. diff --git a/vendor/github.com/blang/semver/LICENSE b/vendor/github.com/blang/semver/LICENSE new file mode 100644 index 000000000..5ba5c86fc --- /dev/null +++ b/vendor/github.com/blang/semver/LICENSE @@ -0,0 +1,22 @@ +The MIT License + +Copyright (c) 2014 Benedikt Lang + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/vendor/github.com/blang/semver/README.md b/vendor/github.com/blang/semver/README.md new file mode 100644 index 000000000..4399639e2 --- /dev/null +++ b/vendor/github.com/blang/semver/README.md @@ -0,0 +1,191 @@ +semver for golang [![Build Status](https://drone.io/github.com/blang/semver/status.png)](https://drone.io/github.com/blang/semver/latest) [![GoDoc](https://godoc.org/github.com/blang/semver?status.png)](https://godoc.org/github.com/blang/semver) [![Coverage Status](https://img.shields.io/coveralls/blang/semver.svg)](https://coveralls.io/r/blang/semver?branch=master) +====== + +semver is a [Semantic Versioning](http://semver.org/) library written in golang. It fully covers spec version `2.0.0`. + +Usage +----- +```bash +$ go get github.com/blang/semver +``` +Note: Always vendor your dependencies or fix on a specific version tag. + +```go +import github.com/blang/semver +v1, err := semver.Make("1.0.0-beta") +v2, err := semver.Make("2.0.0-beta") +v1.Compare(v2) +``` + +Also check the [GoDocs](http://godoc.org/github.com/blang/semver). + +Why should I use this lib? +----- + +- Fully spec compatible +- No reflection +- No regex +- Fully tested (Coverage >99%) +- Readable parsing/validation errors +- Fast (See [Benchmarks](#benchmarks)) +- Only Stdlib +- Uses values instead of pointers +- Many features, see below + + +Features +----- + +- Parsing and validation at all levels +- Comparator-like comparisons +- Compare Helper Methods +- InPlace manipulation +- Ranges `>=1.0.0 <2.0.0 || >=3.0.0 !3.0.1-beta.1` +- Sortable (implements sort.Interface) +- database/sql compatible (sql.Scanner/Valuer) +- encoding/json compatible (json.Marshaler/Unmarshaler) + +Ranges +------ + +A `Range` is a set of conditions which specify which versions satisfy the range. + +A condition is composed of an operator and a version. The supported operators are: + +- `<1.0.0` Less than `1.0.0` +- `<=1.0.0` Less than or equal to `1.0.0` +- `>1.0.0` Greater than `1.0.0` +- `>=1.0.0` Greater than or equal to `1.0.0` +- `1.0.0`, `=1.0.0`, `==1.0.0` Equal to `1.0.0` +- `!1.0.0`, `!=1.0.0` Not equal to `1.0.0`. Excludes version `1.0.0`. + +A `Range` can link multiple `Ranges` separated by space: + +Ranges can be linked by logical AND: + + - `>1.0.0 <2.0.0` would match between both ranges, so `1.1.1` and `1.8.7` but not `1.0.0` or `2.0.0` + - `>1.0.0 <3.0.0 !2.0.3-beta.2` would match every version between `1.0.0` and `3.0.0` except `2.0.3-beta.2` + +Ranges can also be linked by logical OR: + + - `<2.0.0 || >=3.0.0` would match `1.x.x` and `3.x.x` but not `2.x.x` + +AND has a higher precedence than OR. It's not possible to use brackets. + +Ranges can be combined by both AND and OR + + - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1` + +Range usage: + +``` +v, err := semver.Parse("1.2.3") +range, err := semver.ParseRange(">1.0.0 <2.0.0 || >=3.0.0") +if range(v) { + //valid +} + +``` + +Example +----- + +Have a look at full examples in [examples/main.go](examples/main.go) + +```go +import github.com/blang/semver + +v, err := semver.Make("0.0.1-alpha.preview+123.github") +fmt.Printf("Major: %d\n", v.Major) +fmt.Printf("Minor: %d\n", v.Minor) +fmt.Printf("Patch: %d\n", v.Patch) +fmt.Printf("Pre: %s\n", v.Pre) +fmt.Printf("Build: %s\n", v.Build) + +// Prerelease versions array +if len(v.Pre) > 0 { + fmt.Println("Prerelease versions:") + for i, pre := range v.Pre { + fmt.Printf("%d: %q\n", i, pre) + } +} + +// Build meta data array +if len(v.Build) > 0 { + fmt.Println("Build meta data:") + for i, build := range v.Build { + fmt.Printf("%d: %q\n", i, build) + } +} + +v001, err := semver.Make("0.0.1") +// Compare using helpers: v.GT(v2), v.LT, v.GTE, v.LTE +v001.GT(v) == true +v.LT(v001) == true +v.GTE(v) == true +v.LTE(v) == true + +// Or use v.Compare(v2) for comparisons (-1, 0, 1): +v001.Compare(v) == 1 +v.Compare(v001) == -1 +v.Compare(v) == 0 + +// Manipulate Version in place: +v.Pre[0], err = semver.NewPRVersion("beta") +if err != nil { + fmt.Printf("Error parsing pre release version: %q", err) +} + +fmt.Println("\nValidate versions:") +v.Build[0] = "?" + +err = v.Validate() +if err != nil { + fmt.Printf("Validation failed: %s\n", err) +} +``` + + +Benchmarks +----- + + BenchmarkParseSimple-4 5000000 390 ns/op 48 B/op 1 allocs/op + BenchmarkParseComplex-4 1000000 1813 ns/op 256 B/op 7 allocs/op + BenchmarkParseAverage-4 1000000 1171 ns/op 163 B/op 4 allocs/op + BenchmarkStringSimple-4 20000000 119 ns/op 16 B/op 1 allocs/op + BenchmarkStringLarger-4 10000000 206 ns/op 32 B/op 2 allocs/op + BenchmarkStringComplex-4 5000000 324 ns/op 80 B/op 3 allocs/op + BenchmarkStringAverage-4 5000000 273 ns/op 53 B/op 2 allocs/op + BenchmarkValidateSimple-4 200000000 9.33 ns/op 0 B/op 0 allocs/op + BenchmarkValidateComplex-4 3000000 469 ns/op 0 B/op 0 allocs/op + BenchmarkValidateAverage-4 5000000 256 ns/op 0 B/op 0 allocs/op + BenchmarkCompareSimple-4 100000000 11.8 ns/op 0 B/op 0 allocs/op + BenchmarkCompareComplex-4 50000000 30.8 ns/op 0 B/op 0 allocs/op + BenchmarkCompareAverage-4 30000000 41.5 ns/op 0 B/op 0 allocs/op + BenchmarkSort-4 3000000 419 ns/op 256 B/op 2 allocs/op + BenchmarkRangeParseSimple-4 2000000 850 ns/op 192 B/op 5 allocs/op + BenchmarkRangeParseAverage-4 1000000 1677 ns/op 400 B/op 10 allocs/op + BenchmarkRangeParseComplex-4 300000 5214 ns/op 1440 B/op 30 allocs/op + BenchmarkRangeMatchSimple-4 50000000 25.6 ns/op 0 B/op 0 allocs/op + BenchmarkRangeMatchAverage-4 30000000 56.4 ns/op 0 B/op 0 allocs/op + BenchmarkRangeMatchComplex-4 10000000 153 ns/op 0 B/op 0 allocs/op + +See benchmark cases at [semver_test.go](semver_test.go) + + +Motivation +----- + +I simply couldn't find any lib supporting the full spec. Others were just wrong or used reflection and regex which i don't like. + + +Contribution +----- + +Feel free to make a pull request. For bigger changes create a issue first to discuss about it. + + +License +----- + +See [LICENSE](LICENSE) file. diff --git a/vendor/github.com/blang/semver/examples/main.go b/vendor/github.com/blang/semver/examples/main.go new file mode 100644 index 000000000..f36c983d9 --- /dev/null +++ b/vendor/github.com/blang/semver/examples/main.go @@ -0,0 +1,83 @@ +package main + +import ( + "fmt" + "github.com/blang/semver" +) + +func main() { + v, err := semver.Parse("0.0.1-alpha.preview.222+123.github") + if err != nil { + fmt.Printf("Error while parsing (not valid): %q", err) + } + fmt.Printf("Version to string: %q\n", v) + + fmt.Printf("Major: %d\n", v.Major) + fmt.Printf("Minor: %d\n", v.Minor) + fmt.Printf("Patch: %d\n", v.Patch) + + // Prerelease versions + if len(v.Pre) > 0 { + fmt.Println("Prerelease versions:") + for i, pre := range v.Pre { + fmt.Printf("%d: %q\n", i, pre) + } + } + + // Build meta data + if len(v.Build) > 0 { + fmt.Println("Build meta data:") + for i, build := range v.Build { + fmt.Printf("%d: %q\n", i, build) + } + } + + // Make == Parse (Value), New for Pointer + v001, err := semver.Make("0.0.1") + + fmt.Println("\nUse Version.Compare for comparisons (-1, 0, 1):") + fmt.Printf("%q is greater than %q: Compare == %d\n", v001, v, v001.Compare(v)) + fmt.Printf("%q is less than %q: Compare == %d\n", v, v001, v.Compare(v001)) + fmt.Printf("%q is equal to %q: Compare == %d\n", v, v, v.Compare(v)) + + fmt.Println("\nUse comparison helpers returning booleans:") + fmt.Printf("%q is greater than %q: %t\n", v001, v, v001.GT(v)) + fmt.Printf("%q is greater than equal %q: %t\n", v001, v, v001.GTE(v)) + fmt.Printf("%q is greater than equal %q: %t\n", v, v, v.GTE(v)) + fmt.Printf("%q is less than %q: %t\n", v, v001, v.LT(v001)) + fmt.Printf("%q is less than equal %q: %t\n", v, v001, v.LTE(v001)) + fmt.Printf("%q is less than equal %q: %t\n", v, v, v.LTE(v)) + + fmt.Println("\nManipulate Version in place:") + v.Pre[0], err = semver.NewPRVersion("beta") + if err != nil { + fmt.Printf("Error parsing pre release version: %q", err) + } + fmt.Printf("Version to string: %q\n", v) + + fmt.Println("\nCompare Prerelease versions:") + pre1, _ := semver.NewPRVersion("123") + pre2, _ := semver.NewPRVersion("alpha") + pre3, _ := semver.NewPRVersion("124") + fmt.Printf("%q is less than %q: Compare == %d\n", pre1, pre2, pre1.Compare(pre2)) + fmt.Printf("%q is greater than %q: Compare == %d\n", pre3, pre1, pre3.Compare(pre1)) + fmt.Printf("%q is equal to %q: Compare == %d\n", pre1, pre1, pre1.Compare(pre1)) + + fmt.Println("\nValidate versions:") + v.Build[0] = "?" + + err = v.Validate() + if err != nil { + fmt.Printf("Validation failed: %s\n", err) + } + + fmt.Println("Create valid build meta data:") + b1, _ := semver.NewBuildVersion("build123") + v.Build[0] = b1 + fmt.Printf("Version with new build version %q\n", v) + + _, err = semver.NewBuildVersion("build?123") + if err != nil { + fmt.Printf("Create build version failed: %s\n", err) + } +} diff --git a/vendor/github.com/blang/semver/json.go b/vendor/github.com/blang/semver/json.go new file mode 100644 index 000000000..a74bf7c44 --- /dev/null +++ b/vendor/github.com/blang/semver/json.go @@ -0,0 +1,23 @@ +package semver + +import ( + "encoding/json" +) + +// MarshalJSON implements the encoding/json.Marshaler interface. +func (v Version) MarshalJSON() ([]byte, error) { + return json.Marshal(v.String()) +} + +// UnmarshalJSON implements the encoding/json.Unmarshaler interface. +func (v *Version) UnmarshalJSON(data []byte) (err error) { + var versionString string + + if err = json.Unmarshal(data, &versionString); err != nil { + return + } + + *v, err = Parse(versionString) + + return +} diff --git a/vendor/github.com/blang/semver/json_test.go b/vendor/github.com/blang/semver/json_test.go new file mode 100644 index 000000000..039117da9 --- /dev/null +++ b/vendor/github.com/blang/semver/json_test.go @@ -0,0 +1,45 @@ +package semver + +import ( + "encoding/json" + "strconv" + "testing" +) + +func TestJSONMarshal(t *testing.T) { + versionString := "3.1.4-alpha.1.5.9+build.2.6.5" + v, err := Parse(versionString) + if err != nil { + t.Fatal(err) + } + + versionJSON, err := json.Marshal(v) + if err != nil { + t.Fatal(err) + } + + quotedVersionString := strconv.Quote(versionString) + + if string(versionJSON) != quotedVersionString { + t.Fatalf("JSON marshaled semantic version not equal: expected %q, got %q", quotedVersionString, string(versionJSON)) + } +} + +func TestJSONUnmarshal(t *testing.T) { + versionString := "3.1.4-alpha.1.5.9+build.2.6.5" + quotedVersionString := strconv.Quote(versionString) + + var v Version + if err := json.Unmarshal([]byte(quotedVersionString), &v); err != nil { + t.Fatal(err) + } + + if v.String() != versionString { + t.Fatalf("JSON unmarshaled semantic version not equal: expected %q, got %q", versionString, v.String()) + } + + badVersionString := strconv.Quote("3.1.4.1.5.9.2.6.5-other-digits-of-pi") + if err := json.Unmarshal([]byte(badVersionString), &v); err == nil { + t.Fatal("expected JSON unmarshal error, got nil") + } +} diff --git a/vendor/github.com/blang/semver/range.go b/vendor/github.com/blang/semver/range.go new file mode 100644 index 000000000..0a8eaa1c9 --- /dev/null +++ b/vendor/github.com/blang/semver/range.go @@ -0,0 +1,224 @@ +package semver + +import ( + "fmt" + "strings" + "unicode" +) + +type comparator func(Version, Version) bool + +var ( + compEQ comparator = func(v1 Version, v2 Version) bool { + return v1.Compare(v2) == 0 + } + compNE = func(v1 Version, v2 Version) bool { + return v1.Compare(v2) != 0 + } + compGT = func(v1 Version, v2 Version) bool { + return v1.Compare(v2) == 1 + } + compGE = func(v1 Version, v2 Version) bool { + return v1.Compare(v2) >= 0 + } + compLT = func(v1 Version, v2 Version) bool { + return v1.Compare(v2) == -1 + } + compLE = func(v1 Version, v2 Version) bool { + return v1.Compare(v2) <= 0 + } +) + +type versionRange struct { + v Version + c comparator +} + +// rangeFunc creates a Range from the given versionRange. +func (vr *versionRange) rangeFunc() Range { + return Range(func(v Version) bool { + return vr.c(v, vr.v) + }) +} + +// Range represents a range of versions. +// A Range can be used to check if a Version satisfies it: +// +// range, err := semver.ParseRange(">1.0.0 <2.0.0") +// range(semver.MustParse("1.1.1") // returns true +type Range func(Version) bool + +// OR combines the existing Range with another Range using logical OR. +func (rf Range) OR(f Range) Range { + return Range(func(v Version) bool { + return rf(v) || f(v) + }) +} + +// AND combines the existing Range with another Range using logical AND. +func (rf Range) AND(f Range) Range { + return Range(func(v Version) bool { + return rf(v) && f(v) + }) +} + +// ParseRange parses a range and returns a Range. +// If the range could not be parsed an error is returned. +// +// Valid ranges are: +// - "<1.0.0" +// - "<=1.0.0" +// - ">1.0.0" +// - ">=1.0.0" +// - "1.0.0", "=1.0.0", "==1.0.0" +// - "!1.0.0", "!=1.0.0" +// +// A Range can consist of multiple ranges separated by space: +// Ranges can be linked by logical AND: +// - ">1.0.0 <2.0.0" would match between both ranges, so "1.1.1" and "1.8.7" but not "1.0.0" or "2.0.0" +// - ">1.0.0 <3.0.0 !2.0.3-beta.2" would match every version between 1.0.0 and 3.0.0 except 2.0.3-beta.2 +// +// Ranges can also be linked by logical OR: +// - "<2.0.0 || >=3.0.0" would match "1.x.x" and "3.x.x" but not "2.x.x" +// +// AND has a higher precedence than OR. It's not possible to use brackets. +// +// Ranges can be combined by both AND and OR +// +// - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1` +func ParseRange(s string) (Range, error) { + parts := splitAndTrim(s) + orParts, err := splitORParts(parts) + if err != nil { + return nil, err + } + var orFn Range + for _, p := range orParts { + var andFn Range + for _, ap := range p { + opStr, vStr, err := splitComparatorVersion(ap) + if err != nil { + return nil, err + } + vr, err := buildVersionRange(opStr, vStr) + if err != nil { + return nil, fmt.Errorf("Could not parse Range %q: %s", ap, err) + } + rf := vr.rangeFunc() + + // Set function + if andFn == nil { + andFn = rf + } else { // Combine with existing function + andFn = andFn.AND(rf) + } + } + if orFn == nil { + orFn = andFn + } else { + orFn = orFn.OR(andFn) + } + + } + return orFn, nil +} + +// splitORParts splits the already cleaned parts by '||'. +// Checks for invalid positions of the operator and returns an +// error if found. +func splitORParts(parts []string) ([][]string, error) { + var ORparts [][]string + last := 0 + for i, p := range parts { + if p == "||" { + if i == 0 { + return nil, fmt.Errorf("First element in range is '||'") + } + ORparts = append(ORparts, parts[last:i]) + last = i + 1 + } + } + if last == len(parts) { + return nil, fmt.Errorf("Last element in range is '||'") + } + ORparts = append(ORparts, parts[last:]) + return ORparts, nil +} + +// buildVersionRange takes a slice of 2: operator and version +// and builds a versionRange, otherwise an error. +func buildVersionRange(opStr, vStr string) (*versionRange, error) { + c := parseComparator(opStr) + if c == nil { + return nil, fmt.Errorf("Could not parse comparator %q in %q", opStr, strings.Join([]string{opStr, vStr}, "")) + } + v, err := Parse(vStr) + if err != nil { + return nil, fmt.Errorf("Could not parse version %q in %q: %s", vStr, strings.Join([]string{opStr, vStr}, ""), err) + } + + return &versionRange{ + v: v, + c: c, + }, nil + +} + +// splitAndTrim splits a range string by spaces and cleans leading and trailing spaces +func splitAndTrim(s string) (result []string) { + last := 0 + for i := 0; i < len(s); i++ { + if s[i] == ' ' { + if last < i-1 { + result = append(result, s[last:i]) + } + last = i + 1 + } + } + if last < len(s)-1 { + result = append(result, s[last:]) + } + // parts := strings.Split(s, " ") + // for _, x := range parts { + // if s := strings.TrimSpace(x); len(s) != 0 { + // result = append(result, s) + // } + // } + return +} + +// splitComparatorVersion splits the comparator from the version. +// Spaces between the comparator and the version are not allowed. +// Input must be free of leading or trailing spaces. +func splitComparatorVersion(s string) (string, string, error) { + i := strings.IndexFunc(s, unicode.IsDigit) + if i == -1 { + return "", "", fmt.Errorf("Could not get version from string: %q", s) + } + return strings.TrimSpace(s[0:i]), s[i:], nil +} + +func parseComparator(s string) comparator { + switch s { + case "==": + fallthrough + case "": + fallthrough + case "=": + return compEQ + case ">": + return compGT + case ">=": + return compGE + case "<": + return compLT + case "<=": + return compLE + case "!": + fallthrough + case "!=": + return compNE + } + + return nil +} diff --git a/vendor/github.com/blang/semver/range_test.go b/vendor/github.com/blang/semver/range_test.go new file mode 100644 index 000000000..5a745a9a4 --- /dev/null +++ b/vendor/github.com/blang/semver/range_test.go @@ -0,0 +1,442 @@ +package semver + +import ( + "reflect" + "strings" + "testing" +) + +type comparatorTest struct { + input string + comparator func(comparator) bool +} + +func TestParseComparator(t *testing.T) { + compatorTests := []comparatorTest{ + {">", testGT}, + {">=", testGE}, + {"<", testLT}, + {"<=", testLE}, + {"", testEQ}, + {"=", testEQ}, + {"==", testEQ}, + {"!=", testNE}, + {"!", testNE}, + {"-", nil}, + {"<==", nil}, + {"<<", nil}, + {">>", nil}, + } + + for _, tc := range compatorTests { + if c := parseComparator(tc.input); c == nil { + if tc.comparator != nil { + t.Errorf("Comparator nil for case %q\n", tc.input) + } + } else if !tc.comparator(c) { + t.Errorf("Invalid comparator for case %q\n", tc.input) + } + } +} + +var ( + v1 = MustParse("1.2.2") + v2 = MustParse("1.2.3") + v3 = MustParse("1.2.4") +) + +func testEQ(f comparator) bool { + return f(v1, v1) && !f(v1, v2) +} + +func testNE(f comparator) bool { + return !f(v1, v1) && f(v1, v2) +} + +func testGT(f comparator) bool { + return f(v2, v1) && f(v3, v2) && !f(v1, v2) && !f(v1, v1) +} + +func testGE(f comparator) bool { + return f(v2, v1) && f(v3, v2) && !f(v1, v2) +} + +func testLT(f comparator) bool { + return f(v1, v2) && f(v2, v3) && !f(v2, v1) && !f(v1, v1) +} + +func testLE(f comparator) bool { + return f(v1, v2) && f(v2, v3) && !f(v2, v1) +} + +func TestSplitAndTrim(t *testing.T) { + tests := []struct { + i string + s []string + }{ + {"1.2.3 1.2.3", []string{"1.2.3", "1.2.3"}}, + {" 1.2.3 1.2.3 ", []string{"1.2.3", "1.2.3"}}, // Spaces + {"1.2.3 || >=1.2.3 <1.2.3", []string{"1.2.3", "||", ">=1.2.3", "<1.2.3"}}, + {" 1.2.3 || >=1.2.3 <1.2.3 ", []string{"1.2.3", "||", ">=1.2.3", "<1.2.3"}}, + } + + for _, tc := range tests { + p := splitAndTrim(tc.i) + if !reflect.DeepEqual(p, tc.s) { + t.Errorf("Invalid for case %q: Expected %q, got: %q", tc.i, tc.s, p) + } + } +} + +func TestSplitComparatorVersion(t *testing.T) { + tests := []struct { + i string + p []string + }{ + {">1.2.3", []string{">", "1.2.3"}}, + {">=1.2.3", []string{">=", "1.2.3"}}, + {"<1.2.3", []string{"<", "1.2.3"}}, + {"<=1.2.3", []string{"<=", "1.2.3"}}, + {"1.2.3", []string{"", "1.2.3"}}, + {"=1.2.3", []string{"=", "1.2.3"}}, + {"==1.2.3", []string{"==", "1.2.3"}}, + {"!=1.2.3", []string{"!=", "1.2.3"}}, + {"!1.2.3", []string{"!", "1.2.3"}}, + {"error", nil}, + } + for _, tc := range tests { + if op, v, err := splitComparatorVersion(tc.i); err != nil { + if tc.p != nil { + t.Errorf("Invalid for case %q: Expected %q, got error %q", tc.i, tc.p, err) + } + } else if op != tc.p[0] { + t.Errorf("Invalid operator for case %q: Expected %q, got: %q", tc.i, tc.p[0], op) + } else if v != tc.p[1] { + t.Errorf("Invalid version for case %q: Expected %q, got: %q", tc.i, tc.p[1], v) + } + + } +} + +func TestBuildVersionRange(t *testing.T) { + tests := []struct { + opStr string + vStr string + c func(comparator) bool + v string + }{ + {">", "1.2.3", testGT, "1.2.3"}, + {">=", "1.2.3", testGE, "1.2.3"}, + {"<", "1.2.3", testLT, "1.2.3"}, + {"<=", "1.2.3", testLE, "1.2.3"}, + {"", "1.2.3", testEQ, "1.2.3"}, + {"=", "1.2.3", testEQ, "1.2.3"}, + {"==", "1.2.3", testEQ, "1.2.3"}, + {"!=", "1.2.3", testNE, "1.2.3"}, + {"!", "1.2.3", testNE, "1.2.3"}, + {">>", "1.2.3", nil, ""}, // Invalid comparator + {"=", "invalid", nil, ""}, // Invalid version + } + + for _, tc := range tests { + if r, err := buildVersionRange(tc.opStr, tc.vStr); err != nil { + if tc.c != nil { + t.Errorf("Invalid for case %q: Expected %q, got error %q", strings.Join([]string{tc.opStr, tc.vStr}, ""), tc.v, err) + } + } else if r == nil { + t.Errorf("Invalid for case %q: got nil", strings.Join([]string{tc.opStr, tc.vStr}, "")) + } else { + // test version + if tv := MustParse(tc.v); !r.v.EQ(tv) { + t.Errorf("Invalid for case %q: Expected version %q, got: %q", strings.Join([]string{tc.opStr, tc.vStr}, ""), tv, r.v) + } + // test comparator + if r.c == nil { + t.Errorf("Invalid for case %q: got nil comparator", strings.Join([]string{tc.opStr, tc.vStr}, "")) + continue + } + if !tc.c(r.c) { + t.Errorf("Invalid comparator for case %q\n", strings.Join([]string{tc.opStr, tc.vStr}, "")) + } + } + } + +} + +func TestSplitORParts(t *testing.T) { + tests := []struct { + i []string + o [][]string + }{ + {[]string{">1.2.3", "||", "<1.2.3", "||", "=1.2.3"}, [][]string{ + []string{">1.2.3"}, + []string{"<1.2.3"}, + []string{"=1.2.3"}, + }}, + {[]string{">1.2.3", "<1.2.3", "||", "=1.2.3"}, [][]string{ + []string{">1.2.3", "<1.2.3"}, + []string{"=1.2.3"}, + }}, + {[]string{">1.2.3", "||"}, nil}, + {[]string{"||", ">1.2.3"}, nil}, + } + for _, tc := range tests { + o, err := splitORParts(tc.i) + if err != nil && tc.o != nil { + t.Errorf("Unexpected error for case %q: %s", tc.i, err) + } + if !reflect.DeepEqual(tc.o, o) { + t.Errorf("Invalid for case %q: Expected %q, got: %q", tc.i, tc.o, o) + } + } +} + +func TestVersionRangeToRange(t *testing.T) { + vr := versionRange{ + v: MustParse("1.2.3"), + c: compLT, + } + rf := vr.rangeFunc() + if !rf(MustParse("1.2.2")) || rf(MustParse("1.2.3")) { + t.Errorf("Invalid conversion to range func") + } +} + +func TestRangeAND(t *testing.T) { + v := MustParse("1.2.2") + v1 := MustParse("1.2.1") + v2 := MustParse("1.2.3") + rf1 := Range(func(v Version) bool { + return v.GT(v1) + }) + rf2 := Range(func(v Version) bool { + return v.LT(v2) + }) + rf := rf1.AND(rf2) + if rf(v1) { + t.Errorf("Invalid rangefunc, accepted: %s", v1) + } + if rf(v2) { + t.Errorf("Invalid rangefunc, accepted: %s", v2) + } + if !rf(v) { + t.Errorf("Invalid rangefunc, did not accept: %s", v) + } +} + +func TestRangeOR(t *testing.T) { + tests := []struct { + v Version + b bool + }{ + {MustParse("1.2.0"), true}, + {MustParse("1.2.2"), false}, + {MustParse("1.2.4"), true}, + } + v1 := MustParse("1.2.1") + v2 := MustParse("1.2.3") + rf1 := Range(func(v Version) bool { + return v.LT(v1) + }) + rf2 := Range(func(v Version) bool { + return v.GT(v2) + }) + rf := rf1.OR(rf2) + for _, tc := range tests { + if r := rf(tc.v); r != tc.b { + t.Errorf("Invalid for case %q: Expected %t, got %t", tc.v, tc.b, r) + } + } +} + +func TestParseRange(t *testing.T) { + type tv struct { + v string + b bool + } + tests := []struct { + i string + t []tv + }{ + // Simple expressions + {">1.2.3", []tv{ + {"1.2.2", false}, + {"1.2.3", false}, + {"1.2.4", true}, + }}, + {">=1.2.3", []tv{ + {"1.2.3", true}, + {"1.2.4", true}, + {"1.2.2", false}, + }}, + {"<1.2.3", []tv{ + {"1.2.2", true}, + {"1.2.3", false}, + {"1.2.4", false}, + }}, + {"<=1.2.3", []tv{ + {"1.2.2", true}, + {"1.2.3", true}, + {"1.2.4", false}, + }}, + {"1.2.3", []tv{ + {"1.2.2", false}, + {"1.2.3", true}, + {"1.2.4", false}, + }}, + {"=1.2.3", []tv{ + {"1.2.2", false}, + {"1.2.3", true}, + {"1.2.4", false}, + }}, + {"==1.2.3", []tv{ + {"1.2.2", false}, + {"1.2.3", true}, + {"1.2.4", false}, + }}, + {"!=1.2.3", []tv{ + {"1.2.2", true}, + {"1.2.3", false}, + {"1.2.4", true}, + }}, + {"!1.2.3", []tv{ + {"1.2.2", true}, + {"1.2.3", false}, + {"1.2.4", true}, + }}, + // Simple Expression errors + {">>1.2.3", nil}, + {"!1.2.3", nil}, + {"1.0", nil}, + {"string", nil}, + {"", nil}, + + // AND Expressions + {">1.2.2 <1.2.4", []tv{ + {"1.2.2", false}, + {"1.2.3", true}, + {"1.2.4", false}, + }}, + {"<1.2.2 <1.2.4", []tv{ + {"1.2.1", true}, + {"1.2.2", false}, + {"1.2.3", false}, + {"1.2.4", false}, + }}, + {">1.2.2 <1.2.5 !=1.2.4", []tv{ + {"1.2.2", false}, + {"1.2.3", true}, + {"1.2.4", false}, + {"1.2.5", false}, + }}, + {">1.2.2 <1.2.5 !1.2.4", []tv{ + {"1.2.2", false}, + {"1.2.3", true}, + {"1.2.4", false}, + {"1.2.5", false}, + }}, + // OR Expressions + {">1.2.2 || <1.2.4", []tv{ + {"1.2.2", true}, + {"1.2.3", true}, + {"1.2.4", true}, + }}, + {"<1.2.2 || >1.2.4", []tv{ + {"1.2.2", false}, + {"1.2.3", false}, + {"1.2.4", false}, + }}, + // Combined Expressions + {">1.2.2 <1.2.4 || >=2.0.0", []tv{ + {"1.2.2", false}, + {"1.2.3", true}, + {"1.2.4", false}, + {"2.0.0", true}, + {"2.0.1", true}, + }}, + {">1.2.2 <1.2.4 || >=2.0.0 <3.0.0", []tv{ + {"1.2.2", false}, + {"1.2.3", true}, + {"1.2.4", false}, + {"2.0.0", true}, + {"2.0.1", true}, + {"2.9.9", true}, + {"3.0.0", false}, + }}, + } + + for _, tc := range tests { + r, err := ParseRange(tc.i) + if err != nil && tc.t != nil { + t.Errorf("Error parsing range %q: %s", tc.i, err) + continue + } + for _, tvc := range tc.t { + v := MustParse(tvc.v) + if res := r(v); res != tvc.b { + t.Errorf("Invalid for case %q matching %q: Expected %t, got: %t", tc.i, tvc.v, tvc.b, res) + } + } + + } +} + +func BenchmarkRangeParseSimple(b *testing.B) { + const VERSION = ">1.0.0" + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + ParseRange(VERSION) + } +} + +func BenchmarkRangeParseAverage(b *testing.B) { + const VERSION = ">=1.0.0 <2.0.0" + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + ParseRange(VERSION) + } +} + +func BenchmarkRangeParseComplex(b *testing.B) { + const VERSION = ">=1.0.0 <2.0.0 || >=3.0.1 <4.0.0 !=3.0.3 || >=5.0.0" + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + ParseRange(VERSION) + } +} + +func BenchmarkRangeMatchSimple(b *testing.B) { + const VERSION = ">1.0.0" + r, _ := ParseRange(VERSION) + v := MustParse("2.0.0") + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + r(v) + } +} + +func BenchmarkRangeMatchAverage(b *testing.B) { + const VERSION = ">=1.0.0 <2.0.0" + r, _ := ParseRange(VERSION) + v := MustParse("1.2.3") + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + r(v) + } +} + +func BenchmarkRangeMatchComplex(b *testing.B) { + const VERSION = ">=1.0.0 <2.0.0 || >=3.0.1 <4.0.0 !=3.0.3 || >=5.0.0" + r, _ := ParseRange(VERSION) + v := MustParse("5.0.1") + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + r(v) + } +} diff --git a/vendor/github.com/blang/semver/semver.go b/vendor/github.com/blang/semver/semver.go new file mode 100644 index 000000000..bbf85ce97 --- /dev/null +++ b/vendor/github.com/blang/semver/semver.go @@ -0,0 +1,395 @@ +package semver + +import ( + "errors" + "fmt" + "strconv" + "strings" +) + +const ( + numbers string = "0123456789" + alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" + alphanum = alphas + numbers +) + +// SpecVersion is the latest fully supported spec version of semver +var SpecVersion = Version{ + Major: 2, + Minor: 0, + Patch: 0, +} + +// Version represents a semver compatible version +type Version struct { + Major uint64 + Minor uint64 + Patch uint64 + Pre []PRVersion + Build []string //No Precendence +} + +// Version to string +func (v Version) String() string { + b := make([]byte, 0, 5) + b = strconv.AppendUint(b, v.Major, 10) + b = append(b, '.') + b = strconv.AppendUint(b, v.Minor, 10) + b = append(b, '.') + b = strconv.AppendUint(b, v.Patch, 10) + + if len(v.Pre) > 0 { + b = append(b, '-') + b = append(b, v.Pre[0].String()...) + + for _, pre := range v.Pre[1:] { + b = append(b, '.') + b = append(b, pre.String()...) + } + } + + if len(v.Build) > 0 { + b = append(b, '+') + b = append(b, v.Build[0]...) + + for _, build := range v.Build[1:] { + b = append(b, '.') + b = append(b, build...) + } + } + + return string(b) +} + +// Equals checks if v is equal to o. +func (v Version) Equals(o Version) bool { + return (v.Compare(o) == 0) +} + +// EQ checks if v is equal to o. +func (v Version) EQ(o Version) bool { + return (v.Compare(o) == 0) +} + +// NE checks if v is not equal to o. +func (v Version) NE(o Version) bool { + return (v.Compare(o) != 0) +} + +// GT checks if v is greater than o. +func (v Version) GT(o Version) bool { + return (v.Compare(o) == 1) +} + +// GTE checks if v is greater than or equal to o. +func (v Version) GTE(o Version) bool { + return (v.Compare(o) >= 0) +} + +// GE checks if v is greater than or equal to o. +func (v Version) GE(o Version) bool { + return (v.Compare(o) >= 0) +} + +// LT checks if v is less than o. +func (v Version) LT(o Version) bool { + return (v.Compare(o) == -1) +} + +// LTE checks if v is less than or equal to o. +func (v Version) LTE(o Version) bool { + return (v.Compare(o) <= 0) +} + +// LE checks if v is less than or equal to o. +func (v Version) LE(o Version) bool { + return (v.Compare(o) <= 0) +} + +// Compare compares Versions v to o: +// -1 == v is less than o +// 0 == v is equal to o +// 1 == v is greater than o +func (v Version) Compare(o Version) int { + if v.Major != o.Major { + if v.Major > o.Major { + return 1 + } + return -1 + } + if v.Minor != o.Minor { + if v.Minor > o.Minor { + return 1 + } + return -1 + } + if v.Patch != o.Patch { + if v.Patch > o.Patch { + return 1 + } + return -1 + } + + // Quick comparison if a version has no prerelease versions + if len(v.Pre) == 0 && len(o.Pre) == 0 { + return 0 + } else if len(v.Pre) == 0 && len(o.Pre) > 0 { + return 1 + } else if len(v.Pre) > 0 && len(o.Pre) == 0 { + return -1 + } + + i := 0 + for ; i < len(v.Pre) && i < len(o.Pre); i++ { + if comp := v.Pre[i].Compare(o.Pre[i]); comp == 0 { + continue + } else if comp == 1 { + return 1 + } else { + return -1 + } + } + + // If all pr versions are the equal but one has further prversion, this one greater + if i == len(v.Pre) && i == len(o.Pre) { + return 0 + } else if i == len(v.Pre) && i < len(o.Pre) { + return -1 + } else { + return 1 + } + +} + +// Validate validates v and returns error in case +func (v Version) Validate() error { + // Major, Minor, Patch already validated using uint64 + + for _, pre := range v.Pre { + if !pre.IsNum { //Numeric prerelease versions already uint64 + if len(pre.VersionStr) == 0 { + return fmt.Errorf("Prerelease can not be empty %q", pre.VersionStr) + } + if !containsOnly(pre.VersionStr, alphanum) { + return fmt.Errorf("Invalid character(s) found in prerelease %q", pre.VersionStr) + } + } + } + + for _, build := range v.Build { + if len(build) == 0 { + return fmt.Errorf("Build meta data can not be empty %q", build) + } + if !containsOnly(build, alphanum) { + return fmt.Errorf("Invalid character(s) found in build meta data %q", build) + } + } + + return nil +} + +// New is an alias for Parse and returns a pointer, parses version string and returns a validated Version or error +func New(s string) (vp *Version, err error) { + v, err := Parse(s) + vp = &v + return +} + +// Make is an alias for Parse, parses version string and returns a validated Version or error +func Make(s string) (Version, error) { + return Parse(s) +} + +// Parse parses version string and returns a validated Version or error +func Parse(s string) (Version, error) { + if len(s) == 0 { + return Version{}, errors.New("Version string empty") + } + + // Split into major.minor.(patch+pr+meta) + parts := strings.SplitN(s, ".", 3) + if len(parts) != 3 { + return Version{}, errors.New("No Major.Minor.Patch elements found") + } + + // Major + if !containsOnly(parts[0], numbers) { + return Version{}, fmt.Errorf("Invalid character(s) found in major number %q", parts[0]) + } + if hasLeadingZeroes(parts[0]) { + return Version{}, fmt.Errorf("Major number must not contain leading zeroes %q", parts[0]) + } + major, err := strconv.ParseUint(parts[0], 10, 64) + if err != nil { + return Version{}, err + } + + // Minor + if !containsOnly(parts[1], numbers) { + return Version{}, fmt.Errorf("Invalid character(s) found in minor number %q", parts[1]) + } + if hasLeadingZeroes(parts[1]) { + return Version{}, fmt.Errorf("Minor number must not contain leading zeroes %q", parts[1]) + } + minor, err := strconv.ParseUint(parts[1], 10, 64) + if err != nil { + return Version{}, err + } + + v := Version{} + v.Major = major + v.Minor = minor + + var build, prerelease []string + patchStr := parts[2] + + if buildIndex := strings.IndexRune(patchStr, '+'); buildIndex != -1 { + build = strings.Split(patchStr[buildIndex+1:], ".") + patchStr = patchStr[:buildIndex] + } + + if preIndex := strings.IndexRune(patchStr, '-'); preIndex != -1 { + prerelease = strings.Split(patchStr[preIndex+1:], ".") + patchStr = patchStr[:preIndex] + } + + if !containsOnly(patchStr, numbers) { + return Version{}, fmt.Errorf("Invalid character(s) found in patch number %q", patchStr) + } + if hasLeadingZeroes(patchStr) { + return Version{}, fmt.Errorf("Patch number must not contain leading zeroes %q", patchStr) + } + patch, err := strconv.ParseUint(patchStr, 10, 64) + if err != nil { + return Version{}, err + } + + v.Patch = patch + + // Prerelease + for _, prstr := range prerelease { + parsedPR, err := NewPRVersion(prstr) + if err != nil { + return Version{}, err + } + v.Pre = append(v.Pre, parsedPR) + } + + // Build meta data + for _, str := range build { + if len(str) == 0 { + return Version{}, errors.New("Build meta data is empty") + } + if !containsOnly(str, alphanum) { + return Version{}, fmt.Errorf("Invalid character(s) found in build meta data %q", str) + } + v.Build = append(v.Build, str) + } + + return v, nil +} + +// MustParse is like Parse but panics if the version cannot be parsed. +func MustParse(s string) Version { + v, err := Parse(s) + if err != nil { + panic(`semver: Parse(` + s + `): ` + err.Error()) + } + return v +} + +// PRVersion represents a PreRelease Version +type PRVersion struct { + VersionStr string + VersionNum uint64 + IsNum bool +} + +// NewPRVersion creates a new valid prerelease version +func NewPRVersion(s string) (PRVersion, error) { + if len(s) == 0 { + return PRVersion{}, errors.New("Prerelease is empty") + } + v := PRVersion{} + if containsOnly(s, numbers) { + if hasLeadingZeroes(s) { + return PRVersion{}, fmt.Errorf("Numeric PreRelease version must not contain leading zeroes %q", s) + } + num, err := strconv.ParseUint(s, 10, 64) + + // Might never be hit, but just in case + if err != nil { + return PRVersion{}, err + } + v.VersionNum = num + v.IsNum = true + } else if containsOnly(s, alphanum) { + v.VersionStr = s + v.IsNum = false + } else { + return PRVersion{}, fmt.Errorf("Invalid character(s) found in prerelease %q", s) + } + return v, nil +} + +// IsNumeric checks if prerelease-version is numeric +func (v PRVersion) IsNumeric() bool { + return v.IsNum +} + +// Compare compares two PreRelease Versions v and o: +// -1 == v is less than o +// 0 == v is equal to o +// 1 == v is greater than o +func (v PRVersion) Compare(o PRVersion) int { + if v.IsNum && !o.IsNum { + return -1 + } else if !v.IsNum && o.IsNum { + return 1 + } else if v.IsNum && o.IsNum { + if v.VersionNum == o.VersionNum { + return 0 + } else if v.VersionNum > o.VersionNum { + return 1 + } else { + return -1 + } + } else { // both are Alphas + if v.VersionStr == o.VersionStr { + return 0 + } else if v.VersionStr > o.VersionStr { + return 1 + } else { + return -1 + } + } +} + +// PreRelease version to string +func (v PRVersion) String() string { + if v.IsNum { + return strconv.FormatUint(v.VersionNum, 10) + } + return v.VersionStr +} + +func containsOnly(s string, set string) bool { + return strings.IndexFunc(s, func(r rune) bool { + return !strings.ContainsRune(set, r) + }) == -1 +} + +func hasLeadingZeroes(s string) bool { + return len(s) > 1 && s[0] == '0' +} + +// NewBuildVersion creates a new valid build version +func NewBuildVersion(s string) (string, error) { + if len(s) == 0 { + return "", errors.New("Buildversion is empty") + } + if !containsOnly(s, alphanum) { + return "", fmt.Errorf("Invalid character(s) found in build meta data %q", s) + } + return s, nil +} diff --git a/vendor/github.com/blang/semver/semver_test.go b/vendor/github.com/blang/semver/semver_test.go new file mode 100644 index 000000000..e56ebce05 --- /dev/null +++ b/vendor/github.com/blang/semver/semver_test.go @@ -0,0 +1,417 @@ +package semver + +import ( + "testing" +) + +func prstr(s string) PRVersion { + return PRVersion{s, 0, false} +} + +func prnum(i uint64) PRVersion { + return PRVersion{"", i, true} +} + +type formatTest struct { + v Version + result string +} + +var formatTests = []formatTest{ + {Version{1, 2, 3, nil, nil}, "1.2.3"}, + {Version{0, 0, 1, nil, nil}, "0.0.1"}, + {Version{0, 0, 1, []PRVersion{prstr("alpha"), prstr("preview")}, []string{"123", "456"}}, "0.0.1-alpha.preview+123.456"}, + {Version{1, 2, 3, []PRVersion{prstr("alpha"), prnum(1)}, []string{"123", "456"}}, "1.2.3-alpha.1+123.456"}, + {Version{1, 2, 3, []PRVersion{prstr("alpha"), prnum(1)}, nil}, "1.2.3-alpha.1"}, + {Version{1, 2, 3, nil, []string{"123", "456"}}, "1.2.3+123.456"}, + // Prereleases and build metadata hyphens + {Version{1, 2, 3, []PRVersion{prstr("alpha"), prstr("b-eta")}, []string{"123", "b-uild"}}, "1.2.3-alpha.b-eta+123.b-uild"}, + {Version{1, 2, 3, nil, []string{"123", "b-uild"}}, "1.2.3+123.b-uild"}, + {Version{1, 2, 3, []PRVersion{prstr("alpha"), prstr("b-eta")}, nil}, "1.2.3-alpha.b-eta"}, +} + +func TestStringer(t *testing.T) { + for _, test := range formatTests { + if res := test.v.String(); res != test.result { + t.Errorf("Stringer, expected %q but got %q", test.result, res) + } + } +} + +func TestParse(t *testing.T) { + for _, test := range formatTests { + if v, err := Parse(test.result); err != nil { + t.Errorf("Error parsing %q: %q", test.result, err) + } else if comp := v.Compare(test.v); comp != 0 { + t.Errorf("Parsing, expected %q but got %q, comp: %d ", test.v, v, comp) + } else if err := v.Validate(); err != nil { + t.Errorf("Error validating parsed version %q: %q", test.v, err) + } + } +} + +func TestMustParse(t *testing.T) { + _ = MustParse("32.2.1-alpha") +} + +func TestMustParse_panic(t *testing.T) { + defer func() { + if recover() == nil { + t.Errorf("Should have panicked") + } + }() + _ = MustParse("invalid version") +} + +func TestValidate(t *testing.T) { + for _, test := range formatTests { + if err := test.v.Validate(); err != nil { + t.Errorf("Error validating %q: %q", test.v, err) + } + } +} + +type compareTest struct { + v1 Version + v2 Version + result int +} + +var compareTests = []compareTest{ + {Version{1, 0, 0, nil, nil}, Version{1, 0, 0, nil, nil}, 0}, + {Version{2, 0, 0, nil, nil}, Version{1, 0, 0, nil, nil}, 1}, + {Version{0, 1, 0, nil, nil}, Version{0, 1, 0, nil, nil}, 0}, + {Version{0, 2, 0, nil, nil}, Version{0, 1, 0, nil, nil}, 1}, + {Version{0, 0, 1, nil, nil}, Version{0, 0, 1, nil, nil}, 0}, + {Version{0, 0, 2, nil, nil}, Version{0, 0, 1, nil, nil}, 1}, + {Version{1, 2, 3, nil, nil}, Version{1, 2, 3, nil, nil}, 0}, + {Version{2, 2, 4, nil, nil}, Version{1, 2, 4, nil, nil}, 1}, + {Version{1, 3, 3, nil, nil}, Version{1, 2, 3, nil, nil}, 1}, + {Version{1, 2, 4, nil, nil}, Version{1, 2, 3, nil, nil}, 1}, + + // Spec Examples #11 + {Version{1, 0, 0, nil, nil}, Version{2, 0, 0, nil, nil}, -1}, + {Version{2, 0, 0, nil, nil}, Version{2, 1, 0, nil, nil}, -1}, + {Version{2, 1, 0, nil, nil}, Version{2, 1, 1, nil, nil}, -1}, + + // Spec Examples #9 + {Version{1, 0, 0, nil, nil}, Version{1, 0, 0, []PRVersion{prstr("alpha")}, nil}, 1}, + {Version{1, 0, 0, []PRVersion{prstr("alpha")}, nil}, Version{1, 0, 0, []PRVersion{prstr("alpha"), prnum(1)}, nil}, -1}, + {Version{1, 0, 0, []PRVersion{prstr("alpha"), prnum(1)}, nil}, Version{1, 0, 0, []PRVersion{prstr("alpha"), prstr("beta")}, nil}, -1}, + {Version{1, 0, 0, []PRVersion{prstr("alpha"), prstr("beta")}, nil}, Version{1, 0, 0, []PRVersion{prstr("beta")}, nil}, -1}, + {Version{1, 0, 0, []PRVersion{prstr("beta")}, nil}, Version{1, 0, 0, []PRVersion{prstr("beta"), prnum(2)}, nil}, -1}, + {Version{1, 0, 0, []PRVersion{prstr("beta"), prnum(2)}, nil}, Version{1, 0, 0, []PRVersion{prstr("beta"), prnum(11)}, nil}, -1}, + {Version{1, 0, 0, []PRVersion{prstr("beta"), prnum(11)}, nil}, Version{1, 0, 0, []PRVersion{prstr("rc"), prnum(1)}, nil}, -1}, + {Version{1, 0, 0, []PRVersion{prstr("rc"), prnum(1)}, nil}, Version{1, 0, 0, nil, nil}, -1}, + + // Ignore Build metadata + {Version{1, 0, 0, nil, []string{"1", "2", "3"}}, Version{1, 0, 0, nil, nil}, 0}, +} + +func TestCompare(t *testing.T) { + for _, test := range compareTests { + if res := test.v1.Compare(test.v2); res != test.result { + t.Errorf("Comparing %q : %q, expected %d but got %d", test.v1, test.v2, test.result, res) + } + //Test counterpart + if res := test.v2.Compare(test.v1); res != -test.result { + t.Errorf("Comparing %q : %q, expected %d but got %d", test.v2, test.v1, -test.result, res) + } + } +} + +type wrongformatTest struct { + v *Version + str string +} + +var wrongformatTests = []wrongformatTest{ + {nil, ""}, + {nil, "."}, + {nil, "1."}, + {nil, ".1"}, + {nil, "a.b.c"}, + {nil, "1.a.b"}, + {nil, "1.1.a"}, + {nil, "1.a.1"}, + {nil, "a.1.1"}, + {nil, ".."}, + {nil, "1.."}, + {nil, "1.1."}, + {nil, "1..1"}, + {nil, "1.1.+123"}, + {nil, "1.1.-beta"}, + {nil, "-1.1.1"}, + {nil, "1.-1.1"}, + {nil, "1.1.-1"}, + // giant numbers + {nil, "20000000000000000000.1.1"}, + {nil, "1.20000000000000000000.1"}, + {nil, "1.1.20000000000000000000"}, + {nil, "1.1.1-20000000000000000000"}, + // Leading zeroes + {nil, "01.1.1"}, + {nil, "001.1.1"}, + {nil, "1.01.1"}, + {nil, "1.001.1"}, + {nil, "1.1.01"}, + {nil, "1.1.001"}, + {nil, "1.1.1-01"}, + {nil, "1.1.1-001"}, + {nil, "1.1.1-beta.01"}, + {nil, "1.1.1-beta.001"}, + {&Version{0, 0, 0, []PRVersion{prstr("!")}, nil}, "0.0.0-!"}, + {&Version{0, 0, 0, nil, []string{"!"}}, "0.0.0+!"}, + // empty prversion + {&Version{0, 0, 0, []PRVersion{prstr(""), prstr("alpha")}, nil}, "0.0.0-.alpha"}, + // empty build meta data + {&Version{0, 0, 0, []PRVersion{prstr("alpha")}, []string{""}}, "0.0.0-alpha+"}, + {&Version{0, 0, 0, []PRVersion{prstr("alpha")}, []string{"test", ""}}, "0.0.0-alpha+test."}, +} + +func TestWrongFormat(t *testing.T) { + for _, test := range wrongformatTests { + + if res, err := Parse(test.str); err == nil { + t.Errorf("Parsing wrong format version %q, expected error but got %q", test.str, res) + } + + if test.v != nil { + if err := test.v.Validate(); err == nil { + t.Errorf("Validating wrong format version %q (%q), expected error", test.v, test.str) + } + } + } +} + +func TestCompareHelper(t *testing.T) { + v := Version{1, 0, 0, []PRVersion{prstr("alpha")}, nil} + v1 := Version{1, 0, 0, nil, nil} + if !v.EQ(v) { + t.Errorf("%q should be equal to %q", v, v) + } + if !v.Equals(v) { + t.Errorf("%q should be equal to %q", v, v) + } + if !v1.NE(v) { + t.Errorf("%q should not be equal to %q", v1, v) + } + if !v.GTE(v) { + t.Errorf("%q should be greater than or equal to %q", v, v) + } + if !v.LTE(v) { + t.Errorf("%q should be less than or equal to %q", v, v) + } + if !v.LT(v1) { + t.Errorf("%q should be less than %q", v, v1) + } + if !v.LTE(v1) { + t.Errorf("%q should be less than or equal %q", v, v1) + } + if !v.LE(v1) { + t.Errorf("%q should be less than or equal %q", v, v1) + } + if !v1.GT(v) { + t.Errorf("%q should be greater than %q", v1, v) + } + if !v1.GTE(v) { + t.Errorf("%q should be greater than or equal %q", v1, v) + } + if !v1.GE(v) { + t.Errorf("%q should be greater than or equal %q", v1, v) + } +} + +func TestPreReleaseVersions(t *testing.T) { + p1, err := NewPRVersion("123") + if !p1.IsNumeric() { + t.Errorf("Expected numeric prversion, got %q", p1) + } + if p1.VersionNum != 123 { + t.Error("Wrong prversion number") + } + if err != nil { + t.Errorf("Not expected error %q", err) + } + p2, err := NewPRVersion("alpha") + if p2.IsNumeric() { + t.Errorf("Expected non-numeric prversion, got %q", p2) + } + if p2.VersionStr != "alpha" { + t.Error("Wrong prversion string") + } + if err != nil { + t.Errorf("Not expected error %q", err) + } +} + +func TestBuildMetaDataVersions(t *testing.T) { + _, err := NewBuildVersion("123") + if err != nil { + t.Errorf("Unexpected error %q", err) + } + + _, err = NewBuildVersion("build") + if err != nil { + t.Errorf("Unexpected error %q", err) + } + + _, err = NewBuildVersion("test?") + if err == nil { + t.Error("Expected error, got none") + } + + _, err = NewBuildVersion("") + if err == nil { + t.Error("Expected error, got none") + } +} + +func TestNewHelper(t *testing.T) { + v, err := New("1.2.3") + if err != nil { + t.Fatalf("Unexpected error %q", err) + } + + // New returns pointer + if v == nil { + t.Fatal("Version is nil") + } + if v.Compare(Version{1, 2, 3, nil, nil}) != 0 { + t.Fatal("Unexpected comparison problem") + } +} + +func TestMakeHelper(t *testing.T) { + v, err := Make("1.2.3") + if err != nil { + t.Fatalf("Unexpected error %q", err) + } + if v.Compare(Version{1, 2, 3, nil, nil}) != 0 { + t.Fatal("Unexpected comparison problem") + } +} + +func BenchmarkParseSimple(b *testing.B) { + const VERSION = "0.0.1" + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + Parse(VERSION) + } +} + +func BenchmarkParseComplex(b *testing.B) { + const VERSION = "0.0.1-alpha.preview+123.456" + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + Parse(VERSION) + } +} + +func BenchmarkParseAverage(b *testing.B) { + l := len(formatTests) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + Parse(formatTests[n%l].result) + } +} + +func BenchmarkStringSimple(b *testing.B) { + const VERSION = "0.0.1" + v, _ := Parse(VERSION) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + v.String() + } +} + +func BenchmarkStringLarger(b *testing.B) { + const VERSION = "11.15.2012" + v, _ := Parse(VERSION) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + v.String() + } +} + +func BenchmarkStringComplex(b *testing.B) { + const VERSION = "0.0.1-alpha.preview+123.456" + v, _ := Parse(VERSION) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + v.String() + } +} + +func BenchmarkStringAverage(b *testing.B) { + l := len(formatTests) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + formatTests[n%l].v.String() + } +} + +func BenchmarkValidateSimple(b *testing.B) { + const VERSION = "0.0.1" + v, _ := Parse(VERSION) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + v.Validate() + } +} + +func BenchmarkValidateComplex(b *testing.B) { + const VERSION = "0.0.1-alpha.preview+123.456" + v, _ := Parse(VERSION) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + v.Validate() + } +} + +func BenchmarkValidateAverage(b *testing.B) { + l := len(formatTests) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + formatTests[n%l].v.Validate() + } +} + +func BenchmarkCompareSimple(b *testing.B) { + const VERSION = "0.0.1" + v, _ := Parse(VERSION) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + v.Compare(v) + } +} + +func BenchmarkCompareComplex(b *testing.B) { + const VERSION = "0.0.1-alpha.preview+123.456" + v, _ := Parse(VERSION) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + v.Compare(v) + } +} + +func BenchmarkCompareAverage(b *testing.B) { + l := len(compareTests) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + compareTests[n%l].v1.Compare((compareTests[n%l].v2)) + } +} diff --git a/vendor/github.com/blang/semver/sort.go b/vendor/github.com/blang/semver/sort.go new file mode 100644 index 000000000..e18f88082 --- /dev/null +++ b/vendor/github.com/blang/semver/sort.go @@ -0,0 +1,28 @@ +package semver + +import ( + "sort" +) + +// Versions represents multiple versions. +type Versions []Version + +// Len returns length of version collection +func (s Versions) Len() int { + return len(s) +} + +// Swap swaps two versions inside the collection by its indices +func (s Versions) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +// Less checks if version at index i is less than version at index j +func (s Versions) Less(i, j int) bool { + return s[i].LT(s[j]) +} + +// Sort sorts a slice of versions +func Sort(versions []Version) { + sort.Sort(Versions(versions)) +} diff --git a/vendor/github.com/blang/semver/sort_test.go b/vendor/github.com/blang/semver/sort_test.go new file mode 100644 index 000000000..68893972a --- /dev/null +++ b/vendor/github.com/blang/semver/sort_test.go @@ -0,0 +1,30 @@ +package semver + +import ( + "reflect" + "testing" +) + +func TestSort(t *testing.T) { + v100, _ := Parse("1.0.0") + v010, _ := Parse("0.1.0") + v001, _ := Parse("0.0.1") + versions := []Version{v010, v100, v001} + Sort(versions) + + correct := []Version{v001, v010, v100} + if !reflect.DeepEqual(versions, correct) { + t.Fatalf("Sort returned wrong order: %s", versions) + } +} + +func BenchmarkSort(b *testing.B) { + v100, _ := Parse("1.0.0") + v010, _ := Parse("0.1.0") + v001, _ := Parse("0.0.1") + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + Sort([]Version{v010, v100, v001}) + } +} diff --git a/vendor/github.com/blang/semver/sql.go b/vendor/github.com/blang/semver/sql.go new file mode 100644 index 000000000..eb4d80266 --- /dev/null +++ b/vendor/github.com/blang/semver/sql.go @@ -0,0 +1,30 @@ +package semver + +import ( + "database/sql/driver" + "fmt" +) + +// Scan implements the database/sql.Scanner interface. +func (v *Version) Scan(src interface{}) (err error) { + var str string + switch src := src.(type) { + case string: + str = src + case []byte: + str = string(src) + default: + return fmt.Errorf("Version.Scan: cannot convert %T to string.", src) + } + + if t, err := Parse(str); err == nil { + *v = t + } + + return +} + +// Value implements the database/sql/driver.Valuer interface. +func (v Version) Value() (driver.Value, error) { + return v.String(), nil +} diff --git a/vendor/github.com/blang/semver/sql_test.go b/vendor/github.com/blang/semver/sql_test.go new file mode 100644 index 000000000..ebf48b584 --- /dev/null +++ b/vendor/github.com/blang/semver/sql_test.go @@ -0,0 +1,38 @@ +package semver + +import ( + "testing" +) + +type scanTest struct { + val interface{} + shouldError bool + expected string +} + +var scanTests = []scanTest{ + {"1.2.3", false, "1.2.3"}, + {[]byte("1.2.3"), false, "1.2.3"}, + {7, true, ""}, + {7e4, true, ""}, + {true, true, ""}, +} + +func TestScanString(t *testing.T) { + for _, tc := range scanTests { + s := &Version{} + err := s.Scan(tc.val) + if tc.shouldError { + if err == nil { + t.Fatalf("Scan did not return an error on %v (%T)", tc.val, tc.val) + } + } else { + if err != nil { + t.Fatalf("Scan returned an unexpected error: %s (%T) on %v (%T)", tc.val, tc.val, tc.val, tc.val) + } + if val, _ := s.Value(); val != tc.expected { + t.Errorf("Wrong Value returned, expected %q, got %q", tc.expected, val) + } + } + } +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/filters/parse.go b/vendor/github.com/docker/docker/pkg/parsers/filters/parse.go new file mode 100644 index 000000000..df5486d51 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/filters/parse.go @@ -0,0 +1,116 @@ +package filters + +import ( + "encoding/json" + "errors" + "regexp" + "strings" +) + +type Args map[string][]string + +// Parse the argument to the filter flag. Like +// +// `docker ps -f 'created=today' -f 'image.name=ubuntu*'` +// +// If prev map is provided, then it is appended to, and returned. By default a new +// map is created. +func ParseFlag(arg string, prev Args) (Args, error) { + var filters Args = prev + if prev == nil { + filters = Args{} + } + if len(arg) == 0 { + return filters, nil + } + + if !strings.Contains(arg, "=") { + return filters, ErrorBadFormat + } + + f := strings.SplitN(arg, "=", 2) + name := strings.ToLower(strings.TrimSpace(f[0])) + value := strings.TrimSpace(f[1]) + filters[name] = append(filters[name], value) + + return filters, nil +} + +var ErrorBadFormat = errors.New("bad format of filter (expected name=value)") + +// packs the Args into an string for easy transport from client to server +func ToParam(a Args) (string, error) { + // this way we don't URL encode {}, just empty space + if len(a) == 0 { + return "", nil + } + + buf, err := json.Marshal(a) + if err != nil { + return "", err + } + return string(buf), nil +} + +// unpacks the filter Args +func FromParam(p string) (Args, error) { + args := Args{} + if len(p) == 0 { + return args, nil + } + if err := json.NewDecoder(strings.NewReader(p)).Decode(&args); err != nil { + return nil, err + } + return args, nil +} + +func (filters Args) MatchKVList(field string, sources map[string]string) bool { + fieldValues := filters[field] + + //do not filter if there is no filter set or cannot determine filter + if len(fieldValues) == 0 { + return true + } + + if sources == nil || len(sources) == 0 { + return false + } + +outer: + for _, name2match := range fieldValues { + testKV := strings.SplitN(name2match, "=", 2) + + for k, v := range sources { + if len(testKV) == 1 { + if k == testKV[0] { + continue outer + } + } else if k == testKV[0] && v == testKV[1] { + continue outer + } + } + + return false + } + + return true +} + +func (filters Args) Match(field, source string) bool { + fieldValues := filters[field] + + //do not filter if there is no filter set or cannot determine filter + if len(fieldValues) == 0 { + return true + } + for _, name2match := range fieldValues { + match, err := regexp.MatchString(name2match, source) + if err != nil { + continue + } + if match { + return true + } + } + return false +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/filters/parse_test.go b/vendor/github.com/docker/docker/pkg/parsers/filters/parse_test.go new file mode 100644 index 000000000..a141c33ce --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/filters/parse_test.go @@ -0,0 +1,218 @@ +package filters + +import ( + "sort" + "testing" +) + +func TestParseArgs(t *testing.T) { + // equivalent of `docker ps -f 'created=today' -f 'image.name=ubuntu*' -f 'image.name=*untu'` + flagArgs := []string{ + "created=today", + "image.name=ubuntu*", + "image.name=*untu", + } + var ( + args = Args{} + err error + ) + for i := range flagArgs { + args, err = ParseFlag(flagArgs[i], args) + if err != nil { + t.Errorf("failed to parse %s: %s", flagArgs[i], err) + } + } + if len(args["created"]) != 1 { + t.Errorf("failed to set this arg") + } + if len(args["image.name"]) != 2 { + t.Errorf("the args should have collapsed") + } +} + +func TestParseArgsEdgeCase(t *testing.T) { + var filters Args + args, err := ParseFlag("", filters) + if err != nil { + t.Fatal(err) + } + if args == nil || len(args) != 0 { + t.Fatalf("Expected an empty Args (map), got %v", args) + } + if args, err = ParseFlag("anything", args); err == nil || err != ErrorBadFormat { + t.Fatalf("Expected ErrorBadFormat, got %v", err) + } +} + +func TestToParam(t *testing.T) { + a := Args{ + "created": []string{"today"}, + "image.name": []string{"ubuntu*", "*untu"}, + } + + _, err := ToParam(a) + if err != nil { + t.Errorf("failed to marshal the filters: %s", err) + } +} + +func TestFromParam(t *testing.T) { + invalids := []string{ + "anything", + "['a','list']", + "{'key': 'value'}", + `{"key": "value"}`, + } + valids := map[string]Args{ + `{"key": ["value"]}`: { + "key": {"value"}, + }, + `{"key": ["value1", "value2"]}`: { + "key": {"value1", "value2"}, + }, + `{"key1": ["value1"], "key2": ["value2"]}`: { + "key1": {"value1"}, + "key2": {"value2"}, + }, + } + for _, invalid := range invalids { + if _, err := FromParam(invalid); err == nil { + t.Fatalf("Expected an error with %v, got nothing", invalid) + } + } + for json, expectedArgs := range valids { + args, err := FromParam(json) + if err != nil { + t.Fatal(err) + } + if len(args) != len(expectedArgs) { + t.Fatalf("Expected %v, go %v", expectedArgs, args) + } + for key, expectedValues := range expectedArgs { + values := args[key] + sort.Strings(values) + sort.Strings(expectedValues) + if len(values) != len(expectedValues) { + t.Fatalf("Expected %v, go %v", expectedArgs, args) + } + for index, expectedValue := range expectedValues { + if values[index] != expectedValue { + t.Fatalf("Expected %v, go %v", expectedArgs, args) + } + } + } + } +} + +func TestEmpty(t *testing.T) { + a := Args{} + v, err := ToParam(a) + if err != nil { + t.Errorf("failed to marshal the filters: %s", err) + } + v1, err := FromParam(v) + if err != nil { + t.Errorf("%s", err) + } + if len(a) != len(v1) { + t.Errorf("these should both be empty sets") + } +} + +func TestArgsMatchKVList(t *testing.T) { + // empty sources + args := Args{ + "created": []string{"today"}, + } + if args.MatchKVList("created", map[string]string{}) { + t.Fatalf("Expected false for (%v,created), got true", args) + } + // Not empty sources + sources := map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + } + matches := map[*Args]string{ + &Args{}: "field", + &Args{ + "created": []string{"today"}, + "labels": []string{"key1"}, + }: "labels", + &Args{ + "created": []string{"today"}, + "labels": []string{"key1=value1"}, + }: "labels", + } + differs := map[*Args]string{ + &Args{ + "created": []string{"today"}, + }: "created", + &Args{ + "created": []string{"today"}, + "labels": []string{"key4"}, + }: "labels", + &Args{ + "created": []string{"today"}, + "labels": []string{"key1=value3"}, + }: "labels", + } + for args, field := range matches { + if args.MatchKVList(field, sources) != true { + t.Fatalf("Expected true for %v on %v, got false", sources, args) + } + } + for args, field := range differs { + if args.MatchKVList(field, sources) != false { + t.Fatalf("Expected false for %v on %v, got true", sources, args) + } + } +} + +func TestArgsMatch(t *testing.T) { + source := "today" + matches := map[*Args]string{ + &Args{}: "field", + &Args{ + "created": []string{"today"}, + "labels": []string{"key1"}, + }: "today", + &Args{ + "created": []string{"to*"}, + }: "created", + &Args{ + "created": []string{"to(.*)"}, + }: "created", + &Args{ + "created": []string{"tod"}, + }: "created", + &Args{ + "created": []string{"anything", "to*"}, + }: "created", + } + differs := map[*Args]string{ + &Args{ + "created": []string{"tomorrow"}, + }: "created", + &Args{ + "created": []string{"to(day"}, + }: "created", + &Args{ + "created": []string{"tom(.*)"}, + }: "created", + &Args{ + "created": []string{"today1"}, + "labels": []string{"today"}, + }: "created", + } + for args, field := range matches { + if args.Match(field, source) != true { + t.Fatalf("Expected true for %v on %v, got false", source, args) + } + } + for args, field := range differs { + if args.Match(field, source) != false { + t.Fatalf("Expected false for %v on %v, got true", source, args) + } + } +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/kernel/kernel.go b/vendor/github.com/docker/docker/pkg/parsers/kernel/kernel.go new file mode 100644 index 000000000..5f7930684 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/kernel/kernel.go @@ -0,0 +1,95 @@ +// +build !windows + +package kernel + +import ( + "bytes" + "errors" + "fmt" +) + +type KernelVersionInfo struct { + Kernel int + Major int + Minor int + Flavor string +} + +func (k *KernelVersionInfo) String() string { + return fmt.Sprintf("%d.%d.%d%s", k.Kernel, k.Major, k.Minor, k.Flavor) +} + +// Compare two KernelVersionInfo struct. +// Returns -1 if a < b, 0 if a == b, 1 it a > b +func CompareKernelVersion(a, b *KernelVersionInfo) int { + if a.Kernel < b.Kernel { + return -1 + } else if a.Kernel > b.Kernel { + return 1 + } + + if a.Major < b.Major { + return -1 + } else if a.Major > b.Major { + return 1 + } + + if a.Minor < b.Minor { + return -1 + } else if a.Minor > b.Minor { + return 1 + } + + return 0 +} + +func GetKernelVersion() (*KernelVersionInfo, error) { + var ( + err error + ) + + uts, err := uname() + if err != nil { + return nil, err + } + + release := make([]byte, len(uts.Release)) + + i := 0 + for _, c := range uts.Release { + release[i] = byte(c) + i++ + } + + // Remove the \x00 from the release for Atoi to parse correctly + release = release[:bytes.IndexByte(release, 0)] + + return ParseRelease(string(release)) +} + +func ParseRelease(release string) (*KernelVersionInfo, error) { + var ( + kernel, major, minor, parsed int + flavor, partial string + ) + + // Ignore error from Sscanf to allow an empty flavor. Instead, just + // make sure we got all the version numbers. + parsed, _ = fmt.Sscanf(release, "%d.%d%s", &kernel, &major, &partial) + if parsed < 2 { + return nil, errors.New("Can't parse kernel version " + release) + } + + // sometimes we have 3.12.25-gentoo, but sometimes we just have 3.12-1-amd64 + parsed, _ = fmt.Sscanf(partial, ".%d%s", &minor, &flavor) + if parsed < 1 { + flavor = partial + } + + return &KernelVersionInfo{ + Kernel: kernel, + Major: major, + Minor: minor, + Flavor: flavor, + }, nil +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/kernel/kernel_test.go b/vendor/github.com/docker/docker/pkg/parsers/kernel/kernel_test.go new file mode 100644 index 000000000..7f40939cc --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/kernel/kernel_test.go @@ -0,0 +1,92 @@ +package kernel + +import ( + "fmt" + "testing" +) + +func assertParseRelease(t *testing.T, release string, b *KernelVersionInfo, result int) { + var ( + a *KernelVersionInfo + ) + a, _ = ParseRelease(release) + + if r := CompareKernelVersion(a, b); r != result { + t.Fatalf("Unexpected kernel version comparison result for (%v,%v). Found %d, expected %d", release, b, r, result) + } + if a.Flavor != b.Flavor { + t.Fatalf("Unexpected parsed kernel flavor. Found %s, expected %s", a.Flavor, b.Flavor) + } +} + +func TestParseRelease(t *testing.T) { + assertParseRelease(t, "3.8.0", &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, 0) + assertParseRelease(t, "3.4.54.longterm-1", &KernelVersionInfo{Kernel: 3, Major: 4, Minor: 54, Flavor: ".longterm-1"}, 0) + assertParseRelease(t, "3.4.54.longterm-1", &KernelVersionInfo{Kernel: 3, Major: 4, Minor: 54, Flavor: ".longterm-1"}, 0) + assertParseRelease(t, "3.8.0-19-generic", &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0, Flavor: "-19-generic"}, 0) + assertParseRelease(t, "3.12.8tag", &KernelVersionInfo{Kernel: 3, Major: 12, Minor: 8, Flavor: "tag"}, 0) + assertParseRelease(t, "3.12-1-amd64", &KernelVersionInfo{Kernel: 3, Major: 12, Minor: 0, Flavor: "-1-amd64"}, 0) + assertParseRelease(t, "3.8.0", &KernelVersionInfo{Kernel: 4, Major: 8, Minor: 0}, -1) + // Errors + invalids := []string{ + "3", + "a", + "a.a", + "a.a.a-a", + } + for _, invalid := range invalids { + expectedMessage := fmt.Sprintf("Can't parse kernel version %v", invalid) + if _, err := ParseRelease(invalid); err == nil || err.Error() != expectedMessage { + + } + } +} + +func assertKernelVersion(t *testing.T, a, b *KernelVersionInfo, result int) { + if r := CompareKernelVersion(a, b); r != result { + t.Fatalf("Unexpected kernel version comparison result. Found %d, expected %d", r, result) + } +} + +func TestCompareKernelVersion(t *testing.T) { + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + 0) + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 2, Major: 6, Minor: 0}, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + -1) + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + &KernelVersionInfo{Kernel: 2, Major: 6, Minor: 0}, + 1) + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + 0) + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 5}, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + 1) + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 3, Major: 0, Minor: 20}, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + -1) + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 3, Major: 7, Minor: 20}, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + -1) + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 20}, + &KernelVersionInfo{Kernel: 3, Major: 7, Minor: 0}, + 1) + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 20}, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + 1) + assertKernelVersion(t, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}, + &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 20}, + -1) +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/kernel/kernel_windows.go b/vendor/github.com/docker/docker/pkg/parsers/kernel/kernel_windows.go new file mode 100644 index 000000000..399d63e5f --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/kernel/kernel_windows.go @@ -0,0 +1,65 @@ +package kernel + +import ( + "fmt" + "syscall" + "unsafe" +) + +type KernelVersionInfo struct { + kvi string + major int + minor int + build int +} + +func (k *KernelVersionInfo) String() string { + return fmt.Sprintf("%d.%d %d (%s)", k.major, k.minor, k.build, k.kvi) +} + +func GetKernelVersion() (*KernelVersionInfo, error) { + + var ( + h syscall.Handle + dwVersion uint32 + err error + ) + + KVI := &KernelVersionInfo{"Unknown", 0, 0, 0} + + if err = syscall.RegOpenKeyEx(syscall.HKEY_LOCAL_MACHINE, + syscall.StringToUTF16Ptr(`SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\`), + 0, + syscall.KEY_READ, + &h); err != nil { + return KVI, err + } + defer syscall.RegCloseKey(h) + + var buf [1 << 10]uint16 + var typ uint32 + n := uint32(len(buf) * 2) // api expects array of bytes, not uint16 + + if err = syscall.RegQueryValueEx(h, + syscall.StringToUTF16Ptr("BuildLabEx"), + nil, + &typ, + (*byte)(unsafe.Pointer(&buf[0])), + &n); err != nil { + return KVI, err + } + + KVI.kvi = syscall.UTF16ToString(buf[:]) + + // Important - docker.exe MUST be manifested for this API to return + // the correct information. + if dwVersion, err = syscall.GetVersion(); err != nil { + return KVI, err + } + + KVI.major = int(dwVersion & 0xFF) + KVI.minor = int((dwVersion & 0XFF00) >> 8) + KVI.build = int((dwVersion & 0xFFFF0000) >> 16) + + return KVI, nil +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/kernel/uname_linux.go b/vendor/github.com/docker/docker/pkg/parsers/kernel/uname_linux.go new file mode 100644 index 000000000..8ca814c1f --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/kernel/uname_linux.go @@ -0,0 +1,16 @@ +package kernel + +import ( + "syscall" +) + +type Utsname syscall.Utsname + +func uname() (*syscall.Utsname, error) { + uts := &syscall.Utsname{} + + if err := syscall.Uname(uts); err != nil { + return nil, err + } + return uts, nil +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/kernel/uname_unsupported.go b/vendor/github.com/docker/docker/pkg/parsers/kernel/uname_unsupported.go new file mode 100644 index 000000000..00c542258 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/kernel/uname_unsupported.go @@ -0,0 +1,15 @@ +// +build !linux + +package kernel + +import ( + "errors" +) + +type Utsname struct { + Release [65]byte +} + +func uname() (*Utsname, error) { + return nil, errors.New("Kernel version detection is available only on linux") +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_linux.go b/vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_linux.go new file mode 100644 index 000000000..af185f9f6 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_linux.go @@ -0,0 +1,40 @@ +package operatingsystem + +import ( + "bytes" + "errors" + "io/ioutil" +) + +var ( + // file to use to detect if the daemon is running in a container + proc1Cgroup = "/proc/1/cgroup" + + // file to check to determine Operating System + etcOsRelease = "/etc/os-release" +) + +func GetOperatingSystem() (string, error) { + b, err := ioutil.ReadFile(etcOsRelease) + if err != nil { + return "", err + } + if i := bytes.Index(b, []byte("PRETTY_NAME")); i >= 0 { + b = b[i+13:] + return string(b[:bytes.IndexByte(b, '"')]), nil + } + return "", errors.New("PRETTY_NAME not found") +} + +func IsContainerized() (bool, error) { + b, err := ioutil.ReadFile(proc1Cgroup) + if err != nil { + return false, err + } + for _, line := range bytes.Split(b, []byte{'\n'}) { + if len(line) > 0 && !bytes.HasSuffix(line, []byte{'/'}) { + return true, nil + } + } + return false, nil +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_test.go b/vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_test.go new file mode 100644 index 000000000..b7d54cbb1 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_test.go @@ -0,0 +1,124 @@ +package operatingsystem + +import ( + "io/ioutil" + "os" + "path/filepath" + "testing" +) + +func TestGetOperatingSystem(t *testing.T) { + var ( + backup = etcOsRelease + ubuntuTrusty = []byte(`NAME="Ubuntu" +VERSION="14.04, Trusty Tahr" +ID=ubuntu +ID_LIKE=debian +PRETTY_NAME="Ubuntu 14.04 LTS" +VERSION_ID="14.04" +HOME_URL="http://www.ubuntu.com/" +SUPPORT_URL="http://help.ubuntu.com/" +BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"`) + gentoo = []byte(`NAME=Gentoo +ID=gentoo +PRETTY_NAME="Gentoo/Linux" +ANSI_COLOR="1;32" +HOME_URL="http://www.gentoo.org/" +SUPPORT_URL="http://www.gentoo.org/main/en/support.xml" +BUG_REPORT_URL="https://bugs.gentoo.org/" +`) + noPrettyName = []byte(`NAME="Ubuntu" +VERSION="14.04, Trusty Tahr" +ID=ubuntu +ID_LIKE=debian +VERSION_ID="14.04" +HOME_URL="http://www.ubuntu.com/" +SUPPORT_URL="http://help.ubuntu.com/" +BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"`) + ) + + dir := os.TempDir() + etcOsRelease = filepath.Join(dir, "etcOsRelease") + + defer func() { + os.Remove(etcOsRelease) + etcOsRelease = backup + }() + + for expect, osRelease := range map[string][]byte{ + "Ubuntu 14.04 LTS": ubuntuTrusty, + "Gentoo/Linux": gentoo, + "": noPrettyName, + } { + if err := ioutil.WriteFile(etcOsRelease, osRelease, 0600); err != nil { + t.Fatalf("failed to write to %s: %v", etcOsRelease, err) + } + s, err := GetOperatingSystem() + if s != expect { + if expect == "" { + t.Fatalf("Expected error 'PRETTY_NAME not found', but got %v", err) + } else { + t.Fatalf("Expected '%s', but got '%s'. Err=%v", expect, s, err) + } + } + } +} + +func TestIsContainerized(t *testing.T) { + var ( + backup = proc1Cgroup + nonContainerizedProc1Cgroup = []byte(`14:name=systemd:/ +13:hugetlb:/ +12:net_prio:/ +11:perf_event:/ +10:bfqio:/ +9:blkio:/ +8:net_cls:/ +7:freezer:/ +6:devices:/ +5:memory:/ +4:cpuacct:/ +3:cpu:/ +2:cpuset:/ +`) + containerizedProc1Cgroup = []byte(`9:perf_event:/docker/3cef1b53c50b0fa357d994f8a1a8cd783c76bbf4f5dd08b226e38a8bd331338d +8:blkio:/docker/3cef1b53c50b0fa357d994f8a1a8cd783c76bbf4f5dd08b226e38a8bd331338d +7:net_cls:/ +6:freezer:/docker/3cef1b53c50b0fa357d994f8a1a8cd783c76bbf4f5dd08b226e38a8bd331338d +5:devices:/docker/3cef1b53c50b0fa357d994f8a1a8cd783c76bbf4f5dd08b226e38a8bd331338d +4:memory:/docker/3cef1b53c50b0fa357d994f8a1a8cd783c76bbf4f5dd08b226e38a8bd331338d +3:cpuacct:/docker/3cef1b53c50b0fa357d994f8a1a8cd783c76bbf4f5dd08b226e38a8bd331338d +2:cpu:/docker/3cef1b53c50b0fa357d994f8a1a8cd783c76bbf4f5dd08b226e38a8bd331338d +1:cpuset:/`) + ) + + dir := os.TempDir() + proc1Cgroup = filepath.Join(dir, "proc1Cgroup") + + defer func() { + os.Remove(proc1Cgroup) + proc1Cgroup = backup + }() + + if err := ioutil.WriteFile(proc1Cgroup, nonContainerizedProc1Cgroup, 0600); err != nil { + t.Fatalf("failed to write to %s: %v", proc1Cgroup, err) + } + inContainer, err := IsContainerized() + if err != nil { + t.Fatal(err) + } + if inContainer { + t.Fatal("Wrongly assuming containerized") + } + + if err := ioutil.WriteFile(proc1Cgroup, containerizedProc1Cgroup, 0600); err != nil { + t.Fatalf("failed to write to %s: %v", proc1Cgroup, err) + } + inContainer, err = IsContainerized() + if err != nil { + t.Fatal(err) + } + if !inContainer { + t.Fatal("Wrongly assuming non-containerized") + } +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_windows.go b/vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_windows.go new file mode 100644 index 000000000..c843c6f84 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_windows.go @@ -0,0 +1,47 @@ +package operatingsystem + +import ( + "syscall" + "unsafe" +) + +// See https://code.google.com/p/go/source/browse/src/pkg/mime/type_windows.go?r=d14520ac25bf6940785aabb71f5be453a286f58c +// for a similar sample + +func GetOperatingSystem() (string, error) { + + var h syscall.Handle + + // Default return value + ret := "Unknown Operating System" + + if err := syscall.RegOpenKeyEx(syscall.HKEY_LOCAL_MACHINE, + syscall.StringToUTF16Ptr(`SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\`), + 0, + syscall.KEY_READ, + &h); err != nil { + return ret, err + } + defer syscall.RegCloseKey(h) + + var buf [1 << 10]uint16 + var typ uint32 + n := uint32(len(buf) * 2) // api expects array of bytes, not uint16 + + if err := syscall.RegQueryValueEx(h, + syscall.StringToUTF16Ptr("ProductName"), + nil, + &typ, + (*byte)(unsafe.Pointer(&buf[0])), + &n); err != nil { + return ret, err + } + ret = syscall.UTF16ToString(buf[:]) + + return ret, nil +} + +// No-op on Windows +func IsContainerized() (bool, error) { + return false, nil +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/parsers.go b/vendor/github.com/docker/docker/pkg/parsers/parsers.go new file mode 100644 index 000000000..ef7f942e5 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/parsers.go @@ -0,0 +1,170 @@ +package parsers + +import ( + "fmt" + "net/url" + "path" + "runtime" + "strconv" + "strings" +) + +// FIXME: Change this not to receive default value as parameter +func ParseHost(defaultTCPAddr, defaultUnixAddr, addr string) (string, error) { + addr = strings.TrimSpace(addr) + if addr == "" { + if runtime.GOOS != "windows" { + addr = fmt.Sprintf("unix://%s", defaultUnixAddr) + } else { + // Note - defaultTCPAddr already includes tcp:// prefix + addr = fmt.Sprintf("%s", defaultTCPAddr) + } + } + addrParts := strings.Split(addr, "://") + if len(addrParts) == 1 { + addrParts = []string{"tcp", addrParts[0]} + } + + switch addrParts[0] { + case "tcp": + return ParseTCPAddr(addrParts[1], defaultTCPAddr) + case "unix": + return ParseUnixAddr(addrParts[1], defaultUnixAddr) + case "fd": + return addr, nil + default: + return "", fmt.Errorf("Invalid bind address format: %s", addr) + } +} + +func ParseUnixAddr(addr string, defaultAddr string) (string, error) { + addr = strings.TrimPrefix(addr, "unix://") + if strings.Contains(addr, "://") { + return "", fmt.Errorf("Invalid proto, expected unix: %s", addr) + } + if addr == "" { + addr = defaultAddr + } + return fmt.Sprintf("unix://%s", addr), nil +} + +func ParseTCPAddr(addr string, defaultAddr string) (string, error) { + addr = strings.TrimPrefix(addr, "tcp://") + if strings.Contains(addr, "://") || addr == "" { + return "", fmt.Errorf("Invalid proto, expected tcp: %s", addr) + } + + u, err := url.Parse("tcp://" + addr) + if err != nil { + return "", err + } + hostParts := strings.Split(u.Host, ":") + if len(hostParts) != 2 { + return "", fmt.Errorf("Invalid bind address format: %s", addr) + } + host := hostParts[0] + if host == "" { + host = defaultAddr + } + + p, err := strconv.Atoi(hostParts[1]) + if err != nil && p == 0 { + return "", fmt.Errorf("Invalid bind address format: %s", addr) + } + return fmt.Sprintf("tcp://%s:%d%s", host, p, u.Path), nil +} + +// Get a repos name and returns the right reposName + tag|digest +// The tag can be confusing because of a port in a repository name. +// Ex: localhost.localdomain:5000/samalba/hipache:latest +// Digest ex: localhost:5000/foo/bar@sha256:bc8813ea7b3603864987522f02a76101c17ad122e1c46d790efc0fca78ca7bfb +func ParseRepositoryTag(repos string) (string, string) { + n := strings.Index(repos, "@") + if n >= 0 { + parts := strings.Split(repos, "@") + return parts[0], parts[1] + } + n = strings.LastIndex(repos, ":") + if n < 0 { + return repos, "" + } + if tag := repos[n+1:]; !strings.Contains(tag, "/") { + return repos[:n], tag + } + return repos, "" +} + +func PartParser(template, data string) (map[string]string, error) { + // ip:public:private + var ( + templateParts = strings.Split(template, ":") + parts = strings.Split(data, ":") + out = make(map[string]string, len(templateParts)) + ) + if len(parts) != len(templateParts) { + return nil, fmt.Errorf("Invalid format to parse. %s should match template %s", data, template) + } + + for i, t := range templateParts { + value := "" + if len(parts) > i { + value = parts[i] + } + out[t] = value + } + return out, nil +} + +func ParseKeyValueOpt(opt string) (string, string, error) { + parts := strings.SplitN(opt, "=", 2) + if len(parts) != 2 { + return "", "", fmt.Errorf("Unable to parse key/value option: %s", opt) + } + return strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]), nil +} + +func ParsePortRange(ports string) (uint64, uint64, error) { + if ports == "" { + return 0, 0, fmt.Errorf("Empty string specified for ports.") + } + if !strings.Contains(ports, "-") { + start, err := strconv.ParseUint(ports, 10, 16) + end := start + return start, end, err + } + + parts := strings.Split(ports, "-") + start, err := strconv.ParseUint(parts[0], 10, 16) + if err != nil { + return 0, 0, err + } + end, err := strconv.ParseUint(parts[1], 10, 16) + if err != nil { + return 0, 0, err + } + if end < start { + return 0, 0, fmt.Errorf("Invalid range specified for the Port: %s", ports) + } + return start, end, nil +} + +func ParseLink(val string) (string, string, error) { + if val == "" { + return "", "", fmt.Errorf("empty string specified for links") + } + arr := strings.Split(val, ":") + if len(arr) > 2 { + return "", "", fmt.Errorf("bad format for links: %s", val) + } + if len(arr) == 1 { + return val, val, nil + } + // This is kept because we can actually get an HostConfig with links + // from an already created container and the format is not `foo:bar` + // but `/foo:/c1/bar` + if strings.HasPrefix(arr[0], "/") { + _, alias := path.Split(arr[1]) + return arr[0][1:], alias, nil + } + return arr[0], arr[1], nil +} diff --git a/vendor/github.com/docker/docker/pkg/parsers/parsers_test.go b/vendor/github.com/docker/docker/pkg/parsers/parsers_test.go new file mode 100644 index 000000000..a64e6b946 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/parsers/parsers_test.go @@ -0,0 +1,210 @@ +package parsers + +import ( + "strings" + "testing" +) + +func TestParseHost(t *testing.T) { + var ( + defaultHttpHost = "127.0.0.1" + defaultUnix = "/var/run/docker.sock" + ) + invalids := map[string]string{ + "0.0.0.0": "Invalid bind address format: 0.0.0.0", + "tcp://": "Invalid proto, expected tcp: ", + "tcp:a.b.c.d": "Invalid bind address format: tcp:a.b.c.d", + "tcp:a.b.c.d/path": "Invalid bind address format: tcp:a.b.c.d/path", + "udp://127.0.0.1": "Invalid bind address format: udp://127.0.0.1", + "udp://127.0.0.1:2375": "Invalid bind address format: udp://127.0.0.1:2375", + } + valids := map[string]string{ + "0.0.0.1:5555": "tcp://0.0.0.1:5555", + "0.0.0.1:5555/path": "tcp://0.0.0.1:5555/path", + ":6666": "tcp://127.0.0.1:6666", + ":6666/path": "tcp://127.0.0.1:6666/path", + "tcp://:7777": "tcp://127.0.0.1:7777", + "tcp://:7777/path": "tcp://127.0.0.1:7777/path", + "": "unix:///var/run/docker.sock", + "unix:///run/docker.sock": "unix:///run/docker.sock", + "unix://": "unix:///var/run/docker.sock", + "fd://": "fd://", + "fd://something": "fd://something", + } + for invalidAddr, expectedError := range invalids { + if addr, err := ParseHost(defaultHttpHost, defaultUnix, invalidAddr); err == nil || err.Error() != expectedError { + t.Errorf("tcp %v address expected error %v return, got %s and addr %v", invalidAddr, expectedError, err, addr) + } + } + for validAddr, expectedAddr := range valids { + if addr, err := ParseHost(defaultHttpHost, defaultUnix, validAddr); err != nil || addr != expectedAddr { + t.Errorf("%v -> expected %v, got %v", validAddr, expectedAddr, addr) + } + } +} + +func TestParseInvalidUnixAddrInvalid(t *testing.T) { + if _, err := ParseUnixAddr("unix://tcp://127.0.0.1", "unix:///var/run/docker.sock"); err == nil || err.Error() != "Invalid proto, expected unix: tcp://127.0.0.1" { + t.Fatalf("Expected an error, got %v", err) + } +} + +func TestParseRepositoryTag(t *testing.T) { + if repo, tag := ParseRepositoryTag("root"); repo != "root" || tag != "" { + t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "root", "", repo, tag) + } + if repo, tag := ParseRepositoryTag("root:tag"); repo != "root" || tag != "tag" { + t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "root", "tag", repo, tag) + } + if repo, digest := ParseRepositoryTag("root@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); repo != "root" || digest != "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" { + t.Errorf("Expected repo: '%s' and digest: '%s', got '%s' and '%s'", "root", "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", repo, digest) + } + if repo, tag := ParseRepositoryTag("user/repo"); repo != "user/repo" || tag != "" { + t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "user/repo", "", repo, tag) + } + if repo, tag := ParseRepositoryTag("user/repo:tag"); repo != "user/repo" || tag != "tag" { + t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "user/repo", "tag", repo, tag) + } + if repo, digest := ParseRepositoryTag("user/repo@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); repo != "user/repo" || digest != "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" { + t.Errorf("Expected repo: '%s' and digest: '%s', got '%s' and '%s'", "user/repo", "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", repo, digest) + } + if repo, tag := ParseRepositoryTag("url:5000/repo"); repo != "url:5000/repo" || tag != "" { + t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "url:5000/repo", "", repo, tag) + } + if repo, tag := ParseRepositoryTag("url:5000/repo:tag"); repo != "url:5000/repo" || tag != "tag" { + t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "url:5000/repo", "tag", repo, tag) + } + if repo, digest := ParseRepositoryTag("url:5000/repo@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); repo != "url:5000/repo" || digest != "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" { + t.Errorf("Expected repo: '%s' and digest: '%s', got '%s' and '%s'", "url:5000/repo", "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", repo, digest) + } +} + +func TestParsePortMapping(t *testing.T) { + if _, err := PartParser("ip:public:private", "192.168.1.1:80"); err == nil { + t.Fatalf("Expected an error, got %v", err) + } + data, err := PartParser("ip:public:private", "192.168.1.1:80:8080") + if err != nil { + t.Fatal(err) + } + + if len(data) != 3 { + t.FailNow() + } + if data["ip"] != "192.168.1.1" { + t.Fail() + } + if data["public"] != "80" { + t.Fail() + } + if data["private"] != "8080" { + t.Fail() + } +} + +func TestParseKeyValueOpt(t *testing.T) { + invalids := map[string]string{ + "": "Unable to parse key/value option: ", + "key": "Unable to parse key/value option: key", + } + for invalid, expectedError := range invalids { + if _, _, err := ParseKeyValueOpt(invalid); err == nil || err.Error() != expectedError { + t.Fatalf("Expected error %v for %v, got %v", expectedError, invalid, err) + } + } + valids := map[string][]string{ + "key=value": {"key", "value"}, + " key = value ": {"key", "value"}, + "key=value1=value2": {"key", "value1=value2"}, + " key = value1 = value2 ": {"key", "value1 = value2"}, + } + for valid, expectedKeyValue := range valids { + key, value, err := ParseKeyValueOpt(valid) + if err != nil { + t.Fatal(err) + } + if key != expectedKeyValue[0] || value != expectedKeyValue[1] { + t.Fatalf("Expected {%v: %v} got {%v: %v}", expectedKeyValue[0], expectedKeyValue[1], key, value) + } + } +} + +func TestParsePortRange(t *testing.T) { + if start, end, err := ParsePortRange("8000-8080"); err != nil || start != 8000 || end != 8080 { + t.Fatalf("Error: %s or Expecting {start,end} values {8000,8080} but found {%d,%d}.", err, start, end) + } +} + +func TestParsePortRangeEmpty(t *testing.T) { + if _, _, err := ParsePortRange(""); err == nil || err.Error() != "Empty string specified for ports." { + t.Fatalf("Expected error 'Empty string specified for ports.', got %v", err) + } +} + +func TestParsePortRangeWithNoRange(t *testing.T) { + start, end, err := ParsePortRange("8080") + if err != nil { + t.Fatal(err) + } + if start != 8080 || end != 8080 { + t.Fatalf("Expected start and end to be the same and equal to 8080, but were %v and %v", start, end) + } +} + +func TestParsePortRangeIncorrectRange(t *testing.T) { + if _, _, err := ParsePortRange("9000-8080"); err == nil || !strings.Contains(err.Error(), "Invalid range specified for the Port") { + t.Fatalf("Expecting error 'Invalid range specified for the Port' but received %s.", err) + } +} + +func TestParsePortRangeIncorrectEndRange(t *testing.T) { + if _, _, err := ParsePortRange("8000-a"); err == nil || !strings.Contains(err.Error(), "invalid syntax") { + t.Fatalf("Expecting error 'Invalid range specified for the Port' but received %s.", err) + } + + if _, _, err := ParsePortRange("8000-30a"); err == nil || !strings.Contains(err.Error(), "invalid syntax") { + t.Fatalf("Expecting error 'Invalid range specified for the Port' but received %s.", err) + } +} + +func TestParsePortRangeIncorrectStartRange(t *testing.T) { + if _, _, err := ParsePortRange("a-8000"); err == nil || !strings.Contains(err.Error(), "invalid syntax") { + t.Fatalf("Expecting error 'Invalid range specified for the Port' but received %s.", err) + } + + if _, _, err := ParsePortRange("30a-8000"); err == nil || !strings.Contains(err.Error(), "invalid syntax") { + t.Fatalf("Expecting error 'Invalid range specified for the Port' but received %s.", err) + } +} + +func TestParseLink(t *testing.T) { + name, alias, err := ParseLink("name:alias") + if err != nil { + t.Fatalf("Expected not to error out on a valid name:alias format but got: %v", err) + } + if name != "name" { + t.Fatalf("Link name should have been name, got %s instead", name) + } + if alias != "alias" { + t.Fatalf("Link alias should have been alias, got %s instead", alias) + } + // short format definition + name, alias, err = ParseLink("name") + if err != nil { + t.Fatalf("Expected not to error out on a valid name only format but got: %v", err) + } + if name != "name" { + t.Fatalf("Link name should have been name, got %s instead", name) + } + if alias != "name" { + t.Fatalf("Link alias should have been name, got %s instead", alias) + } + // empty string link definition is not allowed + if _, _, err := ParseLink(""); err == nil || !strings.Contains(err.Error(), "empty string specified for links") { + t.Fatalf("Expected error 'empty string specified for links' but got: %v", err) + } + // more than two colons are not allowed + if _, _, err := ParseLink("link:alias:wrong"); err == nil || !strings.Contains(err.Error(), "bad format for links: link:alias:wrong") { + t.Fatalf("Expected error 'bad format for links: link:alias:wrong' but got: %v", err) + } +} diff --git a/vendor/github.com/docker/go-units/CONTRIBUTING.md b/vendor/github.com/docker/go-units/CONTRIBUTING.md new file mode 100644 index 000000000..9ea86d784 --- /dev/null +++ b/vendor/github.com/docker/go-units/CONTRIBUTING.md @@ -0,0 +1,67 @@ +# Contributing to go-units + +Want to hack on go-units? Awesome! Here are instructions to get you started. + +go-units is a part of the [Docker](https://www.docker.com) project, and follows +the same rules and principles. If you're already familiar with the way +Docker does things, you'll feel right at home. + +Otherwise, go read Docker's +[contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md), +[issue triaging](https://github.com/docker/docker/blob/master/project/ISSUE-TRIAGE.md), +[review process](https://github.com/docker/docker/blob/master/project/REVIEWING.md) and +[branches and tags](https://github.com/docker/docker/blob/master/project/BRANCHES-AND-TAGS.md). + +### Sign your work + +The sign-off is a simple line at the end of the explanation for the patch. Your +signature certifies that you wrote the patch or otherwise have the right to pass +it on as an open-source patch. The rules are pretty simple: if you can certify +the below (from [developercertificate.org](http://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +660 York Street, Suite 102, +San Francisco, CA 94110 USA + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. diff --git a/vendor/github.com/docker/go-units/LICENSE.code b/vendor/github.com/docker/go-units/LICENSE.code new file mode 100644 index 000000000..b55b37bc3 --- /dev/null +++ b/vendor/github.com/docker/go-units/LICENSE.code @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2015 Docker, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/docker/go-units/LICENSE.docs b/vendor/github.com/docker/go-units/LICENSE.docs new file mode 100644 index 000000000..e26cd4fc8 --- /dev/null +++ b/vendor/github.com/docker/go-units/LICENSE.docs @@ -0,0 +1,425 @@ +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + + including for purposes of Section 3(b); and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/vendor/github.com/docker/go-units/MAINTAINERS b/vendor/github.com/docker/go-units/MAINTAINERS new file mode 100644 index 000000000..477be8b21 --- /dev/null +++ b/vendor/github.com/docker/go-units/MAINTAINERS @@ -0,0 +1,27 @@ +# go-connections maintainers file +# +# This file describes who runs the docker/go-connections project and how. +# This is a living document - if you see something out of date or missing, speak up! +# +# It is structured to be consumable by both humans and programs. +# To extract its contents programmatically, use any TOML-compliant parser. +# +# This file is compiled into the MAINTAINERS file in docker/opensource. +# +[Org] + [Org."Core maintainers"] + people = [ + "calavera", + ] + +[people] + +# A reference list of all people associated with the project. +# All other sections should refer to people by their canonical key +# in the people section. + + # ADD YOURSELF HERE IN ALPHABETICAL ORDER + [people.calavera] + Name = "David Calavera" + Email = "david.calavera@gmail.com" + GitHub = "calavera" diff --git a/vendor/github.com/docker/go-units/README.md b/vendor/github.com/docker/go-units/README.md new file mode 100644 index 000000000..3ce4d79da --- /dev/null +++ b/vendor/github.com/docker/go-units/README.md @@ -0,0 +1,18 @@ +[![GoDoc](https://godoc.org/github.com/docker/go-units?status.svg)](https://godoc.org/github.com/docker/go-units) + +# Introduction + +go-units is a library to transform human friendly measurements into machine friendly values. + +## Usage + +See the [docs in godoc](https://godoc.org/github.com/docker/go-units) for examples and documentation. + +## Copyright and license + +Copyright © 2015 Docker, Inc. All rights reserved, except as follows. Code +is released under the Apache 2.0 license. The README.md file, and files in the +"docs" folder are licensed under the Creative Commons Attribution 4.0 +International License under the terms and conditions set forth in the file +"LICENSE.docs". You may obtain a duplicate copy of the same license, titled +CC-BY-SA-4.0, at http://creativecommons.org/licenses/by/4.0/. diff --git a/vendor/github.com/docker/go-units/circle.yml b/vendor/github.com/docker/go-units/circle.yml new file mode 100644 index 000000000..9043b3547 --- /dev/null +++ b/vendor/github.com/docker/go-units/circle.yml @@ -0,0 +1,11 @@ +dependencies: + post: + # install golint + - go get github.com/golang/lint/golint + +test: + pre: + # run analysis before tests + - go vet ./... + - test -z "$(golint ./... | tee /dev/stderr)" + - test -z "$(gofmt -s -l . | tee /dev/stderr)" diff --git a/vendor/github.com/docker/go-units/duration.go b/vendor/github.com/docker/go-units/duration.go new file mode 100644 index 000000000..c219a8a96 --- /dev/null +++ b/vendor/github.com/docker/go-units/duration.go @@ -0,0 +1,33 @@ +// Package units provides helper function to parse and print size and time units +// in human-readable format. +package units + +import ( + "fmt" + "time" +) + +// HumanDuration returns a human-readable approximation of a duration +// (eg. "About a minute", "4 hours ago", etc.). +func HumanDuration(d time.Duration) string { + if seconds := int(d.Seconds()); seconds < 1 { + return "Less than a second" + } else if seconds < 60 { + return fmt.Sprintf("%d seconds", seconds) + } else if minutes := int(d.Minutes()); minutes == 1 { + return "About a minute" + } else if minutes < 60 { + return fmt.Sprintf("%d minutes", minutes) + } else if hours := int(d.Hours()); hours == 1 { + return "About an hour" + } else if hours < 48 { + return fmt.Sprintf("%d hours", hours) + } else if hours < 24*7*2 { + return fmt.Sprintf("%d days", hours/24) + } else if hours < 24*30*3 { + return fmt.Sprintf("%d weeks", hours/24/7) + } else if hours < 24*365*2 { + return fmt.Sprintf("%d months", hours/24/30) + } + return fmt.Sprintf("%d years", int(d.Hours())/24/365) +} diff --git a/vendor/github.com/docker/go-units/duration_test.go b/vendor/github.com/docker/go-units/duration_test.go new file mode 100644 index 000000000..63baa515b --- /dev/null +++ b/vendor/github.com/docker/go-units/duration_test.go @@ -0,0 +1,81 @@ +package units + +import ( + "fmt" + "testing" + "time" +) + +func ExampleHumanDuration() { + fmt.Println(HumanDuration(450 * time.Millisecond)) + fmt.Println(HumanDuration(47 * time.Second)) + fmt.Println(HumanDuration(1 * time.Minute)) + fmt.Println(HumanDuration(3 * time.Minute)) + fmt.Println(HumanDuration(35 * time.Minute)) + fmt.Println(HumanDuration(35*time.Minute + 40*time.Second)) + fmt.Println(HumanDuration(1 * time.Hour)) + fmt.Println(HumanDuration(1*time.Hour + 45*time.Minute)) + fmt.Println(HumanDuration(3 * time.Hour)) + fmt.Println(HumanDuration(3*time.Hour + 59*time.Minute)) + fmt.Println(HumanDuration(3*time.Hour + 60*time.Minute)) + fmt.Println(HumanDuration(24 * time.Hour)) + fmt.Println(HumanDuration(24*time.Hour + 12*time.Hour)) + fmt.Println(HumanDuration(2 * 24 * time.Hour)) + fmt.Println(HumanDuration(7 * 24 * time.Hour)) + fmt.Println(HumanDuration(13*24*time.Hour + 5*time.Hour)) + fmt.Println(HumanDuration(2 * 7 * 24 * time.Hour)) + fmt.Println(HumanDuration(2*7*24*time.Hour + 4*24*time.Hour)) + fmt.Println(HumanDuration(3 * 7 * 24 * time.Hour)) + fmt.Println(HumanDuration(4 * 7 * 24 * time.Hour)) + fmt.Println(HumanDuration(4*7*24*time.Hour + 3*24*time.Hour)) + fmt.Println(HumanDuration(1 * 30 * 24 * time.Hour)) + fmt.Println(HumanDuration(1*30*24*time.Hour + 2*7*24*time.Hour)) + fmt.Println(HumanDuration(2 * 30 * 24 * time.Hour)) + fmt.Println(HumanDuration(3*30*24*time.Hour + 1*7*24*time.Hour)) + fmt.Println(HumanDuration(5*30*24*time.Hour + 2*7*24*time.Hour)) + fmt.Println(HumanDuration(13 * 30 * 24 * time.Hour)) + fmt.Println(HumanDuration(23 * 30 * 24 * time.Hour)) + fmt.Println(HumanDuration(24 * 30 * 24 * time.Hour)) + fmt.Println(HumanDuration(24*30*24*time.Hour + 2*7*24*time.Hour)) + fmt.Println(HumanDuration(3*365*24*time.Hour + 2*30*24*time.Hour)) +} + +func TestHumanDuration(t *testing.T) { + // Useful duration abstractions + day := 24 * time.Hour + week := 7 * day + month := 30 * day + year := 365 * day + + assertEquals(t, "Less than a second", HumanDuration(450*time.Millisecond)) + assertEquals(t, "47 seconds", HumanDuration(47*time.Second)) + assertEquals(t, "About a minute", HumanDuration(1*time.Minute)) + assertEquals(t, "3 minutes", HumanDuration(3*time.Minute)) + assertEquals(t, "35 minutes", HumanDuration(35*time.Minute)) + assertEquals(t, "35 minutes", HumanDuration(35*time.Minute+40*time.Second)) + assertEquals(t, "About an hour", HumanDuration(1*time.Hour)) + assertEquals(t, "About an hour", HumanDuration(1*time.Hour+45*time.Minute)) + assertEquals(t, "3 hours", HumanDuration(3*time.Hour)) + assertEquals(t, "3 hours", HumanDuration(3*time.Hour+59*time.Minute)) + assertEquals(t, "4 hours", HumanDuration(3*time.Hour+60*time.Minute)) + assertEquals(t, "24 hours", HumanDuration(24*time.Hour)) + assertEquals(t, "36 hours", HumanDuration(1*day+12*time.Hour)) + assertEquals(t, "2 days", HumanDuration(2*day)) + assertEquals(t, "7 days", HumanDuration(7*day)) + assertEquals(t, "13 days", HumanDuration(13*day+5*time.Hour)) + assertEquals(t, "2 weeks", HumanDuration(2*week)) + assertEquals(t, "2 weeks", HumanDuration(2*week+4*day)) + assertEquals(t, "3 weeks", HumanDuration(3*week)) + assertEquals(t, "4 weeks", HumanDuration(4*week)) + assertEquals(t, "4 weeks", HumanDuration(4*week+3*day)) + assertEquals(t, "4 weeks", HumanDuration(1*month)) + assertEquals(t, "6 weeks", HumanDuration(1*month+2*week)) + assertEquals(t, "8 weeks", HumanDuration(2*month)) + assertEquals(t, "3 months", HumanDuration(3*month+1*week)) + assertEquals(t, "5 months", HumanDuration(5*month+2*week)) + assertEquals(t, "13 months", HumanDuration(13*month)) + assertEquals(t, "23 months", HumanDuration(23*month)) + assertEquals(t, "24 months", HumanDuration(24*month)) + assertEquals(t, "2 years", HumanDuration(24*month+2*week)) + assertEquals(t, "3 years", HumanDuration(3*year+2*month)) +} diff --git a/vendor/github.com/docker/go-units/size.go b/vendor/github.com/docker/go-units/size.go new file mode 100644 index 000000000..989edd29b --- /dev/null +++ b/vendor/github.com/docker/go-units/size.go @@ -0,0 +1,95 @@ +package units + +import ( + "fmt" + "regexp" + "strconv" + "strings" +) + +// See: http://en.wikipedia.org/wiki/Binary_prefix +const ( + // Decimal + + KB = 1000 + MB = 1000 * KB + GB = 1000 * MB + TB = 1000 * GB + PB = 1000 * TB + + // Binary + + KiB = 1024 + MiB = 1024 * KiB + GiB = 1024 * MiB + TiB = 1024 * GiB + PiB = 1024 * TiB +) + +type unitMap map[string]int64 + +var ( + decimalMap = unitMap{"k": KB, "m": MB, "g": GB, "t": TB, "p": PB} + binaryMap = unitMap{"k": KiB, "m": MiB, "g": GiB, "t": TiB, "p": PiB} + sizeRegex = regexp.MustCompile(`^(\d+(\.\d+)*) ?([kKmMgGtTpP])?[bB]?$`) +) + +var decimapAbbrs = []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} +var binaryAbbrs = []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"} + +// CustomSize returns a human-readable approximation of a size +// using custom format. +func CustomSize(format string, size float64, base float64, _map []string) string { + i := 0 + for size >= base { + size = size / base + i++ + } + return fmt.Sprintf(format, size, _map[i]) +} + +// HumanSize returns a human-readable approximation of a size +// capped at 4 valid numbers (eg. "2.746 MB", "796 KB"). +func HumanSize(size float64) string { + return CustomSize("%.4g %s", size, 1000.0, decimapAbbrs) +} + +// BytesSize returns a human-readable size in bytes, kibibytes, +// mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB"). +func BytesSize(size float64) string { + return CustomSize("%.4g %s", size, 1024.0, binaryAbbrs) +} + +// FromHumanSize returns an integer from a human-readable specification of a +// size using SI standard (eg. "44kB", "17MB"). +func FromHumanSize(size string) (int64, error) { + return parseSize(size, decimalMap) +} + +// RAMInBytes parses a human-readable string representing an amount of RAM +// in bytes, kibibytes, mebibytes, gibibytes, or tebibytes and +// returns the number of bytes, or -1 if the string is unparseable. +// Units are case-insensitive, and the 'b' suffix is optional. +func RAMInBytes(size string) (int64, error) { + return parseSize(size, binaryMap) +} + +// Parses the human-readable size string into the amount it represents. +func parseSize(sizeStr string, uMap unitMap) (int64, error) { + matches := sizeRegex.FindStringSubmatch(sizeStr) + if len(matches) != 4 { + return -1, fmt.Errorf("invalid size: '%s'", sizeStr) + } + + size, err := strconv.ParseFloat(matches[1], 64) + if err != nil { + return -1, err + } + + unitPrefix := strings.ToLower(matches[3]) + if mul, ok := uMap[unitPrefix]; ok { + size *= float64(mul) + } + + return int64(size), nil +} diff --git a/vendor/github.com/docker/go-units/size_test.go b/vendor/github.com/docker/go-units/size_test.go new file mode 100644 index 000000000..003bc89a5 --- /dev/null +++ b/vendor/github.com/docker/go-units/size_test.go @@ -0,0 +1,163 @@ +package units + +import ( + "fmt" + "reflect" + "runtime" + "strings" + "testing" +) + +func ExampleBytesSize() { + fmt.Println(BytesSize(1024)) + fmt.Println(BytesSize(1024 * 1024)) + fmt.Println(BytesSize(1048576)) + fmt.Println(BytesSize(2 * MiB)) + fmt.Println(BytesSize(3.42 * GiB)) + fmt.Println(BytesSize(5.372 * TiB)) + fmt.Println(BytesSize(2.22 * PiB)) +} + +func ExampleHumanSize() { + fmt.Println(HumanSize(1000)) + fmt.Println(HumanSize(1024)) + fmt.Println(HumanSize(1000000)) + fmt.Println(HumanSize(1048576)) + fmt.Println(HumanSize(2 * MB)) + fmt.Println(HumanSize(float64(3.42 * GB))) + fmt.Println(HumanSize(float64(5.372 * TB))) + fmt.Println(HumanSize(float64(2.22 * PB))) +} + +func ExampleFromHumanSize() { + fmt.Println(FromHumanSize("32")) + fmt.Println(FromHumanSize("32b")) + fmt.Println(FromHumanSize("32B")) + fmt.Println(FromHumanSize("32k")) + fmt.Println(FromHumanSize("32K")) + fmt.Println(FromHumanSize("32kb")) + fmt.Println(FromHumanSize("32Kb")) + fmt.Println(FromHumanSize("32Mb")) + fmt.Println(FromHumanSize("32Gb")) + fmt.Println(FromHumanSize("32Tb")) + fmt.Println(FromHumanSize("32Pb")) +} + +func ExampleRAMInBytes() { + fmt.Println(RAMInBytes("32")) + fmt.Println(RAMInBytes("32b")) + fmt.Println(RAMInBytes("32B")) + fmt.Println(RAMInBytes("32k")) + fmt.Println(RAMInBytes("32K")) + fmt.Println(RAMInBytes("32kb")) + fmt.Println(RAMInBytes("32Kb")) + fmt.Println(RAMInBytes("32Mb")) + fmt.Println(RAMInBytes("32Gb")) + fmt.Println(RAMInBytes("32Tb")) + fmt.Println(RAMInBytes("32Pb")) + fmt.Println(RAMInBytes("32PB")) + fmt.Println(RAMInBytes("32P")) +} + +func TestBytesSize(t *testing.T) { + assertEquals(t, "1 KiB", BytesSize(1024)) + assertEquals(t, "1 MiB", BytesSize(1024*1024)) + assertEquals(t, "1 MiB", BytesSize(1048576)) + assertEquals(t, "2 MiB", BytesSize(2*MiB)) + assertEquals(t, "3.42 GiB", BytesSize(3.42*GiB)) + assertEquals(t, "5.372 TiB", BytesSize(5.372*TiB)) + assertEquals(t, "2.22 PiB", BytesSize(2.22*PiB)) +} + +func TestHumanSize(t *testing.T) { + assertEquals(t, "1 kB", HumanSize(1000)) + assertEquals(t, "1.024 kB", HumanSize(1024)) + assertEquals(t, "1 MB", HumanSize(1000000)) + assertEquals(t, "1.049 MB", HumanSize(1048576)) + assertEquals(t, "2 MB", HumanSize(2*MB)) + assertEquals(t, "3.42 GB", HumanSize(float64(3.42*GB))) + assertEquals(t, "5.372 TB", HumanSize(float64(5.372*TB))) + assertEquals(t, "2.22 PB", HumanSize(float64(2.22*PB))) +} + +func TestFromHumanSize(t *testing.T) { + assertSuccessEquals(t, 32, FromHumanSize, "32") + assertSuccessEquals(t, 32, FromHumanSize, "32b") + assertSuccessEquals(t, 32, FromHumanSize, "32B") + assertSuccessEquals(t, 32*KB, FromHumanSize, "32k") + assertSuccessEquals(t, 32*KB, FromHumanSize, "32K") + assertSuccessEquals(t, 32*KB, FromHumanSize, "32kb") + assertSuccessEquals(t, 32*KB, FromHumanSize, "32Kb") + assertSuccessEquals(t, 32*MB, FromHumanSize, "32Mb") + assertSuccessEquals(t, 32*GB, FromHumanSize, "32Gb") + assertSuccessEquals(t, 32*TB, FromHumanSize, "32Tb") + assertSuccessEquals(t, 32*PB, FromHumanSize, "32Pb") + + assertSuccessEquals(t, 32.5*KB, FromHumanSize, "32.5kB") + assertSuccessEquals(t, 32.5*KB, FromHumanSize, "32.5 kB") + assertSuccessEquals(t, 32, FromHumanSize, "32.5 B") + + assertError(t, FromHumanSize, "") + assertError(t, FromHumanSize, "hello") + assertError(t, FromHumanSize, "-32") + assertError(t, FromHumanSize, ".3kB") + assertError(t, FromHumanSize, " 32 ") + assertError(t, FromHumanSize, "32m b") + assertError(t, FromHumanSize, "32bm") +} + +func TestRAMInBytes(t *testing.T) { + assertSuccessEquals(t, 32, RAMInBytes, "32") + assertSuccessEquals(t, 32, RAMInBytes, "32b") + assertSuccessEquals(t, 32, RAMInBytes, "32B") + assertSuccessEquals(t, 32*KiB, RAMInBytes, "32k") + assertSuccessEquals(t, 32*KiB, RAMInBytes, "32K") + assertSuccessEquals(t, 32*KiB, RAMInBytes, "32kb") + assertSuccessEquals(t, 32*KiB, RAMInBytes, "32Kb") + assertSuccessEquals(t, 32*MiB, RAMInBytes, "32Mb") + assertSuccessEquals(t, 32*GiB, RAMInBytes, "32Gb") + assertSuccessEquals(t, 32*TiB, RAMInBytes, "32Tb") + assertSuccessEquals(t, 32*PiB, RAMInBytes, "32Pb") + assertSuccessEquals(t, 32*PiB, RAMInBytes, "32PB") + assertSuccessEquals(t, 32*PiB, RAMInBytes, "32P") + + assertSuccessEquals(t, 32, RAMInBytes, "32.3") + tmp := 32.3 * MiB + assertSuccessEquals(t, int64(tmp), RAMInBytes, "32.3 mb") + + assertError(t, RAMInBytes, "") + assertError(t, RAMInBytes, "hello") + assertError(t, RAMInBytes, "-32") + assertError(t, RAMInBytes, " 32 ") + assertError(t, RAMInBytes, "32m b") + assertError(t, RAMInBytes, "32bm") +} + +func assertEquals(t *testing.T, expected, actual interface{}) { + if expected != actual { + t.Errorf("Expected '%v' but got '%v'", expected, actual) + } +} + +// func that maps to the parse function signatures as testing abstraction +type parseFn func(string) (int64, error) + +// Define 'String()' for pretty-print +func (fn parseFn) String() string { + fnName := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name() + return fnName[strings.LastIndex(fnName, ".")+1:] +} + +func assertSuccessEquals(t *testing.T, expected int64, fn parseFn, arg string) { + res, err := fn(arg) + if err != nil || res != expected { + t.Errorf("%s(\"%s\") -> expected '%d' but got '%d' with error '%v'", fn, arg, expected, res, err) + } +} + +func assertError(t *testing.T, fn parseFn, arg string) { + res, err := fn(arg) + if err == nil && res != -1 { + t.Errorf("%s(\"%s\") -> expected error but got '%d'", fn, arg, res) + } +} diff --git a/vendor/github.com/docker/go-units/ulimit.go b/vendor/github.com/docker/go-units/ulimit.go new file mode 100644 index 000000000..5ac7fd825 --- /dev/null +++ b/vendor/github.com/docker/go-units/ulimit.go @@ -0,0 +1,118 @@ +package units + +import ( + "fmt" + "strconv" + "strings" +) + +// Ulimit is a human friendly version of Rlimit. +type Ulimit struct { + Name string + Hard int64 + Soft int64 +} + +// Rlimit specifies the resource limits, such as max open files. +type Rlimit struct { + Type int `json:"type,omitempty"` + Hard uint64 `json:"hard,omitempty"` + Soft uint64 `json:"soft,omitempty"` +} + +const ( + // magic numbers for making the syscall + // some of these are defined in the syscall package, but not all. + // Also since Windows client doesn't get access to the syscall package, need to + // define these here + rlimitAs = 9 + rlimitCore = 4 + rlimitCPU = 0 + rlimitData = 2 + rlimitFsize = 1 + rlimitLocks = 10 + rlimitMemlock = 8 + rlimitMsgqueue = 12 + rlimitNice = 13 + rlimitNofile = 7 + rlimitNproc = 6 + rlimitRss = 5 + rlimitRtprio = 14 + rlimitRttime = 15 + rlimitSigpending = 11 + rlimitStack = 3 +) + +var ulimitNameMapping = map[string]int{ + //"as": rlimitAs, // Disabled since this doesn't seem usable with the way Docker inits a container. + "core": rlimitCore, + "cpu": rlimitCPU, + "data": rlimitData, + "fsize": rlimitFsize, + "locks": rlimitLocks, + "memlock": rlimitMemlock, + "msgqueue": rlimitMsgqueue, + "nice": rlimitNice, + "nofile": rlimitNofile, + "nproc": rlimitNproc, + "rss": rlimitRss, + "rtprio": rlimitRtprio, + "rttime": rlimitRttime, + "sigpending": rlimitSigpending, + "stack": rlimitStack, +} + +// ParseUlimit parses and returns a Ulimit from the specified string. +func ParseUlimit(val string) (*Ulimit, error) { + parts := strings.SplitN(val, "=", 2) + if len(parts) != 2 { + return nil, fmt.Errorf("invalid ulimit argument: %s", val) + } + + if _, exists := ulimitNameMapping[parts[0]]; !exists { + return nil, fmt.Errorf("invalid ulimit type: %s", parts[0]) + } + + var ( + soft int64 + hard = &soft // default to soft in case no hard was set + temp int64 + err error + ) + switch limitVals := strings.Split(parts[1], ":"); len(limitVals) { + case 2: + temp, err = strconv.ParseInt(limitVals[1], 10, 64) + if err != nil { + return nil, err + } + hard = &temp + fallthrough + case 1: + soft, err = strconv.ParseInt(limitVals[0], 10, 64) + if err != nil { + return nil, err + } + default: + return nil, fmt.Errorf("too many limit value arguments - %s, can only have up to two, `soft[:hard]`", parts[1]) + } + + if soft > *hard { + return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: %d > %d", soft, *hard) + } + + return &Ulimit{Name: parts[0], Soft: soft, Hard: *hard}, nil +} + +// GetRlimit returns the RLimit corresponding to Ulimit. +func (u *Ulimit) GetRlimit() (*Rlimit, error) { + t, exists := ulimitNameMapping[u.Name] + if !exists { + return nil, fmt.Errorf("invalid ulimit name %s", u.Name) + } + + return &Rlimit{Type: t, Soft: uint64(u.Soft), Hard: uint64(u.Hard)}, nil +} + +func (u *Ulimit) String() string { + return fmt.Sprintf("%s=%d:%d", u.Name, u.Soft, u.Hard) +} diff --git a/vendor/github.com/docker/go-units/ulimit_test.go b/vendor/github.com/docker/go-units/ulimit_test.go new file mode 100644 index 000000000..3e7f10fc2 --- /dev/null +++ b/vendor/github.com/docker/go-units/ulimit_test.go @@ -0,0 +1,74 @@ +package units + +import ( + "fmt" + "strconv" + "testing" +) + +func ExampleParseUlimit() { + fmt.Println(ParseUlimit("nofile=512:1024")) + fmt.Println(ParseUlimit("nofile=1024")) + fmt.Println(ParseUlimit("cpu=2:4")) + fmt.Println(ParseUlimit("cpu=6")) +} + +func TestParseUlimitValid(t *testing.T) { + u1 := &Ulimit{"nofile", 1024, 512} + if u2, _ := ParseUlimit("nofile=512:1024"); *u1 != *u2 { + t.Fatalf("expected %q, but got %q", u1, u2) + } +} + +func TestParseUlimitInvalidLimitType(t *testing.T) { + if _, err := ParseUlimit("notarealtype=1024:1024"); err == nil { + t.Fatalf("expected error on invalid ulimit type") + } +} + +func TestParseUlimitBadFormat(t *testing.T) { + if _, err := ParseUlimit("nofile:1024:1024"); err == nil { + t.Fatal("expected error on bad syntax") + } + + if _, err := ParseUlimit("nofile"); err == nil { + t.Fatal("expected error on bad syntax") + } + + if _, err := ParseUlimit("nofile="); err == nil { + t.Fatal("expected error on bad syntax") + } + if _, err := ParseUlimit("nofile=:"); err == nil { + t.Fatal("expected error on bad syntax") + } + if _, err := ParseUlimit("nofile=:1024"); err == nil { + t.Fatal("expected error on bad syntax") + } +} + +func TestParseUlimitHardLessThanSoft(t *testing.T) { + if _, err := ParseUlimit("nofile=1024:1"); err == nil { + t.Fatal("expected error on hard limit less than soft limit") + } +} + +func TestParseUlimitInvalidValueType(t *testing.T) { + if _, err := ParseUlimit("nofile=asdf"); err == nil { + t.Fatal("expected error on bad value type, but got no error") + } else if _, ok := err.(*strconv.NumError); !ok { + t.Fatalf("expected error on bad value type, but got `%s`", err) + } + + if _, err := ParseUlimit("nofile=1024:asdf"); err == nil { + t.Fatal("expected error on bad value type, but got no error") + } else if _, ok := err.(*strconv.NumError); !ok { + t.Fatalf("expected error on bad value type, but got `%s`", err) + } +} + +func TestUlimitStringOutput(t *testing.T) { + u := &Ulimit{"nofile", 1024, 512} + if s := u.String(); s != "nofile=512:1024" { + t.Fatal("expected String to return nofile=512:1024, but got", s) + } +} diff --git a/vendor/github.com/juju/ratelimit/ratelimit.go b/vendor/github.com/juju/ratelimit/ratelimit.go index a36ffc74f..3ef32fbcc 100644 --- a/vendor/github.com/juju/ratelimit/ratelimit.go +++ b/vendor/github.com/juju/ratelimit/ratelimit.go @@ -8,10 +8,10 @@ package ratelimit import ( + "math" "strconv" "sync" "time" - "math" ) // Bucket represents a token bucket that fills at a predetermined rate. @@ -171,6 +171,30 @@ func (tb *Bucket) takeAvailable(now time.Time, count int64) int64 { return count } +// Available returns the number of available tokens. It will be negative +// when there are consumers waiting for tokens. Note that if this +// returns greater than zero, it does not guarantee that calls that take +// tokens from the buffer will succeed, as the number of available +// tokens could have changed in the meantime. This method is intended +// primarily for metrics reporting and debugging. +func (tb *Bucket) Available() int64 { + return tb.available(time.Now()) +} + +// available is the internal version of available - it takes the current time as +// an argument to enable easy testing. +func (tb *Bucket) available(now time.Time) int64 { + tb.mu.Lock() + defer tb.mu.Unlock() + tb.adjust(now) + return tb.avail +} + +// Capacity returns the capacity that the bucket was created with. +func (tb *Bucket) Capacity() int64 { + return tb.capacity +} + // Rate returns the fill rate of the bucket, in tokens per second. func (tb *Bucket) Rate() float64 { return 1e9 * float64(tb.quantum) / float64(tb.fillInterval) diff --git a/vendor/github.com/juju/ratelimit/ratelimit_test.go b/vendor/github.com/juju/ratelimit/ratelimit_test.go index 9438a66e3..62d88ded0 100644 --- a/vendor/github.com/juju/ratelimit/ratelimit_test.go +++ b/vendor/github.com/juju/ratelimit/ratelimit_test.go @@ -5,10 +5,11 @@ package ratelimit import ( - gc "launchpad.net/gocheck" - + "math" "testing" "time" + + gc "gopkg.in/check.v1" ) func TestPackage(t *testing.T) { @@ -125,6 +126,49 @@ var takeTests = []struct { }}, }} +var availTests = []struct { + about string + capacity int64 + fillInterval time.Duration + take int64 + sleep time.Duration + + expectCountAfterTake int64 + expectCountAfterSleep int64 +}{{ + about: "should fill tokens after interval", + capacity: 5, + fillInterval: time.Second, + take: 5, + sleep: time.Second, + expectCountAfterTake: 0, + expectCountAfterSleep: 1, +}, { + about: "should fill tokens plus existing count", + capacity: 2, + fillInterval: time.Second, + take: 1, + sleep: time.Second, + expectCountAfterTake: 1, + expectCountAfterSleep: 2, +}, { + about: "shouldn't fill before interval", + capacity: 2, + fillInterval: 2 * time.Second, + take: 1, + sleep: time.Second, + expectCountAfterTake: 1, + expectCountAfterSleep: 1, +}, { + about: "should fill only once after 1*interval before 2*interval", + capacity: 2, + fillInterval: 2 * time.Second, + take: 1, + sleep: 3 * time.Second, + expectCountAfterTake: 1, + expectCountAfterSleep: 2, +}} + func (rateLimitSuite) TestTake(c *gc.C) { for i, test := range takeTests { tb := NewBucket(test.fillInterval, test.capacity) @@ -261,7 +305,7 @@ func (rateLimitSuite) TestPanics(c *gc.C) { } func isCloseTo(x, y, tolerance float64) bool { - return abs(x-y)/y < tolerance + return math.Abs(x-y)/y < tolerance } func (rateLimitSuite) TestRate(c *gc.C) { @@ -320,6 +364,23 @@ func (rateLimitSuite) TestNewWithRate(c *gc.C) { } } +func TestAvailable(t *testing.T) { + for i, tt := range availTests { + tb := NewBucket(tt.fillInterval, tt.capacity) + if c := tb.takeAvailable(tb.startTime, tt.take); c != tt.take { + t.Fatalf("#%d: %s, take = %d, want = %d", i, tt.about, c, tt.take) + } + if c := tb.available(tb.startTime); c != tt.expectCountAfterTake { + t.Fatalf("#%d: %s, after take, available = %d, want = %d", i, tt.about, c, tt.expectCountAfterTake) + } + if c := tb.available(tb.startTime.Add(tt.sleep)); c != tt.expectCountAfterSleep { + t.Fatalf("#%d: %s, after some time it should fill in new tokens, available = %d, want = %d", + i, tt.about, c, tt.expectCountAfterSleep) + } + } + +} + func BenchmarkWait(b *testing.B) { tb := NewBucket(1, 16*1024) for i := b.N - 1; i >= 0; i-- { diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups.go new file mode 100644 index 000000000..c8f779656 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups.go @@ -0,0 +1,64 @@ +// +build linux + +package cgroups + +import ( + "fmt" + + "github.com/opencontainers/runc/libcontainer/configs" +) + +type Manager interface { + // Apply cgroup configuration to the process with the specified pid + Apply(pid int) error + + // Returns the PIDs inside the cgroup set + GetPids() ([]int, error) + + // Returns the PIDs inside the cgroup set & all sub-cgroups + GetAllPids() ([]int, error) + + // Returns statistics for the cgroup set + GetStats() (*Stats, error) + + // Toggles the freezer cgroup according with specified state + Freeze(state configs.FreezerState) error + + // Destroys the cgroup set + Destroy() error + + // NewCgroupManager() and LoadCgroupManager() require following attributes: + // Paths map[string]string + // Cgroups *cgroups.Cgroup + // Paths maps cgroup subsystem to path at which it is mounted. + // Cgroups specifies specific cgroup settings for the various subsystems + + // Returns cgroup paths to save in a state file and to be able to + // restore the object later. + GetPaths() map[string]string + + // Set the cgroup as configured. + Set(container *configs.Config) error +} + +type NotFoundError struct { + Subsystem string +} + +func (e *NotFoundError) Error() string { + return fmt.Sprintf("mountpoint for %s not found", e.Subsystem) +} + +func NewNotFoundError(sub string) error { + return &NotFoundError{ + Subsystem: sub, + } +} + +func IsNotFound(err error) bool { + if err == nil { + return false + } + _, ok := err.(*NotFoundError) + return ok +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_test.go new file mode 100644 index 000000000..2f702bc2e --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_test.go @@ -0,0 +1,18 @@ +// +build linux + +package cgroups + +import ( + "testing" +) + +func TestParseCgroups(t *testing.T) { + cgroups, err := ParseCgroupFile("/proc/self/cgroup") + if err != nil { + t.Fatal(err) + } + + if _, ok := cgroups["cpu"]; !ok { + t.Fail() + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_unsupported.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_unsupported.go new file mode 100644 index 000000000..278d507e2 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_unsupported.go @@ -0,0 +1,3 @@ +// +build !linux + +package cgroups diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/apply_raw.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/apply_raw.go new file mode 100644 index 000000000..21646e571 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/apply_raw.go @@ -0,0 +1,393 @@ +// +build linux + +package fs + +import ( + "errors" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strconv" + "sync" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +var ( + subsystems = subsystemSet{ + &CpusetGroup{}, + &DevicesGroup{}, + &MemoryGroup{}, + &CpuGroup{}, + &CpuacctGroup{}, + &PidsGroup{}, + &BlkioGroup{}, + &HugetlbGroup{}, + &NetClsGroup{}, + &NetPrioGroup{}, + &PerfEventGroup{}, + &FreezerGroup{}, + } + CgroupProcesses = "cgroup.procs" + HugePageSizes, _ = cgroups.GetHugePageSize() +) + +var errSubsystemDoesNotExist = errors.New("cgroup: subsystem does not exist") + +type subsystemSet []subsystem + +func (s subsystemSet) Get(name string) (subsystem, error) { + for _, ss := range s { + if ss.Name() == name { + return ss, nil + } + } + return nil, errSubsystemDoesNotExist +} + +type subsystem interface { + // Name returns the name of the subsystem. + Name() string + // Returns the stats, as 'stats', corresponding to the cgroup under 'path'. + GetStats(path string, stats *cgroups.Stats) error + // Removes the cgroup represented by 'cgroupData'. + Remove(*cgroupData) error + // Creates and joins the cgroup represented by 'cgroupData'. + Apply(*cgroupData) error + // Set the cgroup represented by cgroup. + Set(path string, cgroup *configs.Cgroup) error +} + +type Manager struct { + mu sync.Mutex + Cgroups *configs.Cgroup + Paths map[string]string +} + +// The absolute path to the root of the cgroup hierarchies. +var cgroupRootLock sync.Mutex +var cgroupRoot string + +// Gets the cgroupRoot. +func getCgroupRoot() (string, error) { + cgroupRootLock.Lock() + defer cgroupRootLock.Unlock() + + if cgroupRoot != "" { + return cgroupRoot, nil + } + + root, err := cgroups.FindCgroupMountpointDir() + if err != nil { + return "", err + } + + if _, err := os.Stat(root); err != nil { + return "", err + } + + cgroupRoot = root + return cgroupRoot, nil +} + +type cgroupData struct { + root string + innerPath string + config *configs.Cgroup + pid int +} + +func (m *Manager) Apply(pid int) (err error) { + if m.Cgroups == nil { + return nil + } + + var c = m.Cgroups + + d, err := getCgroupData(m.Cgroups, pid) + if err != nil { + return err + } + + if c.Paths != nil { + paths := make(map[string]string) + for name, path := range c.Paths { + _, err := d.path(name) + if err != nil { + if cgroups.IsNotFound(err) { + continue + } + return err + } + paths[name] = path + } + m.Paths = paths + return cgroups.EnterPid(m.Paths, pid) + } + + paths := make(map[string]string) + defer func() { + if err != nil { + cgroups.RemovePaths(paths) + } + }() + for _, sys := range subsystems { + if err := sys.Apply(d); err != nil { + return err + } + // TODO: Apply should, ideally, be reentrant or be broken up into a separate + // create and join phase so that the cgroup hierarchy for a container can be + // created then join consists of writing the process pids to cgroup.procs + p, err := d.path(sys.Name()) + if err != nil { + if cgroups.IsNotFound(err) { + continue + } + return err + } + paths[sys.Name()] = p + } + m.Paths = paths + return nil +} + +func (m *Manager) Destroy() error { + if m.Cgroups.Paths != nil { + return nil + } + m.mu.Lock() + defer m.mu.Unlock() + if err := cgroups.RemovePaths(m.Paths); err != nil { + return err + } + m.Paths = make(map[string]string) + return nil +} + +func (m *Manager) GetPaths() map[string]string { + m.mu.Lock() + paths := m.Paths + m.mu.Unlock() + return paths +} + +func (m *Manager) GetStats() (*cgroups.Stats, error) { + m.mu.Lock() + defer m.mu.Unlock() + stats := cgroups.NewStats() + for name, path := range m.Paths { + sys, err := subsystems.Get(name) + if err == errSubsystemDoesNotExist || !cgroups.PathExists(path) { + continue + } + if err := sys.GetStats(path, stats); err != nil { + return nil, err + } + } + return stats, nil +} + +func (m *Manager) Set(container *configs.Config) error { + for _, sys := range subsystems { + // Generate fake cgroup data. + d, err := getCgroupData(container.Cgroups, -1) + if err != nil { + return err + } + // Get the path, but don't error out if the cgroup wasn't found. + path, err := d.path(sys.Name()) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + + if err := sys.Set(path, container.Cgroups); err != nil { + return err + } + } + + if m.Paths["cpu"] != "" { + if err := CheckCpushares(m.Paths["cpu"], container.Cgroups.Resources.CpuShares); err != nil { + return err + } + } + return nil +} + +// Freeze toggles the container's freezer cgroup depending on the state +// provided +func (m *Manager) Freeze(state configs.FreezerState) error { + d, err := getCgroupData(m.Cgroups, 0) + if err != nil { + return err + } + dir, err := d.path("freezer") + if err != nil { + return err + } + prevState := m.Cgroups.Resources.Freezer + m.Cgroups.Resources.Freezer = state + freezer, err := subsystems.Get("freezer") + if err != nil { + return err + } + err = freezer.Set(dir, m.Cgroups) + if err != nil { + m.Cgroups.Resources.Freezer = prevState + return err + } + return nil +} + +func (m *Manager) GetPids() ([]int, error) { + dir, err := getCgroupPath(m.Cgroups) + if err != nil { + return nil, err + } + return cgroups.GetPids(dir) +} + +func (m *Manager) GetAllPids() ([]int, error) { + dir, err := getCgroupPath(m.Cgroups) + if err != nil { + return nil, err + } + return cgroups.GetAllPids(dir) +} + +func getCgroupPath(c *configs.Cgroup) (string, error) { + d, err := getCgroupData(c, 0) + if err != nil { + return "", err + } + + return d.path("devices") +} + +func getCgroupData(c *configs.Cgroup, pid int) (*cgroupData, error) { + root, err := getCgroupRoot() + if err != nil { + return nil, err + } + + if (c.Name != "" || c.Parent != "") && c.Path != "" { + return nil, fmt.Errorf("cgroup: either Path or Name and Parent should be used") + } + + innerPath := c.Path + if innerPath == "" { + innerPath = filepath.Join(c.Parent, c.Name) + } + + return &cgroupData{ + root: root, + innerPath: c.Path, + config: c, + pid: pid, + }, nil +} + +func (raw *cgroupData) parentPath(subsystem, mountpoint, root string) (string, error) { + // Use GetThisCgroupDir instead of GetInitCgroupDir, because the creating + // process could in container and shared pid namespace with host, and + // /proc/1/cgroup could point to whole other world of cgroups. + initPath, err := cgroups.GetThisCgroupDir(subsystem) + if err != nil { + return "", err + } + // This is needed for nested containers, because in /proc/self/cgroup we + // see pathes from host, which don't exist in container. + relDir, err := filepath.Rel(root, initPath) + if err != nil { + return "", err + } + return filepath.Join(mountpoint, relDir), nil +} + +func (raw *cgroupData) path(subsystem string) (string, error) { + mnt, root, err := cgroups.FindCgroupMountpointAndRoot(subsystem) + // If we didn't mount the subsystem, there is no point we make the path. + if err != nil { + return "", err + } + + // If the cgroup name/path is absolute do not look relative to the cgroup of the init process. + if filepath.IsAbs(raw.innerPath) { + // Sometimes subsystems can be mounted togethger as 'cpu,cpuacct'. + return filepath.Join(raw.root, filepath.Base(mnt), raw.innerPath), nil + } + + parentPath, err := raw.parentPath(subsystem, mnt, root) + if err != nil { + return "", err + } + + return filepath.Join(parentPath, raw.innerPath), nil +} + +func (raw *cgroupData) join(subsystem string) (string, error) { + path, err := raw.path(subsystem) + if err != nil { + return "", err + } + if err := os.MkdirAll(path, 0755); err != nil { + return "", err + } + if err := writeFile(path, CgroupProcesses, strconv.Itoa(raw.pid)); err != nil { + return "", err + } + return path, nil +} + +func writeFile(dir, file, data string) error { + // Normally dir should not be empty, one case is that cgroup subsystem + // is not mounted, we will get empty dir, and we want it fail here. + if dir == "" { + return fmt.Errorf("no such directory for %s.", file) + } + return ioutil.WriteFile(filepath.Join(dir, file), []byte(data), 0700) +} + +func readFile(dir, file string) (string, error) { + data, err := ioutil.ReadFile(filepath.Join(dir, file)) + return string(data), err +} + +func removePath(p string, err error) error { + if err != nil { + return err + } + if p != "" { + return os.RemoveAll(p) + } + return nil +} + +func CheckCpushares(path string, c int64) error { + var cpuShares int64 + + if c == 0 { + return nil + } + + fd, err := os.Open(filepath.Join(path, "cpu.shares")) + if err != nil { + return err + } + defer fd.Close() + + _, err = fmt.Fscanf(fd, "%d", &cpuShares) + if err != nil && err != io.EOF { + return err + } + + if c > cpuShares { + return fmt.Errorf("The maximum allowed cpu-shares is %d", cpuShares) + } else if c < cpuShares { + return fmt.Errorf("The minimum allowed cpu-shares is %d", cpuShares) + } + + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio.go new file mode 100644 index 000000000..a142cb991 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio.go @@ -0,0 +1,237 @@ +// +build linux + +package fs + +import ( + "bufio" + "fmt" + "os" + "path/filepath" + "strconv" + "strings" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type BlkioGroup struct { +} + +func (s *BlkioGroup) Name() string { + return "blkio" +} + +func (s *BlkioGroup) Apply(d *cgroupData) error { + _, err := d.join("blkio") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func (s *BlkioGroup) Set(path string, cgroup *configs.Cgroup) error { + if cgroup.Resources.BlkioWeight != 0 { + if err := writeFile(path, "blkio.weight", strconv.FormatUint(uint64(cgroup.Resources.BlkioWeight), 10)); err != nil { + return err + } + } + + if cgroup.Resources.BlkioLeafWeight != 0 { + if err := writeFile(path, "blkio.leaf_weight", strconv.FormatUint(uint64(cgroup.Resources.BlkioLeafWeight), 10)); err != nil { + return err + } + } + for _, wd := range cgroup.Resources.BlkioWeightDevice { + if err := writeFile(path, "blkio.weight_device", wd.WeightString()); err != nil { + return err + } + if err := writeFile(path, "blkio.leaf_weight_device", wd.LeafWeightString()); err != nil { + return err + } + } + for _, td := range cgroup.Resources.BlkioThrottleReadBpsDevice { + if err := writeFile(path, "blkio.throttle.read_bps_device", td.String()); err != nil { + return err + } + } + for _, td := range cgroup.Resources.BlkioThrottleWriteBpsDevice { + if err := writeFile(path, "blkio.throttle.write_bps_device", td.String()); err != nil { + return err + } + } + for _, td := range cgroup.Resources.BlkioThrottleReadIOPSDevice { + if err := writeFile(path, "blkio.throttle.read_iops_device", td.String()); err != nil { + return err + } + } + for _, td := range cgroup.Resources.BlkioThrottleWriteIOPSDevice { + if err := writeFile(path, "blkio.throttle.write_iops_device", td.String()); err != nil { + return err + } + } + + return nil +} + +func (s *BlkioGroup) Remove(d *cgroupData) error { + return removePath(d.path("blkio")) +} + +/* +examples: + + blkio.sectors + 8:0 6792 + + blkio.io_service_bytes + 8:0 Read 1282048 + 8:0 Write 2195456 + 8:0 Sync 2195456 + 8:0 Async 1282048 + 8:0 Total 3477504 + Total 3477504 + + blkio.io_serviced + 8:0 Read 124 + 8:0 Write 104 + 8:0 Sync 104 + 8:0 Async 124 + 8:0 Total 228 + Total 228 + + blkio.io_queued + 8:0 Read 0 + 8:0 Write 0 + 8:0 Sync 0 + 8:0 Async 0 + 8:0 Total 0 + Total 0 +*/ + +func splitBlkioStatLine(r rune) bool { + return r == ' ' || r == ':' +} + +func getBlkioStat(path string) ([]cgroups.BlkioStatEntry, error) { + var blkioStats []cgroups.BlkioStatEntry + f, err := os.Open(path) + if err != nil { + if os.IsNotExist(err) { + return blkioStats, nil + } + return nil, err + } + defer f.Close() + + sc := bufio.NewScanner(f) + for sc.Scan() { + // format: dev type amount + fields := strings.FieldsFunc(sc.Text(), splitBlkioStatLine) + if len(fields) < 3 { + if len(fields) == 2 && fields[0] == "Total" { + // skip total line + continue + } else { + return nil, fmt.Errorf("Invalid line found while parsing %s: %s", path, sc.Text()) + } + } + + v, err := strconv.ParseUint(fields[0], 10, 64) + if err != nil { + return nil, err + } + major := v + + v, err = strconv.ParseUint(fields[1], 10, 64) + if err != nil { + return nil, err + } + minor := v + + op := "" + valueField := 2 + if len(fields) == 4 { + op = fields[2] + valueField = 3 + } + v, err = strconv.ParseUint(fields[valueField], 10, 64) + if err != nil { + return nil, err + } + blkioStats = append(blkioStats, cgroups.BlkioStatEntry{Major: major, Minor: minor, Op: op, Value: v}) + } + + return blkioStats, nil +} + +func (s *BlkioGroup) GetStats(path string, stats *cgroups.Stats) error { + // Try to read CFQ stats available on all CFQ enabled kernels first + if blkioStats, err := getBlkioStat(filepath.Join(path, "blkio.io_serviced_recursive")); err == nil && blkioStats != nil { + return getCFQStats(path, stats) + } + return getStats(path, stats) // Use generic stats as fallback +} + +func getCFQStats(path string, stats *cgroups.Stats) error { + var blkioStats []cgroups.BlkioStatEntry + var err error + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.sectors_recursive")); err != nil { + return err + } + stats.BlkioStats.SectorsRecursive = blkioStats + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.io_service_bytes_recursive")); err != nil { + return err + } + stats.BlkioStats.IoServiceBytesRecursive = blkioStats + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.io_serviced_recursive")); err != nil { + return err + } + stats.BlkioStats.IoServicedRecursive = blkioStats + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.io_queued_recursive")); err != nil { + return err + } + stats.BlkioStats.IoQueuedRecursive = blkioStats + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.io_service_time_recursive")); err != nil { + return err + } + stats.BlkioStats.IoServiceTimeRecursive = blkioStats + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.io_wait_time_recursive")); err != nil { + return err + } + stats.BlkioStats.IoWaitTimeRecursive = blkioStats + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.io_merged_recursive")); err != nil { + return err + } + stats.BlkioStats.IoMergedRecursive = blkioStats + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.time_recursive")); err != nil { + return err + } + stats.BlkioStats.IoTimeRecursive = blkioStats + + return nil +} + +func getStats(path string, stats *cgroups.Stats) error { + var blkioStats []cgroups.BlkioStatEntry + var err error + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.throttle.io_service_bytes")); err != nil { + return err + } + stats.BlkioStats.IoServiceBytesRecursive = blkioStats + + if blkioStats, err = getBlkioStat(filepath.Join(path, "blkio.throttle.io_serviced")); err != nil { + return err + } + stats.BlkioStats.IoServicedRecursive = blkioStats + + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio_test.go new file mode 100644 index 000000000..695739204 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio_test.go @@ -0,0 +1,636 @@ +// +build linux + +package fs + +import ( + "strconv" + "testing" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +const ( + sectorsRecursiveContents = `8:0 1024` + serviceBytesRecursiveContents = `8:0 Read 100 +8:0 Write 200 +8:0 Sync 300 +8:0 Async 500 +8:0 Total 500 +Total 500` + servicedRecursiveContents = `8:0 Read 10 +8:0 Write 40 +8:0 Sync 20 +8:0 Async 30 +8:0 Total 50 +Total 50` + queuedRecursiveContents = `8:0 Read 1 +8:0 Write 4 +8:0 Sync 2 +8:0 Async 3 +8:0 Total 5 +Total 5` + serviceTimeRecursiveContents = `8:0 Read 173959 +8:0 Write 0 +8:0 Sync 0 +8:0 Async 173959 +8:0 Total 17395 +Total 17395` + waitTimeRecursiveContents = `8:0 Read 15571 +8:0 Write 0 +8:0 Sync 0 +8:0 Async 15571 +8:0 Total 15571` + mergedRecursiveContents = `8:0 Read 5 +8:0 Write 10 +8:0 Sync 0 +8:0 Async 0 +8:0 Total 15 +Total 15` + timeRecursiveContents = `8:0 8` + throttleServiceBytes = `8:0 Read 11030528 +8:0 Write 23 +8:0 Sync 42 +8:0 Async 11030528 +8:0 Total 11030528 +252:0 Read 11030528 +252:0 Write 23 +252:0 Sync 42 +252:0 Async 11030528 +252:0 Total 11030528 +Total 22061056` + throttleServiced = `8:0 Read 164 +8:0 Write 23 +8:0 Sync 42 +8:0 Async 164 +8:0 Total 164 +252:0 Read 164 +252:0 Write 23 +252:0 Sync 42 +252:0 Async 164 +252:0 Total 164 +Total 328` +) + +func appendBlkioStatEntry(blkioStatEntries *[]cgroups.BlkioStatEntry, major, minor, value uint64, op string) { + *blkioStatEntries = append(*blkioStatEntries, cgroups.BlkioStatEntry{Major: major, Minor: minor, Value: value, Op: op}) +} + +func TestBlkioSetWeight(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + + const ( + weightBefore = 100 + weightAfter = 200 + ) + + helper.writeFileContents(map[string]string{ + "blkio.weight": strconv.Itoa(weightBefore), + }) + + helper.CgroupData.config.Resources.BlkioWeight = weightAfter + blkio := &BlkioGroup{} + if err := blkio.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamUint(helper.CgroupPath, "blkio.weight") + if err != nil { + t.Fatalf("Failed to parse blkio.weight - %s", err) + } + + if value != weightAfter { + t.Fatal("Got the wrong value, set blkio.weight failed.") + } +} + +func TestBlkioSetWeightDevice(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + + const ( + weightDeviceBefore = "8:0 400" + ) + + wd := configs.NewWeightDevice(8, 0, 500, 0) + weightDeviceAfter := wd.WeightString() + + helper.writeFileContents(map[string]string{ + "blkio.weight_device": weightDeviceBefore, + }) + + helper.CgroupData.config.Resources.BlkioWeightDevice = []*configs.WeightDevice{wd} + blkio := &BlkioGroup{} + if err := blkio.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "blkio.weight_device") + if err != nil { + t.Fatalf("Failed to parse blkio.weight_device - %s", err) + } + + if value != weightDeviceAfter { + t.Fatal("Got the wrong value, set blkio.weight_device failed.") + } +} + +// regression #274 +func TestBlkioSetMultipleWeightDevice(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + + const ( + weightDeviceBefore = "8:0 400" + ) + + wd1 := configs.NewWeightDevice(8, 0, 500, 0) + wd2 := configs.NewWeightDevice(8, 16, 500, 0) + // we cannot actually set and check both because normal ioutil.WriteFile + // when writing to cgroup file will overwrite the whole file content instead + // of updating it as the kernel is doing. Just check the second device + // is present will suffice for the test to ensure multiple writes are done. + weightDeviceAfter := wd2.WeightString() + + helper.writeFileContents(map[string]string{ + "blkio.weight_device": weightDeviceBefore, + }) + + helper.CgroupData.config.Resources.BlkioWeightDevice = []*configs.WeightDevice{wd1, wd2} + blkio := &BlkioGroup{} + if err := blkio.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "blkio.weight_device") + if err != nil { + t.Fatalf("Failed to parse blkio.weight_device - %s", err) + } + + if value != weightDeviceAfter { + t.Fatal("Got the wrong value, set blkio.weight_device failed.") + } +} + +func TestBlkioStats(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": serviceBytesRecursiveContents, + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatal(err) + } + + // Verify expected stats. + expectedStats := cgroups.BlkioStats{} + appendBlkioStatEntry(&expectedStats.SectorsRecursive, 8, 0, 1024, "") + + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 100, "Read") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 200, "Write") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 300, "Sync") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 500, "Async") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 500, "Total") + + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 10, "Read") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 40, "Write") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 20, "Sync") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 30, "Async") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 50, "Total") + + appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 1, "Read") + appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 4, "Write") + appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 2, "Sync") + appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 3, "Async") + appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 5, "Total") + + appendBlkioStatEntry(&expectedStats.IoServiceTimeRecursive, 8, 0, 173959, "Read") + appendBlkioStatEntry(&expectedStats.IoServiceTimeRecursive, 8, 0, 0, "Write") + appendBlkioStatEntry(&expectedStats.IoServiceTimeRecursive, 8, 0, 0, "Sync") + appendBlkioStatEntry(&expectedStats.IoServiceTimeRecursive, 8, 0, 173959, "Async") + appendBlkioStatEntry(&expectedStats.IoServiceTimeRecursive, 8, 0, 17395, "Total") + + appendBlkioStatEntry(&expectedStats.IoWaitTimeRecursive, 8, 0, 15571, "Read") + appendBlkioStatEntry(&expectedStats.IoWaitTimeRecursive, 8, 0, 0, "Write") + appendBlkioStatEntry(&expectedStats.IoWaitTimeRecursive, 8, 0, 0, "Sync") + appendBlkioStatEntry(&expectedStats.IoWaitTimeRecursive, 8, 0, 15571, "Async") + appendBlkioStatEntry(&expectedStats.IoWaitTimeRecursive, 8, 0, 15571, "Total") + + appendBlkioStatEntry(&expectedStats.IoMergedRecursive, 8, 0, 5, "Read") + appendBlkioStatEntry(&expectedStats.IoMergedRecursive, 8, 0, 10, "Write") + appendBlkioStatEntry(&expectedStats.IoMergedRecursive, 8, 0, 0, "Sync") + appendBlkioStatEntry(&expectedStats.IoMergedRecursive, 8, 0, 0, "Async") + appendBlkioStatEntry(&expectedStats.IoMergedRecursive, 8, 0, 15, "Total") + + appendBlkioStatEntry(&expectedStats.IoTimeRecursive, 8, 0, 8, "") + + expectBlkioStatsEquals(t, expectedStats, actualStats.BlkioStats) +} + +func TestBlkioStatsNoSectorsFile(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": serviceBytesRecursiveContents, + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatalf("Failed unexpectedly: %s", err) + } +} + +func TestBlkioStatsNoServiceBytesFile(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatalf("Failed unexpectedly: %s", err) + } +} + +func TestBlkioStatsNoServicedFile(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": serviceBytesRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatalf("Failed unexpectedly: %s", err) + } +} + +func TestBlkioStatsNoQueuedFile(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": serviceBytesRecursiveContents, + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatalf("Failed unexpectedly: %s", err) + } +} + +func TestBlkioStatsNoServiceTimeFile(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": serviceBytesRecursiveContents, + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatalf("Failed unexpectedly: %s", err) + } +} + +func TestBlkioStatsNoWaitTimeFile(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": serviceBytesRecursiveContents, + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatalf("Failed unexpectedly: %s", err) + } +} + +func TestBlkioStatsNoMergedFile(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": serviceBytesRecursiveContents, + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatalf("Failed unexpectedly: %s", err) + } +} + +func TestBlkioStatsNoTimeFile(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": serviceBytesRecursiveContents, + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatalf("Failed unexpectedly: %s", err) + } +} + +func TestBlkioStatsUnexpectedNumberOfFields(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": "8:0 Read 100 100", + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected to fail, but did not") + } +} + +func TestBlkioStatsUnexpectedFieldType(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": "8:0 Read Write", + "blkio.io_serviced_recursive": servicedRecursiveContents, + "blkio.io_queued_recursive": queuedRecursiveContents, + "blkio.sectors_recursive": sectorsRecursiveContents, + "blkio.io_service_time_recursive": serviceTimeRecursiveContents, + "blkio.io_wait_time_recursive": waitTimeRecursiveContents, + "blkio.io_merged_recursive": mergedRecursiveContents, + "blkio.time_recursive": timeRecursiveContents, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected to fail, but did not") + } +} + +func TestNonCFQBlkioStats(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "blkio.io_service_bytes_recursive": "", + "blkio.io_serviced_recursive": "", + "blkio.io_queued_recursive": "", + "blkio.sectors_recursive": "", + "blkio.io_service_time_recursive": "", + "blkio.io_wait_time_recursive": "", + "blkio.io_merged_recursive": "", + "blkio.time_recursive": "", + "blkio.throttle.io_service_bytes": throttleServiceBytes, + "blkio.throttle.io_serviced": throttleServiced, + }) + + blkio := &BlkioGroup{} + actualStats := *cgroups.NewStats() + err := blkio.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatal(err) + } + + // Verify expected stats. + expectedStats := cgroups.BlkioStats{} + + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 11030528, "Read") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 23, "Write") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 42, "Sync") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 11030528, "Async") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 11030528, "Total") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 252, 0, 11030528, "Read") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 252, 0, 23, "Write") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 252, 0, 42, "Sync") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 252, 0, 11030528, "Async") + appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 252, 0, 11030528, "Total") + + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 164, "Read") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 23, "Write") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 42, "Sync") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 164, "Async") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 164, "Total") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 252, 0, 164, "Read") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 252, 0, 23, "Write") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 252, 0, 42, "Sync") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 252, 0, 164, "Async") + appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 252, 0, 164, "Total") + + expectBlkioStatsEquals(t, expectedStats, actualStats.BlkioStats) +} + +func TestBlkioSetThrottleReadBpsDevice(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + + const ( + throttleBefore = `8:0 1024` + ) + + td := configs.NewThrottleDevice(8, 0, 2048) + throttleAfter := td.String() + + helper.writeFileContents(map[string]string{ + "blkio.throttle.read_bps_device": throttleBefore, + }) + + helper.CgroupData.config.Resources.BlkioThrottleReadBpsDevice = []*configs.ThrottleDevice{td} + blkio := &BlkioGroup{} + if err := blkio.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "blkio.throttle.read_bps_device") + if err != nil { + t.Fatalf("Failed to parse blkio.throttle.read_bps_device - %s", err) + } + + if value != throttleAfter { + t.Fatal("Got the wrong value, set blkio.throttle.read_bps_device failed.") + } +} +func TestBlkioSetThrottleWriteBpsDevice(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + + const ( + throttleBefore = `8:0 1024` + ) + + td := configs.NewThrottleDevice(8, 0, 2048) + throttleAfter := td.String() + + helper.writeFileContents(map[string]string{ + "blkio.throttle.write_bps_device": throttleBefore, + }) + + helper.CgroupData.config.Resources.BlkioThrottleWriteBpsDevice = []*configs.ThrottleDevice{td} + blkio := &BlkioGroup{} + if err := blkio.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "blkio.throttle.write_bps_device") + if err != nil { + t.Fatalf("Failed to parse blkio.throttle.write_bps_device - %s", err) + } + + if value != throttleAfter { + t.Fatal("Got the wrong value, set blkio.throttle.write_bps_device failed.") + } +} +func TestBlkioSetThrottleReadIOpsDevice(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + + const ( + throttleBefore = `8:0 1024` + ) + + td := configs.NewThrottleDevice(8, 0, 2048) + throttleAfter := td.String() + + helper.writeFileContents(map[string]string{ + "blkio.throttle.read_iops_device": throttleBefore, + }) + + helper.CgroupData.config.Resources.BlkioThrottleReadIOPSDevice = []*configs.ThrottleDevice{td} + blkio := &BlkioGroup{} + if err := blkio.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "blkio.throttle.read_iops_device") + if err != nil { + t.Fatalf("Failed to parse blkio.throttle.read_iops_device - %s", err) + } + + if value != throttleAfter { + t.Fatal("Got the wrong value, set blkio.throttle.read_iops_device failed.") + } +} +func TestBlkioSetThrottleWriteIOpsDevice(t *testing.T) { + helper := NewCgroupTestUtil("blkio", t) + defer helper.cleanup() + + const ( + throttleBefore = `8:0 1024` + ) + + td := configs.NewThrottleDevice(8, 0, 2048) + throttleAfter := td.String() + + helper.writeFileContents(map[string]string{ + "blkio.throttle.write_iops_device": throttleBefore, + }) + + helper.CgroupData.config.Resources.BlkioThrottleWriteIOPSDevice = []*configs.ThrottleDevice{td} + blkio := &BlkioGroup{} + if err := blkio.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "blkio.throttle.write_iops_device") + if err != nil { + t.Fatalf("Failed to parse blkio.throttle.write_iops_device - %s", err) + } + + if value != throttleAfter { + t.Fatal("Got the wrong value, set blkio.throttle.write_iops_device failed.") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu.go new file mode 100644 index 000000000..a4ef28a60 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu.go @@ -0,0 +1,94 @@ +// +build linux + +package fs + +import ( + "bufio" + "os" + "path/filepath" + "strconv" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type CpuGroup struct { +} + +func (s *CpuGroup) Name() string { + return "cpu" +} + +func (s *CpuGroup) Apply(d *cgroupData) error { + // We always want to join the cpu group, to allow fair cpu scheduling + // on a container basis + _, err := d.join("cpu") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func (s *CpuGroup) Set(path string, cgroup *configs.Cgroup) error { + if cgroup.Resources.CpuShares != 0 { + if err := writeFile(path, "cpu.shares", strconv.FormatInt(cgroup.Resources.CpuShares, 10)); err != nil { + return err + } + } + if cgroup.Resources.CpuPeriod != 0 { + if err := writeFile(path, "cpu.cfs_period_us", strconv.FormatInt(cgroup.Resources.CpuPeriod, 10)); err != nil { + return err + } + } + if cgroup.Resources.CpuQuota != 0 { + if err := writeFile(path, "cpu.cfs_quota_us", strconv.FormatInt(cgroup.Resources.CpuQuota, 10)); err != nil { + return err + } + } + if cgroup.Resources.CpuRtPeriod != 0 { + if err := writeFile(path, "cpu.rt_period_us", strconv.FormatInt(cgroup.Resources.CpuRtPeriod, 10)); err != nil { + return err + } + } + if cgroup.Resources.CpuRtRuntime != 0 { + if err := writeFile(path, "cpu.rt_runtime_us", strconv.FormatInt(cgroup.Resources.CpuRtRuntime, 10)); err != nil { + return err + } + } + + return nil +} + +func (s *CpuGroup) Remove(d *cgroupData) error { + return removePath(d.path("cpu")) +} + +func (s *CpuGroup) GetStats(path string, stats *cgroups.Stats) error { + f, err := os.Open(filepath.Join(path, "cpu.stat")) + if err != nil { + if os.IsNotExist(err) { + return nil + } + return err + } + defer f.Close() + + sc := bufio.NewScanner(f) + for sc.Scan() { + t, v, err := getCgroupParamKeyValue(sc.Text()) + if err != nil { + return err + } + switch t { + case "nr_periods": + stats.CpuStats.ThrottlingData.Periods = v + + case "nr_throttled": + stats.CpuStats.ThrottlingData.ThrottledPeriods = v + + case "throttled_time": + stats.CpuStats.ThrottlingData.ThrottledTime = v + } + } + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu_test.go new file mode 100644 index 000000000..554fd5e85 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu_test.go @@ -0,0 +1,163 @@ +// +build linux + +package fs + +import ( + "fmt" + "strconv" + "testing" + + "github.com/opencontainers/runc/libcontainer/cgroups" +) + +func TestCpuSetShares(t *testing.T) { + helper := NewCgroupTestUtil("cpu", t) + defer helper.cleanup() + + const ( + sharesBefore = 1024 + sharesAfter = 512 + ) + + helper.writeFileContents(map[string]string{ + "cpu.shares": strconv.Itoa(sharesBefore), + }) + + helper.CgroupData.config.Resources.CpuShares = sharesAfter + cpu := &CpuGroup{} + if err := cpu.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamUint(helper.CgroupPath, "cpu.shares") + if err != nil { + t.Fatalf("Failed to parse cpu.shares - %s", err) + } + + if value != sharesAfter { + t.Fatal("Got the wrong value, set cpu.shares failed.") + } +} + +func TestCpuSetBandWidth(t *testing.T) { + helper := NewCgroupTestUtil("cpu", t) + defer helper.cleanup() + + const ( + quotaBefore = 8000 + quotaAfter = 5000 + periodBefore = 10000 + periodAfter = 7000 + rtRuntimeBefore = 8000 + rtRuntimeAfter = 5000 + rtPeriodBefore = 10000 + rtPeriodAfter = 7000 + ) + + helper.writeFileContents(map[string]string{ + "cpu.cfs_quota_us": strconv.Itoa(quotaBefore), + "cpu.cfs_period_us": strconv.Itoa(periodBefore), + "cpu.rt_runtime_us": strconv.Itoa(rtRuntimeBefore), + "cpu.rt_period_us": strconv.Itoa(rtPeriodBefore), + }) + + helper.CgroupData.config.Resources.CpuQuota = quotaAfter + helper.CgroupData.config.Resources.CpuPeriod = periodAfter + helper.CgroupData.config.Resources.CpuRtRuntime = rtRuntimeAfter + helper.CgroupData.config.Resources.CpuRtPeriod = rtPeriodAfter + cpu := &CpuGroup{} + if err := cpu.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + quota, err := getCgroupParamUint(helper.CgroupPath, "cpu.cfs_quota_us") + if err != nil { + t.Fatalf("Failed to parse cpu.cfs_quota_us - %s", err) + } + if quota != quotaAfter { + t.Fatal("Got the wrong value, set cpu.cfs_quota_us failed.") + } + + period, err := getCgroupParamUint(helper.CgroupPath, "cpu.cfs_period_us") + if err != nil { + t.Fatalf("Failed to parse cpu.cfs_period_us - %s", err) + } + if period != periodAfter { + t.Fatal("Got the wrong value, set cpu.cfs_period_us failed.") + } + rtRuntime, err := getCgroupParamUint(helper.CgroupPath, "cpu.rt_runtime_us") + if err != nil { + t.Fatalf("Failed to parse cpu.rt_runtime_us - %s", err) + } + if rtRuntime != rtRuntimeAfter { + t.Fatal("Got the wrong value, set cpu.rt_runtime_us failed.") + } + rtPeriod, err := getCgroupParamUint(helper.CgroupPath, "cpu.rt_period_us") + if err != nil { + t.Fatalf("Failed to parse cpu.rt_period_us - %s", err) + } + if rtPeriod != rtPeriodAfter { + t.Fatal("Got the wrong value, set cpu.rt_period_us failed.") + } +} + +func TestCpuStats(t *testing.T) { + helper := NewCgroupTestUtil("cpu", t) + defer helper.cleanup() + + const ( + kNrPeriods = 2000 + kNrThrottled = 200 + kThrottledTime = uint64(18446744073709551615) + ) + + cpuStatContent := fmt.Sprintf("nr_periods %d\n nr_throttled %d\n throttled_time %d\n", + kNrPeriods, kNrThrottled, kThrottledTime) + helper.writeFileContents(map[string]string{ + "cpu.stat": cpuStatContent, + }) + + cpu := &CpuGroup{} + actualStats := *cgroups.NewStats() + err := cpu.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatal(err) + } + + expectedStats := cgroups.ThrottlingData{ + Periods: kNrPeriods, + ThrottledPeriods: kNrThrottled, + ThrottledTime: kThrottledTime} + + expectThrottlingDataEquals(t, expectedStats, actualStats.CpuStats.ThrottlingData) +} + +func TestNoCpuStatFile(t *testing.T) { + helper := NewCgroupTestUtil("cpu", t) + defer helper.cleanup() + + cpu := &CpuGroup{} + actualStats := *cgroups.NewStats() + err := cpu.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatal("Expected not to fail, but did") + } +} + +func TestInvalidCpuStat(t *testing.T) { + helper := NewCgroupTestUtil("cpu", t) + defer helper.cleanup() + cpuStatContent := `nr_periods 2000 + nr_throttled 200 + throttled_time fortytwo` + helper.writeFileContents(map[string]string{ + "cpu.stat": cpuStatContent, + }) + + cpu := &CpuGroup{} + actualStats := *cgroups.NewStats() + err := cpu.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failed stat parsing.") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuacct.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuacct.go new file mode 100644 index 000000000..53afbaddf --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuacct.go @@ -0,0 +1,121 @@ +// +build linux + +package fs + +import ( + "fmt" + "io/ioutil" + "path/filepath" + "strconv" + "strings" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" + "github.com/opencontainers/runc/libcontainer/system" +) + +const ( + cgroupCpuacctStat = "cpuacct.stat" + nanosecondsInSecond = 1000000000 +) + +var clockTicks = uint64(system.GetClockTicks()) + +type CpuacctGroup struct { +} + +func (s *CpuacctGroup) Name() string { + return "cpuacct" +} + +func (s *CpuacctGroup) Apply(d *cgroupData) error { + // we just want to join this group even though we don't set anything + if _, err := d.join("cpuacct"); err != nil && !cgroups.IsNotFound(err) { + return err + } + + return nil +} + +func (s *CpuacctGroup) Set(path string, cgroup *configs.Cgroup) error { + return nil +} + +func (s *CpuacctGroup) Remove(d *cgroupData) error { + return removePath(d.path("cpuacct")) +} + +func (s *CpuacctGroup) GetStats(path string, stats *cgroups.Stats) error { + userModeUsage, kernelModeUsage, err := getCpuUsageBreakdown(path) + if err != nil { + return err + } + + totalUsage, err := getCgroupParamUint(path, "cpuacct.usage") + if err != nil { + return err + } + + percpuUsage, err := getPercpuUsage(path) + if err != nil { + return err + } + + stats.CpuStats.CpuUsage.TotalUsage = totalUsage + stats.CpuStats.CpuUsage.PercpuUsage = percpuUsage + stats.CpuStats.CpuUsage.UsageInUsermode = userModeUsage + stats.CpuStats.CpuUsage.UsageInKernelmode = kernelModeUsage + return nil +} + +// Returns user and kernel usage breakdown in nanoseconds. +func getCpuUsageBreakdown(path string) (uint64, uint64, error) { + userModeUsage := uint64(0) + kernelModeUsage := uint64(0) + const ( + userField = "user" + systemField = "system" + ) + + // Expected format: + // user + // system + data, err := ioutil.ReadFile(filepath.Join(path, cgroupCpuacctStat)) + if err != nil { + return 0, 0, err + } + fields := strings.Fields(string(data)) + if len(fields) != 4 { + return 0, 0, fmt.Errorf("failure - %s is expected to have 4 fields", filepath.Join(path, cgroupCpuacctStat)) + } + if fields[0] != userField { + return 0, 0, fmt.Errorf("unexpected field %q in %q, expected %q", fields[0], cgroupCpuacctStat, userField) + } + if fields[2] != systemField { + return 0, 0, fmt.Errorf("unexpected field %q in %q, expected %q", fields[2], cgroupCpuacctStat, systemField) + } + if userModeUsage, err = strconv.ParseUint(fields[1], 10, 64); err != nil { + return 0, 0, err + } + if kernelModeUsage, err = strconv.ParseUint(fields[3], 10, 64); err != nil { + return 0, 0, err + } + + return (userModeUsage * nanosecondsInSecond) / clockTicks, (kernelModeUsage * nanosecondsInSecond) / clockTicks, nil +} + +func getPercpuUsage(path string) ([]uint64, error) { + percpuUsage := []uint64{} + data, err := ioutil.ReadFile(filepath.Join(path, "cpuacct.usage_percpu")) + if err != nil { + return percpuUsage, err + } + for _, value := range strings.Fields(string(data)) { + value, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return percpuUsage, fmt.Errorf("Unable to convert param value to uint64: %s", err) + } + percpuUsage = append(percpuUsage, value) + } + return percpuUsage, nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset.go new file mode 100644 index 000000000..cbe62bd98 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset.go @@ -0,0 +1,139 @@ +// +build linux + +package fs + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strconv" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" + libcontainerUtils "github.com/opencontainers/runc/libcontainer/utils" +) + +type CpusetGroup struct { +} + +func (s *CpusetGroup) Name() string { + return "cpuset" +} + +func (s *CpusetGroup) Apply(d *cgroupData) error { + dir, err := d.path("cpuset") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return s.ApplyDir(dir, d.config, d.pid) +} + +func (s *CpusetGroup) Set(path string, cgroup *configs.Cgroup) error { + if cgroup.Resources.CpusetCpus != "" { + if err := writeFile(path, "cpuset.cpus", cgroup.Resources.CpusetCpus); err != nil { + return err + } + } + if cgroup.Resources.CpusetMems != "" { + if err := writeFile(path, "cpuset.mems", cgroup.Resources.CpusetMems); err != nil { + return err + } + } + return nil +} + +func (s *CpusetGroup) Remove(d *cgroupData) error { + return removePath(d.path("cpuset")) +} + +func (s *CpusetGroup) GetStats(path string, stats *cgroups.Stats) error { + return nil +} + +func (s *CpusetGroup) ApplyDir(dir string, cgroup *configs.Cgroup, pid int) error { + // This might happen if we have no cpuset cgroup mounted. + // Just do nothing and don't fail. + if dir == "" { + return nil + } + root, err := getCgroupRoot() + if err != nil { + return err + } + if err := s.ensureParent(dir, root); err != nil { + return err + } + // because we are not using d.join we need to place the pid into the procs file + // unlike the other subsystems + if err := writeFile(dir, "cgroup.procs", strconv.Itoa(pid)); err != nil { + return err + } + + return nil +} + +func (s *CpusetGroup) getSubsystemSettings(parent string) (cpus []byte, mems []byte, err error) { + if cpus, err = ioutil.ReadFile(filepath.Join(parent, "cpuset.cpus")); err != nil { + return + } + if mems, err = ioutil.ReadFile(filepath.Join(parent, "cpuset.mems")); err != nil { + return + } + return cpus, mems, nil +} + +// ensureParent makes sure that the parent directory of current is created +// and populated with the proper cpus and mems files copied from +// it's parent. +func (s *CpusetGroup) ensureParent(current, root string) error { + parent := filepath.Dir(current) + if libcontainerUtils.CleanPath(parent) == root { + return nil + } + // Avoid infinite recursion. + if parent == current { + return fmt.Errorf("cpuset: cgroup parent path outside cgroup root") + } + if err := s.ensureParent(parent, root); err != nil { + return err + } + if err := os.MkdirAll(current, 0755); err != nil { + return err + } + return s.copyIfNeeded(current, parent) +} + +// copyIfNeeded copies the cpuset.cpus and cpuset.mems from the parent +// directory to the current directory if the file's contents are 0 +func (s *CpusetGroup) copyIfNeeded(current, parent string) error { + var ( + err error + currentCpus, currentMems []byte + parentCpus, parentMems []byte + ) + + if currentCpus, currentMems, err = s.getSubsystemSettings(current); err != nil { + return err + } + if parentCpus, parentMems, err = s.getSubsystemSettings(parent); err != nil { + return err + } + + if s.isEmpty(currentCpus) { + if err := writeFile(current, "cpuset.cpus", string(parentCpus)); err != nil { + return err + } + } + if s.isEmpty(currentMems) { + if err := writeFile(current, "cpuset.mems", string(parentMems)); err != nil { + return err + } + } + return nil +} + +func (s *CpusetGroup) isEmpty(b []byte) bool { + return len(bytes.Trim(b, "\n")) == 0 +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset_test.go new file mode 100644 index 000000000..0f929151f --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset_test.go @@ -0,0 +1,65 @@ +// +build linux + +package fs + +import ( + "testing" +) + +func TestCpusetSetCpus(t *testing.T) { + helper := NewCgroupTestUtil("cpuset", t) + defer helper.cleanup() + + const ( + cpusBefore = "0" + cpusAfter = "1-3" + ) + + helper.writeFileContents(map[string]string{ + "cpuset.cpus": cpusBefore, + }) + + helper.CgroupData.config.Resources.CpusetCpus = cpusAfter + cpuset := &CpusetGroup{} + if err := cpuset.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "cpuset.cpus") + if err != nil { + t.Fatalf("Failed to parse cpuset.cpus - %s", err) + } + + if value != cpusAfter { + t.Fatal("Got the wrong value, set cpuset.cpus failed.") + } +} + +func TestCpusetSetMems(t *testing.T) { + helper := NewCgroupTestUtil("cpuset", t) + defer helper.cleanup() + + const ( + memsBefore = "0" + memsAfter = "1" + ) + + helper.writeFileContents(map[string]string{ + "cpuset.mems": memsBefore, + }) + + helper.CgroupData.config.Resources.CpusetMems = memsAfter + cpuset := &CpusetGroup{} + if err := cpuset.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "cpuset.mems") + if err != nil { + t.Fatalf("Failed to parse cpuset.mems - %s", err) + } + + if value != memsAfter { + t.Fatal("Got the wrong value, set cpuset.mems failed.") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices.go new file mode 100644 index 000000000..4969798c8 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices.go @@ -0,0 +1,73 @@ +// +build linux + +package fs + +import ( + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type DevicesGroup struct { +} + +func (s *DevicesGroup) Name() string { + return "devices" +} + +func (s *DevicesGroup) Apply(d *cgroupData) error { + _, err := d.join("devices") + if err != nil { + // We will return error even it's `not found` error, devices + // cgroup is hard requirement for container's security. + return err + } + return nil +} + +func (s *DevicesGroup) Set(path string, cgroup *configs.Cgroup) error { + devices := cgroup.Resources.Devices + if len(devices) > 0 { + for _, dev := range devices { + file := "devices.deny" + if dev.Allow { + file = "devices.allow" + } + if err := writeFile(path, file, dev.CgroupString()); err != nil { + return err + } + } + return nil + } + if !cgroup.Resources.AllowAllDevices { + if err := writeFile(path, "devices.deny", "a"); err != nil { + return err + } + + for _, dev := range cgroup.Resources.AllowedDevices { + if err := writeFile(path, "devices.allow", dev.CgroupString()); err != nil { + return err + } + } + return nil + } + + if err := writeFile(path, "devices.allow", "a"); err != nil { + return err + } + + for _, dev := range cgroup.Resources.DeniedDevices { + if err := writeFile(path, "devices.deny", dev.CgroupString()); err != nil { + return err + } + } + + return nil +} + +func (s *DevicesGroup) Remove(d *cgroupData) error { + return removePath(d.path("devices")) +} + +func (s *DevicesGroup) GetStats(path string, stats *cgroups.Stats) error { + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices_test.go new file mode 100644 index 000000000..ee44084ee --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices_test.go @@ -0,0 +1,84 @@ +// +build linux + +package fs + +import ( + "testing" + + "github.com/opencontainers/runc/libcontainer/configs" +) + +var ( + allowedDevices = []*configs.Device{ + { + Path: "/dev/zero", + Type: 'c', + Major: 1, + Minor: 5, + Permissions: "rwm", + FileMode: 0666, + }, + } + allowedList = "c 1:5 rwm" + deniedDevices = []*configs.Device{ + { + Path: "/dev/null", + Type: 'c', + Major: 1, + Minor: 3, + Permissions: "rwm", + FileMode: 0666, + }, + } + deniedList = "c 1:3 rwm" +) + +func TestDevicesSetAllow(t *testing.T) { + helper := NewCgroupTestUtil("devices", t) + defer helper.cleanup() + + helper.writeFileContents(map[string]string{ + "devices.deny": "a", + }) + + helper.CgroupData.config.Resources.AllowAllDevices = false + helper.CgroupData.config.Resources.AllowedDevices = allowedDevices + devices := &DevicesGroup{} + if err := devices.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "devices.allow") + if err != nil { + t.Fatalf("Failed to parse devices.allow - %s", err) + } + + if value != allowedList { + t.Fatal("Got the wrong value, set devices.allow failed.") + } +} + +func TestDevicesSetDeny(t *testing.T) { + helper := NewCgroupTestUtil("devices", t) + defer helper.cleanup() + + helper.writeFileContents(map[string]string{ + "devices.allow": "a", + }) + + helper.CgroupData.config.Resources.AllowAllDevices = true + helper.CgroupData.config.Resources.DeniedDevices = deniedDevices + devices := &DevicesGroup{} + if err := devices.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "devices.deny") + if err != nil { + t.Fatalf("Failed to parse devices.deny - %s", err) + } + + if value != deniedList { + t.Fatal("Got the wrong value, set devices.deny failed.") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer.go new file mode 100644 index 000000000..e70dfe3b9 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer.go @@ -0,0 +1,61 @@ +// +build linux + +package fs + +import ( + "fmt" + "strings" + "time" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type FreezerGroup struct { +} + +func (s *FreezerGroup) Name() string { + return "freezer" +} + +func (s *FreezerGroup) Apply(d *cgroupData) error { + _, err := d.join("freezer") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func (s *FreezerGroup) Set(path string, cgroup *configs.Cgroup) error { + switch cgroup.Resources.Freezer { + case configs.Frozen, configs.Thawed: + if err := writeFile(path, "freezer.state", string(cgroup.Resources.Freezer)); err != nil { + return err + } + + for { + state, err := readFile(path, "freezer.state") + if err != nil { + return err + } + if strings.TrimSpace(state) == string(cgroup.Resources.Freezer) { + break + } + time.Sleep(1 * time.Millisecond) + } + case configs.Undefined: + return nil + default: + return fmt.Errorf("Invalid argument '%s' to freezer.state", string(cgroup.Resources.Freezer)) + } + + return nil +} + +func (s *FreezerGroup) Remove(d *cgroupData) error { + return removePath(d.path("freezer")) +} + +func (s *FreezerGroup) GetStats(path string, stats *cgroups.Stats) error { + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer_test.go new file mode 100644 index 000000000..77708db9a --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer_test.go @@ -0,0 +1,47 @@ +// +build linux + +package fs + +import ( + "testing" + + "github.com/opencontainers/runc/libcontainer/configs" +) + +func TestFreezerSetState(t *testing.T) { + helper := NewCgroupTestUtil("freezer", t) + defer helper.cleanup() + + helper.writeFileContents(map[string]string{ + "freezer.state": string(configs.Frozen), + }) + + helper.CgroupData.config.Resources.Freezer = configs.Thawed + freezer := &FreezerGroup{} + if err := freezer.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "freezer.state") + if err != nil { + t.Fatalf("Failed to parse freezer.state - %s", err) + } + if value != string(configs.Thawed) { + t.Fatal("Got the wrong value, set freezer.state failed.") + } +} + +func TestFreezerSetInvalidState(t *testing.T) { + helper := NewCgroupTestUtil("freezer", t) + defer helper.cleanup() + + const ( + invalidArg configs.FreezerState = "Invalid" + ) + + helper.CgroupData.config.Resources.Freezer = invalidArg + freezer := &FreezerGroup{} + if err := freezer.Set(helper.CgroupPath, helper.CgroupData.config); err == nil { + t.Fatal("Failed to return invalid argument error") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/fs_unsupported.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/fs_unsupported.go new file mode 100644 index 000000000..3ef9e0315 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/fs_unsupported.go @@ -0,0 +1,3 @@ +// +build !linux + +package fs diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb.go new file mode 100644 index 000000000..2f9727719 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb.go @@ -0,0 +1,71 @@ +// +build linux + +package fs + +import ( + "fmt" + "strconv" + "strings" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type HugetlbGroup struct { +} + +func (s *HugetlbGroup) Name() string { + return "hugetlb" +} + +func (s *HugetlbGroup) Apply(d *cgroupData) error { + _, err := d.join("hugetlb") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func (s *HugetlbGroup) Set(path string, cgroup *configs.Cgroup) error { + for _, hugetlb := range cgroup.Resources.HugetlbLimit { + if err := writeFile(path, strings.Join([]string{"hugetlb", hugetlb.Pagesize, "limit_in_bytes"}, "."), strconv.FormatUint(hugetlb.Limit, 10)); err != nil { + return err + } + } + + return nil +} + +func (s *HugetlbGroup) Remove(d *cgroupData) error { + return removePath(d.path("hugetlb")) +} + +func (s *HugetlbGroup) GetStats(path string, stats *cgroups.Stats) error { + hugetlbStats := cgroups.HugetlbStats{} + for _, pageSize := range HugePageSizes { + usage := strings.Join([]string{"hugetlb", pageSize, "usage_in_bytes"}, ".") + value, err := getCgroupParamUint(path, usage) + if err != nil { + return fmt.Errorf("failed to parse %s - %v", usage, err) + } + hugetlbStats.Usage = value + + maxUsage := strings.Join([]string{"hugetlb", pageSize, "max_usage_in_bytes"}, ".") + value, err = getCgroupParamUint(path, maxUsage) + if err != nil { + return fmt.Errorf("failed to parse %s - %v", maxUsage, err) + } + hugetlbStats.MaxUsage = value + + failcnt := strings.Join([]string{"hugetlb", pageSize, "failcnt"}, ".") + value, err = getCgroupParamUint(path, failcnt) + if err != nil { + return fmt.Errorf("failed to parse %s - %v", failcnt, err) + } + hugetlbStats.Failcnt = value + + stats.HugetlbStats[pageSize] = hugetlbStats + } + + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb_test.go new file mode 100644 index 000000000..2d41c4eb2 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb_test.go @@ -0,0 +1,154 @@ +// +build linux + +package fs + +import ( + "fmt" + "strconv" + "testing" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +const ( + hugetlbUsageContents = "128\n" + hugetlbMaxUsageContents = "256\n" + hugetlbFailcnt = "100\n" +) + +var ( + usage = "hugetlb.%s.usage_in_bytes" + limit = "hugetlb.%s.limit_in_bytes" + maxUsage = "hugetlb.%s.max_usage_in_bytes" + failcnt = "hugetlb.%s.failcnt" +) + +func TestHugetlbSetHugetlb(t *testing.T) { + helper := NewCgroupTestUtil("hugetlb", t) + defer helper.cleanup() + + const ( + hugetlbBefore = 256 + hugetlbAfter = 512 + ) + + for _, pageSize := range HugePageSizes { + helper.writeFileContents(map[string]string{ + fmt.Sprintf(limit, pageSize): strconv.Itoa(hugetlbBefore), + }) + } + + for _, pageSize := range HugePageSizes { + helper.CgroupData.config.Resources.HugetlbLimit = []*configs.HugepageLimit{ + { + Pagesize: pageSize, + Limit: hugetlbAfter, + }, + } + hugetlb := &HugetlbGroup{} + if err := hugetlb.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + } + + for _, pageSize := range HugePageSizes { + limit := fmt.Sprintf(limit, pageSize) + value, err := getCgroupParamUint(helper.CgroupPath, limit) + if err != nil { + t.Fatalf("Failed to parse %s - %s", limit, err) + } + if value != hugetlbAfter { + t.Fatalf("Set hugetlb.limit_in_bytes failed. Expected: %v, Got: %v", hugetlbAfter, value) + } + } +} + +func TestHugetlbStats(t *testing.T) { + helper := NewCgroupTestUtil("hugetlb", t) + defer helper.cleanup() + for _, pageSize := range HugePageSizes { + helper.writeFileContents(map[string]string{ + fmt.Sprintf(usage, pageSize): hugetlbUsageContents, + fmt.Sprintf(maxUsage, pageSize): hugetlbMaxUsageContents, + fmt.Sprintf(failcnt, pageSize): hugetlbFailcnt, + }) + } + + hugetlb := &HugetlbGroup{} + actualStats := *cgroups.NewStats() + err := hugetlb.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatal(err) + } + expectedStats := cgroups.HugetlbStats{Usage: 128, MaxUsage: 256, Failcnt: 100} + for _, pageSize := range HugePageSizes { + expectHugetlbStatEquals(t, expectedStats, actualStats.HugetlbStats[pageSize]) + } +} + +func TestHugetlbStatsNoUsageFile(t *testing.T) { + helper := NewCgroupTestUtil("hugetlb", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + maxUsage: hugetlbMaxUsageContents, + }) + + hugetlb := &HugetlbGroup{} + actualStats := *cgroups.NewStats() + err := hugetlb.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestHugetlbStatsNoMaxUsageFile(t *testing.T) { + helper := NewCgroupTestUtil("hugetlb", t) + defer helper.cleanup() + for _, pageSize := range HugePageSizes { + helper.writeFileContents(map[string]string{ + fmt.Sprintf(usage, pageSize): hugetlbUsageContents, + }) + } + + hugetlb := &HugetlbGroup{} + actualStats := *cgroups.NewStats() + err := hugetlb.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestHugetlbStatsBadUsageFile(t *testing.T) { + helper := NewCgroupTestUtil("hugetlb", t) + defer helper.cleanup() + for _, pageSize := range HugePageSizes { + helper.writeFileContents(map[string]string{ + fmt.Sprintf(usage, pageSize): "bad", + maxUsage: hugetlbMaxUsageContents, + }) + } + + hugetlb := &HugetlbGroup{} + actualStats := *cgroups.NewStats() + err := hugetlb.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestHugetlbStatsBadMaxUsageFile(t *testing.T) { + helper := NewCgroupTestUtil("hugetlb", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + usage: hugetlbUsageContents, + maxUsage: "bad", + }) + + hugetlb := &HugetlbGroup{} + actualStats := *cgroups.NewStats() + err := hugetlb.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory.go new file mode 100644 index 000000000..2121f6d4d --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory.go @@ -0,0 +1,201 @@ +// +build linux + +package fs + +import ( + "bufio" + "fmt" + "os" + "path/filepath" + "strconv" + "strings" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type MemoryGroup struct { +} + +func (s *MemoryGroup) Name() string { + return "memory" +} + +func (s *MemoryGroup) Apply(d *cgroupData) (err error) { + path, err := d.path("memory") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + if memoryAssigned(d.config) { + if path != "" { + if err := os.MkdirAll(path, 0755); err != nil { + return err + } + } + // We have to set kernel memory here, as we can't change it once + // processes have been attached. + if err := s.SetKernelMemory(path, d.config); err != nil { + return err + } + } + + defer func() { + if err != nil { + os.RemoveAll(path) + } + }() + + // We need to join memory cgroup after set memory limits, because + // kmem.limit_in_bytes can only be set when the cgroup is empty. + _, err = d.join("memory") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func (s *MemoryGroup) SetKernelMemory(path string, cgroup *configs.Cgroup) error { + // This has to be done separately because it has special constraints (it + // can't be done after there are processes attached to the cgroup). + if cgroup.Resources.KernelMemory > 0 { + if err := writeFile(path, "memory.kmem.limit_in_bytes", strconv.FormatInt(cgroup.Resources.KernelMemory, 10)); err != nil { + return err + } + } + return nil +} + +func (s *MemoryGroup) Set(path string, cgroup *configs.Cgroup) error { + if cgroup.Resources.Memory != 0 { + if err := writeFile(path, "memory.limit_in_bytes", strconv.FormatInt(cgroup.Resources.Memory, 10)); err != nil { + return err + } + } + if cgroup.Resources.MemoryReservation != 0 { + if err := writeFile(path, "memory.soft_limit_in_bytes", strconv.FormatInt(cgroup.Resources.MemoryReservation, 10)); err != nil { + return err + } + } + if cgroup.Resources.MemorySwap > 0 { + if err := writeFile(path, "memory.memsw.limit_in_bytes", strconv.FormatInt(cgroup.Resources.MemorySwap, 10)); err != nil { + return err + } + } + if cgroup.Resources.OomKillDisable { + if err := writeFile(path, "memory.oom_control", "1"); err != nil { + return err + } + } + if cgroup.Resources.MemorySwappiness >= 0 && cgroup.Resources.MemorySwappiness <= 100 { + if err := writeFile(path, "memory.swappiness", strconv.FormatInt(cgroup.Resources.MemorySwappiness, 10)); err != nil { + return err + } + } else if cgroup.Resources.MemorySwappiness == -1 { + return nil + } else { + return fmt.Errorf("invalid value:%d. valid memory swappiness range is 0-100", cgroup.Resources.MemorySwappiness) + } + + return nil +} + +func (s *MemoryGroup) Remove(d *cgroupData) error { + return removePath(d.path("memory")) +} + +func (s *MemoryGroup) GetStats(path string, stats *cgroups.Stats) error { + // Set stats from memory.stat. + statsFile, err := os.Open(filepath.Join(path, "memory.stat")) + if err != nil { + if os.IsNotExist(err) { + return nil + } + return err + } + defer statsFile.Close() + + sc := bufio.NewScanner(statsFile) + for sc.Scan() { + t, v, err := getCgroupParamKeyValue(sc.Text()) + if err != nil { + return fmt.Errorf("failed to parse memory.stat (%q) - %v", sc.Text(), err) + } + stats.MemoryStats.Stats[t] = v + } + stats.MemoryStats.Cache = stats.MemoryStats.Stats["cache"] + + memoryUsage, err := getMemoryData(path, "") + if err != nil { + return err + } + stats.MemoryStats.Usage = memoryUsage + swapUsage, err := getMemoryData(path, "memsw") + if err != nil { + return err + } + stats.MemoryStats.SwapUsage = swapUsage + kernelUsage, err := getMemoryData(path, "kmem") + if err != nil { + return err + } + stats.MemoryStats.KernelUsage = kernelUsage + + return nil +} + +func memoryAssigned(cgroup *configs.Cgroup) bool { + return cgroup.Resources.Memory != 0 || + cgroup.Resources.MemoryReservation != 0 || + cgroup.Resources.MemorySwap > 0 || + cgroup.Resources.KernelMemory > 0 || + cgroup.Resources.OomKillDisable || + cgroup.Resources.MemorySwappiness != -1 +} + +func getMemoryData(path, name string) (cgroups.MemoryData, error) { + memoryData := cgroups.MemoryData{} + + moduleName := "memory" + if name != "" { + moduleName = strings.Join([]string{"memory", name}, ".") + } + usage := strings.Join([]string{moduleName, "usage_in_bytes"}, ".") + maxUsage := strings.Join([]string{moduleName, "max_usage_in_bytes"}, ".") + failcnt := strings.Join([]string{moduleName, "failcnt"}, ".") + limit := strings.Join([]string{moduleName, "limit_in_bytes"}, ".") + + value, err := getCgroupParamUint(path, usage) + if err != nil { + if moduleName != "memory" && os.IsNotExist(err) { + return cgroups.MemoryData{}, nil + } + return cgroups.MemoryData{}, fmt.Errorf("failed to parse %s - %v", usage, err) + } + memoryData.Usage = value + value, err = getCgroupParamUint(path, maxUsage) + if err != nil { + if moduleName != "memory" && os.IsNotExist(err) { + return cgroups.MemoryData{}, nil + } + return cgroups.MemoryData{}, fmt.Errorf("failed to parse %s - %v", maxUsage, err) + } + memoryData.MaxUsage = value + value, err = getCgroupParamUint(path, failcnt) + if err != nil { + if moduleName != "memory" && os.IsNotExist(err) { + return cgroups.MemoryData{}, nil + } + return cgroups.MemoryData{}, fmt.Errorf("failed to parse %s - %v", failcnt, err) + } + memoryData.Failcnt = value + value, err = getCgroupParamUint(path, limit) + if err != nil { + if moduleName != "memory" && os.IsNotExist(err) { + return cgroups.MemoryData{}, nil + } + return cgroups.MemoryData{}, fmt.Errorf("failed to parse %s - %v", limit, err) + } + memoryData.Limit = value + + return memoryData, nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory_test.go new file mode 100644 index 000000000..6dc4ae7c7 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory_test.go @@ -0,0 +1,339 @@ +// +build linux + +package fs + +import ( + "strconv" + "testing" + + "github.com/opencontainers/runc/libcontainer/cgroups" +) + +const ( + memoryStatContents = `cache 512 +rss 1024` + memoryUsageContents = "2048\n" + memoryMaxUsageContents = "4096\n" + memoryFailcnt = "100\n" + memoryLimitContents = "8192\n" +) + +func TestMemorySetMemory(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + + const ( + memoryBefore = 314572800 // 300M + memoryAfter = 524288000 // 500M + reservationBefore = 209715200 // 200M + reservationAfter = 314572800 // 300M + ) + + helper.writeFileContents(map[string]string{ + "memory.limit_in_bytes": strconv.Itoa(memoryBefore), + "memory.soft_limit_in_bytes": strconv.Itoa(reservationBefore), + }) + + helper.CgroupData.config.Resources.Memory = memoryAfter + helper.CgroupData.config.Resources.MemoryReservation = reservationAfter + memory := &MemoryGroup{} + if err := memory.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamUint(helper.CgroupPath, "memory.limit_in_bytes") + if err != nil { + t.Fatalf("Failed to parse memory.limit_in_bytes - %s", err) + } + if value != memoryAfter { + t.Fatal("Got the wrong value, set memory.limit_in_bytes failed.") + } + + value, err = getCgroupParamUint(helper.CgroupPath, "memory.soft_limit_in_bytes") + if err != nil { + t.Fatalf("Failed to parse memory.soft_limit_in_bytes - %s", err) + } + if value != reservationAfter { + t.Fatal("Got the wrong value, set memory.soft_limit_in_bytes failed.") + } +} + +func TestMemorySetMemoryswap(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + + const ( + memoryswapBefore = 314572800 // 300M + memoryswapAfter = 524288000 // 500M + ) + + helper.writeFileContents(map[string]string{ + "memory.memsw.limit_in_bytes": strconv.Itoa(memoryswapBefore), + }) + + helper.CgroupData.config.Resources.MemorySwap = memoryswapAfter + memory := &MemoryGroup{} + if err := memory.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamUint(helper.CgroupPath, "memory.memsw.limit_in_bytes") + if err != nil { + t.Fatalf("Failed to parse memory.memsw.limit_in_bytes - %s", err) + } + if value != memoryswapAfter { + t.Fatal("Got the wrong value, set memory.memsw.limit_in_bytes failed.") + } +} + +func TestMemorySetKernelMemory(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + + const ( + kernelMemoryBefore = 314572800 // 300M + kernelMemoryAfter = 524288000 // 500M + ) + + helper.writeFileContents(map[string]string{ + "memory.kmem.limit_in_bytes": strconv.Itoa(kernelMemoryBefore), + }) + + helper.CgroupData.config.Resources.KernelMemory = kernelMemoryAfter + memory := &MemoryGroup{} + if err := memory.SetKernelMemory(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamUint(helper.CgroupPath, "memory.kmem.limit_in_bytes") + if err != nil { + t.Fatalf("Failed to parse memory.kmem.limit_in_bytes - %s", err) + } + if value != kernelMemoryAfter { + t.Fatal("Got the wrong value, set memory.kmem.limit_in_bytes failed.") + } +} + +func TestMemorySetMemorySwappinessDefault(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + + const ( + swappinessBefore = 60 //deafult is 60 + swappinessAfter = 0 + ) + + helper.writeFileContents(map[string]string{ + "memory.swappiness": strconv.Itoa(swappinessBefore), + }) + + helper.CgroupData.config.Resources.Memory = swappinessAfter + memory := &MemoryGroup{} + if err := memory.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamUint(helper.CgroupPath, "memory.swappiness") + if err != nil { + t.Fatalf("Failed to parse memory.swappiness - %s", err) + } + if value != swappinessAfter { + t.Fatal("Got the wrong value, set memory.swappiness failed.") + } +} + +func TestMemoryStats(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "memory.stat": memoryStatContents, + "memory.usage_in_bytes": memoryUsageContents, + "memory.limit_in_bytes": memoryLimitContents, + "memory.max_usage_in_bytes": memoryMaxUsageContents, + "memory.failcnt": memoryFailcnt, + "memory.memsw.usage_in_bytes": memoryUsageContents, + "memory.memsw.max_usage_in_bytes": memoryMaxUsageContents, + "memory.memsw.failcnt": memoryFailcnt, + "memory.memsw.limit_in_bytes": memoryLimitContents, + "memory.kmem.usage_in_bytes": memoryUsageContents, + "memory.kmem.max_usage_in_bytes": memoryMaxUsageContents, + "memory.kmem.failcnt": memoryFailcnt, + "memory.kmem.limit_in_bytes": memoryLimitContents, + }) + + memory := &MemoryGroup{} + actualStats := *cgroups.NewStats() + err := memory.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatal(err) + } + expectedStats := cgroups.MemoryStats{Cache: 512, Usage: cgroups.MemoryData{Usage: 2048, MaxUsage: 4096, Failcnt: 100, Limit: 8192}, SwapUsage: cgroups.MemoryData{Usage: 2048, MaxUsage: 4096, Failcnt: 100, Limit: 8192}, KernelUsage: cgroups.MemoryData{Usage: 2048, MaxUsage: 4096, Failcnt: 100, Limit: 8192}, Stats: map[string]uint64{"cache": 512, "rss": 1024}} + expectMemoryStatEquals(t, expectedStats, actualStats.MemoryStats) +} + +func TestMemoryStatsNoStatFile(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "memory.usage_in_bytes": memoryUsageContents, + "memory.max_usage_in_bytes": memoryMaxUsageContents, + "memory.limit_in_bytes": memoryLimitContents, + }) + + memory := &MemoryGroup{} + actualStats := *cgroups.NewStats() + err := memory.GetStats(helper.CgroupPath, &actualStats) + if err != nil { + t.Fatal(err) + } +} + +func TestMemoryStatsNoUsageFile(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "memory.stat": memoryStatContents, + "memory.max_usage_in_bytes": memoryMaxUsageContents, + "memory.limit_in_bytes": memoryLimitContents, + }) + + memory := &MemoryGroup{} + actualStats := *cgroups.NewStats() + err := memory.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestMemoryStatsNoMaxUsageFile(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "memory.stat": memoryStatContents, + "memory.usage_in_bytes": memoryUsageContents, + "memory.limit_in_bytes": memoryLimitContents, + }) + + memory := &MemoryGroup{} + actualStats := *cgroups.NewStats() + err := memory.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestMemoryStatsNoLimitInBytesFile(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "memory.stat": memoryStatContents, + "memory.usage_in_bytes": memoryUsageContents, + "memory.max_usage_in_bytes": memoryMaxUsageContents, + }) + + memory := &MemoryGroup{} + actualStats := *cgroups.NewStats() + err := memory.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestMemoryStatsBadStatFile(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "memory.stat": "rss rss", + "memory.usage_in_bytes": memoryUsageContents, + "memory.max_usage_in_bytes": memoryMaxUsageContents, + "memory.limit_in_bytes": memoryLimitContents, + }) + + memory := &MemoryGroup{} + actualStats := *cgroups.NewStats() + err := memory.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestMemoryStatsBadUsageFile(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "memory.stat": memoryStatContents, + "memory.usage_in_bytes": "bad", + "memory.max_usage_in_bytes": memoryMaxUsageContents, + "memory.limit_in_bytes": memoryLimitContents, + }) + + memory := &MemoryGroup{} + actualStats := *cgroups.NewStats() + err := memory.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestMemoryStatsBadMaxUsageFile(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "memory.stat": memoryStatContents, + "memory.usage_in_bytes": memoryUsageContents, + "memory.max_usage_in_bytes": "bad", + "memory.limit_in_bytes": memoryLimitContents, + }) + + memory := &MemoryGroup{} + actualStats := *cgroups.NewStats() + err := memory.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestMemoryStatsBadLimitInBytesFile(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + helper.writeFileContents(map[string]string{ + "memory.stat": memoryStatContents, + "memory.usage_in_bytes": memoryUsageContents, + "memory.max_usage_in_bytes": memoryMaxUsageContents, + "memory.limit_in_bytes": "bad", + }) + + memory := &MemoryGroup{} + actualStats := *cgroups.NewStats() + err := memory.GetStats(helper.CgroupPath, &actualStats) + if err == nil { + t.Fatal("Expected failure") + } +} + +func TestMemorySetOomControl(t *testing.T) { + helper := NewCgroupTestUtil("memory", t) + defer helper.cleanup() + + const ( + oom_kill_disable = 1 // disable oom killer, default is 0 + ) + + helper.writeFileContents(map[string]string{ + "memory.oom_control": strconv.Itoa(oom_kill_disable), + }) + + memory := &MemoryGroup{} + if err := memory.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamUint(helper.CgroupPath, "memory.oom_control") + if err != nil { + t.Fatalf("Failed to parse memory.oom_control - %s", err) + } + + if value != oom_kill_disable { + t.Fatalf("Got the wrong value, set memory.oom_control failed.") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/name.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/name.go new file mode 100644 index 000000000..0e423f667 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/name.go @@ -0,0 +1,32 @@ +// +build linux + +package fs + +import ( + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type NameGroup struct { + GroupName string +} + +func (s *NameGroup) Name() string { + return s.GroupName +} + +func (s *NameGroup) Apply(d *cgroupData) error { + return nil +} + +func (s *NameGroup) Set(path string, cgroup *configs.Cgroup) error { + return nil +} + +func (s *NameGroup) Remove(d *cgroupData) error { + return nil +} + +func (s *NameGroup) GetStats(path string, stats *cgroups.Stats) error { + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls.go new file mode 100644 index 000000000..8a4054ba8 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls.go @@ -0,0 +1,41 @@ +// +build linux + +package fs + +import ( + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type NetClsGroup struct { +} + +func (s *NetClsGroup) Name() string { + return "net_cls" +} + +func (s *NetClsGroup) Apply(d *cgroupData) error { + _, err := d.join("net_cls") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func (s *NetClsGroup) Set(path string, cgroup *configs.Cgroup) error { + if cgroup.Resources.NetClsClassid != "" { + if err := writeFile(path, "net_cls.classid", cgroup.Resources.NetClsClassid); err != nil { + return err + } + } + + return nil +} + +func (s *NetClsGroup) Remove(d *cgroupData) error { + return removePath(d.path("net_cls")) +} + +func (s *NetClsGroup) GetStats(path string, stats *cgroups.Stats) error { + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls_test.go new file mode 100644 index 000000000..974bd9d88 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls_test.go @@ -0,0 +1,38 @@ +// +build linux + +package fs + +import ( + "testing" +) + +const ( + classidBefore = "0x100002" + classidAfter = "0x100001" +) + +func TestNetClsSetClassid(t *testing.T) { + helper := NewCgroupTestUtil("net_cls", t) + defer helper.cleanup() + + helper.writeFileContents(map[string]string{ + "net_cls.classid": classidBefore, + }) + + helper.CgroupData.config.Resources.NetClsClassid = classidAfter + netcls := &NetClsGroup{} + if err := netcls.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + // As we are in mock environment, we can't get correct value of classid from + // net_cls.classid. + // So. we just judge if we successfully write classid into file + value, err := getCgroupParamString(helper.CgroupPath, "net_cls.classid") + if err != nil { + t.Fatalf("Failed to parse net_cls.classid - %s", err) + } + if value != classidAfter { + t.Fatal("Got the wrong value, set net_cls.classid failed.") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio.go new file mode 100644 index 000000000..d0ab2af89 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio.go @@ -0,0 +1,41 @@ +// +build linux + +package fs + +import ( + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type NetPrioGroup struct { +} + +func (s *NetPrioGroup) Name() string { + return "net_prio" +} + +func (s *NetPrioGroup) Apply(d *cgroupData) error { + _, err := d.join("net_prio") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func (s *NetPrioGroup) Set(path string, cgroup *configs.Cgroup) error { + for _, prioMap := range cgroup.Resources.NetPrioIfpriomap { + if err := writeFile(path, "net_prio.ifpriomap", prioMap.CgroupString()); err != nil { + return err + } + } + + return nil +} + +func (s *NetPrioGroup) Remove(d *cgroupData) error { + return removePath(d.path("net_prio")) +} + +func (s *NetPrioGroup) GetStats(path string, stats *cgroups.Stats) error { + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio_test.go new file mode 100644 index 000000000..efbf0639a --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio_test.go @@ -0,0 +1,38 @@ +// +build linux + +package fs + +import ( + "strings" + "testing" + + "github.com/opencontainers/runc/libcontainer/configs" +) + +var ( + prioMap = []*configs.IfPrioMap{ + { + Interface: "test", + Priority: 5, + }, + } +) + +func TestNetPrioSetIfPrio(t *testing.T) { + helper := NewCgroupTestUtil("net_prio", t) + defer helper.cleanup() + + helper.CgroupData.config.Resources.NetPrioIfpriomap = prioMap + netPrio := &NetPrioGroup{} + if err := netPrio.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "net_prio.ifpriomap") + if err != nil { + t.Fatalf("Failed to parse net_prio.ifpriomap - %s", err) + } + if !strings.Contains(value, "test 5") { + t.Fatal("Got the wrong value, set net_prio.ifpriomap failed.") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/perf_event.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/perf_event.go new file mode 100644 index 000000000..5693676d3 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/perf_event.go @@ -0,0 +1,35 @@ +// +build linux + +package fs + +import ( + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type PerfEventGroup struct { +} + +func (s *PerfEventGroup) Name() string { + return "perf_event" +} + +func (s *PerfEventGroup) Apply(d *cgroupData) error { + // we just want to join this group even though we don't set anything + if _, err := d.join("perf_event"); err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func (s *PerfEventGroup) Set(path string, cgroup *configs.Cgroup) error { + return nil +} + +func (s *PerfEventGroup) Remove(d *cgroupData) error { + return removePath(d.path("perf_event")) +} + +func (s *PerfEventGroup) GetStats(path string, stats *cgroups.Stats) error { + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/pids.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/pids.go new file mode 100644 index 000000000..96cbb896c --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/pids.go @@ -0,0 +1,57 @@ +// +build linux + +package fs + +import ( + "fmt" + "strconv" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type PidsGroup struct { +} + +func (s *PidsGroup) Name() string { + return "pids" +} + +func (s *PidsGroup) Apply(d *cgroupData) error { + _, err := d.join("pids") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func (s *PidsGroup) Set(path string, cgroup *configs.Cgroup) error { + if cgroup.Resources.PidsLimit != 0 { + // "max" is the fallback value. + limit := "max" + + if cgroup.Resources.PidsLimit > 0 { + limit = strconv.FormatInt(cgroup.Resources.PidsLimit, 10) + } + + if err := writeFile(path, "pids.max", limit); err != nil { + return err + } + } + + return nil +} + +func (s *PidsGroup) Remove(d *cgroupData) error { + return removePath(d.path("pids")) +} + +func (s *PidsGroup) GetStats(path string, stats *cgroups.Stats) error { + value, err := getCgroupParamUint(path, "pids.current") + if err != nil { + return fmt.Errorf("failed to parse pids.current - %s", err) + } + + stats.PidsStats.Current = value + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/pids_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/pids_test.go new file mode 100644 index 000000000..06b11927a --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/pids_test.go @@ -0,0 +1,83 @@ +// +build linux + +package fs + +import ( + "strconv" + "testing" + + "github.com/opencontainers/runc/libcontainer/cgroups" +) + +const ( + maxUnlimited = -1 + maxLimited = 1024 +) + +func TestPidsSetMax(t *testing.T) { + helper := NewCgroupTestUtil("pids", t) + defer helper.cleanup() + + helper.writeFileContents(map[string]string{ + "pids.max": "max", + }) + + helper.CgroupData.config.Resources.PidsLimit = maxLimited + pids := &PidsGroup{} + if err := pids.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamUint(helper.CgroupPath, "pids.max") + if err != nil { + t.Fatalf("Failed to parse pids.max - %s", err) + } + + if value != maxLimited { + t.Fatalf("Expected %d, got %d for setting pids.max - limited", maxLimited, value) + } +} + +func TestPidsSetUnlimited(t *testing.T) { + helper := NewCgroupTestUtil("pids", t) + defer helper.cleanup() + + helper.writeFileContents(map[string]string{ + "pids.max": strconv.Itoa(maxLimited), + }) + + helper.CgroupData.config.Resources.PidsLimit = maxUnlimited + pids := &PidsGroup{} + if err := pids.Set(helper.CgroupPath, helper.CgroupData.config); err != nil { + t.Fatal(err) + } + + value, err := getCgroupParamString(helper.CgroupPath, "pids.max") + if err != nil { + t.Fatalf("Failed to parse pids.max - %s", err) + } + + if value != "max" { + t.Fatalf("Expected %s, got %s for setting pids.max - unlimited", "max", value) + } +} + +func TestPidsStats(t *testing.T) { + helper := NewCgroupTestUtil("pids", t) + defer helper.cleanup() + + helper.writeFileContents(map[string]string{ + "pids.current": strconv.Itoa(1337), + "pids.max": strconv.Itoa(maxLimited), + }) + + pids := &PidsGroup{} + stats := *cgroups.NewStats() + if err := pids.GetStats(helper.CgroupPath, &stats); err != nil { + t.Fatal(err) + } + + if stats.PidsStats.Current != 1337 { + t.Fatalf("Expected %d, got %d for pids.current", 1337, stats.PidsStats.Current) + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/stats_util_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/stats_util_test.go new file mode 100644 index 000000000..295e7bd22 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/stats_util_test.go @@ -0,0 +1,117 @@ +// +build linux + +package fs + +import ( + "fmt" + "testing" + + "github.com/Sirupsen/logrus" + "github.com/opencontainers/runc/libcontainer/cgroups" +) + +func blkioStatEntryEquals(expected, actual []cgroups.BlkioStatEntry) error { + if len(expected) != len(actual) { + return fmt.Errorf("blkioStatEntries length do not match") + } + for i, expValue := range expected { + actValue := actual[i] + if expValue != actValue { + return fmt.Errorf("Expected blkio stat entry %v but found %v", expValue, actValue) + } + } + return nil +} + +func expectBlkioStatsEquals(t *testing.T, expected, actual cgroups.BlkioStats) { + if err := blkioStatEntryEquals(expected.IoServiceBytesRecursive, actual.IoServiceBytesRecursive); err != nil { + logrus.Printf("blkio IoServiceBytesRecursive do not match - %s\n", err) + t.Fail() + } + + if err := blkioStatEntryEquals(expected.IoServicedRecursive, actual.IoServicedRecursive); err != nil { + logrus.Printf("blkio IoServicedRecursive do not match - %s\n", err) + t.Fail() + } + + if err := blkioStatEntryEquals(expected.IoQueuedRecursive, actual.IoQueuedRecursive); err != nil { + logrus.Printf("blkio IoQueuedRecursive do not match - %s\n", err) + t.Fail() + } + + if err := blkioStatEntryEquals(expected.SectorsRecursive, actual.SectorsRecursive); err != nil { + logrus.Printf("blkio SectorsRecursive do not match - %s\n", err) + t.Fail() + } + + if err := blkioStatEntryEquals(expected.IoServiceTimeRecursive, actual.IoServiceTimeRecursive); err != nil { + logrus.Printf("blkio IoServiceTimeRecursive do not match - %s\n", err) + t.Fail() + } + + if err := blkioStatEntryEquals(expected.IoWaitTimeRecursive, actual.IoWaitTimeRecursive); err != nil { + logrus.Printf("blkio IoWaitTimeRecursive do not match - %s\n", err) + t.Fail() + } + + if err := blkioStatEntryEquals(expected.IoMergedRecursive, actual.IoMergedRecursive); err != nil { + logrus.Printf("blkio IoMergedRecursive do not match - %v vs %v\n", expected.IoMergedRecursive, actual.IoMergedRecursive) + t.Fail() + } + + if err := blkioStatEntryEquals(expected.IoTimeRecursive, actual.IoTimeRecursive); err != nil { + logrus.Printf("blkio IoTimeRecursive do not match - %s\n", err) + t.Fail() + } +} + +func expectThrottlingDataEquals(t *testing.T, expected, actual cgroups.ThrottlingData) { + if expected != actual { + logrus.Printf("Expected throttling data %v but found %v\n", expected, actual) + t.Fail() + } +} + +func expectHugetlbStatEquals(t *testing.T, expected, actual cgroups.HugetlbStats) { + if expected != actual { + logrus.Printf("Expected hugetlb stats %v but found %v\n", expected, actual) + t.Fail() + } +} + +func expectMemoryStatEquals(t *testing.T, expected, actual cgroups.MemoryStats) { + expectMemoryDataEquals(t, expected.Usage, actual.Usage) + expectMemoryDataEquals(t, expected.SwapUsage, actual.SwapUsage) + expectMemoryDataEquals(t, expected.KernelUsage, actual.KernelUsage) + + for key, expValue := range expected.Stats { + actValue, ok := actual.Stats[key] + if !ok { + logrus.Printf("Expected memory stat key %s not found\n", key) + t.Fail() + } + if expValue != actValue { + logrus.Printf("Expected memory stat value %d but found %d\n", expValue, actValue) + t.Fail() + } + } +} + +func expectMemoryDataEquals(t *testing.T, expected, actual cgroups.MemoryData) { + if expected.Usage != actual.Usage { + logrus.Printf("Expected memory usage %d but found %d\n", expected.Usage, actual.Usage) + t.Fail() + } + if expected.MaxUsage != actual.MaxUsage { + logrus.Printf("Expected memory max usage %d but found %d\n", expected.MaxUsage, actual.MaxUsage) + t.Fail() + } + if expected.Failcnt != actual.Failcnt { + logrus.Printf("Expected memory failcnt %d but found %d\n", expected.Failcnt, actual.Failcnt) + t.Fail() + } + if expected.Limit != actual.Limit { + logrus.Printf("Expected memory limit %d but found %d\n", expected.Limit, actual.Limit) + t.Fail() + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/util_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/util_test.go new file mode 100644 index 000000000..7067e799f --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/util_test.go @@ -0,0 +1,67 @@ +// +build linux + +/* +Utility for testing cgroup operations. + +Creates a mock of the cgroup filesystem for the duration of the test. +*/ +package fs + +import ( + "io/ioutil" + "os" + "path/filepath" + "testing" + + "github.com/opencontainers/runc/libcontainer/configs" +) + +type cgroupTestUtil struct { + // cgroup data to use in tests. + CgroupData *cgroupData + + // Path to the mock cgroup directory. + CgroupPath string + + // Temporary directory to store mock cgroup filesystem. + tempDir string + t *testing.T +} + +// Creates a new test util for the specified subsystem +func NewCgroupTestUtil(subsystem string, t *testing.T) *cgroupTestUtil { + d := &cgroupData{ + config: &configs.Cgroup{}, + } + d.config.Resources = &configs.Resources{} + tempDir, err := ioutil.TempDir("", "cgroup_test") + if err != nil { + t.Fatal(err) + } + d.root = tempDir + testCgroupPath := filepath.Join(d.root, subsystem) + if err != nil { + t.Fatal(err) + } + + // Ensure the full mock cgroup path exists. + err = os.MkdirAll(testCgroupPath, 0755) + if err != nil { + t.Fatal(err) + } + return &cgroupTestUtil{CgroupData: d, CgroupPath: testCgroupPath, tempDir: tempDir, t: t} +} + +func (c *cgroupTestUtil) cleanup() { + os.RemoveAll(c.tempDir) +} + +// Write the specified contents on the mock of the specified cgroup files. +func (c *cgroupTestUtil) writeFileContents(fileContents map[string]string) { + for file, contents := range fileContents { + err := writeFile(c.CgroupPath, file, contents) + if err != nil { + c.t.Fatal(err) + } + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils.go new file mode 100644 index 000000000..852b18391 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils.go @@ -0,0 +1,79 @@ +// +build linux + +package fs + +import ( + "errors" + "fmt" + "io/ioutil" + "path/filepath" + "strconv" + "strings" +) + +var ( + ErrNotSupportStat = errors.New("stats are not supported for subsystem") + ErrNotValidFormat = errors.New("line is not a valid key value format") +) + +// Saturates negative values at zero and returns a uint64. +// Due to kernel bugs, some of the memory cgroup stats can be negative. +func parseUint(s string, base, bitSize int) (uint64, error) { + value, err := strconv.ParseUint(s, base, bitSize) + if err != nil { + intValue, intErr := strconv.ParseInt(s, base, bitSize) + // 1. Handle negative values greater than MinInt64 (and) + // 2. Handle negative values lesser than MinInt64 + if intErr == nil && intValue < 0 { + return 0, nil + } else if intErr != nil && intErr.(*strconv.NumError).Err == strconv.ErrRange && intValue < 0 { + return 0, nil + } + + return value, err + } + + return value, nil +} + +// Parses a cgroup param and returns as name, value +// i.e. "io_service_bytes 1234" will return as io_service_bytes, 1234 +func getCgroupParamKeyValue(t string) (string, uint64, error) { + parts := strings.Fields(t) + switch len(parts) { + case 2: + value, err := parseUint(parts[1], 10, 64) + if err != nil { + return "", 0, fmt.Errorf("unable to convert param value (%q) to uint64: %v", parts[1], err) + } + + return parts[0], value, nil + default: + return "", 0, ErrNotValidFormat + } +} + +// Gets a single uint64 value from the specified cgroup file. +func getCgroupParamUint(cgroupPath, cgroupFile string) (uint64, error) { + fileName := filepath.Join(cgroupPath, cgroupFile) + contents, err := ioutil.ReadFile(fileName) + if err != nil { + return 0, err + } + + res, err := parseUint(strings.TrimSpace(string(contents)), 10, 64) + if err != nil { + return res, fmt.Errorf("unable to parse %q as a uint from Cgroup file %q", string(contents), fileName) + } + return res, nil +} + +// Gets a string value from the specified cgroup file +func getCgroupParamString(cgroupPath, cgroupFile string) (string, error) { + contents, err := ioutil.ReadFile(filepath.Join(cgroupPath, cgroupFile)) + if err != nil { + return "", err + } + + return strings.TrimSpace(string(contents)), nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils_test.go new file mode 100644 index 000000000..99cdc18e0 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils_test.go @@ -0,0 +1,97 @@ +// +build linux + +package fs + +import ( + "io/ioutil" + "math" + "os" + "path/filepath" + "strconv" + "testing" +) + +const ( + cgroupFile = "cgroup.file" + floatValue = 2048.0 + floatString = "2048" +) + +func TestGetCgroupParamsInt(t *testing.T) { + // Setup tempdir. + tempDir, err := ioutil.TempDir("", "cgroup_utils_test") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tempDir) + tempFile := filepath.Join(tempDir, cgroupFile) + + // Success. + err = ioutil.WriteFile(tempFile, []byte(floatString), 0755) + if err != nil { + t.Fatal(err) + } + value, err := getCgroupParamUint(tempDir, cgroupFile) + if err != nil { + t.Fatal(err) + } else if value != floatValue { + t.Fatalf("Expected %d to equal %f", value, floatValue) + } + + // Success with new line. + err = ioutil.WriteFile(tempFile, []byte(floatString+"\n"), 0755) + if err != nil { + t.Fatal(err) + } + value, err = getCgroupParamUint(tempDir, cgroupFile) + if err != nil { + t.Fatal(err) + } else if value != floatValue { + t.Fatalf("Expected %d to equal %f", value, floatValue) + } + + // Success with negative values + err = ioutil.WriteFile(tempFile, []byte("-12345"), 0755) + if err != nil { + t.Fatal(err) + } + value, err = getCgroupParamUint(tempDir, cgroupFile) + if err != nil { + t.Fatal(err) + } else if value != 0 { + t.Fatalf("Expected %d to equal %d", value, 0) + } + + // Success with negative values lesser than min int64 + s := strconv.FormatFloat(math.MinInt64, 'f', -1, 64) + err = ioutil.WriteFile(tempFile, []byte(s), 0755) + if err != nil { + t.Fatal(err) + } + value, err = getCgroupParamUint(tempDir, cgroupFile) + if err != nil { + t.Fatal(err) + } else if value != 0 { + t.Fatalf("Expected %d to equal %d", value, 0) + } + + // Not a float. + err = ioutil.WriteFile(tempFile, []byte("not-a-float"), 0755) + if err != nil { + t.Fatal(err) + } + _, err = getCgroupParamUint(tempDir, cgroupFile) + if err == nil { + t.Fatal("Expecting error, got none") + } + + // Unknown file. + err = os.Remove(tempFile) + if err != nil { + t.Fatal(err) + } + _, err = getCgroupParamUint(tempDir, cgroupFile) + if err == nil { + t.Fatal("Expecting error, got none") + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/stats.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/stats.go new file mode 100644 index 000000000..54ace4185 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/stats.go @@ -0,0 +1,100 @@ +// +build linux + +package cgroups + +type ThrottlingData struct { + // Number of periods with throttling active + Periods uint64 `json:"periods,omitempty"` + // Number of periods when the container hit its throttling limit. + ThrottledPeriods uint64 `json:"throttled_periods,omitempty"` + // Aggregate time the container was throttled for in nanoseconds. + ThrottledTime uint64 `json:"throttled_time,omitempty"` +} + +// All CPU stats are aggregate since container inception. +type CpuUsage struct { + // Total CPU time consumed. + // Units: nanoseconds. + TotalUsage uint64 `json:"total_usage,omitempty"` + // Total CPU time consumed per core. + // Units: nanoseconds. + PercpuUsage []uint64 `json:"percpu_usage,omitempty"` + // Time spent by tasks of the cgroup in kernel mode. + // Units: nanoseconds. + UsageInKernelmode uint64 `json:"usage_in_kernelmode"` + // Time spent by tasks of the cgroup in user mode. + // Units: nanoseconds. + UsageInUsermode uint64 `json:"usage_in_usermode"` +} + +type CpuStats struct { + CpuUsage CpuUsage `json:"cpu_usage,omitempty"` + ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` +} + +type MemoryData struct { + Usage uint64 `json:"usage,omitempty"` + MaxUsage uint64 `json:"max_usage,omitempty"` + Failcnt uint64 `json:"failcnt"` + Limit uint64 `json:"limit"` +} + +type MemoryStats struct { + // memory used for cache + Cache uint64 `json:"cache,omitempty"` + // usage of memory + Usage MemoryData `json:"usage,omitempty"` + // usage of memory + swap + SwapUsage MemoryData `json:"swap_usage,omitempty"` + // usafe of kernel memory + KernelUsage MemoryData `json:"kernel_usage,omitempty"` + Stats map[string]uint64 `json:"stats,omitempty"` +} + +type PidsStats struct { + // number of pids in the cgroup + Current uint64 `json:"current,omitempty"` +} + +type BlkioStatEntry struct { + Major uint64 `json:"major,omitempty"` + Minor uint64 `json:"minor,omitempty"` + Op string `json:"op,omitempty"` + Value uint64 `json:"value,omitempty"` +} + +type BlkioStats struct { + // number of bytes tranferred to and from the block device + IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive,omitempty"` + IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive,omitempty"` + IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive,omitempty"` + IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive,omitempty"` + IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive,omitempty"` + IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive,omitempty"` + IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive,omitempty"` + SectorsRecursive []BlkioStatEntry `json:"sectors_recursive,omitempty"` +} + +type HugetlbStats struct { + // current res_counter usage for hugetlb + Usage uint64 `json:"usage,omitempty"` + // maximum usage ever recorded. + MaxUsage uint64 `json:"max_usage,omitempty"` + // number of times htgetlb usage allocation failure. + Failcnt uint64 `json:"failcnt"` +} + +type Stats struct { + CpuStats CpuStats `json:"cpu_stats,omitempty"` + MemoryStats MemoryStats `json:"memory_stats,omitempty"` + PidsStats PidsStats `json:"pids_stats,omitempty"` + BlkioStats BlkioStats `json:"blkio_stats,omitempty"` + // the map is in the format "size of hugepage: stats of the hugepage" + HugetlbStats map[string]HugetlbStats `json:"hugetlb_stats,omitempty"` +} + +func NewStats() *Stats { + memoryStats := MemoryStats{Stats: make(map[string]uint64)} + hugetlbStats := make(map[string]HugetlbStats) + return &Stats{MemoryStats: memoryStats, HugetlbStats: hugetlbStats} +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_nosystemd.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_nosystemd.go new file mode 100644 index 000000000..7de9ae605 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_nosystemd.go @@ -0,0 +1,55 @@ +// +build !linux + +package systemd + +import ( + "fmt" + + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type Manager struct { + Cgroups *configs.Cgroup + Paths map[string]string +} + +func UseSystemd() bool { + return false +} + +func (m *Manager) Apply(pid int) error { + return fmt.Errorf("Systemd not supported") +} + +func (m *Manager) GetPids() ([]int, error) { + return nil, fmt.Errorf("Systemd not supported") +} + +func (m *Manager) GetAllPids() ([]int, error) { + return nil, fmt.Errorf("Systemd not supported") +} + +func (m *Manager) Destroy() error { + return fmt.Errorf("Systemd not supported") +} + +func (m *Manager) GetPaths() map[string]string { + return nil +} + +func (m *Manager) GetStats() (*cgroups.Stats, error) { + return nil, fmt.Errorf("Systemd not supported") +} + +func (m *Manager) Set(container *configs.Config) error { + return nil, fmt.Errorf("Systemd not supported") +} + +func (m *Manager) Freeze(state configs.FreezerState) error { + return fmt.Errorf("Systemd not supported") +} + +func Freeze(c *configs.Cgroup, state configs.FreezerState) error { + return fmt.Errorf("Systemd not supported") +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_systemd.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_systemd.go new file mode 100644 index 000000000..3161639f2 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_systemd.go @@ -0,0 +1,605 @@ +// +build linux + +package systemd + +import ( + "errors" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strconv" + "strings" + "sync" + "time" + + systemdDbus "github.com/coreos/go-systemd/dbus" + systemdUtil "github.com/coreos/go-systemd/util" + "github.com/godbus/dbus" + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/cgroups/fs" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type Manager struct { + mu sync.Mutex + Cgroups *configs.Cgroup + Paths map[string]string +} + +type subsystem interface { + // Name returns the name of the subsystem. + Name() string + // Returns the stats, as 'stats', corresponding to the cgroup under 'path'. + GetStats(path string, stats *cgroups.Stats) error + // Set the cgroup represented by cgroup. + Set(path string, cgroup *configs.Cgroup) error +} + +var errSubsystemDoesNotExist = errors.New("cgroup: subsystem does not exist") + +type subsystemSet []subsystem + +func (s subsystemSet) Get(name string) (subsystem, error) { + for _, ss := range s { + if ss.Name() == name { + return ss, nil + } + } + return nil, errSubsystemDoesNotExist +} + +var subsystems = subsystemSet{ + &fs.CpusetGroup{}, + &fs.DevicesGroup{}, + &fs.MemoryGroup{}, + &fs.CpuGroup{}, + &fs.CpuacctGroup{}, + &fs.PidsGroup{}, + &fs.BlkioGroup{}, + &fs.HugetlbGroup{}, + &fs.PerfEventGroup{}, + &fs.FreezerGroup{}, + &fs.NetPrioGroup{}, + &fs.NetClsGroup{}, + &fs.NameGroup{GroupName: "name=systemd"}, +} + +const ( + testScopeWait = 4 +) + +var ( + connLock sync.Mutex + theConn *systemdDbus.Conn + hasStartTransientUnit bool + hasTransientDefaultDependencies bool +) + +func newProp(name string, units interface{}) systemdDbus.Property { + return systemdDbus.Property{ + Name: name, + Value: dbus.MakeVariant(units), + } +} + +func UseSystemd() bool { + if !systemdUtil.IsRunningSystemd() { + return false + } + + connLock.Lock() + defer connLock.Unlock() + + if theConn == nil { + var err error + theConn, err = systemdDbus.New() + if err != nil { + return false + } + + // Assume we have StartTransientUnit + hasStartTransientUnit = true + + // But if we get UnknownMethod error we don't + if _, err := theConn.StartTransientUnit("test.scope", "invalid", nil, nil); err != nil { + if dbusError, ok := err.(dbus.Error); ok { + if dbusError.Name == "org.freedesktop.DBus.Error.UnknownMethod" { + hasStartTransientUnit = false + return hasStartTransientUnit + } + } + } + + // Ensure the scope name we use doesn't exist. Use the Pid to + // avoid collisions between multiple libcontainer users on a + // single host. + scope := fmt.Sprintf("libcontainer-%d-systemd-test-default-dependencies.scope", os.Getpid()) + testScopeExists := true + for i := 0; i <= testScopeWait; i++ { + if _, err := theConn.StopUnit(scope, "replace", nil); err != nil { + if dbusError, ok := err.(dbus.Error); ok { + if strings.Contains(dbusError.Name, "org.freedesktop.systemd1.NoSuchUnit") { + testScopeExists = false + break + } + } + } + time.Sleep(time.Millisecond) + } + + // Bail out if we can't kill this scope without testing for DefaultDependencies + if testScopeExists { + return hasStartTransientUnit + } + + // Assume StartTransientUnit on a scope allows DefaultDependencies + hasTransientDefaultDependencies = true + ddf := newProp("DefaultDependencies", false) + if _, err := theConn.StartTransientUnit(scope, "replace", []systemdDbus.Property{ddf}, nil); err != nil { + if dbusError, ok := err.(dbus.Error); ok { + if strings.Contains(dbusError.Name, "org.freedesktop.DBus.Error.PropertyReadOnly") { + hasTransientDefaultDependencies = false + } + } + } + + // Not critical because of the stop unit logic above. + theConn.StopUnit(scope, "replace", nil) + } + return hasStartTransientUnit +} + +func getIfaceForUnit(unitName string) string { + if strings.HasSuffix(unitName, ".scope") { + return "Scope" + } + if strings.HasSuffix(unitName, ".service") { + return "Service" + } + return "Unit" +} + +func (m *Manager) Apply(pid int) error { + var ( + c = m.Cgroups + unitName = getUnitName(c) + slice = "system.slice" + properties []systemdDbus.Property + ) + + if c.Paths != nil { + paths := make(map[string]string) + for name, path := range c.Paths { + _, err := getSubsystemPath(m.Cgroups, name) + if err != nil { + // Don't fail if a cgroup hierarchy was not found, just skip this subsystem + if cgroups.IsNotFound(err) { + continue + } + return err + } + paths[name] = path + } + m.Paths = paths + return cgroups.EnterPid(m.Paths, pid) + } + + if c.Parent != "" { + slice = c.Parent + } + + properties = append(properties, + systemdDbus.PropSlice(slice), + systemdDbus.PropDescription("docker container "+c.Name), + newProp("PIDs", []uint32{uint32(pid)}), + ) + + // Always enable accounting, this gets us the same behaviour as the fs implementation, + // plus the kernel has some problems with joining the memory cgroup at a later time. + properties = append(properties, + newProp("MemoryAccounting", true), + newProp("CPUAccounting", true), + newProp("BlockIOAccounting", true)) + + if hasTransientDefaultDependencies { + properties = append(properties, + newProp("DefaultDependencies", false)) + } + + if c.Resources.Memory != 0 { + properties = append(properties, + newProp("MemoryLimit", uint64(c.Resources.Memory))) + } + + if c.Resources.CpuShares != 0 { + properties = append(properties, + newProp("CPUShares", uint64(c.Resources.CpuShares))) + } + + if c.Resources.BlkioWeight != 0 { + properties = append(properties, + newProp("BlockIOWeight", uint64(c.Resources.BlkioWeight))) + } + + // We need to set kernel memory before processes join cgroup because + // kmem.limit_in_bytes can only be set when the cgroup is empty. + // And swap memory limit needs to be set after memory limit, only + // memory limit is handled by systemd, so it's kind of ugly here. + if c.Resources.KernelMemory > 0 { + if err := setKernelMemory(c); err != nil { + return err + } + } + + if _, err := theConn.StartTransientUnit(unitName, "replace", properties, nil); err != nil { + return err + } + + if err := joinDevices(c, pid); err != nil { + return err + } + + // TODO: CpuQuota and CpuPeriod not available in systemd + // we need to manually join the cpu.cfs_quota_us and cpu.cfs_period_us + if err := joinCpu(c, pid); err != nil { + return err + } + + // TODO: MemoryReservation and MemorySwap not available in systemd + if err := joinMemory(c, pid); err != nil { + return err + } + + // we need to manually join the freezer, net_cls, net_prio, pids and cpuset cgroup in systemd + // because it does not currently support it via the dbus api. + if err := joinFreezer(c, pid); err != nil { + return err + } + + if err := joinNetPrio(c, pid); err != nil { + return err + } + if err := joinNetCls(c, pid); err != nil { + return err + } + + if err := joinPids(c, pid); err != nil { + return err + } + + if err := joinCpuset(c, pid); err != nil { + return err + } + + if err := joinHugetlb(c, pid); err != nil { + return err + } + + if err := joinPerfEvent(c, pid); err != nil { + return err + } + // FIXME: Systemd does have `BlockIODeviceWeight` property, but we got problem + // using that (at least on systemd 208, see https://github.com/opencontainers/runc/libcontainer/pull/354), + // so use fs work around for now. + if err := joinBlkio(c, pid); err != nil { + return err + } + + paths := make(map[string]string) + for _, s := range subsystems { + subsystemPath, err := getSubsystemPath(m.Cgroups, s.Name()) + if err != nil { + // Don't fail if a cgroup hierarchy was not found, just skip this subsystem + if cgroups.IsNotFound(err) { + continue + } + return err + } + paths[s.Name()] = subsystemPath + } + m.Paths = paths + return nil +} + +func (m *Manager) Destroy() error { + if m.Cgroups.Paths != nil { + return nil + } + m.mu.Lock() + defer m.mu.Unlock() + theConn.StopUnit(getUnitName(m.Cgroups), "replace", nil) + if err := cgroups.RemovePaths(m.Paths); err != nil { + return err + } + m.Paths = make(map[string]string) + return nil +} + +func (m *Manager) GetPaths() map[string]string { + m.mu.Lock() + paths := m.Paths + m.mu.Unlock() + return paths +} + +func writeFile(dir, file, data string) error { + // Normally dir should not be empty, one case is that cgroup subsystem + // is not mounted, we will get empty dir, and we want it fail here. + if dir == "" { + return fmt.Errorf("no such directory for %s.", file) + } + return ioutil.WriteFile(filepath.Join(dir, file), []byte(data), 0700) +} + +func join(c *configs.Cgroup, subsystem string, pid int) (string, error) { + path, err := getSubsystemPath(c, subsystem) + if err != nil { + return "", err + } + if err := os.MkdirAll(path, 0755); err != nil { + return "", err + } + if err := writeFile(path, "cgroup.procs", strconv.Itoa(pid)); err != nil { + return "", err + } + + return path, nil +} + +func joinCpu(c *configs.Cgroup, pid int) error { + _, err := join(c, "cpu", pid) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func joinFreezer(c *configs.Cgroup, pid int) error { + _, err := join(c, "freezer", pid) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func joinNetPrio(c *configs.Cgroup, pid int) error { + _, err := join(c, "net_prio", pid) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func joinNetCls(c *configs.Cgroup, pid int) error { + _, err := join(c, "net_cls", pid) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func joinPids(c *configs.Cgroup, pid int) error { + _, err := join(c, "pids", pid) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +// systemd represents slice heirarchy using `-`, so we need to follow suit when +// generating the path of slice. Essentially, test-a-b.slice becomes +// test.slice/test-a.slice/test-a-b.slice. +func expandSlice(slice string) (string, error) { + suffix := ".slice" + // Name has to end with ".slice", but can't be just ".slice". + if len(slice) < len(suffix) || !strings.HasSuffix(slice, suffix) { + return "", fmt.Errorf("invalid slice name: %s", slice) + } + + // Path-separators are not allowed. + if strings.Contains(slice, "/") { + return "", fmt.Errorf("invalid slice name: %s", slice) + } + + var path, prefix string + sliceName := strings.TrimSuffix(slice, suffix) + for _, component := range strings.Split(sliceName, "-") { + // test--a.slice isn't permitted, nor is -test.slice. + if component == "" { + return "", fmt.Errorf("invalid slice name: %s", slice) + } + + // Append the component to the path and to the prefix. + path += prefix + component + suffix + "/" + prefix += component + "-" + } + + return path, nil +} + +func getSubsystemPath(c *configs.Cgroup, subsystem string) (string, error) { + mountpoint, err := cgroups.FindCgroupMountpoint(subsystem) + if err != nil { + return "", err + } + + initPath, err := cgroups.GetInitCgroupDir(subsystem) + if err != nil { + return "", err + } + + slice := "system.slice" + if c.Parent != "" { + slice = c.Parent + } + + slice, err = expandSlice(slice) + if err != nil { + return "", err + } + + return filepath.Join(mountpoint, initPath, slice, getUnitName(c)), nil +} + +func (m *Manager) Freeze(state configs.FreezerState) error { + path, err := getSubsystemPath(m.Cgroups, "freezer") + if err != nil { + return err + } + prevState := m.Cgroups.Resources.Freezer + m.Cgroups.Resources.Freezer = state + freezer, err := subsystems.Get("freezer") + if err != nil { + return err + } + err = freezer.Set(path, m.Cgroups) + if err != nil { + m.Cgroups.Resources.Freezer = prevState + return err + } + return nil +} + +func (m *Manager) GetPids() ([]int, error) { + path, err := getSubsystemPath(m.Cgroups, "devices") + if err != nil { + return nil, err + } + return cgroups.GetPids(path) +} + +func (m *Manager) GetAllPids() ([]int, error) { + path, err := getSubsystemPath(m.Cgroups, "devices") + if err != nil { + return nil, err + } + return cgroups.GetAllPids(path) +} + +func (m *Manager) GetStats() (*cgroups.Stats, error) { + m.mu.Lock() + defer m.mu.Unlock() + stats := cgroups.NewStats() + for name, path := range m.Paths { + sys, err := subsystems.Get(name) + if err == errSubsystemDoesNotExist || !cgroups.PathExists(path) { + continue + } + if err := sys.GetStats(path, stats); err != nil { + return nil, err + } + } + + return stats, nil +} + +func (m *Manager) Set(container *configs.Config) error { + for _, sys := range subsystems { + // Get the subsystem path, but don't error out for not found cgroups. + path, err := getSubsystemPath(container.Cgroups, sys.Name()) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + + if err := sys.Set(path, container.Cgroups); err != nil { + return err + } + } + + if m.Paths["cpu"] != "" { + if err := fs.CheckCpushares(m.Paths["cpu"], container.Cgroups.Resources.CpuShares); err != nil { + return err + } + } + return nil +} + +func getUnitName(c *configs.Cgroup) string { + return fmt.Sprintf("%s-%s.scope", c.ScopePrefix, c.Name) +} + +// Atm we can't use the systemd device support because of two missing things: +// * Support for wildcards to allow mknod on any device +// * Support for wildcards to allow /dev/pts support +// +// The second is available in more recent systemd as "char-pts", but not in e.g. v208 which is +// in wide use. When both these are available we will be able to switch, but need to keep the old +// implementation for backwards compat. +// +// Note: we can't use systemd to set up the initial limits, and then change the cgroup +// because systemd will re-write the device settings if it needs to re-apply the cgroup context. +// This happens at least for v208 when any sibling unit is started. +func joinDevices(c *configs.Cgroup, pid int) error { + _, err := join(c, "devices", pid) + // Even if it's `not found` error, we'll return err because devices cgroup + // is hard requirement for container security. + if err != nil { + return err + } + return nil +} + +func setKernelMemory(c *configs.Cgroup) error { + path, err := getSubsystemPath(c, "memory") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + + if err := os.MkdirAll(path, 0755); err != nil { + return err + } + + // This doesn't get called by manager.Set, so we need to do it here. + s := &fs.MemoryGroup{} + return s.SetKernelMemory(path, c) +} + +func joinMemory(c *configs.Cgroup, pid int) error { + _, err := join(c, "memory", pid) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +// systemd does not atm set up the cpuset controller, so we must manually +// join it. Additionally that is a very finicky controller where each +// level must have a full setup as the default for a new directory is "no cpus" +func joinCpuset(c *configs.Cgroup, pid int) error { + path, err := getSubsystemPath(c, "cpuset") + if err != nil && !cgroups.IsNotFound(err) { + return err + } + + s := &fs.CpusetGroup{} + + return s.ApplyDir(path, c, pid) +} + +// `BlockIODeviceWeight` property of systemd does not work properly, and systemd +// expects device path instead of major minor numbers, which is also confusing +// for users. So we use fs work around for now. +func joinBlkio(c *configs.Cgroup, pid int) error { + _, err := join(c, "blkio", pid) + if err != nil { + return err + } + return nil +} + +func joinHugetlb(c *configs.Cgroup, pid int) error { + _, err := join(c, "hugetlb", pid) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} + +func joinPerfEvent(c *configs.Cgroup, pid int) error { + _, err := join(c, "perf_event", pid) + if err != nil && !cgroups.IsNotFound(err) { + return err + } + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/utils.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/utils.go new file mode 100644 index 000000000..8510c7f5c --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/utils.go @@ -0,0 +1,378 @@ +// +build linux + +package cgroups + +import ( + "bufio" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strconv" + "strings" + "time" + + "github.com/docker/go-units" +) + +const cgroupNamePrefix = "name=" + +// https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt +func FindCgroupMountpoint(subsystem string) (string, error) { + // We are not using mount.GetMounts() because it's super-inefficient, + // parsing it directly sped up x10 times because of not using Sscanf. + // It was one of two major performance drawbacks in container start. + f, err := os.Open("/proc/self/mountinfo") + if err != nil { + return "", err + } + defer f.Close() + + scanner := bufio.NewScanner(f) + for scanner.Scan() { + txt := scanner.Text() + fields := strings.Split(txt, " ") + for _, opt := range strings.Split(fields[len(fields)-1], ",") { + if opt == subsystem { + return fields[4], nil + } + } + } + if err := scanner.Err(); err != nil { + return "", err + } + + return "", NewNotFoundError(subsystem) +} + +func FindCgroupMountpointAndRoot(subsystem string) (string, string, error) { + f, err := os.Open("/proc/self/mountinfo") + if err != nil { + return "", "", err + } + defer f.Close() + + scanner := bufio.NewScanner(f) + for scanner.Scan() { + txt := scanner.Text() + fields := strings.Split(txt, " ") + for _, opt := range strings.Split(fields[len(fields)-1], ",") { + if opt == subsystem { + return fields[4], fields[3], nil + } + } + } + if err := scanner.Err(); err != nil { + return "", "", err + } + + return "", "", NewNotFoundError(subsystem) +} + +func FindCgroupMountpointDir() (string, error) { + f, err := os.Open("/proc/self/mountinfo") + if err != nil { + return "", err + } + defer f.Close() + + scanner := bufio.NewScanner(f) + for scanner.Scan() { + text := scanner.Text() + fields := strings.Split(text, " ") + // Safe as mountinfo encodes mountpoints with spaces as \040. + index := strings.Index(text, " - ") + postSeparatorFields := strings.Fields(text[index+3:]) + numPostFields := len(postSeparatorFields) + + // This is an error as we can't detect if the mount is for "cgroup" + if numPostFields == 0 { + return "", fmt.Errorf("Found no fields post '-' in %q", text) + } + + if postSeparatorFields[0] == "cgroup" { + // Check that the mount is properly formated. + if numPostFields < 3 { + return "", fmt.Errorf("Error found less than 3 fields post '-' in %q", text) + } + + return filepath.Dir(fields[4]), nil + } + } + if err := scanner.Err(); err != nil { + return "", err + } + + return "", NewNotFoundError("cgroup") +} + +type Mount struct { + Mountpoint string + Root string + Subsystems []string +} + +func (m Mount) GetThisCgroupDir(cgroups map[string]string) (string, error) { + if len(m.Subsystems) == 0 { + return "", fmt.Errorf("no subsystem for mount") + } + + return getControllerPath(m.Subsystems[0], cgroups) +} + +func getCgroupMountsHelper(ss map[string]bool, mi io.Reader) ([]Mount, error) { + res := make([]Mount, 0, len(ss)) + scanner := bufio.NewScanner(mi) + for scanner.Scan() { + txt := scanner.Text() + sepIdx := strings.IndexByte(txt, '-') + if sepIdx == -1 { + return nil, fmt.Errorf("invalid mountinfo format") + } + if txt[sepIdx+2:sepIdx+8] != "cgroup" { + continue + } + fields := strings.Split(txt, " ") + m := Mount{ + Mountpoint: fields[4], + Root: fields[3], + } + for _, opt := range strings.Split(fields[len(fields)-1], ",") { + if strings.HasPrefix(opt, cgroupNamePrefix) { + m.Subsystems = append(m.Subsystems, opt[len(cgroupNamePrefix):]) + } + if ss[opt] { + m.Subsystems = append(m.Subsystems, opt) + } + } + res = append(res, m) + } + if err := scanner.Err(); err != nil { + return nil, err + } + return res, nil +} + +func GetCgroupMounts() ([]Mount, error) { + f, err := os.Open("/proc/self/mountinfo") + if err != nil { + return nil, err + } + defer f.Close() + + all, err := GetAllSubsystems() + if err != nil { + return nil, err + } + + allMap := make(map[string]bool) + for _, s := range all { + allMap[s] = true + } + return getCgroupMountsHelper(allMap, f) +} + +// Returns all the cgroup subsystems supported by the kernel +func GetAllSubsystems() ([]string, error) { + f, err := os.Open("/proc/cgroups") + if err != nil { + return nil, err + } + defer f.Close() + + subsystems := []string{} + + s := bufio.NewScanner(f) + for s.Scan() { + if err := s.Err(); err != nil { + return nil, err + } + text := s.Text() + if text[0] != '#' { + parts := strings.Fields(text) + if len(parts) >= 4 && parts[3] != "0" { + subsystems = append(subsystems, parts[0]) + } + } + } + return subsystems, nil +} + +// Returns the relative path to the cgroup docker is running in. +func GetThisCgroupDir(subsystem string) (string, error) { + cgroups, err := ParseCgroupFile("/proc/self/cgroup") + if err != nil { + return "", err + } + + return getControllerPath(subsystem, cgroups) +} + +func GetInitCgroupDir(subsystem string) (string, error) { + + cgroups, err := ParseCgroupFile("/proc/1/cgroup") + if err != nil { + return "", err + } + + return getControllerPath(subsystem, cgroups) +} + +func readProcsFile(dir string) ([]int, error) { + f, err := os.Open(filepath.Join(dir, "cgroup.procs")) + if err != nil { + return nil, err + } + defer f.Close() + + var ( + s = bufio.NewScanner(f) + out = []int{} + ) + + for s.Scan() { + if t := s.Text(); t != "" { + pid, err := strconv.Atoi(t) + if err != nil { + return nil, err + } + out = append(out, pid) + } + } + return out, nil +} + +func ParseCgroupFile(path string) (map[string]string, error) { + f, err := os.Open(path) + if err != nil { + return nil, err + } + defer f.Close() + + s := bufio.NewScanner(f) + cgroups := make(map[string]string) + + for s.Scan() { + if err := s.Err(); err != nil { + return nil, err + } + + text := s.Text() + parts := strings.Split(text, ":") + + for _, subs := range strings.Split(parts[1], ",") { + cgroups[subs] = parts[2] + } + } + return cgroups, nil +} + +func getControllerPath(subsystem string, cgroups map[string]string) (string, error) { + + if p, ok := cgroups[subsystem]; ok { + return p, nil + } + + if p, ok := cgroups[cgroupNamePrefix+subsystem]; ok { + return p, nil + } + + return "", NewNotFoundError(subsystem) +} + +func PathExists(path string) bool { + if _, err := os.Stat(path); err != nil { + return false + } + return true +} + +func EnterPid(cgroupPaths map[string]string, pid int) error { + for _, path := range cgroupPaths { + if PathExists(path) { + if err := ioutil.WriteFile(filepath.Join(path, "cgroup.procs"), + []byte(strconv.Itoa(pid)), 0700); err != nil { + return err + } + } + } + return nil +} + +// RemovePaths iterates over the provided paths removing them. +// We trying to remove all paths five times with increasing delay between tries. +// If after all there are not removed cgroups - appropriate error will be +// returned. +func RemovePaths(paths map[string]string) (err error) { + delay := 10 * time.Millisecond + for i := 0; i < 5; i++ { + if i != 0 { + time.Sleep(delay) + delay *= 2 + } + for s, p := range paths { + os.RemoveAll(p) + // TODO: here probably should be logging + _, err := os.Stat(p) + // We need this strange way of checking cgroups existence because + // RemoveAll almost always returns error, even on already removed + // cgroups + if os.IsNotExist(err) { + delete(paths, s) + } + } + if len(paths) == 0 { + return nil + } + } + return fmt.Errorf("Failed to remove paths: %s", paths) +} + +func GetHugePageSize() ([]string, error) { + var pageSizes []string + sizeList := []string{"B", "kB", "MB", "GB", "TB", "PB"} + files, err := ioutil.ReadDir("/sys/kernel/mm/hugepages") + if err != nil { + return pageSizes, err + } + for _, st := range files { + nameArray := strings.Split(st.Name(), "-") + pageSize, err := units.RAMInBytes(nameArray[1]) + if err != nil { + return []string{}, err + } + sizeString := units.CustomSize("%g%s", float64(pageSize), 1024.0, sizeList) + pageSizes = append(pageSizes, sizeString) + } + + return pageSizes, nil +} + +// GetPids returns all pids, that were added to cgroup at path. +func GetPids(path string) ([]int, error) { + return readProcsFile(path) +} + +// GetAllPids returns all pids, that were added to cgroup at path and to all its +// subcgroups. +func GetAllPids(path string) ([]int, error) { + var pids []int + // collect pids from all sub-cgroups + err := filepath.Walk(path, func(p string, info os.FileInfo, iErr error) error { + dir, file := filepath.Split(p) + if file != "cgroup.procs" { + return nil + } + if iErr != nil { + return iErr + } + cPids, err := readProcsFile(dir) + if err != nil { + return err + } + pids = append(pids, cPids...) + return nil + }) + return pids, err +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/cgroups/utils_test.go b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/utils_test.go new file mode 100644 index 000000000..179c14ab3 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/cgroups/utils_test.go @@ -0,0 +1,138 @@ +package cgroups + +import ( + "bytes" + "strings" + "testing" +) + +const fedoraMountinfo = `15 35 0:3 / /proc rw,nosuid,nodev,noexec,relatime shared:5 - proc proc rw +16 35 0:14 / /sys rw,nosuid,nodev,noexec,relatime shared:6 - sysfs sysfs rw,seclabel +17 35 0:5 / /dev rw,nosuid shared:2 - devtmpfs devtmpfs rw,seclabel,size=8056484k,nr_inodes=2014121,mode=755 +18 16 0:15 / /sys/kernel/security rw,nosuid,nodev,noexec,relatime shared:7 - securityfs securityfs rw +19 16 0:13 / /sys/fs/selinux rw,relatime shared:8 - selinuxfs selinuxfs rw +20 17 0:16 / /dev/shm rw,nosuid,nodev shared:3 - tmpfs tmpfs rw,seclabel +21 17 0:10 / /dev/pts rw,nosuid,noexec,relatime shared:4 - devpts devpts rw,seclabel,gid=5,mode=620,ptmxmode=000 +22 35 0:17 / /run rw,nosuid,nodev shared:21 - tmpfs tmpfs rw,seclabel,mode=755 +23 16 0:18 / /sys/fs/cgroup rw,nosuid,nodev,noexec shared:9 - tmpfs tmpfs rw,seclabel,mode=755 +24 23 0:19 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:10 - cgroup cgroup rw,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd +25 16 0:20 / /sys/fs/pstore rw,nosuid,nodev,noexec,relatime shared:20 - pstore pstore rw +26 23 0:21 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:11 - cgroup cgroup rw,cpuset,clone_children +27 23 0:22 / /sys/fs/cgroup/cpu,cpuacct rw,nosuid,nodev,noexec,relatime shared:12 - cgroup cgroup rw,cpuacct,cpu,clone_children +28 23 0:23 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:13 - cgroup cgroup rw,memory,clone_children +29 23 0:24 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:14 - cgroup cgroup rw,devices,clone_children +30 23 0:25 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:15 - cgroup cgroup rw,freezer,clone_children +31 23 0:26 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,net_cls,clone_children +32 23 0:27 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:17 - cgroup cgroup rw,blkio,clone_children +33 23 0:28 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:18 - cgroup cgroup rw,perf_event,clone_children +34 23 0:29 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:19 - cgroup cgroup rw,hugetlb,clone_children +35 1 253:2 / / rw,relatime shared:1 - ext4 /dev/mapper/ssd-root--f20 rw,seclabel,data=ordered +36 15 0:30 / /proc/sys/fs/binfmt_misc rw,relatime shared:22 - autofs systemd-1 rw,fd=38,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +37 17 0:12 / /dev/mqueue rw,relatime shared:23 - mqueue mqueue rw,seclabel +38 35 0:31 / /tmp rw shared:24 - tmpfs tmpfs rw,seclabel +39 17 0:32 / /dev/hugepages rw,relatime shared:25 - hugetlbfs hugetlbfs rw,seclabel +40 16 0:7 / /sys/kernel/debug rw,relatime shared:26 - debugfs debugfs rw +41 16 0:33 / /sys/kernel/config rw,relatime shared:27 - configfs configfs rw +42 35 0:34 / /var/lib/nfs/rpc_pipefs rw,relatime shared:28 - rpc_pipefs sunrpc rw +43 15 0:35 / /proc/fs/nfsd rw,relatime shared:29 - nfsd sunrpc rw +45 35 8:17 / /boot rw,relatime shared:30 - ext4 /dev/sdb1 rw,seclabel,data=ordered +46 35 253:4 / /home rw,relatime shared:31 - ext4 /dev/mapper/ssd-home rw,seclabel,data=ordered +47 35 253:5 / /var/lib/libvirt/images rw,noatime,nodiratime shared:32 - ext4 /dev/mapper/ssd-virt rw,seclabel,discard,data=ordered +48 35 253:12 / /mnt/old rw,relatime shared:33 - ext4 /dev/mapper/HelpDeskRHEL6-FedoraRoot rw,seclabel,data=ordered +121 22 0:36 / /run/user/1000/gvfs rw,nosuid,nodev,relatime shared:104 - fuse.gvfsd-fuse gvfsd-fuse rw,user_id=1000,group_id=1000 +124 16 0:37 / /sys/fs/fuse/connections rw,relatime shared:107 - fusectl fusectl rw +165 38 253:3 / /tmp/mnt rw,relatime shared:147 - ext4 /dev/mapper/ssd-root rw,seclabel,data=ordered +167 35 253:15 / /var/lib/docker/devicemapper/mnt/aae4076022f0e2b80a2afbf8fc6df450c52080191fcef7fb679a73e6f073e5c2 rw,relatime shared:149 - ext4 /dev/mapper/docker-253:2-425882-aae4076022f0e2b80a2afbf8fc6df450c52080191fcef7fb679a73e6f073e5c2 rw,seclabel,discard,stripe=16,data=ordered +171 35 253:16 / /var/lib/docker/devicemapper/mnt/c71be651f114db95180e472f7871b74fa597ee70a58ccc35cb87139ddea15373 rw,relatime shared:153 - ext4 /dev/mapper/docker-253:2-425882-c71be651f114db95180e472f7871b74fa597ee70a58ccc35cb87139ddea15373 rw,seclabel,discard,stripe=16,data=ordered +175 35 253:17 / /var/lib/docker/devicemapper/mnt/1bac6ab72862d2d5626560df6197cf12036b82e258c53d981fa29adce6f06c3c rw,relatime shared:157 - ext4 /dev/mapper/docker-253:2-425882-1bac6ab72862d2d5626560df6197cf12036b82e258c53d981fa29adce6f06c3c rw,seclabel,discard,stripe=16,data=ordered +179 35 253:18 / /var/lib/docker/devicemapper/mnt/d710a357d77158e80d5b2c55710ae07c94e76d34d21ee7bae65ce5418f739b09 rw,relatime shared:161 - ext4 /dev/mapper/docker-253:2-425882-d710a357d77158e80d5b2c55710ae07c94e76d34d21ee7bae65ce5418f739b09 rw,seclabel,discard,stripe=16,data=ordered +183 35 253:19 / /var/lib/docker/devicemapper/mnt/6479f52366114d5f518db6837254baab48fab39f2ac38d5099250e9a6ceae6c7 rw,relatime shared:165 - ext4 /dev/mapper/docker-253:2-425882-6479f52366114d5f518db6837254baab48fab39f2ac38d5099250e9a6ceae6c7 rw,seclabel,discard,stripe=16,data=ordered +187 35 253:20 / /var/lib/docker/devicemapper/mnt/8d9df91c4cca5aef49eeb2725292aab324646f723a7feab56be34c2ad08268e1 rw,relatime shared:169 - ext4 /dev/mapper/docker-253:2-425882-8d9df91c4cca5aef49eeb2725292aab324646f723a7feab56be34c2ad08268e1 rw,seclabel,discard,stripe=16,data=ordered +191 35 253:21 / /var/lib/docker/devicemapper/mnt/c8240b768603d32e920d365dc9d1dc2a6af46cd23e7ae819947f969e1b4ec661 rw,relatime shared:173 - ext4 /dev/mapper/docker-253:2-425882-c8240b768603d32e920d365dc9d1dc2a6af46cd23e7ae819947f969e1b4ec661 rw,seclabel,discard,stripe=16,data=ordered +195 35 253:22 / /var/lib/docker/devicemapper/mnt/2eb3a01278380bbf3ed12d86ac629eaa70a4351301ee307a5cabe7b5f3b1615f rw,relatime shared:177 - ext4 /dev/mapper/docker-253:2-425882-2eb3a01278380bbf3ed12d86ac629eaa70a4351301ee307a5cabe7b5f3b1615f rw,seclabel,discard,stripe=16,data=ordered +199 35 253:23 / /var/lib/docker/devicemapper/mnt/37a17fb7c9d9b80821235d5f2662879bd3483915f245f9b49cdaa0e38779b70b rw,relatime shared:181 - ext4 /dev/mapper/docker-253:2-425882-37a17fb7c9d9b80821235d5f2662879bd3483915f245f9b49cdaa0e38779b70b rw,seclabel,discard,stripe=16,data=ordered +203 35 253:24 / /var/lib/docker/devicemapper/mnt/aea459ae930bf1de913e2f29428fd80ee678a1e962d4080019d9f9774331ee2b rw,relatime shared:185 - ext4 /dev/mapper/docker-253:2-425882-aea459ae930bf1de913e2f29428fd80ee678a1e962d4080019d9f9774331ee2b rw,seclabel,discard,stripe=16,data=ordered +207 35 253:25 / /var/lib/docker/devicemapper/mnt/928ead0bc06c454bd9f269e8585aeae0a6bd697f46dc8754c2a91309bc810882 rw,relatime shared:189 - ext4 /dev/mapper/docker-253:2-425882-928ead0bc06c454bd9f269e8585aeae0a6bd697f46dc8754c2a91309bc810882 rw,seclabel,discard,stripe=16,data=ordered +211 35 253:26 / /var/lib/docker/devicemapper/mnt/0f284d18481d671644706e7a7244cbcf63d590d634cc882cb8721821929d0420 rw,relatime shared:193 - ext4 /dev/mapper/docker-253:2-425882-0f284d18481d671644706e7a7244cbcf63d590d634cc882cb8721821929d0420 rw,seclabel,discard,stripe=16,data=ordered +215 35 253:27 / /var/lib/docker/devicemapper/mnt/d9dd16722ab34c38db2733e23f69e8f4803ce59658250dd63e98adff95d04919 rw,relatime shared:197 - ext4 /dev/mapper/docker-253:2-425882-d9dd16722ab34c38db2733e23f69e8f4803ce59658250dd63e98adff95d04919 rw,seclabel,discard,stripe=16,data=ordered +219 35 253:28 / /var/lib/docker/devicemapper/mnt/bc4500479f18c2c08c21ad5282e5f826a016a386177d9874c2764751c031d634 rw,relatime shared:201 - ext4 /dev/mapper/docker-253:2-425882-bc4500479f18c2c08c21ad5282e5f826a016a386177d9874c2764751c031d634 rw,seclabel,discard,stripe=16,data=ordered +223 35 253:29 / /var/lib/docker/devicemapper/mnt/7770c8b24eb3d5cc159a065910076938910d307ab2f5d94e1dc3b24c06ee2c8a rw,relatime shared:205 - ext4 /dev/mapper/docker-253:2-425882-7770c8b24eb3d5cc159a065910076938910d307ab2f5d94e1dc3b24c06ee2c8a rw,seclabel,discard,stripe=16,data=ordered +227 35 253:30 / /var/lib/docker/devicemapper/mnt/c280cd3d0bf0aa36b478b292279671624cceafc1a67eaa920fa1082601297adf rw,relatime shared:209 - ext4 /dev/mapper/docker-253:2-425882-c280cd3d0bf0aa36b478b292279671624cceafc1a67eaa920fa1082601297adf rw,seclabel,discard,stripe=16,data=ordered +231 35 253:31 / /var/lib/docker/devicemapper/mnt/8b59a7d9340279f09fea67fd6ad89ddef711e9e7050eb647984f8b5ef006335f rw,relatime shared:213 - ext4 /dev/mapper/docker-253:2-425882-8b59a7d9340279f09fea67fd6ad89ddef711e9e7050eb647984f8b5ef006335f rw,seclabel,discard,stripe=16,data=ordered +235 35 253:32 / /var/lib/docker/devicemapper/mnt/1a28059f29eda821578b1bb27a60cc71f76f846a551abefabce6efd0146dce9f rw,relatime shared:217 - ext4 /dev/mapper/docker-253:2-425882-1a28059f29eda821578b1bb27a60cc71f76f846a551abefabce6efd0146dce9f rw,seclabel,discard,stripe=16,data=ordered +239 35 253:33 / /var/lib/docker/devicemapper/mnt/e9aa60c60128cad1 rw,relatime shared:221 - ext4 /dev/mapper/docker-253:2-425882-e9aa60c60128cad1 rw,seclabel,discard,stripe=16,data=ordered +243 35 253:34 / /var/lib/docker/devicemapper/mnt/5fec11304b6f4713fea7b6ccdcc1adc0a1966187f590fe25a8227428a8df275d-init rw,relatime shared:225 - ext4 /dev/mapper/docker-253:2-425882-5fec11304b6f4713fea7b6ccdcc1adc0a1966187f590fe25a8227428a8df275d-init rw,seclabel,discard,stripe=16,data=ordered +247 35 253:35 / /var/lib/docker/devicemapper/mnt/5fec11304b6f4713fea7b6ccdcc1adc0a1966187f590fe25a8227428a8df275d rw,relatime shared:229 - ext4 /dev/mapper/docker-253:2-425882-5fec11304b6f4713fea7b6ccdcc1adc0a1966187f590fe25a8227428a8df275d rw,seclabel,discard,stripe=16,data=ordered +31 21 0:23 / /DATA/foo_bla_bla rw,relatime - cifs //foo/BLA\040BLA\040BLA/ rw,sec=ntlm,cache=loose,unc=\\foo\BLA BLA BLA,username=my_login,domain=mydomain.com,uid=12345678,forceuid,gid=12345678,forcegid,addr=10.1.30.10,file_mode=0755,dir_mode=0755,nounix,rsize=61440,wsize=65536,actimeo=1` + +func TestGetCgroupMounts(t *testing.T) { + subsystems := map[string]bool{ + "cpuset": true, + "cpu": true, + "cpuacct": true, + "memory": true, + "devices": true, + "freezer": true, + "net_cls": true, + "blkio": true, + "perf_event": true, + "hugetlb": true, + } + mi := bytes.NewBufferString(fedoraMountinfo) + cgMounts, err := getCgroupMountsHelper(subsystems, mi) + if err != nil { + t.Fatal(err) + } + cgMap := make(map[string]Mount) + for _, m := range cgMounts { + for _, ss := range m.Subsystems { + cgMap[ss] = m + } + } + for ss := range subsystems { + m, ok := cgMap[ss] + if !ok { + t.Fatalf("%s not found", ss) + } + if m.Root != "/" { + t.Fatalf("unexpected root for %s: %s", ss, m.Root) + } + if !strings.HasPrefix(m.Mountpoint, "/sys/fs/cgroup/") && !strings.Contains(m.Mountpoint, ss) { + t.Fatalf("unexpected mountpoint for %s: %s", ss, m.Mountpoint) + } + var ssFound bool + for _, mss := range m.Subsystems { + if mss == ss { + ssFound = true + break + } + } + if !ssFound { + t.Fatalf("subsystem %s not found in Subsystems field %v", ss, m.Subsystems) + } + } +} + +func BenchmarkGetCgroupMounts(b *testing.B) { + subsystems := map[string]bool{ + "cpuset": true, + "cpu": true, + "cpuacct": true, + "memory": true, + "devices": true, + "freezer": true, + "net_cls": true, + "blkio": true, + "perf_event": true, + "hugetlb": true, + } + b.ResetTimer() + for i := 0; i < b.N; i++ { + b.StopTimer() + mi := bytes.NewBufferString(fedoraMountinfo) + b.StartTimer() + if _, err := getCgroupMountsHelper(subsystems, mi); err != nil { + b.Fatal(err) + } + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/blkio_device.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/blkio_device.go new file mode 100644 index 000000000..e0f3ca165 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/blkio_device.go @@ -0,0 +1,61 @@ +package configs + +import "fmt" + +// blockIODevice holds major:minor format supported in blkio cgroup +type blockIODevice struct { + // Major is the device's major number + Major int64 `json:"major"` + // Minor is the device's minor number + Minor int64 `json:"minor"` +} + +// WeightDevice struct holds a `major:minor weight`|`major:minor leaf_weight` pair +type WeightDevice struct { + blockIODevice + // Weight is the bandwidth rate for the device, range is from 10 to 1000 + Weight uint16 `json:"weight"` + // LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only + LeafWeight uint16 `json:"leafWeight"` +} + +// NewWeightDevice returns a configured WeightDevice pointer +func NewWeightDevice(major, minor int64, weight, leafWeight uint16) *WeightDevice { + wd := &WeightDevice{} + wd.Major = major + wd.Minor = minor + wd.Weight = weight + wd.LeafWeight = leafWeight + return wd +} + +// WeightString formats the struct to be writable to the cgroup specific file +func (wd *WeightDevice) WeightString() string { + return fmt.Sprintf("%d:%d %d", wd.Major, wd.Minor, wd.Weight) +} + +// LeafWeightString formats the struct to be writable to the cgroup specific file +func (wd *WeightDevice) LeafWeightString() string { + return fmt.Sprintf("%d:%d %d", wd.Major, wd.Minor, wd.LeafWeight) +} + +// ThrottleDevice struct holds a `major:minor rate_per_second` pair +type ThrottleDevice struct { + blockIODevice + // Rate is the IO rate limit per cgroup per device + Rate uint64 `json:"rate"` +} + +// NewThrottleDevice returns a configured ThrottleDevice pointer +func NewThrottleDevice(major, minor int64, rate uint64) *ThrottleDevice { + td := &ThrottleDevice{} + td.Major = major + td.Minor = minor + td.Rate = rate + return td +} + +// String formats the struct to be writable to the cgroup specific file +func (td *ThrottleDevice) String() string { + return fmt.Sprintf("%d:%d %d", td.Major, td.Minor, td.Rate) +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_unix.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_unix.go new file mode 100644 index 000000000..40a033f35 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_unix.go @@ -0,0 +1,121 @@ +// +build linux freebsd + +package configs + +type FreezerState string + +const ( + Undefined FreezerState = "" + Frozen FreezerState = "FROZEN" + Thawed FreezerState = "THAWED" +) + +type Cgroup struct { + // Deprecated, use Path instead + Name string `json:"name,omitempty"` + + // name of parent of cgroup or slice + // Deprecated, use Path instead + Parent string `json:"parent,omitempty"` + + // Path specifies the path to cgroups that are created and/or joined by the container. + // The path is assumed to be relative to the host system cgroup mountpoint. + Path string `json:"path"` + + // ScopePrefix decribes prefix for the scope name + ScopePrefix string `json:"scope_prefix"` + + // Paths represent the absolute cgroups paths to join. + // This takes precedence over Path. + Paths map[string]string + + // Resources contains various cgroups settings to apply + *Resources +} + +type Resources struct { + // If this is true allow access to any kind of device within the container. If false, allow access only to devices explicitly listed in the allowed_devices list. + // Deprecated + AllowAllDevices bool `json:"allow_all_devices,omitempty"` + // Deprecated + AllowedDevices []*Device `json:"allowed_devices,omitempty"` + // Deprecated + DeniedDevices []*Device `json:"denied_devices,omitempty"` + + Devices []*Device `json:"devices"` + + // Memory limit (in bytes) + Memory int64 `json:"memory"` + + // Memory reservation or soft_limit (in bytes) + MemoryReservation int64 `json:"memory_reservation"` + + // Total memory usage (memory + swap); set `-1` to enable unlimited swap + MemorySwap int64 `json:"memory_swap"` + + // Kernel memory limit (in bytes) + KernelMemory int64 `json:"kernel_memory"` + + // CPU shares (relative weight vs. other containers) + CpuShares int64 `json:"cpu_shares"` + + // CPU hardcap limit (in usecs). Allowed cpu time in a given period. + CpuQuota int64 `json:"cpu_quota"` + + // CPU period to be used for hardcapping (in usecs). 0 to use system default. + CpuPeriod int64 `json:"cpu_period"` + + // How many time CPU will use in realtime scheduling (in usecs). + CpuRtRuntime int64 `json:"cpu_quota"` + + // CPU period to be used for realtime scheduling (in usecs). + CpuRtPeriod int64 `json:"cpu_period"` + + // CPU to use + CpusetCpus string `json:"cpuset_cpus"` + + // MEM to use + CpusetMems string `json:"cpuset_mems"` + + // Process limit; set <= `0' to disable limit. + PidsLimit int64 `json:"pids_limit"` + + // Specifies per cgroup weight, range is from 10 to 1000. + BlkioWeight uint16 `json:"blkio_weight"` + + // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only + BlkioLeafWeight uint16 `json:"blkio_leaf_weight"` + + // Weight per cgroup per device, can override BlkioWeight. + BlkioWeightDevice []*WeightDevice `json:"blkio_weight_device"` + + // IO read rate limit per cgroup per device, bytes per second. + BlkioThrottleReadBpsDevice []*ThrottleDevice `json:"blkio_throttle_read_bps_device"` + + // IO write rate limit per cgroup per divice, bytes per second. + BlkioThrottleWriteBpsDevice []*ThrottleDevice `json:"blkio_throttle_write_bps_device"` + + // IO read rate limit per cgroup per device, IO per second. + BlkioThrottleReadIOPSDevice []*ThrottleDevice `json:"blkio_throttle_read_iops_device"` + + // IO write rate limit per cgroup per device, IO per second. + BlkioThrottleWriteIOPSDevice []*ThrottleDevice `json:"blkio_throttle_write_iops_device"` + + // set the freeze value for the process + Freezer FreezerState `json:"freezer"` + + // Hugetlb limit (in bytes) + HugetlbLimit []*HugepageLimit `json:"hugetlb_limit"` + + // Whether to disable OOM Killer + OomKillDisable bool `json:"oom_kill_disable"` + + // Tuning swappiness behaviour per cgroup + MemorySwappiness int64 `json:"memory_swappiness"` + + // Set priority of network traffic for container + NetPrioIfpriomap []*IfPrioMap `json:"net_prio_ifpriomap"` + + // Set class identifier for container's network packets + NetClsClassid string `json:"net_cls_classid"` +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_unsupported.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_unsupported.go new file mode 100644 index 000000000..95e2830a4 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_unsupported.go @@ -0,0 +1,6 @@ +// +build !windows,!linux,!freebsd + +package configs + +type Cgroup struct { +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_windows.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_windows.go new file mode 100644 index 000000000..d74847b0d --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/cgroup_windows.go @@ -0,0 +1,6 @@ +package configs + +// TODO Windows: This can ultimately be entirely factored out on Windows as +// cgroups are a Unix-specific construct. +type Cgroup struct { +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/config.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/config.go new file mode 100644 index 000000000..069daae29 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/config.go @@ -0,0 +1,252 @@ +package configs + +import ( + "bytes" + "encoding/json" + "os/exec" +) + +type Rlimit struct { + Type int `json:"type"` + Hard uint64 `json:"hard"` + Soft uint64 `json:"soft"` +} + +// IDMap represents UID/GID Mappings for User Namespaces. +type IDMap struct { + ContainerID int `json:"container_id"` + HostID int `json:"host_id"` + Size int `json:"size"` +} + +// Seccomp represents syscall restrictions +// By default, only the native architecture of the kernel is allowed to be used +// for syscalls. Additional architectures can be added by specifying them in +// Architectures. +type Seccomp struct { + DefaultAction Action `json:"default_action"` + Architectures []string `json:"architectures"` + Syscalls []*Syscall `json:"syscalls"` +} + +// An action to be taken upon rule match in Seccomp +type Action int + +const ( + Kill Action = iota + 1 + Errno + Trap + Allow + Trace +) + +// A comparison operator to be used when matching syscall arguments in Seccomp +type Operator int + +const ( + EqualTo Operator = iota + 1 + NotEqualTo + GreaterThan + GreaterThanOrEqualTo + LessThan + LessThanOrEqualTo + MaskEqualTo +) + +// A rule to match a specific syscall argument in Seccomp +type Arg struct { + Index uint `json:"index"` + Value uint64 `json:"value"` + ValueTwo uint64 `json:"value_two"` + Op Operator `json:"op"` +} + +// An rule to match a syscall in Seccomp +type Syscall struct { + Name string `json:"name"` + Action Action `json:"action"` + Args []*Arg `json:"args"` +} + +// TODO Windows. Many of these fields should be factored out into those parts +// which are common across platforms, and those which are platform specific. + +// Config defines configuration options for executing a process inside a contained environment. +type Config struct { + // NoPivotRoot will use MS_MOVE and a chroot to jail the process into the container's rootfs + // This is a common option when the container is running in ramdisk + NoPivotRoot bool `json:"no_pivot_root"` + + // ParentDeathSignal specifies the signal that is sent to the container's process in the case + // that the parent process dies. + ParentDeathSignal int `json:"parent_death_signal"` + + // PivotDir allows a custom directory inside the container's root filesystem to be used as pivot, when NoPivotRoot is not set. + // When a custom PivotDir not set, a temporary dir inside the root filesystem will be used. The pivot dir needs to be writeable. + // This is required when using read only root filesystems. In these cases, a read/writeable path can be (bind) mounted somewhere inside the root filesystem to act as pivot. + PivotDir string `json:"pivot_dir"` + + // Path to a directory containing the container's root filesystem. + Rootfs string `json:"rootfs"` + + // Readonlyfs will remount the container's rootfs as readonly where only externally mounted + // bind mounts are writtable. + Readonlyfs bool `json:"readonlyfs"` + + // Specifies the mount propagation flags to be applied to /. + RootPropagation int `json:"rootPropagation"` + + // Mounts specify additional source and destination paths that will be mounted inside the container's + // rootfs and mount namespace if specified + Mounts []*Mount `json:"mounts"` + + // The device nodes that should be automatically created within the container upon container start. Note, make sure that the node is marked as allowed in the cgroup as well! + Devices []*Device `json:"devices"` + + MountLabel string `json:"mount_label"` + + // Hostname optionally sets the container's hostname if provided + Hostname string `json:"hostname"` + + // Namespaces specifies the container's namespaces that it should setup when cloning the init process + // If a namespace is not provided that namespace is shared from the container's parent process + Namespaces Namespaces `json:"namespaces"` + + // Capabilities specify the capabilities to keep when executing the process inside the container + // All capbilities not specified will be dropped from the processes capability mask + Capabilities []string `json:"capabilities"` + + // Networks specifies the container's network setup to be created + Networks []*Network `json:"networks"` + + // Routes can be specified to create entries in the route table as the container is started + Routes []*Route `json:"routes"` + + // Cgroups specifies specific cgroup settings for the various subsystems that the container is + // placed into to limit the resources the container has available + Cgroups *Cgroup `json:"cgroups"` + + // AppArmorProfile specifies the profile to apply to the process running in the container and is + // change at the time the process is execed + AppArmorProfile string `json:"apparmor_profile"` + + // ProcessLabel specifies the label to apply to the process running in the container. It is + // commonly used by selinux + ProcessLabel string `json:"process_label"` + + // Rlimits specifies the resource limits, such as max open files, to set in the container + // If Rlimits are not set, the container will inherit rlimits from the parent process + Rlimits []Rlimit `json:"rlimits"` + + // OomScoreAdj specifies the adjustment to be made by the kernel when calculating oom scores + // for a process. Valid values are between the range [-1000, '1000'], where processes with + // higher scores are preferred for being killed. + // More information about kernel oom score calculation here: https://lwn.net/Articles/317814/ + OomScoreAdj int `json:"oom_score_adj"` + + // AdditionalGroups specifies the gids that should be added to supplementary groups + // in addition to those that the user belongs to. + AdditionalGroups []string `json:"additional_groups"` + + // UidMappings is an array of User ID mappings for User Namespaces + UidMappings []IDMap `json:"uid_mappings"` + + // GidMappings is an array of Group ID mappings for User Namespaces + GidMappings []IDMap `json:"gid_mappings"` + + // MaskPaths specifies paths within the container's rootfs to mask over with a bind + // mount pointing to /dev/null as to prevent reads of the file. + MaskPaths []string `json:"mask_paths"` + + // ReadonlyPaths specifies paths within the container's rootfs to remount as read-only + // so that these files prevent any writes. + ReadonlyPaths []string `json:"readonly_paths"` + + // Sysctl is a map of properties and their values. It is the equivalent of using + // sysctl -w my.property.name value in Linux. + Sysctl map[string]string `json:"sysctl"` + + // Seccomp allows actions to be taken whenever a syscall is made within the container. + // A number of rules are given, each having an action to be taken if a syscall matches it. + // A default action to be taken if no rules match is also given. + Seccomp *Seccomp `json:"seccomp"` + + // Hooks are a collection of actions to perform at various container lifecycle events. + // Hooks are not able to be marshaled to json but they are also not needed to. + Hooks *Hooks `json:"-"` + + // Version is the version of opencontainer specification that is supported. + Version string `json:"version"` +} + +type Hooks struct { + // Prestart commands are executed after the container namespaces are created, + // but before the user supplied command is executed from init. + Prestart []Hook + + // Poststart commands are executed after the container init process starts. + Poststart []Hook + + // Poststop commands are executed after the container init process exits. + Poststop []Hook +} + +// HookState is the payload provided to a hook on execution. +type HookState struct { + Version string `json:"version"` + ID string `json:"id"` + Pid int `json:"pid"` + Root string `json:"root"` +} + +type Hook interface { + // Run executes the hook with the provided state. + Run(HookState) error +} + +// NewFunctionHooks will call the provided function when the hook is run. +func NewFunctionHook(f func(HookState) error) FuncHook { + return FuncHook{ + run: f, + } +} + +type FuncHook struct { + run func(HookState) error +} + +func (f FuncHook) Run(s HookState) error { + return f.run(s) +} + +type Command struct { + Path string `json:"path"` + Args []string `json:"args"` + Env []string `json:"env"` + Dir string `json:"dir"` +} + +// NewCommandHooks will execute the provided command when the hook is run. +func NewCommandHook(cmd Command) CommandHook { + return CommandHook{ + Command: cmd, + } +} + +type CommandHook struct { + Command +} + +func (c Command) Run(s HookState) error { + b, err := json.Marshal(s) + if err != nil { + return err + } + cmd := exec.Cmd{ + Path: c.Path, + Args: c.Args, + Env: c.Env, + Stdin: bytes.NewReader(b), + } + return cmd.Run() +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/config_unix.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/config_unix.go new file mode 100644 index 000000000..c447f3ef2 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/config_unix.go @@ -0,0 +1,51 @@ +// +build freebsd linux + +package configs + +import "fmt" + +// Gets the root uid for the process on host which could be non-zero +// when user namespaces are enabled. +func (c Config) HostUID() (int, error) { + if c.Namespaces.Contains(NEWUSER) { + if c.UidMappings == nil { + return -1, fmt.Errorf("User namespaces enabled, but no user mappings found.") + } + id, found := c.hostIDFromMapping(0, c.UidMappings) + if !found { + return -1, fmt.Errorf("User namespaces enabled, but no root user mapping found.") + } + return id, nil + } + // Return default root uid 0 + return 0, nil +} + +// Gets the root gid for the process on host which could be non-zero +// when user namespaces are enabled. +func (c Config) HostGID() (int, error) { + if c.Namespaces.Contains(NEWUSER) { + if c.GidMappings == nil { + return -1, fmt.Errorf("User namespaces enabled, but no gid mappings found.") + } + id, found := c.hostIDFromMapping(0, c.GidMappings) + if !found { + return -1, fmt.Errorf("User namespaces enabled, but no root group mapping found.") + } + return id, nil + } + // Return default root gid 0 + return 0, nil +} + +// Utility function that gets a host ID for a container ID from user namespace map +// if that ID is present in the map. +func (c Config) hostIDFromMapping(containerID int, uMap []IDMap) (int, bool) { + for _, m := range uMap { + if (containerID >= m.ContainerID) && (containerID <= (m.ContainerID + m.Size - 1)) { + hostID := m.HostID + (containerID - m.ContainerID) + return hostID, true + } + } + return -1, false +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/config_unix_test.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/config_unix_test.go new file mode 100644 index 000000000..27d07d4e8 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/config_unix_test.go @@ -0,0 +1,156 @@ +// +build linux freebsd + +package configs + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "testing" +) + +// Checks whether the expected capability is specified in the capabilities. +func contains(expected string, values []string) bool { + for _, v := range values { + if v == expected { + return true + } + } + return false +} + +func containsDevice(expected *Device, values []*Device) bool { + for _, d := range values { + if d.Path == expected.Path && + d.Permissions == expected.Permissions && + d.FileMode == expected.FileMode && + d.Major == expected.Major && + d.Minor == expected.Minor && + d.Type == expected.Type { + return true + } + } + return false +} + +func loadConfig(name string) (*Config, error) { + f, err := os.Open(filepath.Join("../sample_configs", name)) + if err != nil { + return nil, err + } + defer f.Close() + + var container *Config + if err := json.NewDecoder(f).Decode(&container); err != nil { + return nil, err + } + + // Check that a config doesn't contain extra fields + var configMap, abstractMap map[string]interface{} + + if _, err := f.Seek(0, 0); err != nil { + return nil, err + } + + if err := json.NewDecoder(f).Decode(&abstractMap); err != nil { + return nil, err + } + + configData, err := json.Marshal(&container) + if err != nil { + return nil, err + } + + if err := json.Unmarshal(configData, &configMap); err != nil { + return nil, err + } + + for k := range configMap { + delete(abstractMap, k) + } + + if len(abstractMap) != 0 { + return nil, fmt.Errorf("unknown fields: %s", abstractMap) + } + + return container, nil +} + +func TestRemoveNamespace(t *testing.T) { + ns := Namespaces{ + {Type: NEWNET}, + } + if !ns.Remove(NEWNET) { + t.Fatal("NEWNET was not removed") + } + if len(ns) != 0 { + t.Fatalf("namespaces should have 0 items but reports %d", len(ns)) + } +} + +func TestHostUIDNoUSERNS(t *testing.T) { + config := &Config{ + Namespaces: Namespaces{}, + } + uid, err := config.HostUID() + if err != nil { + t.Fatal(err) + } + if uid != 0 { + t.Fatalf("expected uid 0 with no USERNS but received %d", uid) + } +} + +func TestHostUIDWithUSERNS(t *testing.T) { + config := &Config{ + Namespaces: Namespaces{{Type: NEWUSER}}, + UidMappings: []IDMap{ + { + ContainerID: 0, + HostID: 1000, + Size: 1, + }, + }, + } + uid, err := config.HostUID() + if err != nil { + t.Fatal(err) + } + if uid != 1000 { + t.Fatalf("expected uid 1000 with no USERNS but received %d", uid) + } +} + +func TestHostGIDNoUSERNS(t *testing.T) { + config := &Config{ + Namespaces: Namespaces{}, + } + uid, err := config.HostGID() + if err != nil { + t.Fatal(err) + } + if uid != 0 { + t.Fatalf("expected gid 0 with no USERNS but received %d", uid) + } +} + +func TestHostGIDWithUSERNS(t *testing.T) { + config := &Config{ + Namespaces: Namespaces{{Type: NEWUSER}}, + GidMappings: []IDMap{ + { + ContainerID: 0, + HostID: 1000, + Size: 1, + }, + }, + } + uid, err := config.HostGID() + if err != nil { + t.Fatal(err) + } + if uid != 1000 { + t.Fatalf("expected gid 1000 with no USERNS but received %d", uid) + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/config_windows_test.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/config_windows_test.go new file mode 100644 index 000000000..1a0c8fa2d --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/config_windows_test.go @@ -0,0 +1,3 @@ +package configs + +// All current tests are for Unix-specific functionality diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/device.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/device.go new file mode 100644 index 000000000..8701bb212 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/device.go @@ -0,0 +1,57 @@ +package configs + +import ( + "fmt" + "os" +) + +const ( + Wildcard = -1 +) + +// TODO Windows: This can be factored out in the future + +type Device struct { + // Device type, block, char, etc. + Type rune `json:"type"` + + // Path to the device. + Path string `json:"path"` + + // Major is the device's major number. + Major int64 `json:"major"` + + // Minor is the device's minor number. + Minor int64 `json:"minor"` + + // Cgroup permissions format, rwm. + Permissions string `json:"permissions"` + + // FileMode permission bits for the device. + FileMode os.FileMode `json:"file_mode"` + + // Uid of the device. + Uid uint32 `json:"uid"` + + // Gid of the device. + Gid uint32 `json:"gid"` + + // Write the file to the allowed list + Allow bool `json:"allow"` +} + +func (d *Device) CgroupString() string { + return fmt.Sprintf("%c %s:%s %s", d.Type, deviceNumberString(d.Major), deviceNumberString(d.Minor), d.Permissions) +} + +func (d *Device) Mkdev() int { + return int((d.Major << 8) | (d.Minor & 0xff) | ((d.Minor & 0xfff00) << 12)) +} + +// deviceNumberString converts the device number to a string return result. +func deviceNumberString(number int64) string { + if number == Wildcard { + return "*" + } + return fmt.Sprint(number) +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/device_defaults.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/device_defaults.go new file mode 100644 index 000000000..e45299264 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/device_defaults.go @@ -0,0 +1,125 @@ +// +build linux freebsd + +package configs + +var ( + // These are devices that are to be both allowed and created. + DefaultSimpleDevices = []*Device{ + // /dev/null and zero + { + Path: "/dev/null", + Type: 'c', + Major: 1, + Minor: 3, + Permissions: "rwm", + FileMode: 0666, + }, + { + Path: "/dev/zero", + Type: 'c', + Major: 1, + Minor: 5, + Permissions: "rwm", + FileMode: 0666, + }, + + { + Path: "/dev/full", + Type: 'c', + Major: 1, + Minor: 7, + Permissions: "rwm", + FileMode: 0666, + }, + + // consoles and ttys + { + Path: "/dev/tty", + Type: 'c', + Major: 5, + Minor: 0, + Permissions: "rwm", + FileMode: 0666, + }, + + // /dev/urandom,/dev/random + { + Path: "/dev/urandom", + Type: 'c', + Major: 1, + Minor: 9, + Permissions: "rwm", + FileMode: 0666, + }, + { + Path: "/dev/random", + Type: 'c', + Major: 1, + Minor: 8, + Permissions: "rwm", + FileMode: 0666, + }, + } + DefaultAllowedDevices = append([]*Device{ + // allow mknod for any device + { + Type: 'c', + Major: Wildcard, + Minor: Wildcard, + Permissions: "m", + }, + { + Type: 'b', + Major: Wildcard, + Minor: Wildcard, + Permissions: "m", + }, + + { + Path: "/dev/console", + Type: 'c', + Major: 5, + Minor: 1, + Permissions: "rwm", + }, + // /dev/pts/ - pts namespaces are "coming soon" + { + Path: "", + Type: 'c', + Major: 136, + Minor: Wildcard, + Permissions: "rwm", + }, + { + Path: "", + Type: 'c', + Major: 5, + Minor: 2, + Permissions: "rwm", + }, + + // tuntap + { + Path: "", + Type: 'c', + Major: 10, + Minor: 200, + Permissions: "rwm", + }, + }, DefaultSimpleDevices...) + DefaultAutoCreatedDevices = append([]*Device{ + { + // /dev/fuse is created but not allowed. + // This is to allow java to work. Because java + // Insists on there being a /dev/fuse + // https://github.com/docker/docker/issues/514 + // https://github.com/docker/docker/issues/2393 + // + Path: "/dev/fuse", + Type: 'c', + Major: 10, + Minor: 229, + Permissions: "rwm", + }, + }, DefaultSimpleDevices...) +) diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/hugepage_limit.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/hugepage_limit.go new file mode 100644 index 000000000..d30216380 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/hugepage_limit.go @@ -0,0 +1,9 @@ +package configs + +type HugepageLimit struct { + // which type of hugepage to limit. + Pagesize string `json:"page_size"` + + // usage limit for hugepage. + Limit uint64 `json:"limit"` +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/interface_priority_map.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/interface_priority_map.go new file mode 100644 index 000000000..9a0395eaf --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/interface_priority_map.go @@ -0,0 +1,14 @@ +package configs + +import ( + "fmt" +) + +type IfPrioMap struct { + Interface string `json:"interface"` + Priority int64 `json:"priority"` +} + +func (i *IfPrioMap) CgroupString() string { + return fmt.Sprintf("%s %d", i.Interface, i.Priority) +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/mount.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/mount.go new file mode 100644 index 000000000..cc770c916 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/mount.go @@ -0,0 +1,30 @@ +package configs + +type Mount struct { + // Source path for the mount. + Source string `json:"source"` + + // Destination path for the mount inside the container. + Destination string `json:"destination"` + + // Device the mount is for. + Device string `json:"device"` + + // Mount flags. + Flags int `json:"flags"` + + // Propagation Flags + PropagationFlags []int `json:"propagation_flags"` + + // Mount data applied to the mount. + Data string `json:"data"` + + // Relabel source if set, "z" indicates shared, "Z" indicates unshared. + Relabel string `json:"relabel"` + + // Optional Command to be run before Source is mounted. + PremountCmds []Command `json:"premount_cmds"` + + // Optional Command to be run after Source is mounted. + PostmountCmds []Command `json:"postmount_cmds"` +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces.go new file mode 100644 index 000000000..a3329a31a --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces.go @@ -0,0 +1,5 @@ +package configs + +type NamespaceType string + +type Namespaces []Namespace diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall.go new file mode 100644 index 000000000..c962999ef --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall.go @@ -0,0 +1,31 @@ +// +build linux + +package configs + +import "syscall" + +func (n *Namespace) Syscall() int { + return namespaceInfo[n.Type] +} + +var namespaceInfo = map[NamespaceType]int{ + NEWNET: syscall.CLONE_NEWNET, + NEWNS: syscall.CLONE_NEWNS, + NEWUSER: syscall.CLONE_NEWUSER, + NEWIPC: syscall.CLONE_NEWIPC, + NEWUTS: syscall.CLONE_NEWUTS, + NEWPID: syscall.CLONE_NEWPID, +} + +// CloneFlags parses the container's Namespaces options to set the correct +// flags on clone, unshare. This functions returns flags only for new namespaces. +func (n *Namespaces) CloneFlags() uintptr { + var flag int + for _, v := range *n { + if v.Path != "" { + continue + } + flag |= namespaceInfo[v.Type] + } + return uintptr(flag) +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall_unsupported.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall_unsupported.go new file mode 100644 index 000000000..1644588dc --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall_unsupported.go @@ -0,0 +1,15 @@ +// +build !linux,!windows + +package configs + +func (n *Namespace) Syscall() int { + panic("No namespace syscall support") + return 0 +} + +// CloneFlags parses the container's Namespaces options to set the correct +// flags on clone, unshare. This functions returns flags only for new namespaces. +func (n *Namespaces) CloneFlags() uintptr { + panic("No namespace syscall support") + return uintptr(0) +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_unix.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_unix.go new file mode 100644 index 000000000..7bc908546 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_unix.go @@ -0,0 +1,89 @@ +// +build linux freebsd + +package configs + +import "fmt" + +const ( + NEWNET NamespaceType = "NEWNET" + NEWPID NamespaceType = "NEWPID" + NEWNS NamespaceType = "NEWNS" + NEWUTS NamespaceType = "NEWUTS" + NEWIPC NamespaceType = "NEWIPC" + NEWUSER NamespaceType = "NEWUSER" +) + +func NamespaceTypes() []NamespaceType { + return []NamespaceType{ + NEWNET, + NEWPID, + NEWNS, + NEWUTS, + NEWIPC, + NEWUSER, + } +} + +// Namespace defines configuration for each namespace. It specifies an +// alternate path that is able to be joined via setns. +type Namespace struct { + Type NamespaceType `json:"type"` + Path string `json:"path"` +} + +func (n *Namespace) GetPath(pid int) string { + if n.Path != "" { + return n.Path + } + return fmt.Sprintf("/proc/%d/ns/%s", pid, n.file()) +} + +func (n *Namespace) file() string { + file := "" + switch n.Type { + case NEWNET: + file = "net" + case NEWNS: + file = "mnt" + case NEWPID: + file = "pid" + case NEWIPC: + file = "ipc" + case NEWUSER: + file = "user" + case NEWUTS: + file = "uts" + } + return file +} + +func (n *Namespaces) Remove(t NamespaceType) bool { + i := n.index(t) + if i == -1 { + return false + } + *n = append((*n)[:i], (*n)[i+1:]...) + return true +} + +func (n *Namespaces) Add(t NamespaceType, path string) { + i := n.index(t) + if i == -1 { + *n = append(*n, Namespace{Type: t, Path: path}) + return + } + (*n)[i].Path = path +} + +func (n *Namespaces) index(t NamespaceType) int { + for i, ns := range *n { + if ns.Type == t { + return i + } + } + return -1 +} + +func (n *Namespaces) Contains(t NamespaceType) bool { + return n.index(t) != -1 +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_unsupported.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_unsupported.go new file mode 100644 index 000000000..9a74033ce --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/namespaces_unsupported.go @@ -0,0 +1,8 @@ +// +build !linux,!freebsd + +package configs + +// Namespace defines configuration for each namespace. It specifies an +// alternate path that is able to be joined via setns. +type Namespace struct { +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/network.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/network.go new file mode 100644 index 000000000..ccdb228e1 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/network.go @@ -0,0 +1,72 @@ +package configs + +// Network defines configuration for a container's networking stack +// +// The network configuration can be omitted from a container causing the +// container to be setup with the host's networking stack +type Network struct { + // Type sets the networks type, commonly veth and loopback + Type string `json:"type"` + + // Name of the network interface + Name string `json:"name"` + + // The bridge to use. + Bridge string `json:"bridge"` + + // MacAddress contains the MAC address to set on the network interface + MacAddress string `json:"mac_address"` + + // Address contains the IPv4 and mask to set on the network interface + Address string `json:"address"` + + // Gateway sets the gateway address that is used as the default for the interface + Gateway string `json:"gateway"` + + // IPv6Address contains the IPv6 and mask to set on the network interface + IPv6Address string `json:"ipv6_address"` + + // IPv6Gateway sets the ipv6 gateway address that is used as the default for the interface + IPv6Gateway string `json:"ipv6_gateway"` + + // Mtu sets the mtu value for the interface and will be mirrored on both the host and + // container's interfaces if a pair is created, specifically in the case of type veth + // Note: This does not apply to loopback interfaces. + Mtu int `json:"mtu"` + + // TxQueueLen sets the tx_queuelen value for the interface and will be mirrored on both the host and + // container's interfaces if a pair is created, specifically in the case of type veth + // Note: This does not apply to loopback interfaces. + TxQueueLen int `json:"txqueuelen"` + + // HostInterfaceName is a unique name of a veth pair that resides on in the host interface of the + // container. + HostInterfaceName string `json:"host_interface_name"` + + // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface + // bridge port in the case of type veth + // Note: This is unsupported on some systems. + // Note: This does not apply to loopback interfaces. + HairpinMode bool `json:"hairpin_mode"` +} + +// Routes can be specified to create entries in the route table as the container is started +// +// All of destination, source, and gateway should be either IPv4 or IPv6. +// One of the three options must be present, and omitted entries will use their +// IP family default for the route table. For IPv4 for example, setting the +// gateway to 1.2.3.4 and the interface to eth0 will set up a standard +// destination of 0.0.0.0(or *) when viewed in the route table. +type Route struct { + // Sets the destination and mask, should be a CIDR. Accepts IPv4 and IPv6 + Destination string `json:"destination"` + + // Sets the source and mask, should be a CIDR. Accepts IPv4 and IPv6 + Source string `json:"source"` + + // Sets the gateway. Accepts IPv4 and IPv6 + Gateway string `json:"gateway"` + + // The device to set this route up for, for example: eth0 + InterfaceName string `json:"interface_name"` +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/configs/validate/config.go b/vendor/github.com/opencontainers/runc/libcontainer/configs/validate/config.go new file mode 100644 index 000000000..848a67c34 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/configs/validate/config.go @@ -0,0 +1,93 @@ +package validate + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/opencontainers/runc/libcontainer/configs" +) + +type Validator interface { + Validate(*configs.Config) error +} + +func New() Validator { + return &ConfigValidator{} +} + +type ConfigValidator struct { +} + +func (v *ConfigValidator) Validate(config *configs.Config) error { + if err := v.rootfs(config); err != nil { + return err + } + if err := v.network(config); err != nil { + return err + } + if err := v.hostname(config); err != nil { + return err + } + if err := v.security(config); err != nil { + return err + } + if err := v.usernamespace(config); err != nil { + return err + } + return nil +} + +// rootfs validates the the rootfs is an absolute path and is not a symlink +// to the container's root filesystem. +func (v *ConfigValidator) rootfs(config *configs.Config) error { + cleaned, err := filepath.Abs(config.Rootfs) + if err != nil { + return err + } + if cleaned, err = filepath.EvalSymlinks(cleaned); err != nil { + return err + } + if config.Rootfs != cleaned { + return fmt.Errorf("%s is not an absolute path or is a symlink", config.Rootfs) + } + return nil +} + +func (v *ConfigValidator) network(config *configs.Config) error { + if !config.Namespaces.Contains(configs.NEWNET) { + if len(config.Networks) > 0 || len(config.Routes) > 0 { + return fmt.Errorf("unable to apply network settings without a private NET namespace") + } + } + return nil +} + +func (v *ConfigValidator) hostname(config *configs.Config) error { + if config.Hostname != "" && !config.Namespaces.Contains(configs.NEWUTS) { + return fmt.Errorf("unable to set hostname without a private UTS namespace") + } + return nil +} + +func (v *ConfigValidator) security(config *configs.Config) error { + // restrict sys without mount namespace + if (len(config.MaskPaths) > 0 || len(config.ReadonlyPaths) > 0) && + !config.Namespaces.Contains(configs.NEWNS) { + return fmt.Errorf("unable to restrict sys entries without a private MNT namespace") + } + return nil +} + +func (v *ConfigValidator) usernamespace(config *configs.Config) error { + if config.Namespaces.Contains(configs.NEWUSER) { + if _, err := os.Stat("/proc/self/ns/user"); os.IsNotExist(err) { + return fmt.Errorf("USER namespaces aren't enabled in the kernel") + } + } else { + if config.UidMappings != nil || config.GidMappings != nil { + return fmt.Errorf("User namespace mappings specified, but USER namespace isn't enabled in the config") + } + } + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go b/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go new file mode 100644 index 000000000..6c835e68e --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go @@ -0,0 +1,114 @@ +// +build linux + +package system + +import ( + "bufio" + "fmt" + "os" + "os/exec" + "syscall" + "unsafe" +) + +type ParentDeathSignal int + +func (p ParentDeathSignal) Restore() error { + if p == 0 { + return nil + } + current, err := GetParentDeathSignal() + if err != nil { + return err + } + if p == current { + return nil + } + return p.Set() +} + +func (p ParentDeathSignal) Set() error { + return SetParentDeathSignal(uintptr(p)) +} + +func Execv(cmd string, args []string, env []string) error { + name, err := exec.LookPath(cmd) + if err != nil { + return err + } + + return syscall.Exec(name, args, env) +} + +func SetParentDeathSignal(sig uintptr) error { + if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_PDEATHSIG, sig, 0); err != 0 { + return err + } + return nil +} + +func GetParentDeathSignal() (ParentDeathSignal, error) { + var sig int + _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_GET_PDEATHSIG, uintptr(unsafe.Pointer(&sig)), 0) + if err != 0 { + return -1, err + } + return ParentDeathSignal(sig), nil +} + +func SetKeepCaps() error { + if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_KEEPCAPS, 1, 0); err != 0 { + return err + } + + return nil +} + +func ClearKeepCaps() error { + if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_KEEPCAPS, 0, 0); err != 0 { + return err + } + + return nil +} + +func Setctty() error { + if _, _, err := syscall.RawSyscall(syscall.SYS_IOCTL, 0, uintptr(syscall.TIOCSCTTY), 0); err != 0 { + return err + } + return nil +} + +/* + * Detect whether we are currently running in a user namespace. + * Copied from github.com/lxc/lxd/shared/util.go + */ +func RunningInUserNS() bool { + file, err := os.Open("/proc/self/uid_map") + if err != nil { + /* + * This kernel-provided file only exists if user namespaces are + * supported + */ + return false + } + defer file.Close() + + buf := bufio.NewReader(file) + l, _, err := buf.ReadLine() + if err != nil { + return false + } + + line := string(l) + var a, b, c int64 + fmt.Sscanf(line, "%d %d %d", &a, &b, &c) + /* + * We assume we are in the initial user namespace if we have a full + * range - 4294967295 uids starting at uid 0. + */ + if a == 0 && b == 0 && c == 4294967295 { + return false + } + return true +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/proc.go b/vendor/github.com/opencontainers/runc/libcontainer/system/proc.go new file mode 100644 index 000000000..37808a29f --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/system/proc.go @@ -0,0 +1,27 @@ +package system + +import ( + "io/ioutil" + "path/filepath" + "strconv" + "strings" +) + +// look in /proc to find the process start time so that we can verify +// that this pid has started after ourself +func GetProcessStartTime(pid int) (string, error) { + data, err := ioutil.ReadFile(filepath.Join("/proc", strconv.Itoa(pid), "stat")) + if err != nil { + return "", err + } + + parts := strings.Split(string(data), " ") + // the starttime is located at pos 22 + // from the man page + // + // starttime %llu (was %lu before Linux 2.6) + // (22) The time the process started after system boot. In kernels before Linux 2.6, this + // value was expressed in jiffies. Since Linux 2.6, the value is expressed in clock ticks + // (divide by sysconf(_SC_CLK_TCK)). + return parts[22-1], nil // starts at 1 +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/setns_linux.go b/vendor/github.com/opencontainers/runc/libcontainer/system/setns_linux.go new file mode 100644 index 000000000..615ff4c82 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/system/setns_linux.go @@ -0,0 +1,40 @@ +package system + +import ( + "fmt" + "runtime" + "syscall" +) + +// Via http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7b21fddd087678a70ad64afc0f632e0f1071b092 +// +// We need different setns values for the different platforms and arch +// We are declaring the macro here because the SETNS syscall does not exist in th stdlib +var setNsMap = map[string]uintptr{ + "linux/386": 346, + "linux/arm64": 268, + "linux/amd64": 308, + "linux/arm": 375, + "linux/ppc": 350, + "linux/ppc64": 350, + "linux/ppc64le": 350, + "linux/s390x": 339, +} + +var sysSetns = setNsMap[fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)] + +func SysSetns() uint32 { + return uint32(sysSetns) +} + +func Setns(fd uintptr, flags uintptr) error { + ns, exists := setNsMap[fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)] + if !exists { + return fmt.Errorf("unsupported platform %s/%s", runtime.GOOS, runtime.GOARCH) + } + _, _, err := syscall.RawSyscall(ns, fd, flags, 0) + if err != 0 { + return err + } + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go new file mode 100644 index 000000000..c99006518 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go @@ -0,0 +1,25 @@ +// +build linux,386 + +package system + +import ( + "syscall" +) + +// Setuid sets the uid of the calling thread to the specified uid. +func Setuid(uid int) (err error) { + _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID, uintptr(uid), 0, 0) + if e1 != 0 { + err = e1 + } + return +} + +// Setgid sets the gid of the calling thread to the specified gid. +func Setgid(gid int) (err error) { + _, _, e1 := syscall.RawSyscall(syscall.SYS_SETGID32, uintptr(gid), 0, 0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go new file mode 100644 index 000000000..0816bf828 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go @@ -0,0 +1,25 @@ +// +build linux,arm64 linux,amd64 linux,ppc linux,ppc64 linux,ppc64le linux,s390x + +package system + +import ( + "syscall" +) + +// Setuid sets the uid of the calling thread to the specified uid. +func Setuid(uid int) (err error) { + _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID, uintptr(uid), 0, 0) + if e1 != 0 { + err = e1 + } + return +} + +// Setgid sets the gid of the calling thread to the specified gid. +func Setgid(gid int) (err error) { + _, _, e1 := syscall.RawSyscall(syscall.SYS_SETGID, uintptr(gid), 0, 0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_arm.go b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_arm.go new file mode 100644 index 000000000..3f780f312 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_arm.go @@ -0,0 +1,25 @@ +// +build linux,arm + +package system + +import ( + "syscall" +) + +// Setuid sets the uid of the calling thread to the specified uid. +func Setuid(uid int) (err error) { + _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID32, uintptr(uid), 0, 0) + if e1 != 0 { + err = e1 + } + return +} + +// Setgid sets the gid of the calling thread to the specified gid. +func Setgid(gid int) (err error) { + _, _, e1 := syscall.RawSyscall(syscall.SYS_SETGID32, uintptr(gid), 0, 0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go b/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go new file mode 100644 index 000000000..b3a07cba3 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go @@ -0,0 +1,12 @@ +// +build cgo,linux cgo,freebsd + +package system + +/* +#include +*/ +import "C" + +func GetClockTicks() int { + return int(C.sysconf(C._SC_CLK_TCK)) +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go b/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go new file mode 100644 index 000000000..d93b5d5fd --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go @@ -0,0 +1,15 @@ +// +build !cgo windows + +package system + +func GetClockTicks() int { + // TODO figure out a better alternative for platforms where we're missing cgo + // + // TODO Windows. This could be implemented using Win32 QueryPerformanceFrequency(). + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx + // + // An example of its usage can be found here. + // https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx + + return 100 +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go b/vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go new file mode 100644 index 000000000..30f74dfb1 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go @@ -0,0 +1,99 @@ +package system + +import ( + "syscall" + "unsafe" +) + +var _zero uintptr + +// Returns the size of xattrs and nil error +// Requires path, takes allocated []byte or nil as last argument +func Llistxattr(path string, dest []byte) (size int, err error) { + pathBytes, err := syscall.BytePtrFromString(path) + if err != nil { + return -1, err + } + var newpathBytes unsafe.Pointer + if len(dest) > 0 { + newpathBytes = unsafe.Pointer(&dest[0]) + } else { + newpathBytes = unsafe.Pointer(&_zero) + } + + _size, _, errno := syscall.Syscall6(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(newpathBytes), uintptr(len(dest)), 0, 0, 0) + size = int(_size) + if errno != 0 { + return -1, errno + } + + return size, nil +} + +// Returns a []byte slice if the xattr is set and nil otherwise +// Requires path and its attribute as arguments +func Lgetxattr(path string, attr string) ([]byte, error) { + var sz int + pathBytes, err := syscall.BytePtrFromString(path) + if err != nil { + return nil, err + } + attrBytes, err := syscall.BytePtrFromString(attr) + if err != nil { + return nil, err + } + + // Start with a 128 length byte array + sz = 128 + dest := make([]byte, sz) + destBytes := unsafe.Pointer(&dest[0]) + _sz, _, errno := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(attrBytes)), uintptr(destBytes), uintptr(len(dest)), 0, 0) + + switch { + case errno == syscall.ENODATA: + return nil, errno + case errno == syscall.ENOTSUP: + return nil, errno + case errno == syscall.ERANGE: + // 128 byte array might just not be good enough, + // A dummy buffer is used ``uintptr(0)`` to get real size + // of the xattrs on disk + _sz, _, errno = syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(attrBytes)), uintptr(unsafe.Pointer(nil)), uintptr(0), 0, 0) + sz = int(_sz) + if sz < 0 { + return nil, errno + } + dest = make([]byte, sz) + destBytes := unsafe.Pointer(&dest[0]) + _sz, _, errno = syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(attrBytes)), uintptr(destBytes), uintptr(len(dest)), 0, 0) + if errno != 0 { + return nil, errno + } + case errno != 0: + return nil, errno + } + sz = int(_sz) + return dest[:sz], nil +} + +func Lsetxattr(path string, attr string, data []byte, flags int) error { + pathBytes, err := syscall.BytePtrFromString(path) + if err != nil { + return err + } + attrBytes, err := syscall.BytePtrFromString(attr) + if err != nil { + return err + } + var dataBytes unsafe.Pointer + if len(data) > 0 { + dataBytes = unsafe.Pointer(&data[0]) + } else { + dataBytes = unsafe.Pointer(&_zero) + } + _, _, errno := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(attrBytes)), uintptr(dataBytes), uintptr(len(data)), uintptr(flags), 0) + if errno != 0 { + return errno + } + return nil +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go new file mode 100644 index 000000000..1f5528ff3 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go @@ -0,0 +1,81 @@ +package utils + +import ( + "crypto/rand" + "encoding/hex" + "encoding/json" + "io" + "os" + "path/filepath" + "syscall" +) + +const ( + exitSignalOffset = 128 +) + +// GenerateRandomName returns a new name joined with a prefix. This size +// specified is used to truncate the randomly generated value +func GenerateRandomName(prefix string, size int) (string, error) { + id := make([]byte, 32) + if _, err := io.ReadFull(rand.Reader, id); err != nil { + return "", err + } + if size > 64 { + size = 64 + } + return prefix + hex.EncodeToString(id)[:size], nil +} + +// ResolveRootfs ensures that the current working directory is +// not a symlink and returns the absolute path to the rootfs +func ResolveRootfs(uncleanRootfs string) (string, error) { + rootfs, err := filepath.Abs(uncleanRootfs) + if err != nil { + return "", err + } + return filepath.EvalSymlinks(rootfs) +} + +// ExitStatus returns the correct exit status for a process based on if it +// was signaled or exited cleanly +func ExitStatus(status syscall.WaitStatus) int { + if status.Signaled() { + return exitSignalOffset + int(status.Signal()) + } + return status.ExitStatus() +} + +// WriteJSON writes the provided struct v to w using standard json marshaling +func WriteJSON(w io.Writer, v interface{}) error { + data, err := json.Marshal(v) + if err != nil { + return err + } + _, err = w.Write(data) + return err +} + +// CleanPath makes a path safe for use with filepath.Join. This is done by not +// only cleaning the path, but also (if the path is relative) adding a leading +// '/' and cleaning it (then removing the leading '/'). This ensures that a +// path resulting from prepending another path will always resolve to lexically +// be a subdirectory of the prefixed path. This is all done lexically, so paths +// that include symlinks won't be safe as a result of using CleanPath. +func CleanPath(path string) string { + // Ensure that all paths are cleaned (especially problematic ones like + // "/../../../../../" which can cause lots of issues). + path = filepath.Clean(path) + + // If the path isn't absolute, we need to do more processing to fix paths + // such as "../../../..//some/path". We also shouldn't convert absolute + // paths to relative ones. + if !filepath.IsAbs(path) { + path = filepath.Clean(string(os.PathSeparator) + path) + // This can't fail, as (by definition) all paths are relative to root. + path, _ = filepath.Rel(string(os.PathSeparator), path) + } + + // Clean the path again for good measure. + return filepath.Clean(path) +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/utils/utils_test.go b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils_test.go new file mode 100644 index 000000000..813180a8a --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils_test.go @@ -0,0 +1,25 @@ +package utils + +import "testing" + +func TestGenerateName(t *testing.T) { + name, err := GenerateRandomName("veth", 5) + if err != nil { + t.Fatal(err) + } + + expected := 5 + len("veth") + if len(name) != expected { + t.Fatalf("expected name to be %d chars but received %d", expected, len(name)) + } + + name, err = GenerateRandomName("veth", 65) + if err != nil { + t.Fatal(err) + } + + expected = 64 + len("veth") + if len(name) != expected { + t.Fatalf("expected name to be %d chars but received %d", expected, len(name)) + } +} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/utils/utils_unix.go b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils_unix.go new file mode 100644 index 000000000..408918f27 --- /dev/null +++ b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils_unix.go @@ -0,0 +1,33 @@ +// +build !windows + +package utils + +import ( + "io/ioutil" + "strconv" + "syscall" +) + +func CloseExecFrom(minFd int) error { + fdList, err := ioutil.ReadDir("/proc/self/fd") + if err != nil { + return err + } + for _, fi := range fdList { + fd, err := strconv.Atoi(fi.Name()) + if err != nil { + // ignore non-numeric file names + continue + } + + if fd < minFd { + // ignore descriptors lower than our specified minimum + continue + } + + // intentionally ignore errors from syscall.CloseOnExec + syscall.CloseOnExec(fd) + // the cases where this might fail are basically file descriptors that have already been closed (including and especially the one that was created when ioutil.ReadDir did the "opendir" syscall) + } + return nil +} diff --git a/vendor/github.com/ugorji/go/codec/0doc.go b/vendor/github.com/ugorji/go/codec/0doc.go index dd8b589de..bd7361c87 100644 --- a/vendor/github.com/ugorji/go/codec/0doc.go +++ b/vendor/github.com/ugorji/go/codec/0doc.go @@ -64,6 +64,7 @@ Rich Feature Set includes: - Never silently skip data when decoding. User decides whether to return an error or silently skip data when keys or indexes in the data stream do not map to fields in the struct. + - Detect and error when encoding a cyclic reference (instead of stack overflow shutdown) - Encode/Decode from/to chan types (for iterative streaming support) - Drop-in replacement for encoding/json. `json:` key in struct tag supported. - Provides a RPC Server and Client Codec for net/rpc communication protocol. @@ -98,7 +99,21 @@ with the standard net/rpc package. Usage -Typical usage model: +The Handle is SAFE for concurrent READ, but NOT SAFE for concurrent modification. + +The Encoder and Decoder are NOT safe for concurrent use. + +Consequently, the usage model is basically: + + - Create and initialize the Handle before any use. + Once created, DO NOT modify it. + - Multiple Encoders or Decoders can now use the Handle concurrently. + They only read information off the Handle (never write). + - However, each Encoder or Decoder MUST not be used concurrently + - To re-use an Encoder/Decoder, call Reset(...) on it first. + This allows you use state maintained on the Encoder/Decoder. + +Sample usage model: // create and configure Handle var ( @@ -148,3 +163,37 @@ Typical usage model: */ package codec +// Benefits of go-codec: +// +// - encoding/json always reads whole file into memory first. +// This makes it unsuitable for parsing very large files. +// - encoding/xml cannot parse into a map[string]interface{} +// I found this out on reading https://github.com/clbanning/mxj + +// TODO: +// +// - optimization for codecgen: +// if len of entity is <= 3 words, then support a value receiver for encode. +// - (En|De)coder should store an error when it occurs. +// Until reset, subsequent calls return that error that was stored. +// This means that free panics must go away. +// All errors must be raised through errorf method. +// - Decoding using a chan is good, but incurs concurrency costs. +// This is because there's no fast way to use a channel without it +// having to switch goroutines constantly. +// Callback pattern is still the best. Maybe cnsider supporting something like: +// type X struct { +// Name string +// Ys []Y +// Ys chan <- Y +// Ys func(Y) -> call this function for each entry +// } +// - Consider adding a isZeroer interface { isZero() bool } +// It is used within isEmpty, for omitEmpty support. +// - Consider making Handle used AS-IS within the encoding/decoding session. +// This means that we don't cache Handle information within the (En|De)coder, +// except we really need it at Reset(...) +// - Consider adding math/big support +// - Consider reducing the size of the generated functions: +// Maybe use one loop, and put the conditionals in the loop. +// for ... { if cLen > 0 { if j == cLen { break } } else if dd.CheckBreak() { break } } diff --git a/vendor/github.com/ugorji/go/codec/binc.go b/vendor/github.com/ugorji/go/codec/binc.go index 645376479..766d26cf6 100644 --- a/vendor/github.com/ugorji/go/codec/binc.go +++ b/vendor/github.com/ugorji/go/codec/binc.go @@ -59,8 +59,8 @@ type bincEncDriver struct { e *Encoder w encWriter m map[string]uint16 // symbols - s uint16 // symbols sequencer b [scratchByteArrayLen]byte + s uint16 // symbols sequencer encNoSeparator } @@ -318,9 +318,9 @@ func (e *bincEncDriver) encLenNumber(bd byte, v uint64) { //------------------------------------ type bincDecSymbol struct { - i uint16 s string b []byte + i uint16 } type bincDecDriver struct { @@ -329,7 +329,6 @@ type bincDecDriver struct { r decReader br bool // bytes reader bdRead bool - bdType valueType bd byte vd byte vs byte @@ -347,24 +346,23 @@ func (d *bincDecDriver) readNextBd() { d.vd = d.bd >> 4 d.vs = d.bd & 0x0f d.bdRead = true - d.bdType = valueTypeUnset } -func (d *bincDecDriver) IsContainerType(vt valueType) (b bool) { - switch vt { - case valueTypeNil: - return d.vd == bincVdSpecial && d.vs == bincSpNil - case valueTypeBytes: - return d.vd == bincVdByteArray - case valueTypeString: - return d.vd == bincVdString - case valueTypeArray: - return d.vd == bincVdArray - case valueTypeMap: - return d.vd == bincVdMap +func (d *bincDecDriver) ContainerType() (vt valueType) { + if d.vd == bincVdSpecial && d.vs == bincSpNil { + return valueTypeNil + } else if d.vd == bincVdByteArray { + return valueTypeBytes + } else if d.vd == bincVdString { + return valueTypeString + } else if d.vd == bincVdArray { + return valueTypeArray + } else if d.vd == bincVdMap { + return valueTypeMap + } else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } - d.d.errorf("isContainerType: unsupported parameter: %v", vt) - return // "unreachable" + return valueTypeUnset } func (d *bincDecDriver) TryDecodeAsNil() bool { @@ -695,7 +693,7 @@ func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool) if withString { s = string(bs2) } - d.s = append(d.s, bincDecSymbol{symbol, s, bs2}) + d.s = append(d.s, bincDecSymbol{i: symbol, s: s, b: bs2}) } default: d.d.errorf("Invalid d.vd. Expecting string:0x%x, bytearray:0x%x or symbol: 0x%x. Got: 0x%x", @@ -784,97 +782,95 @@ func (d *bincDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []b return } -func (d *bincDecDriver) DecodeNaked() (v interface{}, vt valueType, decodeFurther bool) { +func (d *bincDecDriver) DecodeNaked() { if !d.bdRead { d.readNextBd() } + n := &d.d.n + var decodeFurther bool + switch d.vd { case bincVdSpecial: switch d.vs { case bincSpNil: - vt = valueTypeNil + n.v = valueTypeNil case bincSpFalse: - vt = valueTypeBool - v = false + n.v = valueTypeBool + n.b = false case bincSpTrue: - vt = valueTypeBool - v = true + n.v = valueTypeBool + n.b = true case bincSpNan: - vt = valueTypeFloat - v = math.NaN() + n.v = valueTypeFloat + n.f = math.NaN() case bincSpPosInf: - vt = valueTypeFloat - v = math.Inf(1) + n.v = valueTypeFloat + n.f = math.Inf(1) case bincSpNegInf: - vt = valueTypeFloat - v = math.Inf(-1) + n.v = valueTypeFloat + n.f = math.Inf(-1) case bincSpZeroFloat: - vt = valueTypeFloat - v = float64(0) + n.v = valueTypeFloat + n.f = float64(0) case bincSpZero: - vt = valueTypeUint - v = uint64(0) // int8(0) + n.v = valueTypeUint + n.u = uint64(0) // int8(0) case bincSpNegOne: - vt = valueTypeInt - v = int64(-1) // int8(-1) + n.v = valueTypeInt + n.i = int64(-1) // int8(-1) default: d.d.errorf("decodeNaked: Unrecognized special value 0x%x", d.vs) - return } case bincVdSmallInt: - vt = valueTypeUint - v = uint64(int8(d.vs)) + 1 // int8(d.vs) + 1 + n.v = valueTypeUint + n.u = uint64(int8(d.vs)) + 1 // int8(d.vs) + 1 case bincVdPosInt: - vt = valueTypeUint - v = d.decUint() + n.v = valueTypeUint + n.u = d.decUint() case bincVdNegInt: - vt = valueTypeInt - v = -(int64(d.decUint())) + n.v = valueTypeInt + n.i = -(int64(d.decUint())) case bincVdFloat: - vt = valueTypeFloat - v = d.decFloat() + n.v = valueTypeFloat + n.f = d.decFloat() case bincVdSymbol: - vt = valueTypeSymbol - v = d.DecodeString() + n.v = valueTypeSymbol + n.s = d.DecodeString() case bincVdString: - vt = valueTypeString - v = d.DecodeString() + n.v = valueTypeString + n.s = d.DecodeString() case bincVdByteArray: - vt = valueTypeBytes - v = d.DecodeBytes(nil, false, false) + n.v = valueTypeBytes + n.l = d.DecodeBytes(nil, false, false) case bincVdTimestamp: - vt = valueTypeTimestamp + n.v = valueTypeTimestamp tt, err := decodeTime(d.r.readx(int(d.vs))) if err != nil { panic(err) } - v = tt + n.t = tt case bincVdCustomExt: - vt = valueTypeExt + n.v = valueTypeExt l := d.decLen() - var re RawExt - re.Tag = uint64(d.r.readn1()) - re.Data = d.r.readx(l) - v = &re - vt = valueTypeExt + n.u = uint64(d.r.readn1()) + n.l = d.r.readx(l) case bincVdArray: - vt = valueTypeArray + n.v = valueTypeArray decodeFurther = true case bincVdMap: - vt = valueTypeMap + n.v = valueTypeMap decodeFurther = true default: d.d.errorf("decodeNaked: Unrecognized d.vd: 0x%x", d.vd) - return } if !decodeFurther { d.bdRead = false } - if vt == valueTypeUint && d.h.SignedInteger { - d.bdType = valueTypeInt - v = int64(v.(uint64)) + if n.v == valueTypeUint && d.h.SignedInteger { + n.v = valueTypeInt + n.i = int64(n.u) } return } @@ -898,6 +894,10 @@ type BincHandle struct { binaryEncodingType } +func (h *BincHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { + return h.SetExt(rt, tag, &setExtWrapper{b: ext}) +} + func (h *BincHandle) newEncDriver(e *Encoder) encDriver { return &bincEncDriver{e: e, w: e.w} } @@ -906,8 +906,16 @@ func (h *BincHandle) newDecDriver(d *Decoder) decDriver { return &bincDecDriver{d: d, r: d.r, h: h, br: d.bytes} } -func (h *BincHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { - return h.SetExt(rt, tag, &setExtWrapper{b: ext}) +func (e *bincEncDriver) reset() { + e.w = e.e.w + e.s = 0 + e.m = nil +} + +func (d *bincDecDriver) reset() { + d.r = d.d.r + d.s = nil + d.bd, d.bdRead, d.vd, d.vs = 0, false, 0, 0 } var _ decDriver = (*bincDecDriver)(nil) diff --git a/vendor/github.com/ugorji/go/codec/cbor.go b/vendor/github.com/ugorji/go/codec/cbor.go index 8b6e13a89..a224cd3a7 100644 --- a/vendor/github.com/ugorji/go/codec/cbor.go +++ b/vendor/github.com/ugorji/go/codec/cbor.go @@ -60,11 +60,11 @@ const ( // ------------------- type cborEncDriver struct { + noBuiltInTypes + encNoSeparator e *Encoder w encWriter h *CborHandle - noBuiltInTypes - encNoSeparator x [8]byte } @@ -175,11 +175,10 @@ type cborDecDriver struct { d *Decoder h *CborHandle r decReader + b [scratchByteArrayLen]byte br bool // bytes reader bdRead bool - bdType valueType bd byte - b [scratchByteArrayLen]byte noBuiltInTypes decNoSeparator } @@ -187,24 +186,23 @@ type cborDecDriver struct { func (d *cborDecDriver) readNextBd() { d.bd = d.r.readn1() d.bdRead = true - d.bdType = valueTypeUnset } -func (d *cborDecDriver) IsContainerType(vt valueType) (bv bool) { - switch vt { - case valueTypeNil: - return d.bd == cborBdNil - case valueTypeBytes: - return d.bd == cborBdIndefiniteBytes || (d.bd >= cborBaseBytes && d.bd < cborBaseString) - case valueTypeString: - return d.bd == cborBdIndefiniteString || (d.bd >= cborBaseString && d.bd < cborBaseArray) - case valueTypeArray: - return d.bd == cborBdIndefiniteArray || (d.bd >= cborBaseArray && d.bd < cborBaseMap) - case valueTypeMap: - return d.bd == cborBdIndefiniteMap || (d.bd >= cborBaseMap && d.bd < cborBaseTag) +func (d *cborDecDriver) ContainerType() (vt valueType) { + if d.bd == cborBdNil { + return valueTypeNil + } else if d.bd == cborBdIndefiniteBytes || (d.bd >= cborBaseBytes && d.bd < cborBaseString) { + return valueTypeBytes + } else if d.bd == cborBdIndefiniteString || (d.bd >= cborBaseString && d.bd < cborBaseArray) { + return valueTypeString + } else if d.bd == cborBdIndefiniteArray || (d.bd >= cborBaseArray && d.bd < cborBaseMap) { + return valueTypeArray + } else if d.bd == cborBdIndefiniteMap || (d.bd >= cborBaseMap && d.bd < cborBaseTag) { + return valueTypeMap + } else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } - d.d.errorf("isContainerType: unsupported parameter: %v", vt) - return // "unreachable" + return valueTypeUnset } func (d *cborDecDriver) TryDecodeAsNil() bool { @@ -446,71 +444,72 @@ func (d *cborDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxta return } -func (d *cborDecDriver) DecodeNaked() (v interface{}, vt valueType, decodeFurther bool) { +func (d *cborDecDriver) DecodeNaked() { if !d.bdRead { d.readNextBd() } + n := &d.d.n + var decodeFurther bool + switch d.bd { case cborBdNil: - vt = valueTypeNil + n.v = valueTypeNil case cborBdFalse: - vt = valueTypeBool - v = false + n.v = valueTypeBool + n.b = false case cborBdTrue: - vt = valueTypeBool - v = true + n.v = valueTypeBool + n.b = true case cborBdFloat16, cborBdFloat32: - vt = valueTypeFloat - v = d.DecodeFloat(true) + n.v = valueTypeFloat + n.f = d.DecodeFloat(true) case cborBdFloat64: - vt = valueTypeFloat - v = d.DecodeFloat(false) + n.v = valueTypeFloat + n.f = d.DecodeFloat(false) case cborBdIndefiniteBytes: - vt = valueTypeBytes - v = d.DecodeBytes(nil, false, false) + n.v = valueTypeBytes + n.l = d.DecodeBytes(nil, false, false) case cborBdIndefiniteString: - vt = valueTypeString - v = d.DecodeString() + n.v = valueTypeString + n.s = d.DecodeString() case cborBdIndefiniteArray: - vt = valueTypeArray + n.v = valueTypeArray decodeFurther = true case cborBdIndefiniteMap: - vt = valueTypeMap + n.v = valueTypeMap decodeFurther = true default: switch { case d.bd >= cborBaseUint && d.bd < cborBaseNegInt: if d.h.SignedInteger { - vt = valueTypeInt - v = d.DecodeInt(64) + n.v = valueTypeInt + n.i = d.DecodeInt(64) } else { - vt = valueTypeUint - v = d.DecodeUint(64) + n.v = valueTypeUint + n.u = d.DecodeUint(64) } case d.bd >= cborBaseNegInt && d.bd < cborBaseBytes: - vt = valueTypeInt - v = d.DecodeInt(64) + n.v = valueTypeInt + n.i = d.DecodeInt(64) case d.bd >= cborBaseBytes && d.bd < cborBaseString: - vt = valueTypeBytes - v = d.DecodeBytes(nil, false, false) + n.v = valueTypeBytes + n.l = d.DecodeBytes(nil, false, false) case d.bd >= cborBaseString && d.bd < cborBaseArray: - vt = valueTypeString - v = d.DecodeString() + n.v = valueTypeString + n.s = d.DecodeString() case d.bd >= cborBaseArray && d.bd < cborBaseMap: - vt = valueTypeArray + n.v = valueTypeArray decodeFurther = true case d.bd >= cborBaseMap && d.bd < cborBaseTag: - vt = valueTypeMap + n.v = valueTypeMap decodeFurther = true case d.bd >= cborBaseTag && d.bd < cborBaseSimple: - vt = valueTypeExt - var re RawExt - ui := d.decUint() - d.bdRead = false - re.Tag = ui - d.d.decode(&re.Value) - v = &re + n.v = valueTypeExt + n.u = d.decUint() + n.l = nil + // d.bdRead = false + // d.d.decode(&re.Value) // handled by decode itself. // decodeFurther = true default: d.d.errorf("decodeNaked: Unrecognized d.bd: 0x%x", d.bd) @@ -557,8 +556,12 @@ func (d *cborDecDriver) DecodeNaked() (v interface{}, vt valueType, decodeFurthe // // Now, vv contains the same string "one-byte" // type CborHandle struct { - BasicHandle binaryEncodingType + BasicHandle +} + +func (h *CborHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { + return h.SetExt(rt, tag, &setExtWrapper{i: ext}) } func (h *CborHandle) newEncDriver(e *Encoder) encDriver { @@ -569,8 +572,13 @@ func (h *CborHandle) newDecDriver(d *Decoder) decDriver { return &cborDecDriver{d: d, r: d.r, h: h, br: d.bytes} } -func (h *CborHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { - return h.SetExt(rt, tag, &setExtWrapper{i: ext}) +func (e *cborEncDriver) reset() { + e.w = e.e.w +} + +func (d *cborDecDriver) reset() { + d.r = d.d.r + d.bd, d.bdRead = 0, false } var _ decDriver = (*cborDecDriver)(nil) diff --git a/vendor/github.com/ugorji/go/codec/codec_test.go b/vendor/github.com/ugorji/go/codec/codec_test.go index d9583a9b1..33bbed723 100644 --- a/vendor/github.com/ugorji/go/codec/codec_test.go +++ b/vendor/github.com/ugorji/go/codec/codec_test.go @@ -18,8 +18,6 @@ package codec // // The following manual tests must be done: // - TestCodecUnderlyingType -// - Set fastpathEnabled to false and run tests (to ensure that regular reflection works). -// We don't want to use a variable there so that code is ellided. import ( "bytes" @@ -28,6 +26,7 @@ import ( "fmt" "io/ioutil" "math" + "math/rand" "net" "net/rpc" "os" @@ -36,6 +35,7 @@ import ( "reflect" "runtime" "strconv" + "strings" "sync/atomic" "testing" "time" @@ -46,6 +46,11 @@ func init() { testPreInitFns = append(testPreInitFns, testInit) } +// make this a mapbyslice +type testMbsT []interface{} + +func (_ testMbsT) MapBySlice() {} + type testVerifyArg int const ( @@ -58,14 +63,25 @@ const ( const testSkipRPCTests = false +var ( + testTableNumPrimitives int + testTableIdxTime int + testTableNumMaps int +) + var ( testVerbose bool testInitDebug bool testUseIoEncDec bool testStructToArray bool testCanonical bool + testUseReset bool testWriteNoSymbols bool testSkipIntf bool + testInternStr bool + testUseMust bool + testCheckCircRef bool + testJsonIndent int skipVerifyVal interface{} = &(struct{}{}) @@ -97,13 +113,62 @@ func testInitFlags() { flag.BoolVar(&testStructToArray, "ts", false, "Set StructToArray option") flag.BoolVar(&testWriteNoSymbols, "tn", false, "Set NoSymbols option") flag.BoolVar(&testCanonical, "tc", false, "Set Canonical option") + flag.BoolVar(&testInternStr, "te", false, "Set InternStr option") flag.BoolVar(&testSkipIntf, "tf", false, "Skip Interfaces") + flag.BoolVar(&testUseReset, "tr", false, "Use Reset") + flag.IntVar(&testJsonIndent, "td", 0, "Use JSON Indent") + flag.BoolVar(&testUseMust, "tm", true, "Use Must(En|De)code") + flag.BoolVar(&testCheckCircRef, "tl", false, "Use Check Circular Ref") +} + +func testByteBuf(in []byte) *bytes.Buffer { + return bytes.NewBuffer(in) } type TestABC struct { A, B, C string } +func (x *TestABC) MarshalBinary() ([]byte, error) { + return []byte(fmt.Sprintf("%s %s %s", x.A, x.B, x.C)), nil +} +func (x *TestABC) MarshalText() ([]byte, error) { + return []byte(fmt.Sprintf("%s %s %s", x.A, x.B, x.C)), nil +} +func (x *TestABC) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf(`"%s %s %s"`, x.A, x.B, x.C)), nil +} + +func (x *TestABC) UnmarshalBinary(data []byte) (err error) { + ss := strings.Split(string(data), " ") + x.A, x.B, x.C = ss[0], ss[1], ss[2] + return +} +func (x *TestABC) UnmarshalText(data []byte) (err error) { + return x.UnmarshalBinary(data) +} +func (x *TestABC) UnmarshalJSON(data []byte) (err error) { + return x.UnmarshalBinary(data[1 : len(data)-1]) +} + +type TestABC2 struct { + A, B, C string +} + +func (x TestABC2) MarshalText() ([]byte, error) { + return []byte(fmt.Sprintf("%s %s %s", x.A, x.B, x.C)), nil +} +func (x *TestABC2) UnmarshalText(data []byte) (err error) { + ss := strings.Split(string(data), " ") + x.A, x.B, x.C = ss[0], ss[1], ss[2] + return + // _, err = fmt.Sscanf(string(data), "%s %s %s", &x.A, &x.B, &x.C) +} + +type TestRpcABC struct { + A, B, C string +} + type TestRpcInt struct { i int } @@ -111,7 +176,7 @@ type TestRpcInt struct { func (r *TestRpcInt) Update(n int, res *int) error { r.i = n; *res = r.i; return nil } func (r *TestRpcInt) Square(ignore int, res *int) error { *res = r.i * r.i; return nil } func (r *TestRpcInt) Mult(n int, res *int) error { *res = r.i * n; return nil } -func (r *TestRpcInt) EchoStruct(arg TestABC, res *string) error { +func (r *TestRpcInt) EchoStruct(arg TestRpcABC, res *string) error { *res = fmt.Sprintf("%#v", arg) return nil } @@ -120,28 +185,36 @@ func (r *TestRpcInt) Echo123(args []string, res *string) error { return nil } -type testUnixNanoTimeExt struct{} +type testUnixNanoTimeExt struct { + // keep timestamp here, so that do not incur interface-conversion costs + ts int64 +} -func (x testUnixNanoTimeExt) WriteExt(interface{}) []byte { panic("unsupported") } -func (x testUnixNanoTimeExt) ReadExt(interface{}, []byte) { panic("unsupported") } -func (x testUnixNanoTimeExt) ConvertExt(v interface{}) interface{} { +// func (x *testUnixNanoTimeExt) WriteExt(interface{}) []byte { panic("unsupported") } +// func (x *testUnixNanoTimeExt) ReadExt(interface{}, []byte) { panic("unsupported") } +func (x *testUnixNanoTimeExt) ConvertExt(v interface{}) interface{} { switch v2 := v.(type) { case time.Time: - return v2.UTC().UnixNano() + x.ts = v2.UTC().UnixNano() case *time.Time: - return v2.UTC().UnixNano() + x.ts = v2.UTC().UnixNano() default: panic(fmt.Sprintf("unsupported format for time conversion: expecting time.Time; got %T", v)) } + return &x.ts } -func (x testUnixNanoTimeExt) UpdateExt(dest interface{}, v interface{}) { +func (x *testUnixNanoTimeExt) UpdateExt(dest interface{}, v interface{}) { // fmt.Printf("testUnixNanoTimeExt.UpdateExt: v: %v\n", v) tt := dest.(*time.Time) switch v2 := v.(type) { case int64: *tt = time.Unix(0, v2).UTC() + case *int64: + *tt = time.Unix(0, *v2).UTC() case uint64: *tt = time.Unix(0, int64(v2)).UTC() + case *uint64: + *tt = time.Unix(0, int64(*v2)).UTC() //case float64: //case string: default: @@ -197,6 +270,12 @@ func testVerifyVal(v interface{}, arg testVerifyArg) (v2 interface{}) { m2[j] = testVerifyVal(vj, arg) } v2 = m2 + case testMbsT: + m2 := make([]interface{}, len(iv)) + for j, vj := range iv { + m2[j] = testVerifyVal(vj, arg) + } + v2 = testMbsT(m2) case map[string]bool: switch arg { case testVerifyMapTypeSame: @@ -269,53 +348,36 @@ func testInit() { fmt.Printf("====> depth: %v, ts: %#v\n", 2, ts0) } - testJsonH.Canonical = testCanonical - testCborH.Canonical = testCanonical - testSimpleH.Canonical = testCanonical - testBincH.Canonical = testCanonical - testMsgpackH.Canonical = testCanonical - - testJsonH.StructToArray = testStructToArray - testCborH.StructToArray = testStructToArray - testSimpleH.StructToArray = testStructToArray - testBincH.StructToArray = testStructToArray - testMsgpackH.StructToArray = testStructToArray - - testMsgpackH.RawToString = true - - if testWriteNoSymbols { - testBincH.AsSymbols = AsSymbolNone - } else { - testBincH.AsSymbols = AsSymbolAll + for _, v := range testHandles { + bh := v.getBasicHandle() + bh.InternString = testInternStr + bh.Canonical = testCanonical + bh.CheckCircularRef = testCheckCircRef + bh.StructToArray = testStructToArray + // mostly doing this for binc + if testWriteNoSymbols { + bh.AsSymbols = AsSymbolNone + } else { + bh.AsSymbols = AsSymbolAll + } } + testJsonH.Indent = int8(testJsonIndent) + testMsgpackH.RawToString = true + // testMsgpackH.AddExt(byteSliceTyp, 0, testMsgpackH.BinaryEncodeExt, testMsgpackH.BinaryDecodeExt) // testMsgpackH.AddExt(timeTyp, 1, testMsgpackH.TimeEncodeExt, testMsgpackH.TimeDecodeExt) - timeEncExt := func(rv reflect.Value) (bs []byte, err error) { - switch v2 := rv.Interface().(type) { - case time.Time: - bs = encodeTime(v2) - case *time.Time: - bs = encodeTime(*v2) - default: - err = fmt.Errorf("unsupported format for time conversion: expecting time.Time; got %T", v2) - } - return - } - timeDecExt := func(rv reflect.Value, bs []byte) (err error) { - tt, err := decodeTime(bs) - if err == nil { - *(rv.Interface().(*time.Time)) = tt - } - return - } // add extensions for msgpack, simple for time.Time, so we can encode/decode same way. - testMsgpackH.AddExt(timeTyp, 1, timeEncExt, timeDecExt) - testSimpleH.AddExt(timeTyp, 1, timeEncExt, timeDecExt) - testCborH.SetExt(timeTyp, 1, &testUnixNanoTimeExt{}) - testJsonH.SetExt(timeTyp, 1, &testUnixNanoTimeExt{}) + // use different flavors of XXXExt calls, including deprecated ones. + // NOTE: + // DO NOT set extensions for JsonH, so we can test json(M|Unm)arshal support. + testSimpleH.AddExt(timeTyp, 1, timeExtEncFn, timeExtDecFn) + testMsgpackH.SetBytesExt(timeTyp, 1, timeExt{}) + testCborH.SetInterfaceExt(timeTyp, 1, &testUnixNanoTimeExt{}) + // testJsonH.SetInterfaceExt(timeTyp, 1, &testUnixNanoTimeExt{}) + // primitives MUST be an even number, so it can be used as a mapBySlice also. primitives := []interface{}{ int8(-8), int16(-1616), @@ -329,19 +391,23 @@ func testInit() { float32(-3232.0), float64(-6464646464.0), float32(3232.0), + float64(6464.0), float64(6464646464.0), false, true, + "null", nil, "someday", - "", - "bytestring", timeToCompare1, + "", timeToCompare2, + "bytestring", timeToCompare3, + "none", timeToCompare4, } - mapsAndStrucs := []interface{}{ + + maps := []interface{}{ map[string]bool{ "true": true, "false": false, @@ -375,22 +441,27 @@ func testInit() { uint8(138): false, "false": uint8(200), }, - newTestStruc(0, false, !testSkipIntf, false), } + testTableNumPrimitives = len(primitives) + testTableIdxTime = testTableNumPrimitives - 8 + testTableNumMaps = len(maps) + table = []interface{}{} - table = append(table, primitives...) //0-19 are primitives - table = append(table, primitives) //20 is a list of primitives - table = append(table, mapsAndStrucs...) //21-24 are maps. 25 is a *struct + table = append(table, primitives...) + table = append(table, primitives) + table = append(table, testMbsT(primitives)) + table = append(table, maps...) + table = append(table, newTestStruc(0, false, !testSkipIntf, false)) tableVerify = make([]interface{}, len(table)) tableTestNilVerify = make([]interface{}, len(table)) tablePythonVerify = make([]interface{}, len(table)) - lp := len(primitives) + lp := testTableNumPrimitives + 4 av := tableVerify for i, v := range table { - if i == lp+3 { + if i == lp { av[i] = skipVerifyVal continue } @@ -398,6 +469,8 @@ func testInit() { switch v.(type) { case []interface{}: av[i] = testVerifyVal(v, testVerifyMapTypeSame) + case testMbsT: + av[i] = testVerifyVal(v, testVerifyMapTypeSame) case map[string]interface{}: av[i] = testVerifyVal(v, testVerifyMapTypeSame) case map[interface{}]interface{}: @@ -409,7 +482,7 @@ func testInit() { av = tableTestNilVerify for i, v := range table { - if i > lp+3 { + if i > lp { av[i] = skipVerifyVal continue } @@ -418,34 +491,23 @@ func testInit() { av = tablePythonVerify for i, v := range table { - if i > lp+3 { + if i == testTableNumPrimitives+1 || i > lp { // testTableNumPrimitives+1 is the mapBySlice av[i] = skipVerifyVal continue } av[i] = testVerifyVal(v, testVerifyForPython) } - tablePythonVerify = tablePythonVerify[:24] + // only do the python verify up to the maps, skipping the last 2 maps. + tablePythonVerify = tablePythonVerify[:testTableNumPrimitives+2+testTableNumMaps-2] } func testUnmarshal(v interface{}, data []byte, h Handle) (err error) { - if testUseIoEncDec { - NewDecoder(bytes.NewBuffer(data), h).MustDecode(v) - } else { - NewDecoderBytes(data, h).MustDecode(v) - } - return + return testCodecDecode(data, v, h) } func testMarshal(v interface{}, h Handle) (bs []byte, err error) { - if testUseIoEncDec { - var buf bytes.Buffer - NewEncoder(&buf, h).MustEncode(v) - bs = buf.Bytes() - return - } - NewEncoderBytes(&bs, h).MustEncode(v) - return + return testCodecEncode(v, nil, testByteBuf, h) } func testMarshalErr(v interface{}, h Handle, t *testing.T, name string) (bs []byte, err error) { @@ -532,7 +594,8 @@ func testCodecTableOne(t *testing.T, h Handle) { // func TestMsgpackAllExperimental(t *testing.T) { // dopts := testDecOpts(nil, nil, false, true, true), - idxTime, numPrim, numMap := 19, 23, 4 + numPrim, numMap, idxTime, idxMap := testTableNumPrimitives, testTableNumMaps, testTableIdxTime, testTableNumPrimitives+2 + //println("#################") switch v := h.(type) { case *MsgpackHandle: @@ -545,7 +608,7 @@ func testCodecTableOne(t *testing.T, h Handle) { //skip []interface{} containing time.Time, as it encodes as a number, but cannot decode back to time.Time. //As there is no real support for extension tags in json, this must be skipped. doTestCodecTableOne(t, false, h, table[:numPrim], tableVerify[:numPrim]) - doTestCodecTableOne(t, false, h, table[numPrim+1:], tableVerify[numPrim+1:]) + doTestCodecTableOne(t, false, h, table[idxMap:], tableVerify[idxMap:]) default: doTestCodecTableOne(t, false, h, table, tableVerify) } @@ -562,14 +625,15 @@ func testCodecTableOne(t *testing.T, h Handle) { //skip time.Time, []interface{} containing time.Time, last map, and newStruc doTestCodecTableOne(t, true, h, table[:idxTime], tableTestNilVerify[:idxTime]) - doTestCodecTableOne(t, true, h, table[numPrim+1:numPrim+numMap], tableTestNilVerify[numPrim+1:numPrim+numMap]) + doTestCodecTableOne(t, true, h, table[idxMap:idxMap+numMap-1], tableTestNilVerify[idxMap:idxMap+numMap-1]) v.MapType = oldMapType // func TestMsgpackNilIntf(t *testing.T) { - //do newTestStruc and last element of map - doTestCodecTableOne(t, true, h, table[numPrim+numMap:], tableTestNilVerify[numPrim+numMap:]) + //do last map and newStruc + idx2 := idxMap + numMap - 1 + doTestCodecTableOne(t, true, h, table[idx2:], tableTestNilVerify[idx2:]) //TODO? What is this one? //doTestCodecTableOne(t, true, h, table[17:18], tableTestNilVerify[17:18]) } @@ -663,6 +727,13 @@ func testCodecMiscOne(t *testing.T, h Handle) { // test both pointer and non-pointer (value) for _, tarr1 := range []interface{}{tarr0, &tarr0} { bs, err = testMarshalErr(tarr1, h, t, "tarr1") + if err != nil { + logT(t, "Error marshalling: %v", err) + t.FailNow() + } + if _, ok := h.(*JsonHandle); ok { + logT(t, "Marshal as: %s", bs) + } var tarr2 tarr testUnmarshalErr(&tarr2, bs, h, t, "tarr2") checkEqualT(t, tarr0, tarr2, "tarr0=tarr2") @@ -816,8 +887,8 @@ func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs checkEqualT(t, sq, 25, "sq=25") checkErrT(t, cl.Call("TestRpcInt.Mult", 20, &mult)) checkEqualT(t, mult, 100, "mult=100") - checkErrT(t, cl.Call("TestRpcInt.EchoStruct", TestABC{"Aa", "Bb", "Cc"}, &rstr)) - checkEqualT(t, rstr, fmt.Sprintf("%#v", TestABC{"Aa", "Bb", "Cc"}), "rstr=") + checkErrT(t, cl.Call("TestRpcInt.EchoStruct", TestRpcABC{"Aa", "Bb", "Cc"}, &rstr)) + checkEqualT(t, rstr, fmt.Sprintf("%#v", TestRpcABC{"Aa", "Bb", "Cc"}), "rstr=") checkErrT(t, cl.Call("TestRpcInt.Echo123", []string{"A1", "B2", "C3"}, &rstr)) checkEqualT(t, rstr, fmt.Sprintf("%#v", []string{"A1", "B2", "C3"}), "rstr=") } @@ -898,9 +969,10 @@ func doTestMapEncodeForCanonical(t *testing.T, name string, h Handle) { // encode v1 into b1, decode b1 into v2, encode v2 into b2, compare b1 and b2 bh := h.getBasicHandle() - canonical0 := bh.Canonical - bh.Canonical = true - defer func() { bh.Canonical = canonical0 }() + if !bh.Canonical { + bh.Canonical = true + defer func() { bh.Canonical = false }() + } e1 := NewEncoderBytes(&b1, h) e1.MustEncode(v1) @@ -914,6 +986,163 @@ func doTestMapEncodeForCanonical(t *testing.T, name string, h Handle) { } } +func doTestStdEncIntf(t *testing.T, name string, h Handle) { + args := [][2]interface{}{ + {&TestABC{"A", "BB", "CCC"}, new(TestABC)}, + {&TestABC2{"AAA", "BB", "C"}, new(TestABC2)}, + } + for _, a := range args { + var b []byte + e := NewEncoderBytes(&b, h) + e.MustEncode(a[0]) + d := NewDecoderBytes(b, h) + d.MustDecode(a[1]) + if err := deepEqual(a[0], a[1]); err == nil { + logT(t, "++++ Objects match") + } else { + logT(t, "---- Objects do not match: y1: %v, err: %v", a[1], err) + failT(t) + } + } +} + +func doTestEncCircularRef(t *testing.T, name string, h Handle) { + type T1 struct { + S string + B bool + T interface{} + } + type T2 struct { + S string + T *T1 + } + type T3 struct { + S string + T *T2 + } + t1 := T1{"t1", true, nil} + t2 := T2{"t2", &t1} + t3 := T3{"t3", &t2} + t1.T = &t3 + + var bs []byte + var err error + + bh := h.getBasicHandle() + if !bh.CheckCircularRef { + bh.CheckCircularRef = true + defer func() { bh.CheckCircularRef = false }() + } + err = NewEncoderBytes(&bs, h).Encode(&t3) + if err == nil { + logT(t, "expecting error due to circular reference. found none") + t.FailNow() + } + if x := err.Error(); strings.Contains(x, "circular") || strings.Contains(x, "cyclic") { + logT(t, "error detected as expected: %v", x) + } else { + logT(t, "error detected was not as expected: %v", x) + t.FailNow() + } +} + +// TestAnonCycleT{1,2,3} types are used to test anonymous cycles. +// They are top-level, so that they can have circular references. +type ( + TestAnonCycleT1 struct { + S string + TestAnonCycleT2 + } + TestAnonCycleT2 struct { + S2 string + TestAnonCycleT3 + } + TestAnonCycleT3 struct { + *TestAnonCycleT1 + } +) + +func doTestAnonCycle(t *testing.T, name string, h Handle) { + var x TestAnonCycleT1 + x.S = "hello" + x.TestAnonCycleT2.S2 = "hello.2" + x.TestAnonCycleT2.TestAnonCycleT3.TestAnonCycleT1 = &x + + // just check that you can get typeInfo for T1 + rt := reflect.TypeOf((*TestAnonCycleT1)(nil)).Elem() + rtid := reflect.ValueOf(rt).Pointer() + pti := h.getBasicHandle().getTypeInfo(rtid, rt) + logT(t, "pti: %v", pti) +} + +func doTestJsonLargeInteger(t *testing.T, v interface{}, ias uint8) { + logT(t, "Running doTestJsonLargeInteger: v: %#v, ias: %c", v, ias) + oldIAS := testJsonH.IntegerAsString + defer func() { testJsonH.IntegerAsString = oldIAS }() + testJsonH.IntegerAsString = ias + + var vu uint + var vi int + var vb bool + var b []byte + e := NewEncoderBytes(&b, testJsonH) + e.MustEncode(v) + e.MustEncode(true) + d := NewDecoderBytes(b, testJsonH) + // below, we validate that the json string or number was encoded, + // then decode, and validate that the correct value was decoded. + fnStrChk := func() { + // check that output started with ", and ended with "true + if !(b[0] == '"' && string(b[len(b)-5:]) == `"true`) { + logT(t, "Expecting a JSON string, got: %s", b) + failT(t) + } + } + + switch ias { + case 'L': + switch v2 := v.(type) { + case int: + if v2 > 1<<53 || (v2 < 0 && -v2 > 1<<53) { + fnStrChk() + } + case uint: + if v2 > 1<<53 { + fnStrChk() + } + } + case 'A': + fnStrChk() + default: + // check that output doesn't contain " at all + for _, i := range b { + if i == '"' { + logT(t, "Expecting a JSON Number without quotation: got: %s", b) + failT(t) + } + } + } + switch v2 := v.(type) { + case int: + d.MustDecode(&vi) + d.MustDecode(&vb) + // check that vb = true, and vi == v2 + if !(vb && vi == v2) { + logT(t, "Expecting equal values from %s: got golden: %v, decoded: %v", b, v2, vi) + failT(t) + } + case uint: + d.MustDecode(&vu) + d.MustDecode(&vb) + // check that vb = true, and vi == v2 + if !(vb && vu == v2) { + logT(t, "Expecting equal values from %s: got golden: %v, decoded: %v", b, v2, vu) + failT(t) + } + // fmt.Printf("%v: %s, decode: %d, bool: %v, equal_on_decode: %v\n", v, b, vu, vb, vu == v.(uint)) + } +} + // Comprehensive testing that generates data encoded from python handle (cbor, msgpack), // and validates that our code can read and write it out accordingly. // We keep this unexported here, and put actual test in ext_dep_test.go. @@ -1019,21 +1248,28 @@ func doTestMsgpackRpcSpecGoClientToPythonSvc(t *testing.T) { if testSkipRPCTests { return } - openPort := "6789" - cmd := exec.Command("python", "test.py", "rpc-server", openPort, "2") + // openPorts are between 6700 and 6800 + r := rand.New(rand.NewSource(time.Now().UnixNano())) + openPort := strconv.FormatInt(6700+r.Int63n(99), 10) + // openPort := "6792" + cmd := exec.Command("python", "test.py", "rpc-server", openPort, "4") checkErrT(t, cmd.Start()) - time.Sleep(100 * time.Millisecond) // time for python rpc server to start bs, err2 := net.Dial("tcp", ":"+openPort) + for i := 0; i < 10 && err2 != nil; i++ { + time.Sleep(50 * time.Millisecond) // time for python rpc server to start + bs, err2 = net.Dial("tcp", ":"+openPort) + } checkErrT(t, err2) cc := MsgpackSpecRpc.ClientCodec(bs, testMsgpackH) cl := rpc.NewClientWithCodec(cc) defer cl.Close() var rstr string - checkErrT(t, cl.Call("EchoStruct", TestABC{"Aa", "Bb", "Cc"}, &rstr)) + checkErrT(t, cl.Call("EchoStruct", TestRpcABC{"Aa", "Bb", "Cc"}, &rstr)) //checkEqualT(t, rstr, "{'A': 'Aa', 'B': 'Bb', 'C': 'Cc'}") var mArgs MsgpackSpecRpcMultiArgs = []interface{}{"A1", "B2", "C3"} checkErrT(t, cl.Call("Echo123", mArgs, &rstr)) checkEqualT(t, rstr, "1:A1 2:B2 3:C3", "rstr=") + cmd.Process.Kill() } func doTestMsgpackRpcSpecPythonClientToGoSvc(t *testing.T) { @@ -1051,7 +1287,7 @@ func doTestMsgpackRpcSpecPythonClientToGoSvc(t *testing.T) { t.FailNow() } checkEqualT(t, string(cmdout), - fmt.Sprintf("%#v\n%#v\n", []string{"A1", "B2", "C3"}, TestABC{"Aa", "Bb", "Cc"}), "cmdout=") + fmt.Sprintf("%#v\n%#v\n", []string{"A1", "B2", "C3"}, TestRpcABC{"Aa", "Bb", "Cc"}), "cmdout=") } func TestBincCodecsTable(t *testing.T) { @@ -1066,6 +1302,10 @@ func TestBincCodecsEmbeddedPointer(t *testing.T) { testCodecEmbeddedPointer(t, testBincH) } +func TestBincStdEncIntf(t *testing.T) { + doTestStdEncIntf(t, "binc", testBincH) +} + func TestSimpleCodecsTable(t *testing.T) { testCodecTableOne(t, testSimpleH) } @@ -1078,6 +1318,10 @@ func TestSimpleCodecsEmbeddedPointer(t *testing.T) { testCodecEmbeddedPointer(t, testSimpleH) } +func TestSimpleStdEncIntf(t *testing.T) { + doTestStdEncIntf(t, "simple", testSimpleH) +} + func TestMsgpackCodecsTable(t *testing.T) { testCodecTableOne(t, testMsgpackH) } @@ -1090,6 +1334,10 @@ func TestMsgpackCodecsEmbeddedPointer(t *testing.T) { testCodecEmbeddedPointer(t, testMsgpackH) } +func TestMsgpackStdEncIntf(t *testing.T) { + doTestStdEncIntf(t, "msgpack", testMsgpackH) +} + func TestCborCodecsTable(t *testing.T) { testCodecTableOne(t, testCborH) } @@ -1106,6 +1354,14 @@ func TestCborMapEncodeForCanonical(t *testing.T) { doTestMapEncodeForCanonical(t, "cbor", testCborH) } +func TestCborCodecChan(t *testing.T) { + testCodecChan(t, testCborH) +} + +func TestCborStdEncIntf(t *testing.T) { + doTestStdEncIntf(t, "cbor", testCborH) +} + func TestJsonCodecsTable(t *testing.T) { testCodecTableOne(t, testJsonH) } @@ -1122,8 +1378,18 @@ func TestJsonCodecChan(t *testing.T) { testCodecChan(t, testJsonH) } -func TestCborCodecChan(t *testing.T) { - testCodecChan(t, testCborH) +func TestJsonStdEncIntf(t *testing.T) { + doTestStdEncIntf(t, "json", testJsonH) +} + +// ----- ALL (framework based) ----- + +func TestAllEncCircularRef(t *testing.T) { + doTestEncCircularRef(t, "cbor", testCborH) +} + +func TestAllAnonCycle(t *testing.T) { + doTestAnonCycle(t, "cbor", testCborH) } // ----- RPC ----- @@ -1156,6 +1422,23 @@ func TestBincUnderlyingType(t *testing.T) { testCodecUnderlyingType(t, testBincH) } +func TestJsonLargeInteger(t *testing.T) { + for _, i := range []uint8{'L', 'A', 0} { + for _, j := range []interface{}{ + 1 << 60, + -(1 << 60), + 0, + 1 << 20, + -(1 << 20), + uint(1 << 60), + uint(0), + uint(1 << 20), + } { + doTestJsonLargeInteger(t, j, i) + } + } +} + // TODO: // Add Tests for: // - decoding empty list/map in stream into a nil slice/map @@ -1170,6 +1453,7 @@ func TestBincUnderlyingType(t *testing.T) { // - struct tags: // on anonymous fields, _struct (all fields), etc // - codecgen of struct containing channels. +// - bad input with large array length prefix // // Cleanup tests: // - The are brittle in their handling of validation and skipping diff --git a/vendor/github.com/ugorji/go/codec/codecgen_test.go b/vendor/github.com/ugorji/go/codec/codecgen_test.go index bb7e0bfcf..a73497e91 100644 --- a/vendor/github.com/ugorji/go/codec/codecgen_test.go +++ b/vendor/github.com/ugorji/go/codec/codecgen_test.go @@ -7,8 +7,9 @@ import ( "testing" ) -func TestCodecgenJson1(t *testing.T) { +func _TestCodecgenJson1(t *testing.T) { // This is just a simplistic test for codecgen. + // It is typically disabled. We only enable it for debugging purposes. const callCodecgenDirect bool = true v := newTestStruc(2, false, !testSkipIntf, false) var bs []byte diff --git a/vendor/github.com/ugorji/go/codec/decode.go b/vendor/github.com/ugorji/go/codec/decode.go index 71dd71c89..7e56f1eca 100644 --- a/vendor/github.com/ugorji/go/codec/decode.go +++ b/vendor/github.com/ugorji/go/codec/decode.go @@ -9,6 +9,7 @@ import ( "fmt" "io" "reflect" + "time" ) // Some tagging information for error messages. @@ -48,16 +49,23 @@ type decDriver interface { // this will check if the next token is a break. CheckBreak() bool TryDecodeAsNil() bool - // check if a container type: vt is one of: Bytes, String, Nil, Slice or Map. - // if vt param == valueTypeNil, and nil is seen in stream, consume the nil. - IsContainerType(vt valueType) bool + // vt is one of: Bytes, String, Nil, Slice or Map. Return unSet if not known. + ContainerType() (vt valueType) IsBuiltinType(rt uintptr) bool DecodeBuiltin(rt uintptr, v interface{}) - //decodeNaked: Numbers are decoded as int64, uint64, float64 only (no smaller sized number types). - //for extensions, decodeNaked must completely decode them as a *RawExt. - //extensions should also use readx to decode them, for efficiency. - //kInterface will extract the detached byte slice if it has to pass it outside its realm. - DecodeNaked() (v interface{}, vt valueType, decodeFurther bool) + + // DecodeNaked will decode primitives (number, bool, string, []byte) and RawExt. + // For maps and arrays, it will not do the decoding in-band, but will signal + // the decoder, so that is done later, by setting the decNaked.valueType field. + // + // Note: Numbers are decoded as int64, uint64, float64 only (no smaller sized number types). + // for extensions, DecodeNaked must read the tag and the []byte if it exists. + // if the []byte is not read, then kInterfaceNaked will treat it as a Handle + // that stores the subsequent value in-band, and complete reading the RawExt. + // + // extensions should also use readx to decode them, for efficiency. + // kInterface will extract the detached byte slice if it has to pass it outside its realm. + DecodeNaked() DecodeInt(bitsize uint8) (i int64) DecodeUint(bitsize uint8) (ui uint64) DecodeFloat(chkOverflow32 bool) (f float64) @@ -78,13 +86,15 @@ type decDriver interface { // decodeExt(verifyTag bool, tag byte) (xtag byte, xbs []byte) ReadMapStart() int ReadArrayStart() int - // ReadEnd registers the end of a map or array. - ReadEnd() + + reset() + uncacheRead() } type decNoSeparator struct{} -func (_ decNoSeparator) ReadEnd() {} +func (_ decNoSeparator) ReadEnd() {} +func (_ decNoSeparator) uncacheRead() {} type DecodeOptions struct { // MapType specifies type to use during schema-less decoding of a map in the stream. @@ -326,6 +336,13 @@ type bytesDecReader struct { t int // track start } +func (z *bytesDecReader) reset(in []byte) { + z.b = in + z.a = len(in) + z.c = 0 + z.t = 0 +} + func (z *bytesDecReader) numread() int { return z.c } @@ -460,12 +477,8 @@ func (f *decFnInfo) textUnmarshal(rv reflect.Value) { func (f *decFnInfo) jsonUnmarshal(rv reflect.Value) { tm := f.getValueForUnmarshalInterface(rv, f.ti.junmIndir).(jsonUnmarshaler) // bs := f.d.d.DecodeBytes(f.d.b[:], true, true) - // grab the bytes to be read, as UnmarshalJSON wants the full JSON to unmarshal it itself. - f.d.r.track() - f.d.swallow() - bs := f.d.r.stopTrack() - // fmt.Printf(">>>>>> REFLECTION JSON: %s\n", bs) - fnerr := tm.UnmarshalJSON(bs) + // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. + fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()) if fnerr != nil { panic(fnerr) } @@ -549,63 +562,99 @@ func (f *decFnInfo) kInterfaceNaked() (rvn reflect.Value) { // nil interface: // use some hieristics to decode it appropriately // based on the detected next value in the stream. - v, vt, decodeFurther := f.d.d.DecodeNaked() - if vt == valueTypeNil { + d := f.d + d.d.DecodeNaked() + n := &d.n + if n.v == valueTypeNil { return } // We cannot decode non-nil stream value into nil interface with methods (e.g. io.Reader). - if num := f.ti.rt.NumMethod(); num > 0 { - f.d.errorf("cannot decode non-nil codec value into nil %v (%v methods)", f.ti.rt, num) + // if num := f.ti.rt.NumMethod(); num > 0 { + if f.ti.numMeth > 0 { + d.errorf("cannot decode non-nil codec value into nil %v (%v methods)", f.ti.rt, f.ti.numMeth) return } - var useRvn bool - switch vt { + // var useRvn bool + switch n.v { case valueTypeMap: - if f.d.h.MapType == nil { - var m2 map[interface{}]interface{} - v = &m2 + // if d.h.MapType == nil || d.h.MapType == mapIntfIntfTyp { + // } else if d.h.MapType == mapStrIntfTyp { // for json performance + // } + if d.mtid == 0 || d.mtid == mapIntfIntfTypId { + l := len(n.ms) + n.ms = append(n.ms, nil) + var v2 interface{} = &n.ms[l] + d.decode(v2) + rvn = reflect.ValueOf(v2).Elem() + n.ms = n.ms[:l] + } else if d.mtid == mapStrIntfTypId { // for json performance + l := len(n.ns) + n.ns = append(n.ns, nil) + var v2 interface{} = &n.ns[l] + d.decode(v2) + rvn = reflect.ValueOf(v2).Elem() + n.ns = n.ns[:l] } else { - rvn = reflect.New(f.d.h.MapType).Elem() - useRvn = true + rvn = reflect.New(d.h.MapType).Elem() + d.decodeValue(rvn, nil) } case valueTypeArray: - if f.d.h.SliceType == nil { - var m2 []interface{} - v = &m2 + // if d.h.SliceType == nil || d.h.SliceType == intfSliceTyp { + if d.stid == 0 || d.stid == intfSliceTypId { + l := len(n.ss) + n.ss = append(n.ss, nil) + var v2 interface{} = &n.ss[l] + d.decode(v2) + rvn = reflect.ValueOf(v2).Elem() + n.ss = n.ss[:l] } else { - rvn = reflect.New(f.d.h.SliceType).Elem() - useRvn = true + rvn = reflect.New(d.h.SliceType).Elem() + d.decodeValue(rvn, nil) } case valueTypeExt: - re := v.(*RawExt) - bfn := f.d.h.getExtForTag(re.Tag) + var v interface{} + tag, bytes := n.u, n.l // calling decode below might taint the values + if bytes == nil { + l := len(n.is) + n.is = append(n.is, nil) + v2 := &n.is[l] + d.decode(v2) + v = *v2 + n.is = n.is[:l] + } + bfn := d.h.getExtForTag(tag) if bfn == nil { - re.Data = detachZeroCopyBytes(f.d.bytes, nil, re.Data) - rvn = reflect.ValueOf(*re) + var re RawExt + re.Tag = tag + re.Data = detachZeroCopyBytes(d.bytes, nil, bytes) + rvn = reflect.ValueOf(re) } else { rvnA := reflect.New(bfn.rt) rvn = rvnA.Elem() - if re.Data != nil { - bfn.ext.ReadExt(rvnA.Interface(), re.Data) + if bytes != nil { + bfn.ext.ReadExt(rvnA.Interface(), bytes) } else { - bfn.ext.UpdateExt(rvnA.Interface(), re.Value) + bfn.ext.UpdateExt(rvnA.Interface(), v) } } - return - } - if decodeFurther { - if useRvn { - f.d.decodeValue(rvn, nil) - } else if v != nil { - // this v is a pointer, so we need to dereference it when done - f.d.decode(v) - rvn = reflect.ValueOf(v).Elem() - useRvn = true - } - } - - if !useRvn && v != nil { - rvn = reflect.ValueOf(v) + case valueTypeNil: + // no-op + case valueTypeInt: + rvn = reflect.ValueOf(&n.i).Elem() + case valueTypeUint: + rvn = reflect.ValueOf(&n.u).Elem() + case valueTypeFloat: + rvn = reflect.ValueOf(&n.f).Elem() + case valueTypeBool: + rvn = reflect.ValueOf(&n.b).Elem() + case valueTypeString, valueTypeSymbol: + rvn = reflect.ValueOf(&n.s).Elem() + case valueTypeBytes: + rvn = reflect.ValueOf(&n.l).Elem() + case valueTypeTimestamp: + rvn = reflect.ValueOf(&n.t).Elem() + default: + panic(fmt.Errorf("kInterfaceNaked: unexpected valueType: %d", n.v)) } return } @@ -655,10 +704,14 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { fti := f.ti d := f.d dd := d.d - if dd.IsContainerType(valueTypeMap) { + cr := d.cr + ctyp := dd.ContainerType() + if ctyp == valueTypeMap { containerLen := dd.ReadMapStart() if containerLen == 0 { - dd.ReadEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } return } tisfi := fti.sfi @@ -666,8 +719,14 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { if hasLen { for j := 0; j < containerLen; j++ { // rvkencname := dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapKey) + } rvkencname := stringView(dd.DecodeBytes(f.d.b[:], true, true)) // rvksi := ti.getForEncName(rvkencname) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if k := fti.indexForEncName(rvkencname); k > -1 { si := tisfi[k] if dd.TryDecodeAsNil() { @@ -682,8 +741,14 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { } else { for j := 0; !dd.CheckBreak(); j++ { // rvkencname := dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapKey) + } rvkencname := stringView(dd.DecodeBytes(f.d.b[:], true, true)) // rvksi := ti.getForEncName(rvkencname) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if k := fti.indexForEncName(rvkencname); k > -1 { si := tisfi[k] if dd.TryDecodeAsNil() { @@ -695,12 +760,16 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { d.structFieldNotFound(-1, rvkencname) } } - dd.ReadEnd() } - } else if dd.IsContainerType(valueTypeArray) { + if cr != nil { + cr.sendContainerState(containerMapEnd) + } + } else if ctyp == valueTypeArray { containerLen := dd.ReadArrayStart() if containerLen == 0 { - dd.ReadEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } return } // Not much gain from doing it two ways for array. @@ -714,6 +783,9 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { } else if dd.CheckBreak() { break } + if cr != nil { + cr.sendContainerState(containerArrayElem) + } if dd.TryDecodeAsNil() { si.setToZeroValue(rv) } else { @@ -723,10 +795,15 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { if containerLen > len(fti.sfip) { // read remaining values and throw away for j := len(fti.sfip); j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } d.structFieldNotFound(j, "") } } - dd.ReadEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } } else { f.d.error(onlyMapOrArrayCanDecodeIntoStructErr) return @@ -740,59 +817,50 @@ func (f *decFnInfo) kSlice(rv reflect.Value) { d := f.d dd := d.d rtelem0 := ti.rt.Elem() - - if dd.IsContainerType(valueTypeBytes) || dd.IsContainerType(valueTypeString) { - if ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8 { - if f.seq == seqTypeChan { - bs2 := dd.DecodeBytes(nil, false, true) - ch := rv.Interface().(chan<- byte) - for _, b := range bs2 { - ch <- b - } - } else { - rvbs := rv.Bytes() - bs2 := dd.DecodeBytes(rvbs, false, false) - if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { - if rv.CanSet() { - rv.SetBytes(bs2) - } else { - copy(rvbs, bs2) - } + ctyp := dd.ContainerType() + if ctyp == valueTypeBytes || ctyp == valueTypeString { + // you can only decode bytes or string in the stream into a slice or array of bytes + if !(ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) { + f.d.errorf("bytes or string in the stream must be decoded into a slice or array of bytes, not %v", ti.rt) + } + if f.seq == seqTypeChan { + bs2 := dd.DecodeBytes(nil, false, true) + ch := rv.Interface().(chan<- byte) + for _, b := range bs2 { + ch <- b + } + } else { + rvbs := rv.Bytes() + bs2 := dd.DecodeBytes(rvbs, false, false) + if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { + if rv.CanSet() { + rv.SetBytes(bs2) + } else { + copy(rvbs, bs2) } } - return } + return } // array := f.seq == seqTypeChan - slh, containerLenS := d.decSliceHelperStart() - - var rvlen, numToRead int - var truncated bool // says that the len of the sequence is not same as the expected number of elements. - - numToRead = containerLenS // if truncated, reset numToRead - - // an array can never return a nil slice. so no need to check f.array here. - if rv.IsNil() { - // either chan or slice - if rvlen, truncated = decInferLen(containerLenS, f.d.h.MaxInitLen, int(rtelem0.Size())); truncated { - numToRead = rvlen - } - if f.seq == seqTypeSlice { - rv.Set(reflect.MakeSlice(ti.rt, rvlen, rvlen)) - } else if f.seq == seqTypeChan { - rv.Set(reflect.MakeChan(ti.rt, rvlen)) - } - } else { - rvlen = rv.Len() - } + slh, containerLenS := d.decSliceHelperStart() // only expects valueType(Array|Map) + // // an array can never return a nil slice. so no need to check f.array here. if containerLenS == 0 { - if f.seq == seqTypeSlice && rvlen != 0 { - rv.SetLen(0) + if f.seq == seqTypeSlice { + if rv.IsNil() { + rv.Set(reflect.MakeSlice(ti.rt, 0, 0)) + } else { + rv.SetLen(0) + } + } else if f.seq == seqTypeChan { + if rv.IsNil() { + rv.Set(reflect.MakeChan(ti.rt, 0)) + } } - // dd.ReadEnd() + slh.End() return } @@ -806,30 +874,48 @@ func (f *decFnInfo) kSlice(rv reflect.Value) { rv0 = rv rvChanged := false - rvcap := rv.Cap() - // for j := 0; j < containerLenS; j++ { - - if containerLenS >= 0 { // hasLen + var rvlen int + if containerLenS > 0 { // hasLen if f.seq == seqTypeChan { + if rv.IsNil() { + rvlen, _ = decInferLen(containerLenS, f.d.h.MaxInitLen, int(rtelem0.Size())) + rv.Set(reflect.MakeChan(ti.rt, rvlen)) + } // handle chan specially: for j := 0; j < containerLenS; j++ { rv9 = reflect.New(rtelem0).Elem() + slh.ElemContainerState(j) d.decodeValue(rv9, fn) rv.Send(rv9) } } else { // slice or array + var truncated bool // says len of sequence is not same as expected number of elements + numToRead := containerLenS // if truncated, reset numToRead + + rvcap := rv.Cap() + rvlen = rv.Len() if containerLenS > rvcap { if f.seq == seqTypeArray { d.arrayCannotExpand(rvlen, containerLenS) } else { oldRvlenGtZero := rvlen > 0 rvlen, truncated = decInferLen(containerLenS, f.d.h.MaxInitLen, int(rtelem0.Size())) - rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) - if oldRvlenGtZero && !isImmutableKind(rtelem0.Kind()) { + if truncated { + if rvlen <= rvcap { + rv.SetLen(rvlen) + } else { + rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) + rvChanged = true + } + } else { + rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) + rvChanged = true + } + if rvChanged && oldRvlenGtZero && !isImmutableKind(rtelem0.Kind()) { reflect.Copy(rv, rv0) // only copy up to length NOT cap i.e. rv0.Slice(0, rvcap) } - rvChanged = true + rvcap = rvlen } numToRead = rvlen } else if containerLenS != rvlen { @@ -841,6 +927,7 @@ func (f *decFnInfo) kSlice(rv reflect.Value) { j := 0 // we read up to the numToRead for ; j < numToRead; j++ { + slh.ElemContainerState(j) d.decodeValue(rv.Index(j), fn) } @@ -849,6 +936,7 @@ func (f *decFnInfo) kSlice(rv reflect.Value) { if f.seq == seqTypeArray { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } else if truncated { // slice was truncated, as chan NOT in this block @@ -858,44 +946,59 @@ func (f *decFnInfo) kSlice(rv reflect.Value) { if resetSliceElemToZeroValue { rv9.Set(reflect.Zero(rtelem0)) } + slh.ElemContainerState(j) d.decodeValue(rv9, fn) } } } } else { - for j := 0; !dd.CheckBreak(); j++ { - var decodeIntoBlank bool - // if indefinite, etc, then expand the slice if necessary - if j >= rvlen { - if f.seq == seqTypeArray { - d.arrayCannotExpand(rvlen, j+1) - decodeIntoBlank = true - } else if f.seq == seqTypeSlice { - // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // uses append logic, plus varargs - rv = expandSliceValue(rv, 1) - rv9 = rv.Index(j) - // rv.Index(rv.Len() - 1).Set(reflect.Zero(rtelem0)) - if resetSliceElemToZeroValue { - rv9.Set(reflect.Zero(rtelem0)) - } - rvlen++ - rvChanged = true - } - } else if f.seq != seqTypeChan { // slice or array - rv9 = rv.Index(j) - } + rvlen = rv.Len() + j := 0 + for ; !dd.CheckBreak(); j++ { if f.seq == seqTypeChan { + slh.ElemContainerState(j) rv9 = reflect.New(rtelem0).Elem() d.decodeValue(rv9, fn) rv.Send(rv9) - } else if decodeIntoBlank { - d.swallow() - } else { // seqTypeSlice - d.decodeValue(rv9, fn) + } else { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= rvlen { + if f.seq == seqTypeArray { + d.arrayCannotExpand(rvlen, j+1) + decodeIntoBlank = true + } else { // if f.seq == seqTypeSlice + // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // uses append logic, plus varargs + rv = expandSliceValue(rv, 1) + rv9 = rv.Index(j) + // rv.Index(rv.Len() - 1).Set(reflect.Zero(rtelem0)) + if resetSliceElemToZeroValue { + rv9.Set(reflect.Zero(rtelem0)) + } + rvlen++ + rvChanged = true + } + } else { // slice or array + rv9 = rv.Index(j) + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else { // seqTypeSlice + d.decodeValue(rv9, fn) + } + } + } + if f.seq == seqTypeSlice { + if j < rvlen { + rv.SetLen(j) + } else if j == 0 && rv.IsNil() { + rv = reflect.MakeSlice(ti.rt, 0, 0) + rvChanged = true } } - slh.End() } + slh.End() if rvChanged { rv0.Set(rv) @@ -911,20 +1014,22 @@ func (f *decFnInfo) kMap(rv reflect.Value) { d := f.d dd := d.d containerLen := dd.ReadMapStart() - + cr := d.cr ti := f.ti if rv.IsNil() { rv.Set(reflect.MakeMap(ti.rt)) } if containerLen == 0 { - // It is not length-prefix style container. They have no End marker. - // dd.ReadMapEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } return } ktype, vtype := ti.rt.Key(), ti.rt.Elem() ktypeId := reflect.ValueOf(ktype).Pointer() + vtypeKind := vtype.Kind() var keyFn, valFn *decFn var xtyp reflect.Type for xtyp = ktype; xtyp.Kind() == reflect.Ptr; xtyp = xtyp.Elem() { @@ -933,13 +1038,12 @@ func (f *decFnInfo) kMap(rv reflect.Value) { for xtyp = vtype; xtyp.Kind() == reflect.Ptr; xtyp = xtyp.Elem() { } valFn = d.getDecFn(xtyp, true, true) - var mapGet bool + var mapGet, mapSet bool if !f.d.h.MapValueReset { // if pointer, mapGet = true // if interface, mapGet = true if !DecodeNakedAlways (else false) // if builtin, mapGet = false // else mapGet = true - vtypeKind := vtype.Kind() if vtypeKind == reflect.Ptr { mapGet = true } else if vtypeKind == reflect.Interface { @@ -951,12 +1055,15 @@ func (f *decFnInfo) kMap(rv reflect.Value) { } } - var rvk, rvv reflect.Value + var rvk, rvv, rvz reflect.Value // for j := 0; j < containerLen; j++ { if containerLen > 0 { for j := 0; j < containerLen; j++ { rvk = reflect.New(ktype).Elem() + if cr != nil { + cr.sendContainerState(containerMapKey) + } d.decodeValue(rvk, keyFn) // special case if a byte array. @@ -966,20 +1073,43 @@ func (f *decFnInfo) kMap(rv reflect.Value) { rvk = reflect.ValueOf(d.string(rvk.Bytes())) } } + mapSet = true // set to false if u do a get, and its a pointer, and exists if mapGet { rvv = rv.MapIndex(rvk) - if !rvv.IsValid() { - rvv = reflect.New(vtype).Elem() + if rvv.IsValid() { + if vtypeKind == reflect.Ptr { + mapSet = false + } + } else { + if rvz.IsValid() { + rvz.Set(reflect.Zero(vtype)) + } else { + rvz = reflect.New(vtype).Elem() + } + rvv = rvz } } else { - rvv = reflect.New(vtype).Elem() + if rvz.IsValid() { + rvz.Set(reflect.Zero(vtype)) + } else { + rvz = reflect.New(vtype).Elem() + } + rvv = rvz + } + if cr != nil { + cr.sendContainerState(containerMapValue) } d.decodeValue(rvv, valFn) - rv.SetMapIndex(rvk, rvv) + if mapSet { + rv.SetMapIndex(rvk, rvv) + } } } else { for j := 0; !dd.CheckBreak(); j++ { rvk = reflect.New(ktype).Elem() + if cr != nil { + cr.sendContainerState(containerMapKey) + } d.decodeValue(rvk, keyFn) // special case if a byte array. @@ -989,18 +1119,40 @@ func (f *decFnInfo) kMap(rv reflect.Value) { rvk = reflect.ValueOf(d.string(rvk.Bytes())) } } + mapSet = true // set to false if u do a get, and its a pointer, and exists if mapGet { rvv = rv.MapIndex(rvk) - if !rvv.IsValid() { - rvv = reflect.New(vtype).Elem() + if rvv.IsValid() { + if vtypeKind == reflect.Ptr { + mapSet = false + } + } else { + if rvz.IsValid() { + rvz.Set(reflect.Zero(vtype)) + } else { + rvz = reflect.New(vtype).Elem() + } + rvv = rvz } } else { - rvv = reflect.New(vtype).Elem() + if rvz.IsValid() { + rvz.Set(reflect.Zero(vtype)) + } else { + rvz = reflect.New(vtype).Elem() + } + rvv = rvz + } + if cr != nil { + cr.sendContainerState(containerMapValue) } d.decodeValue(rvv, valFn) - rv.SetMapIndex(rvk, rvv) + if mapSet { + rv.SetMapIndex(rvk, rvv) + } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } } @@ -1009,6 +1161,65 @@ type decRtidFn struct { fn decFn } +// decNaked is used to keep track of the primitives decoded. +// Without it, we would have to decode each primitive and wrap it +// in an interface{}, causing an allocation. +// In this model, the primitives are decoded in a "pseudo-atomic" fashion, +// so we can rest assured that no other decoding happens while these +// primitives are being decoded. +// +// maps and arrays are not handled by this mechanism. +// However, RawExt is, and we accomodate for extensions that decode +// RawExt from DecodeNaked, but need to decode the value subsequently. +// kInterfaceNaked and swallow, which call DecodeNaked, handle this caveat. +// +// However, decNaked also keeps some arrays of default maps and slices +// used in DecodeNaked. This way, we can get a pointer to it +// without causing a new heap allocation. +// +// kInterfaceNaked will ensure that there is no allocation for the common +// uses. +type decNaked struct { + // r RawExt // used for RawExt, uint, []byte. + u uint64 + i int64 + f float64 + l []byte + s string + t time.Time + b bool + v valueType + + // stacks for reducing allocation + is []interface{} + ms []map[interface{}]interface{} + ns []map[string]interface{} + ss [][]interface{} + // rs []RawExt + + // keep arrays at the bottom? Chance is that they are not used much. + ia [4]interface{} + ma [4]map[interface{}]interface{} + na [4]map[string]interface{} + sa [4][]interface{} + // ra [2]RawExt +} + +func (n *decNaked) reset() { + if n.ss != nil { + n.ss = n.ss[:0] + } + if n.is != nil { + n.is = n.is[:0] + } + if n.ms != nil { + n.ms = n.ms[:0] + } + if n.ns != nil { + n.ns = n.ns[:0] + } +} + // A Decoder reads and decodes an object from an input stream in the codec format. type Decoder struct { // hopefully, reduce derefencing cost by laying the decReader inside the Decoder. @@ -1019,32 +1230,84 @@ type Decoder struct { // as the handler MAY need to do some coordination. r decReader // sa [initCollectionCap]decRtidFn - s []decRtidFn - h *BasicHandle + h *BasicHandle + hh Handle - rb bytesDecReader - hh Handle be bool // is binary encoding bytes bool // is bytes reader js bool // is json handle + rb bytesDecReader ri ioDecReader - f map[uintptr]*decFn - is map[string]string // used for interning strings + cr containerStateRecv + + s []decRtidFn + f map[uintptr]*decFn // _ uintptr // for alignment purposes, so next one starts from a cache line - b [scratchByteArrayLen]byte + // cache the mapTypeId and sliceTypeId for faster comparisons + mtid uintptr + stid uintptr + + n decNaked + b [scratchByteArrayLen]byte + is map[string]string // used for interning strings } // NewDecoder returns a Decoder for decoding a stream of bytes from an io.Reader. // // For efficiency, Users are encouraged to pass in a memory buffered reader // (eg bufio.Reader, bytes.Buffer). -func NewDecoder(r io.Reader, h Handle) (d *Decoder) { - d = &Decoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()} - // d.s = d.sa[:0] +func NewDecoder(r io.Reader, h Handle) *Decoder { + d := newDecoder(h) + d.Reset(r) + return d +} + +// NewDecoderBytes returns a Decoder which efficiently decodes directly +// from a byte slice with zero copying. +func NewDecoderBytes(in []byte, h Handle) *Decoder { + d := newDecoder(h) + d.ResetBytes(in) + return d +} + +func newDecoder(h Handle) *Decoder { + d := &Decoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()} + n := &d.n + // n.rs = n.ra[:0] + n.ms = n.ma[:0] + n.is = n.ia[:0] + n.ns = n.na[:0] + n.ss = n.sa[:0] + _, d.js = h.(*JsonHandle) + if d.h.InternString { + d.is = make(map[string]string, 32) + } + d.d = h.newDecDriver(d) + d.cr, _ = d.d.(containerStateRecv) + // d.d = h.newDecDriver(decReaderT{true, &d.rb, &d.ri}) + return d +} + +func (d *Decoder) resetCommon() { + d.n.reset() + d.d.reset() + // reset all things which were cached from the Handle, + // but could be changed. + d.mtid, d.stid = 0, 0 + if d.h.MapType != nil { + d.mtid = reflect.ValueOf(d.h.MapType).Pointer() + } + if d.h.SliceType != nil { + d.stid = reflect.ValueOf(d.h.SliceType).Pointer() + } +} + +func (d *Decoder) Reset(r io.Reader) { d.ri.x = &d.b + // d.s = d.sa[:0] d.ri.bs.r = r var ok bool d.ri.br, ok = r.(decReaderByteScanner) @@ -1052,31 +1315,22 @@ func NewDecoder(r io.Reader, h Handle) (d *Decoder) { d.ri.br = &d.ri.bs } d.r = &d.ri - if d.h.InternString { - d.is = make(map[string]string, 32) - } - _, d.js = h.(*JsonHandle) - d.d = h.newDecDriver(d) - return + d.resetCommon() } -// NewDecoderBytes returns a Decoder which efficiently decodes directly -// from a byte slice with zero copying. -func NewDecoderBytes(in []byte, h Handle) (d *Decoder) { - d = &Decoder{hh: h, h: h.getBasicHandle(), be: h.isBinary(), bytes: true} +func (d *Decoder) ResetBytes(in []byte) { // d.s = d.sa[:0] - d.rb.b = in - d.rb.a = len(in) + d.rb.reset(in) d.r = &d.rb - if d.h.InternString { - d.is = make(map[string]string, 32) - } - _, d.js = h.(*JsonHandle) - d.d = h.newDecDriver(d) - // d.d = h.newDecDriver(decReaderT{true, &d.rb, &d.ri}) - return + d.resetCommon() } +// func (d *Decoder) sendContainerState(c containerState) { +// if d.cr != nil { +// d.cr.sendContainerState(c) +// } +// } + // Decode decodes the stream from reader and stores the result in the // value pointed to by v. v cannot be a nil pointer. v can also be // a reflect.Value of a pointer. @@ -1142,9 +1396,12 @@ func (d *Decoder) swallowViaHammer() { func (d *Decoder) swallow() { // smarter decode that just swallows the content dd := d.d - switch { - case dd.TryDecodeAsNil(): - case dd.IsContainerType(valueTypeMap): + if dd.TryDecodeAsNil() { + return + } + cr := d.cr + switch dd.ContainerType() { + case valueTypeMap: containerLen := dd.ReadMapStart() clenGtEqualZero := containerLen >= 0 for j := 0; ; j++ { @@ -1155,11 +1412,19 @@ func (d *Decoder) swallow() { } else if dd.CheckBreak() { break } + if cr != nil { + cr.sendContainerState(containerMapKey) + } d.swallow() + if cr != nil { + cr.sendContainerState(containerMapValue) + } d.swallow() } - dd.ReadEnd() - case dd.IsContainerType(valueTypeArray): + if cr != nil { + cr.sendContainerState(containerMapEnd) + } + case valueTypeArray: containerLenS := dd.ReadArrayStart() clenGtEqualZero := containerLenS >= 0 for j := 0; ; j++ { @@ -1170,17 +1435,30 @@ func (d *Decoder) swallow() { } else if dd.CheckBreak() { break } + if cr != nil { + cr.sendContainerState(containerArrayElem) + } d.swallow() } - dd.ReadEnd() - case dd.IsContainerType(valueTypeBytes): + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } + case valueTypeBytes: dd.DecodeBytes(d.b[:], false, true) - case dd.IsContainerType(valueTypeString): + case valueTypeString: dd.DecodeBytes(d.b[:], true, true) // dd.DecodeStringAsBytes(d.b[:]) default: // these are all primitives, which we can get from decodeNaked + // if RawExt using Value, complete the processing. dd.DecodeNaked() + if n := &d.n; n.v == valueTypeExt && n.l == nil { + l := len(n.is) + n.is = append(n.is, nil) + v2 := &n.is[l] + d.decode(v2) + n.is = n.is[:l] + } } } @@ -1230,14 +1508,20 @@ func (d *Decoder) decode(iv interface{}) { case *[]uint8: *v = nil case reflect.Value: - d.chkPtrValue(v) + if v.Kind() != reflect.Ptr || v.IsNil() { + d.errNotValidPtrValue(v) + } + // d.chkPtrValue(v) v = v.Elem() if v.IsValid() { v.Set(reflect.Zero(v.Type())) } default: rv := reflect.ValueOf(iv) - d.chkPtrValue(rv) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + d.errNotValidPtrValue(rv) + } + // d.chkPtrValue(rv) rv = rv.Elem() if rv.IsValid() { rv.Set(reflect.Zero(rv.Type())) @@ -1255,7 +1539,10 @@ func (d *Decoder) decode(iv interface{}) { v.CodecDecodeSelf(d) case reflect.Value: - d.chkPtrValue(v) + if v.Kind() != reflect.Ptr || v.IsNil() { + d.errNotValidPtrValue(v) + } + // d.chkPtrValue(v) d.decodeValueNotNil(v.Elem(), nil) case *string: @@ -1325,7 +1612,10 @@ func (d *Decoder) preDecodeValue(rv reflect.Value, tryNil bool) (rv2 reflect.Val func (d *Decoder) decodeI(iv interface{}, checkPtr, tryNil, checkFastpath, checkCodecSelfer bool) { rv := reflect.ValueOf(iv) if checkPtr { - d.chkPtrValue(rv) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + d.errNotValidPtrValue(rv) + } + // d.chkPtrValue(rv) } rv, proceed := d.preDecodeValue(rv, tryNil) if proceed { @@ -1529,6 +1819,10 @@ func (d *Decoder) chkPtrValue(rv reflect.Value) { if rv.Kind() == reflect.Ptr && !rv.IsNil() { return } + d.errNotValidPtrValue(rv) +} + +func (d *Decoder) errNotValidPtrValue(rv reflect.Value) { if !rv.IsValid() { d.error(cannotDecodeIntoNilErr) return @@ -1571,31 +1865,66 @@ func (d *Decoder) intern(s string) { } } +// nextValueBytes returns the next value in the stream as a set of bytes. +func (d *Decoder) nextValueBytes() []byte { + d.d.uncacheRead() + d.r.track() + d.swallow() + return d.r.stopTrack() +} + // -------------------------------------------------- // decSliceHelper assists when decoding into a slice, from a map or an array in the stream. // A slice can be set from a map or array in stream. This supports the MapBySlice interface. type decSliceHelper struct { - dd decDriver - ct valueType + d *Decoder + // ct valueType + array bool } func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) { - x.dd = d.d - if x.dd.IsContainerType(valueTypeArray) { - x.ct = valueTypeArray - clen = x.dd.ReadArrayStart() - } else if x.dd.IsContainerType(valueTypeMap) { - x.ct = valueTypeMap - clen = x.dd.ReadMapStart() * 2 + dd := d.d + ctyp := dd.ContainerType() + if ctyp == valueTypeArray { + x.array = true + clen = dd.ReadArrayStart() + } else if ctyp == valueTypeMap { + clen = dd.ReadMapStart() * 2 } else { - d.errorf("only encoded map or array can be decoded into a slice") + d.errorf("only encoded map or array can be decoded into a slice (%d)", ctyp) } + // x.ct = ctyp + x.d = d return } func (x decSliceHelper) End() { - x.dd.ReadEnd() + cr := x.d.cr + if cr == nil { + return + } + if x.array { + cr.sendContainerState(containerArrayEnd) + } else { + cr.sendContainerState(containerMapEnd) + } +} + +func (x decSliceHelper) ElemContainerState(index int) { + cr := x.d.cr + if cr == nil { + return + } + if x.array { + cr.sendContainerState(containerArrayElem) + } else { + if index%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } } func decByteSlice(r decReader, clen int, bs []byte) (bsOut []byte) { diff --git a/vendor/github.com/ugorji/go/codec/encode.go b/vendor/github.com/ugorji/go/codec/encode.go index 49c3a4577..a874c744b 100644 --- a/vendor/github.com/ugorji/go/codec/encode.go +++ b/vendor/github.com/ugorji/go/codec/encode.go @@ -62,13 +62,14 @@ type encDriver interface { EncodeExt(v interface{}, xtag uint64, ext Ext, e *Encoder) EncodeArrayStart(length int) EncodeMapStart(length int) - EncodeEnd() EncodeString(c charEncoding, v string) EncodeSymbol(v string) EncodeStringBytes(c charEncoding, v []byte) //TODO //encBignum(f *big.Int) //encStringRunes(c charEncoding, v []rune) + + reset() } type encDriverAsis interface { @@ -109,6 +110,15 @@ type EncodeOptions struct { // Canonical bool + // CheckCircularRef controls whether we check for circular references + // and error fast during an encode. + // + // If enabled, an error is received if a pointer to a struct + // references itself either directly or through one of its fields (iteratively). + // + // This is opt-in, as there may be a performance hit to checking circular references. + CheckCircularRef bool + // AsSymbols defines what should be encoded as symbols. // // Encoding as symbols can reduce the encoded size significantly. @@ -158,6 +168,7 @@ func (o *simpleIoEncWriterWriter) Write(p []byte) (n int, err error) { // ioEncWriter implements encWriter and can write to an io.Writer implementation type ioEncWriter struct { w ioEncWriterWriter + s simpleIoEncWriterWriter // x [8]byte // temp byte array re-used internally for efficiency } @@ -382,30 +393,32 @@ func (f *encFnInfo) kSlice(rv reflect.Value) { // (don't call rv.Bytes, rv.Slice, etc). // E.g. type struct S{B [2]byte}; // Encode(S{}) will bomb on "panic: slice of unaddressable array". + e := f.e if f.seq != seqTypeArray { if rv.IsNil() { - f.e.e.EncodeNil() + e.e.EncodeNil() return } // If in this method, then there was no extension function defined. // So it's okay to treat as []byte. if ti.rtid == uint8SliceTypId { - f.e.e.EncodeStringBytes(c_RAW, rv.Bytes()) + e.e.EncodeStringBytes(c_RAW, rv.Bytes()) return } } + cr := e.cr rtelem := ti.rt.Elem() l := rv.Len() - if rtelem.Kind() == reflect.Uint8 { + if ti.rtid == uint8SliceTypId || rtelem.Kind() == reflect.Uint8 { switch f.seq { case seqTypeArray: - // if l == 0 { f.e.e.encodeStringBytes(c_RAW, nil) } else + // if l == 0 { e.e.encodeStringBytes(c_RAW, nil) } else if rv.CanAddr() { - f.e.e.EncodeStringBytes(c_RAW, rv.Slice(0, l).Bytes()) + e.e.EncodeStringBytes(c_RAW, rv.Slice(0, l).Bytes()) } else { var bs []byte - if l <= cap(f.e.b) { - bs = f.e.b[:l] + if l <= cap(e.b) { + bs = e.b[:l] } else { bs = make([]byte, l) } @@ -414,12 +427,12 @@ func (f *encFnInfo) kSlice(rv reflect.Value) { // for i := 0; i < l; i++ { // bs[i] = byte(rv.Index(i).Uint()) // } - f.e.e.EncodeStringBytes(c_RAW, bs) + e.e.EncodeStringBytes(c_RAW, bs) } case seqTypeSlice: - f.e.e.EncodeStringBytes(c_RAW, rv.Bytes()) + e.e.EncodeStringBytes(c_RAW, rv.Bytes()) case seqTypeChan: - bs := f.e.b[:0] + bs := e.b[:0] // do not use range, so that the number of elements encoded // does not change, and encoding does not hang waiting on someone to close chan. // for b := range rv.Interface().(<-chan byte) { @@ -429,22 +442,21 @@ func (f *encFnInfo) kSlice(rv reflect.Value) { for i := 0; i < l; i++ { bs = append(bs, <-ch) } - f.e.e.EncodeStringBytes(c_RAW, bs) + e.e.EncodeStringBytes(c_RAW, bs) } return } if ti.mbs { if l%2 == 1 { - f.e.errorf("mapBySlice requires even slice length, but got %v", l) + e.errorf("mapBySlice requires even slice length, but got %v", l) return } - f.e.e.EncodeMapStart(l / 2) + e.e.EncodeMapStart(l / 2) } else { - f.e.e.EncodeArrayStart(l) + e.e.EncodeArrayStart(l) } - e := f.e if l > 0 { for rtelem.Kind() == reflect.Ptr { rtelem = rtelem.Elem() @@ -459,29 +471,48 @@ func (f *encFnInfo) kSlice(rv reflect.Value) { } // TODO: Consider perf implication of encoding odd index values as symbols if type is string for j := 0; j < l; j++ { + if cr != nil { + if ti.mbs { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } else { + cr.sendContainerState(containerArrayElem) + } + } if f.seq == seqTypeChan { if rv2, ok2 := rv.Recv(); ok2 { e.encodeValue(rv2, fn) + } else { + e.encode(nil) // WE HAVE TO DO SOMETHING, so nil if nothing received. } } else { e.encodeValue(rv.Index(j), fn) } } - } - f.e.e.EncodeEnd() + if cr != nil { + if ti.mbs { + cr.sendContainerState(containerMapEnd) + } else { + cr.sendContainerState(containerArrayEnd) + } + } } func (f *encFnInfo) kStruct(rv reflect.Value) { fti := f.ti e := f.e + cr := e.cr tisfi := fti.sfip toMap := !(fti.toArray || e.h.StructToArray) newlen := len(fti.sfi) // Use sync.Pool to reduce allocating slices unnecessarily. - // The cost of the occasional locking is less than the cost of locking. + // The cost of sync.Pool is less than the cost of new allocation. pool, poolv, fkvs := encStructPoolGet(newlen) // if toMap, use the sorted array. If toArray, use unsorted array (to match sequence in struct) @@ -492,11 +523,6 @@ func (f *encFnInfo) kStruct(rv reflect.Value) { var kv stringRv for _, si := range tisfi { kv.r = si.field(rv, false) - // if si.i != -1 { - // rvals[newlen] = rv.Field(int(si.i)) - // } else { - // rvals[newlen] = rv.FieldByIndex(si.is) - // } if toMap { if si.omitEmpty && isEmptyValue(kv.r) { continue @@ -519,7 +545,7 @@ func (f *encFnInfo) kStruct(rv reflect.Value) { // debugf(">>>> kStruct: newlen: %v", newlen) // sep := !e.be - ee := f.e.e //don't dereference everytime + ee := e.e //don't dereference everytime if toMap { ee.EncodeMapStart(newlen) @@ -527,21 +553,35 @@ func (f *encFnInfo) kStruct(rv reflect.Value) { asSymbols := e.h.AsSymbols == AsSymbolDefault || e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0 for j := 0; j < newlen; j++ { kv = fkvs[j] + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(kv.v) } else { ee.EncodeString(c_UTF8, kv.v) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(kv.r, nil) } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } else { ee.EncodeArrayStart(newlen) for j := 0; j < newlen; j++ { kv = fkvs[j] + if cr != nil { + cr.sendContainerState(containerArrayElem) + } e.encodeValue(kv.r, nil) } + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } } - ee.EncodeEnd() // do not use defer. Instead, use explicit pool return at end of function. // defer has a cost we are trying to avoid. @@ -560,13 +600,15 @@ func (f *encFnInfo) kStruct(rv reflect.Value) { // f.e.encodeValue(rv.Elem()) // } -func (f *encFnInfo) kInterface(rv reflect.Value) { - if rv.IsNil() { - f.e.e.EncodeNil() - return - } - f.e.encodeValue(rv.Elem(), nil) -} +// func (f *encFnInfo) kInterface(rv reflect.Value) { +// println("kInterface called") +// debug.PrintStack() +// if rv.IsNil() { +// f.e.e.EncodeNil() +// return +// } +// f.e.encodeValue(rv.Elem(), nil) +// } func (f *encFnInfo) kMap(rv reflect.Value) { ee := f.e.e @@ -578,8 +620,11 @@ func (f *encFnInfo) kMap(rv reflect.Value) { l := rv.Len() ee.EncodeMapStart(l) e := f.e + cr := e.cr if l == 0 { - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } return } var asSymbols bool @@ -622,6 +667,9 @@ func (f *encFnInfo) kMap(rv reflect.Value) { e.kMapCanonical(rtkeyid, rtkey, rv, mks, valFn, asSymbols) } else { for j := range mks { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if keyTypeIsString { if asSymbols { ee.EncodeSymbol(mks[j].String()) @@ -631,15 +679,20 @@ func (f *encFnInfo) kMap(rv reflect.Value) { } else { e.encodeValue(mks[j], keyFn) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(rv.MapIndex(mks[j]), valFn) } } - - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect.Value, mks []reflect.Value, valFn *encFn, asSymbols bool) { ee := e.e + cr := e.cr // we previously did out-of-band if an extension was registered. // This is not necessary, as the natural kind is sufficient for ordering. @@ -652,7 +705,13 @@ func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect. } sort.Sort(bytesRvSlice(mksv)) for i := range mksv { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeStringBytes(c_RAW, mksv[i].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(rv.MapIndex(mksv[i].r), valFn) } } else { @@ -666,7 +725,13 @@ func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect. } sort.Sort(boolRvSlice(mksv)) for i := range mksv { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(mksv[i].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(rv.MapIndex(mksv[i].r), valFn) } case reflect.String: @@ -678,11 +743,17 @@ func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect. } sort.Sort(stringRvSlice(mksv)) for i := range mksv { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(mksv[i].v) } else { ee.EncodeString(c_UTF8, mksv[i].v) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(rv.MapIndex(mksv[i].r), valFn) } case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint, reflect.Uintptr: @@ -694,7 +765,13 @@ func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect. } sort.Sort(uintRvSlice(mksv)) for i := range mksv { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(mksv[i].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(rv.MapIndex(mksv[i].r), valFn) } case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: @@ -706,7 +783,13 @@ func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect. } sort.Sort(intRvSlice(mksv)) for i := range mksv { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(mksv[i].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(rv.MapIndex(mksv[i].r), valFn) } case reflect.Float32: @@ -718,7 +801,13 @@ func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect. } sort.Sort(floatRvSlice(mksv)) for i := range mksv { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(mksv[i].v)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(rv.MapIndex(mksv[i].r), valFn) } case reflect.Float64: @@ -730,7 +819,13 @@ func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect. } sort.Sort(floatRvSlice(mksv)) for i := range mksv { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(mksv[i].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(rv.MapIndex(mksv[i].r), valFn) } default: @@ -749,7 +844,13 @@ func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect. } sort.Sort(bytesRvSlice(mksbv)) for j := range mksbv { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(mksbv[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encodeValue(rv.MapIndex(mksbv[j].r), valFn) } } @@ -782,17 +883,21 @@ type Encoder struct { // as the handler MAY need to do some coordination. w encWriter s []encRtidFn + ci set be bool // is binary encoding js bool // is json handle wi ioEncWriter wb bytesEncWriter - h *BasicHandle - as encDriverAsis + h *BasicHandle hh Handle - f map[uintptr]*encFn - b [scratchByteArrayLen]byte + + cr containerStateRecv + as encDriverAsis + + f map[uintptr]*encFn + b [scratchByteArrayLen]byte } // NewEncoder returns an Encoder for encoding into an io.Writer. @@ -800,20 +905,8 @@ type Encoder struct { // For efficiency, Users are encouraged to pass in a memory buffered writer // (eg bufio.Writer, bytes.Buffer). func NewEncoder(w io.Writer, h Handle) *Encoder { - e := &Encoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()} - ww, ok := w.(ioEncWriterWriter) - if !ok { - sww := simpleIoEncWriterWriter{w: w} - sww.bw, _ = w.(io.ByteWriter) - sww.sw, _ = w.(ioEncStringWriter) - ww = &sww - //ww = bufio.NewWriterSize(w, defEncByteBufSize) - } - e.wi.w = ww - e.w = &e.wi - _, e.js = h.(*JsonHandle) - e.e = h.newEncDriver(e) - e.as, _ = e.e.(encDriverAsis) + e := newEncoder(h) + e.Reset(w) return e } @@ -823,19 +916,56 @@ func NewEncoder(w io.Writer, h Handle) *Encoder { // It will potentially replace the output byte slice pointed to. // After encoding, the out parameter contains the encoded contents. func NewEncoderBytes(out *[]byte, h Handle) *Encoder { + e := newEncoder(h) + e.ResetBytes(out) + return e +} + +func newEncoder(h Handle) *Encoder { e := &Encoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()} + _, e.js = h.(*JsonHandle) + e.e = h.newEncDriver(e) + e.as, _ = e.e.(encDriverAsis) + e.cr, _ = e.e.(containerStateRecv) + return e +} + +// Reset the Encoder with a new output stream. +// +// This accomodates using the state of the Encoder, +// where it has "cached" information about sub-engines. +func (e *Encoder) Reset(w io.Writer) { + ww, ok := w.(ioEncWriterWriter) + if ok { + e.wi.w = ww + } else { + sww := &e.wi.s + sww.w = w + sww.bw, _ = w.(io.ByteWriter) + sww.sw, _ = w.(ioEncStringWriter) + e.wi.w = sww + //ww = bufio.NewWriterSize(w, defEncByteBufSize) + } + e.w = &e.wi + e.e.reset() +} + +func (e *Encoder) ResetBytes(out *[]byte) { in := *out if in == nil { in = make([]byte, defEncByteBufSize) } - e.wb.b, e.wb.out = in, out + e.wb.b, e.wb.out, e.wb.c = in, out, 0 e.w = &e.wb - _, e.js = h.(*JsonHandle) - e.e = h.newEncDriver(e) - e.as, _ = e.e.(encDriverAsis) - return e + e.e.reset() } +// func (e *Encoder) sendContainerState(c containerState) { +// if e.cr != nil { +// e.cr.sendContainerState(c) +// } +// } + // Encode writes an object into a stream. // // Encoding can be configured via the struct tag for the fields. @@ -1010,50 +1140,73 @@ func (e *Encoder) encode(iv interface{}) { } } -func (e *Encoder) encodeI(iv interface{}, checkFastpath, checkCodecSelfer bool) { - if rv, proceed := e.preEncodeValue(reflect.ValueOf(iv)); proceed { - rt := rv.Type() - rtid := reflect.ValueOf(rt).Pointer() - fn := e.getEncFn(rtid, rt, checkFastpath, checkCodecSelfer) - fn.f(&fn.i, rv) - } -} - -func (e *Encoder) preEncodeValue(rv reflect.Value) (rv2 reflect.Value, proceed bool) { -LOOP: - for { - switch rv.Kind() { - case reflect.Ptr, reflect.Interface: - if rv.IsNil() { - e.e.EncodeNil() - return - } - rv = rv.Elem() - continue LOOP - case reflect.Slice, reflect.Map: - if rv.IsNil() { - e.e.EncodeNil() - return - } - case reflect.Invalid, reflect.Func: +func (e *Encoder) preEncodeValue(rv reflect.Value) (rv2 reflect.Value, sptr uintptr, proceed bool) { + // use a goto statement instead of a recursive function for ptr/interface. +TOP: + switch rv.Kind() { + case reflect.Ptr: + if rv.IsNil() { e.e.EncodeNil() return } - break + rv = rv.Elem() + if e.h.CheckCircularRef && rv.Kind() == reflect.Struct { + // TODO: Movable pointers will be an issue here. Future problem. + sptr = rv.UnsafeAddr() + break TOP + } + goto TOP + case reflect.Interface: + if rv.IsNil() { + e.e.EncodeNil() + return + } + rv = rv.Elem() + goto TOP + case reflect.Slice, reflect.Map: + if rv.IsNil() { + e.e.EncodeNil() + return + } + case reflect.Invalid, reflect.Func: + e.e.EncodeNil() + return } - return rv, true + proceed = true + rv2 = rv + return +} + +func (e *Encoder) doEncodeValue(rv reflect.Value, fn *encFn, sptr uintptr, + checkFastpath, checkCodecSelfer bool) { + if sptr != 0 { + if (&e.ci).add(sptr) { + e.errorf("circular reference found: # %d", sptr) + } + } + if fn == nil { + rt := rv.Type() + rtid := reflect.ValueOf(rt).Pointer() + // fn = e.getEncFn(rtid, rt, true, true) + fn = e.getEncFn(rtid, rt, checkFastpath, checkCodecSelfer) + } + fn.f(&fn.i, rv) + if sptr != 0 { + (&e.ci).remove(sptr) + } +} + +func (e *Encoder) encodeI(iv interface{}, checkFastpath, checkCodecSelfer bool) { + if rv, sptr, proceed := e.preEncodeValue(reflect.ValueOf(iv)); proceed { + e.doEncodeValue(rv, nil, sptr, checkFastpath, checkCodecSelfer) + } } func (e *Encoder) encodeValue(rv reflect.Value, fn *encFn) { // if a valid fn is passed, it MUST BE for the dereferenced type of rv - if rv, proceed := e.preEncodeValue(rv); proceed { - if fn == nil { - rt := rv.Type() - rtid := reflect.ValueOf(rt).Pointer() - fn = e.getEncFn(rtid, rt, true, true) - } - fn.f(&fn.i, rv) + if rv, sptr, proceed := e.preEncodeValue(rv); proceed { + e.doEncodeValue(rv, fn, sptr, true, true) } } @@ -1113,7 +1266,7 @@ func (e *Encoder) getEncFn(rtid uintptr, rt reflect.Type, checkFastpath, checkCo } else { rk := rt.Kind() if fastpathEnabled && checkFastpath && (rk == reflect.Map || rk == reflect.Slice) { - if rt.PkgPath() == "" { + if rt.PkgPath() == "" { // un-named slice or map if idx := fastpathAV.index(rtid); idx != -1 { fn.f = fastpathAV[idx].encfn } @@ -1163,10 +1316,11 @@ func (e *Encoder) getEncFn(rtid uintptr, rt reflect.Type, checkFastpath, checkCo fn.f = (*encFnInfo).kSlice case reflect.Struct: fn.f = (*encFnInfo).kStruct + // reflect.Ptr and reflect.Interface are handled already by preEncodeValue // case reflect.Ptr: // fn.f = (*encFnInfo).kPtr - case reflect.Interface: - fn.f = (*encFnInfo).kInterface + // case reflect.Interface: + // fn.f = (*encFnInfo).kInterface case reflect.Map: fn.f = (*encFnInfo).kMap default: @@ -1232,25 +1386,6 @@ func encStructPoolGet(newlen int) (p *sync.Pool, v interface{}, s []stringRv) { // panic(errors.New("encStructPoolLen must be equal to 4")) // defensive, in case it is changed // } // idxpool := newlen / 8 - - // if pool == nil { - // fkvs = make([]stringRv, newlen) - // } else { - // poolv = pool.Get() - // switch vv := poolv.(type) { - // case *[8]stringRv: - // fkvs = vv[:newlen] - // case *[16]stringRv: - // fkvs = vv[:newlen] - // case *[32]stringRv: - // fkvs = vv[:newlen] - // case *[64]stringRv: - // fkvs = vv[:newlen] - // case *[128]stringRv: - // fkvs = vv[:newlen] - // } - // } - if newlen <= 8 { p = &encStructPool[0] v = p.Get() diff --git a/vendor/github.com/ugorji/go/codec/fast-path.generated.go b/vendor/github.com/ugorji/go/codec/fast-path.generated.go index cb5d6a694..cf6e00df2 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.generated.go +++ b/vendor/github.com/ugorji/go/codec/fast-path.generated.go @@ -1,4 +1,4 @@ -// //+build ignore +// +build !notfastpath // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. @@ -373,6 +373,9 @@ func init() { // -- -- fast path type switch func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { + if !fastpathEnabled { + return false + } switch v := iv.(type) { case []interface{}: @@ -1731,12 +1734,16 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncMapBoolBoolV(*v, fastpathCheckNilTrue, e) default: + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true } func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { + if !fastpathEnabled { + return false + } switch v := iv.(type) { case []interface{}: @@ -1815,12 +1822,16 @@ func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceBoolV(*v, fastpathCheckNilTrue, e) default: + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true } func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { + if !fastpathEnabled { + return false + } switch v := iv.(type) { case map[interface{}]interface{}: @@ -3113,243 +3124,798 @@ func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { // -- -- fast path functions func (f *encFnInfo) fastpathEncSliceIntfR(rv reflect.Value) { - fastpathTV.EncSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceIntfV(v []interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } e.encode(v2) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + e.encode(v2) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceStringR(rv reflect.Value) { - fastpathTV.EncSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceStringV(v []string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeString(c_UTF8, v2) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceStringV(v []string, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeString(c_UTF8, v2) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceFloat32R(rv reflect.Value) { - fastpathTV.EncSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceFloat32V(v []float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeFloat32(v2) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeFloat32(v2) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceFloat64R(rv reflect.Value) { - fastpathTV.EncSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceFloat64V(v []float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeFloat64(v2) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeFloat64(v2) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceUintR(rv reflect.Value) { - fastpathTV.EncSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceUintV(v []uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeUint(uint64(v2)) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceUintV(v []uint, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeUint(uint64(v2)) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceUint16R(rv reflect.Value) { - fastpathTV.EncSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceUint16V(v []uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeUint(uint64(v2)) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeUint(uint64(v2)) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceUint32R(rv reflect.Value) { - fastpathTV.EncSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceUint32V(v []uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeUint(uint64(v2)) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeUint(uint64(v2)) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceUint64R(rv reflect.Value) { - fastpathTV.EncSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceUint64V(v []uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeUint(uint64(v2)) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeUint(uint64(v2)) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceUintptrR(rv reflect.Value) { - fastpathTV.EncSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } e.encode(v2) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + e.encode(v2) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceIntR(rv reflect.Value) { - fastpathTV.EncSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceIntV(v []int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeInt(int64(v2)) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceIntV(v []int, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeInt(int64(v2)) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceInt8R(rv reflect.Value) { - fastpathTV.EncSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceInt8V(v []int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeInt(int64(v2)) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceInt8V(v []int8, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeInt(int64(v2)) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceInt16R(rv reflect.Value) { - fastpathTV.EncSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceInt16V(v []int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeInt(int64(v2)) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceInt16V(v []int16, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeInt(int64(v2)) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceInt32R(rv reflect.Value) { - fastpathTV.EncSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceInt32V(v []int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeInt(int64(v2)) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceInt32V(v []int32, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeInt(int64(v2)) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceInt64R(rv reflect.Value) { - fastpathTV.EncSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceInt64V(v []int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeInt(int64(v2)) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceInt64V(v []int64, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeInt(int64(v2)) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncSliceBoolR(rv reflect.Value) { - fastpathTV.EncSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.EncAsMapSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.EncSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) EncSliceBoolV(v []bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { + cr.sendContainerState(containerArrayElem) + } ee.EncodeBool(v2) } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerArrayEnd) + } +} + +func (_ fastpathT) EncAsMapSliceBoolV(v []bool, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + ee.EncodeBool(v2) + } + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfIntfR(rv reflect.Value) { @@ -3357,6 +3923,7 @@ func (f *encFnInfo) fastpathEncMapIntfIntfR(rv reflect.Value) { } func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3378,16 +3945,30 @@ func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfStringR(rv reflect.Value) { @@ -3395,6 +3976,7 @@ func (f *encFnInfo) fastpathEncMapIntfStringR(rv reflect.Value) { } func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3416,16 +3998,30 @@ func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, checkNil bool, e } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfUintR(rv reflect.Value) { @@ -3433,6 +4029,7 @@ func (f *encFnInfo) fastpathEncMapIntfUintR(rv reflect.Value) { } func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3454,16 +4051,30 @@ func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, checkNil bool, e *Enc } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfUint8R(rv reflect.Value) { @@ -3471,6 +4082,7 @@ func (f *encFnInfo) fastpathEncMapIntfUint8R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3492,16 +4104,30 @@ func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, checkNil bool, e *E } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfUint16R(rv reflect.Value) { @@ -3509,6 +4135,7 @@ func (f *encFnInfo) fastpathEncMapIntfUint16R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3530,16 +4157,30 @@ func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, checkNil bool, e } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfUint32R(rv reflect.Value) { @@ -3547,6 +4188,7 @@ func (f *encFnInfo) fastpathEncMapIntfUint32R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3568,16 +4210,30 @@ func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, checkNil bool, e } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfUint64R(rv reflect.Value) { @@ -3585,6 +4241,7 @@ func (f *encFnInfo) fastpathEncMapIntfUint64R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3606,16 +4263,30 @@ func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, checkNil bool, e } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfUintptrR(rv reflect.Value) { @@ -3623,6 +4294,7 @@ func (f *encFnInfo) fastpathEncMapIntfUintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3644,16 +4316,30 @@ func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfIntR(rv reflect.Value) { @@ -3661,6 +4347,7 @@ func (f *encFnInfo) fastpathEncMapIntfIntR(rv reflect.Value) { } func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3682,16 +4369,30 @@ func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, checkNil bool, e *Encod } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfInt8R(rv reflect.Value) { @@ -3699,6 +4400,7 @@ func (f *encFnInfo) fastpathEncMapIntfInt8R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3720,16 +4422,30 @@ func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, checkNil bool, e *Enc } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfInt16R(rv reflect.Value) { @@ -3737,6 +4453,7 @@ func (f *encFnInfo) fastpathEncMapIntfInt16R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3758,16 +4475,30 @@ func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, checkNil bool, e *E } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfInt32R(rv reflect.Value) { @@ -3775,6 +4506,7 @@ func (f *encFnInfo) fastpathEncMapIntfInt32R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3796,16 +4528,30 @@ func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, checkNil bool, e *E } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfInt64R(rv reflect.Value) { @@ -3813,6 +4559,7 @@ func (f *encFnInfo) fastpathEncMapIntfInt64R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3834,16 +4581,30 @@ func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, checkNil bool, e *E } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfFloat32R(rv reflect.Value) { @@ -3851,6 +4612,7 @@ func (f *encFnInfo) fastpathEncMapIntfFloat32R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3872,16 +4634,30 @@ func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, checkNil bool, } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfFloat64R(rv reflect.Value) { @@ -3889,6 +4665,7 @@ func (f *encFnInfo) fastpathEncMapIntfFloat64R(rv reflect.Value) { } func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3910,16 +4687,30 @@ func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, checkNil bool, } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntfBoolR(rv reflect.Value) { @@ -3927,6 +4718,7 @@ func (f *encFnInfo) fastpathEncMapIntfBoolR(rv reflect.Value) { } func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3948,16 +4740,30 @@ func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, checkNil bool, e *Enc } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.asis(v2[j].v) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[v2[j].i]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringIntfR(rv reflect.Value) { @@ -3965,6 +4771,7 @@ func (f *encFnInfo) fastpathEncMapStringIntfR(rv reflect.Value) { } func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -3980,24 +4787,38 @@ func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, checkNil bool, e } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[string(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringStringR(rv reflect.Value) { @@ -4005,6 +4826,7 @@ func (f *encFnInfo) fastpathEncMapStringStringR(rv reflect.Value) { } func (_ fastpathT) EncMapStringStringV(v map[string]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4020,24 +4842,38 @@ func (_ fastpathT) EncMapStringStringV(v map[string]string, checkNil bool, e *En } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[string(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringUintR(rv reflect.Value) { @@ -4045,6 +4881,7 @@ func (f *encFnInfo) fastpathEncMapStringUintR(rv reflect.Value) { } func (_ fastpathT) EncMapStringUintV(v map[string]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4060,24 +4897,38 @@ func (_ fastpathT) EncMapStringUintV(v map[string]uint, checkNil bool, e *Encode } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringUint8R(rv reflect.Value) { @@ -4085,6 +4936,7 @@ func (f *encFnInfo) fastpathEncMapStringUint8R(rv reflect.Value) { } func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4100,24 +4952,38 @@ func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, checkNil bool, e *Enco } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringUint16R(rv reflect.Value) { @@ -4125,6 +4991,7 @@ func (f *encFnInfo) fastpathEncMapStringUint16R(rv reflect.Value) { } func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4140,24 +5007,38 @@ func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, checkNil bool, e *En } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringUint32R(rv reflect.Value) { @@ -4165,6 +5046,7 @@ func (f *encFnInfo) fastpathEncMapStringUint32R(rv reflect.Value) { } func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4180,24 +5062,38 @@ func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, checkNil bool, e *En } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringUint64R(rv reflect.Value) { @@ -4205,6 +5101,7 @@ func (f *encFnInfo) fastpathEncMapStringUint64R(rv reflect.Value) { } func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4220,24 +5117,38 @@ func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, checkNil bool, e *En } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringUintptrR(rv reflect.Value) { @@ -4245,6 +5156,7 @@ func (f *encFnInfo) fastpathEncMapStringUintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4260,24 +5172,38 @@ func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, checkNil bool, e * } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[string(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringIntR(rv reflect.Value) { @@ -4285,6 +5211,7 @@ func (f *encFnInfo) fastpathEncMapStringIntR(rv reflect.Value) { } func (_ fastpathT) EncMapStringIntV(v map[string]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4300,24 +5227,38 @@ func (_ fastpathT) EncMapStringIntV(v map[string]int, checkNil bool, e *Encoder) } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringInt8R(rv reflect.Value) { @@ -4325,6 +5266,7 @@ func (f *encFnInfo) fastpathEncMapStringInt8R(rv reflect.Value) { } func (_ fastpathT) EncMapStringInt8V(v map[string]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4340,24 +5282,38 @@ func (_ fastpathT) EncMapStringInt8V(v map[string]int8, checkNil bool, e *Encode } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringInt16R(rv reflect.Value) { @@ -4365,6 +5321,7 @@ func (f *encFnInfo) fastpathEncMapStringInt16R(rv reflect.Value) { } func (_ fastpathT) EncMapStringInt16V(v map[string]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4380,24 +5337,38 @@ func (_ fastpathT) EncMapStringInt16V(v map[string]int16, checkNil bool, e *Enco } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringInt32R(rv reflect.Value) { @@ -4405,6 +5376,7 @@ func (f *encFnInfo) fastpathEncMapStringInt32R(rv reflect.Value) { } func (_ fastpathT) EncMapStringInt32V(v map[string]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4420,24 +5392,38 @@ func (_ fastpathT) EncMapStringInt32V(v map[string]int32, checkNil bool, e *Enco } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringInt64R(rv reflect.Value) { @@ -4445,6 +5431,7 @@ func (f *encFnInfo) fastpathEncMapStringInt64R(rv reflect.Value) { } func (_ fastpathT) EncMapStringInt64V(v map[string]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4460,24 +5447,38 @@ func (_ fastpathT) EncMapStringInt64V(v map[string]int64, checkNil bool, e *Enco } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[string(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringFloat32R(rv reflect.Value) { @@ -4485,6 +5486,7 @@ func (f *encFnInfo) fastpathEncMapStringFloat32R(rv reflect.Value) { } func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4500,24 +5502,38 @@ func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, checkNil bool, e * } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[string(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringFloat64R(rv reflect.Value) { @@ -4525,6 +5541,7 @@ func (f *encFnInfo) fastpathEncMapStringFloat64R(rv reflect.Value) { } func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4540,24 +5557,38 @@ func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, checkNil bool, e * } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[string(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapStringBoolR(rv reflect.Value) { @@ -4565,6 +5596,7 @@ func (f *encFnInfo) fastpathEncMapStringBoolR(rv reflect.Value) { } func (_ fastpathT) EncMapStringBoolV(v map[string]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4580,24 +5612,38 @@ func (_ fastpathT) EncMapStringBoolV(v map[string]bool, checkNil bool, e *Encode } sort.Sort(stringSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[string(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32IntfR(rv reflect.Value) { @@ -4605,6 +5651,7 @@ func (f *encFnInfo) fastpathEncMapFloat32IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4619,16 +5666,30 @@ func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, checkNil bool, } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[float32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32StringR(rv reflect.Value) { @@ -4636,6 +5697,7 @@ func (f *encFnInfo) fastpathEncMapFloat32StringR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4650,16 +5712,30 @@ func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, checkNil bool, e * } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[float32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32UintR(rv reflect.Value) { @@ -4667,6 +5743,7 @@ func (f *encFnInfo) fastpathEncMapFloat32UintR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4681,16 +5758,30 @@ func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, checkNil bool, e *Enco } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Uint8R(rv reflect.Value) { @@ -4698,6 +5789,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4712,16 +5804,30 @@ func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, checkNil bool, e *En } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Uint16R(rv reflect.Value) { @@ -4729,6 +5835,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4743,16 +5850,30 @@ func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, checkNil bool, e * } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Uint32R(rv reflect.Value) { @@ -4760,6 +5881,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4774,16 +5896,30 @@ func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, checkNil bool, e * } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Uint64R(rv reflect.Value) { @@ -4791,6 +5927,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4805,16 +5942,30 @@ func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, checkNil bool, e * } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32UintptrR(rv reflect.Value) { @@ -4822,6 +5973,7 @@ func (f *encFnInfo) fastpathEncMapFloat32UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4836,16 +5988,30 @@ func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, e } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[float32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32IntR(rv reflect.Value) { @@ -4853,6 +6019,7 @@ func (f *encFnInfo) fastpathEncMapFloat32IntR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4867,16 +6034,30 @@ func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, checkNil bool, e *Encode } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Int8R(rv reflect.Value) { @@ -4884,6 +6065,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4898,16 +6080,30 @@ func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, checkNil bool, e *Enco } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Int16R(rv reflect.Value) { @@ -4915,6 +6111,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4929,16 +6126,30 @@ func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, checkNil bool, e *En } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Int32R(rv reflect.Value) { @@ -4946,6 +6157,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4960,16 +6172,30 @@ func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, checkNil bool, e *En } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Int64R(rv reflect.Value) { @@ -4977,6 +6203,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -4991,16 +6218,30 @@ func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, checkNil bool, e *En } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Float32R(rv reflect.Value) { @@ -5008,6 +6249,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5022,16 +6264,30 @@ func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, checkNil bool, e } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[float32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32Float64R(rv reflect.Value) { @@ -5039,6 +6295,7 @@ func (f *encFnInfo) fastpathEncMapFloat32Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5053,16 +6310,30 @@ func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, checkNil bool, e } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[float32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat32BoolR(rv reflect.Value) { @@ -5070,6 +6341,7 @@ func (f *encFnInfo) fastpathEncMapFloat32BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5084,16 +6356,30 @@ func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, checkNil bool, e *Enco } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(float32(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[float32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat32(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64IntfR(rv reflect.Value) { @@ -5101,6 +6387,7 @@ func (f *encFnInfo) fastpathEncMapFloat64IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5115,16 +6402,30 @@ func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, checkNil bool, } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[float64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64StringR(rv reflect.Value) { @@ -5132,6 +6433,7 @@ func (f *encFnInfo) fastpathEncMapFloat64StringR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5146,16 +6448,30 @@ func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, checkNil bool, e * } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[float64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64UintR(rv reflect.Value) { @@ -5163,6 +6479,7 @@ func (f *encFnInfo) fastpathEncMapFloat64UintR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5177,16 +6494,30 @@ func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, checkNil bool, e *Enco } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Uint8R(rv reflect.Value) { @@ -5194,6 +6525,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5208,16 +6540,30 @@ func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, checkNil bool, e *En } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Uint16R(rv reflect.Value) { @@ -5225,6 +6571,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5239,16 +6586,30 @@ func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, checkNil bool, e * } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Uint32R(rv reflect.Value) { @@ -5256,6 +6617,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5270,16 +6632,30 @@ func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, checkNil bool, e * } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Uint64R(rv reflect.Value) { @@ -5287,6 +6663,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5301,16 +6678,30 @@ func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, checkNil bool, e * } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64UintptrR(rv reflect.Value) { @@ -5318,6 +6709,7 @@ func (f *encFnInfo) fastpathEncMapFloat64UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5332,16 +6724,30 @@ func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, e } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[float64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64IntR(rv reflect.Value) { @@ -5349,6 +6755,7 @@ func (f *encFnInfo) fastpathEncMapFloat64IntR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5363,16 +6770,30 @@ func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, checkNil bool, e *Encode } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Int8R(rv reflect.Value) { @@ -5380,6 +6801,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5394,16 +6816,30 @@ func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, checkNil bool, e *Enco } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Int16R(rv reflect.Value) { @@ -5411,6 +6847,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5425,16 +6862,30 @@ func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, checkNil bool, e *En } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Int32R(rv reflect.Value) { @@ -5442,6 +6893,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5456,16 +6908,30 @@ func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, checkNil bool, e *En } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Int64R(rv reflect.Value) { @@ -5473,6 +6939,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5487,16 +6954,30 @@ func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, checkNil bool, e *En } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[float64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Float32R(rv reflect.Value) { @@ -5504,6 +6985,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5518,16 +7000,30 @@ func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, checkNil bool, e } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[float64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64Float64R(rv reflect.Value) { @@ -5535,6 +7031,7 @@ func (f *encFnInfo) fastpathEncMapFloat64Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5549,16 +7046,30 @@ func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, checkNil bool, e } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[float64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapFloat64BoolR(rv reflect.Value) { @@ -5566,6 +7077,7 @@ func (f *encFnInfo) fastpathEncMapFloat64BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5580,16 +7092,30 @@ func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, checkNil bool, e *Enco } sort.Sort(floatSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(float64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[float64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeFloat64(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintIntfR(rv reflect.Value) { @@ -5597,6 +7123,7 @@ func (f *encFnInfo) fastpathEncMapUintIntfR(rv reflect.Value) { } func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5611,16 +7138,30 @@ func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, checkNil bool, e *Enc } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintStringR(rv reflect.Value) { @@ -5628,6 +7169,7 @@ func (f *encFnInfo) fastpathEncMapUintStringR(rv reflect.Value) { } func (_ fastpathT) EncMapUintStringV(v map[uint]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5642,16 +7184,30 @@ func (_ fastpathT) EncMapUintStringV(v map[uint]string, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[uint(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintUintR(rv reflect.Value) { @@ -5659,6 +7215,7 @@ func (f *encFnInfo) fastpathEncMapUintUintR(rv reflect.Value) { } func (_ fastpathT) EncMapUintUintV(v map[uint]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5673,16 +7230,30 @@ func (_ fastpathT) EncMapUintUintV(v map[uint]uint, checkNil bool, e *Encoder) { } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintUint8R(rv reflect.Value) { @@ -5690,6 +7261,7 @@ func (f *encFnInfo) fastpathEncMapUintUint8R(rv reflect.Value) { } func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5704,16 +7276,30 @@ func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintUint16R(rv reflect.Value) { @@ -5721,6 +7307,7 @@ func (f *encFnInfo) fastpathEncMapUintUint16R(rv reflect.Value) { } func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5735,16 +7322,30 @@ func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintUint32R(rv reflect.Value) { @@ -5752,6 +7353,7 @@ func (f *encFnInfo) fastpathEncMapUintUint32R(rv reflect.Value) { } func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5766,16 +7368,30 @@ func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintUint64R(rv reflect.Value) { @@ -5783,6 +7399,7 @@ func (f *encFnInfo) fastpathEncMapUintUint64R(rv reflect.Value) { } func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5797,16 +7414,30 @@ func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintUintptrR(rv reflect.Value) { @@ -5814,6 +7445,7 @@ func (f *encFnInfo) fastpathEncMapUintUintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5828,16 +7460,30 @@ func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintIntR(rv reflect.Value) { @@ -5845,6 +7491,7 @@ func (f *encFnInfo) fastpathEncMapUintIntR(rv reflect.Value) { } func (_ fastpathT) EncMapUintIntV(v map[uint]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5859,16 +7506,30 @@ func (_ fastpathT) EncMapUintIntV(v map[uint]int, checkNil bool, e *Encoder) { } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintInt8R(rv reflect.Value) { @@ -5876,6 +7537,7 @@ func (f *encFnInfo) fastpathEncMapUintInt8R(rv reflect.Value) { } func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5890,16 +7552,30 @@ func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, checkNil bool, e *Encoder) { } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintInt16R(rv reflect.Value) { @@ -5907,6 +7583,7 @@ func (f *encFnInfo) fastpathEncMapUintInt16R(rv reflect.Value) { } func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5921,16 +7598,30 @@ func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintInt32R(rv reflect.Value) { @@ -5938,6 +7629,7 @@ func (f *encFnInfo) fastpathEncMapUintInt32R(rv reflect.Value) { } func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5952,16 +7644,30 @@ func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintInt64R(rv reflect.Value) { @@ -5969,6 +7675,7 @@ func (f *encFnInfo) fastpathEncMapUintInt64R(rv reflect.Value) { } func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -5983,16 +7690,30 @@ func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintFloat32R(rv reflect.Value) { @@ -6000,6 +7721,7 @@ func (f *encFnInfo) fastpathEncMapUintFloat32R(rv reflect.Value) { } func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6014,16 +7736,30 @@ func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[uint(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintFloat64R(rv reflect.Value) { @@ -6031,6 +7767,7 @@ func (f *encFnInfo) fastpathEncMapUintFloat64R(rv reflect.Value) { } func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6045,16 +7782,30 @@ func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[uint(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintBoolR(rv reflect.Value) { @@ -6062,6 +7813,7 @@ func (f *encFnInfo) fastpathEncMapUintBoolR(rv reflect.Value) { } func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6076,16 +7828,30 @@ func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, checkNil bool, e *Encoder) { } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[uint(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8IntfR(rv reflect.Value) { @@ -6093,6 +7859,7 @@ func (f *encFnInfo) fastpathEncMapUint8IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6107,16 +7874,30 @@ func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, checkNil bool, e *E } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8StringR(rv reflect.Value) { @@ -6124,6 +7905,7 @@ func (f *encFnInfo) fastpathEncMapUint8StringR(rv reflect.Value) { } func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6138,16 +7920,30 @@ func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[uint8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8UintR(rv reflect.Value) { @@ -6155,6 +7951,7 @@ func (f *encFnInfo) fastpathEncMapUint8UintR(rv reflect.Value) { } func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6169,16 +7966,30 @@ func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Uint8R(rv reflect.Value) { @@ -6186,6 +7997,7 @@ func (f *encFnInfo) fastpathEncMapUint8Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6200,16 +8012,30 @@ func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Uint16R(rv reflect.Value) { @@ -6217,6 +8043,7 @@ func (f *encFnInfo) fastpathEncMapUint8Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6231,16 +8058,30 @@ func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Uint32R(rv reflect.Value) { @@ -6248,6 +8089,7 @@ func (f *encFnInfo) fastpathEncMapUint8Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6262,16 +8104,30 @@ func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Uint64R(rv reflect.Value) { @@ -6279,6 +8135,7 @@ func (f *encFnInfo) fastpathEncMapUint8Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6293,16 +8150,30 @@ func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8UintptrR(rv reflect.Value) { @@ -6310,6 +8181,7 @@ func (f *encFnInfo) fastpathEncMapUint8UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6324,16 +8196,30 @@ func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8IntR(rv reflect.Value) { @@ -6341,6 +8227,7 @@ func (f *encFnInfo) fastpathEncMapUint8IntR(rv reflect.Value) { } func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6355,16 +8242,30 @@ func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, checkNil bool, e *Encoder) { } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Int8R(rv reflect.Value) { @@ -6372,6 +8273,7 @@ func (f *encFnInfo) fastpathEncMapUint8Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6386,16 +8288,30 @@ func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Int16R(rv reflect.Value) { @@ -6403,6 +8319,7 @@ func (f *encFnInfo) fastpathEncMapUint8Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6417,16 +8334,30 @@ func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Int32R(rv reflect.Value) { @@ -6434,6 +8365,7 @@ func (f *encFnInfo) fastpathEncMapUint8Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6448,16 +8380,30 @@ func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Int64R(rv reflect.Value) { @@ -6465,6 +8411,7 @@ func (f *encFnInfo) fastpathEncMapUint8Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6479,16 +8426,30 @@ func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Float32R(rv reflect.Value) { @@ -6496,6 +8457,7 @@ func (f *encFnInfo) fastpathEncMapUint8Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6510,16 +8472,30 @@ func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[uint8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8Float64R(rv reflect.Value) { @@ -6527,6 +8503,7 @@ func (f *encFnInfo) fastpathEncMapUint8Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6541,16 +8518,30 @@ func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[uint8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint8BoolR(rv reflect.Value) { @@ -6558,6 +8549,7 @@ func (f *encFnInfo) fastpathEncMapUint8BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6572,16 +8564,30 @@ func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[uint8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16IntfR(rv reflect.Value) { @@ -6589,6 +8595,7 @@ func (f *encFnInfo) fastpathEncMapUint16IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6603,16 +8610,30 @@ func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, checkNil bool, e } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16StringR(rv reflect.Value) { @@ -6620,6 +8641,7 @@ func (f *encFnInfo) fastpathEncMapUint16StringR(rv reflect.Value) { } func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6634,16 +8656,30 @@ func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[uint16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16UintR(rv reflect.Value) { @@ -6651,6 +8687,7 @@ func (f *encFnInfo) fastpathEncMapUint16UintR(rv reflect.Value) { } func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6665,16 +8702,30 @@ func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Uint8R(rv reflect.Value) { @@ -6682,6 +8733,7 @@ func (f *encFnInfo) fastpathEncMapUint16Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6696,16 +8748,30 @@ func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Uint16R(rv reflect.Value) { @@ -6713,6 +8779,7 @@ func (f *encFnInfo) fastpathEncMapUint16Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6727,16 +8794,30 @@ func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Uint32R(rv reflect.Value) { @@ -6744,6 +8825,7 @@ func (f *encFnInfo) fastpathEncMapUint16Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6758,16 +8840,30 @@ func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Uint64R(rv reflect.Value) { @@ -6775,6 +8871,7 @@ func (f *encFnInfo) fastpathEncMapUint16Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6789,16 +8886,30 @@ func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16UintptrR(rv reflect.Value) { @@ -6806,6 +8917,7 @@ func (f *encFnInfo) fastpathEncMapUint16UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6820,16 +8932,30 @@ func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16IntR(rv reflect.Value) { @@ -6837,6 +8963,7 @@ func (f *encFnInfo) fastpathEncMapUint16IntR(rv reflect.Value) { } func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6851,16 +8978,30 @@ func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Int8R(rv reflect.Value) { @@ -6868,6 +9009,7 @@ func (f *encFnInfo) fastpathEncMapUint16Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6882,16 +9024,30 @@ func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Int16R(rv reflect.Value) { @@ -6899,6 +9055,7 @@ func (f *encFnInfo) fastpathEncMapUint16Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6913,16 +9070,30 @@ func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Int32R(rv reflect.Value) { @@ -6930,6 +9101,7 @@ func (f *encFnInfo) fastpathEncMapUint16Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6944,16 +9116,30 @@ func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Int64R(rv reflect.Value) { @@ -6961,6 +9147,7 @@ func (f *encFnInfo) fastpathEncMapUint16Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -6975,16 +9162,30 @@ func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Float32R(rv reflect.Value) { @@ -6992,6 +9193,7 @@ func (f *encFnInfo) fastpathEncMapUint16Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7006,16 +9208,30 @@ func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[uint16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16Float64R(rv reflect.Value) { @@ -7023,6 +9239,7 @@ func (f *encFnInfo) fastpathEncMapUint16Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7037,16 +9254,30 @@ func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[uint16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint16BoolR(rv reflect.Value) { @@ -7054,6 +9285,7 @@ func (f *encFnInfo) fastpathEncMapUint16BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7068,16 +9300,30 @@ func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[uint16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32IntfR(rv reflect.Value) { @@ -7085,6 +9331,7 @@ func (f *encFnInfo) fastpathEncMapUint32IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7099,16 +9346,30 @@ func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, checkNil bool, e } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32StringR(rv reflect.Value) { @@ -7116,6 +9377,7 @@ func (f *encFnInfo) fastpathEncMapUint32StringR(rv reflect.Value) { } func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7130,16 +9392,30 @@ func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[uint32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32UintR(rv reflect.Value) { @@ -7147,6 +9423,7 @@ func (f *encFnInfo) fastpathEncMapUint32UintR(rv reflect.Value) { } func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7161,16 +9438,30 @@ func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Uint8R(rv reflect.Value) { @@ -7178,6 +9469,7 @@ func (f *encFnInfo) fastpathEncMapUint32Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7192,16 +9484,30 @@ func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Uint16R(rv reflect.Value) { @@ -7209,6 +9515,7 @@ func (f *encFnInfo) fastpathEncMapUint32Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7223,16 +9530,30 @@ func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Uint32R(rv reflect.Value) { @@ -7240,6 +9561,7 @@ func (f *encFnInfo) fastpathEncMapUint32Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7254,16 +9576,30 @@ func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Uint64R(rv reflect.Value) { @@ -7271,6 +9607,7 @@ func (f *encFnInfo) fastpathEncMapUint32Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7285,16 +9622,30 @@ func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32UintptrR(rv reflect.Value) { @@ -7302,6 +9653,7 @@ func (f *encFnInfo) fastpathEncMapUint32UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7316,16 +9668,30 @@ func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32IntR(rv reflect.Value) { @@ -7333,6 +9699,7 @@ func (f *encFnInfo) fastpathEncMapUint32IntR(rv reflect.Value) { } func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7347,16 +9714,30 @@ func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Int8R(rv reflect.Value) { @@ -7364,6 +9745,7 @@ func (f *encFnInfo) fastpathEncMapUint32Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7378,16 +9760,30 @@ func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Int16R(rv reflect.Value) { @@ -7395,6 +9791,7 @@ func (f *encFnInfo) fastpathEncMapUint32Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7409,16 +9806,30 @@ func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Int32R(rv reflect.Value) { @@ -7426,6 +9837,7 @@ func (f *encFnInfo) fastpathEncMapUint32Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7440,16 +9852,30 @@ func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Int64R(rv reflect.Value) { @@ -7457,6 +9883,7 @@ func (f *encFnInfo) fastpathEncMapUint32Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7471,16 +9898,30 @@ func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Float32R(rv reflect.Value) { @@ -7488,6 +9929,7 @@ func (f *encFnInfo) fastpathEncMapUint32Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7502,16 +9944,30 @@ func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[uint32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32Float64R(rv reflect.Value) { @@ -7519,6 +9975,7 @@ func (f *encFnInfo) fastpathEncMapUint32Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7533,16 +9990,30 @@ func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[uint32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint32BoolR(rv reflect.Value) { @@ -7550,6 +10021,7 @@ func (f *encFnInfo) fastpathEncMapUint32BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7564,16 +10036,30 @@ func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[uint32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64IntfR(rv reflect.Value) { @@ -7581,6 +10067,7 @@ func (f *encFnInfo) fastpathEncMapUint64IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7595,16 +10082,30 @@ func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, checkNil bool, e } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64StringR(rv reflect.Value) { @@ -7612,6 +10113,7 @@ func (f *encFnInfo) fastpathEncMapUint64StringR(rv reflect.Value) { } func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7626,16 +10128,30 @@ func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[uint64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64UintR(rv reflect.Value) { @@ -7643,6 +10159,7 @@ func (f *encFnInfo) fastpathEncMapUint64UintR(rv reflect.Value) { } func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7657,16 +10174,30 @@ func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Uint8R(rv reflect.Value) { @@ -7674,6 +10205,7 @@ func (f *encFnInfo) fastpathEncMapUint64Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7688,16 +10220,30 @@ func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Uint16R(rv reflect.Value) { @@ -7705,6 +10251,7 @@ func (f *encFnInfo) fastpathEncMapUint64Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7719,16 +10266,30 @@ func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Uint32R(rv reflect.Value) { @@ -7736,6 +10297,7 @@ func (f *encFnInfo) fastpathEncMapUint64Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7750,16 +10312,30 @@ func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Uint64R(rv reflect.Value) { @@ -7767,6 +10343,7 @@ func (f *encFnInfo) fastpathEncMapUint64Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7781,16 +10358,30 @@ func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64UintptrR(rv reflect.Value) { @@ -7798,6 +10389,7 @@ func (f *encFnInfo) fastpathEncMapUint64UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7812,16 +10404,30 @@ func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uint64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64IntR(rv reflect.Value) { @@ -7829,6 +10435,7 @@ func (f *encFnInfo) fastpathEncMapUint64IntR(rv reflect.Value) { } func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7843,16 +10450,30 @@ func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, checkNil bool, e *Encoder) } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Int8R(rv reflect.Value) { @@ -7860,6 +10481,7 @@ func (f *encFnInfo) fastpathEncMapUint64Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7874,16 +10496,30 @@ func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Int16R(rv reflect.Value) { @@ -7891,6 +10527,7 @@ func (f *encFnInfo) fastpathEncMapUint64Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7905,16 +10542,30 @@ func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Int32R(rv reflect.Value) { @@ -7922,6 +10573,7 @@ func (f *encFnInfo) fastpathEncMapUint64Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7936,16 +10588,30 @@ func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Int64R(rv reflect.Value) { @@ -7953,6 +10619,7 @@ func (f *encFnInfo) fastpathEncMapUint64Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7967,16 +10634,30 @@ func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uint64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Float32R(rv reflect.Value) { @@ -7984,6 +10665,7 @@ func (f *encFnInfo) fastpathEncMapUint64Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -7998,16 +10680,30 @@ func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[uint64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64Float64R(rv reflect.Value) { @@ -8015,6 +10711,7 @@ func (f *encFnInfo) fastpathEncMapUint64Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8029,16 +10726,30 @@ func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[uint64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUint64BoolR(rv reflect.Value) { @@ -8046,6 +10757,7 @@ func (f *encFnInfo) fastpathEncMapUint64BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8060,16 +10772,30 @@ func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(uint64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[uint64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeUint(uint64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrIntfR(rv reflect.Value) { @@ -8077,6 +10803,7 @@ func (f *encFnInfo) fastpathEncMapUintptrIntfR(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8091,16 +10818,30 @@ func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uintptr(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrStringR(rv reflect.Value) { @@ -8108,6 +10849,7 @@ func (f *encFnInfo) fastpathEncMapUintptrStringR(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8122,16 +10864,30 @@ func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[uintptr(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrUintR(rv reflect.Value) { @@ -8139,6 +10895,7 @@ func (f *encFnInfo) fastpathEncMapUintptrUintR(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8153,16 +10910,30 @@ func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrUint8R(rv reflect.Value) { @@ -8170,6 +10941,7 @@ func (f *encFnInfo) fastpathEncMapUintptrUint8R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8184,16 +10956,30 @@ func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrUint16R(rv reflect.Value) { @@ -8201,6 +10987,7 @@ func (f *encFnInfo) fastpathEncMapUintptrUint16R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8215,16 +11002,30 @@ func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrUint32R(rv reflect.Value) { @@ -8232,6 +11033,7 @@ func (f *encFnInfo) fastpathEncMapUintptrUint32R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8246,16 +11048,30 @@ func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrUint64R(rv reflect.Value) { @@ -8263,6 +11079,7 @@ func (f *encFnInfo) fastpathEncMapUintptrUint64R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8277,16 +11094,30 @@ func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, e * } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrUintptrR(rv reflect.Value) { @@ -8294,6 +11125,7 @@ func (f *encFnInfo) fastpathEncMapUintptrUintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8308,16 +11140,30 @@ func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, e } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[uintptr(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrIntR(rv reflect.Value) { @@ -8325,6 +11171,7 @@ func (f *encFnInfo) fastpathEncMapUintptrIntR(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8339,16 +11186,30 @@ func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, checkNil bool, e *Encode } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrInt8R(rv reflect.Value) { @@ -8356,6 +11217,7 @@ func (f *encFnInfo) fastpathEncMapUintptrInt8R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8370,16 +11232,30 @@ func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrInt16R(rv reflect.Value) { @@ -8387,6 +11263,7 @@ func (f *encFnInfo) fastpathEncMapUintptrInt16R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8401,16 +11278,30 @@ func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrInt32R(rv reflect.Value) { @@ -8418,6 +11309,7 @@ func (f *encFnInfo) fastpathEncMapUintptrInt32R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8432,16 +11324,30 @@ func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrInt64R(rv reflect.Value) { @@ -8449,6 +11355,7 @@ func (f *encFnInfo) fastpathEncMapUintptrInt64R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8463,16 +11370,30 @@ func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, checkNil bool, e *En } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[uintptr(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrFloat32R(rv reflect.Value) { @@ -8480,6 +11401,7 @@ func (f *encFnInfo) fastpathEncMapUintptrFloat32R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8494,16 +11416,30 @@ func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, e } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[uintptr(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrFloat64R(rv reflect.Value) { @@ -8511,6 +11447,7 @@ func (f *encFnInfo) fastpathEncMapUintptrFloat64R(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8525,16 +11462,30 @@ func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, e } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[uintptr(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapUintptrBoolR(rv reflect.Value) { @@ -8542,6 +11493,7 @@ func (f *encFnInfo) fastpathEncMapUintptrBoolR(rv reflect.Value) { } func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8556,16 +11508,30 @@ func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, checkNil bool, e *Enco } sort.Sort(uintSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(uintptr(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[uintptr(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } e.encode(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntIntfR(rv reflect.Value) { @@ -8573,6 +11539,7 @@ func (f *encFnInfo) fastpathEncMapIntIntfR(rv reflect.Value) { } func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8587,16 +11554,30 @@ func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, checkNil bool, e *Encod } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntStringR(rv reflect.Value) { @@ -8604,6 +11585,7 @@ func (f *encFnInfo) fastpathEncMapIntStringR(rv reflect.Value) { } func (_ fastpathT) EncMapIntStringV(v map[int]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8618,16 +11600,30 @@ func (_ fastpathT) EncMapIntStringV(v map[int]string, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[int(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntUintR(rv reflect.Value) { @@ -8635,6 +11631,7 @@ func (f *encFnInfo) fastpathEncMapIntUintR(rv reflect.Value) { } func (_ fastpathT) EncMapIntUintV(v map[int]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8649,16 +11646,30 @@ func (_ fastpathT) EncMapIntUintV(v map[int]uint, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntUint8R(rv reflect.Value) { @@ -8666,6 +11677,7 @@ func (f *encFnInfo) fastpathEncMapIntUint8R(rv reflect.Value) { } func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8680,16 +11692,30 @@ func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntUint16R(rv reflect.Value) { @@ -8697,6 +11723,7 @@ func (f *encFnInfo) fastpathEncMapIntUint16R(rv reflect.Value) { } func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8711,16 +11738,30 @@ func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntUint32R(rv reflect.Value) { @@ -8728,6 +11769,7 @@ func (f *encFnInfo) fastpathEncMapIntUint32R(rv reflect.Value) { } func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8742,16 +11784,30 @@ func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntUint64R(rv reflect.Value) { @@ -8759,6 +11815,7 @@ func (f *encFnInfo) fastpathEncMapIntUint64R(rv reflect.Value) { } func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8773,16 +11830,30 @@ func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntUintptrR(rv reflect.Value) { @@ -8790,6 +11861,7 @@ func (f *encFnInfo) fastpathEncMapIntUintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8804,16 +11876,30 @@ func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntIntR(rv reflect.Value) { @@ -8821,6 +11907,7 @@ func (f *encFnInfo) fastpathEncMapIntIntR(rv reflect.Value) { } func (_ fastpathT) EncMapIntIntV(v map[int]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8835,16 +11922,30 @@ func (_ fastpathT) EncMapIntIntV(v map[int]int, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntInt8R(rv reflect.Value) { @@ -8852,6 +11953,7 @@ func (f *encFnInfo) fastpathEncMapIntInt8R(rv reflect.Value) { } func (_ fastpathT) EncMapIntInt8V(v map[int]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8866,16 +11968,30 @@ func (_ fastpathT) EncMapIntInt8V(v map[int]int8, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntInt16R(rv reflect.Value) { @@ -8883,6 +11999,7 @@ func (f *encFnInfo) fastpathEncMapIntInt16R(rv reflect.Value) { } func (_ fastpathT) EncMapIntInt16V(v map[int]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8897,16 +12014,30 @@ func (_ fastpathT) EncMapIntInt16V(v map[int]int16, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntInt32R(rv reflect.Value) { @@ -8914,6 +12045,7 @@ func (f *encFnInfo) fastpathEncMapIntInt32R(rv reflect.Value) { } func (_ fastpathT) EncMapIntInt32V(v map[int]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8928,16 +12060,30 @@ func (_ fastpathT) EncMapIntInt32V(v map[int]int32, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntInt64R(rv reflect.Value) { @@ -8945,6 +12091,7 @@ func (f *encFnInfo) fastpathEncMapIntInt64R(rv reflect.Value) { } func (_ fastpathT) EncMapIntInt64V(v map[int]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8959,16 +12106,30 @@ func (_ fastpathT) EncMapIntInt64V(v map[int]int64, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntFloat32R(rv reflect.Value) { @@ -8976,6 +12137,7 @@ func (f *encFnInfo) fastpathEncMapIntFloat32R(rv reflect.Value) { } func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -8990,16 +12152,30 @@ func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[int(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntFloat64R(rv reflect.Value) { @@ -9007,6 +12183,7 @@ func (f *encFnInfo) fastpathEncMapIntFloat64R(rv reflect.Value) { } func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9021,16 +12198,30 @@ func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[int(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapIntBoolR(rv reflect.Value) { @@ -9038,6 +12229,7 @@ func (f *encFnInfo) fastpathEncMapIntBoolR(rv reflect.Value) { } func (_ fastpathT) EncMapIntBoolV(v map[int]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9052,16 +12244,30 @@ func (_ fastpathT) EncMapIntBoolV(v map[int]bool, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[int(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8IntfR(rv reflect.Value) { @@ -9069,6 +12275,7 @@ func (f *encFnInfo) fastpathEncMapInt8IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9083,16 +12290,30 @@ func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, checkNil bool, e *Enc } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8StringR(rv reflect.Value) { @@ -9100,6 +12321,7 @@ func (f *encFnInfo) fastpathEncMapInt8StringR(rv reflect.Value) { } func (_ fastpathT) EncMapInt8StringV(v map[int8]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9114,16 +12336,30 @@ func (_ fastpathT) EncMapInt8StringV(v map[int8]string, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[int8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8UintR(rv reflect.Value) { @@ -9131,6 +12367,7 @@ func (f *encFnInfo) fastpathEncMapInt8UintR(rv reflect.Value) { } func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9145,16 +12382,30 @@ func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Uint8R(rv reflect.Value) { @@ -9162,6 +12413,7 @@ func (f *encFnInfo) fastpathEncMapInt8Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9176,16 +12428,30 @@ func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Uint16R(rv reflect.Value) { @@ -9193,6 +12459,7 @@ func (f *encFnInfo) fastpathEncMapInt8Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9207,16 +12474,30 @@ func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Uint32R(rv reflect.Value) { @@ -9224,6 +12505,7 @@ func (f *encFnInfo) fastpathEncMapInt8Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9238,16 +12520,30 @@ func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Uint64R(rv reflect.Value) { @@ -9255,6 +12551,7 @@ func (f *encFnInfo) fastpathEncMapInt8Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9269,16 +12566,30 @@ func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8UintptrR(rv reflect.Value) { @@ -9286,6 +12597,7 @@ func (f *encFnInfo) fastpathEncMapInt8UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9300,16 +12612,30 @@ func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8IntR(rv reflect.Value) { @@ -9317,6 +12643,7 @@ func (f *encFnInfo) fastpathEncMapInt8IntR(rv reflect.Value) { } func (_ fastpathT) EncMapInt8IntV(v map[int8]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9331,16 +12658,30 @@ func (_ fastpathT) EncMapInt8IntV(v map[int8]int, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Int8R(rv reflect.Value) { @@ -9348,6 +12689,7 @@ func (f *encFnInfo) fastpathEncMapInt8Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9362,16 +12704,30 @@ func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Int16R(rv reflect.Value) { @@ -9379,6 +12735,7 @@ func (f *encFnInfo) fastpathEncMapInt8Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9393,16 +12750,30 @@ func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Int32R(rv reflect.Value) { @@ -9410,6 +12781,7 @@ func (f *encFnInfo) fastpathEncMapInt8Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9424,16 +12796,30 @@ func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Int64R(rv reflect.Value) { @@ -9441,6 +12827,7 @@ func (f *encFnInfo) fastpathEncMapInt8Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9455,16 +12842,30 @@ func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int8(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Float32R(rv reflect.Value) { @@ -9472,6 +12873,7 @@ func (f *encFnInfo) fastpathEncMapInt8Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9486,16 +12888,30 @@ func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[int8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8Float64R(rv reflect.Value) { @@ -9503,6 +12919,7 @@ func (f *encFnInfo) fastpathEncMapInt8Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9517,16 +12934,30 @@ func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[int8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt8BoolR(rv reflect.Value) { @@ -9534,6 +12965,7 @@ func (f *encFnInfo) fastpathEncMapInt8BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9548,16 +12980,30 @@ func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int8(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[int8(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16IntfR(rv reflect.Value) { @@ -9565,6 +13011,7 @@ func (f *encFnInfo) fastpathEncMapInt16IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9579,16 +13026,30 @@ func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, checkNil bool, e *E } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16StringR(rv reflect.Value) { @@ -9596,6 +13057,7 @@ func (f *encFnInfo) fastpathEncMapInt16StringR(rv reflect.Value) { } func (_ fastpathT) EncMapInt16StringV(v map[int16]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9610,16 +13072,30 @@ func (_ fastpathT) EncMapInt16StringV(v map[int16]string, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[int16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16UintR(rv reflect.Value) { @@ -9627,6 +13103,7 @@ func (f *encFnInfo) fastpathEncMapInt16UintR(rv reflect.Value) { } func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9641,16 +13118,30 @@ func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Uint8R(rv reflect.Value) { @@ -9658,6 +13149,7 @@ func (f *encFnInfo) fastpathEncMapInt16Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9672,16 +13164,30 @@ func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Uint16R(rv reflect.Value) { @@ -9689,6 +13195,7 @@ func (f *encFnInfo) fastpathEncMapInt16Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9703,16 +13210,30 @@ func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Uint32R(rv reflect.Value) { @@ -9720,6 +13241,7 @@ func (f *encFnInfo) fastpathEncMapInt16Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9734,16 +13256,30 @@ func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Uint64R(rv reflect.Value) { @@ -9751,6 +13287,7 @@ func (f *encFnInfo) fastpathEncMapInt16Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9765,16 +13302,30 @@ func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16UintptrR(rv reflect.Value) { @@ -9782,6 +13333,7 @@ func (f *encFnInfo) fastpathEncMapInt16UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9796,16 +13348,30 @@ func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, checkNil bool, e *En } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16IntR(rv reflect.Value) { @@ -9813,6 +13379,7 @@ func (f *encFnInfo) fastpathEncMapInt16IntR(rv reflect.Value) { } func (_ fastpathT) EncMapInt16IntV(v map[int16]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9827,16 +13394,30 @@ func (_ fastpathT) EncMapInt16IntV(v map[int16]int, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Int8R(rv reflect.Value) { @@ -9844,6 +13425,7 @@ func (f *encFnInfo) fastpathEncMapInt16Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9858,16 +13440,30 @@ func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Int16R(rv reflect.Value) { @@ -9875,6 +13471,7 @@ func (f *encFnInfo) fastpathEncMapInt16Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9889,16 +13486,30 @@ func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Int32R(rv reflect.Value) { @@ -9906,6 +13517,7 @@ func (f *encFnInfo) fastpathEncMapInt16Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9920,16 +13532,30 @@ func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Int64R(rv reflect.Value) { @@ -9937,6 +13563,7 @@ func (f *encFnInfo) fastpathEncMapInt16Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9951,16 +13578,30 @@ func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int16(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Float32R(rv reflect.Value) { @@ -9968,6 +13609,7 @@ func (f *encFnInfo) fastpathEncMapInt16Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -9982,16 +13624,30 @@ func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, checkNil bool, e *En } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[int16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16Float64R(rv reflect.Value) { @@ -9999,6 +13655,7 @@ func (f *encFnInfo) fastpathEncMapInt16Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10013,16 +13670,30 @@ func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, checkNil bool, e *En } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[int16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt16BoolR(rv reflect.Value) { @@ -10030,6 +13701,7 @@ func (f *encFnInfo) fastpathEncMapInt16BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10044,16 +13716,30 @@ func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int16(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[int16(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32IntfR(rv reflect.Value) { @@ -10061,6 +13747,7 @@ func (f *encFnInfo) fastpathEncMapInt32IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10075,16 +13762,30 @@ func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, checkNil bool, e *E } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32StringR(rv reflect.Value) { @@ -10092,6 +13793,7 @@ func (f *encFnInfo) fastpathEncMapInt32StringR(rv reflect.Value) { } func (_ fastpathT) EncMapInt32StringV(v map[int32]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10106,16 +13808,30 @@ func (_ fastpathT) EncMapInt32StringV(v map[int32]string, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[int32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32UintR(rv reflect.Value) { @@ -10123,6 +13839,7 @@ func (f *encFnInfo) fastpathEncMapInt32UintR(rv reflect.Value) { } func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10137,16 +13854,30 @@ func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Uint8R(rv reflect.Value) { @@ -10154,6 +13885,7 @@ func (f *encFnInfo) fastpathEncMapInt32Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10168,16 +13900,30 @@ func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Uint16R(rv reflect.Value) { @@ -10185,6 +13931,7 @@ func (f *encFnInfo) fastpathEncMapInt32Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10199,16 +13946,30 @@ func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Uint32R(rv reflect.Value) { @@ -10216,6 +13977,7 @@ func (f *encFnInfo) fastpathEncMapInt32Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10230,16 +13992,30 @@ func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Uint64R(rv reflect.Value) { @@ -10247,6 +14023,7 @@ func (f *encFnInfo) fastpathEncMapInt32Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10261,16 +14038,30 @@ func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32UintptrR(rv reflect.Value) { @@ -10278,6 +14069,7 @@ func (f *encFnInfo) fastpathEncMapInt32UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10292,16 +14084,30 @@ func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, checkNil bool, e *En } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32IntR(rv reflect.Value) { @@ -10309,6 +14115,7 @@ func (f *encFnInfo) fastpathEncMapInt32IntR(rv reflect.Value) { } func (_ fastpathT) EncMapInt32IntV(v map[int32]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10323,16 +14130,30 @@ func (_ fastpathT) EncMapInt32IntV(v map[int32]int, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Int8R(rv reflect.Value) { @@ -10340,6 +14161,7 @@ func (f *encFnInfo) fastpathEncMapInt32Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10354,16 +14176,30 @@ func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Int16R(rv reflect.Value) { @@ -10371,6 +14207,7 @@ func (f *encFnInfo) fastpathEncMapInt32Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10385,16 +14222,30 @@ func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Int32R(rv reflect.Value) { @@ -10402,6 +14253,7 @@ func (f *encFnInfo) fastpathEncMapInt32Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10416,16 +14268,30 @@ func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Int64R(rv reflect.Value) { @@ -10433,6 +14299,7 @@ func (f *encFnInfo) fastpathEncMapInt32Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10447,16 +14314,30 @@ func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int32(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Float32R(rv reflect.Value) { @@ -10464,6 +14345,7 @@ func (f *encFnInfo) fastpathEncMapInt32Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10478,16 +14360,30 @@ func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, checkNil bool, e *En } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[int32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32Float64R(rv reflect.Value) { @@ -10495,6 +14391,7 @@ func (f *encFnInfo) fastpathEncMapInt32Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10509,16 +14406,30 @@ func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, checkNil bool, e *En } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[int32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt32BoolR(rv reflect.Value) { @@ -10526,6 +14437,7 @@ func (f *encFnInfo) fastpathEncMapInt32BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10540,16 +14452,30 @@ func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int32(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[int32(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64IntfR(rv reflect.Value) { @@ -10557,6 +14483,7 @@ func (f *encFnInfo) fastpathEncMapInt64IntfR(rv reflect.Value) { } func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10571,16 +14498,30 @@ func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, checkNil bool, e *E } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64StringR(rv reflect.Value) { @@ -10588,6 +14529,7 @@ func (f *encFnInfo) fastpathEncMapInt64StringR(rv reflect.Value) { } func (_ fastpathT) EncMapInt64StringV(v map[int64]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10602,16 +14544,30 @@ func (_ fastpathT) EncMapInt64StringV(v map[int64]string, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[int64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64UintR(rv reflect.Value) { @@ -10619,6 +14575,7 @@ func (f *encFnInfo) fastpathEncMapInt64UintR(rv reflect.Value) { } func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10633,16 +14590,30 @@ func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Uint8R(rv reflect.Value) { @@ -10650,6 +14621,7 @@ func (f *encFnInfo) fastpathEncMapInt64Uint8R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10664,16 +14636,30 @@ func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Uint16R(rv reflect.Value) { @@ -10681,6 +14667,7 @@ func (f *encFnInfo) fastpathEncMapInt64Uint16R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10695,16 +14682,30 @@ func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Uint32R(rv reflect.Value) { @@ -10712,6 +14713,7 @@ func (f *encFnInfo) fastpathEncMapInt64Uint32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10726,16 +14728,30 @@ func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Uint64R(rv reflect.Value) { @@ -10743,6 +14759,7 @@ func (f *encFnInfo) fastpathEncMapInt64Uint64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10757,16 +14774,30 @@ func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, checkNil bool, e *Enco } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64UintptrR(rv reflect.Value) { @@ -10774,6 +14805,7 @@ func (f *encFnInfo) fastpathEncMapInt64UintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10788,16 +14820,30 @@ func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, checkNil bool, e *En } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[int64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64IntR(rv reflect.Value) { @@ -10805,6 +14851,7 @@ func (f *encFnInfo) fastpathEncMapInt64IntR(rv reflect.Value) { } func (_ fastpathT) EncMapInt64IntV(v map[int64]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10819,16 +14866,30 @@ func (_ fastpathT) EncMapInt64IntV(v map[int64]int, checkNil bool, e *Encoder) { } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Int8R(rv reflect.Value) { @@ -10836,6 +14897,7 @@ func (f *encFnInfo) fastpathEncMapInt64Int8R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10850,16 +14912,30 @@ func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Int16R(rv reflect.Value) { @@ -10867,6 +14943,7 @@ func (f *encFnInfo) fastpathEncMapInt64Int16R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10881,16 +14958,30 @@ func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Int32R(rv reflect.Value) { @@ -10898,6 +14989,7 @@ func (f *encFnInfo) fastpathEncMapInt64Int32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10912,16 +15004,30 @@ func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Int64R(rv reflect.Value) { @@ -10929,6 +15035,7 @@ func (f *encFnInfo) fastpathEncMapInt64Int64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10943,16 +15050,30 @@ func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, checkNil bool, e *Encode } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[int64(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Float32R(rv reflect.Value) { @@ -10960,6 +15081,7 @@ func (f *encFnInfo) fastpathEncMapInt64Float32R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -10974,16 +15096,30 @@ func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, checkNil bool, e *En } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[int64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64Float64R(rv reflect.Value) { @@ -10991,6 +15127,7 @@ func (f *encFnInfo) fastpathEncMapInt64Float64R(rv reflect.Value) { } func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11005,16 +15142,30 @@ func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, checkNil bool, e *En } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[int64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapInt64BoolR(rv reflect.Value) { @@ -11022,6 +15173,7 @@ func (f *encFnInfo) fastpathEncMapInt64BoolR(rv reflect.Value) { } func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11036,16 +15188,30 @@ func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, checkNil bool, e *Encoder) } sort.Sort(intSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(int64(k2))) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[int64(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeInt(int64(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolIntfR(rv reflect.Value) { @@ -11053,6 +15219,7 @@ func (f *encFnInfo) fastpathEncMapBoolIntfR(rv reflect.Value) { } func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11067,16 +15234,30 @@ func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, checkNil bool, e *Enc } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[bool(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolStringR(rv reflect.Value) { @@ -11084,6 +15265,7 @@ func (f *encFnInfo) fastpathEncMapBoolStringR(rv reflect.Value) { } func (_ fastpathT) EncMapBoolStringV(v map[bool]string, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11098,16 +15280,30 @@ func (_ fastpathT) EncMapBoolStringV(v map[bool]string, checkNil bool, e *Encode } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v[bool(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeString(c_UTF8, v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolUintR(rv reflect.Value) { @@ -11115,6 +15311,7 @@ func (f *encFnInfo) fastpathEncMapBoolUintR(rv reflect.Value) { } func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11129,16 +15326,30 @@ func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, checkNil bool, e *Encoder) { } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolUint8R(rv reflect.Value) { @@ -11146,6 +15357,7 @@ func (f *encFnInfo) fastpathEncMapBoolUint8R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11160,16 +15372,30 @@ func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, checkNil bool, e *Encoder) } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolUint16R(rv reflect.Value) { @@ -11177,6 +15403,7 @@ func (f *encFnInfo) fastpathEncMapBoolUint16R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11191,16 +15418,30 @@ func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, checkNil bool, e *Encode } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolUint32R(rv reflect.Value) { @@ -11208,6 +15449,7 @@ func (f *encFnInfo) fastpathEncMapBoolUint32R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11222,16 +15464,30 @@ func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, checkNil bool, e *Encode } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolUint64R(rv reflect.Value) { @@ -11239,6 +15495,7 @@ func (f *encFnInfo) fastpathEncMapBoolUint64R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11253,16 +15510,30 @@ func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, checkNil bool, e *Encode } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeUint(uint64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolUintptrR(rv reflect.Value) { @@ -11270,6 +15541,7 @@ func (f *encFnInfo) fastpathEncMapBoolUintptrR(rv reflect.Value) { } func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11284,16 +15556,30 @@ func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, checkNil bool, e *Enco } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v[bool(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } e.encode(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolIntR(rv reflect.Value) { @@ -11301,6 +15587,7 @@ func (f *encFnInfo) fastpathEncMapBoolIntR(rv reflect.Value) { } func (_ fastpathT) EncMapBoolIntV(v map[bool]int, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11315,16 +15602,30 @@ func (_ fastpathT) EncMapBoolIntV(v map[bool]int, checkNil bool, e *Encoder) { } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolInt8R(rv reflect.Value) { @@ -11332,6 +15633,7 @@ func (f *encFnInfo) fastpathEncMapBoolInt8R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11346,16 +15648,30 @@ func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, checkNil bool, e *Encoder) { } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolInt16R(rv reflect.Value) { @@ -11363,6 +15679,7 @@ func (f *encFnInfo) fastpathEncMapBoolInt16R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11377,16 +15694,30 @@ func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, checkNil bool, e *Encoder) } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolInt32R(rv reflect.Value) { @@ -11394,6 +15725,7 @@ func (f *encFnInfo) fastpathEncMapBoolInt32R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11408,16 +15740,30 @@ func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, checkNil bool, e *Encoder) } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolInt64R(rv reflect.Value) { @@ -11425,6 +15771,7 @@ func (f *encFnInfo) fastpathEncMapBoolInt64R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11439,16 +15786,30 @@ func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, checkNil bool, e *Encoder) } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v[bool(k2)])) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeInt(int64(v2)) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolFloat32R(rv reflect.Value) { @@ -11456,6 +15817,7 @@ func (f *encFnInfo) fastpathEncMapBoolFloat32R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11470,16 +15832,30 @@ func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, checkNil bool, e *Enco } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v[bool(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat32(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolFloat64R(rv reflect.Value) { @@ -11487,6 +15863,7 @@ func (f *encFnInfo) fastpathEncMapBoolFloat64R(rv reflect.Value) { } func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11501,16 +15878,30 @@ func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, checkNil bool, e *Enco } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v[bool(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeFloat64(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } func (f *encFnInfo) fastpathEncMapBoolBoolR(rv reflect.Value) { @@ -11518,6 +15909,7 @@ func (f *encFnInfo) fastpathEncMapBoolBoolR(rv reflect.Value) { } func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -11532,22 +15924,39 @@ func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, checkNil bool, e *Encoder) { } sort.Sort(boolSlice(v2)) for _, k2 := range v2 { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(bool(k2)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v[bool(k2)]) } } else { for k2, v2 := range v { + if cr != nil { + cr.sendContainerState(containerMapKey) + } ee.EncodeBool(k2) + if cr != nil { + cr.sendContainerState(containerMapValue) + } ee.EncodeBool(v2) } } - ee.EncodeEnd() + if cr != nil { + cr.sendContainerState(containerMapEnd) + } } // -- decode // -- -- fast path type switch func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { + if !fastpathEnabled { + return false + } switch v := iv.(type) { case []interface{}: @@ -13719,6 +18128,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } default: + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true @@ -13746,8 +18156,7 @@ func (f fastpathT) DecSliceIntfX(vp *[]interface{}, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceIntfV(v []interface{}, checkNil bool, canChange bool, - d *Decoder) (_ []interface{}, changed bool) { +func (_ fastpathT) DecSliceIntfV(v []interface{}, checkNil bool, canChange bool, d *Decoder) (_ []interface{}, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -13758,59 +18167,83 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16); xtrunc { - x2read = xlen - } - v = make([]interface{}, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []interface{}{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]interface{}, xlen) + } + } else { + v = make([]interface{}, xlen) } - v = make([]interface{}, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) d.decode(&v[j]) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, nil) + slh.ElemContainerState(j) d.decode(&v[j]) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []interface{}{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]interface{}, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, nil) @@ -13819,15 +18252,21 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { d.decode(&v[j]) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -13851,8 +18290,7 @@ func (f fastpathT) DecSliceStringX(vp *[]string, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceStringV(v []string, checkNil bool, canChange bool, - d *Decoder) (_ []string, changed bool) { +func (_ fastpathT) DecSliceStringV(v []string, checkNil bool, canChange bool, d *Decoder) (_ []string, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -13863,59 +18301,83 @@ func (_ fastpathT) DecSliceStringV(v []string, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16); xtrunc { - x2read = xlen - } - v = make([]string, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []string{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]string, xlen) + } + } else { + v = make([]string, xlen) } - v = make([]string, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = dd.DecodeString() } if xtrunc { for ; j < containerLenS; j++ { v = append(v, "") + slh.ElemContainerState(j) v[j] = dd.DecodeString() } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []string{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]string, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, "") @@ -13924,14 +18386,20 @@ func (_ fastpathT) DecSliceStringV(v []string, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = dd.DecodeString() } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -13955,8 +18423,7 @@ func (f fastpathT) DecSliceFloat32X(vp *[]float32, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceFloat32V(v []float32, checkNil bool, canChange bool, - d *Decoder) (_ []float32, changed bool) { +func (_ fastpathT) DecSliceFloat32V(v []float32, checkNil bool, canChange bool, d *Decoder) (_ []float32, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -13967,59 +18434,83 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4); xtrunc { - x2read = xlen - } - v = make([]float32, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []float32{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]float32, xlen) + } + } else { + v = make([]float32, xlen) } - v = make([]float32, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = float32(dd.DecodeFloat(true)) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = float32(dd.DecodeFloat(true)) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []float32{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]float32, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14028,14 +18519,20 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = float32(dd.DecodeFloat(true)) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14059,8 +18556,7 @@ func (f fastpathT) DecSliceFloat64X(vp *[]float64, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceFloat64V(v []float64, checkNil bool, canChange bool, - d *Decoder) (_ []float64, changed bool) { +func (_ fastpathT) DecSliceFloat64V(v []float64, checkNil bool, canChange bool, d *Decoder) (_ []float64, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -14071,59 +18567,83 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen - } - v = make([]float64, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []float64{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]float64, xlen) + } + } else { + v = make([]float64, xlen) } - v = make([]float64, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = dd.DecodeFloat(false) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = dd.DecodeFloat(false) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []float64{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]float64, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14132,14 +18652,20 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = dd.DecodeFloat(false) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14163,8 +18689,7 @@ func (f fastpathT) DecSliceUintX(vp *[]uint, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceUintV(v []uint, checkNil bool, canChange bool, - d *Decoder) (_ []uint, changed bool) { +func (_ fastpathT) DecSliceUintV(v []uint, checkNil bool, canChange bool, d *Decoder) (_ []uint, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -14175,59 +18700,83 @@ func (_ fastpathT) DecSliceUintV(v []uint, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen - } - v = make([]uint, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []uint{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]uint, xlen) + } + } else { + v = make([]uint, xlen) } - v = make([]uint, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = uint(dd.DecodeUint(uintBitsize)) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = uint(dd.DecodeUint(uintBitsize)) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []uint{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]uint, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14236,14 +18785,20 @@ func (_ fastpathT) DecSliceUintV(v []uint, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = uint(dd.DecodeUint(uintBitsize)) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14267,8 +18822,7 @@ func (f fastpathT) DecSliceUint16X(vp *[]uint16, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceUint16V(v []uint16, checkNil bool, canChange bool, - d *Decoder) (_ []uint16, changed bool) { +func (_ fastpathT) DecSliceUint16V(v []uint16, checkNil bool, canChange bool, d *Decoder) (_ []uint16, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -14279,59 +18833,83 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2); xtrunc { - x2read = xlen - } - v = make([]uint16, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []uint16{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]uint16, xlen) + } + } else { + v = make([]uint16, xlen) } - v = make([]uint16, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = uint16(dd.DecodeUint(16)) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = uint16(dd.DecodeUint(16)) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []uint16{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]uint16, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14340,14 +18918,20 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = uint16(dd.DecodeUint(16)) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14371,8 +18955,7 @@ func (f fastpathT) DecSliceUint32X(vp *[]uint32, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceUint32V(v []uint32, checkNil bool, canChange bool, - d *Decoder) (_ []uint32, changed bool) { +func (_ fastpathT) DecSliceUint32V(v []uint32, checkNil bool, canChange bool, d *Decoder) (_ []uint32, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -14383,59 +18966,83 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4); xtrunc { - x2read = xlen - } - v = make([]uint32, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []uint32{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]uint32, xlen) + } + } else { + v = make([]uint32, xlen) } - v = make([]uint32, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = uint32(dd.DecodeUint(32)) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = uint32(dd.DecodeUint(32)) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []uint32{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]uint32, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14444,14 +19051,20 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = uint32(dd.DecodeUint(32)) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14475,8 +19088,7 @@ func (f fastpathT) DecSliceUint64X(vp *[]uint64, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceUint64V(v []uint64, checkNil bool, canChange bool, - d *Decoder) (_ []uint64, changed bool) { +func (_ fastpathT) DecSliceUint64V(v []uint64, checkNil bool, canChange bool, d *Decoder) (_ []uint64, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -14487,59 +19099,83 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen - } - v = make([]uint64, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []uint64{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]uint64, xlen) + } + } else { + v = make([]uint64, xlen) } - v = make([]uint64, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = dd.DecodeUint(64) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = dd.DecodeUint(64) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []uint64{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]uint64, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14548,14 +19184,20 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = dd.DecodeUint(64) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14579,8 +19221,7 @@ func (f fastpathT) DecSliceUintptrX(vp *[]uintptr, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceUintptrV(v []uintptr, checkNil bool, canChange bool, - d *Decoder) (_ []uintptr, changed bool) { +func (_ fastpathT) DecSliceUintptrV(v []uintptr, checkNil bool, canChange bool, d *Decoder) (_ []uintptr, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -14591,59 +19232,83 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen - } - v = make([]uintptr, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []uintptr{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]uintptr, xlen) + } + } else { + v = make([]uintptr, xlen) } - v = make([]uintptr, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = uintptr(dd.DecodeUint(uintBitsize)) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = uintptr(dd.DecodeUint(uintBitsize)) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []uintptr{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]uintptr, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14652,14 +19317,20 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = uintptr(dd.DecodeUint(uintBitsize)) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14683,8 +19354,7 @@ func (f fastpathT) DecSliceIntX(vp *[]int, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceIntV(v []int, checkNil bool, canChange bool, - d *Decoder) (_ []int, changed bool) { +func (_ fastpathT) DecSliceIntV(v []int, checkNil bool, canChange bool, d *Decoder) (_ []int, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -14695,59 +19365,83 @@ func (_ fastpathT) DecSliceIntV(v []int, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen - } - v = make([]int, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []int{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]int, xlen) + } + } else { + v = make([]int, xlen) } - v = make([]int, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = int(dd.DecodeInt(intBitsize)) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = int(dd.DecodeInt(intBitsize)) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []int{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]int, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14756,14 +19450,20 @@ func (_ fastpathT) DecSliceIntV(v []int, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = int(dd.DecodeInt(intBitsize)) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14787,8 +19487,7 @@ func (f fastpathT) DecSliceInt8X(vp *[]int8, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceInt8V(v []int8, checkNil bool, canChange bool, - d *Decoder) (_ []int8, changed bool) { +func (_ fastpathT) DecSliceInt8V(v []int8, checkNil bool, canChange bool, d *Decoder) (_ []int8, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -14799,59 +19498,83 @@ func (_ fastpathT) DecSliceInt8V(v []int8, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1); xtrunc { - x2read = xlen - } - v = make([]int8, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []int8{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]int8, xlen) + } + } else { + v = make([]int8, xlen) } - v = make([]int8, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = int8(dd.DecodeInt(8)) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = int8(dd.DecodeInt(8)) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []int8{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]int8, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14860,14 +19583,20 @@ func (_ fastpathT) DecSliceInt8V(v []int8, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = int8(dd.DecodeInt(8)) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14891,8 +19620,7 @@ func (f fastpathT) DecSliceInt16X(vp *[]int16, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceInt16V(v []int16, checkNil bool, canChange bool, - d *Decoder) (_ []int16, changed bool) { +func (_ fastpathT) DecSliceInt16V(v []int16, checkNil bool, canChange bool, d *Decoder) (_ []int16, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -14903,59 +19631,83 @@ func (_ fastpathT) DecSliceInt16V(v []int16, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2); xtrunc { - x2read = xlen - } - v = make([]int16, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []int16{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]int16, xlen) + } + } else { + v = make([]int16, xlen) } - v = make([]int16, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = int16(dd.DecodeInt(16)) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = int16(dd.DecodeInt(16)) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []int16{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]int16, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -14964,14 +19716,20 @@ func (_ fastpathT) DecSliceInt16V(v []int16, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = int16(dd.DecodeInt(16)) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -14995,8 +19753,7 @@ func (f fastpathT) DecSliceInt32X(vp *[]int32, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceInt32V(v []int32, checkNil bool, canChange bool, - d *Decoder) (_ []int32, changed bool) { +func (_ fastpathT) DecSliceInt32V(v []int32, checkNil bool, canChange bool, d *Decoder) (_ []int32, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -15007,59 +19764,83 @@ func (_ fastpathT) DecSliceInt32V(v []int32, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4); xtrunc { - x2read = xlen - } - v = make([]int32, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []int32{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]int32, xlen) + } + } else { + v = make([]int32, xlen) } - v = make([]int32, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = int32(dd.DecodeInt(32)) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = int32(dd.DecodeInt(32)) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []int32{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]int32, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -15068,14 +19849,20 @@ func (_ fastpathT) DecSliceInt32V(v []int32, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = int32(dd.DecodeInt(32)) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -15099,8 +19886,7 @@ func (f fastpathT) DecSliceInt64X(vp *[]int64, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceInt64V(v []int64, checkNil bool, canChange bool, - d *Decoder) (_ []int64, changed bool) { +func (_ fastpathT) DecSliceInt64V(v []int64, checkNil bool, canChange bool, d *Decoder) (_ []int64, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -15111,59 +19897,83 @@ func (_ fastpathT) DecSliceInt64V(v []int64, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen - } - v = make([]int64, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []int64{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]int64, xlen) + } + } else { + v = make([]int64, xlen) } - v = make([]int64, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = dd.DecodeInt(64) } if xtrunc { for ; j < containerLenS; j++ { v = append(v, 0) + slh.ElemContainerState(j) v[j] = dd.DecodeInt(64) } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []int64{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]int64, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, 0) @@ -15172,14 +19982,20 @@ func (_ fastpathT) DecSliceInt64V(v []int64, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = dd.DecodeInt(64) } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -15203,8 +20019,7 @@ func (f fastpathT) DecSliceBoolX(vp *[]bool, checkNil bool, d *Decoder) { *vp = v } } -func (_ fastpathT) DecSliceBoolV(v []bool, checkNil bool, canChange bool, - d *Decoder) (_ []bool, changed bool) { +func (_ fastpathT) DecSliceBoolV(v []bool, checkNil bool, canChange bool, d *Decoder) (_ []bool, changed bool) { dd := d.d if checkNil && dd.TryDecodeAsNil() { @@ -15215,59 +20030,83 @@ func (_ fastpathT) DecSliceBoolV(v []bool, checkNil bool, canChange bool, } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1); xtrunc { - x2read = xlen - } - v = make([]bool, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] + if canChange { + if v == nil { + v = []bool{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } + slh.End() return v, changed } if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]bool, xlen) + } + } else { + v = make([]bool, xlen) } - v = make([]bool, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true + if canChange { + v = v[:containerLenS] + changed = true + } } - j := 0 for ; j < x2read; j++ { + slh.ElemContainerState(j) v[j] = dd.DecodeBool() } if xtrunc { for ; j < containerLenS; j++ { v = append(v, false) + slh.ElemContainerState(j) v[j] = dd.DecodeBool() } } else if !canChange { for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { + breakFound := dd.CheckBreak() + if breakFound { + if canChange { + if v == nil { + v = []bool{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]bool, 1, 4) + changed = true + } j := 0 - for ; !dd.CheckBreak(); j++ { + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, false) @@ -15276,14 +20115,20 @@ func (_ fastpathT) DecSliceBoolV(v []bool, checkNil bool, canChange bool, d.arrayCannotExpand(len(v), j+1) } } + slh.ElemContainerState(j) if j < len(v) { v[j] = dd.DecodeBool() } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -15308,6 +20153,7 @@ func (f fastpathT) DecMapIntfIntfX(vp *map[interface{}]interface{}, checkNil boo func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15327,11 +20173,17 @@ func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -15344,11 +20196,17 @@ func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -15359,7 +20217,9 @@ func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15385,6 +20245,7 @@ func (f fastpathT) DecMapIntfStringX(vp *map[interface{}]string, checkNil bool, func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15404,11 +20265,17 @@ func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, checkNil bool, ca var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -15416,17 +20283,25 @@ func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, checkNil bool, ca } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15452,6 +20327,7 @@ func (f fastpathT) DecMapIntfUintX(vp *map[interface{}]uint, checkNil bool, d *D func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15471,11 +20347,17 @@ func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, checkNil bool, canCha var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -15483,17 +20365,25 @@ func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, checkNil bool, canCha } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15519,6 +20409,7 @@ func (f fastpathT) DecMapIntfUint8X(vp *map[interface{}]uint8, checkNil bool, d func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15538,11 +20429,17 @@ func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, checkNil bool, canC var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -15550,17 +20447,25 @@ func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, checkNil bool, canC } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15586,6 +20491,7 @@ func (f fastpathT) DecMapIntfUint16X(vp *map[interface{}]uint16, checkNil bool, func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15605,11 +20511,17 @@ func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, checkNil bool, ca var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -15617,17 +20529,25 @@ func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, checkNil bool, ca } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15653,6 +20573,7 @@ func (f fastpathT) DecMapIntfUint32X(vp *map[interface{}]uint32, checkNil bool, func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15672,11 +20593,17 @@ func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, checkNil bool, ca var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -15684,17 +20611,25 @@ func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, checkNil bool, ca } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15720,6 +20655,7 @@ func (f fastpathT) DecMapIntfUint64X(vp *map[interface{}]uint64, checkNil bool, func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15739,11 +20675,17 @@ func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, checkNil bool, ca var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -15751,17 +20693,25 @@ func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, checkNil bool, ca } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15787,6 +20737,7 @@ func (f fastpathT) DecMapIntfUintptrX(vp *map[interface{}]uintptr, checkNil bool func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15806,11 +20757,17 @@ func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -15818,17 +20775,25 @@ func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15854,6 +20819,7 @@ func (f fastpathT) DecMapIntfIntX(vp *map[interface{}]int, checkNil bool, d *Dec func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15873,11 +20839,17 @@ func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, checkNil bool, canChang var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -15885,17 +20857,25 @@ func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, checkNil bool, canChang } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15921,6 +20901,7 @@ func (f fastpathT) DecMapIntfInt8X(vp *map[interface{}]int8, checkNil bool, d *D func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -15940,11 +20921,17 @@ func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, checkNil bool, canCha var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -15952,17 +20939,25 @@ func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, checkNil bool, canCha } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -15988,6 +20983,7 @@ func (f fastpathT) DecMapIntfInt16X(vp *map[interface{}]int16, checkNil bool, d func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16007,11 +21003,17 @@ func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, checkNil bool, canC var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -16019,17 +21021,25 @@ func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, checkNil bool, canC } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16055,6 +21065,7 @@ func (f fastpathT) DecMapIntfInt32X(vp *map[interface{}]int32, checkNil bool, d func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16074,11 +21085,17 @@ func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, checkNil bool, canC var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -16086,17 +21103,25 @@ func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, checkNil bool, canC } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16122,6 +21147,7 @@ func (f fastpathT) DecMapIntfInt64X(vp *map[interface{}]int64, checkNil bool, d func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16141,11 +21167,17 @@ func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, checkNil bool, canC var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -16153,17 +21185,25 @@ func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, checkNil bool, canC } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16189,6 +21229,7 @@ func (f fastpathT) DecMapIntfFloat32X(vp *map[interface{}]float32, checkNil bool func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16208,11 +21249,17 @@ func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, checkNil bool, var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -16220,17 +21267,25 @@ func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, checkNil bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16256,6 +21311,7 @@ func (f fastpathT) DecMapIntfFloat64X(vp *map[interface{}]float64, checkNil bool func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16275,11 +21331,17 @@ func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, checkNil bool, var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -16287,17 +21349,25 @@ func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, checkNil bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16323,6 +21393,7 @@ func (f fastpathT) DecMapIntfBoolX(vp *map[interface{}]bool, checkNil bool, d *D func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, checkNil bool, canChange bool, d *Decoder) (_ map[interface{}]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16342,11 +21413,17 @@ func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, checkNil bool, canCha var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -16354,17 +21431,25 @@ func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, checkNil bool, canCha } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) } + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16390,6 +21475,7 @@ func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, checkNil bool, func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[string]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16409,7 +21495,13 @@ func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, checkNil bool, ca var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -16422,7 +21514,13 @@ func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, checkNil bool, ca } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -16433,7 +21531,9 @@ func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, checkNil bool, ca v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16459,6 +21559,7 @@ func (f fastpathT) DecMapStringStringX(vp *map[string]string, checkNil bool, d * func (_ fastpathT) DecMapStringStringV(v map[string]string, checkNil bool, canChange bool, d *Decoder) (_ map[string]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16478,7 +21579,13 @@ func (_ fastpathT) DecMapStringStringV(v map[string]string, checkNil bool, canCh var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -16486,13 +21593,21 @@ func (_ fastpathT) DecMapStringStringV(v map[string]string, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16518,6 +21633,7 @@ func (f fastpathT) DecMapStringUintX(vp *map[string]uint, checkNil bool, d *Deco func (_ fastpathT) DecMapStringUintV(v map[string]uint, checkNil bool, canChange bool, d *Decoder) (_ map[string]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16537,7 +21653,13 @@ func (_ fastpathT) DecMapStringUintV(v map[string]uint, checkNil bool, canChange var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -16545,13 +21667,21 @@ func (_ fastpathT) DecMapStringUintV(v map[string]uint, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16577,6 +21707,7 @@ func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, checkNil bool, d *De func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[string]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16596,7 +21727,13 @@ func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, checkNil bool, canChan var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -16604,13 +21741,21 @@ func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16636,6 +21781,7 @@ func (f fastpathT) DecMapStringUint16X(vp *map[string]uint16, checkNil bool, d * func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[string]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16655,7 +21801,13 @@ func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, checkNil bool, canCh var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -16663,13 +21815,21 @@ func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16695,6 +21855,7 @@ func (f fastpathT) DecMapStringUint32X(vp *map[string]uint32, checkNil bool, d * func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[string]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16714,7 +21875,13 @@ func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, checkNil bool, canCh var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -16722,13 +21889,21 @@ func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16754,6 +21929,7 @@ func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, checkNil bool, d * func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[string]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16773,7 +21949,13 @@ func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, checkNil bool, canCh var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -16781,13 +21963,21 @@ func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16813,6 +22003,7 @@ func (f fastpathT) DecMapStringUintptrX(vp *map[string]uintptr, checkNil bool, d func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[string]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16832,7 +22023,13 @@ func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, checkNil bool, can var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -16840,13 +22037,21 @@ func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16872,6 +22077,7 @@ func (f fastpathT) DecMapStringIntX(vp *map[string]int, checkNil bool, d *Decode func (_ fastpathT) DecMapStringIntV(v map[string]int, checkNil bool, canChange bool, d *Decoder) (_ map[string]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16891,7 +22097,13 @@ func (_ fastpathT) DecMapStringIntV(v map[string]int, checkNil bool, canChange b var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -16899,13 +22111,21 @@ func (_ fastpathT) DecMapStringIntV(v map[string]int, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16931,6 +22151,7 @@ func (f fastpathT) DecMapStringInt8X(vp *map[string]int8, checkNil bool, d *Deco func (_ fastpathT) DecMapStringInt8V(v map[string]int8, checkNil bool, canChange bool, d *Decoder) (_ map[string]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -16950,7 +22171,13 @@ func (_ fastpathT) DecMapStringInt8V(v map[string]int8, checkNil bool, canChange var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -16958,13 +22185,21 @@ func (_ fastpathT) DecMapStringInt8V(v map[string]int8, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -16990,6 +22225,7 @@ func (f fastpathT) DecMapStringInt16X(vp *map[string]int16, checkNil bool, d *De func (_ fastpathT) DecMapStringInt16V(v map[string]int16, checkNil bool, canChange bool, d *Decoder) (_ map[string]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17009,7 +22245,13 @@ func (_ fastpathT) DecMapStringInt16V(v map[string]int16, checkNil bool, canChan var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -17017,13 +22259,21 @@ func (_ fastpathT) DecMapStringInt16V(v map[string]int16, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17049,6 +22299,7 @@ func (f fastpathT) DecMapStringInt32X(vp *map[string]int32, checkNil bool, d *De func (_ fastpathT) DecMapStringInt32V(v map[string]int32, checkNil bool, canChange bool, d *Decoder) (_ map[string]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17068,7 +22319,13 @@ func (_ fastpathT) DecMapStringInt32V(v map[string]int32, checkNil bool, canChan var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -17076,13 +22333,21 @@ func (_ fastpathT) DecMapStringInt32V(v map[string]int32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17108,6 +22373,7 @@ func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, checkNil bool, d *De func (_ fastpathT) DecMapStringInt64V(v map[string]int64, checkNil bool, canChange bool, d *Decoder) (_ map[string]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17127,7 +22393,13 @@ func (_ fastpathT) DecMapStringInt64V(v map[string]int64, checkNil bool, canChan var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -17135,13 +22407,21 @@ func (_ fastpathT) DecMapStringInt64V(v map[string]int64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17167,6 +22447,7 @@ func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, checkNil bool, d func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, checkNil bool, canChange bool, d *Decoder) (_ map[string]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17186,7 +22467,13 @@ func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, checkNil bool, can var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -17194,13 +22481,21 @@ func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17226,6 +22521,7 @@ func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, checkNil bool, d func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, checkNil bool, canChange bool, d *Decoder) (_ map[string]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17245,7 +22541,13 @@ func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, checkNil bool, can var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -17253,13 +22555,21 @@ func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17285,6 +22595,7 @@ func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, checkNil bool, d *Deco func (_ fastpathT) DecMapStringBoolV(v map[string]bool, checkNil bool, canChange bool, d *Decoder) (_ map[string]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17304,7 +22615,13 @@ func (_ fastpathT) DecMapStringBoolV(v map[string]bool, checkNil bool, canChange var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -17312,13 +22629,21 @@ func (_ fastpathT) DecMapStringBoolV(v map[string]bool, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeString() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17344,6 +22669,7 @@ func (f fastpathT) DecMapFloat32IntfX(vp *map[float32]interface{}, checkNil bool func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[float32]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17363,7 +22689,13 @@ func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, checkNil bool, var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -17376,7 +22708,13 @@ func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, checkNil bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -17387,7 +22725,9 @@ func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, checkNil bool, v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17413,6 +22753,7 @@ func (f fastpathT) DecMapFloat32StringX(vp *map[float32]string, checkNil bool, d func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, checkNil bool, canChange bool, d *Decoder) (_ map[float32]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17432,7 +22773,13 @@ func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, checkNil bool, can var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -17440,13 +22787,21 @@ func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17472,6 +22827,7 @@ func (f fastpathT) DecMapFloat32UintX(vp *map[float32]uint, checkNil bool, d *De func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, checkNil bool, canChange bool, d *Decoder) (_ map[float32]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17491,7 +22847,13 @@ func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, checkNil bool, canChan var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -17499,13 +22861,21 @@ func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17531,6 +22901,7 @@ func (f fastpathT) DecMapFloat32Uint8X(vp *map[float32]uint8, checkNil bool, d * func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[float32]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17550,7 +22921,13 @@ func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, checkNil bool, canCh var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -17558,13 +22935,21 @@ func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17590,6 +22975,7 @@ func (f fastpathT) DecMapFloat32Uint16X(vp *map[float32]uint16, checkNil bool, d func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[float32]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17609,7 +22995,13 @@ func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, checkNil bool, can var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -17617,13 +23009,21 @@ func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17649,6 +23049,7 @@ func (f fastpathT) DecMapFloat32Uint32X(vp *map[float32]uint32, checkNil bool, d func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[float32]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17668,7 +23069,13 @@ func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, checkNil bool, can var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -17676,13 +23083,21 @@ func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17708,6 +23123,7 @@ func (f fastpathT) DecMapFloat32Uint64X(vp *map[float32]uint64, checkNil bool, d func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[float32]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17727,7 +23143,13 @@ func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, checkNil bool, can var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -17735,13 +23157,21 @@ func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17767,6 +23197,7 @@ func (f fastpathT) DecMapFloat32UintptrX(vp *map[float32]uintptr, checkNil bool, func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[float32]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17786,7 +23217,13 @@ func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, c var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -17794,13 +23231,21 @@ func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, c } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17826,6 +23271,7 @@ func (f fastpathT) DecMapFloat32IntX(vp *map[float32]int, checkNil bool, d *Deco func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, checkNil bool, canChange bool, d *Decoder) (_ map[float32]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17845,7 +23291,13 @@ func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, checkNil bool, canChange var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -17853,13 +23305,21 @@ func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17885,6 +23345,7 @@ func (f fastpathT) DecMapFloat32Int8X(vp *map[float32]int8, checkNil bool, d *De func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, checkNil bool, canChange bool, d *Decoder) (_ map[float32]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17904,7 +23365,13 @@ func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, checkNil bool, canChan var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -17912,13 +23379,21 @@ func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -17944,6 +23419,7 @@ func (f fastpathT) DecMapFloat32Int16X(vp *map[float32]int16, checkNil bool, d * func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, checkNil bool, canChange bool, d *Decoder) (_ map[float32]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -17963,7 +23439,13 @@ func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, checkNil bool, canCh var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -17971,13 +23453,21 @@ func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18003,6 +23493,7 @@ func (f fastpathT) DecMapFloat32Int32X(vp *map[float32]int32, checkNil bool, d * func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, checkNil bool, canChange bool, d *Decoder) (_ map[float32]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18022,7 +23513,13 @@ func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, checkNil bool, canCh var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -18030,13 +23527,21 @@ func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18062,6 +23567,7 @@ func (f fastpathT) DecMapFloat32Int64X(vp *map[float32]int64, checkNil bool, d * func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, checkNil bool, canChange bool, d *Decoder) (_ map[float32]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18081,7 +23587,13 @@ func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, checkNil bool, canCh var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -18089,13 +23601,21 @@ func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18121,6 +23641,7 @@ func (f fastpathT) DecMapFloat32Float32X(vp *map[float32]float32, checkNil bool, func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, checkNil bool, canChange bool, d *Decoder) (_ map[float32]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18140,7 +23661,13 @@ func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, checkNil bool, c var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -18148,13 +23675,21 @@ func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, checkNil bool, c } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18180,6 +23715,7 @@ func (f fastpathT) DecMapFloat32Float64X(vp *map[float32]float64, checkNil bool, func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, checkNil bool, canChange bool, d *Decoder) (_ map[float32]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18199,7 +23735,13 @@ func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, checkNil bool, c var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -18207,13 +23749,21 @@ func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, checkNil bool, c } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18239,6 +23789,7 @@ func (f fastpathT) DecMapFloat32BoolX(vp *map[float32]bool, checkNil bool, d *De func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, checkNil bool, canChange bool, d *Decoder) (_ map[float32]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18258,7 +23809,13 @@ func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, checkNil bool, canChan var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -18266,13 +23823,21 @@ func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = float32(dd.DecodeFloat(true)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18298,6 +23863,7 @@ func (f fastpathT) DecMapFloat64IntfX(vp *map[float64]interface{}, checkNil bool func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[float64]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18317,7 +23883,13 @@ func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, checkNil bool, var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -18330,7 +23902,13 @@ func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, checkNil bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -18341,7 +23919,9 @@ func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, checkNil bool, v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18367,6 +23947,7 @@ func (f fastpathT) DecMapFloat64StringX(vp *map[float64]string, checkNil bool, d func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, checkNil bool, canChange bool, d *Decoder) (_ map[float64]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18386,7 +23967,13 @@ func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, checkNil bool, can var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -18394,13 +23981,21 @@ func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18426,6 +24021,7 @@ func (f fastpathT) DecMapFloat64UintX(vp *map[float64]uint, checkNil bool, d *De func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, checkNil bool, canChange bool, d *Decoder) (_ map[float64]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18445,7 +24041,13 @@ func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, checkNil bool, canChan var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -18453,13 +24055,21 @@ func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18485,6 +24095,7 @@ func (f fastpathT) DecMapFloat64Uint8X(vp *map[float64]uint8, checkNil bool, d * func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[float64]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18504,7 +24115,13 @@ func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, checkNil bool, canCh var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -18512,13 +24129,21 @@ func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18544,6 +24169,7 @@ func (f fastpathT) DecMapFloat64Uint16X(vp *map[float64]uint16, checkNil bool, d func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[float64]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18563,7 +24189,13 @@ func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, checkNil bool, can var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -18571,13 +24203,21 @@ func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18603,6 +24243,7 @@ func (f fastpathT) DecMapFloat64Uint32X(vp *map[float64]uint32, checkNil bool, d func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[float64]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18622,7 +24263,13 @@ func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, checkNil bool, can var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -18630,13 +24277,21 @@ func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18662,6 +24317,7 @@ func (f fastpathT) DecMapFloat64Uint64X(vp *map[float64]uint64, checkNil bool, d func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[float64]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18681,7 +24337,13 @@ func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, checkNil bool, can var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -18689,13 +24351,21 @@ func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18721,6 +24391,7 @@ func (f fastpathT) DecMapFloat64UintptrX(vp *map[float64]uintptr, checkNil bool, func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[float64]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18740,7 +24411,13 @@ func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, c var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -18748,13 +24425,21 @@ func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, c } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18780,6 +24465,7 @@ func (f fastpathT) DecMapFloat64IntX(vp *map[float64]int, checkNil bool, d *Deco func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, checkNil bool, canChange bool, d *Decoder) (_ map[float64]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18799,7 +24485,13 @@ func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, checkNil bool, canChange var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -18807,13 +24499,21 @@ func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18839,6 +24539,7 @@ func (f fastpathT) DecMapFloat64Int8X(vp *map[float64]int8, checkNil bool, d *De func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, checkNil bool, canChange bool, d *Decoder) (_ map[float64]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18858,7 +24559,13 @@ func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, checkNil bool, canChan var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -18866,13 +24573,21 @@ func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18898,6 +24613,7 @@ func (f fastpathT) DecMapFloat64Int16X(vp *map[float64]int16, checkNil bool, d * func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, checkNil bool, canChange bool, d *Decoder) (_ map[float64]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18917,7 +24633,13 @@ func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, checkNil bool, canCh var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -18925,13 +24647,21 @@ func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -18957,6 +24687,7 @@ func (f fastpathT) DecMapFloat64Int32X(vp *map[float64]int32, checkNil bool, d * func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, checkNil bool, canChange bool, d *Decoder) (_ map[float64]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -18976,7 +24707,13 @@ func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, checkNil bool, canCh var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -18984,13 +24721,21 @@ func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19016,6 +24761,7 @@ func (f fastpathT) DecMapFloat64Int64X(vp *map[float64]int64, checkNil bool, d * func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, checkNil bool, canChange bool, d *Decoder) (_ map[float64]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19035,7 +24781,13 @@ func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, checkNil bool, canCh var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -19043,13 +24795,21 @@ func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19075,6 +24835,7 @@ func (f fastpathT) DecMapFloat64Float32X(vp *map[float64]float32, checkNil bool, func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, checkNil bool, canChange bool, d *Decoder) (_ map[float64]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19094,7 +24855,13 @@ func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, checkNil bool, c var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -19102,13 +24869,21 @@ func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, checkNil bool, c } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19134,6 +24909,7 @@ func (f fastpathT) DecMapFloat64Float64X(vp *map[float64]float64, checkNil bool, func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, checkNil bool, canChange bool, d *Decoder) (_ map[float64]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19153,7 +24929,13 @@ func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, checkNil bool, c var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -19161,13 +24943,21 @@ func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, checkNil bool, c } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19193,6 +24983,7 @@ func (f fastpathT) DecMapFloat64BoolX(vp *map[float64]bool, checkNil bool, d *De func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, checkNil bool, canChange bool, d *Decoder) (_ map[float64]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19212,7 +25003,13 @@ func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, checkNil bool, canChan var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -19220,13 +25017,21 @@ func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeFloat(false) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19252,6 +25057,7 @@ func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, checkNil bool, d *D func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[uint]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19271,7 +25077,13 @@ func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, checkNil bool, canCha var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -19284,7 +25096,13 @@ func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, checkNil bool, canCha } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -19295,7 +25113,9 @@ func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, checkNil bool, canCha v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19321,6 +25141,7 @@ func (f fastpathT) DecMapUintStringX(vp *map[uint]string, checkNil bool, d *Deco func (_ fastpathT) DecMapUintStringV(v map[uint]string, checkNil bool, canChange bool, d *Decoder) (_ map[uint]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19340,7 +25161,13 @@ func (_ fastpathT) DecMapUintStringV(v map[uint]string, checkNil bool, canChange var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -19348,13 +25175,21 @@ func (_ fastpathT) DecMapUintStringV(v map[uint]string, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19380,6 +25215,7 @@ func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, checkNil bool, d *Decoder) func (_ fastpathT) DecMapUintUintV(v map[uint]uint, checkNil bool, canChange bool, d *Decoder) (_ map[uint]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19399,7 +25235,13 @@ func (_ fastpathT) DecMapUintUintV(v map[uint]uint, checkNil bool, canChange boo var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -19407,13 +25249,21 @@ func (_ fastpathT) DecMapUintUintV(v map[uint]uint, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19439,6 +25289,7 @@ func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, checkNil bool, d *Decode func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[uint]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19458,7 +25309,13 @@ func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, checkNil bool, canChange b var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -19466,13 +25323,21 @@ func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19498,6 +25363,7 @@ func (f fastpathT) DecMapUintUint16X(vp *map[uint]uint16, checkNil bool, d *Deco func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[uint]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19517,7 +25383,13 @@ func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, checkNil bool, canChange var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -19525,13 +25397,21 @@ func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19557,6 +25437,7 @@ func (f fastpathT) DecMapUintUint32X(vp *map[uint]uint32, checkNil bool, d *Deco func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[uint]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19576,7 +25457,13 @@ func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, checkNil bool, canChange var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -19584,13 +25471,21 @@ func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19616,6 +25511,7 @@ func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, checkNil bool, d *Deco func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[uint]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19635,7 +25531,13 @@ func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, checkNil bool, canChange var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -19643,13 +25545,21 @@ func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19675,6 +25585,7 @@ func (f fastpathT) DecMapUintUintptrX(vp *map[uint]uintptr, checkNil bool, d *De func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[uint]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19694,7 +25605,13 @@ func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, checkNil bool, canChan var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -19702,13 +25619,21 @@ func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19734,6 +25659,7 @@ func (f fastpathT) DecMapUintIntX(vp *map[uint]int, checkNil bool, d *Decoder) { func (_ fastpathT) DecMapUintIntV(v map[uint]int, checkNil bool, canChange bool, d *Decoder) (_ map[uint]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19753,7 +25679,13 @@ func (_ fastpathT) DecMapUintIntV(v map[uint]int, checkNil bool, canChange bool, var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -19761,13 +25693,21 @@ func (_ fastpathT) DecMapUintIntV(v map[uint]int, checkNil bool, canChange bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19793,6 +25733,7 @@ func (f fastpathT) DecMapUintInt8X(vp *map[uint]int8, checkNil bool, d *Decoder) func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, checkNil bool, canChange bool, d *Decoder) (_ map[uint]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19812,7 +25753,13 @@ func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, checkNil bool, canChange boo var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -19820,13 +25767,21 @@ func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19852,6 +25807,7 @@ func (f fastpathT) DecMapUintInt16X(vp *map[uint]int16, checkNil bool, d *Decode func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, checkNil bool, canChange bool, d *Decoder) (_ map[uint]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19871,7 +25827,13 @@ func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, checkNil bool, canChange b var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -19879,13 +25841,21 @@ func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19911,6 +25881,7 @@ func (f fastpathT) DecMapUintInt32X(vp *map[uint]int32, checkNil bool, d *Decode func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, checkNil bool, canChange bool, d *Decoder) (_ map[uint]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19930,7 +25901,13 @@ func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, checkNil bool, canChange b var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -19938,13 +25915,21 @@ func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -19970,6 +25955,7 @@ func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, checkNil bool, d *Decode func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, checkNil bool, canChange bool, d *Decoder) (_ map[uint]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -19989,7 +25975,13 @@ func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, checkNil bool, canChange b var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -19997,13 +25989,21 @@ func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20029,6 +26029,7 @@ func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, checkNil bool, d *De func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, checkNil bool, canChange bool, d *Decoder) (_ map[uint]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20048,7 +26049,13 @@ func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, checkNil bool, canChan var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -20056,13 +26063,21 @@ func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20088,6 +26103,7 @@ func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, checkNil bool, d *De func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, checkNil bool, canChange bool, d *Decoder) (_ map[uint]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20107,7 +26123,13 @@ func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, checkNil bool, canChan var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -20115,13 +26137,21 @@ func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20147,6 +26177,7 @@ func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, checkNil bool, d *Decoder) func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, checkNil bool, canChange bool, d *Decoder) (_ map[uint]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20166,7 +26197,13 @@ func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, checkNil bool, canChange boo var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -20174,13 +26211,21 @@ func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20206,6 +26251,7 @@ func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, checkNil bool, d func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20225,7 +26271,13 @@ func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, checkNil bool, canC var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -20238,7 +26290,13 @@ func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, checkNil bool, canC } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -20249,7 +26307,9 @@ func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, checkNil bool, canC v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20275,6 +26335,7 @@ func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, checkNil bool, d *De func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20294,7 +26355,13 @@ func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, checkNil bool, canChan var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -20302,13 +26369,21 @@ func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20334,6 +26409,7 @@ func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, checkNil bool, d *Decode func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20353,7 +26429,13 @@ func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, checkNil bool, canChange b var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -20361,13 +26443,21 @@ func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20393,6 +26483,7 @@ func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, checkNil bool, d *Deco func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20412,7 +26503,13 @@ func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, checkNil bool, canChange var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -20420,13 +26517,21 @@ func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20452,6 +26557,7 @@ func (f fastpathT) DecMapUint8Uint16X(vp *map[uint8]uint16, checkNil bool, d *De func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20471,7 +26577,13 @@ func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, checkNil bool, canChan var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -20479,13 +26591,21 @@ func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20511,6 +26631,7 @@ func (f fastpathT) DecMapUint8Uint32X(vp *map[uint8]uint32, checkNil bool, d *De func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20530,7 +26651,13 @@ func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, checkNil bool, canChan var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -20538,13 +26665,21 @@ func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20570,6 +26705,7 @@ func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, checkNil bool, d *De func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20589,7 +26725,13 @@ func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, checkNil bool, canChan var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -20597,13 +26739,21 @@ func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20629,6 +26779,7 @@ func (f fastpathT) DecMapUint8UintptrX(vp *map[uint8]uintptr, checkNil bool, d * func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20648,7 +26799,13 @@ func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, canCh var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -20656,13 +26813,21 @@ func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20688,6 +26853,7 @@ func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, checkNil bool, d *Decoder) func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20707,7 +26873,13 @@ func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, checkNil bool, canChange boo var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -20715,13 +26887,21 @@ func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20747,6 +26927,7 @@ func (f fastpathT) DecMapUint8Int8X(vp *map[uint8]int8, checkNil bool, d *Decode func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20766,7 +26947,13 @@ func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, checkNil bool, canChange b var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -20774,13 +26961,21 @@ func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20806,6 +27001,7 @@ func (f fastpathT) DecMapUint8Int16X(vp *map[uint8]int16, checkNil bool, d *Deco func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20825,7 +27021,13 @@ func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, checkNil bool, canChange var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -20833,13 +27035,21 @@ func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20865,6 +27075,7 @@ func (f fastpathT) DecMapUint8Int32X(vp *map[uint8]int32, checkNil bool, d *Deco func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20884,7 +27095,13 @@ func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, checkNil bool, canChange var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -20892,13 +27109,21 @@ func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20924,6 +27149,7 @@ func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, checkNil bool, d *Deco func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -20943,7 +27169,13 @@ func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, checkNil bool, canChange var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -20951,13 +27183,21 @@ func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -20983,6 +27223,7 @@ func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, checkNil bool, d * func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21002,7 +27243,13 @@ func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, checkNil bool, canCh var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -21010,13 +27257,21 @@ func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21042,6 +27297,7 @@ func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, checkNil bool, d * func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21061,7 +27317,13 @@ func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, checkNil bool, canCh var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -21069,13 +27331,21 @@ func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21101,6 +27371,7 @@ func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, checkNil bool, d *Decode func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, checkNil bool, canChange bool, d *Decoder) (_ map[uint8]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21120,7 +27391,13 @@ func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, checkNil bool, canChange b var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -21128,13 +27405,21 @@ func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint8(dd.DecodeUint(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21160,6 +27445,7 @@ func (f fastpathT) DecMapUint16IntfX(vp *map[uint16]interface{}, checkNil bool, func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21179,7 +27465,13 @@ func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, checkNil bool, ca var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -21192,7 +27484,13 @@ func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, checkNil bool, ca } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -21203,7 +27501,9 @@ func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, checkNil bool, ca v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21229,6 +27529,7 @@ func (f fastpathT) DecMapUint16StringX(vp *map[uint16]string, checkNil bool, d * func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21248,7 +27549,13 @@ func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, checkNil bool, canCh var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -21256,13 +27563,21 @@ func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21288,6 +27603,7 @@ func (f fastpathT) DecMapUint16UintX(vp *map[uint16]uint, checkNil bool, d *Deco func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21307,7 +27623,13 @@ func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, checkNil bool, canChange var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -21315,13 +27637,21 @@ func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21347,6 +27677,7 @@ func (f fastpathT) DecMapUint16Uint8X(vp *map[uint16]uint8, checkNil bool, d *De func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21366,7 +27697,13 @@ func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, checkNil bool, canChan var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -21374,13 +27711,21 @@ func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21406,6 +27751,7 @@ func (f fastpathT) DecMapUint16Uint16X(vp *map[uint16]uint16, checkNil bool, d * func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21425,7 +27771,13 @@ func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, checkNil bool, canCh var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -21433,13 +27785,21 @@ func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21465,6 +27825,7 @@ func (f fastpathT) DecMapUint16Uint32X(vp *map[uint16]uint32, checkNil bool, d * func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21484,7 +27845,13 @@ func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, checkNil bool, canCh var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -21492,13 +27859,21 @@ func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21524,6 +27899,7 @@ func (f fastpathT) DecMapUint16Uint64X(vp *map[uint16]uint64, checkNil bool, d * func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21543,7 +27919,13 @@ func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, checkNil bool, canCh var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -21551,13 +27933,21 @@ func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21583,6 +27973,7 @@ func (f fastpathT) DecMapUint16UintptrX(vp *map[uint16]uintptr, checkNil bool, d func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21602,7 +27993,13 @@ func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, can var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -21610,13 +28007,21 @@ func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21642,6 +28047,7 @@ func (f fastpathT) DecMapUint16IntX(vp *map[uint16]int, checkNil bool, d *Decode func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21661,7 +28067,13 @@ func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, checkNil bool, canChange b var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -21669,13 +28081,21 @@ func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21701,6 +28121,7 @@ func (f fastpathT) DecMapUint16Int8X(vp *map[uint16]int8, checkNil bool, d *Deco func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21720,7 +28141,13 @@ func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, checkNil bool, canChange var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -21728,13 +28155,21 @@ func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21760,6 +28195,7 @@ func (f fastpathT) DecMapUint16Int16X(vp *map[uint16]int16, checkNil bool, d *De func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21779,7 +28215,13 @@ func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, checkNil bool, canChan var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -21787,13 +28229,21 @@ func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21819,6 +28269,7 @@ func (f fastpathT) DecMapUint16Int32X(vp *map[uint16]int32, checkNil bool, d *De func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21838,7 +28289,13 @@ func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, checkNil bool, canChan var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -21846,13 +28303,21 @@ func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21878,6 +28343,7 @@ func (f fastpathT) DecMapUint16Int64X(vp *map[uint16]int64, checkNil bool, d *De func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21897,7 +28363,13 @@ func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, checkNil bool, canChan var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -21905,13 +28377,21 @@ func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21937,6 +28417,7 @@ func (f fastpathT) DecMapUint16Float32X(vp *map[uint16]float32, checkNil bool, d func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -21956,7 +28437,13 @@ func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, checkNil bool, can var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -21964,13 +28451,21 @@ func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -21996,6 +28491,7 @@ func (f fastpathT) DecMapUint16Float64X(vp *map[uint16]float64, checkNil bool, d func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22015,7 +28511,13 @@ func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, checkNil bool, can var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -22023,13 +28525,21 @@ func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22055,6 +28565,7 @@ func (f fastpathT) DecMapUint16BoolX(vp *map[uint16]bool, checkNil bool, d *Deco func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, checkNil bool, canChange bool, d *Decoder) (_ map[uint16]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22074,7 +28585,13 @@ func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, checkNil bool, canChange var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -22082,13 +28599,21 @@ func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint16(dd.DecodeUint(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22114,6 +28639,7 @@ func (f fastpathT) DecMapUint32IntfX(vp *map[uint32]interface{}, checkNil bool, func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22133,7 +28659,13 @@ func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, checkNil bool, ca var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -22146,7 +28678,13 @@ func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, checkNil bool, ca } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -22157,7 +28695,9 @@ func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, checkNil bool, ca v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22183,6 +28723,7 @@ func (f fastpathT) DecMapUint32StringX(vp *map[uint32]string, checkNil bool, d * func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22202,7 +28743,13 @@ func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, checkNil bool, canCh var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -22210,13 +28757,21 @@ func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22242,6 +28797,7 @@ func (f fastpathT) DecMapUint32UintX(vp *map[uint32]uint, checkNil bool, d *Deco func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22261,7 +28817,13 @@ func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, checkNil bool, canChange var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -22269,13 +28831,21 @@ func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22301,6 +28871,7 @@ func (f fastpathT) DecMapUint32Uint8X(vp *map[uint32]uint8, checkNil bool, d *De func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22320,7 +28891,13 @@ func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, checkNil bool, canChan var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -22328,13 +28905,21 @@ func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22360,6 +28945,7 @@ func (f fastpathT) DecMapUint32Uint16X(vp *map[uint32]uint16, checkNil bool, d * func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22379,7 +28965,13 @@ func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, checkNil bool, canCh var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -22387,13 +28979,21 @@ func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22419,6 +29019,7 @@ func (f fastpathT) DecMapUint32Uint32X(vp *map[uint32]uint32, checkNil bool, d * func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22438,7 +29039,13 @@ func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, checkNil bool, canCh var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -22446,13 +29053,21 @@ func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22478,6 +29093,7 @@ func (f fastpathT) DecMapUint32Uint64X(vp *map[uint32]uint64, checkNil bool, d * func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22497,7 +29113,13 @@ func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, checkNil bool, canCh var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -22505,13 +29127,21 @@ func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22537,6 +29167,7 @@ func (f fastpathT) DecMapUint32UintptrX(vp *map[uint32]uintptr, checkNil bool, d func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22556,7 +29187,13 @@ func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, can var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -22564,13 +29201,21 @@ func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22596,6 +29241,7 @@ func (f fastpathT) DecMapUint32IntX(vp *map[uint32]int, checkNil bool, d *Decode func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22615,7 +29261,13 @@ func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, checkNil bool, canChange b var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -22623,13 +29275,21 @@ func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22655,6 +29315,7 @@ func (f fastpathT) DecMapUint32Int8X(vp *map[uint32]int8, checkNil bool, d *Deco func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22674,7 +29335,13 @@ func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, checkNil bool, canChange var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -22682,13 +29349,21 @@ func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22714,6 +29389,7 @@ func (f fastpathT) DecMapUint32Int16X(vp *map[uint32]int16, checkNil bool, d *De func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22733,7 +29409,13 @@ func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, checkNil bool, canChan var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -22741,13 +29423,21 @@ func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22773,6 +29463,7 @@ func (f fastpathT) DecMapUint32Int32X(vp *map[uint32]int32, checkNil bool, d *De func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22792,7 +29483,13 @@ func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, checkNil bool, canChan var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -22800,13 +29497,21 @@ func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22832,6 +29537,7 @@ func (f fastpathT) DecMapUint32Int64X(vp *map[uint32]int64, checkNil bool, d *De func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22851,7 +29557,13 @@ func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, checkNil bool, canChan var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -22859,13 +29571,21 @@ func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22891,6 +29611,7 @@ func (f fastpathT) DecMapUint32Float32X(vp *map[uint32]float32, checkNil bool, d func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22910,7 +29631,13 @@ func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, checkNil bool, can var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -22918,13 +29645,21 @@ func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -22950,6 +29685,7 @@ func (f fastpathT) DecMapUint32Float64X(vp *map[uint32]float64, checkNil bool, d func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -22969,7 +29705,13 @@ func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, checkNil bool, can var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -22977,13 +29719,21 @@ func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23009,6 +29759,7 @@ func (f fastpathT) DecMapUint32BoolX(vp *map[uint32]bool, checkNil bool, d *Deco func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, checkNil bool, canChange bool, d *Decoder) (_ map[uint32]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23028,7 +29779,13 @@ func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, checkNil bool, canChange var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -23036,13 +29793,21 @@ func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uint32(dd.DecodeUint(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23068,6 +29833,7 @@ func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, checkNil bool, func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23087,7 +29853,13 @@ func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, checkNil bool, ca var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -23100,7 +29872,13 @@ func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, checkNil bool, ca } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -23111,7 +29889,9 @@ func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, checkNil bool, ca v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23137,6 +29917,7 @@ func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, checkNil bool, d * func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23156,7 +29937,13 @@ func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, checkNil bool, canCh var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -23164,13 +29951,21 @@ func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23196,6 +29991,7 @@ func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, checkNil bool, d *Deco func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23215,7 +30011,13 @@ func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, checkNil bool, canChange var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -23223,13 +30025,21 @@ func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23255,6 +30065,7 @@ func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, checkNil bool, d *De func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23274,7 +30085,13 @@ func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, checkNil bool, canChan var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -23282,13 +30099,21 @@ func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23314,6 +30139,7 @@ func (f fastpathT) DecMapUint64Uint16X(vp *map[uint64]uint16, checkNil bool, d * func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23333,7 +30159,13 @@ func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, checkNil bool, canCh var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -23341,13 +30173,21 @@ func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23373,6 +30213,7 @@ func (f fastpathT) DecMapUint64Uint32X(vp *map[uint64]uint32, checkNil bool, d * func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23392,7 +30233,13 @@ func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, checkNil bool, canCh var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -23400,13 +30247,21 @@ func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23432,6 +30287,7 @@ func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, checkNil bool, d * func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23451,7 +30307,13 @@ func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, checkNil bool, canCh var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -23459,13 +30321,21 @@ func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23491,6 +30361,7 @@ func (f fastpathT) DecMapUint64UintptrX(vp *map[uint64]uintptr, checkNil bool, d func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23510,7 +30381,13 @@ func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, can var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -23518,13 +30395,21 @@ func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23550,6 +30435,7 @@ func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, checkNil bool, d *Decode func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23569,7 +30455,13 @@ func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, checkNil bool, canChange b var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -23577,13 +30469,21 @@ func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23609,6 +30509,7 @@ func (f fastpathT) DecMapUint64Int8X(vp *map[uint64]int8, checkNil bool, d *Deco func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23628,7 +30529,13 @@ func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, checkNil bool, canChange var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -23636,13 +30543,21 @@ func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23668,6 +30583,7 @@ func (f fastpathT) DecMapUint64Int16X(vp *map[uint64]int16, checkNil bool, d *De func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23687,7 +30603,13 @@ func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, checkNil bool, canChan var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -23695,13 +30617,21 @@ func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23727,6 +30657,7 @@ func (f fastpathT) DecMapUint64Int32X(vp *map[uint64]int32, checkNil bool, d *De func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23746,7 +30677,13 @@ func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, checkNil bool, canChan var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -23754,13 +30691,21 @@ func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23786,6 +30731,7 @@ func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, checkNil bool, d *De func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23805,7 +30751,13 @@ func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, checkNil bool, canChan var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -23813,13 +30765,21 @@ func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23845,6 +30805,7 @@ func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, checkNil bool, d func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23864,7 +30825,13 @@ func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, checkNil bool, can var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -23872,13 +30839,21 @@ func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23904,6 +30879,7 @@ func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, checkNil bool, d func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23923,7 +30899,13 @@ func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, checkNil bool, can var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -23931,13 +30913,21 @@ func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -23963,6 +30953,7 @@ func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, checkNil bool, d *Deco func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, checkNil bool, canChange bool, d *Decoder) (_ map[uint64]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -23982,7 +30973,13 @@ func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, checkNil bool, canChange var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -23990,13 +30987,21 @@ func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeUint(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24022,6 +31027,7 @@ func (f fastpathT) DecMapUintptrIntfX(vp *map[uintptr]interface{}, checkNil bool func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24041,7 +31047,13 @@ func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -24054,7 +31066,13 @@ func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -24065,7 +31083,9 @@ func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24091,6 +31111,7 @@ func (f fastpathT) DecMapUintptrStringX(vp *map[uintptr]string, checkNil bool, d func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24110,7 +31131,13 @@ func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, checkNil bool, can var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -24118,13 +31145,21 @@ func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24150,6 +31185,7 @@ func (f fastpathT) DecMapUintptrUintX(vp *map[uintptr]uint, checkNil bool, d *De func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24169,7 +31205,13 @@ func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, checkNil bool, canChan var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -24177,13 +31219,21 @@ func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24209,6 +31259,7 @@ func (f fastpathT) DecMapUintptrUint8X(vp *map[uintptr]uint8, checkNil bool, d * func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24228,7 +31279,13 @@ func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, canCh var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -24236,13 +31293,21 @@ func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24268,6 +31333,7 @@ func (f fastpathT) DecMapUintptrUint16X(vp *map[uintptr]uint16, checkNil bool, d func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24287,7 +31353,13 @@ func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, can var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -24295,13 +31367,21 @@ func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24327,6 +31407,7 @@ func (f fastpathT) DecMapUintptrUint32X(vp *map[uintptr]uint32, checkNil bool, d func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24346,7 +31427,13 @@ func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, can var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -24354,13 +31441,21 @@ func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24386,6 +31481,7 @@ func (f fastpathT) DecMapUintptrUint64X(vp *map[uintptr]uint64, checkNil bool, d func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24405,7 +31501,13 @@ func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, can var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -24413,13 +31515,21 @@ func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, can } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24445,6 +31555,7 @@ func (f fastpathT) DecMapUintptrUintptrX(vp *map[uintptr]uintptr, checkNil bool, func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24464,7 +31575,13 @@ func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, c var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -24472,13 +31589,21 @@ func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, c } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24504,6 +31629,7 @@ func (f fastpathT) DecMapUintptrIntX(vp *map[uintptr]int, checkNil bool, d *Deco func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24523,7 +31649,13 @@ func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, checkNil bool, canChange var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -24531,13 +31663,21 @@ func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24563,6 +31703,7 @@ func (f fastpathT) DecMapUintptrInt8X(vp *map[uintptr]int8, checkNil bool, d *De func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24582,7 +31723,13 @@ func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, checkNil bool, canChan var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -24590,13 +31737,21 @@ func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24622,6 +31777,7 @@ func (f fastpathT) DecMapUintptrInt16X(vp *map[uintptr]int16, checkNil bool, d * func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24641,7 +31797,13 @@ func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, checkNil bool, canCh var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -24649,13 +31811,21 @@ func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24681,6 +31851,7 @@ func (f fastpathT) DecMapUintptrInt32X(vp *map[uintptr]int32, checkNil bool, d * func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24700,7 +31871,13 @@ func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, checkNil bool, canCh var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -24708,13 +31885,21 @@ func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24740,6 +31925,7 @@ func (f fastpathT) DecMapUintptrInt64X(vp *map[uintptr]int64, checkNil bool, d * func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24759,7 +31945,13 @@ func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, checkNil bool, canCh var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -24767,13 +31959,21 @@ func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24799,6 +31999,7 @@ func (f fastpathT) DecMapUintptrFloat32X(vp *map[uintptr]float32, checkNil bool, func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24818,7 +32019,13 @@ func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, c var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -24826,13 +32033,21 @@ func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, c } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24858,6 +32073,7 @@ func (f fastpathT) DecMapUintptrFloat64X(vp *map[uintptr]float64, checkNil bool, func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24877,7 +32093,13 @@ func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, c var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -24885,13 +32107,21 @@ func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, c } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24917,6 +32147,7 @@ func (f fastpathT) DecMapUintptrBoolX(vp *map[uintptr]bool, checkNil bool, d *De func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, checkNil bool, canChange bool, d *Decoder) (_ map[uintptr]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24936,7 +32167,13 @@ func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, checkNil bool, canChan var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -24944,13 +32181,21 @@ func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = uintptr(dd.DecodeUint(uintBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -24976,6 +32221,7 @@ func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, checkNil bool, d *Dec func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[int]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -24995,7 +32241,13 @@ func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, checkNil bool, canChang var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -25008,7 +32260,13 @@ func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, checkNil bool, canChang } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -25019,7 +32277,9 @@ func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, checkNil bool, canChang v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25045,6 +32305,7 @@ func (f fastpathT) DecMapIntStringX(vp *map[int]string, checkNil bool, d *Decode func (_ fastpathT) DecMapIntStringV(v map[int]string, checkNil bool, canChange bool, d *Decoder) (_ map[int]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25064,7 +32325,13 @@ func (_ fastpathT) DecMapIntStringV(v map[int]string, checkNil bool, canChange b var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -25072,13 +32339,21 @@ func (_ fastpathT) DecMapIntStringV(v map[int]string, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25104,6 +32379,7 @@ func (f fastpathT) DecMapIntUintX(vp *map[int]uint, checkNil bool, d *Decoder) { func (_ fastpathT) DecMapIntUintV(v map[int]uint, checkNil bool, canChange bool, d *Decoder) (_ map[int]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25123,7 +32399,13 @@ func (_ fastpathT) DecMapIntUintV(v map[int]uint, checkNil bool, canChange bool, var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -25131,13 +32413,21 @@ func (_ fastpathT) DecMapIntUintV(v map[int]uint, checkNil bool, canChange bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25163,6 +32453,7 @@ func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, checkNil bool, d *Decoder) func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[int]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25182,7 +32473,13 @@ func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, checkNil bool, canChange boo var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -25190,13 +32487,21 @@ func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25222,6 +32527,7 @@ func (f fastpathT) DecMapIntUint16X(vp *map[int]uint16, checkNil bool, d *Decode func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[int]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25241,7 +32547,13 @@ func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, checkNil bool, canChange b var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -25249,13 +32561,21 @@ func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25281,6 +32601,7 @@ func (f fastpathT) DecMapIntUint32X(vp *map[int]uint32, checkNil bool, d *Decode func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[int]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25300,7 +32621,13 @@ func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, checkNil bool, canChange b var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -25308,13 +32635,21 @@ func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25340,6 +32675,7 @@ func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, checkNil bool, d *Decode func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[int]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25359,7 +32695,13 @@ func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, checkNil bool, canChange b var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -25367,13 +32709,21 @@ func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25399,6 +32749,7 @@ func (f fastpathT) DecMapIntUintptrX(vp *map[int]uintptr, checkNil bool, d *Deco func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[int]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25418,7 +32769,13 @@ func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, checkNil bool, canChange var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -25426,13 +32783,21 @@ func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25458,6 +32823,7 @@ func (f fastpathT) DecMapIntIntX(vp *map[int]int, checkNil bool, d *Decoder) { func (_ fastpathT) DecMapIntIntV(v map[int]int, checkNil bool, canChange bool, d *Decoder) (_ map[int]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25477,7 +32843,13 @@ func (_ fastpathT) DecMapIntIntV(v map[int]int, checkNil bool, canChange bool, var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -25485,13 +32857,21 @@ func (_ fastpathT) DecMapIntIntV(v map[int]int, checkNil bool, canChange bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25517,6 +32897,7 @@ func (f fastpathT) DecMapIntInt8X(vp *map[int]int8, checkNil bool, d *Decoder) { func (_ fastpathT) DecMapIntInt8V(v map[int]int8, checkNil bool, canChange bool, d *Decoder) (_ map[int]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25536,7 +32917,13 @@ func (_ fastpathT) DecMapIntInt8V(v map[int]int8, checkNil bool, canChange bool, var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -25544,13 +32931,21 @@ func (_ fastpathT) DecMapIntInt8V(v map[int]int8, checkNil bool, canChange bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25576,6 +32971,7 @@ func (f fastpathT) DecMapIntInt16X(vp *map[int]int16, checkNil bool, d *Decoder) func (_ fastpathT) DecMapIntInt16V(v map[int]int16, checkNil bool, canChange bool, d *Decoder) (_ map[int]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25595,7 +32991,13 @@ func (_ fastpathT) DecMapIntInt16V(v map[int]int16, checkNil bool, canChange boo var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -25603,13 +33005,21 @@ func (_ fastpathT) DecMapIntInt16V(v map[int]int16, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25635,6 +33045,7 @@ func (f fastpathT) DecMapIntInt32X(vp *map[int]int32, checkNil bool, d *Decoder) func (_ fastpathT) DecMapIntInt32V(v map[int]int32, checkNil bool, canChange bool, d *Decoder) (_ map[int]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25654,7 +33065,13 @@ func (_ fastpathT) DecMapIntInt32V(v map[int]int32, checkNil bool, canChange boo var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -25662,13 +33079,21 @@ func (_ fastpathT) DecMapIntInt32V(v map[int]int32, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25694,6 +33119,7 @@ func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, checkNil bool, d *Decoder) func (_ fastpathT) DecMapIntInt64V(v map[int]int64, checkNil bool, canChange bool, d *Decoder) (_ map[int]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25713,7 +33139,13 @@ func (_ fastpathT) DecMapIntInt64V(v map[int]int64, checkNil bool, canChange boo var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -25721,13 +33153,21 @@ func (_ fastpathT) DecMapIntInt64V(v map[int]int64, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25753,6 +33193,7 @@ func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, checkNil bool, d *Deco func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, checkNil bool, canChange bool, d *Decoder) (_ map[int]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25772,7 +33213,13 @@ func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, checkNil bool, canChange var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -25780,13 +33227,21 @@ func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25812,6 +33267,7 @@ func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, checkNil bool, d *Deco func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, checkNil bool, canChange bool, d *Decoder) (_ map[int]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25831,7 +33287,13 @@ func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, checkNil bool, canChange var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -25839,13 +33301,21 @@ func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25871,6 +33341,7 @@ func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, checkNil bool, d *Decoder) { func (_ fastpathT) DecMapIntBoolV(v map[int]bool, checkNil bool, canChange bool, d *Decoder) (_ map[int]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25890,7 +33361,13 @@ func (_ fastpathT) DecMapIntBoolV(v map[int]bool, checkNil bool, canChange bool, var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -25898,13 +33375,21 @@ func (_ fastpathT) DecMapIntBoolV(v map[int]bool, checkNil bool, canChange bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int(dd.DecodeInt(intBitsize)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25930,6 +33415,7 @@ func (f fastpathT) DecMapInt8IntfX(vp *map[int8]interface{}, checkNil bool, d *D func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[int8]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -25949,7 +33435,13 @@ func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, checkNil bool, canCha var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -25962,7 +33454,13 @@ func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, checkNil bool, canCha } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -25973,7 +33471,9 @@ func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, checkNil bool, canCha v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -25999,6 +33499,7 @@ func (f fastpathT) DecMapInt8StringX(vp *map[int8]string, checkNil bool, d *Deco func (_ fastpathT) DecMapInt8StringV(v map[int8]string, checkNil bool, canChange bool, d *Decoder) (_ map[int8]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26018,7 +33519,13 @@ func (_ fastpathT) DecMapInt8StringV(v map[int8]string, checkNil bool, canChange var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -26026,13 +33533,21 @@ func (_ fastpathT) DecMapInt8StringV(v map[int8]string, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26058,6 +33573,7 @@ func (f fastpathT) DecMapInt8UintX(vp *map[int8]uint, checkNil bool, d *Decoder) func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, checkNil bool, canChange bool, d *Decoder) (_ map[int8]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26077,7 +33593,13 @@ func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, checkNil bool, canChange boo var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -26085,13 +33607,21 @@ func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26117,6 +33647,7 @@ func (f fastpathT) DecMapInt8Uint8X(vp *map[int8]uint8, checkNil bool, d *Decode func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[int8]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26136,7 +33667,13 @@ func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, checkNil bool, canChange b var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -26144,13 +33681,21 @@ func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26176,6 +33721,7 @@ func (f fastpathT) DecMapInt8Uint16X(vp *map[int8]uint16, checkNil bool, d *Deco func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[int8]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26195,7 +33741,13 @@ func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, checkNil bool, canChange var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -26203,13 +33755,21 @@ func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26235,6 +33795,7 @@ func (f fastpathT) DecMapInt8Uint32X(vp *map[int8]uint32, checkNil bool, d *Deco func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[int8]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26254,7 +33815,13 @@ func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, checkNil bool, canChange var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -26262,13 +33829,21 @@ func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26294,6 +33869,7 @@ func (f fastpathT) DecMapInt8Uint64X(vp *map[int8]uint64, checkNil bool, d *Deco func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[int8]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26313,7 +33889,13 @@ func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, checkNil bool, canChange var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -26321,13 +33903,21 @@ func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26353,6 +33943,7 @@ func (f fastpathT) DecMapInt8UintptrX(vp *map[int8]uintptr, checkNil bool, d *De func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[int8]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26372,7 +33963,13 @@ func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, checkNil bool, canChan var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -26380,13 +33977,21 @@ func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26412,6 +34017,7 @@ func (f fastpathT) DecMapInt8IntX(vp *map[int8]int, checkNil bool, d *Decoder) { func (_ fastpathT) DecMapInt8IntV(v map[int8]int, checkNil bool, canChange bool, d *Decoder) (_ map[int8]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26431,7 +34037,13 @@ func (_ fastpathT) DecMapInt8IntV(v map[int8]int, checkNil bool, canChange bool, var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -26439,13 +34051,21 @@ func (_ fastpathT) DecMapInt8IntV(v map[int8]int, checkNil bool, canChange bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26471,6 +34091,7 @@ func (f fastpathT) DecMapInt8Int8X(vp *map[int8]int8, checkNil bool, d *Decoder) func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, checkNil bool, canChange bool, d *Decoder) (_ map[int8]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26490,7 +34111,13 @@ func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, checkNil bool, canChange boo var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -26498,13 +34125,21 @@ func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26530,6 +34165,7 @@ func (f fastpathT) DecMapInt8Int16X(vp *map[int8]int16, checkNil bool, d *Decode func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, checkNil bool, canChange bool, d *Decoder) (_ map[int8]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26549,7 +34185,13 @@ func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, checkNil bool, canChange b var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -26557,13 +34199,21 @@ func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26589,6 +34239,7 @@ func (f fastpathT) DecMapInt8Int32X(vp *map[int8]int32, checkNil bool, d *Decode func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, checkNil bool, canChange bool, d *Decoder) (_ map[int8]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26608,7 +34259,13 @@ func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, checkNil bool, canChange b var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -26616,13 +34273,21 @@ func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26648,6 +34313,7 @@ func (f fastpathT) DecMapInt8Int64X(vp *map[int8]int64, checkNil bool, d *Decode func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, checkNil bool, canChange bool, d *Decoder) (_ map[int8]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26667,7 +34333,13 @@ func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, checkNil bool, canChange b var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -26675,13 +34347,21 @@ func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26707,6 +34387,7 @@ func (f fastpathT) DecMapInt8Float32X(vp *map[int8]float32, checkNil bool, d *De func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, checkNil bool, canChange bool, d *Decoder) (_ map[int8]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26726,7 +34407,13 @@ func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, checkNil bool, canChan var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -26734,13 +34421,21 @@ func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26766,6 +34461,7 @@ func (f fastpathT) DecMapInt8Float64X(vp *map[int8]float64, checkNil bool, d *De func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, checkNil bool, canChange bool, d *Decoder) (_ map[int8]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26785,7 +34481,13 @@ func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, checkNil bool, canChan var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -26793,13 +34495,21 @@ func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26825,6 +34535,7 @@ func (f fastpathT) DecMapInt8BoolX(vp *map[int8]bool, checkNil bool, d *Decoder) func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, checkNil bool, canChange bool, d *Decoder) (_ map[int8]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26844,7 +34555,13 @@ func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, checkNil bool, canChange boo var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -26852,13 +34569,21 @@ func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int8(dd.DecodeInt(8)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26884,6 +34609,7 @@ func (f fastpathT) DecMapInt16IntfX(vp *map[int16]interface{}, checkNil bool, d func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[int16]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26903,7 +34629,13 @@ func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, checkNil bool, canC var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -26916,7 +34648,13 @@ func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, checkNil bool, canC } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -26927,7 +34665,9 @@ func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, checkNil bool, canC v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -26953,6 +34693,7 @@ func (f fastpathT) DecMapInt16StringX(vp *map[int16]string, checkNil bool, d *De func (_ fastpathT) DecMapInt16StringV(v map[int16]string, checkNil bool, canChange bool, d *Decoder) (_ map[int16]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -26972,7 +34713,13 @@ func (_ fastpathT) DecMapInt16StringV(v map[int16]string, checkNil bool, canChan var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -26980,13 +34727,21 @@ func (_ fastpathT) DecMapInt16StringV(v map[int16]string, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27012,6 +34767,7 @@ func (f fastpathT) DecMapInt16UintX(vp *map[int16]uint, checkNil bool, d *Decode func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, checkNil bool, canChange bool, d *Decoder) (_ map[int16]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27031,7 +34787,13 @@ func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, checkNil bool, canChange b var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -27039,13 +34801,21 @@ func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27071,6 +34841,7 @@ func (f fastpathT) DecMapInt16Uint8X(vp *map[int16]uint8, checkNil bool, d *Deco func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[int16]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27090,7 +34861,13 @@ func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, checkNil bool, canChange var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -27098,13 +34875,21 @@ func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27130,6 +34915,7 @@ func (f fastpathT) DecMapInt16Uint16X(vp *map[int16]uint16, checkNil bool, d *De func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[int16]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27149,7 +34935,13 @@ func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, checkNil bool, canChan var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -27157,13 +34949,21 @@ func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27189,6 +34989,7 @@ func (f fastpathT) DecMapInt16Uint32X(vp *map[int16]uint32, checkNil bool, d *De func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[int16]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27208,7 +35009,13 @@ func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, checkNil bool, canChan var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -27216,13 +35023,21 @@ func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27248,6 +35063,7 @@ func (f fastpathT) DecMapInt16Uint64X(vp *map[int16]uint64, checkNil bool, d *De func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[int16]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27267,7 +35083,13 @@ func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, checkNil bool, canChan var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -27275,13 +35097,21 @@ func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27307,6 +35137,7 @@ func (f fastpathT) DecMapInt16UintptrX(vp *map[int16]uintptr, checkNil bool, d * func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[int16]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27326,7 +35157,13 @@ func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, checkNil bool, canCh var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -27334,13 +35171,21 @@ func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27366,6 +35211,7 @@ func (f fastpathT) DecMapInt16IntX(vp *map[int16]int, checkNil bool, d *Decoder) func (_ fastpathT) DecMapInt16IntV(v map[int16]int, checkNil bool, canChange bool, d *Decoder) (_ map[int16]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27385,7 +35231,13 @@ func (_ fastpathT) DecMapInt16IntV(v map[int16]int, checkNil bool, canChange boo var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -27393,13 +35245,21 @@ func (_ fastpathT) DecMapInt16IntV(v map[int16]int, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27425,6 +35285,7 @@ func (f fastpathT) DecMapInt16Int8X(vp *map[int16]int8, checkNil bool, d *Decode func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, checkNil bool, canChange bool, d *Decoder) (_ map[int16]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27444,7 +35305,13 @@ func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, checkNil bool, canChange b var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -27452,13 +35319,21 @@ func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27484,6 +35359,7 @@ func (f fastpathT) DecMapInt16Int16X(vp *map[int16]int16, checkNil bool, d *Deco func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, checkNil bool, canChange bool, d *Decoder) (_ map[int16]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27503,7 +35379,13 @@ func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, checkNil bool, canChange var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -27511,13 +35393,21 @@ func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27543,6 +35433,7 @@ func (f fastpathT) DecMapInt16Int32X(vp *map[int16]int32, checkNil bool, d *Deco func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, checkNil bool, canChange bool, d *Decoder) (_ map[int16]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27562,7 +35453,13 @@ func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, checkNil bool, canChange var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -27570,13 +35467,21 @@ func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27602,6 +35507,7 @@ func (f fastpathT) DecMapInt16Int64X(vp *map[int16]int64, checkNil bool, d *Deco func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, checkNil bool, canChange bool, d *Decoder) (_ map[int16]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27621,7 +35527,13 @@ func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, checkNil bool, canChange var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -27629,13 +35541,21 @@ func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27661,6 +35581,7 @@ func (f fastpathT) DecMapInt16Float32X(vp *map[int16]float32, checkNil bool, d * func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, checkNil bool, canChange bool, d *Decoder) (_ map[int16]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27680,7 +35601,13 @@ func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, checkNil bool, canCh var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -27688,13 +35615,21 @@ func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27720,6 +35655,7 @@ func (f fastpathT) DecMapInt16Float64X(vp *map[int16]float64, checkNil bool, d * func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, checkNil bool, canChange bool, d *Decoder) (_ map[int16]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27739,7 +35675,13 @@ func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, checkNil bool, canCh var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -27747,13 +35689,21 @@ func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27779,6 +35729,7 @@ func (f fastpathT) DecMapInt16BoolX(vp *map[int16]bool, checkNil bool, d *Decode func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, checkNil bool, canChange bool, d *Decoder) (_ map[int16]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27798,7 +35749,13 @@ func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, checkNil bool, canChange b var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -27806,13 +35763,21 @@ func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int16(dd.DecodeInt(16)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27838,6 +35803,7 @@ func (f fastpathT) DecMapInt32IntfX(vp *map[int32]interface{}, checkNil bool, d func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[int32]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27857,7 +35823,13 @@ func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, checkNil bool, canC var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -27870,7 +35842,13 @@ func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, checkNil bool, canC } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -27881,7 +35859,9 @@ func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, checkNil bool, canC v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27907,6 +35887,7 @@ func (f fastpathT) DecMapInt32StringX(vp *map[int32]string, checkNil bool, d *De func (_ fastpathT) DecMapInt32StringV(v map[int32]string, checkNil bool, canChange bool, d *Decoder) (_ map[int32]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27926,7 +35907,13 @@ func (_ fastpathT) DecMapInt32StringV(v map[int32]string, checkNil bool, canChan var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -27934,13 +35921,21 @@ func (_ fastpathT) DecMapInt32StringV(v map[int32]string, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -27966,6 +35961,7 @@ func (f fastpathT) DecMapInt32UintX(vp *map[int32]uint, checkNil bool, d *Decode func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, checkNil bool, canChange bool, d *Decoder) (_ map[int32]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -27985,7 +35981,13 @@ func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, checkNil bool, canChange b var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -27993,13 +35995,21 @@ func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28025,6 +36035,7 @@ func (f fastpathT) DecMapInt32Uint8X(vp *map[int32]uint8, checkNil bool, d *Deco func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[int32]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28044,7 +36055,13 @@ func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, checkNil bool, canChange var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -28052,13 +36069,21 @@ func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28084,6 +36109,7 @@ func (f fastpathT) DecMapInt32Uint16X(vp *map[int32]uint16, checkNil bool, d *De func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[int32]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28103,7 +36129,13 @@ func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, checkNil bool, canChan var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -28111,13 +36143,21 @@ func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28143,6 +36183,7 @@ func (f fastpathT) DecMapInt32Uint32X(vp *map[int32]uint32, checkNil bool, d *De func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[int32]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28162,7 +36203,13 @@ func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, checkNil bool, canChan var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -28170,13 +36217,21 @@ func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28202,6 +36257,7 @@ func (f fastpathT) DecMapInt32Uint64X(vp *map[int32]uint64, checkNil bool, d *De func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[int32]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28221,7 +36277,13 @@ func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, checkNil bool, canChan var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -28229,13 +36291,21 @@ func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28261,6 +36331,7 @@ func (f fastpathT) DecMapInt32UintptrX(vp *map[int32]uintptr, checkNil bool, d * func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[int32]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28280,7 +36351,13 @@ func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, checkNil bool, canCh var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -28288,13 +36365,21 @@ func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28320,6 +36405,7 @@ func (f fastpathT) DecMapInt32IntX(vp *map[int32]int, checkNil bool, d *Decoder) func (_ fastpathT) DecMapInt32IntV(v map[int32]int, checkNil bool, canChange bool, d *Decoder) (_ map[int32]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28339,7 +36425,13 @@ func (_ fastpathT) DecMapInt32IntV(v map[int32]int, checkNil bool, canChange boo var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -28347,13 +36439,21 @@ func (_ fastpathT) DecMapInt32IntV(v map[int32]int, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28379,6 +36479,7 @@ func (f fastpathT) DecMapInt32Int8X(vp *map[int32]int8, checkNil bool, d *Decode func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, checkNil bool, canChange bool, d *Decoder) (_ map[int32]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28398,7 +36499,13 @@ func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, checkNil bool, canChange b var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -28406,13 +36513,21 @@ func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28438,6 +36553,7 @@ func (f fastpathT) DecMapInt32Int16X(vp *map[int32]int16, checkNil bool, d *Deco func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, checkNil bool, canChange bool, d *Decoder) (_ map[int32]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28457,7 +36573,13 @@ func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, checkNil bool, canChange var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -28465,13 +36587,21 @@ func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28497,6 +36627,7 @@ func (f fastpathT) DecMapInt32Int32X(vp *map[int32]int32, checkNil bool, d *Deco func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, checkNil bool, canChange bool, d *Decoder) (_ map[int32]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28516,7 +36647,13 @@ func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, checkNil bool, canChange var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -28524,13 +36661,21 @@ func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28556,6 +36701,7 @@ func (f fastpathT) DecMapInt32Int64X(vp *map[int32]int64, checkNil bool, d *Deco func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, checkNil bool, canChange bool, d *Decoder) (_ map[int32]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28575,7 +36721,13 @@ func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, checkNil bool, canChange var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -28583,13 +36735,21 @@ func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28615,6 +36775,7 @@ func (f fastpathT) DecMapInt32Float32X(vp *map[int32]float32, checkNil bool, d * func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, checkNil bool, canChange bool, d *Decoder) (_ map[int32]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28634,7 +36795,13 @@ func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, checkNil bool, canCh var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -28642,13 +36809,21 @@ func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28674,6 +36849,7 @@ func (f fastpathT) DecMapInt32Float64X(vp *map[int32]float64, checkNil bool, d * func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, checkNil bool, canChange bool, d *Decoder) (_ map[int32]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28693,7 +36869,13 @@ func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, checkNil bool, canCh var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -28701,13 +36883,21 @@ func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28733,6 +36923,7 @@ func (f fastpathT) DecMapInt32BoolX(vp *map[int32]bool, checkNil bool, d *Decode func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, checkNil bool, canChange bool, d *Decoder) (_ map[int32]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28752,7 +36943,13 @@ func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, checkNil bool, canChange b var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -28760,13 +36957,21 @@ func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = int32(dd.DecodeInt(32)) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28792,6 +36997,7 @@ func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, checkNil bool, d func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[int64]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28811,7 +37017,13 @@ func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, checkNil bool, canC var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -28824,7 +37036,13 @@ func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, checkNil bool, canC } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -28835,7 +37053,9 @@ func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, checkNil bool, canC v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28861,6 +37081,7 @@ func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, checkNil bool, d *De func (_ fastpathT) DecMapInt64StringV(v map[int64]string, checkNil bool, canChange bool, d *Decoder) (_ map[int64]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28880,7 +37101,13 @@ func (_ fastpathT) DecMapInt64StringV(v map[int64]string, checkNil bool, canChan var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -28888,13 +37115,21 @@ func (_ fastpathT) DecMapInt64StringV(v map[int64]string, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28920,6 +37155,7 @@ func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, checkNil bool, d *Decode func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, checkNil bool, canChange bool, d *Decoder) (_ map[int64]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28939,7 +37175,13 @@ func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, checkNil bool, canChange b var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -28947,13 +37189,21 @@ func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -28979,6 +37229,7 @@ func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, checkNil bool, d *Deco func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[int64]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -28998,7 +37249,13 @@ func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, checkNil bool, canChange var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -29006,13 +37263,21 @@ func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29038,6 +37303,7 @@ func (f fastpathT) DecMapInt64Uint16X(vp *map[int64]uint16, checkNil bool, d *De func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[int64]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29057,7 +37323,13 @@ func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, checkNil bool, canChan var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -29065,13 +37337,21 @@ func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29097,6 +37377,7 @@ func (f fastpathT) DecMapInt64Uint32X(vp *map[int64]uint32, checkNil bool, d *De func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[int64]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29116,7 +37397,13 @@ func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, checkNil bool, canChan var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -29124,13 +37411,21 @@ func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29156,6 +37451,7 @@ func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, checkNil bool, d *De func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[int64]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29175,7 +37471,13 @@ func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, checkNil bool, canChan var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -29183,13 +37485,21 @@ func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29215,6 +37525,7 @@ func (f fastpathT) DecMapInt64UintptrX(vp *map[int64]uintptr, checkNil bool, d * func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[int64]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29234,7 +37545,13 @@ func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, checkNil bool, canCh var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -29242,13 +37559,21 @@ func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29274,6 +37599,7 @@ func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, checkNil bool, d *Decoder) func (_ fastpathT) DecMapInt64IntV(v map[int64]int, checkNil bool, canChange bool, d *Decoder) (_ map[int64]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29293,7 +37619,13 @@ func (_ fastpathT) DecMapInt64IntV(v map[int64]int, checkNil bool, canChange boo var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -29301,13 +37633,21 @@ func (_ fastpathT) DecMapInt64IntV(v map[int64]int, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29333,6 +37673,7 @@ func (f fastpathT) DecMapInt64Int8X(vp *map[int64]int8, checkNil bool, d *Decode func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, checkNil bool, canChange bool, d *Decoder) (_ map[int64]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29352,7 +37693,13 @@ func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, checkNil bool, canChange b var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -29360,13 +37707,21 @@ func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29392,6 +37747,7 @@ func (f fastpathT) DecMapInt64Int16X(vp *map[int64]int16, checkNil bool, d *Deco func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, checkNil bool, canChange bool, d *Decoder) (_ map[int64]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29411,7 +37767,13 @@ func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, checkNil bool, canChange var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -29419,13 +37781,21 @@ func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29451,6 +37821,7 @@ func (f fastpathT) DecMapInt64Int32X(vp *map[int64]int32, checkNil bool, d *Deco func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, checkNil bool, canChange bool, d *Decoder) (_ map[int64]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29470,7 +37841,13 @@ func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, checkNil bool, canChange var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -29478,13 +37855,21 @@ func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29510,6 +37895,7 @@ func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, checkNil bool, d *Deco func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, checkNil bool, canChange bool, d *Decoder) (_ map[int64]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29529,7 +37915,13 @@ func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, checkNil bool, canChange var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -29537,13 +37929,21 @@ func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29569,6 +37969,7 @@ func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, checkNil bool, d * func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, checkNil bool, canChange bool, d *Decoder) (_ map[int64]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29588,7 +37989,13 @@ func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, checkNil bool, canCh var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -29596,13 +38003,21 @@ func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29628,6 +38043,7 @@ func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, checkNil bool, d * func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, checkNil bool, canChange bool, d *Decoder) (_ map[int64]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29647,7 +38063,13 @@ func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, checkNil bool, canCh var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -29655,13 +38077,21 @@ func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, checkNil bool, canCh } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29687,6 +38117,7 @@ func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, checkNil bool, d *Decode func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, checkNil bool, canChange bool, d *Decoder) (_ map[int64]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29706,7 +38137,13 @@ func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, checkNil bool, canChange b var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -29714,13 +38151,21 @@ func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeInt(64) + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29746,6 +38191,7 @@ func (f fastpathT) DecMapBoolIntfX(vp *map[bool]interface{}, checkNil bool, d *D func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, checkNil bool, canChange bool, d *Decoder) (_ map[bool]interface{}, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29765,7 +38211,13 @@ func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, checkNil bool, canCha var mv interface{} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -29778,7 +38230,13 @@ func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, checkNil bool, canCha } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } if mapGet { mv = v[mk] } else { @@ -29789,7 +38247,9 @@ func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, checkNil bool, canCha v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29815,6 +38275,7 @@ func (f fastpathT) DecMapBoolStringX(vp *map[bool]string, checkNil bool, d *Deco func (_ fastpathT) DecMapBoolStringV(v map[bool]string, checkNil bool, canChange bool, d *Decoder) (_ map[bool]string, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29834,7 +38295,13 @@ func (_ fastpathT) DecMapBoolStringV(v map[bool]string, checkNil bool, canChange var mv string if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv @@ -29842,13 +38309,21 @@ func (_ fastpathT) DecMapBoolStringV(v map[bool]string, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeString() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29874,6 +38349,7 @@ func (f fastpathT) DecMapBoolUintX(vp *map[bool]uint, checkNil bool, d *Decoder) func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, checkNil bool, canChange bool, d *Decoder) (_ map[bool]uint, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29893,7 +38369,13 @@ func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, checkNil bool, canChange boo var mv uint if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -29901,13 +38383,21 @@ func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29933,6 +38423,7 @@ func (f fastpathT) DecMapBoolUint8X(vp *map[bool]uint8, checkNil bool, d *Decode func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, checkNil bool, canChange bool, d *Decoder) (_ map[bool]uint8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -29952,7 +38443,13 @@ func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, checkNil bool, canChange b var mv uint8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv @@ -29960,13 +38457,21 @@ func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint8(dd.DecodeUint(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -29992,6 +38497,7 @@ func (f fastpathT) DecMapBoolUint16X(vp *map[bool]uint16, checkNil bool, d *Deco func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, checkNil bool, canChange bool, d *Decoder) (_ map[bool]uint16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30011,7 +38517,13 @@ func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, checkNil bool, canChange var mv uint16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv @@ -30019,13 +38531,21 @@ func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint16(dd.DecodeUint(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30051,6 +38571,7 @@ func (f fastpathT) DecMapBoolUint32X(vp *map[bool]uint32, checkNil bool, d *Deco func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, checkNil bool, canChange bool, d *Decoder) (_ map[bool]uint32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30070,7 +38591,13 @@ func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, checkNil bool, canChange var mv uint32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv @@ -30078,13 +38605,21 @@ func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uint32(dd.DecodeUint(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30110,6 +38645,7 @@ func (f fastpathT) DecMapBoolUint64X(vp *map[bool]uint64, checkNil bool, d *Deco func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, checkNil bool, canChange bool, d *Decoder) (_ map[bool]uint64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30129,7 +38665,13 @@ func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, checkNil bool, canChange var mv uint64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv @@ -30137,13 +38679,21 @@ func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, checkNil bool, canChange } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeUint(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30169,6 +38719,7 @@ func (f fastpathT) DecMapBoolUintptrX(vp *map[bool]uintptr, checkNil bool, d *De func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, checkNil bool, canChange bool, d *Decoder) (_ map[bool]uintptr, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30188,7 +38739,13 @@ func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, checkNil bool, canChan var mv uintptr if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv @@ -30196,13 +38753,21 @@ func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = uintptr(dd.DecodeUint(uintBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30228,6 +38793,7 @@ func (f fastpathT) DecMapBoolIntX(vp *map[bool]int, checkNil bool, d *Decoder) { func (_ fastpathT) DecMapBoolIntV(v map[bool]int, checkNil bool, canChange bool, d *Decoder) (_ map[bool]int, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30247,7 +38813,13 @@ func (_ fastpathT) DecMapBoolIntV(v map[bool]int, checkNil bool, canChange bool, var mv int if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv @@ -30255,13 +38827,21 @@ func (_ fastpathT) DecMapBoolIntV(v map[bool]int, checkNil bool, canChange bool, } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int(dd.DecodeInt(intBitsize)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30287,6 +38867,7 @@ func (f fastpathT) DecMapBoolInt8X(vp *map[bool]int8, checkNil bool, d *Decoder) func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, checkNil bool, canChange bool, d *Decoder) (_ map[bool]int8, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30306,7 +38887,13 @@ func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, checkNil bool, canChange boo var mv int8 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv @@ -30314,13 +38901,21 @@ func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int8(dd.DecodeInt(8)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30346,6 +38941,7 @@ func (f fastpathT) DecMapBoolInt16X(vp *map[bool]int16, checkNil bool, d *Decode func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, checkNil bool, canChange bool, d *Decoder) (_ map[bool]int16, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30365,7 +38961,13 @@ func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, checkNil bool, canChange b var mv int16 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv @@ -30373,13 +38975,21 @@ func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int16(dd.DecodeInt(16)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30405,6 +39015,7 @@ func (f fastpathT) DecMapBoolInt32X(vp *map[bool]int32, checkNil bool, d *Decode func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, checkNil bool, canChange bool, d *Decoder) (_ map[bool]int32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30424,7 +39035,13 @@ func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, checkNil bool, canChange b var mv int32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv @@ -30432,13 +39049,21 @@ func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = int32(dd.DecodeInt(32)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30464,6 +39089,7 @@ func (f fastpathT) DecMapBoolInt64X(vp *map[bool]int64, checkNil bool, d *Decode func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, checkNil bool, canChange bool, d *Decoder) (_ map[bool]int64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30483,7 +39109,13 @@ func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, checkNil bool, canChange b var mv int64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv @@ -30491,13 +39123,21 @@ func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, checkNil bool, canChange b } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeInt(64) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30523,6 +39163,7 @@ func (f fastpathT) DecMapBoolFloat32X(vp *map[bool]float32, checkNil bool, d *De func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, checkNil bool, canChange bool, d *Decoder) (_ map[bool]float32, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30542,7 +39183,13 @@ func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, checkNil bool, canChan var mv float32 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv @@ -30550,13 +39197,21 @@ func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = float32(dd.DecodeFloat(true)) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30582,6 +39237,7 @@ func (f fastpathT) DecMapBoolFloat64X(vp *map[bool]float64, checkNil bool, d *De func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, checkNil bool, canChange bool, d *Decoder) (_ map[bool]float64, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30601,7 +39257,13 @@ func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, checkNil bool, canChan var mv float64 if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv @@ -30609,13 +39271,21 @@ func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, checkNil bool, canChan } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeFloat(false) if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } @@ -30641,6 +39311,7 @@ func (f fastpathT) DecMapBoolBoolX(vp *map[bool]bool, checkNil bool, d *Decoder) func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, checkNil bool, canChange bool, d *Decoder) (_ map[bool]bool, changed bool) { dd := d.d + cr := d.cr if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -30660,7 +39331,13 @@ func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, checkNil bool, canChange boo var mv bool if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv @@ -30668,13 +39345,21 @@ func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, checkNil bool, canChange boo } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { + cr.sendContainerState(containerMapKey) + } mk = dd.DecodeBool() + if cr != nil { + cr.sendContainerState(containerMapValue) + } mv = dd.DecodeBool() if v != nil { v[mk] = mv } } - dd.ReadEnd() + } + if cr != nil { + cr.sendContainerState(containerMapEnd) } return v, changed } diff --git a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl index 7bcbaf831..04c173fba 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl @@ -1,4 +1,4 @@ -// //+build ignore +// +build !notfastpath // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. @@ -106,6 +106,9 @@ func init() { // -- -- fast path type switch func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { + if !fastpathEnabled { + return false + } switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} case []{{ .Elem }}:{{else}} @@ -116,13 +119,16 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e) {{end}}{{end}} default: - _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true } func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { + if !fastpathEnabled { + return false + } switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} case []{{ .Elem }}: @@ -131,12 +137,16 @@ func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e) {{end}}{{end}}{{end}} default: + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true } func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { + if !fastpathEnabled { + return false + } switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if .MapKey }} case map[{{ .MapKey }}]{{ .Elem }}: @@ -145,6 +155,7 @@ func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e) {{end}}{{end}}{{end}} default: + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true @@ -154,19 +165,50 @@ func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} func (f *encFnInfo) {{ .MethodNamePfx "fastpathEnc" false }}R(rv reflect.Value) { - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv.Interface().([]{{ .Elem }}), fastpathCheckNilFalse, f.e) + if f.ti.mbs { + fastpathTV.{{ .MethodNamePfx "EncAsMap" false }}V(rv.Interface().([]{{ .Elem }}), fastpathCheckNilFalse, f.e) + } else { + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv.Interface().([]{{ .Elem }}), fastpathCheckNilFalse, f.e) + } } func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, checkNil bool, e *Encoder) { - ee := e.e + ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return } ee.EncodeArrayStart(len(v)) for _, v2 := range v { + if cr != nil { cr.sendContainerState(containerArrayElem) } {{ encmd .Elem "v2"}} } - ee.EncodeEnd() + if cr != nil { cr.sendContainerState(containerArrayEnd) }{{/* ee.EncodeEnd() */}} +} + +func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, checkNil bool, e *Encoder) { + ee := e.e + cr := e.cr + if checkNil && v == nil { + ee.EncodeNil() + return + } + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.EncodeMapStart(len(v) / 2) + for j, v2 := range v { + if cr != nil { + if j%2 == 0 { + cr.sendContainerState(containerMapKey) + } else { + cr.sendContainerState(containerMapValue) + } + } + {{ encmd .Elem "v2"}} + } + if cr != nil { cr.sendContainerState(containerMapEnd) } } {{end}}{{end}}{{end}} @@ -178,6 +220,7 @@ func (f *encFnInfo) {{ .MethodNamePfx "fastpathEnc" false }}R(rv reflect.Value) } func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, e *Encoder) { ee := e.e + cr := e.cr if checkNil && v == nil { ee.EncodeNil() return @@ -201,7 +244,9 @@ func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Ele } sort.Sort(bytesISlice(v2)) for j := range v2 { + if cr != nil { cr.sendContainerState(containerMapKey) } e.asis(v2[j].v) + if cr != nil { cr.sendContainerState(containerMapValue) } e.encode(v[v2[j].i]) } {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v)) var i int @@ -211,24 +256,28 @@ func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Ele } sort.Sort({{ sorttype .MapKey false}}(v2)) for _, k2 := range v2 { + if cr != nil { cr.sendContainerState(containerMapKey) } {{if eq .MapKey "string"}}if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) }{{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} + if cr != nil { cr.sendContainerState(containerMapValue) } {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }} } {{end}} } else { for k2, v2 := range v { + if cr != nil { cr.sendContainerState(containerMapKey) } {{if eq .MapKey "string"}}if asSymbols { ee.EncodeSymbol(k2) } else { ee.EncodeString(c_UTF8, k2) }{{else}}{{ encmd .MapKey "k2"}}{{end}} + if cr != nil { cr.sendContainerState(containerMapValue) } {{ encmd .Elem "v2"}} } } - ee.EncodeEnd() + if cr != nil { cr.sendContainerState(containerMapEnd) }{{/* ee.EncodeEnd() */}} } {{end}}{{end}}{{end}} @@ -237,6 +286,9 @@ func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Ele // -- -- fast path type switch func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { + if !fastpathEnabled { + return false + } switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} case []{{ .Elem }}:{{else}} @@ -250,6 +302,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } {{end}}{{end}} default: + _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) return false } return true @@ -283,8 +336,7 @@ func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *[]{{ .Elem }}, checkNil *vp = v } } -func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, checkNil bool, canChange bool, - d *Decoder) (_ []{{ .Elem }}, changed bool) { +func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, checkNil bool, canChange bool, d *Decoder) (_ []{{ .Elem }}, changed bool) { dd := d.d {{/* // if dd.isContainerType(valueTypeNil) { dd.TryDecodeAsNil() */}} if checkNil && dd.TryDecodeAsNil() { @@ -295,28 +347,22 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, checkNil b } slh, containerLenS := d.decSliceHelperStart() - x2read := containerLenS - var xtrunc bool - if canChange && v == nil { - var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }}); xtrunc { - x2read = xlen - } - v = make([]{{ .Elem }}, xlen) - changed = true - } if containerLenS == 0 { - if canChange && len(v) != 0 { - v = v[:0] - changed = true - }{{/* - // slh.End() // dd.ReadArrayEnd() - */}} - return v, changed + if canChange { + if v == nil { + v = []{{ .Elem }}{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed } - {{/* // for j := 0; j < containerLenS; j++ { */}} if containerLenS > 0 { + x2read := containerLenS + var xtrunc bool if containerLenS > cap(v) { if canChange { {{/* // fast-path is for "basic" immutable types, so no need to copy them over @@ -324,37 +370,64 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, checkNil b // copy(s, v[:cap(v)]) // v = s */}} var xlen int - if xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }}); xtrunc { - x2read = xlen + xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }}) + if xtrunc { + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]{{ .Elem }}, xlen) + } + } else { + v = make([]{{ .Elem }}, xlen) } - v = make([]{{ .Elem }}, xlen) changed = true } else { d.arrayCannotExpand(len(v), containerLenS) - x2read = len(v) } + x2read = len(v) } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true - } - {{/* // all checks done. cannot go past len. */}} + if canChange { + v = v[:containerLenS] + changed = true + } + } {{/* // all checks done. cannot go past len. */}} j := 0 - for ; j < x2read; j++ { + for ; j < x2read; j++ { + slh.ElemContainerState(j) {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }} } if xtrunc { {{/* // means canChange=true, changed=true already. */}} for ; j < containerLenS; j++ { v = append(v, {{ zerocmd .Elem }}) + slh.ElemContainerState(j) {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }} } } else if !canChange { - for ; j < containerLenS; j++ { + for ; j < containerLenS; j++ { + slh.ElemContainerState(j) d.swallow() } } } else { - j := 0 - for ; !dd.CheckBreak(); j++ { + breakFound := dd.CheckBreak() {{/* check break first, so we can initialize v with a capacity of 4 if necessary */}} + if breakFound { + if canChange { + if v == nil { + v = []{{ .Elem }}{} + } else if len(v) != 0 { + v = v[:0] + } + changed = true + } + slh.End() + return v, changed + } + if cap(v) == 0 { + v = make([]{{ .Elem }}, 1, 4) + changed = true + } + j := 0 + for ; !breakFound; j++ { if j >= len(v) { if canChange { v = append(v, {{ zerocmd .Elem }}) @@ -362,16 +435,22 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, checkNil b } else { d.arrayCannotExpand(len(v), j+1) } - } + } + slh.ElemContainerState(j) if j < len(v) { {{/* // all checks done. cannot go past len. */}} {{ if eq .Elem "interface{}" }}d.decode(&v[j]) {{ else }}v[j] = {{ decmd .Elem }}{{ end }} } else { d.swallow() } + breakFound = dd.CheckBreak() + } + if canChange && j < len(v) { + v = v[:j] + changed = true } - slh.End() } + slh.End() return v, changed } @@ -405,6 +484,7 @@ func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .E func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, canChange bool, d *Decoder) (_ map[{{ .MapKey }}]{{ .Elem }}, changed bool) { dd := d.d + cr := d.cr {{/* // if dd.isContainerType(valueTypeNil) {dd.TryDecodeAsNil() */}} if checkNil && dd.TryDecodeAsNil() { if v != nil { @@ -424,11 +504,13 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Ele var mv {{ .Elem }} if containerLen > 0 { for j := 0; j < containerLen; j++ { + if cr != nil { cr.sendContainerState(containerMapKey) } {{ if eq .MapKey "interface{}" }}mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}} }{{ else }}mk = {{ decmd .MapKey }}{{ end }} + if cr != nil { cr.sendContainerState(containerMapValue) } {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil } d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }} if v != nil { @@ -437,19 +519,21 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Ele } } else if containerLen < 0 { for j := 0; !dd.CheckBreak(); j++ { + if cr != nil { cr.sendContainerState(containerMapKey) } {{ if eq .MapKey "interface{}" }}mk = nil d.decode(&mk) if bv, bok := mk.([]byte); bok { mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}} }{{ else }}mk = {{ decmd .MapKey }}{{ end }} + if cr != nil { cr.sendContainerState(containerMapValue) } {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil } d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }} if v != nil { v[mk] = mv } } - dd.ReadEnd() } + if cr != nil { cr.sendContainerState(containerMapEnd) } return v, changed } diff --git a/vendor/github.com/ugorji/go/codec/fast-path.not.go b/vendor/github.com/ugorji/go/codec/fast-path.not.go new file mode 100644 index 000000000..d6f5f0c91 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/fast-path.not.go @@ -0,0 +1,32 @@ +// +build notfastpath + +package codec + +import "reflect" + +// The generated fast-path code is very large, and adds a few seconds to the build time. +// This causes test execution, execution of small tools which use codec, etc +// to take a long time. +// +// To mitigate, we now support the notfastpath tag. +// This tag disables fastpath during build, allowing for faster build, test execution, +// short-program runs, etc. + +func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false } +func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } +func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } +func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } + +type fastpathT struct{} +type fastpathE struct { + rtid uintptr + rt reflect.Type + encfn func(*encFnInfo, reflect.Value) + decfn func(*decFnInfo, reflect.Value) +} +type fastpathA [0]fastpathE + +func (x fastpathA) index(rtid uintptr) int { return -1 } + +var fastpathAV fastpathA +var fastpathTV fastpathT diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl index eb31a9a96..32df54144 100644 --- a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl @@ -1,86 +1,104 @@ -{{var "v"}} := {{ if not isArray}}*{{ end }}{{ .Varname }} -{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}} - -var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}} -var {{var "c"}}, {{var "rt"}} bool {{/* // changed, truncated */}} -_, _, _ = {{var "c"}}, {{var "rt"}}, {{var "rl"}} -{{var "rr"}} = {{var "l"}} -{{/* rl is NOT used. Only used for getting DecInferLen. len(r) used directly in code */}} - -{{ if not isArray }}if {{var "v"}} == nil { - if {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}); {{var "rt"}} { - {{var "rr"}} = {{var "rl"}} - } - {{var "v"}} = make({{ .CTyp }}, {{var "rl"}}) - {{var "c"}} = true -} -{{ end }} -if {{var "l"}} == 0 { {{ if isSlice }} - if len({{var "v"}}) != 0 { - {{var "v"}} = {{var "v"}}[:0] - {{var "c"}} = true - } {{ end }} +{{var "v"}} := {{if not isArray}}*{{end}}{{ .Varname }} +{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}}{{if not isArray}} +var {{var "c"}} bool {{/* // changed */}} +_ = {{var "c"}}{{end}} +if {{var "l"}} == 0 { + {{if isSlice }}if {{var "v"}} == nil { + {{var "v"}} = []{{ .Typ }}{} + {{var "c"}} = true + } else if len({{var "v"}}) != 0 { + {{var "v"}} = {{var "v"}}[:0] + {{var "c"}} = true + } {{end}} {{if isChan }}if {{var "v"}} == nil { + {{var "v"}} = make({{ .CTyp }}, 0) + {{var "c"}} = true + } {{end}} } else if {{var "l"}} > 0 { - {{ if isChan }} + {{if isChan }}if {{var "v"}} == nil { + {{var "rl"}}, _ = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) + {{var "v"}} = make({{ .CTyp }}, {{var "rl"}}) + {{var "c"}} = true + } for {{var "r"}} := 0; {{var "r"}} < {{var "l"}}; {{var "r"}}++ { + {{var "h"}}.ElemContainerState({{var "r"}}) var {{var "t"}} {{ .Typ }} {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} - {{var "v"}} <- {{var "t"}} - {{ else }} - if {{var "l"}} > cap({{var "v"}}) { - {{ if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}}) - {{ else }}{{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) - {{ if .Immutable }} - {{var "v2"}} := {{var "v"}} - {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) - if len({{var "v"}}) > 0 { - copy({{var "v"}}, {{var "v2"}}[:cap({{var "v2"}})]) - } - {{ else }}{{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) - {{ end }}{{var "c"}} = true - {{ end }} - {{var "rr"}} = len({{var "v"}}) - } else if {{var "l"}} != len({{var "v"}}) { - {{ if isSlice }}{{var "v"}} = {{var "v"}}[:{{var "l"}}] - {{var "c"}} = true {{ end }} + {{var "v"}} <- {{var "t"}} } + {{ else }} var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}} + var {{var "rt"}} bool {{/* truncated */}} + _, _ = {{var "rl"}}, {{var "rt"}} + {{var "rr"}} = {{var "l"}} // len({{var "v"}}) + if {{var "l"}} > cap({{var "v"}}) { + {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}}) + {{ else }}{{if not .Immutable }} + {{var "rg"}} := len({{var "v"}}) > 0 + {{var "v2"}} := {{var "v"}} {{end}} + {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) + if {{var "rt"}} { + if {{var "rl"}} <= cap({{var "v"}}) { + {{var "v"}} = {{var "v"}}[:{{var "rl"}}] + } else { + {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) + } + } else { + {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) + } + {{var "c"}} = true + {{var "rr"}} = len({{var "v"}}) {{if not .Immutable }} + if {{var "rg"}} { copy({{var "v"}}, {{var "v2"}}) } {{end}} {{end}}{{/* end not Immutable, isArray */}} + } {{if isSlice }} else if {{var "l"}} != len({{var "v"}}) { + {{var "v"}} = {{var "v"}}[:{{var "l"}}] + {{var "c"}} = true + } {{end}} {{/* end isSlice:47 */}} {{var "j"}} := 0 for ; {{var "j"}} < {{var "rr"}} ; {{var "j"}}++ { + {{var "h"}}.ElemContainerState({{var "j"}}) {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } - {{ if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { + {{if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { + {{var "h"}}.ElemContainerState({{var "j"}}) z.DecSwallow() } - {{ else }}if {{var "rt"}} { {{/* means that it is mutable and slice */}} + {{ else }}if {{var "rt"}} { for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { {{var "v"}} = append({{var "v"}}, {{ zero}}) + {{var "h"}}.ElemContainerState({{var "j"}}) {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } - } - {{ end }} - {{ end }}{{/* closing 'if not chan' */}} -} else { - for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ { - if {{var "j"}} >= len({{var "v"}}) { - {{ if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) - {{ else if isSlice}}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }} - {{var "c"}} = true {{ end }} - } - {{ if isChan}} + } {{end}} {{/* end isArray:56 */}} + {{end}} {{/* end isChan:16 */}} +} else { {{/* len < 0 */}} + {{var "j"}} := 0 + for ; !r.CheckBreak(); {{var "j"}}++ { + {{if isChan }} + {{var "h"}}.ElemContainerState({{var "j"}}) var {{var "t"}} {{ .Typ }} {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} {{var "v"}} <- {{var "t"}} {{ else }} + if {{var "j"}} >= len({{var "v"}}) { + {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) + {{ else }}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }} + {{var "c"}} = true {{end}} + } + {{var "h"}}.ElemContainerState({{var "j"}}) if {{var "j"}} < len({{var "v"}}) { {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } else { z.DecSwallow() } - {{ end }} + {{end}} } - {{var "h"}}.End() + {{if isSlice }}if {{var "j"}} < len({{var "v"}}) { + {{var "v"}} = {{var "v"}}[:{{var "j"}}] + {{var "c"}} = true + } else if {{var "j"}} == 0 && {{var "v"}} == nil { + {{var "v"}} = []{{ .Typ }}{} + {{var "c"}} = true + }{{end}} } -{{ if not isArray }}if {{var "c"}} { +{{var "h"}}.End() +{{if not isArray }}if {{var "c"}} { *{{ .Varname }} = {{var "v"}} -}{{ end }} - +}{{end}} diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl index 836eb3b5d..77400e0a1 100644 --- a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl @@ -8,7 +8,7 @@ if {{var "v"}} == nil { } var {{var "mk"}} {{ .KTyp }} var {{var "mv"}} {{ .Typ }} -var {{var "mg"}} bool +var {{var "mg"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool if {{var "bh"}}.MapValueReset { {{if decElemKindPtr}}{{var "mg"}} = true {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true } @@ -16,31 +16,43 @@ if {{var "bh"}}.MapValueReset { {{end}} } if {{var "l"}} > 0 { for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ { + z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { {{var "mk"}} = string({{var "bv"}}) - }{{ end }} + }{{ end }}{{if decElemKindPtr}} + {{var "ms"}} = true{{end}} if {{var "mg"}} { - {{var "mv"}} = {{var "v"}}[{{var "mk"}}] + {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] + if {{var "mok"}} { + {{var "ms"}} = false + } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} + z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} - if {{var "v"}} != nil { + if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } } else if {{var "l"}} < 0 { for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ { + z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { {{var "mk"}} = string({{var "bv"}}) - }{{ end }} + }{{ end }}{{if decElemKindPtr}} + {{var "ms"}} = true {{ end }} if {{var "mg"}} { - {{var "mv"}} = {{var "v"}}[{{var "mk"}}] + {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] + if {{var "mok"}} { + {{var "ms"}} = false + } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} + z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} - if {{var "v"}} != nil { + if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } -r.ReadEnd() } // else len==0: TODO: Should we clear map entries? +z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go index 9710eca50..22bce776b 100644 --- a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go +++ b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go @@ -115,6 +115,15 @@ func (f genHelperEncoder) EncExt(v interface{}) (r bool) { return false } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncSendContainerState(c containerState) { + if f.e.cr != nil { + f.e.cr.sendContainerState(c) + } +} + +// ---------------- DECODER FOLLOWS ----------------- + // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecBasicHandle() *BasicHandle { return f.d.h @@ -167,11 +176,8 @@ func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { // bs := f.dd.DecodeBytes(f.d.b[:], true, true) - f.d.r.track() - f.d.swallow() - bs := f.d.r.stopTrack() - // fmt.Printf(">>>>>> CODECGEN JSON: %s\n", bs) - fnerr := tm.UnmarshalJSON(bs) + // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. + fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()) if fnerr != nil { panic(fnerr) } @@ -218,3 +224,10 @@ func (f genHelperDecoder) DecExt(v interface{}) (r bool) { func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) { return decInferLen(clen, maxlen, unit) } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecSendContainerState(c containerState) { + if f.d.cr != nil { + f.d.cr.sendContainerState(c) + } +} diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl index 8bc506112..31958574f 100644 --- a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl @@ -106,6 +106,14 @@ func (f genHelperEncoder) EncExt(v interface{}) (r bool) { } return false } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncSendContainerState(c containerState) { + if f.e.cr != nil { + f.e.cr.sendContainerState(c) + } +} + +// ---------------- DECODER FOLLOWS ----------------- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecBasicHandle() *BasicHandle { @@ -150,11 +158,8 @@ func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { // bs := f.dd.DecodeBytes(f.d.b[:], true, true) - f.d.r.track() - f.d.swallow() - bs := f.d.r.stopTrack() - // fmt.Printf(">>>>>> CODECGEN JSON: %s\n", bs) - fnerr := tm.UnmarshalJSON(bs) + // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. + fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()) if fnerr != nil { panic(fnerr) } @@ -195,6 +200,12 @@ func (f genHelperDecoder) DecExt(v interface{}) (r bool) { func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) { return decInferLen(clen, maxlen, unit) } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecSendContainerState(c containerState) { + if f.d.cr != nil { + f.d.cr.sendContainerState(c) + } +} {{/* diff --git a/vendor/github.com/ugorji/go/codec/gen.generated.go b/vendor/github.com/ugorji/go/codec/gen.generated.go index dab6d94bd..2ace97b78 100644 --- a/vendor/github.com/ugorji/go/codec/gen.generated.go +++ b/vendor/github.com/ugorji/go/codec/gen.generated.go @@ -16,7 +16,7 @@ if {{var "v"}} == nil { } var {{var "mk"}} {{ .KTyp }} var {{var "mv"}} {{ .Typ }} -var {{var "mg"}} bool +var {{var "mg"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool if {{var "bh"}}.MapValueReset { {{if decElemKindPtr}}{{var "mg"}} = true {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true } @@ -24,122 +24,152 @@ if {{var "bh"}}.MapValueReset { {{end}} } if {{var "l"}} > 0 { for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ { + z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { {{var "mk"}} = string({{var "bv"}}) - }{{ end }} + }{{ end }}{{if decElemKindPtr}} + {{var "ms"}} = true{{end}} if {{var "mg"}} { - {{var "mv"}} = {{var "v"}}[{{var "mk"}}] + {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] + if {{var "mok"}} { + {{var "ms"}} = false + } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} + z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} - if {{var "v"}} != nil { + if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } } else if {{var "l"}} < 0 { for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ { + z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { {{var "mk"}} = string({{var "bv"}}) - }{{ end }} + }{{ end }}{{if decElemKindPtr}} + {{var "ms"}} = true {{ end }} if {{var "mg"}} { - {{var "mv"}} = {{var "v"}}[{{var "mk"}}] + {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] + if {{var "mok"}} { + {{var "ms"}} = false + } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} + z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} - if {{var "v"}} != nil { + if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } -r.ReadEnd() } // else len==0: TODO: Should we clear map entries? +z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) ` const genDecListTmpl = ` -{{var "v"}} := {{ if not isArray}}*{{ end }}{{ .Varname }} -{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}} - -var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}} -var {{var "c"}}, {{var "rt"}} bool {{/* // changed, truncated */}} -_, _, _ = {{var "c"}}, {{var "rt"}}, {{var "rl"}} -{{var "rr"}} = {{var "l"}} -{{/* rl is NOT used. Only used for getting DecInferLen. len(r) used directly in code */}} - -{{ if not isArray }}if {{var "v"}} == nil { - if {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}); {{var "rt"}} { - {{var "rr"}} = {{var "rl"}} - } - {{var "v"}} = make({{ .CTyp }}, {{var "rl"}}) - {{var "c"}} = true -} -{{ end }} -if {{var "l"}} == 0 { {{ if isSlice }} - if len({{var "v"}}) != 0 { - {{var "v"}} = {{var "v"}}[:0] - {{var "c"}} = true - } {{ end }} +{{var "v"}} := {{if not isArray}}*{{end}}{{ .Varname }} +{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}}{{if not isArray}} +var {{var "c"}} bool {{/* // changed */}} +_ = {{var "c"}}{{end}} +if {{var "l"}} == 0 { + {{if isSlice }}if {{var "v"}} == nil { + {{var "v"}} = []{{ .Typ }}{} + {{var "c"}} = true + } else if len({{var "v"}}) != 0 { + {{var "v"}} = {{var "v"}}[:0] + {{var "c"}} = true + } {{end}} {{if isChan }}if {{var "v"}} == nil { + {{var "v"}} = make({{ .CTyp }}, 0) + {{var "c"}} = true + } {{end}} } else if {{var "l"}} > 0 { - {{ if isChan }} + {{if isChan }}if {{var "v"}} == nil { + {{var "rl"}}, _ = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) + {{var "v"}} = make({{ .CTyp }}, {{var "rl"}}) + {{var "c"}} = true + } for {{var "r"}} := 0; {{var "r"}} < {{var "l"}}; {{var "r"}}++ { + {{var "h"}}.ElemContainerState({{var "r"}}) var {{var "t"}} {{ .Typ }} {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} - {{var "v"}} <- {{var "t"}} - {{ else }} - if {{var "l"}} > cap({{var "v"}}) { - {{ if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}}) - {{ else }}{{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) - {{ if .Immutable }} - {{var "v2"}} := {{var "v"}} - {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) - if len({{var "v"}}) > 0 { - copy({{var "v"}}, {{var "v2"}}[:cap({{var "v2"}})]) - } - {{ else }}{{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) - {{ end }}{{var "c"}} = true - {{ end }} - {{var "rr"}} = len({{var "v"}}) - } else if {{var "l"}} != len({{var "v"}}) { - {{ if isSlice }}{{var "v"}} = {{var "v"}}[:{{var "l"}}] - {{var "c"}} = true {{ end }} + {{var "v"}} <- {{var "t"}} } + {{ else }} var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}} + var {{var "rt"}} bool {{/* truncated */}} + _, _ = {{var "rl"}}, {{var "rt"}} + {{var "rr"}} = {{var "l"}} // len({{var "v"}}) + if {{var "l"}} > cap({{var "v"}}) { + {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}}) + {{ else }}{{if not .Immutable }} + {{var "rg"}} := len({{var "v"}}) > 0 + {{var "v2"}} := {{var "v"}} {{end}} + {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) + if {{var "rt"}} { + if {{var "rl"}} <= cap({{var "v"}}) { + {{var "v"}} = {{var "v"}}[:{{var "rl"}}] + } else { + {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) + } + } else { + {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) + } + {{var "c"}} = true + {{var "rr"}} = len({{var "v"}}) {{if not .Immutable }} + if {{var "rg"}} { copy({{var "v"}}, {{var "v2"}}) } {{end}} {{end}}{{/* end not Immutable, isArray */}} + } {{if isSlice }} else if {{var "l"}} != len({{var "v"}}) { + {{var "v"}} = {{var "v"}}[:{{var "l"}}] + {{var "c"}} = true + } {{end}} {{/* end isSlice:47 */}} {{var "j"}} := 0 for ; {{var "j"}} < {{var "rr"}} ; {{var "j"}}++ { + {{var "h"}}.ElemContainerState({{var "j"}}) {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } - {{ if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { + {{if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { + {{var "h"}}.ElemContainerState({{var "j"}}) z.DecSwallow() } - {{ else }}if {{var "rt"}} { {{/* means that it is mutable and slice */}} + {{ else }}if {{var "rt"}} { for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { {{var "v"}} = append({{var "v"}}, {{ zero}}) + {{var "h"}}.ElemContainerState({{var "j"}}) {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } - } - {{ end }} - {{ end }}{{/* closing 'if not chan' */}} -} else { - for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ { - if {{var "j"}} >= len({{var "v"}}) { - {{ if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) - {{ else if isSlice}}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }} - {{var "c"}} = true {{ end }} - } - {{ if isChan}} + } {{end}} {{/* end isArray:56 */}} + {{end}} {{/* end isChan:16 */}} +} else { {{/* len < 0 */}} + {{var "j"}} := 0 + for ; !r.CheckBreak(); {{var "j"}}++ { + {{if isChan }} + {{var "h"}}.ElemContainerState({{var "j"}}) var {{var "t"}} {{ .Typ }} {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} {{var "v"}} <- {{var "t"}} {{ else }} + if {{var "j"}} >= len({{var "v"}}) { + {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) + {{ else }}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }} + {{var "c"}} = true {{end}} + } + {{var "h"}}.ElemContainerState({{var "j"}}) if {{var "j"}} < len({{var "v"}}) { {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } else { z.DecSwallow() } - {{ end }} + {{end}} } - {{var "h"}}.End() + {{if isSlice }}if {{var "j"}} < len({{var "v"}}) { + {{var "v"}} = {{var "v"}}[:{{var "j"}}] + {{var "c"}} = true + } else if {{var "j"}} == 0 && {{var "v"}} == nil { + {{var "v"}} = []{{ .Typ }}{} + {{var "c"}} = true + }{{end}} } -{{ if not isArray }}if {{var "c"}} { +{{var "h"}}.End() +{{if not isArray }}if {{var "c"}} { *{{ .Varname }} = {{var "v"}} -}{{ end }} - +}{{end}} ` diff --git a/vendor/github.com/ugorji/go/codec/gen.go b/vendor/github.com/ugorji/go/codec/gen.go index b158564ba..ffc5aecf6 100644 --- a/vendor/github.com/ugorji/go/codec/gen.go +++ b/vendor/github.com/ugorji/go/codec/gen.go @@ -21,6 +21,8 @@ import ( "sync" "text/template" "time" + "unicode" + "unicode/utf8" ) // --------------------------------------------------- @@ -91,7 +93,8 @@ import ( // v3: Changes for Kubernetes: // changes in signature of some unpublished helper methods and codecgen cmdline arguments. // v4: Removed separator support from (en|de)cDriver, and refactored codec(gen) -const GenVersion = 4 +// v5: changes to support faster json decoding. Let encoder/decoder maintain state of collections. +const GenVersion = 5 const ( genCodecPkg = "codec1978" @@ -110,6 +113,14 @@ const ( genUseOneFunctionForDecStructMap = true ) +type genStructMapStyle uint8 + +const ( + genStructMapStyleConsolidated genStructMapStyle = iota + genStructMapStyleLenPrefix + genStructMapStyleCheckBreak +) + var ( genAllTypesSamePkgErr = errors.New("All types must be in the same package") genExpectArrayOrMapErr = errors.New("unexpected type. Expecting array/map/slice") @@ -230,10 +241,18 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn x.line("") x.line("const (") + x.linef("// ----- content types ----") x.linef("codecSelferC_UTF8%s = %v", x.xs, int64(c_UTF8)) x.linef("codecSelferC_RAW%s = %v", x.xs, int64(c_RAW)) + x.linef("// ----- value types used ----") x.linef("codecSelferValueTypeArray%s = %v", x.xs, int64(valueTypeArray)) x.linef("codecSelferValueTypeMap%s = %v", x.xs, int64(valueTypeMap)) + x.linef("// ----- containerStateValues ----") + x.linef("codecSelfer_containerMapKey%s = %v", x.xs, int64(containerMapKey)) + x.linef("codecSelfer_containerMapValue%s = %v", x.xs, int64(containerMapValue)) + x.linef("codecSelfer_containerMapEnd%s = %v", x.xs, int64(containerMapEnd)) + x.linef("codecSelfer_containerArrayElem%s = %v", x.xs, int64(containerArrayElem)) + x.linef("codecSelfer_containerArrayEnd%s = %v", x.xs, int64(containerArrayEnd)) x.line(")") x.line("var (") x.line("codecSelferBitsize" + x.xs + " = uint8(reflect.TypeOf(uint(0)).Bits())") @@ -249,14 +268,13 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn x.line("type " + x.hn + " struct{}") x.line("") + x.varsfxreset() x.line("func init() {") x.linef("if %sGenVersion != %v {", x.cpfx, GenVersion) x.line("_, file, _, _ := runtime.Caller(0)") x.line(`err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", `) x.linef(`%v, %sGenVersion, file)`, GenVersion, x.cpfx) x.line("panic(err)") - // x.linef(`panic(fmt.Errorf("Re-run codecgen due to version mismatch: `+ - // `current: %%v, need %%v, file: %%v", %v, %sGenVersion, file))`, GenVersion, x.cpfx) x.linef("}") x.line("if false { // reference the types, but skip this branch at build/run time") var n int @@ -294,6 +312,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn for _, t := range x.ts { rtid := reflect.ValueOf(t).Pointer() // generate enc functions for all these slice/map types. + x.varsfxreset() x.linef("func (x %s) enc%s(v %s%s, e *%sEncoder) {", x.hn, x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), x.cpfx) x.genRequiredMethodVars(true) switch t.Kind() { @@ -308,6 +327,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn x.line("") // generate dec functions for all these slice/map types. + x.varsfxreset() x.linef("func (x %s) dec%s(v *%s, d *%sDecoder) {", x.hn, x.genMethodNameT(t), x.genTypeName(t), x.cpfx) x.genRequiredMethodVars(false) switch t.Kind() { @@ -362,7 +382,7 @@ func (x *genRunner) genRefPkgs(t reflect.Type) { x.imn[tpkg] = tpkg } else { x.imc++ - x.imn[tpkg] = "pkg" + strconv.FormatUint(x.imc, 10) + "_" + tpkg[idx+1:] + x.imn[tpkg] = "pkg" + strconv.FormatUint(x.imc, 10) + "_" + genGoIdentifier(tpkg[idx+1:], false) } } } @@ -393,6 +413,10 @@ func (x *genRunner) varsfx() string { return strconv.FormatUint(x.c, 10) } +func (x *genRunner) varsfxreset() { + x.c = 0 +} + func (x *genRunner) out(s string) { if _, err := io.WriteString(x.w, s); err != nil { panic(err) @@ -479,6 +503,7 @@ func (x *genRunner) selfer(encode bool) { // always make decode use a pointer receiver, // and structs always use a ptr receiver (encode|decode) isptr := !encode || t.Kind() == reflect.Struct + x.varsfxreset() fnSigPfx := "func (x " if isptr { fnSigPfx += "*" @@ -515,21 +540,21 @@ func (x *genRunner) selfer(encode bool) { x.out(fnSigPfx) x.line(") codecDecodeSelfFromMap(l int, d *" + x.cpfx + "Decoder) {") x.genRequiredMethodVars(false) - x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, 0) + x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleConsolidated) x.line("}") x.line("") } else { x.out(fnSigPfx) x.line(") codecDecodeSelfFromMapLenPrefix(l int, d *" + x.cpfx + "Decoder) {") x.genRequiredMethodVars(false) - x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, 1) + x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleLenPrefix) x.line("}") x.line("") x.out(fnSigPfx) x.line(") codecDecodeSelfFromMapCheckBreak(l int, d *" + x.cpfx + "Decoder) {") x.genRequiredMethodVars(false) - x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, 2) + x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleCheckBreak) x.line("}") x.line("") } @@ -548,14 +573,31 @@ func (x *genRunner) selfer(encode bool) { func (x *genRunner) xtraSM(varname string, encode bool, t reflect.Type) { if encode { x.linef("h.enc%s((%s%s)(%s), e)", x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), varname) - // x.line("h.enc" + x.genMethodNameT(t) + "(" + x.genTypeName(t) + "(" + varname + "), e)") } else { x.linef("h.dec%s((*%s)(%s), d)", x.genMethodNameT(t), x.genTypeName(t), varname) - // x.line("h.dec" + x.genMethodNameT(t) + "((*" + x.genTypeName(t) + ")(" + varname + "), d)") } - if _, ok := x.tm[t]; !ok { - x.tm[t] = struct{}{} - x.ts = append(x.ts, t) + x.registerXtraT(t) +} + +func (x *genRunner) registerXtraT(t reflect.Type) { + // recursively register the types + if _, ok := x.tm[t]; ok { + return + } + var tkey reflect.Type + switch t.Kind() { + case reflect.Chan, reflect.Slice, reflect.Array: + case reflect.Map: + tkey = t.Key() + default: + return + } + x.tm[t] = struct{}{} + x.ts = append(x.ts, t) + // check if this refers to any xtra types eg. a slice of array: add the array + x.registerXtraT(t.Elem()) + if tkey != nil { + x.registerXtraT(tkey) } } @@ -595,22 +637,33 @@ func (x *genRunner) encVar(varname string, t reflect.Type) { } -// enc will encode a variable (varname) of type T, -// except t is of kind reflect.Struct or reflect.Array, wherein varname is of type *T (to prevent copying) +// enc will encode a variable (varname) of type t, +// except t is of kind reflect.Struct or reflect.Array, wherein varname is of type ptrTo(T) (to prevent copying) func (x *genRunner) enc(varname string, t reflect.Type) { - // varName here must be to a pointer to a struct/array, or to a value directly. rtid := reflect.ValueOf(t).Pointer() // We call CodecEncodeSelf if one of the following are honored: // - the type already implements Selfer, call that // - the type has a Selfer implementation just created, use that // - the type is in the list of the ones we will generate for, but it is not currently being generated + mi := x.varsfx() tptr := reflect.PtrTo(t) tk := t.Kind() if x.checkForSelfer(t, varname) { - if t.Implements(selferTyp) || (tptr.Implements(selferTyp) && (tk == reflect.Array || tk == reflect.Struct)) { - x.line(varname + ".CodecEncodeSelf(e)") - return + if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T + if tptr.Implements(selferTyp) || t.Implements(selferTyp) { + x.line(varname + ".CodecEncodeSelf(e)") + return + } + } else { // varname is of type T + if t.Implements(selferTyp) { + x.line(varname + ".CodecEncodeSelf(e)") + return + } else if tptr.Implements(selferTyp) { + x.linef("%ssf%s := &%s", genTempVarPfx, mi, varname) + x.linef("%ssf%s.CodecEncodeSelf(e)", genTempVarPfx, mi) + return + } } if _, ok := x.te[rtid]; ok { @@ -640,7 +693,6 @@ func (x *genRunner) enc(varname string, t reflect.Type) { // check if // - type is RawExt // - the type implements (Text|JSON|Binary)(Unm|M)arshal - mi := x.varsfx() x.linef("%sm%s := z.EncBinary()", genTempVarPfx, mi) x.linef("_ = %sm%s", genTempVarPfx, mi) x.line("if false {") //start if block @@ -663,15 +715,31 @@ func (x *genRunner) enc(varname string, t reflect.Type) { // first check if extensions are configued, before doing the interface conversion x.linef("} else if z.HasExtensions() && z.EncExt(%s) {", varname) } - if t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) { - x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname) + if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T + if t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) { + x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname) + } + if t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) { + x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname) + } else if t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) { + x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname) + } + } else { // varname is of type T + if t.Implements(binaryMarshalerTyp) { + x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname) + } else if tptr.Implements(binaryMarshalerTyp) { + x.linef("} else if %sm%s { z.EncBinaryMarshal(&%v) ", genTempVarPfx, mi, varname) + } + if t.Implements(jsonMarshalerTyp) { + x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname) + } else if tptr.Implements(jsonMarshalerTyp) { + x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", genTempVarPfx, mi, varname) + } else if t.Implements(textMarshalerTyp) { + x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname) + } else if tptr.Implements(textMarshalerTyp) { + x.linef("} else if !%sm%s { z.EncTextMarshal(&%v) ", genTempVarPfx, mi, varname) + } } - if t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) { - x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname) - } else if t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) { - x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname) - } - x.line("} else {") switch t.Kind() { @@ -815,12 +883,14 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { } x.linef("%s[%v] = %s", numfieldsvar, j, omitline) } + x.linef("var %snn%s int", genTempVarPfx, i) x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray { x.line("r.EncodeArrayStart(" + strconv.FormatInt(int64(len(tisfi)), 10) + ")") x.linef("} else {") // if not ti.toArray - x.linef("var %snn%s int = %v", genTempVarPfx, i, nn) + x.linef("%snn%s = %v", genTempVarPfx, i, nn) x.linef("for _, b := range %s { if b { %snn%s++ } }", numfieldsvar, genTempVarPfx, i) x.linef("r.EncodeMapStart(%snn%s)", genTempVarPfx, i) + x.linef("%snn%s = %v", genTempVarPfx, i, 0) // x.line("r.EncodeMapStart(" + strconv.FormatInt(int64(len(tisfi)), 10) + ")") x.line("}") // close if not StructToArray @@ -864,11 +934,9 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { if labelUsed { x.line("if " + isNilVarName + " { r.EncodeNil() } else { ") } + x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) if si.omitEmpty { x.linef("if %s[%v] {", numfieldsvar, j) - // omitEmptyVarNameX := genTempVarPfx + "ov" + i - // x.line("var " + omitEmptyVarNameX + " " + x.genTypeName(t2.Type)) - // x.encVar(omitEmptyVarNameX, t2.Type) } x.encVar(varname+"."+t2.Name, t2.Type) if si.omitEmpty { @@ -879,21 +947,15 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { if labelUsed { x.line("}") } + x.linef("} else {") // if not ti.toArray - // omitEmptyVar := genTempVarPfx + "x" + i + t2.Name - // x.line("const " + omitEmptyVar + " bool = " + strconv.FormatBool(si.omitEmpty)) - // doOmitEmpty := si.omitEmpty && t2.Type.Kind() != reflect.Struct + if si.omitEmpty { x.linef("if %s[%v] {", numfieldsvar, j) - // x.linef(`println("Encoding field: %v")`, j) - // x.out("if ") - // if labelUsed { - // x.out("!" + isNilVarName + " && ") - // } - // x.line(varname + "." + t2.Name + " != " + genZeroValueR(t2.Type, x.tc) + " {") } - // x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(\"" + t2.Name + "\"))") + x.linef("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs) x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(\"" + si.encName + "\"))") + x.linef("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs) if labelUsed { x.line("if " + isNilVarName + " { r.EncodeNil() } else { ") x.encVar(varname+"."+t2.Name, t2.Type) @@ -906,9 +968,12 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { } x.linef("} ") // end if/else ti.toArray } - x.line("if " + sepVarname + " {") - x.line("r.EncodeEnd()") + x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray { + x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) + x.line("} else {") + x.linef("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) x.line("}") + } func (x *genRunner) encListFallback(varname string, t reflect.Type) { @@ -917,14 +982,16 @@ func (x *genRunner) encListFallback(varname string, t reflect.Type) { x.line("r.EncodeArrayStart(len(" + varname + "))") if t.Kind() == reflect.Chan { x.linef("for %si%s, %si2%s := 0, len(%s); %si%s < %si2%s; %si%s++ {", g, i, g, i, varname, g, i, g, i, g, i) + x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) x.linef("%sv%s := <-%s", g, i, varname) } else { // x.linef("for %si%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname) x.linef("for _, %sv%s := range %s {", genTempVarPfx, i, varname) + x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) } x.encVar(genTempVarPfx+"v"+i, t.Elem()) x.line("}") - x.line("r.EncodeEnd()") + x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) } func (x *genRunner) encMapFallback(varname string, t reflect.Type) { @@ -933,10 +1000,12 @@ func (x *genRunner) encMapFallback(varname string, t reflect.Type) { x.line("r.EncodeMapStart(len(" + varname + "))") x.linef("for %sk%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname) // x.line("for " + genTempVarPfx + "k" + i + ", " + genTempVarPfx + "v" + i + " := range " + varname + " {") + x.linef("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs) x.encVar(genTempVarPfx+"k"+i, t.Key()) + x.linef("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs) x.encVar(genTempVarPfx+"v"+i, t.Elem()) x.line("}") - x.line("r.EncodeEnd()") + x.linef("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) } func (x *genRunner) decVar(varname string, t reflect.Type, canBeNil bool) { @@ -954,8 +1023,6 @@ func (x *genRunner) decVar(varname string, t reflect.Type, canBeNil bool) { x.line("if r.TryDecodeAsNil() {") if t.Kind() == reflect.Ptr { x.line("if " + varname + " != nil { ") - // x.line("var " + genTempVarPfx + i + " " + x.genTypeName(t.Elem())) - // x.line("*" + varname + " = " + genTempVarPfx + i) // if varname is a field of a struct (has a dot in it), // then just set it to nil @@ -964,12 +1031,8 @@ func (x *genRunner) decVar(varname string, t reflect.Type, canBeNil bool) { } else { x.line("*" + varname + " = " + x.genZeroValueR(t.Elem())) } - // x.line("*" + varname + " = nil") x.line("}") - } else { - // x.line("var " + genTempVarPfx + i + " " + x.genTypeName(t)) - // x.line(varname + " = " + genTempVarPfx + i) x.line(varname + " = " + x.genZeroValueR(t)) } x.line("} else {") @@ -1012,6 +1075,8 @@ func (x *genRunner) decVar(varname string, t reflect.Type, canBeNil bool) { } } +// dec will decode a variable (varname) of type ptrTo(t). +// t is always a basetype (i.e. not of kind reflect.Ptr). func (x *genRunner) dec(varname string, t reflect.Type) { // assumptions: // - the varname is to a pointer already. No need to take address of it @@ -1149,8 +1214,6 @@ func (x *genRunner) dec(varname string, t reflect.Type) { } else if fastpathAV.index(rtid) != -1 { g := x.newGenV(t) x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", false, d)") - // x.line("z." + g.MethodNamePfx("Dec", false) + "(" + varname + ")") - // x.line(g.FastpathName(false) + "(" + varname + ", d)") } else { x.xtraSM(varname, false, t) // x.decListFallback(varname, rtid, false, t) @@ -1163,8 +1226,6 @@ func (x *genRunner) dec(varname string, t reflect.Type) { if fastpathAV.index(rtid) != -1 { g := x.newGenV(t) x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", false, d)") - // x.line("z." + g.MethodNamePfx("Dec", false) + "(" + varname + ")") - // x.line(g.FastpathName(false) + "(" + varname + ", d)") } else { x.xtraSM(varname, false, t) // x.decMapFallback(varname, rtid, t) @@ -1294,6 +1355,7 @@ func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) { type tstruc struct { TempVar string + Sfx string Rand string Varname string KTyp string @@ -1303,7 +1365,7 @@ func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) telem := t.Elem() tkey := t.Key() ts := tstruc{ - genTempVarPfx, x.varsfx(), varname, x.genTypeName(tkey), + genTempVarPfx, x.xs, x.varsfx(), varname, x.genTypeName(tkey), x.genTypeName(telem), int(telem.Size() + tkey.Size()), } @@ -1359,6 +1421,7 @@ func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintpt if si.i != -1 { t2 = t.Field(int(si.i)) } else { + //we must accomodate anonymous fields, where the embedded field is a nil pointer in the value. // t2 = t.FieldByIndex(si.is) t2typ := t varname3 := varname @@ -1370,8 +1433,7 @@ func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintpt t2typ = t2.Type varname3 = varname3 + "." + t2.Name if t2typ.Kind() == reflect.Ptr { - x.line("if " + varname3 + " == nil {" + - varname3 + " = new(" + x.genTypeName(t2typ.Elem()) + ") }") + x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem())) } } } @@ -1380,11 +1442,10 @@ func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintpt x.line("default:") // pass the slice here, so that the string will not escape, and maybe save allocation x.line("z.DecStructFieldNotFound(-1, " + kName + ")") - // x.line("z.DecStructFieldNotFoundB(" + kName + "Slc)") x.line("} // end switch " + kName) } -func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t reflect.Type, style uint8) { +func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t reflect.Type, style genStructMapStyle) { tpfx := genTempVarPfx i := x.varsfx() kName := tpfx + "s" + i @@ -1406,14 +1467,11 @@ func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t ref x.line("var " + kName + "Slc = z.DecScratchBuffer() // default slice to decode into") - // x.line("var " + kName + " string // default string to decode into") - // x.line("_ = " + kName) x.line("_ = " + kName + "Slc") - // x.linef("var %sb%s bool", tpfx, i) // break switch style { - case 1: + case genStructMapStyleLenPrefix: x.linef("for %sj%s := 0; %sj%s < %s; %sj%s++ {", tpfx, i, tpfx, i, lenvarname, tpfx, i) - case 2: + case genStructMapStyleCheckBreak: x.linef("for %sj%s := 0; !r.CheckBreak(); %sj%s++ {", tpfx, i, tpfx, i) default: // 0, otherwise. x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length @@ -1421,11 +1479,9 @@ func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t ref x.linef("if %shl%s { if %sj%s >= %s { break }", tpfx, i, tpfx, i, lenvarname) x.line("} else { if r.CheckBreak() { break }; }") } - // x.line(kName + " = z.ReadStringAsBytes(" + kName + ")") - // x.line(kName + " = z.ReadString()") + x.linef("z.DecSendContainerState(codecSelfer_containerMapKey%s)", x.xs) x.line(kName + "Slc = r.DecodeBytes(" + kName + "Slc, true, true)") // let string be scoped to this loop alone, so it doesn't escape. - // x.line(kName + " := " + x.cpfx + "GenBytesToStringRO(" + kName + "Slc)") if x.unsafe { x.line(kName + "SlcHdr := codecSelferUnsafeString" + x.xs + "{uintptr(unsafe.Pointer(&" + kName + "Slc[0])), len(" + kName + "Slc)}") @@ -1433,16 +1489,11 @@ func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t ref } else { x.line(kName + " := string(" + kName + "Slc)") } + x.linef("z.DecSendContainerState(codecSelfer_containerMapValue%s)", x.xs) x.decStructMapSwitch(kName, varname, rtid, t) x.line("} // end for " + tpfx + "j" + i) - switch style { - case 1: - case 2: - x.line("r.ReadEnd()") - default: - x.linef("if !%shl%s { r.ReadEnd() }", tpfx, i) - } + x.linef("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) } func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid uintptr, t reflect.Type) { @@ -1451,25 +1502,37 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid ti := x.ti.get(rtid, t) tisfi := ti.sfip // always use sequence from file. decStruct expects same thing. x.linef("var %sj%s int", tpfx, i) - x.linef("var %sb%s bool", tpfx, i) // break - // x.linef("var %sl%s := r.ReadArrayStart()", tpfx, i) + x.linef("var %sb%s bool", tpfx, i) // break x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length for _, si := range tisfi { var t2 reflect.StructField if si.i != -1 { t2 = t.Field(int(si.i)) } else { - t2 = t.FieldByIndex(si.is) + //we must accomodate anonymous fields, where the embedded field is a nil pointer in the value. + // t2 = t.FieldByIndex(si.is) + t2typ := t + varname3 := varname + for _, ix := range si.is { + for t2typ.Kind() == reflect.Ptr { + t2typ = t2typ.Elem() + } + t2 = t2typ.Field(ix) + t2typ = t2.Type + varname3 = varname3 + "." + t2.Name + if t2typ.Kind() == reflect.Ptr { + x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem())) + } + } } x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }", tpfx, i, tpfx, i, tpfx, i, tpfx, i, lenvarname, tpfx, i) - // x.line("if " + tpfx + "j" + i + "++; " + tpfx + "j" + - // i + " <= " + tpfx + "l" + i + " {") - x.linef("if %sb%s { r.ReadEnd(); %s }", tpfx, i, breakString) + x.linef("if %sb%s { z.DecSendContainerState(codecSelfer_containerArrayEnd%s); %s }", + tpfx, i, x.xs, breakString) + x.linef("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) x.decVar(varname+"."+t2.Name, t2.Type, true) - // x.line("} // end if " + tpfx + "j" + i + " <= " + tpfx + "l" + i) } // read remaining values and throw away. x.line("for {") @@ -1477,19 +1540,20 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid tpfx, i, tpfx, i, tpfx, i, tpfx, i, lenvarname, tpfx, i) x.linef("if %sb%s { break }", tpfx, i) + x.linef("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) x.linef(`z.DecStructFieldNotFound(%sj%s - 1, "")`, tpfx, i) x.line("}") - x.line("r.ReadEnd()") + x.linef("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) } func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { // if container is map - // x.line("if z.DecContainerIsMap() { ") i := x.varsfx() - x.line("if r.IsContainerType(codecSelferValueTypeMap" + x.xs + ") {") + x.linef("%sct%s := r.ContainerType()", genTempVarPfx, i) + x.linef("if %sct%s == codecSelferValueTypeMap%s {", genTempVarPfx, i, x.xs) x.line(genTempVarPfx + "l" + i + " := r.ReadMapStart()") x.linef("if %sl%s == 0 {", genTempVarPfx, i) - x.line("r.ReadEnd()") + x.linef("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) if genUseOneFunctionForDecStructMap { x.line("} else { ") x.linef("x.codecDecodeSelfFromMap(%sl%s, d)", genTempVarPfx, i) @@ -1502,18 +1566,16 @@ func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { x.line("}") // else if container is array - // x.line("} else if z.DecContainerIsArray() { ") - x.line("} else if r.IsContainerType(codecSelferValueTypeArray" + x.xs + ") {") + x.linef("} else if %sct%s == codecSelferValueTypeArray%s {", genTempVarPfx, i, x.xs) x.line(genTempVarPfx + "l" + i + " := r.ReadArrayStart()") x.linef("if %sl%s == 0 {", genTempVarPfx, i) - x.line("r.ReadEnd()") + x.linef("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) x.line("} else { ") x.linef("x.codecDecodeSelfFromArray(%sl%s, d)", genTempVarPfx, i) x.line("}") // else panic x.line("} else { ") x.line("panic(codecSelferOnlyMapOrArrayEncodeToStructErr" + x.xs + ")") - // x.line("panic(`only encoded map or array can be decoded into a struct`)") x.line("} ") } @@ -1587,6 +1649,26 @@ func genImportPath(t reflect.Type) (s string) { return } +// A go identifier is (letter|_)[letter|number|_]* +func genGoIdentifier(s string, checkFirstChar bool) string { + b := make([]byte, 0, len(s)) + t := make([]byte, 4) + var n int + for i, r := range s { + if checkFirstChar && i == 0 && !unicode.IsLetter(r) { + b = append(b, '_') + } + // r must be unicode_letter, unicode_digit or _ + if unicode.IsLetter(r) || unicode.IsDigit(r) { + n = utf8.EncodeRune(t, r) + b = append(b, t[:n]...) + } else { + b = append(b, '_') + } + } + return string(b) +} + func genNonPtr(t reflect.Type) reflect.Type { for t.Kind() == reflect.Ptr { t = t.Elem() @@ -1849,10 +1931,6 @@ func genInternalInit() { "float64": 8, "bool": 1, } - // mapvaltypes2 := make(map[string]bool) - // for _, s := range mapvaltypes { - // mapvaltypes2[s] = true - // } var gt genInternal // For each slice or map type, there must be a (symetrical) Encode and Decode fast-path function diff --git a/vendor/github.com/ugorji/go/codec/helper.go b/vendor/github.com/ugorji/go/codec/helper.go index 96b5a1f22..40065a01c 100644 --- a/vendor/github.com/ugorji/go/codec/helper.go +++ b/vendor/github.com/ugorji/go/codec/helper.go @@ -112,8 +112,6 @@ import ( "strings" "sync" "time" - "unicode" - "unicode/utf8" ) const ( @@ -157,8 +155,10 @@ const ( resetSliceElemToZeroValue bool = false ) -var oneByteArr = [1]byte{0} -var zeroByteSlice = oneByteArr[:0:0] +var ( + oneByteArr = [1]byte{0} + zeroByteSlice = oneByteArr[:0:0] +) type charEncoding uint8 @@ -194,14 +194,6 @@ const ( type seqType uint8 -// mirror json.Marshaler and json.Unmarshaler here, so we don't import the encoding/json package -type jsonMarshaler interface { - MarshalJSON() ([]byte, error) -} -type jsonUnmarshaler interface { - UnmarshalJSON([]byte) error -} - const ( _ seqType = iota seqTypeArray @@ -209,13 +201,61 @@ const ( seqTypeChan ) +// note that containerMapStart and containerArraySend are not sent. +// This is because the ReadXXXStart and EncodeXXXStart already does these. +type containerState uint8 + +const ( + _ containerState = iota + + containerMapStart // slot left open, since Driver method already covers it + containerMapKey + containerMapValue + containerMapEnd + containerArrayStart // slot left open, since Driver methods already cover it + containerArrayElem + containerArrayEnd +) + +type rgetPoolT struct { + encNames [8]string + fNames [8]string + etypes [8]uintptr + sfis [8]*structFieldInfo +} + +var rgetPool = sync.Pool{ + New: func() interface{} { return new(rgetPoolT) }, +} + +type rgetT struct { + fNames []string + encNames []string + etypes []uintptr + sfis []*structFieldInfo +} + +type containerStateRecv interface { + sendContainerState(containerState) +} + +// mirror json.Marshaler and json.Unmarshaler here, +// so we don't import the encoding/json package +type jsonMarshaler interface { + MarshalJSON() ([]byte, error) +} +type jsonUnmarshaler interface { + UnmarshalJSON([]byte) error +} + var ( bigen = binary.BigEndian structInfoFieldName = "_struct" - // mapStrIntfTyp = reflect.TypeOf(map[string]interface{}(nil)) - intfSliceTyp = reflect.TypeOf([]interface{}(nil)) - intfTyp = intfSliceTyp.Elem() + mapStrIntfTyp = reflect.TypeOf(map[string]interface{}(nil)) + mapIntfIntfTyp = reflect.TypeOf(map[interface{}]interface{}(nil)) + intfSliceTyp = reflect.TypeOf([]interface{}(nil)) + intfTyp = intfSliceTyp.Elem() stringTyp = reflect.TypeOf("") timeTyp = reflect.TypeOf(time.Time{}) @@ -241,6 +281,9 @@ var ( timeTypId = reflect.ValueOf(timeTyp).Pointer() stringTypId = reflect.ValueOf(stringTyp).Pointer() + mapStrIntfTypId = reflect.ValueOf(mapStrIntfTyp).Pointer() + mapIntfIntfTypId = reflect.ValueOf(mapIntfIntfTyp).Pointer() + intfSliceTypId = reflect.ValueOf(intfSliceTyp).Pointer() // mapBySliceTypId = reflect.ValueOf(mapBySliceTyp).Pointer() intBitsize uint8 = uint8(reflect.TypeOf(int(0)).Bits()) @@ -283,7 +326,7 @@ type MapBySlice interface { type BasicHandle struct { // TypeInfos is used to get the type info for any type. // - // If not configure, the default TypeInfos is used, which uses struct tag keys: codec, json + // If not configured, the default TypeInfos is used, which uses struct tag keys: codec, json TypeInfos *TypeInfos extHandle @@ -332,6 +375,8 @@ type RawExt struct { // It is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of the types. type BytesExt interface { // WriteExt converts a value to a []byte. + // + // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array. WriteExt(v interface{}) []byte // ReadExt updates a value from a []byte. @@ -344,6 +389,8 @@ type BytesExt interface { // It is used by codecs (e.g. cbor, json) which use the format to do custom serialization of the types. type InterfaceExt interface { // ConvertExt converts a value into a simpler interface for easy encoding e.g. convert time.Time to int64. + // + // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array. ConvertExt(v interface{}) interface{} // UpdateExt updates a value from a simpler interface for easy decoding e.g. convert int64 to time.Time. @@ -363,7 +410,6 @@ type addExtWrapper struct { } func (x addExtWrapper) WriteExt(v interface{}) []byte { - // fmt.Printf(">>>>>>>>>> WriteExt: %T, %v\n", v, v) bs, err := x.encFn(reflect.ValueOf(v)) if err != nil { panic(err) @@ -372,7 +418,6 @@ func (x addExtWrapper) WriteExt(v interface{}) []byte { } func (x addExtWrapper) ReadExt(v interface{}, bs []byte) { - // fmt.Printf(">>>>>>>>>> ReadExt: %T, %v\n", v, v) if err := x.decFn(reflect.ValueOf(v), bs); err != nil { panic(err) } @@ -474,7 +519,7 @@ type extTypeTagFn struct { ext Ext } -type extHandle []*extTypeTagFn +type extHandle []extTypeTagFn // DEPRECATED: Use SetBytesExt or SetInterfaceExt on the Handle instead. // @@ -513,12 +558,17 @@ func (o *extHandle) SetExt(rt reflect.Type, tag uint64, ext Ext) (err error) { } } - *o = append(*o, &extTypeTagFn{rtid, rt, tag, ext}) + if *o == nil { + *o = make([]extTypeTagFn, 0, 4) + } + *o = append(*o, extTypeTagFn{rtid, rt, tag, ext}) return } func (o extHandle) getExt(rtid uintptr) *extTypeTagFn { - for _, v := range o { + var v *extTypeTagFn + for i := range o { + v = &o[i] if v.rtid == rtid { return v } @@ -527,7 +577,9 @@ func (o extHandle) getExt(rtid uintptr) *extTypeTagFn { } func (o extHandle) getExtForTag(tag uint64) *extTypeTagFn { - for _, v := range o { + var v *extTypeTagFn + for i := range o { + v = &o[i] if v.tag == tag { return v } @@ -650,6 +702,8 @@ type typeInfo struct { rt reflect.Type rtid uintptr + numMeth uint16 // number of methods + // baseId gives pointer to the base reflect.Type, after deferencing // the pointers. E.g. base type of ***time.Time is time.Time. base reflect.Type @@ -746,14 +800,10 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) { return } - x.mu.Lock() - defer x.mu.Unlock() - if pti, ok = x.infos[rtid]; ok { - return - } - + // do not hold lock while computing this. + // it may lead to duplication, but that's ok. ti := typeInfo{rt: rt, rtid: rtid} - pti = &ti + ti.numMeth = uint16(rt.NumMethod()) var indir int8 if ok, indir = implementsIntf(rt, binaryMarshalerTyp); ok { @@ -803,84 +853,128 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) { siInfo = parseStructFieldInfo(structInfoFieldName, x.structTag(f.Tag)) ti.toArray = siInfo.toArray } - sfip := make([]*structFieldInfo, 0, rt.NumField()) - x.rget(rt, nil, make(map[string]bool, 16), &sfip, siInfo) - - ti.sfip = make([]*structFieldInfo, len(sfip)) - ti.sfi = make([]*structFieldInfo, len(sfip)) - copy(ti.sfip, sfip) - sort.Sort(sfiSortedByEncName(sfip)) - copy(ti.sfi, sfip) + pi := rgetPool.Get() + pv := pi.(*rgetPoolT) + pv.etypes[0] = ti.baseId + vv := rgetT{pv.fNames[:0], pv.encNames[:0], pv.etypes[:1], pv.sfis[:0]} + x.rget(rt, rtid, nil, &vv, siInfo) + ti.sfip = make([]*structFieldInfo, len(vv.sfis)) + ti.sfi = make([]*structFieldInfo, len(vv.sfis)) + copy(ti.sfip, vv.sfis) + sort.Sort(sfiSortedByEncName(vv.sfis)) + copy(ti.sfi, vv.sfis) + rgetPool.Put(pi) } // sfi = sfip - x.infos[rtid] = pti + + x.mu.Lock() + if pti, ok = x.infos[rtid]; !ok { + pti = &ti + x.infos[rtid] = pti + } + x.mu.Unlock() return } -func (x *TypeInfos) rget(rt reflect.Type, indexstack []int, fnameToHastag map[string]bool, - sfi *[]*structFieldInfo, siInfo *structFieldInfo, +func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr, + indexstack []int, pv *rgetT, siInfo *structFieldInfo, ) { - for j := 0; j < rt.NumField(); j++ { + // This will read up the fields and store how to access the value. + // It uses the go language's rules for embedding, as below: + // - if a field has been seen while traversing, skip it + // - if an encName has been seen while traversing, skip it + // - if an embedded type has been seen, skip it + // + // Also, per Go's rules, embedded fields must be analyzed AFTER all top-level fields. + // + // Note: we consciously use slices, not a map, to simulate a set. + // Typically, types have < 16 fields, and iteration using equals is faster than maps there + + type anonField struct { + ft reflect.Type + idx int + } + + var anonFields []anonField + +LOOP: + for j, jlen := 0, rt.NumField(); j < jlen; j++ { f := rt.Field(j) - // func types are skipped. - if tk := f.Type.Kind(); tk == reflect.Func { + fkind := f.Type.Kind() + // skip if a func type, or is unexported, or structTag value == "-" + switch fkind { + case reflect.Func, reflect.Complex64, reflect.Complex128, reflect.UnsafePointer: + continue LOOP + } + + // if r1, _ := utf8.DecodeRuneInString(f.Name); r1 == utf8.RuneError || !unicode.IsUpper(r1) { + if f.PkgPath != "" && !f.Anonymous { // unexported, not embedded continue } stag := x.structTag(f.Tag) if stag == "-" { continue } - if r1, _ := utf8.DecodeRuneInString(f.Name); r1 == utf8.RuneError || !unicode.IsUpper(r1) { - continue - } var si *structFieldInfo - // if anonymous and there is no struct tag (or it's blank) - // and its a struct (or pointer to struct), inline it. - var doInline bool - if f.Anonymous && f.Type.Kind() != reflect.Interface { - doInline = stag == "" + // if anonymous and no struct tag (or it's blank), and a struct (or pointer to struct), inline it. + if f.Anonymous && fkind != reflect.Interface { + doInline := stag == "" if !doInline { si = parseStructFieldInfo("", stag) doInline = si.encName == "" // doInline = si.isZero() - // fmt.Printf(">>>> doInline for si.isZero: %s: %v\n", f.Name, doInline) + } + if doInline { + ft := f.Type + for ft.Kind() == reflect.Ptr { + ft = ft.Elem() + } + if ft.Kind() == reflect.Struct { + // handle anonymous fields after handling all the non-anon fields + anonFields = append(anonFields, anonField{ft, j}) + continue + } } } - if doInline { - ft := f.Type - for ft.Kind() == reflect.Ptr { - ft = ft.Elem() - } - if ft.Kind() == reflect.Struct { - indexstack2 := make([]int, len(indexstack)+1, len(indexstack)+4) - copy(indexstack2, indexstack) - indexstack2[len(indexstack)] = j - // indexstack2 := append(append(make([]int, 0, len(indexstack)+4), indexstack...), j) - x.rget(ft, indexstack2, fnameToHastag, sfi, siInfo) - continue - } - } - // do not let fields with same name in embedded structs override field at higher level. - // this must be done after anonymous check, to allow anonymous field - // still include their child fields - if _, ok := fnameToHastag[f.Name]; ok { + // after the anonymous dance: if an unexported field, skip + if f.PkgPath != "" { // unexported continue } + if f.Name == "" { panic(noFieldNameToStructFieldInfoErr) } + + for _, k := range pv.fNames { + if k == f.Name { + continue LOOP + } + } + pv.fNames = append(pv.fNames, f.Name) + if si == nil { si = parseStructFieldInfo(f.Name, stag) } else if si.encName == "" { si.encName = f.Name } + + for _, k := range pv.encNames { + if k == si.encName { + continue LOOP + } + } + pv.encNames = append(pv.encNames, si.encName) + // si.ikind = int(f.Type.Kind()) if len(indexstack) == 0 { si.i = int16(j) } else { si.i = -1 - si.is = append(append(make([]int, 0, len(indexstack)+4), indexstack...), j) + si.is = make([]int, len(indexstack)+1) + copy(si.is, indexstack) + si.is[len(indexstack)] = j + // si.is = append(append(make([]int, 0, len(indexstack)+4), indexstack...), j) } if siInfo != nil { @@ -888,8 +982,26 @@ func (x *TypeInfos) rget(rt reflect.Type, indexstack []int, fnameToHastag map[st si.omitEmpty = true } } - *sfi = append(*sfi, si) - fnameToHastag[f.Name] = stag != "" + pv.sfis = append(pv.sfis, si) + } + + // now handle anonymous fields +LOOP2: + for _, af := range anonFields { + // if etypes contains this, then do not call rget again (as the fields are already seen here) + ftid := reflect.ValueOf(af.ft).Pointer() + for _, k := range pv.etypes { + if k == ftid { + continue LOOP2 + } + } + pv.etypes = append(pv.etypes, ftid) + + indexstack2 := make([]int, len(indexstack)+1) + copy(indexstack2, indexstack) + indexstack2[len(indexstack)] = af.idx + // indexstack2 := append(append(make([]int, 0, len(indexstack)+4), indexstack...), j) + x.rget(af.ft, ftid, indexstack2, pv, siInfo) } } @@ -1087,3 +1199,73 @@ type bytesISlice []bytesI func (p bytesISlice) Len() int { return len(p) } func (p bytesISlice) Less(i, j int) bool { return bytes.Compare(p[i].v, p[j].v) == -1 } func (p bytesISlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +// ----------------- + +type set []uintptr + +func (s *set) add(v uintptr) (exists bool) { + // e.ci is always nil, or len >= 1 + // defer func() { fmt.Printf("$$$$$$$$$$$ cirRef Add: %v, exists: %v\n", v, exists) }() + x := *s + if x == nil { + x = make([]uintptr, 1, 8) + x[0] = v + *s = x + return + } + // typically, length will be 1. make this perform. + if len(x) == 1 { + if j := x[0]; j == 0 { + x[0] = v + } else if j == v { + exists = true + } else { + x = append(x, v) + *s = x + } + return + } + // check if it exists + for _, j := range x { + if j == v { + exists = true + return + } + } + // try to replace a "deleted" slot + for i, j := range x { + if j == 0 { + x[i] = v + return + } + } + // if unable to replace deleted slot, just append it. + x = append(x, v) + *s = x + return +} + +func (s *set) remove(v uintptr) (exists bool) { + // defer func() { fmt.Printf("$$$$$$$$$$$ cirRef Rm: %v, exists: %v\n", v, exists) }() + x := *s + if len(x) == 0 { + return + } + if len(x) == 1 { + if x[0] == v { + x[0] = 0 + } + return + } + for i, j := range x { + if j == v { + exists = true + x[i] = 0 // set it to 0, as way to delete it. + // copy(x[i:], x[i+1:]) + // x = x[:len(x)-1] + return + } + } + return +} diff --git a/vendor/github.com/ugorji/go/codec/helper_test.go b/vendor/github.com/ugorji/go/codec/helper_test.go index 685c576c4..e1dea52f4 100644 --- a/vendor/github.com/ugorji/go/codec/helper_test.go +++ b/vendor/github.com/ugorji/go/codec/helper_test.go @@ -29,7 +29,22 @@ package codec // To fully test everything: // go test -tags=x -benchtime=100ms -tv -bg -bi -brw -bu -v -run=. -bench=. +// Handling flags +// codec_test.go will define a set of global flags for testing, including: +// - Use Reset +// - Use IO reader/writer (vs direct bytes) +// - Set Canonical +// - Set InternStrings +// - Use Symbols +// +// This way, we can test them all by running same set of tests with a different +// set of flags. +// +// Following this, all the benchmarks will utilize flags set by codec_test.go +// and will not redefine these "global" flags. + import ( + "bytes" "errors" "flag" "fmt" @@ -38,30 +53,45 @@ import ( "testing" ) -const ( - testLogToT = true - failNowOnFail = true -) +type testHED struct { + H Handle + E *Encoder + D *Decoder +} var ( - testNoopH = NoopHandle(8) - testMsgpackH = &MsgpackHandle{} - testBincH = &BincHandle{} - testBincHNoSym = &BincHandle{} - testBincHSym = &BincHandle{} - testSimpleH = &SimpleHandle{} - testCborH = &CborHandle{} - testJsonH = &JsonHandle{} + testNoopH = NoopHandle(8) + testMsgpackH = &MsgpackHandle{} + testBincH = &BincHandle{} + testSimpleH = &SimpleHandle{} + testCborH = &CborHandle{} + testJsonH = &JsonHandle{} + testHandles []Handle testPreInitFns []func() testPostInitFns []func() testOnce sync.Once + + testHEDs []testHED ) func init() { - testBincHSym.AsSymbols = AsSymbolAll - testBincHNoSym.AsSymbols = AsSymbolNone + testHEDs = make([]testHED, 0, 32) + testHandles = append(testHandles, + testNoopH, testMsgpackH, testBincH, testSimpleH, + testCborH, testJsonH) +} + +func testHEDGet(h Handle) *testHED { + for i := range testHEDs { + v := &testHEDs[i] + if v.H == h { + return v + } + } + testHEDs = append(testHEDs, testHED{h, NewEncoder(nil, h), NewDecoder(nil, h)}) + return &testHEDs[len(testHEDs)-1] } func testInitAll() { @@ -74,6 +104,95 @@ func testInitAll() { } } +func testCodecEncode(ts interface{}, bsIn []byte, + fn func([]byte) *bytes.Buffer, h Handle) (bs []byte, err error) { + // bs = make([]byte, 0, approxSize) + var e *Encoder + var buf *bytes.Buffer + if testUseReset { + e = testHEDGet(h).E + } else { + e = NewEncoder(nil, h) + } + if testUseIoEncDec { + buf = fn(bsIn) + e.Reset(buf) + } else { + bs = bsIn + e.ResetBytes(&bs) + } + if testUseMust { + e.MustEncode(ts) + } else { + err = e.Encode(ts) + } + if testUseIoEncDec { + bs = buf.Bytes() + } + return +} + +func testCodecDecode(bs []byte, ts interface{}, h Handle) (err error) { + var d *Decoder + var buf *bytes.Reader + if testUseReset { + d = testHEDGet(h).D + } else { + d = NewDecoder(nil, h) + } + if testUseIoEncDec { + buf = bytes.NewReader(bs) + d.Reset(buf) + } else { + d.ResetBytes(bs) + } + if testUseMust { + d.MustDecode(ts) + } else { + err = d.Decode(ts) + } + return +} + +// ----- functions below are used only by tests (not benchmarks) + +const ( + testLogToT = true + failNowOnFail = true +) + +func checkErrT(t *testing.T, err error) { + if err != nil { + logT(t, err.Error()) + failT(t) + } +} + +func checkEqualT(t *testing.T, v1 interface{}, v2 interface{}, desc string) (err error) { + if err = deepEqual(v1, v2); err != nil { + logT(t, "Not Equal: %s: %v. v1: %v, v2: %v", desc, err, v1, v2) + failT(t) + } + return +} + +func failT(t *testing.T) { + if failNowOnFail { + t.FailNow() + } else { + t.Fail() + } +} + +// --- these functions are used by both benchmarks and tests + +func deepEqual(v1, v2 interface{}) (err error) { + if !reflect.DeepEqual(v1, v2) { + err = errors.New("Not Match") + } + return +} + func logT(x interface{}, format string, args ...interface{}) { if t, ok := x.(*testing.T); ok && t != nil && testLogToT { if testVerbose { @@ -121,35 +240,3 @@ func approxDataSize(rv reflect.Value) (sum int) { } return } - -// ----- functions below are used only by tests (not benchmarks) - -func checkErrT(t *testing.T, err error) { - if err != nil { - logT(t, err.Error()) - failT(t) - } -} - -func checkEqualT(t *testing.T, v1 interface{}, v2 interface{}, desc string) (err error) { - if err = deepEqual(v1, v2); err != nil { - logT(t, "Not Equal: %s: %v. v1: %v, v2: %v", desc, err, v1, v2) - failT(t) - } - return -} - -func failT(t *testing.T) { - if failNowOnFail { - t.FailNow() - } else { - t.Fail() - } -} - -func deepEqual(v1, v2 interface{}) (err error) { - if !reflect.DeepEqual(v1, v2) { - err = errors.New("Not Match") - } - return -} diff --git a/vendor/github.com/ugorji/go/codec/json.go b/vendor/github.com/ugorji/go/codec/json.go index e70fc658d..a04dfcb9d 100644 --- a/vendor/github.com/ugorji/go/codec/json.go +++ b/vendor/github.com/ugorji/go/codec/json.go @@ -30,8 +30,6 @@ package codec // Top-level methods of json(End|Dec)Driver (which are implementations of (en|de)cDriver // MUST not call one-another. -// They all must call sep(), and sep() MUST NOT be called more than once for each read. -// If sep() is called and read is not done, you MUST call retryRead so separator wouldn't be read/written twice. import ( "bytes" @@ -39,33 +37,38 @@ import ( "fmt" "reflect" "strconv" - "sync" "unicode/utf16" "unicode/utf8" ) //-------------------------------- -var jsonLiterals = [...]byte{'t', 'r', 'u', 'e', 'f', 'a', 'l', 's', 'e', 'n', 'u', 'l', 'l'} +var ( + jsonLiterals = [...]byte{'t', 'r', 'u', 'e', 'f', 'a', 'l', 's', 'e', 'n', 'u', 'l', 'l'} -var jsonFloat64Pow10 = [...]float64{ - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, - 1e20, 1e21, 1e22, -} + jsonFloat64Pow10 = [...]float64{ + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + 1e20, 1e21, 1e22, + } -var jsonUint64Pow10 = [...]uint64{ - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, -} + jsonUint64Pow10 = [...]uint64{ + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + } + + // jsonTabs and jsonSpaces are used as caches for indents + jsonTabs, jsonSpaces string +) const ( - // if jsonTrackSkipWhitespace, we track Whitespace and reduce the number of redundant checks. - // Make it a const flag, so that it can be elided during linking if false. + // jsonUnreadAfterDecNum controls whether we unread after decoding a number. // - // It is not a clear win, because we continually set a flag behind a pointer - // and then check it each time, as opposed to just 4 conditionals on a stack variable. - jsonTrackSkipWhitespace = true + // instead of unreading, just update d.tok (iff it's not a whitespace char) + // However, doing this means that we may HOLD onto some data which belongs to another stream. + // Thus, it is safest to unread the data when done. + // keep behind a constant flag for now. + jsonUnreadAfterDecNum = true // If !jsonValidateSymbols, decoding will be faster, by skipping some checks: // - If we see first character of null, false or true, @@ -87,100 +90,21 @@ const ( jsonNumUintMaxVal = 1< 1<<53 || v < -(1<<53)) { + e.w.writen1('"') + e.w.writeb(strconv.AppendInt(e.b[:0], v, 10)) + e.w.writen1('"') + return } e.w.writeb(strconv.AppendInt(e.b[:0], v, 10)) } func (e *jsonEncDriver) EncodeUint(v uint64) { - if c := e.s.sc.sep(); c != 0 { - e.w.writen1(c) + if x := e.h.IntegerAsString; x == 'A' || x == 'L' && v > 1<<53 { + e.w.writen1('"') + e.w.writeb(strconv.AppendUint(e.b[:0], v, 10)) + e.w.writen1('"') + return } e.w.writeb(strconv.AppendUint(e.b[:0], v, 10)) } func (e *jsonEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) { - if c := e.s.sc.sep(); c != 0 { - e.w.writen1(c) - } if v := ext.ConvertExt(rv); v == nil { e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil() } else { - e.s.sc.retryRead() en.encode(v) } } func (e *jsonEncDriver) EncodeRawExt(re *RawExt, en *Encoder) { - if c := e.s.sc.sep(); c != 0 { - e.w.writen1(c) - } // only encodes re.Value (never re.Data) if re.Value == nil { e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil() } else { - e.s.sc.retryRead() en.encode(re.Value) } } func (e *jsonEncDriver) EncodeArrayStart(length int) { - if c := e.s.sc.sep(); c != 0 { - e.w.writen1(c) + if e.d { + e.dl++ } - e.s.start(']') e.w.writen1('[') + e.c = containerArrayStart } func (e *jsonEncDriver) EncodeMapStart(length int) { - if c := e.s.sc.sep(); c != 0 { - e.w.writen1(c) + if e.d { + e.dl++ } - e.s.start('}') e.w.writen1('{') -} - -func (e *jsonEncDriver) EncodeEnd() { - b := e.s.sc.st - e.s.end() - e.w.writen1(b) + e.c = containerMapStart } func (e *jsonEncDriver) EncodeString(c charEncoding, v string) { // e.w.writestr(strconv.Quote(v)) - if c := e.s.sc.sep(); c != 0 { - e.w.writen1(c) - } e.quoteStr(v) } func (e *jsonEncDriver) EncodeSymbol(v string) { // e.EncodeString(c_UTF8, v) - if c := e.s.sc.sep(); c != 0 { - e.w.writen1(c) - } e.quoteStr(v) } @@ -310,14 +274,8 @@ func (e *jsonEncDriver) EncodeStringBytes(c charEncoding, v []byte) { e.EncodeExt(v, 0, &e.se, e.e) return } - if c := e.s.sc.sep(); c != 0 { - e.w.writen1(c) - } if c == c_RAW { slen := base64.StdEncoding.EncodedLen(len(v)) - if e.bs == nil { - e.bs = e.b[:] - } if cap(e.bs) >= slen { e.bs = e.bs[:slen] } else { @@ -334,9 +292,6 @@ func (e *jsonEncDriver) EncodeStringBytes(c charEncoding, v []byte) { } func (e *jsonEncDriver) EncodeAsis(v []byte) { - if c := e.s.sc.sep(); c != 0 { - e.w.writen1(c) - } e.w.writeb(v) } @@ -491,188 +446,231 @@ func (x *jsonNum) floatVal() (f float64, parseUsingStrConv bool) { } type jsonDecDriver struct { - d *Decoder - h *JsonHandle - r decReader // *bytesDecReader decReader - ct valueType // container type. one of unset, array or map. - bstr [8]byte // scratch used for string \UXXX parsing - b [64]byte // scratch, used for parsing strings or numbers - b2 [64]byte // scratch, used only for decodeBytes (after base64) - bs []byte // scratch. Initialized from b. Used for parsing strings or numbers. + noBuiltInTypes + d *Decoder + h *JsonHandle + r decReader - wsSkipped bool // whitespace skipped + c containerState + // tok is used to store the token read right after skipWhiteSpace. + tok uint8 + + bstr [8]byte // scratch used for string \UXXX parsing + b [64]byte // scratch, used for parsing strings or numbers + b2 [64]byte // scratch, used only for decodeBytes (after base64) + bs []byte // scratch. Initialized from b. Used for parsing strings or numbers. se setExtWrapper - s jsonStack - n jsonNum - noBuiltInTypes } -// This will skip whitespace characters and return the next byte to read. -// The next byte determines what the value will be one of. -func (d *jsonDecDriver) skipWhitespace(unread bool) (b byte) { - // as initReadNext is not called all the time, we set ct to unSet whenever - // we skipwhitespace, as this is the signal that something new is about to be read. - d.ct = valueTypeUnset - b = d.r.readn1() - if !jsonTrackSkipWhitespace || !d.wsSkipped { - for ; b == ' ' || b == '\t' || b == '\r' || b == '\n'; b = d.r.readn1() { - } - if jsonTrackSkipWhitespace { - d.wsSkipped = true - } - } - if unread { +func jsonIsWS(b byte) bool { + return b == ' ' || b == '\t' || b == '\r' || b == '\n' +} + +// // This will skip whitespace characters and return the next byte to read. +// // The next byte determines what the value will be one of. +// func (d *jsonDecDriver) skipWhitespace() { +// // fast-path: do not enter loop. Just check first (in case no whitespace). +// b := d.r.readn1() +// if jsonIsWS(b) { +// r := d.r +// for b = r.readn1(); jsonIsWS(b); b = r.readn1() { +// } +// } +// d.tok = b +// } + +func (d *jsonDecDriver) uncacheRead() { + if d.tok != 0 { d.r.unreadn1() + d.tok = 0 } - return b +} + +func (d *jsonDecDriver) sendContainerState(c containerState) { + if d.tok == 0 { + var b byte + r := d.r + for b = r.readn1(); jsonIsWS(b); b = r.readn1() { + } + d.tok = b + } + var xc uint8 // char expected + if c == containerMapKey { + if d.c != containerMapStart { + xc = ',' + } + } else if c == containerMapValue { + xc = ':' + } else if c == containerMapEnd { + xc = '}' + } else if c == containerArrayElem { + if d.c != containerArrayStart { + xc = ',' + } + } else if c == containerArrayEnd { + xc = ']' + } + if xc != 0 { + if d.tok != xc { + d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok) + } + d.tok = 0 + } + d.c = c } func (d *jsonDecDriver) CheckBreak() bool { - b := d.skipWhitespace(true) - return b == '}' || b == ']' + if d.tok == 0 { + var b byte + r := d.r + for b = r.readn1(); jsonIsWS(b); b = r.readn1() { + } + d.tok = b + } + if d.tok == '}' || d.tok == ']' { + // d.tok = 0 // only checking, not consuming + return true + } + return false } func (d *jsonDecDriver) readStrIdx(fromIdx, toIdx uint8) { bs := d.r.readx(int(toIdx - fromIdx)) + d.tok = 0 if jsonValidateSymbols { if !bytes.Equal(bs, jsonLiterals[fromIdx:toIdx]) { d.d.errorf("json: expecting %s: got %s", jsonLiterals[fromIdx:toIdx], bs) return } } - if jsonTrackSkipWhitespace { - d.wsSkipped = false - } } func (d *jsonDecDriver) TryDecodeAsNil() bool { - // we mustn't consume the state here, and end up trying to read separator twice. - // Instead, we keep track of the state and restore it if we couldn't decode as nil. - - if c := d.s.sc.sep(); c != 0 { - d.expectChar(c) + if d.tok == 0 { + var b byte + r := d.r + for b = r.readn1(); jsonIsWS(b); b = r.readn1() { + } + d.tok = b } - b := d.skipWhitespace(false) - if b == 'n' { + if d.tok == 'n' { d.readStrIdx(10, 13) // ull - d.ct = valueTypeNil return true } - d.r.unreadn1() - d.s.sc.retryRead() return false } func (d *jsonDecDriver) DecodeBool() bool { - if c := d.s.sc.sep(); c != 0 { - d.expectChar(c) + if d.tok == 0 { + var b byte + r := d.r + for b = r.readn1(); jsonIsWS(b); b = r.readn1() { + } + d.tok = b } - b := d.skipWhitespace(false) - if b == 'f' { + if d.tok == 'f' { d.readStrIdx(5, 9) // alse return false } - if b == 't' { + if d.tok == 't' { d.readStrIdx(1, 4) // rue return true } - d.d.errorf("json: decode bool: got first char %c", b) + d.d.errorf("json: decode bool: got first char %c", d.tok) return false // "unreachable" } func (d *jsonDecDriver) ReadMapStart() int { - if c := d.s.sc.sep(); c != 0 { - d.expectChar(c) + if d.tok == 0 { + var b byte + r := d.r + for b = r.readn1(); jsonIsWS(b); b = r.readn1() { + } + d.tok = b } - d.s.start('}') - d.expectChar('{') - d.ct = valueTypeMap + if d.tok != '{' { + d.d.errorf("json: expect char '%c' but got char '%c'", '{', d.tok) + } + d.tok = 0 + d.c = containerMapStart return -1 } func (d *jsonDecDriver) ReadArrayStart() int { - if c := d.s.sc.sep(); c != 0 { - d.expectChar(c) + if d.tok == 0 { + var b byte + r := d.r + for b = r.readn1(); jsonIsWS(b); b = r.readn1() { + } + d.tok = b } - d.s.start(']') - d.expectChar('[') - d.ct = valueTypeArray + if d.tok != '[' { + d.d.errorf("json: expect char '%c' but got char '%c'", '[', d.tok) + } + d.tok = 0 + d.c = containerArrayStart return -1 } -func (d *jsonDecDriver) ReadEnd() { - b := d.s.sc.st - d.s.end() - d.expectChar(b) -} - -func (d *jsonDecDriver) expectChar(c uint8) { - b := d.skipWhitespace(false) - if b != c { - d.d.errorf("json: expect char '%c' but got char '%c'", c, b) - return - } - if jsonTrackSkipWhitespace { - d.wsSkipped = false - } -} - -// func (d *jsonDecDriver) maybeChar(c uint8) { -// b := d.skipWhitespace(false) -// if b != c { -// d.r.unreadn1() -// return -// } -// if jsonTrackSkipWhitespace { -// d.wsSkipped = false -// } -// } - -func (d *jsonDecDriver) IsContainerType(vt valueType) bool { +func (d *jsonDecDriver) ContainerType() (vt valueType) { // check container type by checking the first char - if d.ct == valueTypeUnset { - b := d.skipWhitespace(true) - if b == '{' { - d.ct = valueTypeMap - } else if b == '[' { - d.ct = valueTypeArray - } else if b == 'n' { - d.ct = valueTypeNil - } else if b == '"' { - d.ct = valueTypeString + if d.tok == 0 { + var b byte + r := d.r + for b = r.readn1(); jsonIsWS(b); b = r.readn1() { } + d.tok = b } - if vt == valueTypeNil || vt == valueTypeBytes || vt == valueTypeString || - vt == valueTypeArray || vt == valueTypeMap { - return d.ct == vt + if b := d.tok; b == '{' { + return valueTypeMap + } else if b == '[' { + return valueTypeArray + } else if b == 'n' { + return valueTypeNil + } else if b == '"' { + return valueTypeString } - // ugorji: made switch into conditionals, so that IsContainerType can be inlined. - // switch vt { - // case valueTypeNil, valueTypeBytes, valueTypeString, valueTypeArray, valueTypeMap: - // return d.ct == vt - // } - d.d.errorf("isContainerType: unsupported parameter: %v", vt) - return false // "unreachable" + return valueTypeUnset + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) + // return false // "unreachable" } func (d *jsonDecDriver) decNum(storeBytes bool) { // If it is has a . or an e|E, decode as a float; else decode as an int. - b := d.skipWhitespace(false) + if d.tok == 0 { + var b byte + r := d.r + for b = r.readn1(); jsonIsWS(b); b = r.readn1() { + } + d.tok = b + } + b := d.tok + var str bool + if b == '"' { + str = true + b = d.r.readn1() + } if !(b == '+' || b == '-' || b == '.' || (b >= '0' && b <= '9')) { d.d.errorf("json: decNum: got first char '%c'", b) return } + d.tok = 0 const cutoff = (1<<64-1)/uint64(10) + 1 // cutoff64(base) const jsonNumUintMaxVal = 1< 2^53 cannot be represented as a JSON number without losing precision. + // This can be mitigated by configuring how to encode integers. + // + // IntegerAsString interpretes the following values: + // - if 'L', then encode integers > 2^53 as a json string. + // - if 'A', then encode all integers as a json string + // containing the exact integer representation as a decimal. + // - else encode all integers as a json number (default) + IntegerAsString uint8 +} + +func (h *JsonHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { + return h.SetExt(rt, tag, &setExtWrapper{i: ext}) } func (h *JsonHandle) newEncDriver(e *Encoder) encDriver { - hd := jsonEncDriver{e: e, w: e.w, h: h} - hd.se.i = h.RawBytesExt + hd := jsonEncDriver{e: e, h: h} + hd.bs = hd.b[:0] + + hd.reset() + return &hd } func (h *JsonHandle) newDecDriver(d *Decoder) decDriver { // d := jsonDecDriver{r: r.(*bytesDecReader), h: h} - hd := jsonDecDriver{d: d, r: d.r, h: h} + hd := jsonDecDriver{d: d, h: h} hd.bs = hd.b[:0] - hd.se.i = h.RawBytesExt + hd.reset() return &hd } -func (h *JsonHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { - return h.SetExt(rt, tag, &setExtWrapper{i: ext}) +func (e *jsonEncDriver) reset() { + e.w = e.e.w + e.se.i = e.h.RawBytesExt + if e.bs != nil { + e.bs = e.bs[:0] + } + e.d, e.dt, e.dl, e.ds = false, false, 0, "" + e.c = 0 + if e.h.Indent > 0 { + e.d = true + e.ds = jsonSpaces[:e.h.Indent] + } else if e.h.Indent < 0 { + e.d = true + e.dt = true + e.ds = jsonTabs[:-(e.h.Indent)] + } +} + +func (d *jsonDecDriver) reset() { + d.r = d.d.r + d.se.i = d.h.RawBytesExt + if d.bs != nil { + d.bs = d.bs[:0] + } + d.c, d.tok = 0, 0 + d.n.reset() } var jsonEncodeTerminate = []byte{' '} diff --git a/vendor/github.com/ugorji/go/codec/msgpack.go b/vendor/github.com/ugorji/go/codec/msgpack.go index fd5f3895d..f9f872362 100644 --- a/vendor/github.com/ugorji/go/codec/msgpack.go +++ b/vendor/github.com/ugorji/go/codec/msgpack.go @@ -103,11 +103,11 @@ var ( //--------------------------------------------- type msgpackEncDriver struct { + noBuiltInTypes + encNoSeparator e *Encoder w encWriter h *MsgpackHandle - noBuiltInTypes - encNoSeparator x [8]byte } @@ -271,7 +271,6 @@ type msgpackDecDriver struct { bd byte bdRead bool br bool // bytes reader - bdType valueType noBuiltInTypes noStreamingCodec decNoSeparator @@ -282,106 +281,100 @@ type msgpackDecDriver struct { // It is called when a nil interface{} is passed, leaving it up to the DecDriver // to introspect the stream and decide how best to decode. // It deciphers the value by looking at the stream first. -func (d *msgpackDecDriver) DecodeNaked() (v interface{}, vt valueType, decodeFurther bool) { +func (d *msgpackDecDriver) DecodeNaked() { if !d.bdRead { d.readNextBd() } bd := d.bd + n := &d.d.n + var decodeFurther bool switch bd { case mpNil: - vt = valueTypeNil + n.v = valueTypeNil d.bdRead = false case mpFalse: - vt = valueTypeBool - v = false + n.v = valueTypeBool + n.b = false case mpTrue: - vt = valueTypeBool - v = true + n.v = valueTypeBool + n.b = true case mpFloat: - vt = valueTypeFloat - v = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4)))) + n.v = valueTypeFloat + n.f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4)))) case mpDouble: - vt = valueTypeFloat - v = math.Float64frombits(bigen.Uint64(d.r.readx(8))) + n.v = valueTypeFloat + n.f = math.Float64frombits(bigen.Uint64(d.r.readx(8))) case mpUint8: - vt = valueTypeUint - v = uint64(d.r.readn1()) + n.v = valueTypeUint + n.u = uint64(d.r.readn1()) case mpUint16: - vt = valueTypeUint - v = uint64(bigen.Uint16(d.r.readx(2))) + n.v = valueTypeUint + n.u = uint64(bigen.Uint16(d.r.readx(2))) case mpUint32: - vt = valueTypeUint - v = uint64(bigen.Uint32(d.r.readx(4))) + n.v = valueTypeUint + n.u = uint64(bigen.Uint32(d.r.readx(4))) case mpUint64: - vt = valueTypeUint - v = uint64(bigen.Uint64(d.r.readx(8))) + n.v = valueTypeUint + n.u = uint64(bigen.Uint64(d.r.readx(8))) case mpInt8: - vt = valueTypeInt - v = int64(int8(d.r.readn1())) + n.v = valueTypeInt + n.i = int64(int8(d.r.readn1())) case mpInt16: - vt = valueTypeInt - v = int64(int16(bigen.Uint16(d.r.readx(2)))) + n.v = valueTypeInt + n.i = int64(int16(bigen.Uint16(d.r.readx(2)))) case mpInt32: - vt = valueTypeInt - v = int64(int32(bigen.Uint32(d.r.readx(4)))) + n.v = valueTypeInt + n.i = int64(int32(bigen.Uint32(d.r.readx(4)))) case mpInt64: - vt = valueTypeInt - v = int64(int64(bigen.Uint64(d.r.readx(8)))) + n.v = valueTypeInt + n.i = int64(int64(bigen.Uint64(d.r.readx(8)))) default: switch { case bd >= mpPosFixNumMin && bd <= mpPosFixNumMax: // positive fixnum (always signed) - vt = valueTypeInt - v = int64(int8(bd)) + n.v = valueTypeInt + n.i = int64(int8(bd)) case bd >= mpNegFixNumMin && bd <= mpNegFixNumMax: // negative fixnum - vt = valueTypeInt - v = int64(int8(bd)) + n.v = valueTypeInt + n.i = int64(int8(bd)) case bd == mpStr8, bd == mpStr16, bd == mpStr32, bd >= mpFixStrMin && bd <= mpFixStrMax: if d.h.RawToString { - var rvm string - vt = valueTypeString - v = &rvm + n.v = valueTypeString + n.s = d.DecodeString() } else { - var rvm = zeroByteSlice - vt = valueTypeBytes - v = &rvm + n.v = valueTypeBytes + n.l = d.DecodeBytes(nil, false, false) } - decodeFurther = true case bd == mpBin8, bd == mpBin16, bd == mpBin32: - var rvm = zeroByteSlice - vt = valueTypeBytes - v = &rvm - decodeFurther = true + n.v = valueTypeBytes + n.l = d.DecodeBytes(nil, false, false) case bd == mpArray16, bd == mpArray32, bd >= mpFixArrayMin && bd <= mpFixArrayMax: - vt = valueTypeArray + n.v = valueTypeArray decodeFurther = true case bd == mpMap16, bd == mpMap32, bd >= mpFixMapMin && bd <= mpFixMapMax: - vt = valueTypeMap + n.v = valueTypeMap decodeFurther = true case bd >= mpFixExt1 && bd <= mpFixExt16, bd >= mpExt8 && bd <= mpExt32: + n.v = valueTypeExt clen := d.readExtLen() - var re RawExt - re.Tag = uint64(d.r.readn1()) - re.Data = d.r.readx(clen) - v = &re - vt = valueTypeExt + n.u = uint64(d.r.readn1()) + n.l = d.r.readx(clen) default: d.d.errorf("Nil-Deciphered DecodeValue: %s: hex: %x, dec: %d", msgBadDesc, bd, bd) - return } } if !decodeFurther { d.bdRead = false } - if vt == valueTypeUint && d.h.SignedInteger { - d.bdType = valueTypeInt - v = int64(v.(uint64)) + if n.v == valueTypeUint && d.h.SignedInteger { + n.v = valueTypeInt + n.i = int64(n.u) } return } @@ -566,28 +559,27 @@ func (d *msgpackDecDriver) DecodeString() (s string) { func (d *msgpackDecDriver) readNextBd() { d.bd = d.r.readn1() d.bdRead = true - d.bdType = valueTypeUnset } -func (d *msgpackDecDriver) IsContainerType(vt valueType) bool { +func (d *msgpackDecDriver) ContainerType() (vt valueType) { bd := d.bd - switch vt { - case valueTypeNil: - return bd == mpNil - case valueTypeBytes: - return bd == mpBin8 || bd == mpBin16 || bd == mpBin32 || - (!d.h.RawToString && - (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax))) - case valueTypeString: - return d.h.RawToString && - (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax)) - case valueTypeArray: - return bd == mpArray16 || bd == mpArray32 || (bd >= mpFixArrayMin && bd <= mpFixArrayMax) - case valueTypeMap: - return bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) + if bd == mpNil { + return valueTypeNil + } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 || + (!d.h.RawToString && + (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax))) { + return valueTypeBytes + } else if d.h.RawToString && + (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax)) { + return valueTypeString + } else if bd == mpArray16 || bd == mpArray32 || (bd >= mpFixArrayMin && bd <= mpFixArrayMax) { + return valueTypeArray + } else if bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) { + return valueTypeMap + } else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } - d.d.errorf("isContainerType: unsupported parameter: %v", vt) - return false // "unreachable" + return valueTypeUnset } func (d *msgpackDecDriver) TryDecodeAsNil() (v bool) { @@ -701,7 +693,6 @@ func (d *msgpackDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs //MsgpackHandle is a Handle for the Msgpack Schema-Free Encoding Format. type MsgpackHandle struct { BasicHandle - binaryEncodingType // RawToString controls how raw bytes are decoded into a nil interface{}. RawToString bool @@ -717,6 +708,11 @@ type MsgpackHandle struct { // type is provided (e.g. decoding into a nil interface{}), you get back // a []byte or string based on the setting of RawToString. WriteExt bool + binaryEncodingType +} + +func (h *MsgpackHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { + return h.SetExt(rt, tag, &setExtWrapper{b: ext}) } func (h *MsgpackHandle) newEncDriver(e *Encoder) encDriver { @@ -727,8 +723,13 @@ func (h *MsgpackHandle) newDecDriver(d *Decoder) decDriver { return &msgpackDecDriver{d: d, r: d.r, h: h, br: d.bytes} } -func (h *MsgpackHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { - return h.SetExt(rt, tag, &setExtWrapper{b: ext}) +func (e *msgpackEncDriver) reset() { + e.w = e.e.w +} + +func (d *msgpackDecDriver) reset() { + d.r = d.d.r + d.bd, d.bdRead = 0, false } //-------------------------------------------------- diff --git a/vendor/github.com/ugorji/go/codec/noop.go b/vendor/github.com/ugorji/go/codec/noop.go index ca02c6a7e..cfee3d084 100644 --- a/vendor/github.com/ugorji/go/codec/noop.go +++ b/vendor/github.com/ugorji/go/codec/noop.go @@ -38,21 +38,26 @@ type noopHandle struct { } type noopDrv struct { + d *Decoder + e *Encoder i int S []string B [][]byte mks []bool // stack. if map (true), else if array (false) mk bool // top of stack. what container are we on? map or array? - ct valueType // last request for IsContainerType. - cb bool // last response for IsContainerType. + ct valueType // last response for IsContainerType. + cb int // counter for ContainerType rand *rand.Rand } func (h *noopDrv) r(v int) int { return h.rand.Intn(v) } func (h *noopDrv) m(v int) int { h.i++; return h.i % v } -func (h *noopDrv) newEncDriver(_ *Encoder) encDriver { return h } -func (h *noopDrv) newDecDriver(_ *Decoder) decDriver { return h } +func (h *noopDrv) newEncDriver(e *Encoder) encDriver { h.e = e; return h } +func (h *noopDrv) newDecDriver(d *Decoder) decDriver { h.d = d; return h } + +func (h *noopDrv) reset() {} +func (h *noopDrv) uncacheRead() {} // --- encDriver @@ -111,18 +116,48 @@ func (h *noopDrv) ReadEnd() { h.end() } func (h *noopDrv) ReadMapStart() int { h.start(true); return h.m(10) } func (h *noopDrv) ReadArrayStart() int { h.start(false); return h.m(10) } -func (h *noopDrv) IsContainerType(vt valueType) bool { +func (h *noopDrv) ContainerType() (vt valueType) { // return h.m(2) == 0 - // handle kStruct - if h.ct == valueTypeMap && vt == valueTypeArray || h.ct == valueTypeArray && vt == valueTypeMap { - h.cb = !h.cb - h.ct = vt - return h.cb - } - // go in a loop and check it. - h.ct = vt - h.cb = h.m(7) == 0 - return h.cb + // handle kStruct, which will bomb is it calls this and doesn't get back a map or array. + // consequently, if the return value is not map or array, reset it to one of them based on h.m(7) % 2 + // for kstruct: at least one out of every 2 times, return one of valueTypeMap or Array (else kstruct bombs) + // however, every 10th time it is called, we just return something else. + var vals = [...]valueType{valueTypeArray, valueTypeMap} + // ------------ TAKE ------------ + // if h.cb%2 == 0 { + // if h.ct == valueTypeMap || h.ct == valueTypeArray { + // } else { + // h.ct = vals[h.m(2)] + // } + // } else if h.cb%5 == 0 { + // h.ct = valueType(h.m(8)) + // } else { + // h.ct = vals[h.m(2)] + // } + // ------------ TAKE ------------ + // if h.cb%16 == 0 { + // h.ct = valueType(h.cb % 8) + // } else { + // h.ct = vals[h.cb%2] + // } + h.ct = vals[h.cb%2] + h.cb++ + return h.ct + + // if h.ct == valueTypeNil || h.ct == valueTypeString || h.ct == valueTypeBytes { + // return h.ct + // } + // return valueTypeUnset + // TODO: may need to tweak this so it works. + // if h.ct == valueTypeMap && vt == valueTypeArray || h.ct == valueTypeArray && vt == valueTypeMap { + // h.cb = !h.cb + // h.ct = vt + // return h.cb + // } + // // go in a loop and check it. + // h.ct = vt + // h.cb = h.m(7) == 0 + // return h.cb } func (h *noopDrv) TryDecodeAsNil() bool { if h.mk { @@ -135,7 +170,7 @@ func (h *noopDrv) DecodeExt(rv interface{}, xtag uint64, ext Ext) uint64 { return 0 } -func (h *noopDrv) DecodeNaked() (v interface{}, vt valueType, decodeFurther bool) { +func (h *noopDrv) DecodeNaked() { // use h.r (random) not h.m() because h.m() could cause the same value to be given. var sk int if h.mk { @@ -144,32 +179,35 @@ func (h *noopDrv) DecodeNaked() (v interface{}, vt valueType, decodeFurther bool } else { sk = h.r(12) } + n := &h.d.n switch sk { case 0: - vt = valueTypeNil + n.v = valueTypeNil case 1: - vt, v = valueTypeBool, false + n.v, n.b = valueTypeBool, false case 2: - vt, v = valueTypeBool, true + n.v, n.b = valueTypeBool, true case 3: - vt, v = valueTypeInt, h.DecodeInt(64) + n.v, n.i = valueTypeInt, h.DecodeInt(64) case 4: - vt, v = valueTypeUint, h.DecodeUint(64) + n.v, n.u = valueTypeUint, h.DecodeUint(64) case 5: - vt, v = valueTypeFloat, h.DecodeFloat(true) + n.v, n.f = valueTypeFloat, h.DecodeFloat(true) case 6: - vt, v = valueTypeFloat, h.DecodeFloat(false) + n.v, n.f = valueTypeFloat, h.DecodeFloat(false) case 7: - vt, v = valueTypeString, h.DecodeString() + n.v, n.s = valueTypeString, h.DecodeString() case 8: - vt, v = valueTypeBytes, h.B[h.m(len(h.B))] + n.v, n.l = valueTypeBytes, h.B[h.m(len(h.B))] case 9: - vt, decodeFurther = valueTypeArray, true + n.v = valueTypeArray case 10: - vt, decodeFurther = valueTypeMap, true + n.v = valueTypeMap default: - vt, v = valueTypeExt, &RawExt{Tag: h.DecodeUint(64), Data: h.B[h.m(len(h.B))]} + n.v = valueTypeExt + n.u = h.DecodeUint(64) + n.l = h.B[h.m(len(h.B))] } - h.ct = vt + h.ct = n.v return } diff --git a/vendor/github.com/ugorji/go/codec/prebuild.sh b/vendor/github.com/ugorji/go/codec/prebuild.sh index 9c8119f36..909f4bb0f 100644 --- a/vendor/github.com/ugorji/go/codec/prebuild.sh +++ b/vendor/github.com/ugorji/go/codec/prebuild.sh @@ -49,7 +49,8 @@ _build() { # [ -e "safe${_gg}" ] && mv safe${_gg} safe${_gg}__${_zts}.bak # [ -e "unsafe${_gg}" ] && mv unsafe${_gg} unsafe${_gg}__${_zts}.bak else - rm -f fast-path.generated.go gen.generated.go gen-helper.generated.go *safe.generated.go *_generated_test.go *.generated_ffjson_expose.go + rm -f fast-path.generated.go gen.generated.go gen-helper.generated.go \ + *safe.generated.go *_generated_test.go *.generated_ffjson_expose.go fi cat > gen.generated.go <> gen.generated.go < fast-path.generated.go < gen-from-tmpl.codec.generated.go <>>>>>> TAGS: $ztags" OPTIND=1 - while getopts "xurtcinsvg" flag + while getopts "_xurtcinsvgzmefdl" flag do case "x$flag" in - 'xt') printf ">>>>>>> REGULAR : "; go test "-tags=$ztags" "$zverbose" ; sleep 2 ;; - 'xc') printf ">>>>>>> CANONICAL : "; go test "-tags=$ztags" "$zverbose" -tc; sleep 2 ;; - 'xi') printf ">>>>>>> I/O : "; go test "-tags=$ztags" "$zverbose" -ti; sleep 2 ;; - 'xn') printf ">>>>>>> NO_SYMBOLS : "; go test "-tags=$ztags" "$zverbose" -tn; sleep 2 ;; - 'xs') printf ">>>>>>> TO_ARRAY : "; go test "-tags=$ztags" "$zverbose" -ts; sleep 2 ;; + 'xt') printf ">>>>>>> REGULAR : "; go test "-tags=$ztags" $zargs ; sleep 2 ;; + 'xc') printf ">>>>>>> CANONICAL : "; go test "-tags=$ztags" $zargs -tc; sleep 2 ;; + 'xi') printf ">>>>>>> I/O : "; go test "-tags=$ztags" $zargs -ti; sleep 2 ;; + 'xn') printf ">>>>>>> NO_SYMBOLS : "; go test "-tags=$ztags" -run=Binc $zargs -tn; sleep 2 ;; + 'xs') printf ">>>>>>> TO_ARRAY : "; go test "-tags=$ztags" $zargs -ts; sleep 2 ;; + 'xe') printf ">>>>>>> INTERN : "; go test "-tags=$ztags" $zargs -te; sleep 2 ;; + 'xd') printf ">>>>>>> INDENT : "; + go test "-tags=$ztags" -run=JsonCodecsTable -td=-1 $zargs; + go test "-tags=$ztags" -run=JsonCodecsTable -td=8 $zargs; + sleep 2 ;; *) ;; esac done @@ -46,11 +60,21 @@ _run() { # echo ">>>>>>> RUNNING VARIATIONS OF TESTS" if [[ "x$@" = "x" ]]; then - # r, x, g, gu - _run "-rtcins" - _run "-xtcins" - _run "-gtcins" - _run "-gutcins" + # All: r, x, g, gu + _run "-_tcinsed_ml" # regular + _run "-_tcinsed_ml_z" # regular with reset + _run "-_tcinsed_ml_f" # regular with no fastpath (notfastpath) + _run "-x_tcinsed_ml" # external + _run "-gx_tcinsed_ml" # codecgen: requires external + _run "-gxu_tcinsed_ml" # codecgen + unsafe +elif [[ "x$@" = "x-Z" ]]; then + # Regular + _run "-_tcinsed_ml" # regular + _run "-_tcinsed_ml_z" # regular with reset +elif [[ "x$@" = "x-F" ]]; then + # regular with notfastpath + _run "-_tcinsed_ml_f" # regular + _run "-_tcinsed_ml_zf" # regular with reset else _run "$@" fi diff --git a/vendor/github.com/ugorji/go/codec/time.go b/vendor/github.com/ugorji/go/codec/time.go index 733fc3fb7..718b731ec 100644 --- a/vendor/github.com/ugorji/go/codec/time.go +++ b/vendor/github.com/ugorji/go/codec/time.go @@ -4,13 +4,53 @@ package codec import ( + "fmt" + "reflect" "time" ) var ( - timeDigits = [...]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} + timeDigits = [...]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} + timeExtEncFn = func(rv reflect.Value) (bs []byte, err error) { + defer panicToErr(&err) + bs = timeExt{}.WriteExt(rv.Interface()) + return + } + timeExtDecFn = func(rv reflect.Value, bs []byte) (err error) { + defer panicToErr(&err) + timeExt{}.ReadExt(rv.Interface(), bs) + return + } ) +type timeExt struct{} + +func (x timeExt) WriteExt(v interface{}) (bs []byte) { + switch v2 := v.(type) { + case time.Time: + bs = encodeTime(v2) + case *time.Time: + bs = encodeTime(*v2) + default: + panic(fmt.Errorf("unsupported format for time conversion: expecting time.Time; got %T", v2)) + } + return +} +func (x timeExt) ReadExt(v interface{}, bs []byte) { + tt, err := decodeTime(bs) + if err != nil { + panic(err) + } + *(v.(*time.Time)) = tt +} + +func (x timeExt) ConvertExt(v interface{}) interface{} { + return x.WriteExt(v) +} +func (x timeExt) UpdateExt(v interface{}, src interface{}) { + x.ReadExt(v, src.([]byte)) +} + // EncodeTime encodes a time.Time as a []byte, including // information on the instant in time and UTC offset. // diff --git a/vendor/k8s.io/kubernetes/pkg/api/conversion.go b/vendor/k8s.io/kubernetes/pkg/api/conversion.go index f5ceb96bb..5599db346 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/conversion.go +++ b/vendor/k8s.io/kubernetes/pkg/api/conversion.go @@ -22,69 +22,132 @@ import ( "k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" - "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/intstr" ) -// Codec is the identity codec for this package - it can only convert itself -// to itself. -var Codec = runtime.CodecFor(Scheme, "") - func init() { Scheme.AddDefaultingFuncs( func(obj *ListOptions) { - obj.LabelSelector = labels.Everything() - obj.FieldSelector = fields.Everything() - }, - // TODO: see about moving this into v1/defaults.go - func(obj *PodExecOptions) { - obj.Stderr = true - obj.Stdout = true - }, - func(obj *PodAttachOptions) { - obj.Stderr = true - obj.Stdout = true + if obj.LabelSelector == nil { + obj.LabelSelector = labels.Everything() + } + if obj.FieldSelector == nil { + obj.FieldSelector = fields.Everything() + } }, ) Scheme.AddConversionFuncs( - func(in *unversioned.Time, out *unversioned.Time, s conversion.Scope) error { - // Cannot deep copy these, because time.Time has unexported fields. - *out = *in - return nil - }, - func(in *string, out *labels.Selector, s conversion.Scope) error { - selector, err := labels.Parse(*in) - if err != nil { - return err - } - *out = selector - return nil - }, - func(in *string, out *fields.Selector, s conversion.Scope) error { - selector, err := fields.ParseSelector(*in) - if err != nil { - return err - } - *out = selector - return nil - }, - func(in *labels.Selector, out *string, s conversion.Scope) error { - if *in == nil { - return nil - } - *out = (*in).String() - return nil - }, - func(in *fields.Selector, out *string, s conversion.Scope) error { - if *in == nil { - return nil - } - *out = (*in).String() - return nil - }, - func(in *resource.Quantity, out *resource.Quantity, s conversion.Scope) error { - // Cannot deep copy these, because inf.Dec has unexported fields. - *out = *in.Copy() - return nil - }, + Convert_unversioned_TypeMeta_To_unversioned_TypeMeta, + Convert_unversioned_ListMeta_To_unversioned_ListMeta, + Convert_intstr_IntOrString_To_intstr_IntOrString, + Convert_unversioned_Time_To_unversioned_Time, + Convert_string_To_labels_Selector, + Convert_string_To_fields_Selector, + Convert_bool_ref_To_bool, + Convert_bool_To_bool_ref, + Convert_string_ref_To_string, + Convert_string_To_string_ref, + Convert_labels_Selector_To_string, + Convert_fields_Selector_To_string, + Convert_resource_Quantity_To_resource_Quantity, ) } + +func Convert_string_ref_To_string(in **string, out *string, s conversion.Scope) error { + if *in == nil { + *out = "" + return nil + } + *out = **in + return nil +} + +func Convert_string_To_string_ref(in *string, out **string, s conversion.Scope) error { + if in == nil { + stringVar := "" + *out = &stringVar + return nil + } + *out = in + return nil +} + +func Convert_bool_ref_To_bool(in **bool, out *bool, s conversion.Scope) error { + if *in == nil { + *out = false + return nil + } + *out = **in + return nil +} + +func Convert_bool_To_bool_ref(in *bool, out **bool, s conversion.Scope) error { + if in == nil { + boolVar := false + *out = &boolVar + return nil + } + *out = in + return nil +} + +func Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(in, out *unversioned.TypeMeta, s conversion.Scope) error { + // These values are explicitly not copied + //out.APIVersion = in.APIVersion + //out.Kind = in.Kind + return nil +} + +func Convert_unversioned_ListMeta_To_unversioned_ListMeta(in, out *unversioned.ListMeta, s conversion.Scope) error { + out.ResourceVersion = in.ResourceVersion + out.SelfLink = in.SelfLink + return nil +} + +func Convert_intstr_IntOrString_To_intstr_IntOrString(in, out *intstr.IntOrString, s conversion.Scope) error { + out.Type = in.Type + out.IntVal = in.IntVal + out.StrVal = in.StrVal + return nil +} + +func Convert_unversioned_Time_To_unversioned_Time(in *unversioned.Time, out *unversioned.Time, s conversion.Scope) error { + // Cannot deep copy these, because time.Time has unexported fields. + *out = *in + return nil +} +func Convert_string_To_labels_Selector(in *string, out *labels.Selector, s conversion.Scope) error { + selector, err := labels.Parse(*in) + if err != nil { + return err + } + *out = selector + return nil +} +func Convert_string_To_fields_Selector(in *string, out *fields.Selector, s conversion.Scope) error { + selector, err := fields.ParseSelector(*in) + if err != nil { + return err + } + *out = selector + return nil +} +func Convert_labels_Selector_To_string(in *labels.Selector, out *string, s conversion.Scope) error { + if *in == nil { + return nil + } + *out = (*in).String() + return nil +} +func Convert_fields_Selector_To_string(in *fields.Selector, out *string, s conversion.Scope) error { + if *in == nil { + return nil + } + *out = (*in).String() + return nil +} +func Convert_resource_Quantity_To_resource_Quantity(in *resource.Quantity, out *resource.Quantity, s conversion.Scope) error { + // Cannot deep copy these, because inf.Dec has unexported fields. + *out = *in.Copy() + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/conversion_test.go b/vendor/k8s.io/kubernetes/pkg/api/conversion_test.go index e3449def6..827022270 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/conversion_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/conversion_test.go @@ -22,6 +22,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/runtime" ) func BenchmarkPodConversion(b *testing.B) { @@ -30,18 +31,18 @@ func BenchmarkPodConversion(b *testing.B) { b.Fatalf("Unexpected error while reading file: %v", err) } var pod api.Pod - if err := api.Scheme.DecodeInto(data, &pod); err != nil { + if err := runtime.DecodeInto(testapi.Default.Codec(), data, &pod); err != nil { b.Fatalf("Unexpected error decoding pod: %v", err) } - scheme := api.Scheme.Raw() + scheme := api.Scheme var result *api.Pod for i := 0; i < b.N; i++ { - versionedObj, err := scheme.ConvertToVersion(&pod, testapi.Default.Version()) + versionedObj, err := scheme.ConvertToVersion(&pod, testapi.Default.GroupVersion().String()) if err != nil { b.Fatalf("Conversion error: %v", err) } - obj, err := scheme.ConvertToVersion(versionedObj, scheme.InternalVersion) + obj, err := scheme.ConvertToVersion(versionedObj, testapi.Default.InternalGroupVersion().String()) if err != nil { b.Fatalf("Conversion error: %v", err) } @@ -58,18 +59,18 @@ func BenchmarkNodeConversion(b *testing.B) { b.Fatalf("Unexpected error while reading file: %v", err) } var node api.Node - if err := api.Scheme.DecodeInto(data, &node); err != nil { + if err := runtime.DecodeInto(testapi.Default.Codec(), data, &node); err != nil { b.Fatalf("Unexpected error decoding node: %v", err) } - scheme := api.Scheme.Raw() + scheme := api.Scheme var result *api.Node for i := 0; i < b.N; i++ { - versionedObj, err := scheme.ConvertToVersion(&node, testapi.Default.Version()) + versionedObj, err := scheme.ConvertToVersion(&node, testapi.Default.GroupVersion().String()) if err != nil { b.Fatalf("Conversion error: %v", err) } - obj, err := scheme.ConvertToVersion(versionedObj, scheme.InternalVersion) + obj, err := scheme.ConvertToVersion(versionedObj, testapi.Default.InternalGroupVersion().String()) if err != nil { b.Fatalf("Conversion error: %v", err) } @@ -86,18 +87,18 @@ func BenchmarkReplicationControllerConversion(b *testing.B) { b.Fatalf("Unexpected error while reading file: %v", err) } var replicationController api.ReplicationController - if err := api.Scheme.DecodeInto(data, &replicationController); err != nil { + if err := runtime.DecodeInto(testapi.Default.Codec(), data, &replicationController); err != nil { b.Fatalf("Unexpected error decoding node: %v", err) } - scheme := api.Scheme.Raw() + scheme := api.Scheme var result *api.ReplicationController for i := 0; i < b.N; i++ { - versionedObj, err := scheme.ConvertToVersion(&replicationController, testapi.Default.Version()) + versionedObj, err := scheme.ConvertToVersion(&replicationController, testapi.Default.GroupVersion().String()) if err != nil { b.Fatalf("Conversion error: %v", err) } - obj, err := scheme.ConvertToVersion(versionedObj, scheme.InternalVersion) + obj, err := scheme.ConvertToVersion(versionedObj, testapi.Default.InternalGroupVersion().String()) if err != nil { b.Fatalf("Conversion error: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/copy_test.go b/vendor/k8s.io/kubernetes/pkg/api/copy_test.go index 0744873ce..194b5318a 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/copy_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/copy_test.go @@ -24,6 +24,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" apitesting "k8s.io/kubernetes/pkg/api/testing" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/util" "github.com/google/gofuzz" @@ -31,37 +32,37 @@ import ( func TestDeepCopyApiObjects(t *testing.T) { for i := 0; i < *fuzzIters; i++ { - for _, version := range []string{"", testapi.Default.Version()} { + for _, version := range []unversioned.GroupVersion{testapi.Default.InternalGroupVersion(), *testapi.Default.GroupVersion()} { f := apitesting.FuzzerFor(t, version, rand.NewSource(rand.Int63())) for kind := range api.Scheme.KnownTypes(version) { - doDeepCopyTest(t, version, kind, f) + doDeepCopyTest(t, version.WithKind(kind), f) } } } } -func doDeepCopyTest(t *testing.T, version, kind string, f *fuzz.Fuzzer) { - item, err := api.Scheme.New(version, kind) +func doDeepCopyTest(t *testing.T, kind unversioned.GroupVersionKind, f *fuzz.Fuzzer) { + item, err := api.Scheme.New(kind) if err != nil { - t.Fatalf("Could not create a %s: %s", kind, err) + t.Fatalf("Could not create a %v: %s", kind, err) } f.Fuzz(item) itemCopy, err := api.Scheme.DeepCopy(item) if err != nil { - t.Errorf("Could not deep copy a %s: %s", kind, err) + t.Errorf("Could not deep copy a %v: %s", kind, err) return } if !reflect.DeepEqual(item, itemCopy) { - t.Errorf("\nexpected: %#v\n\ngot: %#v\n\ndiff: %v", item, itemCopy, util.ObjectDiff(item, itemCopy)) + t.Errorf("\nexpected: %#v\n\ngot: %#v\n\ndiff: %v", item, itemCopy, util.ObjectGoPrintSideBySide(item, itemCopy)) } } func TestDeepCopySingleType(t *testing.T) { for i := 0; i < *fuzzIters; i++ { - for _, version := range []string{"", testapi.Default.Version()} { + for _, version := range []unversioned.GroupVersion{testapi.Default.InternalGroupVersion(), *testapi.Default.GroupVersion()} { f := apitesting.FuzzerFor(t, version, rand.NewSource(rand.Int63())) - doDeepCopyTest(t, version, "Pod", f) + doDeepCopyTest(t, version.WithKind("Pod"), f) } } } diff --git a/vendor/k8s.io/kubernetes/pkg/api/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/api/deep_copy_generated.go index 2f147789b..a63ef92ca 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/deep_copy_generated.go +++ b/vendor/k8s.io/kubernetes/pkg/api/deep_copy_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2015 The Kubernetes Authors All rights reserved. +Copyright 2016 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,24 +14,178 @@ See the License for the specific language governing permissions and limitations under the License. */ -// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh. +// This file was autogenerated by deepcopy-gen. Do not edit it manually! package api import ( - time "time" - resource "k8s.io/kubernetes/pkg/api/resource" unversioned "k8s.io/kubernetes/pkg/api/unversioned" conversion "k8s.io/kubernetes/pkg/conversion" fields "k8s.io/kubernetes/pkg/fields" labels "k8s.io/kubernetes/pkg/labels" runtime "k8s.io/kubernetes/pkg/runtime" - util "k8s.io/kubernetes/pkg/util" - inf "speter.net/go/exp/math/dec/inf" + intstr "k8s.io/kubernetes/pkg/util/intstr" + sets "k8s.io/kubernetes/pkg/util/sets" ) -func deepCopy_api_AWSElasticBlockStoreVolumeSource(in AWSElasticBlockStoreVolumeSource, out *AWSElasticBlockStoreVolumeSource, c *conversion.Cloner) error { +func init() { + if err := Scheme.AddGeneratedDeepCopyFuncs( + DeepCopy_api_AWSElasticBlockStoreVolumeSource, + DeepCopy_api_Affinity, + DeepCopy_api_AzureFileVolumeSource, + DeepCopy_api_Binding, + DeepCopy_api_Capabilities, + DeepCopy_api_CephFSVolumeSource, + DeepCopy_api_CinderVolumeSource, + DeepCopy_api_ComponentCondition, + DeepCopy_api_ComponentStatus, + DeepCopy_api_ComponentStatusList, + DeepCopy_api_ConfigMap, + DeepCopy_api_ConfigMapKeySelector, + DeepCopy_api_ConfigMapList, + DeepCopy_api_ConfigMapVolumeSource, + DeepCopy_api_Container, + DeepCopy_api_ContainerImage, + DeepCopy_api_ContainerPort, + DeepCopy_api_ContainerState, + DeepCopy_api_ContainerStateRunning, + DeepCopy_api_ContainerStateTerminated, + DeepCopy_api_ContainerStateWaiting, + DeepCopy_api_ContainerStatus, + DeepCopy_api_ConversionError, + DeepCopy_api_DaemonEndpoint, + DeepCopy_api_DeleteOptions, + DeepCopy_api_DownwardAPIVolumeFile, + DeepCopy_api_DownwardAPIVolumeSource, + DeepCopy_api_EmptyDirVolumeSource, + DeepCopy_api_EndpointAddress, + DeepCopy_api_EndpointPort, + DeepCopy_api_EndpointSubset, + DeepCopy_api_Endpoints, + DeepCopy_api_EndpointsList, + DeepCopy_api_EnvVar, + DeepCopy_api_EnvVarSource, + DeepCopy_api_Event, + DeepCopy_api_EventList, + DeepCopy_api_EventSource, + DeepCopy_api_ExecAction, + DeepCopy_api_ExportOptions, + DeepCopy_api_FCVolumeSource, + DeepCopy_api_FlexVolumeSource, + DeepCopy_api_FlockerVolumeSource, + DeepCopy_api_GCEPersistentDiskVolumeSource, + DeepCopy_api_GitRepoVolumeSource, + DeepCopy_api_GlusterfsVolumeSource, + DeepCopy_api_HTTPGetAction, + DeepCopy_api_HTTPHeader, + DeepCopy_api_Handler, + DeepCopy_api_HostPathVolumeSource, + DeepCopy_api_ISCSIVolumeSource, + DeepCopy_api_KeyToPath, + DeepCopy_api_Lifecycle, + DeepCopy_api_LimitRange, + DeepCopy_api_LimitRangeItem, + DeepCopy_api_LimitRangeList, + DeepCopy_api_LimitRangeSpec, + DeepCopy_api_List, + DeepCopy_api_ListOptions, + DeepCopy_api_LoadBalancerIngress, + DeepCopy_api_LoadBalancerStatus, + DeepCopy_api_LocalObjectReference, + DeepCopy_api_NFSVolumeSource, + DeepCopy_api_Namespace, + DeepCopy_api_NamespaceList, + DeepCopy_api_NamespaceSpec, + DeepCopy_api_NamespaceStatus, + DeepCopy_api_Node, + DeepCopy_api_NodeAddress, + DeepCopy_api_NodeAffinity, + DeepCopy_api_NodeCondition, + DeepCopy_api_NodeDaemonEndpoints, + DeepCopy_api_NodeList, + DeepCopy_api_NodeResources, + DeepCopy_api_NodeSelector, + DeepCopy_api_NodeSelectorRequirement, + DeepCopy_api_NodeSelectorTerm, + DeepCopy_api_NodeSpec, + DeepCopy_api_NodeStatus, + DeepCopy_api_NodeSystemInfo, + DeepCopy_api_ObjectFieldSelector, + DeepCopy_api_ObjectMeta, + DeepCopy_api_ObjectReference, + DeepCopy_api_PersistentVolume, + DeepCopy_api_PersistentVolumeClaim, + DeepCopy_api_PersistentVolumeClaimList, + DeepCopy_api_PersistentVolumeClaimSpec, + DeepCopy_api_PersistentVolumeClaimStatus, + DeepCopy_api_PersistentVolumeClaimVolumeSource, + DeepCopy_api_PersistentVolumeList, + DeepCopy_api_PersistentVolumeSource, + DeepCopy_api_PersistentVolumeSpec, + DeepCopy_api_PersistentVolumeStatus, + DeepCopy_api_Pod, + DeepCopy_api_PodAttachOptions, + DeepCopy_api_PodCondition, + DeepCopy_api_PodExecOptions, + DeepCopy_api_PodList, + DeepCopy_api_PodLogOptions, + DeepCopy_api_PodProxyOptions, + DeepCopy_api_PodSecurityContext, + DeepCopy_api_PodSpec, + DeepCopy_api_PodStatus, + DeepCopy_api_PodStatusResult, + DeepCopy_api_PodTemplate, + DeepCopy_api_PodTemplateList, + DeepCopy_api_PodTemplateSpec, + DeepCopy_api_PreferredSchedulingTerm, + DeepCopy_api_Probe, + DeepCopy_api_RBDVolumeSource, + DeepCopy_api_RangeAllocation, + DeepCopy_api_ReplicationController, + DeepCopy_api_ReplicationControllerList, + DeepCopy_api_ReplicationControllerSpec, + DeepCopy_api_ReplicationControllerStatus, + DeepCopy_api_ResourceQuota, + DeepCopy_api_ResourceQuotaList, + DeepCopy_api_ResourceQuotaSpec, + DeepCopy_api_ResourceQuotaStatus, + DeepCopy_api_ResourceRequirements, + DeepCopy_api_SELinuxOptions, + DeepCopy_api_Secret, + DeepCopy_api_SecretKeySelector, + DeepCopy_api_SecretList, + DeepCopy_api_SecretVolumeSource, + DeepCopy_api_SecurityContext, + DeepCopy_api_SerializedReference, + DeepCopy_api_Service, + DeepCopy_api_ServiceAccount, + DeepCopy_api_ServiceAccountList, + DeepCopy_api_ServiceList, + DeepCopy_api_ServicePort, + DeepCopy_api_ServiceSpec, + DeepCopy_api_ServiceStatus, + DeepCopy_api_TCPSocketAction, + DeepCopy_api_Volume, + DeepCopy_api_VolumeMount, + DeepCopy_api_VolumeSource, + DeepCopy_conversion_Meta, + DeepCopy_intstr_IntOrString, + DeepCopy_sets_Empty, + DeepCopy_unversioned_GroupKind, + DeepCopy_unversioned_GroupResource, + DeepCopy_unversioned_GroupVersion, + DeepCopy_unversioned_GroupVersionKind, + DeepCopy_unversioned_GroupVersionResource, + DeepCopy_unversioned_ListMeta, + DeepCopy_unversioned_TypeMeta, + ); err != nil { + // if one of the deep copy functions is malformed, detect it immediately. + panic(err) + } +} + +func DeepCopy_api_AWSElasticBlockStoreVolumeSource(in AWSElasticBlockStoreVolumeSource, out *AWSElasticBlockStoreVolumeSource, c *conversion.Cloner) error { out.VolumeID = in.VolumeID out.FSType = in.FSType out.Partition = in.Partition @@ -39,32 +193,54 @@ func deepCopy_api_AWSElasticBlockStoreVolumeSource(in AWSElasticBlockStoreVolume return nil } -func deepCopy_api_Binding(in Binding, out *Binding, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_Affinity(in Affinity, out *Affinity, c *conversion.Cloner) error { + if in.NodeAffinity != nil { + in, out := in.NodeAffinity, &out.NodeAffinity + *out = new(NodeAffinity) + if err := DeepCopy_api_NodeAffinity(*in, *out, c); err != nil { + return err + } + } else { + out.NodeAffinity = nil + } + return nil +} + +func DeepCopy_api_AzureFileVolumeSource(in AzureFileVolumeSource, out *AzureFileVolumeSource, c *conversion.Cloner) error { + out.SecretName = in.SecretName + out.ShareName = in.ShareName + out.ReadOnly = in.ReadOnly + return nil +} + +func DeepCopy_api_Binding(in Binding, out *Binding, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectReference(in.Target, &out.Target, c); err != nil { + if err := DeepCopy_api_ObjectReference(in.Target, &out.Target, c); err != nil { return err } return nil } -func deepCopy_api_Capabilities(in Capabilities, out *Capabilities, c *conversion.Cloner) error { +func DeepCopy_api_Capabilities(in Capabilities, out *Capabilities, c *conversion.Cloner) error { if in.Add != nil { - out.Add = make([]Capability, len(in.Add)) - for i := range in.Add { - out.Add[i] = in.Add[i] + in, out := in.Add, &out.Add + *out = make([]Capability, len(in)) + for i := range in { + (*out)[i] = in[i] } } else { out.Add = nil } if in.Drop != nil { - out.Drop = make([]Capability, len(in.Drop)) - for i := range in.Drop { - out.Drop[i] = in.Drop[i] + in, out := in.Drop, &out.Drop + *out = make([]Capability, len(in)) + for i := range in { + (*out)[i] = in[i] } } else { out.Drop = nil @@ -72,20 +248,21 @@ func deepCopy_api_Capabilities(in Capabilities, out *Capabilities, c *conversion return nil } -func deepCopy_api_CephFSVolumeSource(in CephFSVolumeSource, out *CephFSVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_CephFSVolumeSource(in CephFSVolumeSource, out *CephFSVolumeSource, c *conversion.Cloner) error { if in.Monitors != nil { - out.Monitors = make([]string, len(in.Monitors)) - for i := range in.Monitors { - out.Monitors[i] = in.Monitors[i] - } + in, out := in.Monitors, &out.Monitors + *out = make([]string, len(in)) + copy(*out, in) } else { out.Monitors = nil } + out.Path = in.Path out.User = in.User out.SecretFile = in.SecretFile if in.SecretRef != nil { - out.SecretRef = new(LocalObjectReference) - if err := deepCopy_api_LocalObjectReference(*in.SecretRef, out.SecretRef, c); err != nil { + in, out := in.SecretRef, &out.SecretRef + *out = new(LocalObjectReference) + if err := DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil { return err } } else { @@ -95,14 +272,14 @@ func deepCopy_api_CephFSVolumeSource(in CephFSVolumeSource, out *CephFSVolumeSou return nil } -func deepCopy_api_CinderVolumeSource(in CinderVolumeSource, out *CinderVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_CinderVolumeSource(in CinderVolumeSource, out *CinderVolumeSource, c *conversion.Cloner) error { out.VolumeID = in.VolumeID out.FSType = in.FSType out.ReadOnly = in.ReadOnly return nil } -func deepCopy_api_ComponentCondition(in ComponentCondition, out *ComponentCondition, c *conversion.Cloner) error { +func DeepCopy_api_ComponentCondition(in ComponentCondition, out *ComponentCondition, c *conversion.Cloner) error { out.Type = in.Type out.Status = in.Status out.Message = in.Message @@ -110,17 +287,18 @@ func deepCopy_api_ComponentCondition(in ComponentCondition, out *ComponentCondit return nil } -func deepCopy_api_ComponentStatus(in ComponentStatus, out *ComponentStatus, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ComponentStatus(in ComponentStatus, out *ComponentStatus, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } if in.Conditions != nil { - out.Conditions = make([]ComponentCondition, len(in.Conditions)) - for i := range in.Conditions { - if err := deepCopy_api_ComponentCondition(in.Conditions[i], &out.Conditions[i], c); err != nil { + in, out := in.Conditions, &out.Conditions + *out = make([]ComponentCondition, len(in)) + for i := range in { + if err := DeepCopy_api_ComponentCondition(in[i], &(*out)[i], c); err != nil { return err } } @@ -130,17 +308,18 @@ func deepCopy_api_ComponentStatus(in ComponentStatus, out *ComponentStatus, c *c return nil } -func deepCopy_api_ComponentStatusList(in ComponentStatusList, out *ComponentStatusList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ComponentStatusList(in ComponentStatusList, out *ComponentStatusList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]ComponentStatus, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_ComponentStatus(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]ComponentStatus, len(in)) + for i := range in { + if err := DeepCopy_api_ComponentStatus(in[i], &(*out)[i], c); err != nil { return err } } @@ -150,30 +329,95 @@ func deepCopy_api_ComponentStatusList(in ComponentStatusList, out *ComponentStat return nil } -func deepCopy_api_Container(in Container, out *Container, c *conversion.Cloner) error { +func DeepCopy_api_ConfigMap(in ConfigMap, out *ConfigMap, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if in.Data != nil { + in, out := in.Data, &out.Data + *out = make(map[string]string) + for key, val := range in { + (*out)[key] = val + } + } else { + out.Data = nil + } + return nil +} + +func DeepCopy_api_ConfigMapKeySelector(in ConfigMapKeySelector, out *ConfigMapKeySelector, c *conversion.Cloner) error { + if err := DeepCopy_api_LocalObjectReference(in.LocalObjectReference, &out.LocalObjectReference, c); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func DeepCopy_api_ConfigMapList(in ConfigMapList, out *ConfigMapList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + return err + } + if in.Items != nil { + in, out := in.Items, &out.Items + *out = make([]ConfigMap, len(in)) + for i := range in { + if err := DeepCopy_api_ConfigMap(in[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func DeepCopy_api_ConfigMapVolumeSource(in ConfigMapVolumeSource, out *ConfigMapVolumeSource, c *conversion.Cloner) error { + if err := DeepCopy_api_LocalObjectReference(in.LocalObjectReference, &out.LocalObjectReference, c); err != nil { + return err + } + if in.Items != nil { + in, out := in.Items, &out.Items + *out = make([]KeyToPath, len(in)) + for i := range in { + if err := DeepCopy_api_KeyToPath(in[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func DeepCopy_api_Container(in Container, out *Container, c *conversion.Cloner) error { out.Name = in.Name out.Image = in.Image if in.Command != nil { - out.Command = make([]string, len(in.Command)) - for i := range in.Command { - out.Command[i] = in.Command[i] - } + in, out := in.Command, &out.Command + *out = make([]string, len(in)) + copy(*out, in) } else { out.Command = nil } if in.Args != nil { - out.Args = make([]string, len(in.Args)) - for i := range in.Args { - out.Args[i] = in.Args[i] - } + in, out := in.Args, &out.Args + *out = make([]string, len(in)) + copy(*out, in) } else { out.Args = nil } out.WorkingDir = in.WorkingDir if in.Ports != nil { - out.Ports = make([]ContainerPort, len(in.Ports)) - for i := range in.Ports { - if err := deepCopy_api_ContainerPort(in.Ports[i], &out.Ports[i], c); err != nil { + in, out := in.Ports, &out.Ports + *out = make([]ContainerPort, len(in)) + for i := range in { + if err := DeepCopy_api_ContainerPort(in[i], &(*out)[i], c); err != nil { return err } } @@ -181,22 +425,24 @@ func deepCopy_api_Container(in Container, out *Container, c *conversion.Cloner) out.Ports = nil } if in.Env != nil { - out.Env = make([]EnvVar, len(in.Env)) - for i := range in.Env { - if err := deepCopy_api_EnvVar(in.Env[i], &out.Env[i], c); err != nil { + in, out := in.Env, &out.Env + *out = make([]EnvVar, len(in)) + for i := range in { + if err := DeepCopy_api_EnvVar(in[i], &(*out)[i], c); err != nil { return err } } } else { out.Env = nil } - if err := deepCopy_api_ResourceRequirements(in.Resources, &out.Resources, c); err != nil { + if err := DeepCopy_api_ResourceRequirements(in.Resources, &out.Resources, c); err != nil { return err } if in.VolumeMounts != nil { - out.VolumeMounts = make([]VolumeMount, len(in.VolumeMounts)) - for i := range in.VolumeMounts { - if err := deepCopy_api_VolumeMount(in.VolumeMounts[i], &out.VolumeMounts[i], c); err != nil { + in, out := in.VolumeMounts, &out.VolumeMounts + *out = make([]VolumeMount, len(in)) + for i := range in { + if err := DeepCopy_api_VolumeMount(in[i], &(*out)[i], c); err != nil { return err } } @@ -204,24 +450,27 @@ func deepCopy_api_Container(in Container, out *Container, c *conversion.Cloner) out.VolumeMounts = nil } if in.LivenessProbe != nil { - out.LivenessProbe = new(Probe) - if err := deepCopy_api_Probe(*in.LivenessProbe, out.LivenessProbe, c); err != nil { + in, out := in.LivenessProbe, &out.LivenessProbe + *out = new(Probe) + if err := DeepCopy_api_Probe(*in, *out, c); err != nil { return err } } else { out.LivenessProbe = nil } if in.ReadinessProbe != nil { - out.ReadinessProbe = new(Probe) - if err := deepCopy_api_Probe(*in.ReadinessProbe, out.ReadinessProbe, c); err != nil { + in, out := in.ReadinessProbe, &out.ReadinessProbe + *out = new(Probe) + if err := DeepCopy_api_Probe(*in, *out, c); err != nil { return err } } else { out.ReadinessProbe = nil } if in.Lifecycle != nil { - out.Lifecycle = new(Lifecycle) - if err := deepCopy_api_Lifecycle(*in.Lifecycle, out.Lifecycle, c); err != nil { + in, out := in.Lifecycle, &out.Lifecycle + *out = new(Lifecycle) + if err := DeepCopy_api_Lifecycle(*in, *out, c); err != nil { return err } } else { @@ -230,8 +479,9 @@ func deepCopy_api_Container(in Container, out *Container, c *conversion.Cloner) out.TerminationMessagePath = in.TerminationMessagePath out.ImagePullPolicy = in.ImagePullPolicy if in.SecurityContext != nil { - out.SecurityContext = new(SecurityContext) - if err := deepCopy_api_SecurityContext(*in.SecurityContext, out.SecurityContext, c); err != nil { + in, out := in.SecurityContext, &out.SecurityContext + *out = new(SecurityContext) + if err := DeepCopy_api_SecurityContext(*in, *out, c); err != nil { return err } } else { @@ -243,7 +493,19 @@ func deepCopy_api_Container(in Container, out *Container, c *conversion.Cloner) return nil } -func deepCopy_api_ContainerPort(in ContainerPort, out *ContainerPort, c *conversion.Cloner) error { +func DeepCopy_api_ContainerImage(in ContainerImage, out *ContainerImage, c *conversion.Cloner) error { + if in.RepoTags != nil { + in, out := in.RepoTags, &out.RepoTags + *out = make([]string, len(in)) + copy(*out, in) + } else { + out.RepoTags = nil + } + out.Size = in.Size + return nil +} + +func DeepCopy_api_ContainerPort(in ContainerPort, out *ContainerPort, c *conversion.Cloner) error { out.Name = in.Name out.HostPort = in.HostPort out.ContainerPort = in.ContainerPort @@ -252,26 +514,29 @@ func deepCopy_api_ContainerPort(in ContainerPort, out *ContainerPort, c *convers return nil } -func deepCopy_api_ContainerState(in ContainerState, out *ContainerState, c *conversion.Cloner) error { +func DeepCopy_api_ContainerState(in ContainerState, out *ContainerState, c *conversion.Cloner) error { if in.Waiting != nil { - out.Waiting = new(ContainerStateWaiting) - if err := deepCopy_api_ContainerStateWaiting(*in.Waiting, out.Waiting, c); err != nil { + in, out := in.Waiting, &out.Waiting + *out = new(ContainerStateWaiting) + if err := DeepCopy_api_ContainerStateWaiting(*in, *out, c); err != nil { return err } } else { out.Waiting = nil } if in.Running != nil { - out.Running = new(ContainerStateRunning) - if err := deepCopy_api_ContainerStateRunning(*in.Running, out.Running, c); err != nil { + in, out := in.Running, &out.Running + *out = new(ContainerStateRunning) + if err := DeepCopy_api_ContainerStateRunning(*in, *out, c); err != nil { return err } } else { out.Running = nil } if in.Terminated != nil { - out.Terminated = new(ContainerStateTerminated) - if err := deepCopy_api_ContainerStateTerminated(*in.Terminated, out.Terminated, c); err != nil { + in, out := in.Terminated, &out.Terminated + *out = new(ContainerStateTerminated) + if err := DeepCopy_api_ContainerStateTerminated(*in, *out, c); err != nil { return err } } else { @@ -280,40 +545,46 @@ func deepCopy_api_ContainerState(in ContainerState, out *ContainerState, c *conv return nil } -func deepCopy_api_ContainerStateRunning(in ContainerStateRunning, out *ContainerStateRunning, c *conversion.Cloner) error { - if err := deepCopy_unversioned_Time(in.StartedAt, &out.StartedAt, c); err != nil { +func DeepCopy_api_ContainerStateRunning(in ContainerStateRunning, out *ContainerStateRunning, c *conversion.Cloner) error { + if newVal, err := c.DeepCopy(in.StartedAt); err != nil { return err + } else { + out.StartedAt = newVal.(unversioned.Time) } return nil } -func deepCopy_api_ContainerStateTerminated(in ContainerStateTerminated, out *ContainerStateTerminated, c *conversion.Cloner) error { +func DeepCopy_api_ContainerStateTerminated(in ContainerStateTerminated, out *ContainerStateTerminated, c *conversion.Cloner) error { out.ExitCode = in.ExitCode out.Signal = in.Signal out.Reason = in.Reason out.Message = in.Message - if err := deepCopy_unversioned_Time(in.StartedAt, &out.StartedAt, c); err != nil { + if newVal, err := c.DeepCopy(in.StartedAt); err != nil { return err + } else { + out.StartedAt = newVal.(unversioned.Time) } - if err := deepCopy_unversioned_Time(in.FinishedAt, &out.FinishedAt, c); err != nil { + if newVal, err := c.DeepCopy(in.FinishedAt); err != nil { return err + } else { + out.FinishedAt = newVal.(unversioned.Time) } out.ContainerID = in.ContainerID return nil } -func deepCopy_api_ContainerStateWaiting(in ContainerStateWaiting, out *ContainerStateWaiting, c *conversion.Cloner) error { +func DeepCopy_api_ContainerStateWaiting(in ContainerStateWaiting, out *ContainerStateWaiting, c *conversion.Cloner) error { out.Reason = in.Reason out.Message = in.Message return nil } -func deepCopy_api_ContainerStatus(in ContainerStatus, out *ContainerStatus, c *conversion.Cloner) error { +func DeepCopy_api_ContainerStatus(in ContainerStatus, out *ContainerStatus, c *conversion.Cloner) error { out.Name = in.Name - if err := deepCopy_api_ContainerState(in.State, &out.State, c); err != nil { + if err := DeepCopy_api_ContainerState(in.State, &out.State, c); err != nil { return err } - if err := deepCopy_api_ContainerState(in.LastTerminationState, &out.LastTerminationState, c); err != nil { + if err := DeepCopy_api_ContainerState(in.LastTerminationState, &out.LastTerminationState, c); err != nil { return err } out.Ready = in.Ready @@ -324,37 +595,54 @@ func deepCopy_api_ContainerStatus(in ContainerStatus, out *ContainerStatus, c *c return nil } -func deepCopy_api_DaemonEndpoint(in DaemonEndpoint, out *DaemonEndpoint, c *conversion.Cloner) error { +func DeepCopy_api_ConversionError(in ConversionError, out *ConversionError, c *conversion.Cloner) error { + if newVal, err := c.DeepCopy(in.In); err != nil { + return err + } else { + out.In = newVal.(interface{}) + } + if newVal, err := c.DeepCopy(in.Out); err != nil { + return err + } else { + out.Out = newVal.(interface{}) + } + out.Message = in.Message + return nil +} + +func DeepCopy_api_DaemonEndpoint(in DaemonEndpoint, out *DaemonEndpoint, c *conversion.Cloner) error { out.Port = in.Port return nil } -func deepCopy_api_DeleteOptions(in DeleteOptions, out *DeleteOptions, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_DeleteOptions(in DeleteOptions, out *DeleteOptions, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } if in.GracePeriodSeconds != nil { - out.GracePeriodSeconds = new(int64) - *out.GracePeriodSeconds = *in.GracePeriodSeconds + in, out := in.GracePeriodSeconds, &out.GracePeriodSeconds + *out = new(int64) + **out = *in } else { out.GracePeriodSeconds = nil } return nil } -func deepCopy_api_DownwardAPIVolumeFile(in DownwardAPIVolumeFile, out *DownwardAPIVolumeFile, c *conversion.Cloner) error { +func DeepCopy_api_DownwardAPIVolumeFile(in DownwardAPIVolumeFile, out *DownwardAPIVolumeFile, c *conversion.Cloner) error { out.Path = in.Path - if err := deepCopy_api_ObjectFieldSelector(in.FieldRef, &out.FieldRef, c); err != nil { + if err := DeepCopy_api_ObjectFieldSelector(in.FieldRef, &out.FieldRef, c); err != nil { return err } return nil } -func deepCopy_api_DownwardAPIVolumeSource(in DownwardAPIVolumeSource, out *DownwardAPIVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_DownwardAPIVolumeSource(in DownwardAPIVolumeSource, out *DownwardAPIVolumeSource, c *conversion.Cloner) error { if in.Items != nil { - out.Items = make([]DownwardAPIVolumeFile, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_DownwardAPIVolumeFile(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]DownwardAPIVolumeFile, len(in)) + for i := range in { + if err := DeepCopy_api_DownwardAPIVolumeFile(in[i], &(*out)[i], c); err != nil { return err } } @@ -364,16 +652,17 @@ func deepCopy_api_DownwardAPIVolumeSource(in DownwardAPIVolumeSource, out *Downw return nil } -func deepCopy_api_EmptyDirVolumeSource(in EmptyDirVolumeSource, out *EmptyDirVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_EmptyDirVolumeSource(in EmptyDirVolumeSource, out *EmptyDirVolumeSource, c *conversion.Cloner) error { out.Medium = in.Medium return nil } -func deepCopy_api_EndpointAddress(in EndpointAddress, out *EndpointAddress, c *conversion.Cloner) error { +func DeepCopy_api_EndpointAddress(in EndpointAddress, out *EndpointAddress, c *conversion.Cloner) error { out.IP = in.IP if in.TargetRef != nil { - out.TargetRef = new(ObjectReference) - if err := deepCopy_api_ObjectReference(*in.TargetRef, out.TargetRef, c); err != nil { + in, out := in.TargetRef, &out.TargetRef + *out = new(ObjectReference) + if err := DeepCopy_api_ObjectReference(*in, *out, c); err != nil { return err } } else { @@ -382,18 +671,19 @@ func deepCopy_api_EndpointAddress(in EndpointAddress, out *EndpointAddress, c *c return nil } -func deepCopy_api_EndpointPort(in EndpointPort, out *EndpointPort, c *conversion.Cloner) error { +func DeepCopy_api_EndpointPort(in EndpointPort, out *EndpointPort, c *conversion.Cloner) error { out.Name = in.Name out.Port = in.Port out.Protocol = in.Protocol return nil } -func deepCopy_api_EndpointSubset(in EndpointSubset, out *EndpointSubset, c *conversion.Cloner) error { +func DeepCopy_api_EndpointSubset(in EndpointSubset, out *EndpointSubset, c *conversion.Cloner) error { if in.Addresses != nil { - out.Addresses = make([]EndpointAddress, len(in.Addresses)) - for i := range in.Addresses { - if err := deepCopy_api_EndpointAddress(in.Addresses[i], &out.Addresses[i], c); err != nil { + in, out := in.Addresses, &out.Addresses + *out = make([]EndpointAddress, len(in)) + for i := range in { + if err := DeepCopy_api_EndpointAddress(in[i], &(*out)[i], c); err != nil { return err } } @@ -401,9 +691,10 @@ func deepCopy_api_EndpointSubset(in EndpointSubset, out *EndpointSubset, c *conv out.Addresses = nil } if in.NotReadyAddresses != nil { - out.NotReadyAddresses = make([]EndpointAddress, len(in.NotReadyAddresses)) - for i := range in.NotReadyAddresses { - if err := deepCopy_api_EndpointAddress(in.NotReadyAddresses[i], &out.NotReadyAddresses[i], c); err != nil { + in, out := in.NotReadyAddresses, &out.NotReadyAddresses + *out = make([]EndpointAddress, len(in)) + for i := range in { + if err := DeepCopy_api_EndpointAddress(in[i], &(*out)[i], c); err != nil { return err } } @@ -411,9 +702,10 @@ func deepCopy_api_EndpointSubset(in EndpointSubset, out *EndpointSubset, c *conv out.NotReadyAddresses = nil } if in.Ports != nil { - out.Ports = make([]EndpointPort, len(in.Ports)) - for i := range in.Ports { - if err := deepCopy_api_EndpointPort(in.Ports[i], &out.Ports[i], c); err != nil { + in, out := in.Ports, &out.Ports + *out = make([]EndpointPort, len(in)) + for i := range in { + if err := DeepCopy_api_EndpointPort(in[i], &(*out)[i], c); err != nil { return err } } @@ -423,17 +715,18 @@ func deepCopy_api_EndpointSubset(in EndpointSubset, out *EndpointSubset, c *conv return nil } -func deepCopy_api_Endpoints(in Endpoints, out *Endpoints, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_Endpoints(in Endpoints, out *Endpoints, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } if in.Subsets != nil { - out.Subsets = make([]EndpointSubset, len(in.Subsets)) - for i := range in.Subsets { - if err := deepCopy_api_EndpointSubset(in.Subsets[i], &out.Subsets[i], c); err != nil { + in, out := in.Subsets, &out.Subsets + *out = make([]EndpointSubset, len(in)) + for i := range in { + if err := DeepCopy_api_EndpointSubset(in[i], &(*out)[i], c); err != nil { return err } } @@ -443,17 +736,18 @@ func deepCopy_api_Endpoints(in Endpoints, out *Endpoints, c *conversion.Cloner) return nil } -func deepCopy_api_EndpointsList(in EndpointsList, out *EndpointsList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_EndpointsList(in EndpointsList, out *EndpointsList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]Endpoints, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_Endpoints(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]Endpoints, len(in)) + for i := range in { + if err := DeepCopy_api_Endpoints(in[i], &(*out)[i], c); err != nil { return err } } @@ -463,12 +757,13 @@ func deepCopy_api_EndpointsList(in EndpointsList, out *EndpointsList, c *convers return nil } -func deepCopy_api_EnvVar(in EnvVar, out *EnvVar, c *conversion.Cloner) error { +func DeepCopy_api_EnvVar(in EnvVar, out *EnvVar, c *conversion.Cloner) error { out.Name = in.Name out.Value = in.Value if in.ValueFrom != nil { - out.ValueFrom = new(EnvVarSource) - if err := deepCopy_api_EnvVarSource(*in.ValueFrom, out.ValueFrom, c); err != nil { + in, out := in.ValueFrom, &out.ValueFrom + *out = new(EnvVarSource) + if err := DeepCopy_api_EnvVarSource(*in, *out, c); err != nil { return err } } else { @@ -477,54 +772,79 @@ func deepCopy_api_EnvVar(in EnvVar, out *EnvVar, c *conversion.Cloner) error { return nil } -func deepCopy_api_EnvVarSource(in EnvVarSource, out *EnvVarSource, c *conversion.Cloner) error { +func DeepCopy_api_EnvVarSource(in EnvVarSource, out *EnvVarSource, c *conversion.Cloner) error { if in.FieldRef != nil { - out.FieldRef = new(ObjectFieldSelector) - if err := deepCopy_api_ObjectFieldSelector(*in.FieldRef, out.FieldRef, c); err != nil { + in, out := in.FieldRef, &out.FieldRef + *out = new(ObjectFieldSelector) + if err := DeepCopy_api_ObjectFieldSelector(*in, *out, c); err != nil { return err } } else { out.FieldRef = nil } + if in.ConfigMapKeyRef != nil { + in, out := in.ConfigMapKeyRef, &out.ConfigMapKeyRef + *out = new(ConfigMapKeySelector) + if err := DeepCopy_api_ConfigMapKeySelector(*in, *out, c); err != nil { + return err + } + } else { + out.ConfigMapKeyRef = nil + } + if in.SecretKeyRef != nil { + in, out := in.SecretKeyRef, &out.SecretKeyRef + *out = new(SecretKeySelector) + if err := DeepCopy_api_SecretKeySelector(*in, *out, c); err != nil { + return err + } + } else { + out.SecretKeyRef = nil + } return nil } -func deepCopy_api_Event(in Event, out *Event, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_Event(in Event, out *Event, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectReference(in.InvolvedObject, &out.InvolvedObject, c); err != nil { + if err := DeepCopy_api_ObjectReference(in.InvolvedObject, &out.InvolvedObject, c); err != nil { return err } out.Reason = in.Reason out.Message = in.Message - if err := deepCopy_api_EventSource(in.Source, &out.Source, c); err != nil { + if err := DeepCopy_api_EventSource(in.Source, &out.Source, c); err != nil { return err } - if err := deepCopy_unversioned_Time(in.FirstTimestamp, &out.FirstTimestamp, c); err != nil { + if newVal, err := c.DeepCopy(in.FirstTimestamp); err != nil { return err + } else { + out.FirstTimestamp = newVal.(unversioned.Time) } - if err := deepCopy_unversioned_Time(in.LastTimestamp, &out.LastTimestamp, c); err != nil { + if newVal, err := c.DeepCopy(in.LastTimestamp); err != nil { return err + } else { + out.LastTimestamp = newVal.(unversioned.Time) } out.Count = in.Count + out.Type = in.Type return nil } -func deepCopy_api_EventList(in EventList, out *EventList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_EventList(in EventList, out *EventList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]Event, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_Event(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]Event, len(in)) + for i := range in { + if err := DeepCopy_api_Event(in[i], &(*out)[i], c); err != nil { return err } } @@ -534,36 +854,44 @@ func deepCopy_api_EventList(in EventList, out *EventList, c *conversion.Cloner) return nil } -func deepCopy_api_EventSource(in EventSource, out *EventSource, c *conversion.Cloner) error { +func DeepCopy_api_EventSource(in EventSource, out *EventSource, c *conversion.Cloner) error { out.Component = in.Component out.Host = in.Host return nil } -func deepCopy_api_ExecAction(in ExecAction, out *ExecAction, c *conversion.Cloner) error { +func DeepCopy_api_ExecAction(in ExecAction, out *ExecAction, c *conversion.Cloner) error { if in.Command != nil { - out.Command = make([]string, len(in.Command)) - for i := range in.Command { - out.Command[i] = in.Command[i] - } + in, out := in.Command, &out.Command + *out = make([]string, len(in)) + copy(*out, in) } else { out.Command = nil } return nil } -func deepCopy_api_FCVolumeSource(in FCVolumeSource, out *FCVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_ExportOptions(in ExportOptions, out *ExportOptions, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + out.Export = in.Export + out.Exact = in.Exact + return nil +} + +func DeepCopy_api_FCVolumeSource(in FCVolumeSource, out *FCVolumeSource, c *conversion.Cloner) error { if in.TargetWWNs != nil { - out.TargetWWNs = make([]string, len(in.TargetWWNs)) - for i := range in.TargetWWNs { - out.TargetWWNs[i] = in.TargetWWNs[i] - } + in, out := in.TargetWWNs, &out.TargetWWNs + *out = make([]string, len(in)) + copy(*out, in) } else { out.TargetWWNs = nil } if in.Lun != nil { - out.Lun = new(int) - *out.Lun = *in.Lun + in, out := in.Lun, &out.Lun + *out = new(int) + **out = *in } else { out.Lun = nil } @@ -572,12 +900,37 @@ func deepCopy_api_FCVolumeSource(in FCVolumeSource, out *FCVolumeSource, c *conv return nil } -func deepCopy_api_FlockerVolumeSource(in FlockerVolumeSource, out *FlockerVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_FlexVolumeSource(in FlexVolumeSource, out *FlexVolumeSource, c *conversion.Cloner) error { + out.Driver = in.Driver + out.FSType = in.FSType + if in.SecretRef != nil { + in, out := in.SecretRef, &out.SecretRef + *out = new(LocalObjectReference) + if err := DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil { + return err + } + } else { + out.SecretRef = nil + } + out.ReadOnly = in.ReadOnly + if in.Options != nil { + in, out := in.Options, &out.Options + *out = make(map[string]string) + for key, val := range in { + (*out)[key] = val + } + } else { + out.Options = nil + } + return nil +} + +func DeepCopy_api_FlockerVolumeSource(in FlockerVolumeSource, out *FlockerVolumeSource, c *conversion.Cloner) error { out.DatasetName = in.DatasetName return nil } -func deepCopy_api_GCEPersistentDiskVolumeSource(in GCEPersistentDiskVolumeSource, out *GCEPersistentDiskVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_GCEPersistentDiskVolumeSource(in GCEPersistentDiskVolumeSource, out *GCEPersistentDiskVolumeSource, c *conversion.Cloner) error { out.PDName = in.PDName out.FSType = in.FSType out.Partition = in.Partition @@ -585,49 +938,70 @@ func deepCopy_api_GCEPersistentDiskVolumeSource(in GCEPersistentDiskVolumeSource return nil } -func deepCopy_api_GitRepoVolumeSource(in GitRepoVolumeSource, out *GitRepoVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_GitRepoVolumeSource(in GitRepoVolumeSource, out *GitRepoVolumeSource, c *conversion.Cloner) error { out.Repository = in.Repository out.Revision = in.Revision + out.Directory = in.Directory return nil } -func deepCopy_api_GlusterfsVolumeSource(in GlusterfsVolumeSource, out *GlusterfsVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_GlusterfsVolumeSource(in GlusterfsVolumeSource, out *GlusterfsVolumeSource, c *conversion.Cloner) error { out.EndpointsName = in.EndpointsName out.Path = in.Path out.ReadOnly = in.ReadOnly return nil } -func deepCopy_api_HTTPGetAction(in HTTPGetAction, out *HTTPGetAction, c *conversion.Cloner) error { +func DeepCopy_api_HTTPGetAction(in HTTPGetAction, out *HTTPGetAction, c *conversion.Cloner) error { out.Path = in.Path - if err := deepCopy_util_IntOrString(in.Port, &out.Port, c); err != nil { + if err := DeepCopy_intstr_IntOrString(in.Port, &out.Port, c); err != nil { return err } out.Host = in.Host out.Scheme = in.Scheme + if in.HTTPHeaders != nil { + in, out := in.HTTPHeaders, &out.HTTPHeaders + *out = make([]HTTPHeader, len(in)) + for i := range in { + if err := DeepCopy_api_HTTPHeader(in[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.HTTPHeaders = nil + } return nil } -func deepCopy_api_Handler(in Handler, out *Handler, c *conversion.Cloner) error { +func DeepCopy_api_HTTPHeader(in HTTPHeader, out *HTTPHeader, c *conversion.Cloner) error { + out.Name = in.Name + out.Value = in.Value + return nil +} + +func DeepCopy_api_Handler(in Handler, out *Handler, c *conversion.Cloner) error { if in.Exec != nil { - out.Exec = new(ExecAction) - if err := deepCopy_api_ExecAction(*in.Exec, out.Exec, c); err != nil { + in, out := in.Exec, &out.Exec + *out = new(ExecAction) + if err := DeepCopy_api_ExecAction(*in, *out, c); err != nil { return err } } else { out.Exec = nil } if in.HTTPGet != nil { - out.HTTPGet = new(HTTPGetAction) - if err := deepCopy_api_HTTPGetAction(*in.HTTPGet, out.HTTPGet, c); err != nil { + in, out := in.HTTPGet, &out.HTTPGet + *out = new(HTTPGetAction) + if err := DeepCopy_api_HTTPGetAction(*in, *out, c); err != nil { return err } } else { out.HTTPGet = nil } if in.TCPSocket != nil { - out.TCPSocket = new(TCPSocketAction) - if err := deepCopy_api_TCPSocketAction(*in.TCPSocket, out.TCPSocket, c); err != nil { + in, out := in.TCPSocket, &out.TCPSocket + *out = new(TCPSocketAction) + if err := DeepCopy_api_TCPSocketAction(*in, *out, c); err != nil { return err } } else { @@ -636,32 +1010,41 @@ func deepCopy_api_Handler(in Handler, out *Handler, c *conversion.Cloner) error return nil } -func deepCopy_api_HostPathVolumeSource(in HostPathVolumeSource, out *HostPathVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_HostPathVolumeSource(in HostPathVolumeSource, out *HostPathVolumeSource, c *conversion.Cloner) error { out.Path = in.Path return nil } -func deepCopy_api_ISCSIVolumeSource(in ISCSIVolumeSource, out *ISCSIVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_ISCSIVolumeSource(in ISCSIVolumeSource, out *ISCSIVolumeSource, c *conversion.Cloner) error { out.TargetPortal = in.TargetPortal out.IQN = in.IQN out.Lun = in.Lun + out.ISCSIInterface = in.ISCSIInterface out.FSType = in.FSType out.ReadOnly = in.ReadOnly return nil } -func deepCopy_api_Lifecycle(in Lifecycle, out *Lifecycle, c *conversion.Cloner) error { +func DeepCopy_api_KeyToPath(in KeyToPath, out *KeyToPath, c *conversion.Cloner) error { + out.Key = in.Key + out.Path = in.Path + return nil +} + +func DeepCopy_api_Lifecycle(in Lifecycle, out *Lifecycle, c *conversion.Cloner) error { if in.PostStart != nil { - out.PostStart = new(Handler) - if err := deepCopy_api_Handler(*in.PostStart, out.PostStart, c); err != nil { + in, out := in.PostStart, &out.PostStart + *out = new(Handler) + if err := DeepCopy_api_Handler(*in, *out, c); err != nil { return err } } else { out.PostStart = nil } if in.PreStop != nil { - out.PreStop = new(Handler) - if err := deepCopy_api_Handler(*in.PreStop, out.PreStop, c); err != nil { + in, out := in.PreStop, &out.PreStop + *out = new(Handler) + if err := DeepCopy_api_Handler(*in, *out, c); err != nil { return err } } else { @@ -670,77 +1053,82 @@ func deepCopy_api_Lifecycle(in Lifecycle, out *Lifecycle, c *conversion.Cloner) return nil } -func deepCopy_api_LimitRange(in LimitRange, out *LimitRange, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_LimitRange(in LimitRange, out *LimitRange, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_LimitRangeSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_LimitRangeSpec(in.Spec, &out.Spec, c); err != nil { return err } return nil } -func deepCopy_api_LimitRangeItem(in LimitRangeItem, out *LimitRangeItem, c *conversion.Cloner) error { +func DeepCopy_api_LimitRangeItem(in LimitRangeItem, out *LimitRangeItem, c *conversion.Cloner) error { out.Type = in.Type if in.Max != nil { - out.Max = make(ResourceList) - for key, val := range in.Max { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Max, &out.Max + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Max[key] = *newVal } } else { out.Max = nil } if in.Min != nil { - out.Min = make(ResourceList) - for key, val := range in.Min { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Min, &out.Min + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Min[key] = *newVal } } else { out.Min = nil } if in.Default != nil { - out.Default = make(ResourceList) - for key, val := range in.Default { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Default, &out.Default + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Default[key] = *newVal } } else { out.Default = nil } if in.DefaultRequest != nil { - out.DefaultRequest = make(ResourceList) - for key, val := range in.DefaultRequest { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.DefaultRequest, &out.DefaultRequest + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.DefaultRequest[key] = *newVal } } else { out.DefaultRequest = nil } if in.MaxLimitRequestRatio != nil { - out.MaxLimitRequestRatio = make(ResourceList) - for key, val := range in.MaxLimitRequestRatio { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.MaxLimitRequestRatio, &out.MaxLimitRequestRatio + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.MaxLimitRequestRatio[key] = *newVal } } else { out.MaxLimitRequestRatio = nil @@ -748,17 +1136,18 @@ func deepCopy_api_LimitRangeItem(in LimitRangeItem, out *LimitRangeItem, c *conv return nil } -func deepCopy_api_LimitRangeList(in LimitRangeList, out *LimitRangeList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_LimitRangeList(in LimitRangeList, out *LimitRangeList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]LimitRange, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_LimitRange(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]LimitRange, len(in)) + for i := range in { + if err := DeepCopy_api_LimitRange(in[i], &(*out)[i], c); err != nil { return err } } @@ -768,11 +1157,12 @@ func deepCopy_api_LimitRangeList(in LimitRangeList, out *LimitRangeList, c *conv return nil } -func deepCopy_api_LimitRangeSpec(in LimitRangeSpec, out *LimitRangeSpec, c *conversion.Cloner) error { +func DeepCopy_api_LimitRangeSpec(in LimitRangeSpec, out *LimitRangeSpec, c *conversion.Cloner) error { if in.Limits != nil { - out.Limits = make([]LimitRangeItem, len(in.Limits)) - for i := range in.Limits { - if err := deepCopy_api_LimitRangeItem(in.Limits[i], &out.Limits[i], c); err != nil { + in, out := in.Limits, &out.Limits + *out = make([]LimitRangeItem, len(in)) + for i := range in { + if err := DeepCopy_api_LimitRangeItem(in[i], &(*out)[i], c); err != nil { return err } } @@ -782,22 +1172,21 @@ func deepCopy_api_LimitRangeSpec(in LimitRangeSpec, out *LimitRangeSpec, c *conv return nil } -func deepCopy_api_List(in List, out *List, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_List(in List, out *List, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]runtime.Object, len(in.Items)) - for i := range in.Items { - if newVal, err := c.DeepCopy(in.Items[i]); err != nil { + in, out := in.Items, &out.Items + *out = make([]runtime.Object, len(in)) + for i := range in { + if newVal, err := c.DeepCopy(in[i]); err != nil { return err - } else if newVal == nil { - out.Items[i] = nil } else { - out.Items[i] = newVal.(runtime.Object) + (*out)[i] = newVal.(runtime.Object) } } } else { @@ -806,40 +1195,44 @@ func deepCopy_api_List(in List, out *List, c *conversion.Cloner) error { return nil } -func deepCopy_api_ListOptions(in ListOptions, out *ListOptions, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ListOptions(in ListOptions, out *ListOptions, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } if newVal, err := c.DeepCopy(in.LabelSelector); err != nil { return err - } else if newVal == nil { - out.LabelSelector = nil } else { out.LabelSelector = newVal.(labels.Selector) } if newVal, err := c.DeepCopy(in.FieldSelector); err != nil { return err - } else if newVal == nil { - out.FieldSelector = nil } else { out.FieldSelector = newVal.(fields.Selector) } out.Watch = in.Watch out.ResourceVersion = in.ResourceVersion + if in.TimeoutSeconds != nil { + in, out := in.TimeoutSeconds, &out.TimeoutSeconds + *out = new(int64) + **out = *in + } else { + out.TimeoutSeconds = nil + } return nil } -func deepCopy_api_LoadBalancerIngress(in LoadBalancerIngress, out *LoadBalancerIngress, c *conversion.Cloner) error { +func DeepCopy_api_LoadBalancerIngress(in LoadBalancerIngress, out *LoadBalancerIngress, c *conversion.Cloner) error { out.IP = in.IP out.Hostname = in.Hostname return nil } -func deepCopy_api_LoadBalancerStatus(in LoadBalancerStatus, out *LoadBalancerStatus, c *conversion.Cloner) error { +func DeepCopy_api_LoadBalancerStatus(in LoadBalancerStatus, out *LoadBalancerStatus, c *conversion.Cloner) error { if in.Ingress != nil { - out.Ingress = make([]LoadBalancerIngress, len(in.Ingress)) - for i := range in.Ingress { - if err := deepCopy_api_LoadBalancerIngress(in.Ingress[i], &out.Ingress[i], c); err != nil { + in, out := in.Ingress, &out.Ingress + *out = make([]LoadBalancerIngress, len(in)) + for i := range in { + if err := DeepCopy_api_LoadBalancerIngress(in[i], &(*out)[i], c); err != nil { return err } } @@ -849,45 +1242,46 @@ func deepCopy_api_LoadBalancerStatus(in LoadBalancerStatus, out *LoadBalancerSta return nil } -func deepCopy_api_LocalObjectReference(in LocalObjectReference, out *LocalObjectReference, c *conversion.Cloner) error { +func DeepCopy_api_LocalObjectReference(in LocalObjectReference, out *LocalObjectReference, c *conversion.Cloner) error { out.Name = in.Name return nil } -func deepCopy_api_NFSVolumeSource(in NFSVolumeSource, out *NFSVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_NFSVolumeSource(in NFSVolumeSource, out *NFSVolumeSource, c *conversion.Cloner) error { out.Server = in.Server out.Path = in.Path out.ReadOnly = in.ReadOnly return nil } -func deepCopy_api_Namespace(in Namespace, out *Namespace, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_Namespace(in Namespace, out *Namespace, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_NamespaceSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_NamespaceSpec(in.Spec, &out.Spec, c); err != nil { return err } - if err := deepCopy_api_NamespaceStatus(in.Status, &out.Status, c); err != nil { + if err := DeepCopy_api_NamespaceStatus(in.Status, &out.Status, c); err != nil { return err } return nil } -func deepCopy_api_NamespaceList(in NamespaceList, out *NamespaceList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_NamespaceList(in NamespaceList, out *NamespaceList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]Namespace, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_Namespace(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]Namespace, len(in)) + for i := range in { + if err := DeepCopy_api_Namespace(in[i], &(*out)[i], c); err != nil { return err } } @@ -897,11 +1291,12 @@ func deepCopy_api_NamespaceList(in NamespaceList, out *NamespaceList, c *convers return nil } -func deepCopy_api_NamespaceSpec(in NamespaceSpec, out *NamespaceSpec, c *conversion.Cloner) error { +func DeepCopy_api_NamespaceSpec(in NamespaceSpec, out *NamespaceSpec, c *conversion.Cloner) error { if in.Finalizers != nil { - out.Finalizers = make([]FinalizerName, len(in.Finalizers)) - for i := range in.Finalizers { - out.Finalizers[i] = in.Finalizers[i] + in, out := in.Finalizers, &out.Finalizers + *out = make([]FinalizerName, len(in)) + for i := range in { + (*out)[i] = in[i] } } else { out.Finalizers = nil @@ -909,65 +1304,94 @@ func deepCopy_api_NamespaceSpec(in NamespaceSpec, out *NamespaceSpec, c *convers return nil } -func deepCopy_api_NamespaceStatus(in NamespaceStatus, out *NamespaceStatus, c *conversion.Cloner) error { +func DeepCopy_api_NamespaceStatus(in NamespaceStatus, out *NamespaceStatus, c *conversion.Cloner) error { out.Phase = in.Phase return nil } -func deepCopy_api_Node(in Node, out *Node, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_Node(in Node, out *Node, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_NodeSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_NodeSpec(in.Spec, &out.Spec, c); err != nil { return err } - if err := deepCopy_api_NodeStatus(in.Status, &out.Status, c); err != nil { + if err := DeepCopy_api_NodeStatus(in.Status, &out.Status, c); err != nil { return err } return nil } -func deepCopy_api_NodeAddress(in NodeAddress, out *NodeAddress, c *conversion.Cloner) error { +func DeepCopy_api_NodeAddress(in NodeAddress, out *NodeAddress, c *conversion.Cloner) error { out.Type = in.Type out.Address = in.Address return nil } -func deepCopy_api_NodeCondition(in NodeCondition, out *NodeCondition, c *conversion.Cloner) error { +func DeepCopy_api_NodeAffinity(in NodeAffinity, out *NodeAffinity, c *conversion.Cloner) error { + if in.RequiredDuringSchedulingIgnoredDuringExecution != nil { + in, out := in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution + *out = new(NodeSelector) + if err := DeepCopy_api_NodeSelector(*in, *out, c); err != nil { + return err + } + } else { + out.RequiredDuringSchedulingIgnoredDuringExecution = nil + } + if in.PreferredDuringSchedulingIgnoredDuringExecution != nil { + in, out := in.PreferredDuringSchedulingIgnoredDuringExecution, &out.PreferredDuringSchedulingIgnoredDuringExecution + *out = make([]PreferredSchedulingTerm, len(in)) + for i := range in { + if err := DeepCopy_api_PreferredSchedulingTerm(in[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.PreferredDuringSchedulingIgnoredDuringExecution = nil + } + return nil +} + +func DeepCopy_api_NodeCondition(in NodeCondition, out *NodeCondition, c *conversion.Cloner) error { out.Type = in.Type out.Status = in.Status - if err := deepCopy_unversioned_Time(in.LastHeartbeatTime, &out.LastHeartbeatTime, c); err != nil { + if newVal, err := c.DeepCopy(in.LastHeartbeatTime); err != nil { return err + } else { + out.LastHeartbeatTime = newVal.(unversioned.Time) } - if err := deepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil { + if newVal, err := c.DeepCopy(in.LastTransitionTime); err != nil { return err + } else { + out.LastTransitionTime = newVal.(unversioned.Time) } out.Reason = in.Reason out.Message = in.Message return nil } -func deepCopy_api_NodeDaemonEndpoints(in NodeDaemonEndpoints, out *NodeDaemonEndpoints, c *conversion.Cloner) error { - if err := deepCopy_api_DaemonEndpoint(in.KubeletEndpoint, &out.KubeletEndpoint, c); err != nil { +func DeepCopy_api_NodeDaemonEndpoints(in NodeDaemonEndpoints, out *NodeDaemonEndpoints, c *conversion.Cloner) error { + if err := DeepCopy_api_DaemonEndpoint(in.KubeletEndpoint, &out.KubeletEndpoint, c); err != nil { return err } return nil } -func deepCopy_api_NodeList(in NodeList, out *NodeList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_NodeList(in NodeList, out *NodeList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]Node, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_Node(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]Node, len(in)) + for i := range in { + if err := DeepCopy_api_Node(in[i], &(*out)[i], c); err != nil { return err } } @@ -977,7 +1401,67 @@ func deepCopy_api_NodeList(in NodeList, out *NodeList, c *conversion.Cloner) err return nil } -func deepCopy_api_NodeSpec(in NodeSpec, out *NodeSpec, c *conversion.Cloner) error { +func DeepCopy_api_NodeResources(in NodeResources, out *NodeResources, c *conversion.Cloner) error { + if in.Capacity != nil { + in, out := in.Capacity, &out.Capacity + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { + return err + } else { + (*out)[key] = newVal.(resource.Quantity) + } + } + } else { + out.Capacity = nil + } + return nil +} + +func DeepCopy_api_NodeSelector(in NodeSelector, out *NodeSelector, c *conversion.Cloner) error { + if in.NodeSelectorTerms != nil { + in, out := in.NodeSelectorTerms, &out.NodeSelectorTerms + *out = make([]NodeSelectorTerm, len(in)) + for i := range in { + if err := DeepCopy_api_NodeSelectorTerm(in[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.NodeSelectorTerms = nil + } + return nil +} + +func DeepCopy_api_NodeSelectorRequirement(in NodeSelectorRequirement, out *NodeSelectorRequirement, c *conversion.Cloner) error { + out.Key = in.Key + out.Operator = in.Operator + if in.Values != nil { + in, out := in.Values, &out.Values + *out = make([]string, len(in)) + copy(*out, in) + } else { + out.Values = nil + } + return nil +} + +func DeepCopy_api_NodeSelectorTerm(in NodeSelectorTerm, out *NodeSelectorTerm, c *conversion.Cloner) error { + if in.MatchExpressions != nil { + in, out := in.MatchExpressions, &out.MatchExpressions + *out = make([]NodeSelectorRequirement, len(in)) + for i := range in { + if err := DeepCopy_api_NodeSelectorRequirement(in[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.MatchExpressions = nil + } + return nil +} + +func DeepCopy_api_NodeSpec(in NodeSpec, out *NodeSpec, c *conversion.Cloner) error { out.PodCIDR = in.PodCIDR out.ExternalID = in.ExternalID out.ProviderID = in.ProviderID @@ -985,24 +1469,39 @@ func deepCopy_api_NodeSpec(in NodeSpec, out *NodeSpec, c *conversion.Cloner) err return nil } -func deepCopy_api_NodeStatus(in NodeStatus, out *NodeStatus, c *conversion.Cloner) error { +func DeepCopy_api_NodeStatus(in NodeStatus, out *NodeStatus, c *conversion.Cloner) error { if in.Capacity != nil { - out.Capacity = make(ResourceList) - for key, val := range in.Capacity { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Capacity, &out.Capacity + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Capacity[key] = *newVal } } else { out.Capacity = nil } + if in.Allocatable != nil { + in, out := in.Allocatable, &out.Allocatable + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { + return err + } else { + (*out)[key] = newVal.(resource.Quantity) + } + } + } else { + out.Allocatable = nil + } out.Phase = in.Phase if in.Conditions != nil { - out.Conditions = make([]NodeCondition, len(in.Conditions)) - for i := range in.Conditions { - if err := deepCopy_api_NodeCondition(in.Conditions[i], &out.Conditions[i], c); err != nil { + in, out := in.Conditions, &out.Conditions + *out = make([]NodeCondition, len(in)) + for i := range in { + if err := DeepCopy_api_NodeCondition(in[i], &(*out)[i], c); err != nil { return err } } @@ -1010,43 +1509,55 @@ func deepCopy_api_NodeStatus(in NodeStatus, out *NodeStatus, c *conversion.Clone out.Conditions = nil } if in.Addresses != nil { - out.Addresses = make([]NodeAddress, len(in.Addresses)) - for i := range in.Addresses { - if err := deepCopy_api_NodeAddress(in.Addresses[i], &out.Addresses[i], c); err != nil { + in, out := in.Addresses, &out.Addresses + *out = make([]NodeAddress, len(in)) + for i := range in { + if err := DeepCopy_api_NodeAddress(in[i], &(*out)[i], c); err != nil { return err } } } else { out.Addresses = nil } - if err := deepCopy_api_NodeDaemonEndpoints(in.DaemonEndpoints, &out.DaemonEndpoints, c); err != nil { + if err := DeepCopy_api_NodeDaemonEndpoints(in.DaemonEndpoints, &out.DaemonEndpoints, c); err != nil { return err } - if err := deepCopy_api_NodeSystemInfo(in.NodeInfo, &out.NodeInfo, c); err != nil { + if err := DeepCopy_api_NodeSystemInfo(in.NodeInfo, &out.NodeInfo, c); err != nil { return err } + if in.Images != nil { + in, out := in.Images, &out.Images + *out = make([]ContainerImage, len(in)) + for i := range in { + if err := DeepCopy_api_ContainerImage(in[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.Images = nil + } return nil } -func deepCopy_api_NodeSystemInfo(in NodeSystemInfo, out *NodeSystemInfo, c *conversion.Cloner) error { +func DeepCopy_api_NodeSystemInfo(in NodeSystemInfo, out *NodeSystemInfo, c *conversion.Cloner) error { out.MachineID = in.MachineID out.SystemUUID = in.SystemUUID out.BootID = in.BootID out.KernelVersion = in.KernelVersion - out.OsImage = in.OsImage + out.OSImage = in.OSImage out.ContainerRuntimeVersion = in.ContainerRuntimeVersion out.KubeletVersion = in.KubeletVersion out.KubeProxyVersion = in.KubeProxyVersion return nil } -func deepCopy_api_ObjectFieldSelector(in ObjectFieldSelector, out *ObjectFieldSelector, c *conversion.Cloner) error { +func DeepCopy_api_ObjectFieldSelector(in ObjectFieldSelector, out *ObjectFieldSelector, c *conversion.Cloner) error { out.APIVersion = in.APIVersion out.FieldPath = in.FieldPath return nil } -func deepCopy_api_ObjectMeta(in ObjectMeta, out *ObjectMeta, c *conversion.Cloner) error { +func DeepCopy_api_ObjectMeta(in ObjectMeta, out *ObjectMeta, c *conversion.Cloner) error { out.Name = in.Name out.GenerateName = in.GenerateName out.Namespace = in.Namespace @@ -1054,35 +1565,43 @@ func deepCopy_api_ObjectMeta(in ObjectMeta, out *ObjectMeta, c *conversion.Clone out.UID = in.UID out.ResourceVersion = in.ResourceVersion out.Generation = in.Generation - if err := deepCopy_unversioned_Time(in.CreationTimestamp, &out.CreationTimestamp, c); err != nil { + if newVal, err := c.DeepCopy(in.CreationTimestamp); err != nil { return err + } else { + out.CreationTimestamp = newVal.(unversioned.Time) } if in.DeletionTimestamp != nil { - out.DeletionTimestamp = new(unversioned.Time) - if err := deepCopy_unversioned_Time(*in.DeletionTimestamp, out.DeletionTimestamp, c); err != nil { + in, out := in.DeletionTimestamp, &out.DeletionTimestamp + *out = new(unversioned.Time) + if newVal, err := c.DeepCopy(*in); err != nil { return err + } else { + **out = newVal.(unversioned.Time) } } else { out.DeletionTimestamp = nil } if in.DeletionGracePeriodSeconds != nil { - out.DeletionGracePeriodSeconds = new(int64) - *out.DeletionGracePeriodSeconds = *in.DeletionGracePeriodSeconds + in, out := in.DeletionGracePeriodSeconds, &out.DeletionGracePeriodSeconds + *out = new(int64) + **out = *in } else { out.DeletionGracePeriodSeconds = nil } if in.Labels != nil { - out.Labels = make(map[string]string) - for key, val := range in.Labels { - out.Labels[key] = val + in, out := in.Labels, &out.Labels + *out = make(map[string]string) + for key, val := range in { + (*out)[key] = val } } else { out.Labels = nil } if in.Annotations != nil { - out.Annotations = make(map[string]string) - for key, val := range in.Annotations { - out.Annotations[key] = val + in, out := in.Annotations, &out.Annotations + *out = make(map[string]string) + for key, val := range in { + (*out)[key] = val } } else { out.Annotations = nil @@ -1090,7 +1609,7 @@ func deepCopy_api_ObjectMeta(in ObjectMeta, out *ObjectMeta, c *conversion.Clone return nil } -func deepCopy_api_ObjectReference(in ObjectReference, out *ObjectReference, c *conversion.Cloner) error { +func DeepCopy_api_ObjectReference(in ObjectReference, out *ObjectReference, c *conversion.Cloner) error { out.Kind = in.Kind out.Namespace = in.Namespace out.Name = in.Name @@ -1101,49 +1620,50 @@ func deepCopy_api_ObjectReference(in ObjectReference, out *ObjectReference, c *c return nil } -func deepCopy_api_PersistentVolume(in PersistentVolume, out *PersistentVolume, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PersistentVolume(in PersistentVolume, out *PersistentVolume, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_PersistentVolumeSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_PersistentVolumeSpec(in.Spec, &out.Spec, c); err != nil { return err } - if err := deepCopy_api_PersistentVolumeStatus(in.Status, &out.Status, c); err != nil { + if err := DeepCopy_api_PersistentVolumeStatus(in.Status, &out.Status, c); err != nil { return err } return nil } -func deepCopy_api_PersistentVolumeClaim(in PersistentVolumeClaim, out *PersistentVolumeClaim, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PersistentVolumeClaim(in PersistentVolumeClaim, out *PersistentVolumeClaim, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_PersistentVolumeClaimSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_PersistentVolumeClaimSpec(in.Spec, &out.Spec, c); err != nil { return err } - if err := deepCopy_api_PersistentVolumeClaimStatus(in.Status, &out.Status, c); err != nil { + if err := DeepCopy_api_PersistentVolumeClaimStatus(in.Status, &out.Status, c); err != nil { return err } return nil } -func deepCopy_api_PersistentVolumeClaimList(in PersistentVolumeClaimList, out *PersistentVolumeClaimList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PersistentVolumeClaimList(in PersistentVolumeClaimList, out *PersistentVolumeClaimList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]PersistentVolumeClaim, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_PersistentVolumeClaim(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]PersistentVolumeClaim, len(in)) + for i := range in { + if err := DeepCopy_api_PersistentVolumeClaim(in[i], &(*out)[i], c); err != nil { return err } } @@ -1153,40 +1673,43 @@ func deepCopy_api_PersistentVolumeClaimList(in PersistentVolumeClaimList, out *P return nil } -func deepCopy_api_PersistentVolumeClaimSpec(in PersistentVolumeClaimSpec, out *PersistentVolumeClaimSpec, c *conversion.Cloner) error { +func DeepCopy_api_PersistentVolumeClaimSpec(in PersistentVolumeClaimSpec, out *PersistentVolumeClaimSpec, c *conversion.Cloner) error { if in.AccessModes != nil { - out.AccessModes = make([]PersistentVolumeAccessMode, len(in.AccessModes)) - for i := range in.AccessModes { - out.AccessModes[i] = in.AccessModes[i] + in, out := in.AccessModes, &out.AccessModes + *out = make([]PersistentVolumeAccessMode, len(in)) + for i := range in { + (*out)[i] = in[i] } } else { out.AccessModes = nil } - if err := deepCopy_api_ResourceRequirements(in.Resources, &out.Resources, c); err != nil { + if err := DeepCopy_api_ResourceRequirements(in.Resources, &out.Resources, c); err != nil { return err } out.VolumeName = in.VolumeName return nil } -func deepCopy_api_PersistentVolumeClaimStatus(in PersistentVolumeClaimStatus, out *PersistentVolumeClaimStatus, c *conversion.Cloner) error { +func DeepCopy_api_PersistentVolumeClaimStatus(in PersistentVolumeClaimStatus, out *PersistentVolumeClaimStatus, c *conversion.Cloner) error { out.Phase = in.Phase if in.AccessModes != nil { - out.AccessModes = make([]PersistentVolumeAccessMode, len(in.AccessModes)) - for i := range in.AccessModes { - out.AccessModes[i] = in.AccessModes[i] + in, out := in.AccessModes, &out.AccessModes + *out = make([]PersistentVolumeAccessMode, len(in)) + for i := range in { + (*out)[i] = in[i] } } else { out.AccessModes = nil } if in.Capacity != nil { - out.Capacity = make(ResourceList) - for key, val := range in.Capacity { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Capacity, &out.Capacity + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Capacity[key] = *newVal } } else { out.Capacity = nil @@ -1194,23 +1717,24 @@ func deepCopy_api_PersistentVolumeClaimStatus(in PersistentVolumeClaimStatus, ou return nil } -func deepCopy_api_PersistentVolumeClaimVolumeSource(in PersistentVolumeClaimVolumeSource, out *PersistentVolumeClaimVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_PersistentVolumeClaimVolumeSource(in PersistentVolumeClaimVolumeSource, out *PersistentVolumeClaimVolumeSource, c *conversion.Cloner) error { out.ClaimName = in.ClaimName out.ReadOnly = in.ReadOnly return nil } -func deepCopy_api_PersistentVolumeList(in PersistentVolumeList, out *PersistentVolumeList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PersistentVolumeList(in PersistentVolumeList, out *PersistentVolumeList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]PersistentVolume, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_PersistentVolume(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]PersistentVolume, len(in)) + for i := range in { + if err := DeepCopy_api_PersistentVolume(in[i], &(*out)[i], c); err != nil { return err } } @@ -1220,125 +1744,157 @@ func deepCopy_api_PersistentVolumeList(in PersistentVolumeList, out *PersistentV return nil } -func deepCopy_api_PersistentVolumeSource(in PersistentVolumeSource, out *PersistentVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_PersistentVolumeSource(in PersistentVolumeSource, out *PersistentVolumeSource, c *conversion.Cloner) error { if in.GCEPersistentDisk != nil { - out.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) - if err := deepCopy_api_GCEPersistentDiskVolumeSource(*in.GCEPersistentDisk, out.GCEPersistentDisk, c); err != nil { + in, out := in.GCEPersistentDisk, &out.GCEPersistentDisk + *out = new(GCEPersistentDiskVolumeSource) + if err := DeepCopy_api_GCEPersistentDiskVolumeSource(*in, *out, c); err != nil { return err } } else { out.GCEPersistentDisk = nil } if in.AWSElasticBlockStore != nil { - out.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) - if err := deepCopy_api_AWSElasticBlockStoreVolumeSource(*in.AWSElasticBlockStore, out.AWSElasticBlockStore, c); err != nil { + in, out := in.AWSElasticBlockStore, &out.AWSElasticBlockStore + *out = new(AWSElasticBlockStoreVolumeSource) + if err := DeepCopy_api_AWSElasticBlockStoreVolumeSource(*in, *out, c); err != nil { return err } } else { out.AWSElasticBlockStore = nil } if in.HostPath != nil { - out.HostPath = new(HostPathVolumeSource) - if err := deepCopy_api_HostPathVolumeSource(*in.HostPath, out.HostPath, c); err != nil { + in, out := in.HostPath, &out.HostPath + *out = new(HostPathVolumeSource) + if err := DeepCopy_api_HostPathVolumeSource(*in, *out, c); err != nil { return err } } else { out.HostPath = nil } if in.Glusterfs != nil { - out.Glusterfs = new(GlusterfsVolumeSource) - if err := deepCopy_api_GlusterfsVolumeSource(*in.Glusterfs, out.Glusterfs, c); err != nil { + in, out := in.Glusterfs, &out.Glusterfs + *out = new(GlusterfsVolumeSource) + if err := DeepCopy_api_GlusterfsVolumeSource(*in, *out, c); err != nil { return err } } else { out.Glusterfs = nil } if in.NFS != nil { - out.NFS = new(NFSVolumeSource) - if err := deepCopy_api_NFSVolumeSource(*in.NFS, out.NFS, c); err != nil { + in, out := in.NFS, &out.NFS + *out = new(NFSVolumeSource) + if err := DeepCopy_api_NFSVolumeSource(*in, *out, c); err != nil { return err } } else { out.NFS = nil } if in.RBD != nil { - out.RBD = new(RBDVolumeSource) - if err := deepCopy_api_RBDVolumeSource(*in.RBD, out.RBD, c); err != nil { + in, out := in.RBD, &out.RBD + *out = new(RBDVolumeSource) + if err := DeepCopy_api_RBDVolumeSource(*in, *out, c); err != nil { return err } } else { out.RBD = nil } if in.ISCSI != nil { - out.ISCSI = new(ISCSIVolumeSource) - if err := deepCopy_api_ISCSIVolumeSource(*in.ISCSI, out.ISCSI, c); err != nil { + in, out := in.ISCSI, &out.ISCSI + *out = new(ISCSIVolumeSource) + if err := DeepCopy_api_ISCSIVolumeSource(*in, *out, c); err != nil { return err } } else { out.ISCSI = nil } + if in.FlexVolume != nil { + in, out := in.FlexVolume, &out.FlexVolume + *out = new(FlexVolumeSource) + if err := DeepCopy_api_FlexVolumeSource(*in, *out, c); err != nil { + return err + } + } else { + out.FlexVolume = nil + } if in.Cinder != nil { - out.Cinder = new(CinderVolumeSource) - if err := deepCopy_api_CinderVolumeSource(*in.Cinder, out.Cinder, c); err != nil { + in, out := in.Cinder, &out.Cinder + *out = new(CinderVolumeSource) + if err := DeepCopy_api_CinderVolumeSource(*in, *out, c); err != nil { return err } } else { out.Cinder = nil } if in.CephFS != nil { - out.CephFS = new(CephFSVolumeSource) - if err := deepCopy_api_CephFSVolumeSource(*in.CephFS, out.CephFS, c); err != nil { + in, out := in.CephFS, &out.CephFS + *out = new(CephFSVolumeSource) + if err := DeepCopy_api_CephFSVolumeSource(*in, *out, c); err != nil { return err } } else { out.CephFS = nil } if in.FC != nil { - out.FC = new(FCVolumeSource) - if err := deepCopy_api_FCVolumeSource(*in.FC, out.FC, c); err != nil { + in, out := in.FC, &out.FC + *out = new(FCVolumeSource) + if err := DeepCopy_api_FCVolumeSource(*in, *out, c); err != nil { return err } } else { out.FC = nil } if in.Flocker != nil { - out.Flocker = new(FlockerVolumeSource) - if err := deepCopy_api_FlockerVolumeSource(*in.Flocker, out.Flocker, c); err != nil { + in, out := in.Flocker, &out.Flocker + *out = new(FlockerVolumeSource) + if err := DeepCopy_api_FlockerVolumeSource(*in, *out, c); err != nil { return err } } else { out.Flocker = nil } + if in.AzureFile != nil { + in, out := in.AzureFile, &out.AzureFile + *out = new(AzureFileVolumeSource) + if err := DeepCopy_api_AzureFileVolumeSource(*in, *out, c); err != nil { + return err + } + } else { + out.AzureFile = nil + } return nil } -func deepCopy_api_PersistentVolumeSpec(in PersistentVolumeSpec, out *PersistentVolumeSpec, c *conversion.Cloner) error { +func DeepCopy_api_PersistentVolumeSpec(in PersistentVolumeSpec, out *PersistentVolumeSpec, c *conversion.Cloner) error { if in.Capacity != nil { - out.Capacity = make(ResourceList) - for key, val := range in.Capacity { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Capacity, &out.Capacity + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Capacity[key] = *newVal } } else { out.Capacity = nil } - if err := deepCopy_api_PersistentVolumeSource(in.PersistentVolumeSource, &out.PersistentVolumeSource, c); err != nil { + if err := DeepCopy_api_PersistentVolumeSource(in.PersistentVolumeSource, &out.PersistentVolumeSource, c); err != nil { return err } if in.AccessModes != nil { - out.AccessModes = make([]PersistentVolumeAccessMode, len(in.AccessModes)) - for i := range in.AccessModes { - out.AccessModes[i] = in.AccessModes[i] + in, out := in.AccessModes, &out.AccessModes + *out = make([]PersistentVolumeAccessMode, len(in)) + for i := range in { + (*out)[i] = in[i] } } else { out.AccessModes = nil } if in.ClaimRef != nil { - out.ClaimRef = new(ObjectReference) - if err := deepCopy_api_ObjectReference(*in.ClaimRef, out.ClaimRef, c); err != nil { + in, out := in.ClaimRef, &out.ClaimRef + *out = new(ObjectReference) + if err := DeepCopy_api_ObjectReference(*in, *out, c); err != nil { return err } } else { @@ -1348,31 +1904,31 @@ func deepCopy_api_PersistentVolumeSpec(in PersistentVolumeSpec, out *PersistentV return nil } -func deepCopy_api_PersistentVolumeStatus(in PersistentVolumeStatus, out *PersistentVolumeStatus, c *conversion.Cloner) error { +func DeepCopy_api_PersistentVolumeStatus(in PersistentVolumeStatus, out *PersistentVolumeStatus, c *conversion.Cloner) error { out.Phase = in.Phase out.Message = in.Message out.Reason = in.Reason return nil } -func deepCopy_api_Pod(in Pod, out *Pod, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_Pod(in Pod, out *Pod, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_PodSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_PodSpec(in.Spec, &out.Spec, c); err != nil { return err } - if err := deepCopy_api_PodStatus(in.Status, &out.Status, c); err != nil { + if err := DeepCopy_api_PodStatus(in.Status, &out.Status, c); err != nil { return err } return nil } -func deepCopy_api_PodAttachOptions(in PodAttachOptions, out *PodAttachOptions, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PodAttachOptions(in PodAttachOptions, out *PodAttachOptions, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } out.Stdin = in.Stdin @@ -1383,22 +1939,26 @@ func deepCopy_api_PodAttachOptions(in PodAttachOptions, out *PodAttachOptions, c return nil } -func deepCopy_api_PodCondition(in PodCondition, out *PodCondition, c *conversion.Cloner) error { +func DeepCopy_api_PodCondition(in PodCondition, out *PodCondition, c *conversion.Cloner) error { out.Type = in.Type out.Status = in.Status - if err := deepCopy_unversioned_Time(in.LastProbeTime, &out.LastProbeTime, c); err != nil { + if newVal, err := c.DeepCopy(in.LastProbeTime); err != nil { return err + } else { + out.LastProbeTime = newVal.(unversioned.Time) } - if err := deepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil { + if newVal, err := c.DeepCopy(in.LastTransitionTime); err != nil { return err + } else { + out.LastTransitionTime = newVal.(unversioned.Time) } out.Reason = in.Reason out.Message = in.Message return nil } -func deepCopy_api_PodExecOptions(in PodExecOptions, out *PodExecOptions, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PodExecOptions(in PodExecOptions, out *PodExecOptions, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } out.Stdin = in.Stdin @@ -1407,27 +1967,27 @@ func deepCopy_api_PodExecOptions(in PodExecOptions, out *PodExecOptions, c *conv out.TTY = in.TTY out.Container = in.Container if in.Command != nil { - out.Command = make([]string, len(in.Command)) - for i := range in.Command { - out.Command[i] = in.Command[i] - } + in, out := in.Command, &out.Command + *out = make([]string, len(in)) + copy(*out, in) } else { out.Command = nil } return nil } -func deepCopy_api_PodList(in PodList, out *PodList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PodList(in PodList, out *PodList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]Pod, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_Pod(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]Pod, len(in)) + for i := range in { + if err := DeepCopy_api_Pod(in[i], &(*out)[i], c); err != nil { return err } } @@ -1437,91 +1997,107 @@ func deepCopy_api_PodList(in PodList, out *PodList, c *conversion.Cloner) error return nil } -func deepCopy_api_PodLogOptions(in PodLogOptions, out *PodLogOptions, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PodLogOptions(in PodLogOptions, out *PodLogOptions, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } out.Container = in.Container out.Follow = in.Follow out.Previous = in.Previous if in.SinceSeconds != nil { - out.SinceSeconds = new(int64) - *out.SinceSeconds = *in.SinceSeconds + in, out := in.SinceSeconds, &out.SinceSeconds + *out = new(int64) + **out = *in } else { out.SinceSeconds = nil } if in.SinceTime != nil { - out.SinceTime = new(unversioned.Time) - if err := deepCopy_unversioned_Time(*in.SinceTime, out.SinceTime, c); err != nil { + in, out := in.SinceTime, &out.SinceTime + *out = new(unversioned.Time) + if newVal, err := c.DeepCopy(*in); err != nil { return err + } else { + **out = newVal.(unversioned.Time) } } else { out.SinceTime = nil } out.Timestamps = in.Timestamps if in.TailLines != nil { - out.TailLines = new(int64) - *out.TailLines = *in.TailLines + in, out := in.TailLines, &out.TailLines + *out = new(int64) + **out = *in } else { out.TailLines = nil } if in.LimitBytes != nil { - out.LimitBytes = new(int64) - *out.LimitBytes = *in.LimitBytes + in, out := in.LimitBytes, &out.LimitBytes + *out = new(int64) + **out = *in } else { out.LimitBytes = nil } return nil } -func deepCopy_api_PodProxyOptions(in PodProxyOptions, out *PodProxyOptions, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PodProxyOptions(in PodProxyOptions, out *PodProxyOptions, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } out.Path = in.Path return nil } -func deepCopy_api_PodSecurityContext(in PodSecurityContext, out *PodSecurityContext, c *conversion.Cloner) error { +func DeepCopy_api_PodSecurityContext(in PodSecurityContext, out *PodSecurityContext, c *conversion.Cloner) error { out.HostNetwork = in.HostNetwork out.HostPID = in.HostPID out.HostIPC = in.HostIPC - if in.SupplementalGroups != nil { - out.SupplementalGroups = make([]int64, len(in.SupplementalGroups)) - for i := range in.SupplementalGroups { - out.SupplementalGroups[i] = in.SupplementalGroups[i] - } - } else { - out.SupplementalGroups = nil - } if in.SELinuxOptions != nil { - out.SELinuxOptions = new(SELinuxOptions) - if err := deepCopy_api_SELinuxOptions(*in.SELinuxOptions, out.SELinuxOptions, c); err != nil { + in, out := in.SELinuxOptions, &out.SELinuxOptions + *out = new(SELinuxOptions) + if err := DeepCopy_api_SELinuxOptions(*in, *out, c); err != nil { return err } } else { out.SELinuxOptions = nil } if in.RunAsUser != nil { - out.RunAsUser = new(int64) - *out.RunAsUser = *in.RunAsUser + in, out := in.RunAsUser, &out.RunAsUser + *out = new(int64) + **out = *in } else { out.RunAsUser = nil } if in.RunAsNonRoot != nil { - out.RunAsNonRoot = new(bool) - *out.RunAsNonRoot = *in.RunAsNonRoot + in, out := in.RunAsNonRoot, &out.RunAsNonRoot + *out = new(bool) + **out = *in } else { out.RunAsNonRoot = nil } + if in.SupplementalGroups != nil { + in, out := in.SupplementalGroups, &out.SupplementalGroups + *out = make([]int64, len(in)) + copy(*out, in) + } else { + out.SupplementalGroups = nil + } + if in.FSGroup != nil { + in, out := in.FSGroup, &out.FSGroup + *out = new(int64) + **out = *in + } else { + out.FSGroup = nil + } return nil } -func deepCopy_api_PodSpec(in PodSpec, out *PodSpec, c *conversion.Cloner) error { +func DeepCopy_api_PodSpec(in PodSpec, out *PodSpec, c *conversion.Cloner) error { if in.Volumes != nil { - out.Volumes = make([]Volume, len(in.Volumes)) - for i := range in.Volumes { - if err := deepCopy_api_Volume(in.Volumes[i], &out.Volumes[i], c); err != nil { + in, out := in.Volumes, &out.Volumes + *out = make([]Volume, len(in)) + for i := range in { + if err := DeepCopy_api_Volume(in[i], &(*out)[i], c); err != nil { return err } } @@ -1529,9 +2105,10 @@ func deepCopy_api_PodSpec(in PodSpec, out *PodSpec, c *conversion.Cloner) error out.Volumes = nil } if in.Containers != nil { - out.Containers = make([]Container, len(in.Containers)) - for i := range in.Containers { - if err := deepCopy_api_Container(in.Containers[i], &out.Containers[i], c); err != nil { + in, out := in.Containers, &out.Containers + *out = make([]Container, len(in)) + for i := range in { + if err := DeepCopy_api_Container(in[i], &(*out)[i], c); err != nil { return err } } @@ -1540,22 +2117,25 @@ func deepCopy_api_PodSpec(in PodSpec, out *PodSpec, c *conversion.Cloner) error } out.RestartPolicy = in.RestartPolicy if in.TerminationGracePeriodSeconds != nil { - out.TerminationGracePeriodSeconds = new(int64) - *out.TerminationGracePeriodSeconds = *in.TerminationGracePeriodSeconds + in, out := in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds + *out = new(int64) + **out = *in } else { out.TerminationGracePeriodSeconds = nil } if in.ActiveDeadlineSeconds != nil { - out.ActiveDeadlineSeconds = new(int64) - *out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds + in, out := in.ActiveDeadlineSeconds, &out.ActiveDeadlineSeconds + *out = new(int64) + **out = *in } else { out.ActiveDeadlineSeconds = nil } out.DNSPolicy = in.DNSPolicy if in.NodeSelector != nil { - out.NodeSelector = make(map[string]string) - for key, val := range in.NodeSelector { - out.NodeSelector[key] = val + in, out := in.NodeSelector, &out.NodeSelector + *out = make(map[string]string) + for key, val := range in { + (*out)[key] = val } } else { out.NodeSelector = nil @@ -1563,17 +2143,19 @@ func deepCopy_api_PodSpec(in PodSpec, out *PodSpec, c *conversion.Cloner) error out.ServiceAccountName = in.ServiceAccountName out.NodeName = in.NodeName if in.SecurityContext != nil { - out.SecurityContext = new(PodSecurityContext) - if err := deepCopy_api_PodSecurityContext(*in.SecurityContext, out.SecurityContext, c); err != nil { + in, out := in.SecurityContext, &out.SecurityContext + *out = new(PodSecurityContext) + if err := DeepCopy_api_PodSecurityContext(*in, *out, c); err != nil { return err } } else { out.SecurityContext = nil } if in.ImagePullSecrets != nil { - out.ImagePullSecrets = make([]LocalObjectReference, len(in.ImagePullSecrets)) - for i := range in.ImagePullSecrets { - if err := deepCopy_api_LocalObjectReference(in.ImagePullSecrets[i], &out.ImagePullSecrets[i], c); err != nil { + in, out := in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]LocalObjectReference, len(in)) + for i := range in { + if err := DeepCopy_api_LocalObjectReference(in[i], &(*out)[i], c); err != nil { return err } } @@ -1583,12 +2165,13 @@ func deepCopy_api_PodSpec(in PodSpec, out *PodSpec, c *conversion.Cloner) error return nil } -func deepCopy_api_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner) error { +func DeepCopy_api_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner) error { out.Phase = in.Phase if in.Conditions != nil { - out.Conditions = make([]PodCondition, len(in.Conditions)) - for i := range in.Conditions { - if err := deepCopy_api_PodCondition(in.Conditions[i], &out.Conditions[i], c); err != nil { + in, out := in.Conditions, &out.Conditions + *out = make([]PodCondition, len(in)) + for i := range in { + if err := DeepCopy_api_PodCondition(in[i], &(*out)[i], c); err != nil { return err } } @@ -1600,17 +2183,21 @@ func deepCopy_api_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner) out.HostIP = in.HostIP out.PodIP = in.PodIP if in.StartTime != nil { - out.StartTime = new(unversioned.Time) - if err := deepCopy_unversioned_Time(*in.StartTime, out.StartTime, c); err != nil { + in, out := in.StartTime, &out.StartTime + *out = new(unversioned.Time) + if newVal, err := c.DeepCopy(*in); err != nil { return err + } else { + **out = newVal.(unversioned.Time) } } else { out.StartTime = nil } if in.ContainerStatuses != nil { - out.ContainerStatuses = make([]ContainerStatus, len(in.ContainerStatuses)) - for i := range in.ContainerStatuses { - if err := deepCopy_api_ContainerStatus(in.ContainerStatuses[i], &out.ContainerStatuses[i], c); err != nil { + in, out := in.ContainerStatuses, &out.ContainerStatuses + *out = make([]ContainerStatus, len(in)) + for i := range in { + if err := DeepCopy_api_ContainerStatus(in[i], &(*out)[i], c); err != nil { return err } } @@ -1620,43 +2207,44 @@ func deepCopy_api_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner) return nil } -func deepCopy_api_PodStatusResult(in PodStatusResult, out *PodStatusResult, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PodStatusResult(in PodStatusResult, out *PodStatusResult, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_PodStatus(in.Status, &out.Status, c); err != nil { + if err := DeepCopy_api_PodStatus(in.Status, &out.Status, c); err != nil { return err } return nil } -func deepCopy_api_PodTemplate(in PodTemplate, out *PodTemplate, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PodTemplate(in PodTemplate, out *PodTemplate, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_PodTemplateSpec(in.Template, &out.Template, c); err != nil { + if err := DeepCopy_api_PodTemplateSpec(in.Template, &out.Template, c); err != nil { return err } return nil } -func deepCopy_api_PodTemplateList(in PodTemplateList, out *PodTemplateList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_PodTemplateList(in PodTemplateList, out *PodTemplateList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]PodTemplate, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_PodTemplate(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]PodTemplate, len(in)) + for i := range in { + if err := DeepCopy_api_PodTemplate(in[i], &(*out)[i], c); err != nil { return err } } @@ -1666,31 +2254,41 @@ func deepCopy_api_PodTemplateList(in PodTemplateList, out *PodTemplateList, c *c return nil } -func deepCopy_api_PodTemplateSpec(in PodTemplateSpec, out *PodTemplateSpec, c *conversion.Cloner) error { - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { +func DeepCopy_api_PodTemplateSpec(in PodTemplateSpec, out *PodTemplateSpec, c *conversion.Cloner) error { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_PodSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_PodSpec(in.Spec, &out.Spec, c); err != nil { return err } return nil } -func deepCopy_api_Probe(in Probe, out *Probe, c *conversion.Cloner) error { - if err := deepCopy_api_Handler(in.Handler, &out.Handler, c); err != nil { +func DeepCopy_api_PreferredSchedulingTerm(in PreferredSchedulingTerm, out *PreferredSchedulingTerm, c *conversion.Cloner) error { + out.Weight = in.Weight + if err := DeepCopy_api_NodeSelectorTerm(in.Preference, &out.Preference, c); err != nil { + return err + } + return nil +} + +func DeepCopy_api_Probe(in Probe, out *Probe, c *conversion.Cloner) error { + if err := DeepCopy_api_Handler(in.Handler, &out.Handler, c); err != nil { return err } out.InitialDelaySeconds = in.InitialDelaySeconds out.TimeoutSeconds = in.TimeoutSeconds + out.PeriodSeconds = in.PeriodSeconds + out.SuccessThreshold = in.SuccessThreshold + out.FailureThreshold = in.FailureThreshold return nil } -func deepCopy_api_RBDVolumeSource(in RBDVolumeSource, out *RBDVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_RBDVolumeSource(in RBDVolumeSource, out *RBDVolumeSource, c *conversion.Cloner) error { if in.CephMonitors != nil { - out.CephMonitors = make([]string, len(in.CephMonitors)) - for i := range in.CephMonitors { - out.CephMonitors[i] = in.CephMonitors[i] - } + in, out := in.CephMonitors, &out.CephMonitors + *out = make([]string, len(in)) + copy(*out, in) } else { out.CephMonitors = nil } @@ -1700,8 +2298,9 @@ func deepCopy_api_RBDVolumeSource(in RBDVolumeSource, out *RBDVolumeSource, c *c out.RadosUser = in.RadosUser out.Keyring = in.Keyring if in.SecretRef != nil { - out.SecretRef = new(LocalObjectReference) - if err := deepCopy_api_LocalObjectReference(*in.SecretRef, out.SecretRef, c); err != nil { + in, out := in.SecretRef, &out.SecretRef + *out = new(LocalObjectReference) + if err := DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil { return err } } else { @@ -1711,52 +2310,52 @@ func deepCopy_api_RBDVolumeSource(in RBDVolumeSource, out *RBDVolumeSource, c *c return nil } -func deepCopy_api_RangeAllocation(in RangeAllocation, out *RangeAllocation, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_RangeAllocation(in RangeAllocation, out *RangeAllocation, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } out.Range = in.Range if in.Data != nil { - out.Data = make([]uint8, len(in.Data)) - for i := range in.Data { - out.Data[i] = in.Data[i] - } + in, out := in.Data, &out.Data + *out = make([]byte, len(in)) + copy(*out, in) } else { out.Data = nil } return nil } -func deepCopy_api_ReplicationController(in ReplicationController, out *ReplicationController, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ReplicationController(in ReplicationController, out *ReplicationController, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_ReplicationControllerSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_ReplicationControllerSpec(in.Spec, &out.Spec, c); err != nil { return err } - if err := deepCopy_api_ReplicationControllerStatus(in.Status, &out.Status, c); err != nil { + if err := DeepCopy_api_ReplicationControllerStatus(in.Status, &out.Status, c); err != nil { return err } return nil } -func deepCopy_api_ReplicationControllerList(in ReplicationControllerList, out *ReplicationControllerList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ReplicationControllerList(in ReplicationControllerList, out *ReplicationControllerList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]ReplicationController, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_ReplicationController(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]ReplicationController, len(in)) + for i := range in { + if err := DeepCopy_api_ReplicationController(in[i], &(*out)[i], c); err != nil { return err } } @@ -1766,19 +2365,21 @@ func deepCopy_api_ReplicationControllerList(in ReplicationControllerList, out *R return nil } -func deepCopy_api_ReplicationControllerSpec(in ReplicationControllerSpec, out *ReplicationControllerSpec, c *conversion.Cloner) error { +func DeepCopy_api_ReplicationControllerSpec(in ReplicationControllerSpec, out *ReplicationControllerSpec, c *conversion.Cloner) error { out.Replicas = in.Replicas if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + in, out := in.Selector, &out.Selector + *out = make(map[string]string) + for key, val := range in { + (*out)[key] = val } } else { out.Selector = nil } if in.Template != nil { - out.Template = new(PodTemplateSpec) - if err := deepCopy_api_PodTemplateSpec(*in.Template, out.Template, c); err != nil { + in, out := in.Template, &out.Template + *out = new(PodTemplateSpec) + if err := DeepCopy_api_PodTemplateSpec(*in, *out, c); err != nil { return err } } else { @@ -1787,39 +2388,40 @@ func deepCopy_api_ReplicationControllerSpec(in ReplicationControllerSpec, out *R return nil } -func deepCopy_api_ReplicationControllerStatus(in ReplicationControllerStatus, out *ReplicationControllerStatus, c *conversion.Cloner) error { +func DeepCopy_api_ReplicationControllerStatus(in ReplicationControllerStatus, out *ReplicationControllerStatus, c *conversion.Cloner) error { out.Replicas = in.Replicas out.ObservedGeneration = in.ObservedGeneration return nil } -func deepCopy_api_ResourceQuota(in ResourceQuota, out *ResourceQuota, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ResourceQuota(in ResourceQuota, out *ResourceQuota, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_ResourceQuotaSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_ResourceQuotaSpec(in.Spec, &out.Spec, c); err != nil { return err } - if err := deepCopy_api_ResourceQuotaStatus(in.Status, &out.Status, c); err != nil { + if err := DeepCopy_api_ResourceQuotaStatus(in.Status, &out.Status, c); err != nil { return err } return nil } -func deepCopy_api_ResourceQuotaList(in ResourceQuotaList, out *ResourceQuotaList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ResourceQuotaList(in ResourceQuotaList, out *ResourceQuotaList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]ResourceQuota, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_ResourceQuota(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]ResourceQuota, len(in)) + for i := range in { + if err := DeepCopy_api_ResourceQuota(in[i], &(*out)[i], c); err != nil { return err } } @@ -1829,15 +2431,16 @@ func deepCopy_api_ResourceQuotaList(in ResourceQuotaList, out *ResourceQuotaList return nil } -func deepCopy_api_ResourceQuotaSpec(in ResourceQuotaSpec, out *ResourceQuotaSpec, c *conversion.Cloner) error { +func DeepCopy_api_ResourceQuotaSpec(in ResourceQuotaSpec, out *ResourceQuotaSpec, c *conversion.Cloner) error { if in.Hard != nil { - out.Hard = make(ResourceList) - for key, val := range in.Hard { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Hard, &out.Hard + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Hard[key] = *newVal } } else { out.Hard = nil @@ -1845,27 +2448,29 @@ func deepCopy_api_ResourceQuotaSpec(in ResourceQuotaSpec, out *ResourceQuotaSpec return nil } -func deepCopy_api_ResourceQuotaStatus(in ResourceQuotaStatus, out *ResourceQuotaStatus, c *conversion.Cloner) error { +func DeepCopy_api_ResourceQuotaStatus(in ResourceQuotaStatus, out *ResourceQuotaStatus, c *conversion.Cloner) error { if in.Hard != nil { - out.Hard = make(ResourceList) - for key, val := range in.Hard { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Hard, &out.Hard + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Hard[key] = *newVal } } else { out.Hard = nil } if in.Used != nil { - out.Used = make(ResourceList) - for key, val := range in.Used { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Used, &out.Used + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Used[key] = *newVal } } else { out.Used = nil @@ -1873,27 +2478,29 @@ func deepCopy_api_ResourceQuotaStatus(in ResourceQuotaStatus, out *ResourceQuota return nil } -func deepCopy_api_ResourceRequirements(in ResourceRequirements, out *ResourceRequirements, c *conversion.Cloner) error { +func DeepCopy_api_ResourceRequirements(in ResourceRequirements, out *ResourceRequirements, c *conversion.Cloner) error { if in.Limits != nil { - out.Limits = make(ResourceList) - for key, val := range in.Limits { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Limits, &out.Limits + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Limits[key] = *newVal } } else { out.Limits = nil } if in.Requests != nil { - out.Requests = make(ResourceList) - for key, val := range in.Requests { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + in, out := in.Requests, &out.Requests + *out = make(ResourceList) + for key, val := range in { + if newVal, err := c.DeepCopy(val); err != nil { return err + } else { + (*out)[key] = newVal.(resource.Quantity) } - out.Requests[key] = *newVal } } else { out.Requests = nil @@ -1901,7 +2508,7 @@ func deepCopy_api_ResourceRequirements(in ResourceRequirements, out *ResourceReq return nil } -func deepCopy_api_SELinuxOptions(in SELinuxOptions, out *SELinuxOptions, c *conversion.Cloner) error { +func DeepCopy_api_SELinuxOptions(in SELinuxOptions, out *SELinuxOptions, c *conversion.Cloner) error { out.User = in.User out.Role = in.Role out.Type = in.Type @@ -1909,20 +2516,21 @@ func deepCopy_api_SELinuxOptions(in SELinuxOptions, out *SELinuxOptions, c *conv return nil } -func deepCopy_api_Secret(in Secret, out *Secret, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_Secret(in Secret, out *Secret, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } if in.Data != nil { - out.Data = make(map[string][]uint8) - for key, val := range in.Data { + in, out := in.Data, &out.Data + *out = make(map[string][]byte) + for key, val := range in { if newVal, err := c.DeepCopy(val); err != nil { return err } else { - out.Data[key] = newVal.([]uint8) + (*out)[key] = newVal.([]byte) } } } else { @@ -1932,17 +2540,26 @@ func deepCopy_api_Secret(in Secret, out *Secret, c *conversion.Cloner) error { return nil } -func deepCopy_api_SecretList(in SecretList, out *SecretList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_SecretKeySelector(in SecretKeySelector, out *SecretKeySelector, c *conversion.Cloner) error { + if err := DeepCopy_api_LocalObjectReference(in.LocalObjectReference, &out.LocalObjectReference, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + out.Key = in.Key + return nil +} + +func DeepCopy_api_SecretList(in SecretList, out *SecretList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]Secret, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_Secret(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]Secret, len(in)) + for i := range in { + if err := DeepCopy_api_Secret(in[i], &(*out)[i], c); err != nil { return err } } @@ -1952,86 +2569,99 @@ func deepCopy_api_SecretList(in SecretList, out *SecretList, c *conversion.Clone return nil } -func deepCopy_api_SecretVolumeSource(in SecretVolumeSource, out *SecretVolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_SecretVolumeSource(in SecretVolumeSource, out *SecretVolumeSource, c *conversion.Cloner) error { out.SecretName = in.SecretName return nil } -func deepCopy_api_SecurityContext(in SecurityContext, out *SecurityContext, c *conversion.Cloner) error { +func DeepCopy_api_SecurityContext(in SecurityContext, out *SecurityContext, c *conversion.Cloner) error { if in.Capabilities != nil { - out.Capabilities = new(Capabilities) - if err := deepCopy_api_Capabilities(*in.Capabilities, out.Capabilities, c); err != nil { + in, out := in.Capabilities, &out.Capabilities + *out = new(Capabilities) + if err := DeepCopy_api_Capabilities(*in, *out, c); err != nil { return err } } else { out.Capabilities = nil } if in.Privileged != nil { - out.Privileged = new(bool) - *out.Privileged = *in.Privileged + in, out := in.Privileged, &out.Privileged + *out = new(bool) + **out = *in } else { out.Privileged = nil } if in.SELinuxOptions != nil { - out.SELinuxOptions = new(SELinuxOptions) - if err := deepCopy_api_SELinuxOptions(*in.SELinuxOptions, out.SELinuxOptions, c); err != nil { + in, out := in.SELinuxOptions, &out.SELinuxOptions + *out = new(SELinuxOptions) + if err := DeepCopy_api_SELinuxOptions(*in, *out, c); err != nil { return err } } else { out.SELinuxOptions = nil } if in.RunAsUser != nil { - out.RunAsUser = new(int64) - *out.RunAsUser = *in.RunAsUser + in, out := in.RunAsUser, &out.RunAsUser + *out = new(int64) + **out = *in } else { out.RunAsUser = nil } if in.RunAsNonRoot != nil { - out.RunAsNonRoot = new(bool) - *out.RunAsNonRoot = *in.RunAsNonRoot + in, out := in.RunAsNonRoot, &out.RunAsNonRoot + *out = new(bool) + **out = *in } else { out.RunAsNonRoot = nil } + if in.ReadOnlyRootFilesystem != nil { + in, out := in.ReadOnlyRootFilesystem, &out.ReadOnlyRootFilesystem + *out = new(bool) + **out = *in + } else { + out.ReadOnlyRootFilesystem = nil + } return nil } -func deepCopy_api_SerializedReference(in SerializedReference, out *SerializedReference, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_SerializedReference(in SerializedReference, out *SerializedReference, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectReference(in.Reference, &out.Reference, c); err != nil { + if err := DeepCopy_api_ObjectReference(in.Reference, &out.Reference, c); err != nil { return err } return nil } -func deepCopy_api_Service(in Service, out *Service, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_Service(in Service, out *Service, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } - if err := deepCopy_api_ServiceSpec(in.Spec, &out.Spec, c); err != nil { + if err := DeepCopy_api_ServiceSpec(in.Spec, &out.Spec, c); err != nil { return err } - if err := deepCopy_api_ServiceStatus(in.Status, &out.Status, c); err != nil { + if err := DeepCopy_api_ServiceStatus(in.Status, &out.Status, c); err != nil { return err } return nil } -func deepCopy_api_ServiceAccount(in ServiceAccount, out *ServiceAccount, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ServiceAccount(in ServiceAccount, out *ServiceAccount, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + if err := DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { return err } if in.Secrets != nil { - out.Secrets = make([]ObjectReference, len(in.Secrets)) - for i := range in.Secrets { - if err := deepCopy_api_ObjectReference(in.Secrets[i], &out.Secrets[i], c); err != nil { + in, out := in.Secrets, &out.Secrets + *out = make([]ObjectReference, len(in)) + for i := range in { + if err := DeepCopy_api_ObjectReference(in[i], &(*out)[i], c); err != nil { return err } } @@ -2039,9 +2669,10 @@ func deepCopy_api_ServiceAccount(in ServiceAccount, out *ServiceAccount, c *conv out.Secrets = nil } if in.ImagePullSecrets != nil { - out.ImagePullSecrets = make([]LocalObjectReference, len(in.ImagePullSecrets)) - for i := range in.ImagePullSecrets { - if err := deepCopy_api_LocalObjectReference(in.ImagePullSecrets[i], &out.ImagePullSecrets[i], c); err != nil { + in, out := in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]LocalObjectReference, len(in)) + for i := range in { + if err := DeepCopy_api_LocalObjectReference(in[i], &(*out)[i], c); err != nil { return err } } @@ -2051,17 +2682,18 @@ func deepCopy_api_ServiceAccount(in ServiceAccount, out *ServiceAccount, c *conv return nil } -func deepCopy_api_ServiceAccountList(in ServiceAccountList, out *ServiceAccountList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ServiceAccountList(in ServiceAccountList, out *ServiceAccountList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]ServiceAccount, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_ServiceAccount(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]ServiceAccount, len(in)) + for i := range in { + if err := DeepCopy_api_ServiceAccount(in[i], &(*out)[i], c); err != nil { return err } } @@ -2071,17 +2703,18 @@ func deepCopy_api_ServiceAccountList(in ServiceAccountList, out *ServiceAccountL return nil } -func deepCopy_api_ServiceList(in ServiceList, out *ServiceList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { +func DeepCopy_api_ServiceList(in ServiceList, out *ServiceList, c *conversion.Cloner) error { + if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { return err } if in.Items != nil { - out.Items = make([]Service, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_Service(in.Items[i], &out.Items[i], c); err != nil { + in, out := in.Items, &out.Items + *out = make([]Service, len(in)) + for i := range in { + if err := DeepCopy_api_Service(in[i], &(*out)[i], c); err != nil { return err } } @@ -2091,23 +2724,24 @@ func deepCopy_api_ServiceList(in ServiceList, out *ServiceList, c *conversion.Cl return nil } -func deepCopy_api_ServicePort(in ServicePort, out *ServicePort, c *conversion.Cloner) error { +func DeepCopy_api_ServicePort(in ServicePort, out *ServicePort, c *conversion.Cloner) error { out.Name = in.Name out.Protocol = in.Protocol out.Port = in.Port - if err := deepCopy_util_IntOrString(in.TargetPort, &out.TargetPort, c); err != nil { + if err := DeepCopy_intstr_IntOrString(in.TargetPort, &out.TargetPort, c); err != nil { return err } out.NodePort = in.NodePort return nil } -func deepCopy_api_ServiceSpec(in ServiceSpec, out *ServiceSpec, c *conversion.Cloner) error { +func DeepCopy_api_ServiceSpec(in ServiceSpec, out *ServiceSpec, c *conversion.Cloner) error { out.Type = in.Type if in.Ports != nil { - out.Ports = make([]ServicePort, len(in.Ports)) - for i := range in.Ports { - if err := deepCopy_api_ServicePort(in.Ports[i], &out.Ports[i], c); err != nil { + in, out := in.Ports, &out.Ports + *out = make([]ServicePort, len(in)) + for i := range in { + if err := DeepCopy_api_ServicePort(in[i], &(*out)[i], c); err != nil { return err } } @@ -2115,19 +2749,19 @@ func deepCopy_api_ServiceSpec(in ServiceSpec, out *ServiceSpec, c *conversion.Cl out.Ports = nil } if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + in, out := in.Selector, &out.Selector + *out = make(map[string]string) + for key, val := range in { + (*out)[key] = val } } else { out.Selector = nil } out.ClusterIP = in.ClusterIP if in.ExternalIPs != nil { - out.ExternalIPs = make([]string, len(in.ExternalIPs)) - for i := range in.ExternalIPs { - out.ExternalIPs[i] = in.ExternalIPs[i] - } + in, out := in.ExternalIPs, &out.ExternalIPs + *out = make([]string, len(in)) + copy(*out, in) } else { out.ExternalIPs = nil } @@ -2136,338 +2770,272 @@ func deepCopy_api_ServiceSpec(in ServiceSpec, out *ServiceSpec, c *conversion.Cl return nil } -func deepCopy_api_ServiceStatus(in ServiceStatus, out *ServiceStatus, c *conversion.Cloner) error { - if err := deepCopy_api_LoadBalancerStatus(in.LoadBalancer, &out.LoadBalancer, c); err != nil { +func DeepCopy_api_ServiceStatus(in ServiceStatus, out *ServiceStatus, c *conversion.Cloner) error { + if err := DeepCopy_api_LoadBalancerStatus(in.LoadBalancer, &out.LoadBalancer, c); err != nil { return err } return nil } -func deepCopy_api_TCPSocketAction(in TCPSocketAction, out *TCPSocketAction, c *conversion.Cloner) error { - if err := deepCopy_util_IntOrString(in.Port, &out.Port, c); err != nil { +func DeepCopy_api_TCPSocketAction(in TCPSocketAction, out *TCPSocketAction, c *conversion.Cloner) error { + if err := DeepCopy_intstr_IntOrString(in.Port, &out.Port, c); err != nil { return err } return nil } -func deepCopy_api_Volume(in Volume, out *Volume, c *conversion.Cloner) error { +func DeepCopy_api_Volume(in Volume, out *Volume, c *conversion.Cloner) error { out.Name = in.Name - if err := deepCopy_api_VolumeSource(in.VolumeSource, &out.VolumeSource, c); err != nil { + if err := DeepCopy_api_VolumeSource(in.VolumeSource, &out.VolumeSource, c); err != nil { return err } return nil } -func deepCopy_api_VolumeMount(in VolumeMount, out *VolumeMount, c *conversion.Cloner) error { +func DeepCopy_api_VolumeMount(in VolumeMount, out *VolumeMount, c *conversion.Cloner) error { out.Name = in.Name out.ReadOnly = in.ReadOnly out.MountPath = in.MountPath return nil } -func deepCopy_api_VolumeSource(in VolumeSource, out *VolumeSource, c *conversion.Cloner) error { +func DeepCopy_api_VolumeSource(in VolumeSource, out *VolumeSource, c *conversion.Cloner) error { if in.HostPath != nil { - out.HostPath = new(HostPathVolumeSource) - if err := deepCopy_api_HostPathVolumeSource(*in.HostPath, out.HostPath, c); err != nil { + in, out := in.HostPath, &out.HostPath + *out = new(HostPathVolumeSource) + if err := DeepCopy_api_HostPathVolumeSource(*in, *out, c); err != nil { return err } } else { out.HostPath = nil } if in.EmptyDir != nil { - out.EmptyDir = new(EmptyDirVolumeSource) - if err := deepCopy_api_EmptyDirVolumeSource(*in.EmptyDir, out.EmptyDir, c); err != nil { + in, out := in.EmptyDir, &out.EmptyDir + *out = new(EmptyDirVolumeSource) + if err := DeepCopy_api_EmptyDirVolumeSource(*in, *out, c); err != nil { return err } } else { out.EmptyDir = nil } if in.GCEPersistentDisk != nil { - out.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) - if err := deepCopy_api_GCEPersistentDiskVolumeSource(*in.GCEPersistentDisk, out.GCEPersistentDisk, c); err != nil { + in, out := in.GCEPersistentDisk, &out.GCEPersistentDisk + *out = new(GCEPersistentDiskVolumeSource) + if err := DeepCopy_api_GCEPersistentDiskVolumeSource(*in, *out, c); err != nil { return err } } else { out.GCEPersistentDisk = nil } if in.AWSElasticBlockStore != nil { - out.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) - if err := deepCopy_api_AWSElasticBlockStoreVolumeSource(*in.AWSElasticBlockStore, out.AWSElasticBlockStore, c); err != nil { + in, out := in.AWSElasticBlockStore, &out.AWSElasticBlockStore + *out = new(AWSElasticBlockStoreVolumeSource) + if err := DeepCopy_api_AWSElasticBlockStoreVolumeSource(*in, *out, c); err != nil { return err } } else { out.AWSElasticBlockStore = nil } if in.GitRepo != nil { - out.GitRepo = new(GitRepoVolumeSource) - if err := deepCopy_api_GitRepoVolumeSource(*in.GitRepo, out.GitRepo, c); err != nil { + in, out := in.GitRepo, &out.GitRepo + *out = new(GitRepoVolumeSource) + if err := DeepCopy_api_GitRepoVolumeSource(*in, *out, c); err != nil { return err } } else { out.GitRepo = nil } if in.Secret != nil { - out.Secret = new(SecretVolumeSource) - if err := deepCopy_api_SecretVolumeSource(*in.Secret, out.Secret, c); err != nil { + in, out := in.Secret, &out.Secret + *out = new(SecretVolumeSource) + if err := DeepCopy_api_SecretVolumeSource(*in, *out, c); err != nil { return err } } else { out.Secret = nil } if in.NFS != nil { - out.NFS = new(NFSVolumeSource) - if err := deepCopy_api_NFSVolumeSource(*in.NFS, out.NFS, c); err != nil { + in, out := in.NFS, &out.NFS + *out = new(NFSVolumeSource) + if err := DeepCopy_api_NFSVolumeSource(*in, *out, c); err != nil { return err } } else { out.NFS = nil } if in.ISCSI != nil { - out.ISCSI = new(ISCSIVolumeSource) - if err := deepCopy_api_ISCSIVolumeSource(*in.ISCSI, out.ISCSI, c); err != nil { + in, out := in.ISCSI, &out.ISCSI + *out = new(ISCSIVolumeSource) + if err := DeepCopy_api_ISCSIVolumeSource(*in, *out, c); err != nil { return err } } else { out.ISCSI = nil } if in.Glusterfs != nil { - out.Glusterfs = new(GlusterfsVolumeSource) - if err := deepCopy_api_GlusterfsVolumeSource(*in.Glusterfs, out.Glusterfs, c); err != nil { + in, out := in.Glusterfs, &out.Glusterfs + *out = new(GlusterfsVolumeSource) + if err := DeepCopy_api_GlusterfsVolumeSource(*in, *out, c); err != nil { return err } } else { out.Glusterfs = nil } if in.PersistentVolumeClaim != nil { - out.PersistentVolumeClaim = new(PersistentVolumeClaimVolumeSource) - if err := deepCopy_api_PersistentVolumeClaimVolumeSource(*in.PersistentVolumeClaim, out.PersistentVolumeClaim, c); err != nil { + in, out := in.PersistentVolumeClaim, &out.PersistentVolumeClaim + *out = new(PersistentVolumeClaimVolumeSource) + if err := DeepCopy_api_PersistentVolumeClaimVolumeSource(*in, *out, c); err != nil { return err } } else { out.PersistentVolumeClaim = nil } if in.RBD != nil { - out.RBD = new(RBDVolumeSource) - if err := deepCopy_api_RBDVolumeSource(*in.RBD, out.RBD, c); err != nil { + in, out := in.RBD, &out.RBD + *out = new(RBDVolumeSource) + if err := DeepCopy_api_RBDVolumeSource(*in, *out, c); err != nil { return err } } else { out.RBD = nil } + if in.FlexVolume != nil { + in, out := in.FlexVolume, &out.FlexVolume + *out = new(FlexVolumeSource) + if err := DeepCopy_api_FlexVolumeSource(*in, *out, c); err != nil { + return err + } + } else { + out.FlexVolume = nil + } if in.Cinder != nil { - out.Cinder = new(CinderVolumeSource) - if err := deepCopy_api_CinderVolumeSource(*in.Cinder, out.Cinder, c); err != nil { + in, out := in.Cinder, &out.Cinder + *out = new(CinderVolumeSource) + if err := DeepCopy_api_CinderVolumeSource(*in, *out, c); err != nil { return err } } else { out.Cinder = nil } if in.CephFS != nil { - out.CephFS = new(CephFSVolumeSource) - if err := deepCopy_api_CephFSVolumeSource(*in.CephFS, out.CephFS, c); err != nil { + in, out := in.CephFS, &out.CephFS + *out = new(CephFSVolumeSource) + if err := DeepCopy_api_CephFSVolumeSource(*in, *out, c); err != nil { return err } } else { out.CephFS = nil } if in.Flocker != nil { - out.Flocker = new(FlockerVolumeSource) - if err := deepCopy_api_FlockerVolumeSource(*in.Flocker, out.Flocker, c); err != nil { + in, out := in.Flocker, &out.Flocker + *out = new(FlockerVolumeSource) + if err := DeepCopy_api_FlockerVolumeSource(*in, *out, c); err != nil { return err } } else { out.Flocker = nil } if in.DownwardAPI != nil { - out.DownwardAPI = new(DownwardAPIVolumeSource) - if err := deepCopy_api_DownwardAPIVolumeSource(*in.DownwardAPI, out.DownwardAPI, c); err != nil { + in, out := in.DownwardAPI, &out.DownwardAPI + *out = new(DownwardAPIVolumeSource) + if err := DeepCopy_api_DownwardAPIVolumeSource(*in, *out, c); err != nil { return err } } else { out.DownwardAPI = nil } if in.FC != nil { - out.FC = new(FCVolumeSource) - if err := deepCopy_api_FCVolumeSource(*in.FC, out.FC, c); err != nil { + in, out := in.FC, &out.FC + *out = new(FCVolumeSource) + if err := DeepCopy_api_FCVolumeSource(*in, *out, c); err != nil { return err } } else { out.FC = nil } - return nil -} - -func deepCopy_resource_Quantity(in resource.Quantity, out *resource.Quantity, c *conversion.Cloner) error { - if in.Amount != nil { - if newVal, err := c.DeepCopy(in.Amount); err != nil { + if in.AzureFile != nil { + in, out := in.AzureFile, &out.AzureFile + *out = new(AzureFileVolumeSource) + if err := DeepCopy_api_AzureFileVolumeSource(*in, *out, c); err != nil { return err - } else { - out.Amount = newVal.(*inf.Dec) } } else { - out.Amount = nil + out.AzureFile = nil + } + if in.ConfigMap != nil { + in, out := in.ConfigMap, &out.ConfigMap + *out = new(ConfigMapVolumeSource) + if err := DeepCopy_api_ConfigMapVolumeSource(*in, *out, c); err != nil { + return err + } + } else { + out.ConfigMap = nil } - out.Format = in.Format return nil } -func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.ListMeta, c *conversion.Cloner) error { - out.SelfLink = in.SelfLink - out.ResourceVersion = in.ResourceVersion - return nil -} - -func deepCopy_unversioned_Time(in unversioned.Time, out *unversioned.Time, c *conversion.Cloner) error { - if newVal, err := c.DeepCopy(in.Time); err != nil { +func DeepCopy_conversion_Meta(in conversion.Meta, out *conversion.Meta, c *conversion.Cloner) error { + out.SrcVersion = in.SrcVersion + out.DestVersion = in.DestVersion + if newVal, err := c.DeepCopy(in.KeyNameMapping); err != nil { return err } else { - out.Time = newVal.(time.Time) + out.KeyNameMapping = newVal.(conversion.FieldMappingFunc) } return nil } -func deepCopy_unversioned_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error { - out.Kind = in.Kind - out.APIVersion = in.APIVersion - return nil -} - -func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *conversion.Cloner) error { - out.Kind = in.Kind +func DeepCopy_intstr_IntOrString(in intstr.IntOrString, out *intstr.IntOrString, c *conversion.Cloner) error { + out.Type = in.Type out.IntVal = in.IntVal out.StrVal = in.StrVal return nil } -func init() { - err := Scheme.AddGeneratedDeepCopyFuncs( - deepCopy_api_AWSElasticBlockStoreVolumeSource, - deepCopy_api_Binding, - deepCopy_api_Capabilities, - deepCopy_api_CephFSVolumeSource, - deepCopy_api_CinderVolumeSource, - deepCopy_api_ComponentCondition, - deepCopy_api_ComponentStatus, - deepCopy_api_ComponentStatusList, - deepCopy_api_Container, - deepCopy_api_ContainerPort, - deepCopy_api_ContainerState, - deepCopy_api_ContainerStateRunning, - deepCopy_api_ContainerStateTerminated, - deepCopy_api_ContainerStateWaiting, - deepCopy_api_ContainerStatus, - deepCopy_api_DaemonEndpoint, - deepCopy_api_DeleteOptions, - deepCopy_api_DownwardAPIVolumeFile, - deepCopy_api_DownwardAPIVolumeSource, - deepCopy_api_EmptyDirVolumeSource, - deepCopy_api_EndpointAddress, - deepCopy_api_EndpointPort, - deepCopy_api_EndpointSubset, - deepCopy_api_Endpoints, - deepCopy_api_EndpointsList, - deepCopy_api_EnvVar, - deepCopy_api_EnvVarSource, - deepCopy_api_Event, - deepCopy_api_EventList, - deepCopy_api_EventSource, - deepCopy_api_ExecAction, - deepCopy_api_FCVolumeSource, - deepCopy_api_FlockerVolumeSource, - deepCopy_api_GCEPersistentDiskVolumeSource, - deepCopy_api_GitRepoVolumeSource, - deepCopy_api_GlusterfsVolumeSource, - deepCopy_api_HTTPGetAction, - deepCopy_api_Handler, - deepCopy_api_HostPathVolumeSource, - deepCopy_api_ISCSIVolumeSource, - deepCopy_api_Lifecycle, - deepCopy_api_LimitRange, - deepCopy_api_LimitRangeItem, - deepCopy_api_LimitRangeList, - deepCopy_api_LimitRangeSpec, - deepCopy_api_List, - deepCopy_api_ListOptions, - deepCopy_api_LoadBalancerIngress, - deepCopy_api_LoadBalancerStatus, - deepCopy_api_LocalObjectReference, - deepCopy_api_NFSVolumeSource, - deepCopy_api_Namespace, - deepCopy_api_NamespaceList, - deepCopy_api_NamespaceSpec, - deepCopy_api_NamespaceStatus, - deepCopy_api_Node, - deepCopy_api_NodeAddress, - deepCopy_api_NodeCondition, - deepCopy_api_NodeDaemonEndpoints, - deepCopy_api_NodeList, - deepCopy_api_NodeSpec, - deepCopy_api_NodeStatus, - deepCopy_api_NodeSystemInfo, - deepCopy_api_ObjectFieldSelector, - deepCopy_api_ObjectMeta, - deepCopy_api_ObjectReference, - deepCopy_api_PersistentVolume, - deepCopy_api_PersistentVolumeClaim, - deepCopy_api_PersistentVolumeClaimList, - deepCopy_api_PersistentVolumeClaimSpec, - deepCopy_api_PersistentVolumeClaimStatus, - deepCopy_api_PersistentVolumeClaimVolumeSource, - deepCopy_api_PersistentVolumeList, - deepCopy_api_PersistentVolumeSource, - deepCopy_api_PersistentVolumeSpec, - deepCopy_api_PersistentVolumeStatus, - deepCopy_api_Pod, - deepCopy_api_PodAttachOptions, - deepCopy_api_PodCondition, - deepCopy_api_PodExecOptions, - deepCopy_api_PodList, - deepCopy_api_PodLogOptions, - deepCopy_api_PodProxyOptions, - deepCopy_api_PodSecurityContext, - deepCopy_api_PodSpec, - deepCopy_api_PodStatus, - deepCopy_api_PodStatusResult, - deepCopy_api_PodTemplate, - deepCopy_api_PodTemplateList, - deepCopy_api_PodTemplateSpec, - deepCopy_api_Probe, - deepCopy_api_RBDVolumeSource, - deepCopy_api_RangeAllocation, - deepCopy_api_ReplicationController, - deepCopy_api_ReplicationControllerList, - deepCopy_api_ReplicationControllerSpec, - deepCopy_api_ReplicationControllerStatus, - deepCopy_api_ResourceQuota, - deepCopy_api_ResourceQuotaList, - deepCopy_api_ResourceQuotaSpec, - deepCopy_api_ResourceQuotaStatus, - deepCopy_api_ResourceRequirements, - deepCopy_api_SELinuxOptions, - deepCopy_api_Secret, - deepCopy_api_SecretList, - deepCopy_api_SecretVolumeSource, - deepCopy_api_SecurityContext, - deepCopy_api_SerializedReference, - deepCopy_api_Service, - deepCopy_api_ServiceAccount, - deepCopy_api_ServiceAccountList, - deepCopy_api_ServiceList, - deepCopy_api_ServicePort, - deepCopy_api_ServiceSpec, - deepCopy_api_ServiceStatus, - deepCopy_api_TCPSocketAction, - deepCopy_api_Volume, - deepCopy_api_VolumeMount, - deepCopy_api_VolumeSource, - deepCopy_resource_Quantity, - deepCopy_unversioned_ListMeta, - deepCopy_unversioned_Time, - deepCopy_unversioned_TypeMeta, - deepCopy_util_IntOrString, - ) - if err != nil { - // if one of the deep copy functions is malformed, detect it immediately. - panic(err) - } +func DeepCopy_sets_Empty(in sets.Empty, out *sets.Empty, c *conversion.Cloner) error { + return nil +} + +func DeepCopy_unversioned_GroupKind(in unversioned.GroupKind, out *unversioned.GroupKind, c *conversion.Cloner) error { + out.Group = in.Group + out.Kind = in.Kind + return nil +} + +func DeepCopy_unversioned_GroupResource(in unversioned.GroupResource, out *unversioned.GroupResource, c *conversion.Cloner) error { + out.Group = in.Group + out.Resource = in.Resource + return nil +} + +func DeepCopy_unversioned_GroupVersion(in unversioned.GroupVersion, out *unversioned.GroupVersion, c *conversion.Cloner) error { + out.Group = in.Group + out.Version = in.Version + return nil +} + +func DeepCopy_unversioned_GroupVersionKind(in unversioned.GroupVersionKind, out *unversioned.GroupVersionKind, c *conversion.Cloner) error { + out.Group = in.Group + out.Version = in.Version + out.Kind = in.Kind + return nil +} + +func DeepCopy_unversioned_GroupVersionResource(in unversioned.GroupVersionResource, out *unversioned.GroupVersionResource, c *conversion.Cloner) error { + out.Group = in.Group + out.Version = in.Version + out.Resource = in.Resource + return nil +} + +func DeepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.ListMeta, c *conversion.Cloner) error { + out.SelfLink = in.SelfLink + out.ResourceVersion = in.ResourceVersion + return nil +} + +func DeepCopy_unversioned_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error { + out.Kind = in.Kind + out.APIVersion = in.APIVersion + return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/api/deep_copy_test.go b/vendor/k8s.io/kubernetes/pkg/api/deep_copy_test.go index 606e3ab08..a251623a0 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/deep_copy_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/deep_copy_test.go @@ -21,6 +21,8 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/runtime" ) func BenchmarkPodCopy(b *testing.B) { @@ -29,7 +31,7 @@ func BenchmarkPodCopy(b *testing.B) { b.Fatalf("Unexpected error while reading file: %v", err) } var pod api.Pod - if err := api.Scheme.DecodeInto(data, &pod); err != nil { + if err := runtime.DecodeInto(testapi.Default.Codec(), data, &pod); err != nil { b.Fatalf("Unexpected error decoding pod: %v", err) } @@ -52,7 +54,7 @@ func BenchmarkNodeCopy(b *testing.B) { b.Fatalf("Unexpected error while reading file: %v", err) } var node api.Node - if err := api.Scheme.DecodeInto(data, &node); err != nil { + if err := runtime.DecodeInto(testapi.Default.Codec(), data, &node); err != nil { b.Fatalf("Unexpected error decoding node: %v", err) } @@ -75,7 +77,7 @@ func BenchmarkReplicationControllerCopy(b *testing.B) { b.Fatalf("Unexpected error while reading file: %v", err) } var replicationController api.ReplicationController - if err := api.Scheme.DecodeInto(data, &replicationController); err != nil { + if err := runtime.DecodeInto(testapi.Default.Codec(), data, &replicationController); err != nil { b.Fatalf("Unexpected error decoding node: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/doc.go b/vendor/k8s.io/kubernetes/pkg/api/doc.go index 7cc6359fa..8a54f7acc 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/doc.go +++ b/vendor/k8s.io/kubernetes/pkg/api/doc.go @@ -17,6 +17,6 @@ limitations under the License. // Package api contains the latest (or "internal") version of the // Kubernetes API objects. This is the API objects as represented in memory. // The contract presented to clients is located in the versioned packages, -// which are sub-directories. The first one is "v1beta1". Those packages +// which are sub-directories. The first one is "v1". Those packages // describe how a particular version is serialized to storage/network. package api diff --git a/vendor/k8s.io/kubernetes/pkg/api/endpoints/util.go b/vendor/k8s.io/kubernetes/pkg/api/endpoints/util.go index bf9e0b2d3..91bc57166 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/endpoints/util.go +++ b/vendor/k8s.io/kubernetes/pkg/api/endpoints/util.go @@ -25,7 +25,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/types" - "k8s.io/kubernetes/pkg/util" + hashutil "k8s.io/kubernetes/pkg/util/hash" ) // RepackSubsets takes a slice of EndpointSubset objects, expands it to the full @@ -138,7 +138,7 @@ func hashAddresses(addrs addressSet) string { } sort.Sort(addrsReady(slice)) hasher := md5.New() - util.DeepHashObject(hasher, slice) + hashutil.DeepHashObject(hasher, slice) return hex.EncodeToString(hasher.Sum(nil)[0:]) } @@ -191,7 +191,7 @@ func SortSubsets(subsets []api.EndpointSubset) []api.EndpointSubset { } func hashObject(hasher hash.Hash, obj interface{}) []byte { - util.DeepHashObject(hasher, obj) + hashutil.DeepHashObject(hasher, obj) return hasher.Sum(nil) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/errors/errors.go b/vendor/k8s.io/kubernetes/pkg/api/errors/errors.go index 8f1fdb965..a78b7bc24 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/errors/errors.go +++ b/vendor/k8s.io/kubernetes/pkg/api/errors/errors.go @@ -24,8 +24,7 @@ import ( "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" - utilerrors "k8s.io/kubernetes/pkg/util/errors" - "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/validation/field" ) // HTTP Status codes not in the golang http package. @@ -46,6 +45,12 @@ type StatusError struct { ErrStatus unversioned.Status } +// APIStatus is exposed by errors that can be converted to an api.Status object +// for finer grained details. +type APIStatus interface { + Status() unversioned.Status +} + var _ error = &StatusError{} // Error implements the Error interface. @@ -88,30 +93,32 @@ func FromObject(obj runtime.Object) error { } // NewNotFound returns a new error which indicates that the resource of the kind and the name was not found. -func NewNotFound(kind, name string) error { +func NewNotFound(qualifiedResource unversioned.GroupResource, name string) error { return &StatusError{unversioned.Status{ Status: unversioned.StatusFailure, Code: http.StatusNotFound, Reason: unversioned.StatusReasonNotFound, Details: &unversioned.StatusDetails{ - Kind: kind, - Name: name, + Group: qualifiedResource.Group, + Kind: qualifiedResource.Resource, + Name: name, }, - Message: fmt.Sprintf("%s %q not found", kind, name), + Message: fmt.Sprintf("%s %q not found", qualifiedResource.String(), name), }} } // NewAlreadyExists returns an error indicating the item requested exists by that identifier. -func NewAlreadyExists(kind, name string) error { +func NewAlreadyExists(qualifiedResource unversioned.GroupResource, name string) error { return &StatusError{unversioned.Status{ Status: unversioned.StatusFailure, Code: http.StatusConflict, Reason: unversioned.StatusReasonAlreadyExists, Details: &unversioned.StatusDetails{ - Kind: kind, - Name: name, + Group: qualifiedResource.Group, + Kind: qualifiedResource.Resource, + Name: name, }, - Message: fmt.Sprintf("%s %q already exists", kind, name), + Message: fmt.Sprintf("%s %q already exists", qualifiedResource.String(), name), }} } @@ -131,55 +138,67 @@ func NewUnauthorized(reason string) error { } // NewForbidden returns an error indicating the requested action was forbidden -func NewForbidden(kind, name string, err error) error { +func NewForbidden(qualifiedResource unversioned.GroupResource, name string, err error) error { return &StatusError{unversioned.Status{ Status: unversioned.StatusFailure, Code: http.StatusForbidden, Reason: unversioned.StatusReasonForbidden, Details: &unversioned.StatusDetails{ - Kind: kind, - Name: name, + Group: qualifiedResource.Group, + Kind: qualifiedResource.Resource, + Name: name, }, - Message: fmt.Sprintf("%s %q is forbidden: %v", kind, name, err), + Message: fmt.Sprintf("%s %q is forbidden: %v", qualifiedResource.String(), name, err), }} } // NewConflict returns an error indicating the item can't be updated as provided. -func NewConflict(kind, name string, err error) error { +func NewConflict(qualifiedResource unversioned.GroupResource, name string, err error) error { return &StatusError{unversioned.Status{ Status: unversioned.StatusFailure, Code: http.StatusConflict, Reason: unversioned.StatusReasonConflict, Details: &unversioned.StatusDetails{ - Kind: kind, - Name: name, + Group: qualifiedResource.Group, + Kind: qualifiedResource.Resource, + Name: name, }, - Message: fmt.Sprintf("%s %q cannot be updated: %v", kind, name, err), + Message: fmt.Sprintf("%s %q cannot be updated: %v", qualifiedResource.String(), name, err), + }} +} + +// NewGone returns an error indicating the item no longer available at the server and no forwarding address is known. +func NewGone(message string) error { + return &StatusError{unversioned.Status{ + Status: unversioned.StatusFailure, + Code: http.StatusGone, + Reason: unversioned.StatusReasonGone, + Message: message, }} } // NewInvalid returns an error indicating the item is invalid and cannot be processed. -func NewInvalid(kind, name string, errs fielderrors.ValidationErrorList) error { +func NewInvalid(qualifiedKind unversioned.GroupKind, name string, errs field.ErrorList) error { causes := make([]unversioned.StatusCause, 0, len(errs)) for i := range errs { - if err, ok := errs[i].(*fielderrors.ValidationError); ok { - causes = append(causes, unversioned.StatusCause{ - Type: unversioned.CauseType(err.Type), - Message: err.ErrorBody(), - Field: err.Field, - }) - } + err := errs[i] + causes = append(causes, unversioned.StatusCause{ + Type: unversioned.CauseType(err.Type), + Message: err.ErrorBody(), + Field: err.Field, + }) } return &StatusError{unversioned.Status{ Status: unversioned.StatusFailure, Code: StatusUnprocessableEntity, // RFC 4918: StatusUnprocessableEntity Reason: unversioned.StatusReasonInvalid, Details: &unversioned.StatusDetails{ - Kind: kind, + Group: qualifiedKind.Group, + Kind: qualifiedKind.Kind, Name: name, Causes: causes, }, - Message: fmt.Sprintf("%s %q is invalid: %v", kind, name, utilerrors.NewAggregate(errs)), + Message: fmt.Sprintf("%s %q is invalid: %v", qualifiedKind.String(), name, errs.ToAggregate()), }} } @@ -204,34 +223,42 @@ func NewServiceUnavailable(reason string) error { } // NewMethodNotSupported returns an error indicating the requested action is not supported on this kind. -func NewMethodNotSupported(kind, action string) error { +func NewMethodNotSupported(qualifiedResource unversioned.GroupResource, action string) error { return &StatusError{unversioned.Status{ Status: unversioned.StatusFailure, Code: http.StatusMethodNotAllowed, Reason: unversioned.StatusReasonMethodNotAllowed, Details: &unversioned.StatusDetails{ - Kind: kind, + Group: qualifiedResource.Group, + Kind: qualifiedResource.Resource, }, - Message: fmt.Sprintf("%s is not supported on resources of kind %q", action, kind), + Message: fmt.Sprintf("%s is not supported on resources of kind %q", action, qualifiedResource.String()), }} } // NewServerTimeout returns an error indicating the requested action could not be completed due to a // transient error, and the client should try again. -func NewServerTimeout(kind, operation string, retryAfterSeconds int) error { +func NewServerTimeout(qualifiedResource unversioned.GroupResource, operation string, retryAfterSeconds int) error { return &StatusError{unversioned.Status{ Status: unversioned.StatusFailure, Code: http.StatusInternalServerError, Reason: unversioned.StatusReasonServerTimeout, Details: &unversioned.StatusDetails{ - Kind: kind, + Group: qualifiedResource.Group, + Kind: qualifiedResource.Resource, Name: operation, - RetryAfterSeconds: retryAfterSeconds, + RetryAfterSeconds: int32(retryAfterSeconds), }, - Message: fmt.Sprintf("The %s operation against %s could not be completed at this time, please try again.", operation, kind), + Message: fmt.Sprintf("The %s operation against %s could not be completed at this time, please try again.", operation, qualifiedResource.String()), }} } +// NewServerTimeoutForKind should not exist. Server timeouts happen when accessing resources, the Kind is just what we +// happened to be looking at when the request failed. This delegates to keep code sane, but we should work towards removing this. +func NewServerTimeoutForKind(qualifiedKind unversioned.GroupKind, operation string, retryAfterSeconds int) error { + return NewServerTimeout(unversioned.GroupResource{Group: qualifiedKind.Group, Resource: qualifiedKind.Kind}, operation, retryAfterSeconds) +} + // NewInternalError returns an error indicating the item is invalid and cannot be processed. func NewInternalError(err error) error { return &StatusError{unversioned.Status{ @@ -254,13 +281,13 @@ func NewTimeoutError(message string, retryAfterSeconds int) error { Reason: unversioned.StatusReasonTimeout, Message: fmt.Sprintf("Timeout: %s", message), Details: &unversioned.StatusDetails{ - RetryAfterSeconds: retryAfterSeconds, + RetryAfterSeconds: int32(retryAfterSeconds), }, }} } // NewGenericServerResponse returns a new error for server responses that are not in a recognizable form. -func NewGenericServerResponse(code int, verb, kind, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) error { +func NewGenericServerResponse(code int, verb string, qualifiedResource unversioned.GroupResource, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) error { reason := unversioned.StatusReasonUnknown message := fmt.Sprintf("the server responded with the status code %d but did not return more information", code) switch code { @@ -302,10 +329,10 @@ func NewGenericServerResponse(code int, verb, kind, name, serverMessage string, } } switch { - case len(kind) > 0 && len(name) > 0: - message = fmt.Sprintf("%s (%s %s %s)", message, strings.ToLower(verb), kind, name) - case len(kind) > 0: - message = fmt.Sprintf("%s (%s %s)", message, strings.ToLower(verb), kind) + case !qualifiedResource.IsEmpty() && len(name) > 0: + message = fmt.Sprintf("%s (%s %s %s)", message, strings.ToLower(verb), qualifiedResource.String(), name) + case !qualifiedResource.IsEmpty(): + message = fmt.Sprintf("%s (%s %s)", message, strings.ToLower(verb), qualifiedResource.String()) } var causes []unversioned.StatusCause if isUnexpectedResponse { @@ -320,14 +347,15 @@ func NewGenericServerResponse(code int, verb, kind, name, serverMessage string, } return &StatusError{unversioned.Status{ Status: unversioned.StatusFailure, - Code: code, + Code: int32(code), Reason: reason, Details: &unversioned.StatusDetails{ - Kind: kind, - Name: name, + Group: qualifiedResource.Group, + Kind: qualifiedResource.Resource, + Name: name, Causes: causes, - RetryAfterSeconds: retryAfterSeconds, + RetryAfterSeconds: int32(retryAfterSeconds), }, Message: message, }} @@ -386,7 +414,7 @@ func IsServerTimeout(err error) bool { // and may be the result of another HTTP actor. func IsUnexpectedServerError(err error) bool { switch t := err.(type) { - case *StatusError: + case APIStatus: if d := t.Status().Details; d != nil { for _, cause := range d.Causes { if cause.Type == unversioned.CauseTypeUnexpectedServerResponse { @@ -408,11 +436,11 @@ func IsUnexpectedObjectError(err error) bool { // suggested seconds to wait, or false if the error does not imply a wait. func SuggestsClientDelay(err error) (int, bool) { switch t := err.(type) { - case *StatusError: + case APIStatus: if t.Status().Details != nil { switch t.Status().Reason { case unversioned.StatusReasonServerTimeout, unversioned.StatusReasonTimeout: - return t.Status().Details.RetryAfterSeconds, true + return int(t.Status().Details.RetryAfterSeconds), true } } } @@ -421,8 +449,8 @@ func SuggestsClientDelay(err error) (int, bool) { func reasonForError(err error) unversioned.StatusReason { switch t := err.(type) { - case *StatusError: - return t.ErrStatus.Reason + case APIStatus: + return t.Status().Reason } return unversioned.StatusReasonUnknown } diff --git a/vendor/k8s.io/kubernetes/pkg/api/errors/errors_test.go b/vendor/k8s.io/kubernetes/pkg/api/errors/errors_test.go index 35c6d0801..066bb25f2 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/errors/errors_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/errors/errors_test.go @@ -22,13 +22,14 @@ import ( "reflect" "testing" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/validation/field" ) func TestErrorNew(t *testing.T) { - err := NewAlreadyExists("test", "1") + err := NewAlreadyExists(api.Resource("tests"), "1") if !IsAlreadyExists(err) { t.Errorf("expected to be %s", unversioned.StatusReasonAlreadyExists) } @@ -54,47 +55,47 @@ func TestErrorNew(t *testing.T) { t.Errorf("expected to not be %s", unversioned.StatusReasonMethodNotAllowed) } - if !IsConflict(NewConflict("test", "2", errors.New("message"))) { + if !IsConflict(NewConflict(api.Resource("tests"), "2", errors.New("message"))) { t.Errorf("expected to be conflict") } - if !IsNotFound(NewNotFound("test", "3")) { + if !IsNotFound(NewNotFound(api.Resource("tests"), "3")) { t.Errorf("expected to be %s", unversioned.StatusReasonNotFound) } - if !IsInvalid(NewInvalid("test", "2", nil)) { + if !IsInvalid(NewInvalid(api.Kind("Test"), "2", nil)) { t.Errorf("expected to be %s", unversioned.StatusReasonInvalid) } if !IsBadRequest(NewBadRequest("reason")) { t.Errorf("expected to be %s", unversioned.StatusReasonBadRequest) } - if !IsForbidden(NewForbidden("test", "2", errors.New("reason"))) { + if !IsForbidden(NewForbidden(api.Resource("tests"), "2", errors.New("reason"))) { t.Errorf("expected to be %s", unversioned.StatusReasonForbidden) } if !IsUnauthorized(NewUnauthorized("reason")) { t.Errorf("expected to be %s", unversioned.StatusReasonUnauthorized) } - if !IsServerTimeout(NewServerTimeout("test", "reason", 0)) { + if !IsServerTimeout(NewServerTimeout(api.Resource("tests"), "reason", 0)) { t.Errorf("expected to be %s", unversioned.StatusReasonServerTimeout) } - if time, ok := SuggestsClientDelay(NewServerTimeout("test", "doing something", 10)); time != 10 || !ok { + if time, ok := SuggestsClientDelay(NewServerTimeout(api.Resource("tests"), "doing something", 10)); time != 10 || !ok { t.Errorf("expected to be %s", unversioned.StatusReasonServerTimeout) } if time, ok := SuggestsClientDelay(NewTimeoutError("test reason", 10)); time != 10 || !ok { t.Errorf("expected to be %s", unversioned.StatusReasonTimeout) } - if !IsMethodNotSupported(NewMethodNotSupported("foo", "delete")) { + if !IsMethodNotSupported(NewMethodNotSupported(api.Resource("foos"), "delete")) { t.Errorf("expected to be %s", unversioned.StatusReasonMethodNotAllowed) } } func TestNewInvalid(t *testing.T) { testCases := []struct { - Err *fielderrors.ValidationError + Err *field.Error Details *unversioned.StatusDetails }{ { - fielderrors.NewFieldDuplicate("field[0].name", "bar"), + field.Duplicate(field.NewPath("field[0].name"), "bar"), &unversioned.StatusDetails{ - Kind: "kind", + Kind: "Kind", Name: "name", Causes: []unversioned.StatusCause{{ Type: unversioned.CauseTypeFieldValueDuplicate, @@ -103,9 +104,9 @@ func TestNewInvalid(t *testing.T) { }, }, { - fielderrors.NewFieldInvalid("field[0].name", "bar", "detail"), + field.Invalid(field.NewPath("field[0].name"), "bar", "detail"), &unversioned.StatusDetails{ - Kind: "kind", + Kind: "Kind", Name: "name", Causes: []unversioned.StatusCause{{ Type: unversioned.CauseTypeFieldValueInvalid, @@ -114,9 +115,9 @@ func TestNewInvalid(t *testing.T) { }, }, { - fielderrors.NewFieldNotFound("field[0].name", "bar"), + field.NotFound(field.NewPath("field[0].name"), "bar"), &unversioned.StatusDetails{ - Kind: "kind", + Kind: "Kind", Name: "name", Causes: []unversioned.StatusCause{{ Type: unversioned.CauseTypeFieldValueNotFound, @@ -125,9 +126,9 @@ func TestNewInvalid(t *testing.T) { }, }, { - fielderrors.NewFieldValueNotSupported("field[0].name", "bar", nil), + field.NotSupported(field.NewPath("field[0].name"), "bar", nil), &unversioned.StatusDetails{ - Kind: "kind", + Kind: "Kind", Name: "name", Causes: []unversioned.StatusCause{{ Type: unversioned.CauseTypeFieldValueNotSupported, @@ -136,9 +137,9 @@ func TestNewInvalid(t *testing.T) { }, }, { - fielderrors.NewFieldRequired("field[0].name"), + field.Required(field.NewPath("field[0].name"), ""), &unversioned.StatusDetails{ - Kind: "kind", + Kind: "Kind", Name: "name", Causes: []unversioned.StatusCause{{ Type: unversioned.CauseTypeFieldValueRequired, @@ -150,7 +151,7 @@ func TestNewInvalid(t *testing.T) { for i, testCase := range testCases { vErr, expected := testCase.Err, testCase.Details expected.Causes[0].Message = vErr.ErrorBody() - err := NewInvalid("kind", "name", fielderrors.ValidationErrorList{vErr}) + err := NewInvalid(api.Kind("Kind"), "name", field.ErrorList{vErr}) status := err.(*StatusError).ErrStatus if status.Code != 422 || status.Reason != unversioned.StatusReasonInvalid { t.Errorf("%d: unexpected status: %#v", i, status) @@ -169,7 +170,7 @@ func Test_reasonForError(t *testing.T) { type TestType struct{} -func (*TestType) IsAnAPIObject() {} +func (obj *TestType) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } func TestFromObject(t *testing.T) { table := []struct { diff --git a/vendor/k8s.io/kubernetes/pkg/api/errors/etcd/etcd.go b/vendor/k8s.io/kubernetes/pkg/api/errors/etcd/etcd.go index f3dcff02c..3e09aebaa 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/errors/etcd/etcd.go +++ b/vendor/k8s.io/kubernetes/pkg/api/errors/etcd/etcd.go @@ -18,48 +18,70 @@ package etcd import ( "k8s.io/kubernetes/pkg/api/errors" - etcdstorage "k8s.io/kubernetes/pkg/storage/etcd" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/storage" ) -// InterpretGetError converts a generic etcd error on a retrieval +// InterpretListError converts a generic error on a retrieval // operation into the appropriate API error. -func InterpretGetError(err error, kind, name string) error { +func InterpretListError(err error, qualifiedResource unversioned.GroupResource) error { switch { - case etcdstorage.IsEtcdNotFound(err): - return errors.NewNotFound(kind, name) + case storage.IsNotFound(err): + return errors.NewNotFound(qualifiedResource, "") + case storage.IsUnreachable(err): + return errors.NewServerTimeout(qualifiedResource, "list", 2) // TODO: make configurable or handled at a higher level default: return err } } -// InterpretCreateError converts a generic etcd error on a create +// InterpretGetError converts a generic error on a retrieval // operation into the appropriate API error. -func InterpretCreateError(err error, kind, name string) error { +func InterpretGetError(err error, qualifiedResource unversioned.GroupResource, name string) error { switch { - case etcdstorage.IsEtcdNodeExist(err): - return errors.NewAlreadyExists(kind, name) + case storage.IsNotFound(err): + return errors.NewNotFound(qualifiedResource, name) + case storage.IsUnreachable(err): + return errors.NewServerTimeout(qualifiedResource, "get", 2) // TODO: make configurable or handled at a higher level default: return err } } -// InterpretUpdateError converts a generic etcd error on a update +// InterpretCreateError converts a generic error on a create // operation into the appropriate API error. -func InterpretUpdateError(err error, kind, name string) error { +func InterpretCreateError(err error, qualifiedResource unversioned.GroupResource, name string) error { switch { - case etcdstorage.IsEtcdTestFailed(err), etcdstorage.IsEtcdNodeExist(err): - return errors.NewConflict(kind, name, err) + case storage.IsNodeExist(err): + return errors.NewAlreadyExists(qualifiedResource, name) + case storage.IsUnreachable(err): + return errors.NewServerTimeout(qualifiedResource, "create", 2) // TODO: make configurable or handled at a higher level default: return err } } -// InterpretDeleteError converts a generic etcd error on a delete +// InterpretUpdateError converts a generic error on a update // operation into the appropriate API error. -func InterpretDeleteError(err error, kind, name string) error { +func InterpretUpdateError(err error, qualifiedResource unversioned.GroupResource, name string) error { switch { - case etcdstorage.IsEtcdNotFound(err): - return errors.NewNotFound(kind, name) + case storage.IsTestFailed(err), storage.IsNodeExist(err): + return errors.NewConflict(qualifiedResource, name, err) + case storage.IsUnreachable(err): + return errors.NewServerTimeout(qualifiedResource, "update", 2) // TODO: make configurable or handled at a higher level + default: + return err + } +} + +// InterpretDeleteError converts a generic error on a delete +// operation into the appropriate API error. +func InterpretDeleteError(err error, qualifiedResource unversioned.GroupResource, name string) error { + switch { + case storage.IsNotFound(err): + return errors.NewNotFound(qualifiedResource, name) + case storage.IsUnreachable(err): + return errors.NewServerTimeout(qualifiedResource, "delete", 2) // TODO: make configurable or handled at a higher level default: return err } diff --git a/vendor/k8s.io/kubernetes/pkg/api/helpers.go b/vendor/k8s.io/kubernetes/pkg/api/helpers.go index 8248899d5..b373b9eee 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/helpers.go +++ b/vendor/k8s.io/kubernetes/pkg/api/helpers.go @@ -18,6 +18,7 @@ package api import ( "crypto/md5" + "encoding/json" "fmt" "reflect" "strings" @@ -53,8 +54,7 @@ func (c *ConversionError) Error() string { var Semantic = conversion.EqualitiesOrDie( func(a, b resource.Quantity) bool { // Ignore formatting, only care that numeric value stayed the same. - // TODO: if we decide it's important, after we drop v1beta1/2, we - // could start comparing format. + // TODO: if we decide it's important, it should be safe to start comparing the format. // // Uninitialized quantities are equivalent to 0 quantities. if a.Amount == nil && b.MilliValue() == 0 { @@ -154,7 +154,7 @@ func AddToNodeAddresses(addresses *[]NodeAddress, addAddresses ...NodeAddress) { } func HashObject(obj runtime.Object, codec runtime.Codec) (string, error) { - data, err := codec.Encode(obj) + data, err := runtime.Encode(codec, obj) if err != nil { return "", err } @@ -264,3 +264,54 @@ func ParseRFC3339(s string, nowFn func() unversioned.Time) (unversioned.Time, er } return unversioned.Time{t}, nil } + +// NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement api type into a struct that implements +// labels.Selector. +func NodeSelectorRequirementsAsSelector(nsm []NodeSelectorRequirement) (labels.Selector, error) { + if len(nsm) == 0 { + return labels.Nothing(), nil + } + selector := labels.NewSelector() + for _, expr := range nsm { + var op labels.Operator + switch expr.Operator { + case NodeSelectorOpIn: + op = labels.InOperator + case NodeSelectorOpNotIn: + op = labels.NotInOperator + case NodeSelectorOpExists: + op = labels.ExistsOperator + case NodeSelectorOpDoesNotExist: + op = labels.DoesNotExistOperator + case NodeSelectorOpGt: + op = labels.GreaterThanOperator + case NodeSelectorOpLt: + op = labels.LessThanOperator + default: + return nil, fmt.Errorf("%q is not a valid node selector operator", expr.Operator) + } + r, err := labels.NewRequirement(expr.Key, op, sets.NewString(expr.Values...)) + if err != nil { + return nil, err + } + selector = selector.Add(*r) + } + return selector, nil +} + +// AffinityAnnotationKey represents the key of affinity data (json serialized) +// in the Annotations of a Pod. +const AffinityAnnotationKey string = "scheduler.alpha.kubernetes.io/affinity" + +// GetAffinityFromPod gets the json serialized affinity data from Pod.Annotations +// and converts it to the Affinity type in api. +func GetAffinityFromPodAnnotations(annotations map[string]string) (Affinity, error) { + var affinity Affinity + if len(annotations) > 0 && annotations[AffinityAnnotationKey] != "" { + err := json.Unmarshal([]byte(annotations[AffinityAnnotationKey]), &affinity) + if err != nil { + return affinity, err + } + } + return affinity, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/helpers_test.go b/vendor/k8s.io/kubernetes/pkg/api/helpers_test.go index 6cbe47269..2d6bd488f 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/helpers_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/helpers_test.go @@ -17,10 +17,12 @@ limitations under the License. package api import ( + "reflect" "strings" "testing" "k8s.io/kubernetes/pkg/api/resource" + "k8s.io/kubernetes/pkg/labels" "speter.net/go/exp/math/dec/inf" ) @@ -175,3 +177,123 @@ func TestRemoveDuplicateAccessModes(t *testing.T) { t.Errorf("Expected 2 distinct modes in set but found %v", len(modes)) } } + +func TestNodeSelectorRequirementsAsSelector(t *testing.T) { + matchExpressions := []NodeSelectorRequirement{{ + Key: "foo", + Operator: NodeSelectorOpIn, + Values: []string{"bar", "baz"}, + }} + mustParse := func(s string) labels.Selector { + out, e := labels.Parse(s) + if e != nil { + panic(e) + } + return out + } + tc := []struct { + in []NodeSelectorRequirement + out labels.Selector + expectErr bool + }{ + {in: nil, out: labels.Nothing()}, + {in: []NodeSelectorRequirement{}, out: labels.Nothing()}, + { + in: matchExpressions, + out: mustParse("foo in (baz,bar)"), + }, + { + in: []NodeSelectorRequirement{{ + Key: "foo", + Operator: NodeSelectorOpExists, + Values: []string{"bar", "baz"}, + }}, + expectErr: true, + }, + { + in: []NodeSelectorRequirement{{ + Key: "foo", + Operator: NodeSelectorOpGt, + Values: []string{"1.1"}, + }}, + out: mustParse("foo>1.1"), + }, + { + in: []NodeSelectorRequirement{{ + Key: "bar", + Operator: NodeSelectorOpLt, + Values: []string{"7.1"}, + }}, + out: mustParse("bar<7.1"), + }, + } + + for i, tc := range tc { + out, err := NodeSelectorRequirementsAsSelector(tc.in) + if err == nil && tc.expectErr { + t.Errorf("[%v]expected error but got none.", i) + } + if err != nil && !tc.expectErr { + t.Errorf("[%v]did not expect error but got: %v", i, err) + } + if !reflect.DeepEqual(out, tc.out) { + t.Errorf("[%v]expected:\n\t%+v\nbut got:\n\t%+v", i, tc.out, out) + } + } +} + +func TestGetAffinityFromPod(t *testing.T) { + testCases := []struct { + pod *Pod + expectErr bool + }{ + { + pod: &Pod{}, + expectErr: false, + }, + { + pod: &Pod{ + ObjectMeta: ObjectMeta{ + Annotations: map[string]string{ + AffinityAnnotationKey: ` + {"nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [{ + "matchExpressions": [{ + "key": "foo", + "operator": "In", + "values": ["value1", "value2"] + }] + }] + }}}`, + }, + }, + }, + expectErr: false, + }, + { + pod: &Pod{ + ObjectMeta: ObjectMeta{ + Annotations: map[string]string{ + AffinityAnnotationKey: ` + {"nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [{ + "matchExpressions": [{ + "key": "foo", + `, + }, + }, + }, + expectErr: true, + }, + } + + for i, tc := range testCases { + _, err := GetAffinityFromPodAnnotations(tc.pod.Annotations) + if err == nil && tc.expectErr { + t.Errorf("[%v]expected error but got none.", i) + } + if err != nil && !tc.expectErr { + t.Errorf("[%v]did not expect error but got: %v", i, err) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/install/install.go b/vendor/k8s.io/kubernetes/pkg/api/install/install.go index 49b684076..14cf55519 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/install/install.go +++ b/vendor/k8s.io/kubernetes/pkg/api/install/install.go @@ -20,54 +20,76 @@ package install import ( "fmt" - "strings" "github.com/golang/glog" - "k8s.io/kubernetes/pkg/api/latest" - "k8s.io/kubernetes/pkg/util/sets" - "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" - "k8s.io/kubernetes/pkg/api/registered" - apiutil "k8s.io/kubernetes/pkg/api/util" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/apimachinery" + "k8s.io/kubernetes/pkg/apimachinery/registered" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/sets" ) -// userResources is a group of resources mostly used by a kubectl user -var userResources = []string{"rc", "svc", "pods", "pvc"} - const importPrefix = "k8s.io/kubernetes/pkg/api" var accessor = meta.NewAccessor() +// availableVersions lists all known external versions for this group from most preferred to least preferred +var availableVersions = []unversioned.GroupVersion{v1.SchemeGroupVersion} + func init() { - groupMeta, err := latest.RegisterGroup("") - if err != nil { + registered.RegisterVersions(availableVersions) + externalVersions := []unversioned.GroupVersion{} + for _, v := range availableVersions { + if registered.IsAllowedVersion(v) { + externalVersions = append(externalVersions, v) + } + } + if len(externalVersions) == 0 { + glog.V(4).Infof("No version is registered for group %v", api.GroupName) + return + } + + if err := registered.EnableVersions(externalVersions...); err != nil { glog.V(4).Infof("%v", err) return } - // Use the first API version in the list of registered versions as the latest. - registeredGroupVersions := registered.GroupVersionsForGroup("") - groupVersion := registeredGroupVersions[0] - *groupMeta = latest.GroupMeta{ - GroupVersion: groupVersion, - Group: apiutil.GetGroup(groupVersion), - Version: apiutil.GetVersion(groupVersion), - Codec: runtime.CodecFor(api.Scheme, groupVersion), + if err := enableVersions(externalVersions); err != nil { + glog.V(4).Infof("%v", err) + return } - var versions []string - var groupVersions []string - for i := len(registeredGroupVersions) - 1; i >= 0; i-- { - versions = append(versions, apiutil.GetVersion(registeredGroupVersions[i])) - groupVersions = append(groupVersions, registeredGroupVersions[i]) +} + +// TODO: enableVersions should be centralized rather than spread in each API +// group. +// We can combine registered.RegisterVersions, registered.EnableVersions and +// registered.RegisterGroup once we have moved enableVersions there. +func enableVersions(externalVersions []unversioned.GroupVersion) error { + addVersionsToScheme(externalVersions...) + preferredExternalVersion := externalVersions[0] + + groupMeta := apimachinery.GroupMeta{ + GroupVersion: preferredExternalVersion, + GroupVersions: externalVersions, + RESTMapper: newRESTMapper(externalVersions), + SelfLinker: runtime.SelfLinker(accessor), + InterfacesFor: interfacesFor, } - groupMeta.Versions = versions - groupMeta.GroupVersions = groupVersions - groupMeta.SelfLinker = runtime.SelfLinker(accessor) + if err := registered.RegisterGroup(groupMeta); err != nil { + return err + } + api.RegisterRESTMapper(groupMeta.RESTMapper) + return nil +} +// userResources is a group of resources mostly used by a kubectl user +var userResources = []string{"rc", "svc", "pods", "pvc"} + +func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { // the list of kinds that are scoped at the root of the api hierarchy // if a kind is not enumerated here, it is assumed to have a namespace scope rootScoped := sets.NewString( @@ -90,28 +112,40 @@ func init() { "ThirdPartyResourceData", "ThirdPartyResourceList") - mapper := api.NewDefaultRESTMapper("", versions, interfacesFor, importPrefix, ignoredKinds, rootScoped) + mapper := api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) // setup aliases for groups of resources mapper.AddResourceAlias("all", userResources...) - groupMeta.RESTMapper = mapper - api.RegisterRESTMapper(groupMeta.RESTMapper) - groupMeta.InterfacesFor = interfacesFor + + return mapper } // InterfacesFor returns the default Codec and ResourceVersioner for a given version // string, or an error if the version is not known. -func interfacesFor(version string) (*meta.VersionInterfaces, error) { +func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { switch version { - case "v1": + case v1.SchemeGroupVersion: return &meta.VersionInterfaces{ - Codec: v1.Codec, ObjectConvertor: api.Scheme, MetadataAccessor: accessor, }, nil default: - { - g, _ := latest.Group("") - return nil, fmt.Errorf("unsupported storage version: %s (valid: %s)", version, strings.Join(g.Versions, ", ")) + g, _ := registered.Group(api.GroupName) + return nil, fmt.Errorf("unsupported storage version: %s (valid: %v)", version, g.GroupVersions) + } +} + +func addVersionsToScheme(externalVersions ...unversioned.GroupVersion) { + // add the internal version to Scheme + api.AddToScheme(api.Scheme) + // add the enabled external versions to Scheme + for _, v := range externalVersions { + if !registered.IsEnabledVersion(v) { + glog.Errorf("Version %s is not enabled, so it will not be added to the Scheme.", v) + continue + } + switch v { + case v1.SchemeGroupVersion: + v1.AddToScheme(api.Scheme) } } } diff --git a/vendor/k8s.io/kubernetes/pkg/api/install/install_test.go b/vendor/k8s.io/kubernetes/pkg/api/install/install_test.go index 3bfc7f589..0b1615350 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/install/install_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/install/install_test.go @@ -18,11 +18,13 @@ package install import ( "encoding/json" + "reflect" "testing" internal "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/latest" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/runtime" ) func TestResourceVersioner(t *testing.T) { @@ -47,9 +49,9 @@ func TestResourceVersioner(t *testing.T) { func TestCodec(t *testing.T) { pod := internal.Pod{} - // We do want to use package latest rather than testapi here, because we - // want to test if the package install and package latest work as expected. - data, err := latest.GroupOrDie("").Codec.Encode(&pod) + // We do want to use package registered rather than testapi here, because we + // want to test if the package install and package registered work as expected. + data, err := runtime.Encode(internal.Codecs.LegacyCodec(registered.GroupOrDie(internal.GroupName).GroupVersion), &pod) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -57,33 +59,37 @@ func TestCodec(t *testing.T) { if err := json.Unmarshal(data, &other); err != nil { t.Fatalf("unexpected error: %v", err) } - if other.APIVersion != latest.GroupOrDie("").Version || other.Kind != "Pod" { + if other.APIVersion != registered.GroupOrDie(internal.GroupName).GroupVersion.Version || other.Kind != "Pod" { t.Errorf("unexpected unmarshalled object %#v", other) } } func TestInterfacesFor(t *testing.T) { - if _, err := latest.GroupOrDie("").InterfacesFor(""); err == nil { + if _, err := registered.GroupOrDie(internal.GroupName).InterfacesFor(internal.SchemeGroupVersion); err == nil { t.Fatalf("unexpected non-error: %v", err) } - for i, version := range append([]string{latest.GroupOrDie("").Version}, latest.GroupOrDie("").Versions...) { - if vi, err := latest.GroupOrDie("").InterfacesFor(version); err != nil || vi == nil { + for i, version := range registered.GroupOrDie(internal.GroupName).GroupVersions { + if vi, err := registered.GroupOrDie(internal.GroupName).InterfacesFor(version); err != nil || vi == nil { t.Fatalf("%d: unexpected result: %v", i, err) } } } func TestRESTMapper(t *testing.T) { - if v, k, err := latest.GroupOrDie("").RESTMapper.VersionAndKindForResource("replicationcontrollers"); err != nil || v != "v1" || k != "ReplicationController" { - t.Errorf("unexpected version mapping: %s %s %v", v, k, err) + gv := unversioned.GroupVersion{Group: "", Version: "v1"} + rcGVK := gv.WithKind("ReplicationController") + podTemplateGVK := gv.WithKind("PodTemplate") + + if gvk, err := registered.GroupOrDie(internal.GroupName).RESTMapper.KindFor(internal.SchemeGroupVersion.WithResource("replicationcontrollers")); err != nil || gvk != rcGVK { + t.Errorf("unexpected version mapping: %v %v", gvk, err) } - if m, err := latest.GroupOrDie("").RESTMapper.RESTMapping("PodTemplate", ""); err != nil || m.APIVersion != "v1" || m.Resource != "podtemplates" { + if m, err := registered.GroupOrDie(internal.GroupName).RESTMapper.RESTMapping(podTemplateGVK.GroupKind(), ""); err != nil || m.GroupVersionKind != podTemplateGVK || m.Resource != "podtemplates" { t.Errorf("unexpected version mapping: %#v %v", m, err) } - for _, version := range latest.GroupOrDie("").Versions { - mapping, err := latest.GroupOrDie("").RESTMapper.RESTMapping("ReplicationController", version) + for _, version := range registered.GroupOrDie(internal.GroupName).GroupVersions { + mapping, err := registered.GroupOrDie(internal.GroupName).RESTMapper.RESTMapping(rcGVK.GroupKind(), version.Version) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -91,13 +97,13 @@ func TestRESTMapper(t *testing.T) { if mapping.Resource != "replicationControllers" && mapping.Resource != "replicationcontrollers" { t.Errorf("incorrect resource name: %#v", mapping) } - if mapping.APIVersion != version { + if mapping.GroupVersionKind.GroupVersion() != version { t.Errorf("incorrect version: %v", mapping) } - interfaces, _ := latest.GroupOrDie("").InterfacesFor(version) - if mapping.Codec != interfaces.Codec { - t.Errorf("unexpected codec: %#v, expected: %#v", mapping, interfaces) + interfaces, _ := registered.GroupOrDie(internal.GroupName).InterfacesFor(version) + if mapping.ObjectConvertor != interfaces.ObjectConvertor { + t.Errorf("unexpected: %#v, expected: %#v", mapping, interfaces) } rc := &internal.ReplicationController{ObjectMeta: internal.ObjectMeta{Name: "foo"}} @@ -110,3 +116,14 @@ func TestRESTMapper(t *testing.T) { } } } + +func TestUnversioned(t *testing.T) { + for _, obj := range []runtime.Object{ + &unversioned.Status{}, + &unversioned.ExportOptions{}, + } { + if unversioned, ok := internal.Scheme.IsUnversioned(obj); !unversioned || !ok { + t.Errorf("%v is expected to be unversioned", reflect.TypeOf(obj)) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/latest/latest.go b/vendor/k8s.io/kubernetes/pkg/api/latest/latest.go deleted file mode 100644 index 934146661..000000000 --- a/vendor/k8s.io/kubernetes/pkg/api/latest/latest.go +++ /dev/null @@ -1,149 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package latest - -import ( - "fmt" - "sort" - "strings" - - "k8s.io/kubernetes/pkg/api/meta" - "k8s.io/kubernetes/pkg/api/registered" - "k8s.io/kubernetes/pkg/runtime" -) - -var ( - allGroups = GroupMetaMap{} - // Group is a shortcut to allGroups.Group. - Group = allGroups.Group - // RegisterGroup is a shortcut to allGroups.RegisterGroup. - RegisterGroup = allGroups.RegisterGroup - // GroupOrDie is a shortcut to allGroups.GroupOrDie. - GroupOrDie = allGroups.GroupOrDie - // AllPreferredGroupVersions returns the preferred versions of all - // registered groups in the form of "group1/version1,group2/version2,..." - AllPreferredGroupVersions = allGroups.AllPreferredGroupVersions - // IsRegistered is a shortcut to allGroups.IsRegistered. - IsRegistered = allGroups.IsRegistered -) - -// GroupMetaMap is a map between group names and their metadata. -type GroupMetaMap map[string]*GroupMeta - -// RegisterGroup registers a group to GroupMetaMap. -func (g GroupMetaMap) RegisterGroup(group string) (*GroupMeta, error) { - _, found := g[group] - if found { - return nil, fmt.Errorf("group %v is already registered", g) - } - if len(registered.GroupVersionsForGroup(group)) == 0 { - return nil, fmt.Errorf("No version is registered for group %v", group) - } - g[group] = &GroupMeta{} - return g[group], nil -} - -// Group returns the metadata of a group if the gruop is registered, otherwise -// an erorr is returned. -func (g GroupMetaMap) Group(group string) (*GroupMeta, error) { - groupMeta, found := g[group] - if !found { - return nil, fmt.Errorf("no version is registered for group %v", group) - } - return groupMeta, nil -} - -// IsRegistered takes a string and determines if it's one of the registered groups -func (g GroupMetaMap) IsRegistered(group string) bool { - _, found := g[group] - return found -} - -// TODO: This is an expedient function, because we don't check if a Group is -// supported throughout the code base. We will abandon this function and -// checking the error returned by the Group() function. -func (g GroupMetaMap) GroupOrDie(group string) *GroupMeta { - groupMeta, found := g[group] - if !found { - const msg = "Please check the KUBE_API_VERSIONS environment variable." - if group == "" { - panic("The legacy v1 API is not registered. " + msg) - } else { - panic(fmt.Sprintf("No version is registered for group %s. ", group) + msg) - } - } - return groupMeta -} - -// AllPreferredGroupVersions returns the preferred versions of all registered -// groups in the form of "group1/version1,group2/version2,..." -func (g GroupMetaMap) AllPreferredGroupVersions() string { - if len(g) == 0 { - return "" - } - var defaults []string - for _, groupMeta := range g { - defaults = append(defaults, groupMeta.GroupVersion) - } - sort.Strings(defaults) - return strings.Join(defaults, ",") -} - -// GroupMeta stores the metadata of a group, such as the latest supported version. -type GroupMeta struct { - // GroupVersion represents the current external default version of the group. It - // is in the form of "group/version". - GroupVersion string - - // Version represents the current external default version of the group. - // It equals to the "version" part of GroupVersion. - Version string - - // Group represents the name of the group - Group string - - // Versions is the list of versions that are recognized in code. The order - // provided is assumed to be from the oldest to the newest, e.g., - // Versions[0] == oldest and Versions[N-1] == newest. - // Clients may choose to prefer the latter items in the list over the former - // items when presented with a set of versions to choose. - Versions []string - - // GroupVersions is Group + Versions. This is to avoid string concatenation - // in many places. - GroupVersions []string - - // Codec is the default codec for serializing output that should use - // the latest supported version. Use this Codec when writing to - // disk, a data store that is not dynamically versioned, or in tests. - // This codec can decode any object that Kubernetes is aware of. - Codec runtime.Codec - - // SelfLinker can set or get the SelfLink field of all API types. - // TODO: when versioning changes, make this part of each API definition. - // TODO(lavalamp): Combine SelfLinker & ResourceVersioner interfaces, force all uses - // to go through the InterfacesFor method below. - SelfLinker runtime.SelfLinker - - // RESTMapper provides the default mapping between REST paths and the objects declared in api.Scheme and all known - // Kubernetes versions. - RESTMapper meta.RESTMapper - - // InterfacesFor returns the default Codec and ResourceVersioner for a given version - // string, or an error if the version is not known. - InterfacesFor func(version string) (*meta.VersionInterfaces, error) -} diff --git a/vendor/k8s.io/kubernetes/pkg/api/mapper.go b/vendor/k8s.io/kubernetes/pkg/api/mapper.go index 10a38ff21..054f74d5e 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/mapper.go +++ b/vendor/k8s.io/kubernetes/pkg/api/mapper.go @@ -20,6 +20,7 @@ import ( "strings" "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/util/sets" ) @@ -33,14 +34,15 @@ func RegisterRESTMapper(m meta.RESTMapper) { RESTMapper = append(RESTMapper.(meta.MultiRESTMapper), m) } -func NewDefaultRESTMapper(group string, versions []string, interfacesFunc meta.VersionInterfacesFunc, +func NewDefaultRESTMapper(defaultGroupVersions []unversioned.GroupVersion, interfacesFunc meta.VersionInterfacesFunc, importPathPrefix string, ignoredKinds, rootScoped sets.String) *meta.DefaultRESTMapper { - mapper := meta.NewDefaultRESTMapper(group, versions, interfacesFunc) + mapper := meta.NewDefaultRESTMapper(defaultGroupVersions, interfacesFunc) // enumerate all supported versions, get the kinds, and register with the mapper how to address // our resources. - for _, version := range versions { - for kind, oType := range Scheme.KnownTypes(version) { + for _, gv := range defaultGroupVersions { + for kind, oType := range Scheme.KnownTypes(gv) { + gvk := gv.WithKind(kind) // TODO: Remove import path prefix check. // We check the import path prefix because we currently stuff both "api" and "extensions" objects // into the same group within Scheme since Scheme has no notion of groups yet. @@ -51,7 +53,7 @@ func NewDefaultRESTMapper(group string, versions []string, interfacesFunc meta.V if rootScoped.Has(kind) { scope = meta.RESTScopeRoot } - mapper.Add(scope, kind, version, false) + mapper.Add(gvk, scope) } } return mapper diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta.go b/vendor/k8s.io/kubernetes/pkg/api/meta.go index a69f66d86..ec84c3c8a 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/meta.go +++ b/vendor/k8s.io/kubernetes/pkg/api/meta.go @@ -20,6 +20,7 @@ import ( "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/util" ) @@ -60,3 +61,22 @@ func ListMetaFor(obj runtime.Object) (*unversioned.ListMeta, error) { err = runtime.FieldPtr(v, "ListMeta", &meta) return meta, err } + +// Namespace implements meta.Object for any object with an ObjectMeta typed field. Allows +// fast, direct access to metadata fields for API objects. +func (meta *ObjectMeta) GetNamespace() string { return meta.Namespace } +func (meta *ObjectMeta) SetNamespace(namespace string) { meta.Namespace = namespace } +func (meta *ObjectMeta) GetName() string { return meta.Name } +func (meta *ObjectMeta) SetName(name string) { meta.Name = name } +func (meta *ObjectMeta) GetGenerateName() string { return meta.GenerateName } +func (meta *ObjectMeta) SetGenerateName(generateName string) { meta.GenerateName = generateName } +func (meta *ObjectMeta) GetUID() types.UID { return meta.UID } +func (meta *ObjectMeta) SetUID(uid types.UID) { meta.UID = uid } +func (meta *ObjectMeta) GetResourceVersion() string { return meta.ResourceVersion } +func (meta *ObjectMeta) SetResourceVersion(version string) { meta.ResourceVersion = version } +func (meta *ObjectMeta) GetSelfLink() string { return meta.SelfLink } +func (meta *ObjectMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink } +func (meta *ObjectMeta) GetLabels() map[string]string { return meta.Labels } +func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = labels } +func (meta *ObjectMeta) GetAnnotations() map[string]string { return meta.Annotations } +func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations } diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/errors.go b/vendor/k8s.io/kubernetes/pkg/api/meta/errors.go new file mode 100644 index 000000000..2b89bcb8a --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/errors.go @@ -0,0 +1,72 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package meta + +import ( + "fmt" + + "k8s.io/kubernetes/pkg/api/unversioned" +) + +// AmbiguousResourceError is returned if the RESTMapper finds multiple matches for a resource +type AmbiguousResourceError struct { + PartialResource unversioned.GroupVersionResource + + MatchingResources []unversioned.GroupVersionResource + MatchingKinds []unversioned.GroupVersionKind +} + +func (e *AmbiguousResourceError) Error() string { + switch { + case len(e.MatchingKinds) > 0 && len(e.MatchingResources) > 0: + return fmt.Sprintf("%v matches multiple resources %v and kinds %v", e.PartialResource, e.MatchingResources, e.MatchingKinds) + case len(e.MatchingKinds) > 0: + return fmt.Sprintf("%v matches multiple kinds %v", e.PartialResource, e.MatchingKinds) + case len(e.MatchingResources) > 0: + return fmt.Sprintf("%v matches multiple resources %v", e.PartialResource, e.MatchingResources) + + } + + return fmt.Sprintf("%v matches multiple resources or kinds", e.PartialResource) +} + +func IsAmbiguousResourceError(err error) bool { + if err == nil { + return false + } + + _, ok := err.(*AmbiguousResourceError) + return ok +} + +// NoResourceMatchError is returned if the RESTMapper can't find any match for a resource +type NoResourceMatchError struct { + PartialResource unversioned.GroupVersionResource +} + +func (e *NoResourceMatchError) Error() string { + return fmt.Sprintf("no matches for %v", e.PartialResource) +} + +func IsNoResourceMatchError(err error) bool { + if err == nil { + return false + } + + _, ok := err.(*NoResourceMatchError) + return ok +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/help.go b/vendor/k8s.io/kubernetes/pkg/api/meta/help.go new file mode 100644 index 000000000..7d1570bc2 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/help.go @@ -0,0 +1,133 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package meta + +import ( + "fmt" + "reflect" + + "k8s.io/kubernetes/pkg/conversion" + "k8s.io/kubernetes/pkg/runtime" +) + +// IsListType returns true if the provided Object has a slice called Items +func IsListType(obj runtime.Object) bool { + _, err := GetItemsPtr(obj) + return err == nil +} + +// GetItemsPtr returns a pointer to the list object's Items member. +// If 'list' doesn't have an Items member, it's not really a list type +// and an error will be returned. +// This function will either return a pointer to a slice, or an error, but not both. +func GetItemsPtr(list runtime.Object) (interface{}, error) { + v, err := conversion.EnforcePtr(list) + if err != nil { + return nil, err + } + items := v.FieldByName("Items") + if !items.IsValid() { + return nil, fmt.Errorf("no Items field in %#v", list) + } + switch items.Kind() { + case reflect.Interface, reflect.Ptr: + target := reflect.TypeOf(items.Interface()).Elem() + if target.Kind() != reflect.Slice { + return nil, fmt.Errorf("items: Expected slice, got %s", target.Kind()) + } + return items.Interface(), nil + case reflect.Slice: + return items.Addr().Interface(), nil + default: + return nil, fmt.Errorf("items: Expected slice, got %s", items.Kind()) + } +} + +// ExtractList returns obj's Items element as an array of runtime.Objects. +// Returns an error if obj is not a List type (does not have an Items member). +func ExtractList(obj runtime.Object) ([]runtime.Object, error) { + itemsPtr, err := GetItemsPtr(obj) + if err != nil { + return nil, err + } + items, err := conversion.EnforcePtr(itemsPtr) + if err != nil { + return nil, err + } + list := make([]runtime.Object, items.Len()) + for i := range list { + raw := items.Index(i) + switch item := raw.Interface().(type) { + case runtime.RawExtension: + switch { + case item.Object != nil: + list[i] = item.Object + case item.RawJSON != nil: + list[i] = &runtime.Unknown{RawJSON: item.RawJSON} + default: + list[i] = nil + } + case runtime.Object: + list[i] = item + default: + var found bool + if list[i], found = raw.Addr().Interface().(runtime.Object); !found { + return nil, fmt.Errorf("%v: item[%v]: Expected object, got %#v(%s)", obj, i, raw.Interface(), raw.Kind()) + } + } + } + return list, nil +} + +// objectSliceType is the type of a slice of Objects +var objectSliceType = reflect.TypeOf([]runtime.Object{}) + +// SetList sets the given list object's Items member have the elements given in +// objects. +// Returns an error if list is not a List type (does not have an Items member), +// or if any of the objects are not of the right type. +func SetList(list runtime.Object, objects []runtime.Object) error { + itemsPtr, err := GetItemsPtr(list) + if err != nil { + return err + } + items, err := conversion.EnforcePtr(itemsPtr) + if err != nil { + return err + } + if items.Type() == objectSliceType { + items.Set(reflect.ValueOf(objects)) + return nil + } + slice := reflect.MakeSlice(items.Type(), len(objects), len(objects)) + for i := range objects { + dest := slice.Index(i) + src, err := conversion.EnforcePtr(objects[i]) + if err != nil { + return err + } + if src.Type().AssignableTo(dest.Type()) { + dest.Set(src) + } else if src.Type().ConvertibleTo(dest.Type()) { + dest.Set(src.Convert(dest.Type())) + } else { + return fmt.Errorf("item[%d]: can't assign or convert %v into %v", i, src.Type(), dest.Type()) + } + } + items.Set(slice) + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/help_test.go b/vendor/k8s.io/kubernetes/pkg/api/meta/help_test.go new file mode 100644 index 000000000..435784fdc --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/help_test.go @@ -0,0 +1,253 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package meta_test + +import ( + "reflect" + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util" + + "github.com/google/gofuzz" +) + +func TestIsList(t *testing.T) { + tests := []struct { + obj runtime.Object + isList bool + }{ + {&api.PodList{}, true}, + {&api.Pod{}, false}, + } + for _, item := range tests { + if e, a := item.isList, meta.IsListType(item.obj); e != a { + t.Errorf("%v: Expected %v, got %v", reflect.TypeOf(item.obj), e, a) + } + } +} + +func TestExtractList(t *testing.T) { + pl := &api.PodList{ + Items: []api.Pod{ + {ObjectMeta: api.ObjectMeta{Name: "1"}}, + {ObjectMeta: api.ObjectMeta{Name: "2"}}, + {ObjectMeta: api.ObjectMeta{Name: "3"}}, + }, + } + list, err := meta.ExtractList(pl) + if err != nil { + t.Fatalf("Unexpected error %v", err) + } + if e, a := len(list), len(pl.Items); e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + for i := range list { + if e, a := list[i].(*api.Pod).Name, pl.Items[i].Name; e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + } +} + +func TestExtractListV1(t *testing.T) { + pl := &v1.PodList{ + Items: []v1.Pod{ + {ObjectMeta: v1.ObjectMeta{Name: "1"}}, + {ObjectMeta: v1.ObjectMeta{Name: "2"}}, + {ObjectMeta: v1.ObjectMeta{Name: "3"}}, + }, + } + list, err := meta.ExtractList(pl) + if err != nil { + t.Fatalf("Unexpected error %v", err) + } + if e, a := len(list), len(pl.Items); e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + for i := range list { + if e, a := list[i].(*v1.Pod).Name, pl.Items[i].Name; e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + } +} + +func TestExtractListGeneric(t *testing.T) { + pl := &api.List{ + Items: []runtime.Object{ + &api.Pod{ObjectMeta: api.ObjectMeta{Name: "1"}}, + &api.Service{ObjectMeta: api.ObjectMeta{Name: "2"}}, + }, + } + list, err := meta.ExtractList(pl) + if err != nil { + t.Fatalf("Unexpected error %v", err) + } + if e, a := len(list), len(pl.Items); e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + if obj, ok := list[0].(*api.Pod); !ok { + t.Fatalf("Expected list[0] to be *api.Pod, it is %#v", obj) + } + if obj, ok := list[1].(*api.Service); !ok { + t.Fatalf("Expected list[1] to be *api.Service, it is %#v", obj) + } +} + +func TestExtractListGenericV1(t *testing.T) { + pl := &v1.List{ + Items: []runtime.RawExtension{ + {RawJSON: []byte("foo")}, + {RawJSON: []byte("bar")}, + {Object: &v1.Pod{ObjectMeta: v1.ObjectMeta{Name: "other"}}}, + }, + } + list, err := meta.ExtractList(pl) + if err != nil { + t.Fatalf("Unexpected error %v", err) + } + if e, a := len(list), len(pl.Items); e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + if obj, ok := list[0].(*runtime.Unknown); !ok { + t.Fatalf("Expected list[0] to be *runtime.Unknown, it is %#v", obj) + } + if obj, ok := list[1].(*runtime.Unknown); !ok { + t.Fatalf("Expected list[1] to be *runtime.Unknown, it is %#v", obj) + } + if obj, ok := list[2].(*v1.Pod); !ok { + t.Fatalf("Expected list[2] to be *runtime.Unknown, it is %#v", obj) + } +} + +type fakePtrInterfaceList struct { + Items *[]runtime.Object +} + +func (obj fakePtrInterfaceList) GetObjectKind() unversioned.ObjectKind { + return unversioned.EmptyObjectKind +} + +func TestExtractListOfInterfacePtrs(t *testing.T) { + pl := &fakePtrInterfaceList{ + Items: &[]runtime.Object{}, + } + list, err := meta.ExtractList(pl) + if err != nil { + t.Fatalf("Unexpected error %v", err) + } + if len(list) > 0 { + t.Fatalf("Expected empty list, got %#v", list) + } +} + +type fakePtrValueList struct { + Items []*api.Pod +} + +func (obj fakePtrValueList) GetObjectKind() unversioned.ObjectKind { + return unversioned.EmptyObjectKind +} + +func TestExtractListOfValuePtrs(t *testing.T) { + pl := &fakePtrValueList{ + Items: []*api.Pod{ + {ObjectMeta: api.ObjectMeta{Name: "1"}}, + {ObjectMeta: api.ObjectMeta{Name: "2"}}, + }, + } + list, err := meta.ExtractList(pl) + if err != nil { + t.Fatalf("Unexpected error %v", err) + } + if e, a := len(list), len(pl.Items); e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + for i := range list { + if obj, ok := list[i].(*api.Pod); !ok { + t.Fatalf("Expected list[%d] to be *api.Pod, it is %#v", i, obj) + } + } +} + +func TestSetList(t *testing.T) { + pl := &api.PodList{} + list := []runtime.Object{ + &api.Pod{ObjectMeta: api.ObjectMeta{Name: "1"}}, + &api.Pod{ObjectMeta: api.ObjectMeta{Name: "2"}}, + &api.Pod{ObjectMeta: api.ObjectMeta{Name: "3"}}, + } + err := meta.SetList(pl, list) + if err != nil { + t.Fatalf("Unexpected error %v", err) + } + if e, a := len(list), len(pl.Items); e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + for i := range list { + if e, a := list[i].(*api.Pod).Name, pl.Items[i].Name; e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + } +} + +func TestSetListToRuntimeObjectArray(t *testing.T) { + pl := &api.List{} + list := []runtime.Object{ + &api.Pod{ObjectMeta: api.ObjectMeta{Name: "1"}}, + &api.Pod{ObjectMeta: api.ObjectMeta{Name: "2"}}, + &api.Pod{ObjectMeta: api.ObjectMeta{Name: "3"}}, + } + err := meta.SetList(pl, list) + if err != nil { + t.Fatalf("Unexpected error %v", err) + } + if e, a := len(list), len(pl.Items); e != a { + t.Fatalf("Expected %v, got %v", e, a) + } + for i := range list { + if e, a := list[i], pl.Items[i]; e != a { + t.Fatalf("%d: unmatched: %s", i, util.ObjectDiff(e, a)) + } + } +} + +func TestSetExtractListRoundTrip(t *testing.T) { + fuzzer := fuzz.New().NilChance(0).NumElements(1, 5) + for i := 0; i < 5; i++ { + start := &api.PodList{} + fuzzer.Fuzz(&start.Items) + + list, err := meta.ExtractList(start) + if err != nil { + t.Errorf("Unexpected error %v", err) + continue + } + got := &api.PodList{} + err = meta.SetList(got, list) + if err != nil { + t.Errorf("Unexpected error %v", err) + continue + } + if e, a := start, got; !reflect.DeepEqual(e, a) { + t.Fatalf("Expected %#v, got %#v", e, a) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/interfaces.go b/vendor/k8s.io/kubernetes/pkg/api/meta/interfaces.go index 3d7455469..f1402e7ad 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/meta/interfaces.go +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/interfaces.go @@ -17,48 +17,59 @@ limitations under the License. package meta import ( + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/types" ) // VersionInterfaces contains the interfaces one should use for dealing with types of a particular version. type VersionInterfaces struct { - runtime.Codec runtime.ObjectConvertor MetadataAccessor } -// Interface lets you work with object and list metadata from any of the versioned or +type ObjectMetaAccessor interface { + GetObjectMeta() Object +} + +// Object lets you work with object metadata from any of the versioned or // internal API objects. Attempting to set or retrieve a field on an object that does // not support that field (Name, UID, Namespace on lists) will be a no-op and return // a default value. -// TODO: rename to ObjectInterface when we clear up these interfaces. -type Interface interface { - TypeInterface - - Namespace() string +type Object interface { + GetNamespace() string SetNamespace(namespace string) - Name() string + GetName() string SetName(name string) - GenerateName() string + GetGenerateName() string SetGenerateName(name string) - UID() types.UID + GetUID() types.UID SetUID(uid types.UID) - ResourceVersion() string + GetResourceVersion() string SetResourceVersion(version string) - SelfLink() string + GetSelfLink() string SetSelfLink(selfLink string) - Labels() map[string]string + GetLabels() map[string]string SetLabels(labels map[string]string) - Annotations() map[string]string + GetAnnotations() map[string]string SetAnnotations(annotations map[string]string) } -// TypeInterface exposes the type and APIVersion of versioned or internal API objects. -type TypeInterface interface { - APIVersion() string +// List lets you work with list metadata from any of the versioned or +// internal API objects. Attempting to set or retrieve a field on an object that does +// not support that field will be a no-op and return a default value. +type List interface { + GetResourceVersion() string + SetResourceVersion(version string) + GetSelfLink() string + SetSelfLink(selfLink string) +} + +// Type exposes the type and APIVersion of versioned or internal API objects. +type Type interface { + GetAPIVersion() string SetAPIVersion(version string) - Kind() string + GetKind() string SetKind(kind string) } @@ -107,8 +118,6 @@ const ( ) // RESTScope contains the information needed to deal with REST resources that are in a resource hierarchy -// TODO After we deprecate v1beta1 and v1beta2, we can look a supporting removing the flexibility of supporting -// either a query or path param, and instead just support path param type RESTScope interface { // Name of the scope Name() RESTScopeName @@ -126,15 +135,12 @@ type RESTScope interface { type RESTMapping struct { // Resource is a string representing the name of this resource as a REST client would see it Resource string - // APIVersion represents the APIVersion that represents the resource as presented. It is provided - // for convenience for passing around a consistent mapping. - APIVersion string - Kind string + + GroupVersionKind unversioned.GroupVersionKind // Scope contains the information needed to deal with REST Resources that are in a resource hierarchy Scope RESTScope - runtime.Codec runtime.ObjectConvertor MetadataAccessor } @@ -150,12 +156,20 @@ type RESTMapping struct { // TODO(caesarxuchao): Add proper multi-group support so that kinds & resources are // scoped to groups. See http://issues.k8s.io/12413 and http://issues.k8s.io/10009. type RESTMapper interface { - VersionAndKindForResource(resource string) (defaultVersion, kind string, err error) - // TODO(caesarxuchao): Remove GroupForResource when multi-group support is in (since - // group will be part of the version). - GroupForResource(resource string) (string, error) - RESTMapping(kind string, versions ...string) (*RESTMapping, error) + // KindFor takes a partial resource and returns back the single match. Returns an error if there are multiple matches + KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) + + // KindsFor takes a partial resource and returns back the list of potential kinds in priority order + KindsFor(resource unversioned.GroupVersionResource) ([]unversioned.GroupVersionKind, error) + + // ResourceFor takes a partial resource and returns back the single match. Returns an error if there are multiple matches + ResourceFor(input unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error) + + // ResourcesFor takes a partial resource and returns back the list of potential resource in priority order + ResourcesFor(input unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error) + + RESTMapping(gk unversioned.GroupKind, versions ...string) (*RESTMapping, error) + AliasesForResource(resource string) ([]string, bool) ResourceSingularizer(resource string) (singular string, err error) - ResourceIsValid(resource string) bool } diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/meta.go b/vendor/k8s.io/kubernetes/pkg/api/meta/meta.go index 848f09afe..bf11abd18 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/meta/meta.go +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/meta.go @@ -20,6 +20,7 @@ import ( "fmt" "reflect" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/types" @@ -29,8 +30,18 @@ import ( // obj must be a pointer to an API type. An error is returned if the minimum // required fields are missing. Fields that are not required return the default // value and are a no-op if set. -// TODO: add a fast path for *TypeMeta and *ObjectMeta for internal objects -func Accessor(obj interface{}) (Interface, error) { +func Accessor(obj interface{}) (Object, error) { + if oi, ok := obj.(ObjectMetaAccessor); ok { + if om := oi.GetObjectMeta(); om != nil { + return om, nil + } + } + // we may get passed an object that is directly portable to Object + if oi, ok := obj.(Object); ok { + return oi, nil + } + // legacy path for objects that do not implement Object and ObjectMetaAccessor via + // reflection - very slow code path. v, err := conversion.EnforcePtr(obj) if err != nil { return nil, err @@ -79,7 +90,10 @@ func Accessor(obj interface{}) (Interface, error) { // TODO: this interface is used to test code that does not have ObjectMeta or ListMeta // in round tripping (objects which can use apiVersion/kind, but do not fit the Kube // api conventions). -func TypeAccessor(obj interface{}) (TypeInterface, error) { +func TypeAccessor(obj interface{}) (Type, error) { + if typed, ok := obj.(runtime.Object); ok { + return objectAccessor{typed}, nil + } v, err := conversion.EnforcePtr(obj) if err != nil { return nil, err @@ -100,6 +114,46 @@ func TypeAccessor(obj interface{}) (TypeInterface, error) { return a, nil } +type objectAccessor struct { + runtime.Object +} + +func (obj objectAccessor) GetKind() string { + if gvk := obj.GetObjectKind().GroupVersionKind(); gvk != nil { + return gvk.Kind + } + return "" +} + +func (obj objectAccessor) SetKind(kind string) { + gvk := obj.GetObjectKind().GroupVersionKind() + if gvk == nil { + gvk = &unversioned.GroupVersionKind{} + } + gvk.Kind = kind + obj.GetObjectKind().SetGroupVersionKind(gvk) +} + +func (obj objectAccessor) GetAPIVersion() string { + if gvk := obj.GetObjectKind().GroupVersionKind(); gvk != nil { + return gvk.GroupVersion().String() + } + return "" +} + +func (obj objectAccessor) SetAPIVersion(version string) { + gvk := obj.GetObjectKind().GroupVersionKind() + if gvk == nil { + gvk = &unversioned.GroupVersionKind{} + } + gv, err := unversioned.ParseGroupVersion(version) + if err != nil { + gv = unversioned.GroupVersion{Version: version} + } + gvk.Group, gvk.Version = gv.Group, gv.Version + obj.GetObjectKind().SetGroupVersionKind(gvk) +} + // NewAccessor returns a MetadataAccessor that can retrieve // or manipulate resource version on objects derived from core API // metadata concepts. @@ -111,36 +165,20 @@ func NewAccessor() MetadataAccessor { type resourceAccessor struct{} func (resourceAccessor) Kind(obj runtime.Object) (string, error) { - accessor, err := Accessor(obj) - if err != nil { - return "", err - } - return accessor.Kind(), nil + return objectAccessor{obj}.GetKind(), nil } func (resourceAccessor) SetKind(obj runtime.Object, kind string) error { - accessor, err := Accessor(obj) - if err != nil { - return err - } - accessor.SetKind(kind) + objectAccessor{obj}.SetKind(kind) return nil } func (resourceAccessor) APIVersion(obj runtime.Object) (string, error) { - accessor, err := Accessor(obj) - if err != nil { - return "", err - } - return accessor.APIVersion(), nil + return objectAccessor{obj}.GetAPIVersion(), nil } func (resourceAccessor) SetAPIVersion(obj runtime.Object, version string) error { - accessor, err := Accessor(obj) - if err != nil { - return err - } - accessor.SetAPIVersion(version) + objectAccessor{obj}.SetAPIVersion(version) return nil } @@ -149,7 +187,7 @@ func (resourceAccessor) Namespace(obj runtime.Object) (string, error) { if err != nil { return "", err } - return accessor.Namespace(), nil + return accessor.GetNamespace(), nil } func (resourceAccessor) SetNamespace(obj runtime.Object, namespace string) error { @@ -166,7 +204,7 @@ func (resourceAccessor) Name(obj runtime.Object) (string, error) { if err != nil { return "", err } - return accessor.Name(), nil + return accessor.GetName(), nil } func (resourceAccessor) SetName(obj runtime.Object, name string) error { @@ -183,7 +221,7 @@ func (resourceAccessor) GenerateName(obj runtime.Object) (string, error) { if err != nil { return "", err } - return accessor.GenerateName(), nil + return accessor.GetGenerateName(), nil } func (resourceAccessor) SetGenerateName(obj runtime.Object, name string) error { @@ -200,7 +238,7 @@ func (resourceAccessor) UID(obj runtime.Object) (types.UID, error) { if err != nil { return "", err } - return accessor.UID(), nil + return accessor.GetUID(), nil } func (resourceAccessor) SetUID(obj runtime.Object, uid types.UID) error { @@ -217,7 +255,7 @@ func (resourceAccessor) SelfLink(obj runtime.Object) (string, error) { if err != nil { return "", err } - return accessor.SelfLink(), nil + return accessor.GetSelfLink(), nil } func (resourceAccessor) SetSelfLink(obj runtime.Object, selfLink string) error { @@ -234,7 +272,7 @@ func (resourceAccessor) Labels(obj runtime.Object) (map[string]string, error) { if err != nil { return nil, err } - return accessor.Labels(), nil + return accessor.GetLabels(), nil } func (resourceAccessor) SetLabels(obj runtime.Object, labels map[string]string) error { @@ -251,7 +289,7 @@ func (resourceAccessor) Annotations(obj runtime.Object) (map[string]string, erro if err != nil { return nil, err } - return accessor.Annotations(), nil + return accessor.GetAnnotations(), nil } func (resourceAccessor) SetAnnotations(obj runtime.Object, annotations map[string]string) error { @@ -268,7 +306,7 @@ func (resourceAccessor) ResourceVersion(obj runtime.Object) (string, error) { if err != nil { return "", err } - return accessor.ResourceVersion(), nil + return accessor.GetResourceVersion(), nil } func (resourceAccessor) SetResourceVersion(obj runtime.Object, version string) error { @@ -295,7 +333,7 @@ type genericAccessor struct { annotations *map[string]string } -func (a genericAccessor) Namespace() string { +func (a genericAccessor) GetNamespace() string { if a.namespace == nil { return "" } @@ -309,7 +347,7 @@ func (a genericAccessor) SetNamespace(namespace string) { *a.namespace = namespace } -func (a genericAccessor) Name() string { +func (a genericAccessor) GetName() string { if a.name == nil { return "" } @@ -323,7 +361,7 @@ func (a genericAccessor) SetName(name string) { *a.name = name } -func (a genericAccessor) GenerateName() string { +func (a genericAccessor) GetGenerateName() string { if a.generateName == nil { return "" } @@ -337,7 +375,7 @@ func (a genericAccessor) SetGenerateName(generateName string) { *a.generateName = generateName } -func (a genericAccessor) UID() types.UID { +func (a genericAccessor) GetUID() types.UID { if a.uid == nil { return "" } @@ -351,7 +389,7 @@ func (a genericAccessor) SetUID(uid types.UID) { *a.uid = uid } -func (a genericAccessor) APIVersion() string { +func (a genericAccessor) GetAPIVersion() string { return *a.apiVersion } @@ -359,7 +397,7 @@ func (a genericAccessor) SetAPIVersion(version string) { *a.apiVersion = version } -func (a genericAccessor) Kind() string { +func (a genericAccessor) GetKind() string { return *a.kind } @@ -367,7 +405,7 @@ func (a genericAccessor) SetKind(kind string) { *a.kind = kind } -func (a genericAccessor) ResourceVersion() string { +func (a genericAccessor) GetResourceVersion() string { return *a.resourceVersion } @@ -375,7 +413,7 @@ func (a genericAccessor) SetResourceVersion(version string) { *a.resourceVersion = version } -func (a genericAccessor) SelfLink() string { +func (a genericAccessor) GetSelfLink() string { return *a.selfLink } @@ -383,7 +421,7 @@ func (a genericAccessor) SetSelfLink(selfLink string) { *a.selfLink = selfLink } -func (a genericAccessor) Labels() map[string]string { +func (a genericAccessor) GetLabels() map[string]string { if a.labels == nil { return nil } @@ -394,7 +432,7 @@ func (a genericAccessor) SetLabels(labels map[string]string) { *a.labels = labels } -func (a genericAccessor) Annotations() map[string]string { +func (a genericAccessor) GetAnnotations() map[string]string { if a.annotations == nil { return nil } @@ -402,6 +440,10 @@ func (a genericAccessor) Annotations() map[string]string { } func (a genericAccessor) SetAnnotations(annotations map[string]string) { + if a.annotations == nil { + emptyAnnotations := make(map[string]string) + a.annotations = &emptyAnnotations + } *a.annotations = annotations } diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/meta_test.go b/vendor/k8s.io/kubernetes/pkg/api/meta/meta_test.go index 37cedb2be..5b6c35230 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/meta/meta_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/meta_test.go @@ -14,16 +14,117 @@ See the License for the specific language governing permissions and limitations under the License. */ -package meta +package meta_test import ( "reflect" "testing" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/types" ) +func TestAPIObjectMeta(t *testing.T) { + j := &api.Pod{ + TypeMeta: unversioned.TypeMeta{APIVersion: "/a", Kind: "b"}, + ObjectMeta: api.ObjectMeta{ + Namespace: "bar", + Name: "foo", + GenerateName: "prefix", + UID: "uid", + ResourceVersion: "1", + SelfLink: "some/place/only/we/know", + Labels: map[string]string{"foo": "bar"}, + Annotations: map[string]string{"x": "y"}, + }, + } + var _ meta.Object = &j.ObjectMeta + var _ meta.ObjectMetaAccessor = j + accessor, err := meta.Accessor(j) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if accessor != meta.Object(&j.ObjectMeta) { + t.Fatalf("should have returned the same pointer: %#v %#v", accessor, j) + } + if e, a := "bar", accessor.GetNamespace(); e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "foo", accessor.GetName(); e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "prefix", accessor.GetGenerateName(); e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "uid", string(accessor.GetUID()); e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "1", accessor.GetResourceVersion(); e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "some/place/only/we/know", accessor.GetSelfLink(); e != a { + t.Errorf("expected %v, got %v", e, a) + } + + typeAccessor, err := meta.TypeAccessor(j) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if e, a := "a", typeAccessor.GetAPIVersion(); e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "b", typeAccessor.GetKind(); e != a { + t.Errorf("expected %v, got %v", e, a) + } + + accessor.SetNamespace("baz") + accessor.SetName("bar") + accessor.SetGenerateName("generate") + accessor.SetUID("other") + typeAccessor.SetAPIVersion("c") + typeAccessor.SetKind("d") + accessor.SetResourceVersion("2") + accessor.SetSelfLink("google.com") + + // Prove that accessor changes the original object. + if e, a := "baz", j.Namespace; e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "bar", j.Name; e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "generate", j.GenerateName; e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := types.UID("other"), j.UID; e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "c", j.APIVersion; e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "d", j.Kind; e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "2", j.ResourceVersion; e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "google.com", j.SelfLink; e != a { + t.Errorf("expected %v, got %v", e, a) + } + + typeAccessor.SetAPIVersion("d") + typeAccessor.SetKind("e") + if e, a := "d", j.APIVersion; e != a { + t.Errorf("expected %v, got %v", e, a) + } + if e, a := "e", j.Kind; e != a { + t.Errorf("expected %v, got %v", e, a) + } +} + func TestGenericTypeMeta(t *testing.T) { type TypeMeta struct { Kind string `json:"kind,omitempty"` @@ -55,43 +156,37 @@ func TestGenericTypeMeta(t *testing.T) { Annotations: map[string]string{"x": "y"}, }, } - accessor, err := Accessor(&j) + accessor, err := meta.Accessor(&j) if err != nil { t.Fatalf("unexpected error: %v", err) } - if e, a := "bar", accessor.Namespace(); e != a { + if e, a := "bar", accessor.GetNamespace(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "foo", accessor.Name(); e != a { + if e, a := "foo", accessor.GetName(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "prefix", accessor.GenerateName(); e != a { + if e, a := "prefix", accessor.GetGenerateName(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "uid", string(accessor.UID()); e != a { + if e, a := "uid", string(accessor.GetUID()); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "a", accessor.APIVersion(); e != a { + if e, a := "1", accessor.GetResourceVersion(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "b", accessor.Kind(); e != a { - t.Errorf("expected %v, got %v", e, a) - } - if e, a := "1", accessor.ResourceVersion(); e != a { - t.Errorf("expected %v, got %v", e, a) - } - if e, a := "some/place/only/we/know", accessor.SelfLink(); e != a { + if e, a := "some/place/only/we/know", accessor.GetSelfLink(); e != a { t.Errorf("expected %v, got %v", e, a) } - typeAccessor, err := TypeAccessor(&j) + typeAccessor, err := meta.TypeAccessor(&j) if err != nil { t.Fatalf("unexpected error: %v", err) } - if e, a := "a", accessor.APIVersion(); e != a { + if e, a := "a", typeAccessor.GetAPIVersion(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "b", accessor.Kind(); e != a { + if e, a := "b", typeAccessor.GetKind(); e != a { t.Errorf("expected %v, got %v", e, a) } @@ -99,8 +194,8 @@ func TestGenericTypeMeta(t *testing.T) { accessor.SetName("bar") accessor.SetGenerateName("generate") accessor.SetUID("other") - accessor.SetAPIVersion("c") - accessor.SetKind("d") + typeAccessor.SetAPIVersion("c") + typeAccessor.SetKind("d") accessor.SetResourceVersion("2") accessor.SetSelfLink("google.com") @@ -157,7 +252,13 @@ type InternalObject struct { TypeMeta InternalTypeMeta `json:",inline"` } -func (*InternalObject) IsAnAPIObject() {} +func (obj *InternalObject) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *InternalObject) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.TypeMeta.APIVersion, obj.TypeMeta.Kind = gvk.ToAPIVersionAndKind() +} +func (obj *InternalObject) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.TypeMeta.APIVersion, obj.TypeMeta.Kind) +} func TestGenericTypeMetaAccessor(t *testing.T) { j := &InternalObject{ @@ -166,7 +267,7 @@ func TestGenericTypeMetaAccessor(t *testing.T) { Name: "foo", GenerateName: "prefix", UID: "uid", - APIVersion: "a", + APIVersion: "/a", Kind: "b", ResourceVersion: "1", SelfLink: "some/place/only/we/know", @@ -174,7 +275,7 @@ func TestGenericTypeMetaAccessor(t *testing.T) { Annotations: map[string]string{"x": "y"}, }, } - accessor := NewAccessor() + accessor := meta.NewAccessor() namespace, err := accessor.Namespace(j) if err != nil { t.Errorf("unexpected error: %v", err) @@ -347,38 +448,43 @@ func TestGenericObjectMeta(t *testing.T) { Annotations: map[string]string{"a": "b"}, }, } - accessor, err := Accessor(&j) + accessor, err := meta.Accessor(&j) if err != nil { t.Fatalf("unexpected error: %v", err) } - if e, a := "bar", accessor.Namespace(); e != a { + if e, a := "bar", accessor.GetNamespace(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "foo", accessor.Name(); e != a { + if e, a := "foo", accessor.GetName(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "prefix", accessor.GenerateName(); e != a { + if e, a := "prefix", accessor.GetGenerateName(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "uid", string(accessor.UID()); e != a { + if e, a := "uid", string(accessor.GetUID()); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "a", accessor.APIVersion(); e != a { + if e, a := "1", accessor.GetResourceVersion(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "b", accessor.Kind(); e != a { + if e, a := "some/place/only/we/know", accessor.GetSelfLink(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "1", accessor.ResourceVersion(); e != a { + if e, a := 1, len(accessor.GetLabels()); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "some/place/only/we/know", accessor.SelfLink(); e != a { + if e, a := 1, len(accessor.GetAnnotations()); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := 1, len(accessor.Labels()); e != a { + + typeAccessor, err := meta.TypeAccessor(&j) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if e, a := "a", typeAccessor.GetAPIVersion(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := 1, len(accessor.Annotations()); e != a { + if e, a := "b", typeAccessor.GetKind(); e != a { t.Errorf("expected %v, got %v", e, a) } @@ -386,8 +492,8 @@ func TestGenericObjectMeta(t *testing.T) { accessor.SetName("bar") accessor.SetGenerateName("generate") accessor.SetUID("other") - accessor.SetAPIVersion("c") - accessor.SetKind("d") + typeAccessor.SetAPIVersion("c") + typeAccessor.SetKind("d") accessor.SetResourceVersion("2") accessor.SetSelfLink("google.com") accessor.SetLabels(map[string]string{"other": "label"}) @@ -449,33 +555,38 @@ func TestGenericListMeta(t *testing.T) { SelfLink: "some/place/only/we/know", }, } - accessor, err := Accessor(&j) + accessor, err := meta.Accessor(&j) if err != nil { t.Fatalf("unexpected error: %v", err) } - if e, a := "", accessor.Name(); e != a { + if e, a := "", accessor.GetName(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "", string(accessor.UID()); e != a { + if e, a := "", string(accessor.GetUID()); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "a", accessor.APIVersion(); e != a { + if e, a := "1", accessor.GetResourceVersion(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "b", accessor.Kind(); e != a { + if e, a := "some/place/only/we/know", accessor.GetSelfLink(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "1", accessor.ResourceVersion(); e != a { + + typeAccessor, err := meta.TypeAccessor(&j) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if e, a := "a", typeAccessor.GetAPIVersion(); e != a { t.Errorf("expected %v, got %v", e, a) } - if e, a := "some/place/only/we/know", accessor.SelfLink(); e != a { + if e, a := "b", typeAccessor.GetKind(); e != a { t.Errorf("expected %v, got %v", e, a) } accessor.SetName("bar") accessor.SetUID("other") - accessor.SetAPIVersion("c") - accessor.SetKind("d") + typeAccessor.SetAPIVersion("c") + typeAccessor.SetKind("d") accessor.SetResourceVersion("2") accessor.SetSelfLink("google.com") @@ -498,12 +609,19 @@ type MyAPIObject struct { TypeMeta InternalTypeMeta `json:",inline"` } -func (*MyAPIObject) IsAnAPIObject() {} - -type MyIncorrectlyMarkedAsAPIObject struct { +func (obj *MyAPIObject) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *MyAPIObject) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.TypeMeta.APIVersion, obj.TypeMeta.Kind = gvk.ToAPIVersionAndKind() +} +func (obj *MyAPIObject) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.TypeMeta.APIVersion, obj.TypeMeta.Kind) } -func (*MyIncorrectlyMarkedAsAPIObject) IsAnAPIObject() {} +type MyIncorrectlyMarkedAsAPIObject struct{} + +func (obj *MyIncorrectlyMarkedAsAPIObject) GetObjectKind() unversioned.ObjectKind { + return unversioned.EmptyObjectKind +} func TestResourceVersionerOfAPI(t *testing.T) { type T struct { @@ -515,7 +633,7 @@ func TestResourceVersionerOfAPI(t *testing.T) { "api object with version": {&MyAPIObject{TypeMeta: InternalTypeMeta{ResourceVersion: "1"}}, "1"}, "pointer to api object with version": {&MyAPIObject{TypeMeta: InternalTypeMeta{ResourceVersion: "1"}}, "1"}, } - versioning := NewAccessor() + versioning := meta.NewAccessor() for key, testCase := range testCases { actual, err := versioning.ResourceVersion(testCase.Object) if err != nil { @@ -578,7 +696,7 @@ func TestTypeMetaSelfLinker(t *testing.T) { }, } - linker := runtime.SelfLinker(NewAccessor()) + linker := runtime.SelfLinker(meta.NewAccessor()) for name, item := range table { got, err := linker.SelfLink(item.obj) if e, a := item.succeed, err == nil; e != a { @@ -603,3 +721,58 @@ func TestTypeMetaSelfLinker(t *testing.T) { } } } + +// BenchmarkAccessorSetFastPath shows the interface fast path +func BenchmarkAccessorSetFastPath(b *testing.B) { + obj := &api.Pod{ + TypeMeta: unversioned.TypeMeta{APIVersion: "/a", Kind: "b"}, + ObjectMeta: api.ObjectMeta{ + Namespace: "bar", + Name: "foo", + GenerateName: "prefix", + UID: "uid", + ResourceVersion: "1", + SelfLink: "some/place/only/we/know", + Labels: map[string]string{"foo": "bar"}, + Annotations: map[string]string{"x": "y"}, + }, + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + acc, err := meta.Accessor(obj) + if err != nil { + b.Fatal(err) + } + acc.SetNamespace("something") + } + b.StopTimer() +} + +// BenchmarkAccessorSetReflection provides a baseline for accessor performance +func BenchmarkAccessorSetReflection(b *testing.B) { + obj := &InternalObject{ + InternalTypeMeta{ + Namespace: "bar", + Name: "foo", + GenerateName: "prefix", + UID: "uid", + APIVersion: "a", + Kind: "b", + ResourceVersion: "1", + SelfLink: "some/place/only/we/know", + Labels: map[string]string{"foo": "bar"}, + Annotations: map[string]string{"x": "y"}, + }, + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + acc, err := meta.Accessor(obj) + if err != nil { + b.Fatal(err) + } + acc.SetNamespace("something") + } + b.StopTimer() +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/multirestmapper.go b/vendor/k8s.io/kubernetes/pkg/api/meta/multirestmapper.go new file mode 100644 index 000000000..4d284e62a --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/multirestmapper.go @@ -0,0 +1,121 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package meta + +import ( + "fmt" + "strings" + + "k8s.io/kubernetes/pkg/api/unversioned" +) + +// MultiRESTMapper is a wrapper for multiple RESTMappers. +type MultiRESTMapper []RESTMapper + +func (m MultiRESTMapper) String() string { + nested := []string{} + for _, t := range m { + currString := fmt.Sprintf("%v", t) + splitStrings := strings.Split(currString, "\n") + nested = append(nested, strings.Join(splitStrings, "\n\t")) + } + + return fmt.Sprintf("MultiRESTMapper{\n\t%s\n}", strings.Join(nested, "\n\t")) +} + +// ResourceSingularizer converts a REST resource name from plural to singular (e.g., from pods to pod) +// This implementation supports multiple REST schemas and return the first match. +func (m MultiRESTMapper) ResourceSingularizer(resource string) (singular string, err error) { + for _, t := range m { + singular, err = t.ResourceSingularizer(resource) + if err == nil { + return + } + } + return +} + +func (m MultiRESTMapper) ResourcesFor(resource unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error) { + for _, t := range m { + gvrs, err := t.ResourcesFor(resource) + // ignore "no match" errors, but any other error percolates back up + if !IsNoResourceMatchError(err) { + return gvrs, err + } + } + return nil, &NoResourceMatchError{PartialResource: resource} +} + +// KindsFor provides the Kind mappings for the REST resources. This implementation supports multiple REST schemas and returns +// the first match. +func (m MultiRESTMapper) KindsFor(resource unversioned.GroupVersionResource) (gvk []unversioned.GroupVersionKind, err error) { + for _, t := range m { + gvks, err := t.KindsFor(resource) + // ignore "no match" errors, but any other error percolates back up + if !IsNoResourceMatchError(err) { + return gvks, err + } + } + return nil, &NoResourceMatchError{PartialResource: resource} +} + +func (m MultiRESTMapper) ResourceFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error) { + for _, t := range m { + gvr, err := t.ResourceFor(resource) + // ignore "no match" errors, but any other error percolates back up + if !IsNoResourceMatchError(err) { + return gvr, err + } + } + return unversioned.GroupVersionResource{}, &NoResourceMatchError{PartialResource: resource} +} + +// KindsFor provides the Kind mapping for the REST resources. This implementation supports multiple REST schemas and returns +// the first match. +func (m MultiRESTMapper) KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) { + for _, t := range m { + gvk, err := t.KindFor(resource) + // ignore "no match" errors, but any other error percolates back up + if !IsNoResourceMatchError(err) { + return gvk, err + } + } + return unversioned.GroupVersionKind{}, &NoResourceMatchError{PartialResource: resource} +} + +// RESTMapping provides the REST mapping for the resource based on the +// kind and version. This implementation supports multiple REST schemas and +// return the first match. +func (m MultiRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (mapping *RESTMapping, err error) { + for _, t := range m { + mapping, err = t.RESTMapping(gk, versions...) + if err == nil { + return + } + } + return +} + +// AliasesForResource finds the first alias response for the provided mappers. +func (m MultiRESTMapper) AliasesForResource(alias string) (aliases []string, ok bool) { + for _, t := range m { + if aliases, ok = t.AliasesForResource(alias); ok { + return + } + } + return nil, false +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/multirestmapper_test.go b/vendor/k8s.io/kubernetes/pkg/api/meta/multirestmapper_test.go new file mode 100644 index 000000000..c4d543115 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/multirestmapper_test.go @@ -0,0 +1,238 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package meta + +import ( + "errors" + "reflect" + "testing" + + "k8s.io/kubernetes/pkg/api/unversioned" +) + +func TestMultiRESTMapperResourceForErrorHandling(t *testing.T) { + tcs := []struct { + name string + + mapper MultiRESTMapper + input unversioned.GroupVersionResource + result unversioned.GroupVersionResource + err error + }{ + { + name: "empty", + mapper: MultiRESTMapper{}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: unversioned.GroupVersionResource{}, + err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "foo"}}, + }, + { + name: "ignore not found", + mapper: MultiRESTMapper{fixedRESTMapper{err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "IGNORE_THIS"}}}}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: unversioned.GroupVersionResource{}, + err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "foo"}}, + }, + { + name: "accept first failure", + mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{resourceFor: unversioned.GroupVersionResource{Resource: "unused"}}}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: unversioned.GroupVersionResource{}, + err: errors.New("fail on this"), + }, + } + + for _, tc := range tcs { + actualResult, actualErr := tc.mapper.ResourceFor(tc.input) + if e, a := tc.result, actualResult; e != a { + t.Errorf("%s: expected %v, got %v", tc.name, e, a) + } + if e, a := tc.err.Error(), actualErr.Error(); e != a { + t.Errorf("%s: expected %v, got %v", tc.name, e, a) + } + } +} + +func TestMultiRESTMapperResourcesForErrorHandling(t *testing.T) { + tcs := []struct { + name string + + mapper MultiRESTMapper + input unversioned.GroupVersionResource + result []unversioned.GroupVersionResource + err error + }{ + { + name: "empty", + mapper: MultiRESTMapper{}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: nil, + err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "foo"}}, + }, + { + name: "ignore not found", + mapper: MultiRESTMapper{fixedRESTMapper{err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "IGNORE_THIS"}}}}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: nil, + err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "foo"}}, + }, + { + name: "accept first failure", + mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{resourcesFor: []unversioned.GroupVersionResource{{Resource: "unused"}}}}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: nil, + err: errors.New("fail on this"), + }, + } + + for _, tc := range tcs { + actualResult, actualErr := tc.mapper.ResourcesFor(tc.input) + if e, a := tc.result, actualResult; !reflect.DeepEqual(e, a) { + t.Errorf("%s: expected %v, got %v", tc.name, e, a) + } + if e, a := tc.err.Error(), actualErr.Error(); e != a { + t.Errorf("%s: expected %v, got %v", tc.name, e, a) + } + } +} + +func TestMultiRESTMapperKindsForErrorHandling(t *testing.T) { + tcs := []struct { + name string + + mapper MultiRESTMapper + input unversioned.GroupVersionResource + result []unversioned.GroupVersionKind + err error + }{ + { + name: "empty", + mapper: MultiRESTMapper{}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: nil, + err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "foo"}}, + }, + { + name: "ignore not found", + mapper: MultiRESTMapper{fixedRESTMapper{err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "IGNORE_THIS"}}}}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: nil, + err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "foo"}}, + }, + { + name: "accept first failure", + mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{kindsFor: []unversioned.GroupVersionKind{{Kind: "unused"}}}}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: nil, + err: errors.New("fail on this"), + }, + } + + for _, tc := range tcs { + actualResult, actualErr := tc.mapper.KindsFor(tc.input) + if e, a := tc.result, actualResult; !reflect.DeepEqual(e, a) { + t.Errorf("%s: expected %v, got %v", tc.name, e, a) + } + if e, a := tc.err.Error(), actualErr.Error(); e != a { + t.Errorf("%s: expected %v, got %v", tc.name, e, a) + } + } +} + +func TestMultiRESTMapperKindForErrorHandling(t *testing.T) { + tcs := []struct { + name string + + mapper MultiRESTMapper + input unversioned.GroupVersionResource + result unversioned.GroupVersionKind + err error + }{ + { + name: "empty", + mapper: MultiRESTMapper{}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: unversioned.GroupVersionKind{}, + err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "foo"}}, + }, + { + name: "ignore not found", + mapper: MultiRESTMapper{fixedRESTMapper{err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "IGNORE_THIS"}}}}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: unversioned.GroupVersionKind{}, + err: &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "foo"}}, + }, + { + name: "accept first failure", + mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{kindFor: unversioned.GroupVersionKind{Kind: "unused"}}}, + input: unversioned.GroupVersionResource{Resource: "foo"}, + result: unversioned.GroupVersionKind{}, + err: errors.New("fail on this"), + }, + } + + for _, tc := range tcs { + actualResult, actualErr := tc.mapper.KindFor(tc.input) + if e, a := tc.result, actualResult; e != a { + t.Errorf("%s: expected %v, got %v", tc.name, e, a) + } + if e, a := tc.err.Error(), actualErr.Error(); e != a { + t.Errorf("%s: expected %v, got %v", tc.name, e, a) + } + } +} + +type fixedRESTMapper struct { + resourcesFor []unversioned.GroupVersionResource + kindsFor []unversioned.GroupVersionKind + resourceFor unversioned.GroupVersionResource + kindFor unversioned.GroupVersionKind + + err error +} + +func (m fixedRESTMapper) ResourceSingularizer(resource string) (singular string, err error) { + return "", m.err +} + +func (m fixedRESTMapper) ResourcesFor(resource unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error) { + return m.resourcesFor, m.err +} + +func (m fixedRESTMapper) KindsFor(resource unversioned.GroupVersionResource) (gvk []unversioned.GroupVersionKind, err error) { + return m.kindsFor, m.err +} + +func (m fixedRESTMapper) ResourceFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error) { + return m.resourceFor, m.err +} + +func (m fixedRESTMapper) KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) { + return m.kindFor, m.err +} + +func (m fixedRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (mapping *RESTMapping, err error) { + return nil, m.err +} + +func (m fixedRESTMapper) AliasesForResource(alias string) (aliases []string, ok bool) { + return nil, false +} + +func (m fixedRESTMapper) ResourceIsValid(resource unversioned.GroupVersionResource) bool { + return false +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/restmapper.go b/vendor/k8s.io/kubernetes/pkg/api/meta/restmapper.go index ab389b934..7b1856bc4 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/meta/restmapper.go +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/restmapper.go @@ -19,7 +19,12 @@ package meta import ( "fmt" + "sort" "strings" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/sets" ) // Implements RESTScope interface @@ -54,13 +59,6 @@ var RESTScopeRoot = &restScope{ name: RESTScopeNameRoot, } -// typeMeta is used as a key for lookup in the mapping between REST path and -// API object. -type typeMeta struct { - APIVersion string - Kind string -} - // DefaultRESTMapper exposes mappings between the types defined in a // runtime.Scheme. It assumes that all types defined the provided scheme // can be mapped with the provided MetadataAccessor and Codec interfaces. @@ -72,190 +70,433 @@ type typeMeta struct { // // TODO: Only accept plural for some operations for increased control? // (`get pod bar` vs `get pods bar`) +// TODO these maps should be keyed based on GroupVersionKinds type DefaultRESTMapper struct { - mapping map[string]typeMeta - reverse map[typeMeta]string - scopes map[typeMeta]RESTScope - group string - versions []string - plurals map[string]string - singulars map[string]string + defaultGroupVersions []unversioned.GroupVersion + + resourceToKind map[unversioned.GroupVersionResource]unversioned.GroupVersionKind + kindToPluralResource map[unversioned.GroupVersionKind]unversioned.GroupVersionResource + kindToScope map[unversioned.GroupVersionKind]RESTScope + singularToPlural map[unversioned.GroupVersionResource]unversioned.GroupVersionResource + pluralToSingular map[unversioned.GroupVersionResource]unversioned.GroupVersionResource + interfacesFunc VersionInterfacesFunc } -// VersionInterfacesFunc returns the appropriate codec, typer, and metadata accessor for a +func (m *DefaultRESTMapper) String() string { + return fmt.Sprintf("DefaultRESTMapper{kindToPluralResource=%v}", m.kindToPluralResource) +} + +var _ RESTMapper = &DefaultRESTMapper{} + +// VersionInterfacesFunc returns the appropriate typer, and metadata accessor for a // given api version, or an error if no such api version exists. -type VersionInterfacesFunc func(apiVersion string) (*VersionInterfaces, error) +type VersionInterfacesFunc func(version unversioned.GroupVersion) (*VersionInterfaces, error) // NewDefaultRESTMapper initializes a mapping between Kind and APIVersion // to a resource name and back based on the objects in a runtime.Scheme // and the Kubernetes API conventions. Takes a group name, a priority list of the versions // to search when an object has no default version (set empty to return an error), -// and a function that retrieves the correct codec and metadata for a given version. -func NewDefaultRESTMapper(group string, versions []string, f VersionInterfacesFunc) *DefaultRESTMapper { - mapping := make(map[string]typeMeta) - reverse := make(map[typeMeta]string) - scopes := make(map[typeMeta]RESTScope) - plurals := make(map[string]string) - singulars := make(map[string]string) +// and a function that retrieves the correct metadata for a given version. +func NewDefaultRESTMapper(defaultGroupVersions []unversioned.GroupVersion, f VersionInterfacesFunc) *DefaultRESTMapper { + resourceToKind := make(map[unversioned.GroupVersionResource]unversioned.GroupVersionKind) + kindToPluralResource := make(map[unversioned.GroupVersionKind]unversioned.GroupVersionResource) + kindToScope := make(map[unversioned.GroupVersionKind]RESTScope) + singularToPlural := make(map[unversioned.GroupVersionResource]unversioned.GroupVersionResource) + pluralToSingular := make(map[unversioned.GroupVersionResource]unversioned.GroupVersionResource) // TODO: verify name mappings work correctly when versions differ return &DefaultRESTMapper{ - mapping: mapping, - reverse: reverse, - scopes: scopes, - group: group, - versions: versions, - plurals: plurals, - singulars: singulars, - interfacesFunc: f, + resourceToKind: resourceToKind, + kindToPluralResource: kindToPluralResource, + kindToScope: kindToScope, + defaultGroupVersions: defaultGroupVersions, + singularToPlural: singularToPlural, + pluralToSingular: pluralToSingular, + interfacesFunc: f, } } -func (m *DefaultRESTMapper) Add(scope RESTScope, kind string, version string, mixedCase bool) { - plural, singular := KindToResource(kind, mixedCase) - m.plurals[singular] = plural - m.singulars[plural] = singular - meta := typeMeta{APIVersion: version, Kind: kind} - _, ok1 := m.mapping[plural] - _, ok2 := m.mapping[strings.ToLower(plural)] - if !ok1 && !ok2 { - m.mapping[plural] = meta - m.mapping[singular] = meta - if strings.ToLower(plural) != plural { - m.mapping[strings.ToLower(plural)] = meta - m.mapping[strings.ToLower(singular)] = meta - } - } - m.reverse[meta] = plural - m.scopes[meta] = scope +func (m *DefaultRESTMapper) Add(kind unversioned.GroupVersionKind, scope RESTScope) { + plural, singular := KindToResource(kind) + + m.singularToPlural[singular] = plural + m.pluralToSingular[plural] = singular + + m.resourceToKind[singular] = kind + m.resourceToKind[plural] = kind + + m.kindToPluralResource[kind] = plural + m.kindToScope[kind] = scope +} + +// unpluralizedSuffixes is a list of resource suffixes that are the same plural and singular +// This is only is only necessary because some bits of code are lazy and don't actually use the RESTMapper like they should. +// TODO eliminate this so that different callers can correctly map to resources. This probably means updating all +// callers to use the RESTMapper they mean. +var unpluralizedSuffixes = []string{ + "endpoints", } // KindToResource converts Kind to a resource name. -func KindToResource(kind string, mixedCase bool) (plural, singular string) { - if len(kind) == 0 { - return +func KindToResource(kind unversioned.GroupVersionKind) ( /*plural*/ unversioned.GroupVersionResource /*singular*/, unversioned.GroupVersionResource) { + kindName := kind.Kind + if len(kindName) == 0 { + return unversioned.GroupVersionResource{}, unversioned.GroupVersionResource{} } - if mixedCase { - // Legacy support for mixed case names - singular = strings.ToLower(kind[:1]) + kind[1:] - } else { - singular = strings.ToLower(kind) - } - if strings.HasSuffix(singular, "status") { - plural = singular + "es" - } else { - switch string(singular[len(singular)-1]) { - case "s": - plural = singular - case "y": - plural = strings.TrimSuffix(singular, "y") + "ies" - default: - plural = singular + "s" + singularName := strings.ToLower(kindName) + singular := kind.GroupVersion().WithResource(singularName) + + for _, skip := range unpluralizedSuffixes { + if strings.HasSuffix(singularName, skip) { + return singular, singular } } - return + + switch string(singularName[len(singularName)-1]) { + case "s": + return kind.GroupVersion().WithResource(singularName + "es"), singular + case "y": + return kind.GroupVersion().WithResource(strings.TrimSuffix(singularName, "y") + "ies"), singular + } + + return kind.GroupVersion().WithResource(singularName + "s"), singular } // ResourceSingularizer implements RESTMapper // It converts a resource name from plural to singular (e.g., from pods to pod) -func (m *DefaultRESTMapper) ResourceSingularizer(resource string) (singular string, err error) { - singular, ok := m.singulars[resource] - if !ok { - return resource, fmt.Errorf("no singular of resource %q has been defined", resource) +func (m *DefaultRESTMapper) ResourceSingularizer(resourceType string) (string, error) { + partialResource := unversioned.GroupVersionResource{Resource: resourceType} + resources, err := m.ResourcesFor(partialResource) + if err != nil { + return resourceType, err } - return singular, nil -} -// VersionAndKindForResource implements RESTMapper -func (m *DefaultRESTMapper) VersionAndKindForResource(resource string) (defaultVersion, kind string, err error) { - if parts := strings.Split(resource, "/"); len(parts) > 1 { - if len(parts) > 2 { - return "", "", fmt.Errorf("resource %q has an invalid name", resource) + singular := unversioned.GroupVersionResource{} + for _, curr := range resources { + currSingular, ok := m.pluralToSingular[curr] + if !ok { + continue } - resource = parts[1] - if m.group != parts[0] { - return "", "", fmt.Errorf("no resource %q is defined for group %q", resource, m.group) + if singular.IsEmpty() { + singular = currSingular + continue + } + + if currSingular.Resource != singular.Resource { + return resourceType, fmt.Errorf("multiple possibile singular resources (%v) found for %v", resources, resourceType) } } - meta, ok := m.mapping[strings.ToLower(resource)] - if !ok { - return "", "", fmt.Errorf("no resource %q has been defined", resource) + + if singular.IsEmpty() { + return resourceType, fmt.Errorf("no singular of resource %v has been defined", resourceType) } - return meta.APIVersion, meta.Kind, nil + + return singular.Resource, nil } -func (m *DefaultRESTMapper) GroupForResource(resource string) (string, error) { - if _, ok := m.mapping[strings.ToLower(resource)]; !ok { - return "", fmt.Errorf("no resource %q has been defined", resource) +func (m *DefaultRESTMapper) ResourcesFor(resource unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error) { + hasResource := len(resource.Resource) > 0 + hasGroup := len(resource.Group) > 0 + hasVersion := len(resource.Version) > 0 + + if !hasResource { + return nil, fmt.Errorf("a resource must be present, got: %v", resource) } - return m.group, nil + + ret := []unversioned.GroupVersionResource{} + switch { + // fully qualified. Find the exact match + case hasGroup && hasVersion: + for plural, singular := range m.pluralToSingular { + if singular == resource { + ret = append(ret, plural) + break + } + if plural == resource { + ret = append(ret, plural) + break + } + } + + case hasGroup: + requestedGroupResource := resource.GroupResource() + for plural, singular := range m.pluralToSingular { + if singular.GroupResource() == requestedGroupResource { + ret = append(ret, plural) + } + if plural.GroupResource() == requestedGroupResource { + ret = append(ret, plural) + } + } + + case hasVersion: + for plural, singular := range m.pluralToSingular { + if singular.Version == resource.Version && singular.Resource == resource.Resource { + ret = append(ret, plural) + } + if plural.Version == resource.Version && plural.Resource == resource.Resource { + ret = append(ret, plural) + } + } + + default: + for plural, singular := range m.pluralToSingular { + if singular.Resource == resource.Resource { + ret = append(ret, plural) + } + if plural.Resource == resource.Resource { + ret = append(ret, plural) + } + } + } + + if len(ret) == 0 { + return nil, &NoResourceMatchError{PartialResource: resource} + } + + sort.Sort(resourceByPreferredGroupVersion{ret, m.defaultGroupVersions}) + return ret, nil +} + +func (m *DefaultRESTMapper) ResourceFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error) { + resources, err := m.ResourcesFor(resource) + if err != nil { + return unversioned.GroupVersionResource{}, err + } + if len(resources) == 1 { + return resources[0], nil + } + + return unversioned.GroupVersionResource{}, &AmbiguousResourceError{PartialResource: resource, MatchingResources: resources} +} + +func (m *DefaultRESTMapper) KindsFor(input unversioned.GroupVersionResource) ([]unversioned.GroupVersionKind, error) { + resource := input.GroupVersion().WithResource(strings.ToLower(input.Resource)) + if resource.Version == runtime.APIVersionInternal { + resource.Version = "" + } + + hasResource := len(resource.Resource) > 0 + hasGroup := len(resource.Group) > 0 + hasVersion := len(resource.Version) > 0 + + if !hasResource { + return nil, fmt.Errorf("a resource must be present, got: %v", resource) + } + + ret := []unversioned.GroupVersionKind{} + switch { + // fully qualified. Find the exact match + case hasGroup && hasVersion: + kind, exists := m.resourceToKind[resource] + if exists { + ret = append(ret, kind) + } + + case hasGroup: + requestedGroupResource := resource.GroupResource() + for currResource, currKind := range m.resourceToKind { + if currResource.GroupResource() == requestedGroupResource { + ret = append(ret, currKind) + } + } + + case hasVersion: + for currResource, currKind := range m.resourceToKind { + if currResource.Version == resource.Version && currResource.Resource == resource.Resource { + ret = append(ret, currKind) + } + } + + default: + for currResource, currKind := range m.resourceToKind { + if currResource.Resource == resource.Resource { + ret = append(ret, currKind) + } + } + } + + if len(ret) == 0 { + return nil, &NoResourceMatchError{PartialResource: input} + } + + sort.Sort(kindByPreferredGroupVersion{ret, m.defaultGroupVersions}) + return ret, nil +} + +func (m *DefaultRESTMapper) KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) { + kinds, err := m.KindsFor(resource) + if err != nil { + return unversioned.GroupVersionKind{}, err + } + + // TODO for each group, choose the most preferred (first) version. This keeps us consistent with code today. + // eventually, we'll need a RESTMapper that is aware of what's available server-side and deconflicts that with + // user preferences + oneKindPerGroup := []unversioned.GroupVersionKind{} + groupsAdded := sets.String{} + for _, kind := range kinds { + if groupsAdded.Has(kind.Group) { + continue + } + + oneKindPerGroup = append(oneKindPerGroup, kind) + groupsAdded.Insert(kind.Group) + } + + if len(oneKindPerGroup) == 1 { + return oneKindPerGroup[0], nil + } + + return unversioned.GroupVersionKind{}, &AmbiguousResourceError{PartialResource: resource, MatchingKinds: kinds} +} + +type kindByPreferredGroupVersion struct { + list []unversioned.GroupVersionKind + sortOrder []unversioned.GroupVersion +} + +func (o kindByPreferredGroupVersion) Len() int { return len(o.list) } +func (o kindByPreferredGroupVersion) Swap(i, j int) { o.list[i], o.list[j] = o.list[j], o.list[i] } +func (o kindByPreferredGroupVersion) Less(i, j int) bool { + lhs := o.list[i] + rhs := o.list[j] + if lhs == rhs { + return false + } + + if lhs.GroupVersion() == rhs.GroupVersion() { + return lhs.Kind < rhs.Kind + } + + // otherwise, the difference is in the GroupVersion, so we need to sort with respect to the preferred order + lhsIndex := -1 + rhsIndex := -1 + + for i := range o.sortOrder { + if o.sortOrder[i] == lhs.GroupVersion() { + lhsIndex = i + } + if o.sortOrder[i] == rhs.GroupVersion() { + rhsIndex = i + } + } + + if rhsIndex == -1 { + return true + } + + return lhsIndex < rhsIndex +} + +type resourceByPreferredGroupVersion struct { + list []unversioned.GroupVersionResource + sortOrder []unversioned.GroupVersion +} + +func (o resourceByPreferredGroupVersion) Len() int { return len(o.list) } +func (o resourceByPreferredGroupVersion) Swap(i, j int) { o.list[i], o.list[j] = o.list[j], o.list[i] } +func (o resourceByPreferredGroupVersion) Less(i, j int) bool { + lhs := o.list[i] + rhs := o.list[j] + if lhs == rhs { + return false + } + + if lhs.GroupVersion() == rhs.GroupVersion() { + return lhs.Resource < rhs.Resource + } + + // otherwise, the difference is in the GroupVersion, so we need to sort with respect to the preferred order + lhsIndex := -1 + rhsIndex := -1 + + for i := range o.sortOrder { + if o.sortOrder[i] == lhs.GroupVersion() { + lhsIndex = i + } + if o.sortOrder[i] == rhs.GroupVersion() { + rhsIndex = i + } + } + + if rhsIndex == -1 { + return true + } + + return lhsIndex < rhsIndex } // RESTMapping returns a struct representing the resource path and conversion interfaces a -// RESTClient should use to operate on the provided kind in order of versions. If a version search +// RESTClient should use to operate on the provided group/kind in order of versions. If a version search // order is not provided, the search order provided to DefaultRESTMapper will be used to resolve which -// APIVersion should be used to access the named kind. -func (m *DefaultRESTMapper) RESTMapping(kind string, versions ...string) (*RESTMapping, error) { +// version should be used to access the named group/kind. +func (m *DefaultRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (*RESTMapping, error) { // Pick an appropriate version - var version string + var gvk *unversioned.GroupVersionKind hadVersion := false - for _, v := range versions { - if len(v) == 0 { + for _, version := range versions { + if len(version) == 0 || version == runtime.APIVersionInternal { continue } + + currGVK := gk.WithVersion(version) hadVersion = true - if _, ok := m.reverse[typeMeta{APIVersion: v, Kind: kind}]; ok { - version = v + if _, ok := m.kindToPluralResource[currGVK]; ok { + gvk = &currGVK break } } // Use the default preferred versions - if !hadVersion && len(version) == 0 { - for _, v := range m.versions { - if _, ok := m.reverse[typeMeta{APIVersion: v, Kind: kind}]; ok { - version = v + if !hadVersion && (gvk == nil) { + for _, gv := range m.defaultGroupVersions { + if gv.Group != gk.Group { + continue + } + + currGVK := gk.WithVersion(gv.Version) + if _, ok := m.kindToPluralResource[currGVK]; ok { + gvk = &currGVK break } } } - if len(version) == 0 { - return nil, fmt.Errorf("no kind named %q is registered in versions %q", kind, versions) + if gvk == nil { + return nil, fmt.Errorf("no kind named %q is registered in versions %q", gk, versions) } // Ensure we have a REST mapping - resource, ok := m.reverse[typeMeta{APIVersion: version, Kind: kind}] + resource, ok := m.kindToPluralResource[*gvk] if !ok { - found := []string{} - for _, v := range m.versions { - if _, ok := m.reverse[typeMeta{APIVersion: v, Kind: kind}]; ok { - found = append(found, v) + found := []unversioned.GroupVersion{} + for _, gv := range m.defaultGroupVersions { + if _, ok := m.kindToPluralResource[*gvk]; ok { + found = append(found, gv) } } if len(found) > 0 { - return nil, fmt.Errorf("object with kind %q exists in versions %q, not %q", kind, strings.Join(found, ", "), version) + return nil, fmt.Errorf("object with kind %q exists in versions %v, not %v", gvk.Kind, found, gvk.GroupVersion().String()) } - return nil, fmt.Errorf("the provided version %q and kind %q cannot be mapped to a supported object", version, kind) + return nil, fmt.Errorf("the provided version %q and kind %q cannot be mapped to a supported object", gvk.GroupVersion().String(), gvk.Kind) } // Ensure we have a REST scope - scope, ok := m.scopes[typeMeta{APIVersion: version, Kind: kind}] + scope, ok := m.kindToScope[*gvk] if !ok { - return nil, fmt.Errorf("the provided version %q and kind %q cannot be mapped to a supported scope", version, kind) + return nil, fmt.Errorf("the provided version %q and kind %q cannot be mapped to a supported scope", gvk.GroupVersion().String(), gvk.Kind) } - interfaces, err := m.interfacesFunc(version) + interfaces, err := m.interfacesFunc(gvk.GroupVersion()) if err != nil { - return nil, fmt.Errorf("the provided version %q has no relevant versions", version) + return nil, fmt.Errorf("the provided version %q has no relevant versions", gvk.GroupVersion().String()) } retVal := &RESTMapping{ - Resource: resource, - APIVersion: version, - Kind: kind, - Scope: scope, + Resource: resource.Resource, + GroupVersionKind: *gvk, + Scope: scope, - Codec: interfaces.Codec, ObjectConvertor: interfaces.ObjectConvertor, MetadataAccessor: interfaces.MetadataAccessor, } @@ -281,82 +522,3 @@ func (m *DefaultRESTMapper) AliasesForResource(alias string) ([]string, bool) { } return nil, false } - -// ResourceIsValid takes a string (kind) and checks if it's a valid resource -func (m *DefaultRESTMapper) ResourceIsValid(resource string) bool { - _, _, err := m.VersionAndKindForResource(resource) - return err == nil -} - -// MultiRESTMapper is a wrapper for multiple RESTMappers. -type MultiRESTMapper []RESTMapper - -// ResourceSingularizer converts a REST resource name from plural to singular (e.g., from pods to pod) -// This implementation supports multiple REST schemas and return the first match. -func (m MultiRESTMapper) ResourceSingularizer(resource string) (singular string, err error) { - for _, t := range m { - singular, err = t.ResourceSingularizer(resource) - if err == nil { - return - } - } - return -} - -// VersionAndKindForResource provides the Version and Kind mappings for the -// REST resources. This implementation supports multiple REST schemas and return -// the first match. -func (m MultiRESTMapper) VersionAndKindForResource(resource string) (defaultVersion, kind string, err error) { - for _, t := range m { - defaultVersion, kind, err = t.VersionAndKindForResource(resource) - if err == nil { - return - } - } - return -} - -// GroupForResource provides the Group mappings for the REST resources. This -// implementation supports multiple REST schemas and returns the first match. -func (m MultiRESTMapper) GroupForResource(resource string) (group string, err error) { - for _, t := range m { - group, err = t.GroupForResource(resource) - if err == nil { - return - } - } - return -} - -// RESTMapping provides the REST mapping for the resource based on the resource -// kind and version. This implementation supports multiple REST schemas and -// return the first match. -func (m MultiRESTMapper) RESTMapping(kind string, versions ...string) (mapping *RESTMapping, err error) { - for _, t := range m { - mapping, err = t.RESTMapping(kind, versions...) - if err == nil { - return - } - } - return -} - -// AliasesForResource finds the first alias response for the provided mappers. -func (m MultiRESTMapper) AliasesForResource(alias string) (aliases []string, ok bool) { - for _, t := range m { - if aliases, ok = t.AliasesForResource(alias); ok { - return - } - } - return nil, false -} - -// ResourceIsValid takes a string (either group/kind or kind) and checks if it's a valid resource -func (m MultiRESTMapper) ResourceIsValid(resource string) bool { - for _, t := range m { - if t.ResourceIsValid(resource) { - return true - } - } - return false -} diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta/restmapper_test.go b/vendor/k8s.io/kubernetes/pkg/api/meta/restmapper_test.go index 40a52b5ce..8f494d0a6 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/meta/restmapper_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/meta/restmapper_test.go @@ -18,38 +18,14 @@ package meta import ( "errors" - "io" + "reflect" + "strings" "testing" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" ) -type fakeCodec struct{} - -func (fakeCodec) Encode(runtime.Object) ([]byte, error) { - return []byte{}, nil -} - -func (fakeCodec) EncodeToStream(runtime.Object, io.Writer) error { - return nil -} - -func (fakeCodec) Decode([]byte) (runtime.Object, error) { - return nil, nil -} - -func (fakeCodec) DecodeToVersion([]byte, string) (runtime.Object, error) { - return nil, nil -} - -func (fakeCodec) DecodeInto([]byte, runtime.Object) error { - return nil -} - -func (fakeCodec) DecodeIntoWithSpecifiedVersionKind([]byte, runtime.Object, string, string) error { - return nil -} - type fakeConvertor struct{} func (fakeConvertor) Convert(in, out interface{}) error { @@ -64,77 +40,313 @@ func (fakeConvertor) ConvertFieldLabel(version, kind, label, value string) (stri return label, value, nil } -var validCodec = fakeCodec{} var validAccessor = resourceAccessor{} var validConvertor = fakeConvertor{} -func fakeInterfaces(version string) (*VersionInterfaces, error) { - return &VersionInterfaces{Codec: validCodec, ObjectConvertor: validConvertor, MetadataAccessor: validAccessor}, nil +func fakeInterfaces(version unversioned.GroupVersion) (*VersionInterfaces, error) { + return &VersionInterfaces{ObjectConvertor: validConvertor, MetadataAccessor: validAccessor}, nil } var unmatchedErr = errors.New("no version") -func unmatchedVersionInterfaces(version string) (*VersionInterfaces, error) { +func unmatchedVersionInterfaces(version unversioned.GroupVersion) (*VersionInterfaces, error) { return nil, unmatchedErr } func TestRESTMapperVersionAndKindForResource(t *testing.T) { + testGroup := "test.group" + testVersion := "test" + testGroupVersion := unversioned.GroupVersion{Group: testGroup, Version: testVersion} + testCases := []struct { - Resource string - Kind, APIVersion string - MixedCase bool - Err bool + Resource unversioned.GroupVersionResource + GroupVersionToRegister unversioned.GroupVersion + ExpectedGVK unversioned.GroupVersionKind + Err bool }{ - {Resource: "internalobjec", Err: true}, - {Resource: "internalObjec", Err: true}, + {Resource: unversioned.GroupVersionResource{Resource: "internalobjec"}, Err: true}, + {Resource: unversioned.GroupVersionResource{Resource: "internalObjec"}, Err: true}, - {Resource: "internalobject", Kind: "InternalObject", APIVersion: "test"}, - {Resource: "internalobjects", Kind: "InternalObject", APIVersion: "test"}, - - {Resource: "internalobject", MixedCase: true, Kind: "InternalObject", APIVersion: "test"}, - {Resource: "internalobjects", MixedCase: true, Kind: "InternalObject", APIVersion: "test"}, - - {Resource: "internalObject", MixedCase: true, Kind: "InternalObject", APIVersion: "test"}, - {Resource: "internalObjects", MixedCase: true, Kind: "InternalObject", APIVersion: "test"}, + {Resource: unversioned.GroupVersionResource{Resource: "internalobject"}, ExpectedGVK: testGroupVersion.WithKind("InternalObject")}, + {Resource: unversioned.GroupVersionResource{Resource: "internalobjects"}, ExpectedGVK: testGroupVersion.WithKind("InternalObject")}, } for i, testCase := range testCases { - mapper := NewDefaultRESTMapper("tgroup", []string{"test"}, fakeInterfaces) - mapper.Add(RESTScopeNamespace, testCase.Kind, testCase.APIVersion, testCase.MixedCase) - v, k, err := mapper.VersionAndKindForResource(testCase.Resource) + mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{testGroupVersion}, fakeInterfaces) + if len(testCase.ExpectedGVK.Kind) != 0 { + mapper.Add(testCase.ExpectedGVK, RESTScopeNamespace) + } + actualGVK, err := mapper.KindFor(testCase.Resource) + hasErr := err != nil if hasErr != testCase.Err { t.Errorf("%d: unexpected error behavior %t: %v", i, testCase.Err, err) continue } - if v != testCase.APIVersion || k != testCase.Kind { - t.Errorf("%d: unexpected version and kind: %s %s", i, v, k) + if err != nil { + continue + } + + if actualGVK != testCase.ExpectedGVK { + t.Errorf("%d: unexpected version and kind: e=%s a=%s", i, testCase.ExpectedGVK, actualGVK) } } } func TestRESTMapperGroupForResource(t *testing.T) { testCases := []struct { - Resource string - Kind, APIVersion, Group string - Err bool + Resource unversioned.GroupVersionResource + GroupVersionKind unversioned.GroupVersionKind + Err bool }{ - {Resource: "myObject", Kind: "MyObject", APIVersion: "test", Group: "testapi"}, - {Resource: "myobject", Kind: "MyObject", APIVersion: "test", Group: "testapi2"}, - {Resource: "myObje", Err: true, Kind: "MyObject", APIVersion: "test", Group: "testapi"}, - {Resource: "myobje", Err: true, Kind: "MyObject", APIVersion: "test", Group: "testapi"}, + {Resource: unversioned.GroupVersionResource{Resource: "myObject"}, GroupVersionKind: unversioned.GroupVersionKind{Group: "testapi", Version: "test", Kind: "MyObject"}}, + {Resource: unversioned.GroupVersionResource{Resource: "myobject"}, GroupVersionKind: unversioned.GroupVersionKind{Group: "testapi2", Version: "test", Kind: "MyObject"}}, + {Resource: unversioned.GroupVersionResource{Resource: "myObje"}, Err: true, GroupVersionKind: unversioned.GroupVersionKind{Group: "testapi", Version: "test", Kind: "MyObject"}}, + {Resource: unversioned.GroupVersionResource{Resource: "myobje"}, Err: true, GroupVersionKind: unversioned.GroupVersionKind{Group: "testapi", Version: "test", Kind: "MyObject"}}, } for i, testCase := range testCases { - mapper := NewDefaultRESTMapper(testCase.Group, []string{"test"}, fakeInterfaces) - mapper.Add(RESTScopeNamespace, testCase.Kind, testCase.APIVersion, false) - g, err := mapper.GroupForResource(testCase.Resource) + mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{testCase.GroupVersionKind.GroupVersion()}, fakeInterfaces) + mapper.Add(testCase.GroupVersionKind, RESTScopeNamespace) + + actualGVK, err := mapper.KindFor(testCase.Resource) if testCase.Err { if err == nil { t.Errorf("%d: expected error", i) } } else if err != nil { t.Errorf("%d: unexpected error: %v", i, err) - } else if g != testCase.Group { - t.Errorf("%d: expected group %q, got %q", i, testCase.Group, g) + } else if actualGVK != testCase.GroupVersionKind { + t.Errorf("%d: expected group %q, got %q", i, testCase.GroupVersionKind, actualGVK) + } + } +} + +func TestRESTMapperKindsFor(t *testing.T) { + testCases := []struct { + Name string + PreferredOrder []unversioned.GroupVersion + KindsToRegister []unversioned.GroupVersionKind + PartialResourceToRequest unversioned.GroupVersionResource + + ExpectedKinds []unversioned.GroupVersionKind + ExpectedKindErr string + }{ + { + Name: "ambiguous groups, with preference order", + PreferredOrder: []unversioned.GroupVersion{ + {Group: "second-group", Version: "first-version"}, + {Group: "first-group", Version: "first-version"}, + }, + KindsToRegister: []unversioned.GroupVersionKind{ + {Group: "first-group", Version: "first-version", Kind: "my-kind"}, + {Group: "first-group", Version: "first-version", Kind: "your-kind"}, + {Group: "second-group", Version: "first-version", Kind: "my-kind"}, + {Group: "second-group", Version: "first-version", Kind: "your-kind"}, + }, + PartialResourceToRequest: unversioned.GroupVersionResource{Resource: "my-kinds"}, + + ExpectedKinds: []unversioned.GroupVersionKind{ + {Group: "second-group", Version: "first-version", Kind: "my-kind"}, + {Group: "first-group", Version: "first-version", Kind: "my-kind"}, + }, + ExpectedKindErr: " matches multiple kinds ", + }, + + { + Name: "ambiguous groups, with explicit group match", + PreferredOrder: []unversioned.GroupVersion{ + {Group: "second-group", Version: "first-version"}, + {Group: "first-group", Version: "first-version"}, + }, + KindsToRegister: []unversioned.GroupVersionKind{ + {Group: "first-group", Version: "first-version", Kind: "my-kind"}, + {Group: "first-group", Version: "first-version", Kind: "your-kind"}, + {Group: "second-group", Version: "first-version", Kind: "my-kind"}, + {Group: "second-group", Version: "first-version", Kind: "your-kind"}, + }, + PartialResourceToRequest: unversioned.GroupVersionResource{Group: "first-group", Resource: "my-kinds"}, + + ExpectedKinds: []unversioned.GroupVersionKind{ + {Group: "first-group", Version: "first-version", Kind: "my-kind"}, + }, + }, + + { + Name: "ambiguous groups, with ambiguous version match", + PreferredOrder: []unversioned.GroupVersion{ + {Group: "first-group", Version: "first-version"}, + {Group: "second-group", Version: "first-version"}, + }, + KindsToRegister: []unversioned.GroupVersionKind{ + {Group: "first-group", Version: "first-version", Kind: "my-kind"}, + {Group: "first-group", Version: "first-version", Kind: "your-kind"}, + {Group: "second-group", Version: "first-version", Kind: "my-kind"}, + {Group: "second-group", Version: "first-version", Kind: "your-kind"}, + }, + PartialResourceToRequest: unversioned.GroupVersionResource{Version: "first-version", Resource: "my-kinds"}, + + ExpectedKinds: []unversioned.GroupVersionKind{ + {Group: "first-group", Version: "first-version", Kind: "my-kind"}, + {Group: "second-group", Version: "first-version", Kind: "my-kind"}, + }, + ExpectedKindErr: " matches multiple kinds ", + }, + } + for _, testCase := range testCases { + tcName := testCase.Name + mapper := NewDefaultRESTMapper(testCase.PreferredOrder, fakeInterfaces) + for _, kind := range testCase.KindsToRegister { + mapper.Add(kind, RESTScopeNamespace) + } + + actualKinds, err := mapper.KindsFor(testCase.PartialResourceToRequest) + if err != nil { + t.Errorf("%s: unexpected error: %v", tcName, err) + continue + } + if !reflect.DeepEqual(testCase.ExpectedKinds, actualKinds) { + t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedKinds, actualKinds) + } + + singleKind, err := mapper.KindFor(testCase.PartialResourceToRequest) + if err == nil && len(testCase.ExpectedKindErr) != 0 { + t.Errorf("%s: expected error: %v", tcName, testCase.ExpectedKindErr) + continue + } + if err != nil { + if len(testCase.ExpectedKindErr) == 0 { + t.Errorf("%s: unexpected error: %v", tcName, err) + continue + } else { + if !strings.Contains(err.Error(), testCase.ExpectedKindErr) { + t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedKindErr, err) + continue + } + } + + } else { + if testCase.ExpectedKinds[0] != singleKind { + t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedKinds[0], singleKind) + } + + } + } +} + +func TestRESTMapperResourcesFor(t *testing.T) { + testCases := []struct { + Name string + PreferredOrder []unversioned.GroupVersion + KindsToRegister []unversioned.GroupVersionKind + PluralPartialResourceToRequest unversioned.GroupVersionResource + SingularPartialResourceToRequest unversioned.GroupVersionResource + + ExpectedResources []unversioned.GroupVersionResource + ExpectedResourceErr string + }{ + { + Name: "ambiguous groups, with preference order", + PreferredOrder: []unversioned.GroupVersion{ + {Group: "second-group", Version: "first-version"}, + {Group: "first-group", Version: "first-version"}, + }, + KindsToRegister: []unversioned.GroupVersionKind{ + {Group: "first-group", Version: "first-version", Kind: "my-kind"}, + {Group: "first-group", Version: "first-version", Kind: "your-kind"}, + {Group: "second-group", Version: "first-version", Kind: "my-kind"}, + {Group: "second-group", Version: "first-version", Kind: "your-kind"}, + }, + PluralPartialResourceToRequest: unversioned.GroupVersionResource{Resource: "my-kinds"}, + SingularPartialResourceToRequest: unversioned.GroupVersionResource{Resource: "my-kind"}, + + ExpectedResources: []unversioned.GroupVersionResource{ + {Group: "second-group", Version: "first-version", Resource: "my-kinds"}, + {Group: "first-group", Version: "first-version", Resource: "my-kinds"}, + }, + ExpectedResourceErr: " matches multiple resources ", + }, + + { + Name: "ambiguous groups, with explicit group match", + PreferredOrder: []unversioned.GroupVersion{ + {Group: "second-group", Version: "first-version"}, + {Group: "first-group", Version: "first-version"}, + }, + KindsToRegister: []unversioned.GroupVersionKind{ + {Group: "first-group", Version: "first-version", Kind: "my-kind"}, + {Group: "first-group", Version: "first-version", Kind: "your-kind"}, + {Group: "second-group", Version: "first-version", Kind: "my-kind"}, + {Group: "second-group", Version: "first-version", Kind: "your-kind"}, + }, + PluralPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first-group", Resource: "my-kinds"}, + SingularPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first-group", Resource: "my-kind"}, + + ExpectedResources: []unversioned.GroupVersionResource{ + {Group: "first-group", Version: "first-version", Resource: "my-kinds"}, + }, + }, + + { + Name: "ambiguous groups, with ambiguous version match", + PreferredOrder: []unversioned.GroupVersion{ + {Group: "first-group", Version: "first-version"}, + {Group: "second-group", Version: "first-version"}, + }, + KindsToRegister: []unversioned.GroupVersionKind{ + {Group: "first-group", Version: "first-version", Kind: "my-kind"}, + {Group: "first-group", Version: "first-version", Kind: "your-kind"}, + {Group: "second-group", Version: "first-version", Kind: "my-kind"}, + {Group: "second-group", Version: "first-version", Kind: "your-kind"}, + }, + PluralPartialResourceToRequest: unversioned.GroupVersionResource{Version: "first-version", Resource: "my-kinds"}, + SingularPartialResourceToRequest: unversioned.GroupVersionResource{Version: "first-version", Resource: "my-kind"}, + + ExpectedResources: []unversioned.GroupVersionResource{ + {Group: "first-group", Version: "first-version", Resource: "my-kinds"}, + {Group: "second-group", Version: "first-version", Resource: "my-kinds"}, + }, + ExpectedResourceErr: " matches multiple resources ", + }, + } + for _, testCase := range testCases { + tcName := testCase.Name + + for _, partialResource := range []unversioned.GroupVersionResource{testCase.PluralPartialResourceToRequest, testCase.SingularPartialResourceToRequest} { + mapper := NewDefaultRESTMapper(testCase.PreferredOrder, fakeInterfaces) + for _, kind := range testCase.KindsToRegister { + mapper.Add(kind, RESTScopeNamespace) + } + + actualResources, err := mapper.ResourcesFor(partialResource) + if err != nil { + t.Errorf("%s: unexpected error: %v", tcName, err) + continue + } + if !reflect.DeepEqual(testCase.ExpectedResources, actualResources) { + t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedResources, actualResources) + } + + singleResource, err := mapper.ResourceFor(partialResource) + if err == nil && len(testCase.ExpectedResourceErr) != 0 { + t.Errorf("%s: expected error: %v", tcName, testCase.ExpectedResourceErr) + continue + } + if err != nil { + if len(testCase.ExpectedResourceErr) == 0 { + t.Errorf("%s: unexpected error: %v", tcName, err) + continue + } else { + if !strings.Contains(err.Error(), testCase.ExpectedResourceErr) { + t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedResourceErr, err) + continue + } + } + + } else { + if testCase.ExpectedResources[0] != singleResource { + t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedResources[0], singleResource) + } + + } } } } @@ -142,97 +354,103 @@ func TestRESTMapperGroupForResource(t *testing.T) { func TestKindToResource(t *testing.T) { testCases := []struct { Kind string - MixedCase bool Plural, Singular string }{ - {Kind: "Pod", MixedCase: true, Plural: "pods", Singular: "pod"}, - {Kind: "Pod", MixedCase: true, Plural: "pods", Singular: "pod"}, - {Kind: "Pod", MixedCase: false, Plural: "pods", Singular: "pod"}, + {Kind: "Pod", Plural: "pods", Singular: "pod"}, - {Kind: "ReplicationController", MixedCase: true, Plural: "replicationControllers", Singular: "replicationController"}, - {Kind: "ReplicationController", MixedCase: true, Plural: "replicationControllers", Singular: "replicationController"}, - {Kind: "ReplicationController", MixedCase: false, Plural: "replicationcontrollers", Singular: "replicationcontroller"}, + {Kind: "ReplicationController", Plural: "replicationcontrollers", Singular: "replicationcontroller"}, - {Kind: "ImageRepository", MixedCase: true, Plural: "imageRepositories", Singular: "imageRepository"}, - - {Kind: "lowercase", MixedCase: false, Plural: "lowercases", Singular: "lowercase"}, - // Don't add extra s if the original object is already plural - {Kind: "lowercases", MixedCase: false, Plural: "lowercases", Singular: "lowercases"}, + // Add "ies" when ending with "y" + {Kind: "ImageRepository", Plural: "imagerepositories", Singular: "imagerepository"}, + // Add "es" when ending with "s" + {Kind: "miss", Plural: "misses", Singular: "miss"}, + // Add "s" otherwise + {Kind: "lowercase", Plural: "lowercases", Singular: "lowercase"}, } for i, testCase := range testCases { - plural, singular := KindToResource(testCase.Kind, testCase.MixedCase) - if singular != testCase.Singular || plural != testCase.Plural { - t.Errorf("%d: unexpected plural and singular: %s %s", i, plural, singular) + version := unversioned.GroupVersion{} + + plural, singular := KindToResource(version.WithKind(testCase.Kind)) + if singular != version.WithResource(testCase.Singular) || plural != version.WithResource(testCase.Plural) { + t.Errorf("%d: unexpected plural and singular: %v %v", i, plural, singular) } } } func TestRESTMapperResourceSingularizer(t *testing.T) { + testGroupVersion := unversioned.GroupVersion{Group: "tgroup", Version: "test"} + testCases := []struct { - Kind, APIVersion string - MixedCase bool - Plural string - Singular string + Kind string + Plural string + Singular string }{ - {Kind: "Pod", APIVersion: "test", MixedCase: true, Plural: "pods", Singular: "pod"}, - {Kind: "Pod", APIVersion: "test", MixedCase: false, Plural: "pods", Singular: "pod"}, + {Kind: "Pod", Plural: "pods", Singular: "pod"}, + {Kind: "ReplicationController", Plural: "replicationcontrollers", Singular: "replicationcontroller"}, + {Kind: "ImageRepository", Plural: "imagerepositories", Singular: "imagerepository"}, + {Kind: "Status", Plural: "statuses", Singular: "status"}, - {Kind: "ReplicationController", APIVersion: "test", MixedCase: true, Plural: "replicationControllers", Singular: "replicationController"}, - {Kind: "ReplicationController", APIVersion: "test", MixedCase: false, Plural: "replicationcontrollers", Singular: "replicationcontroller"}, - - {Kind: "ImageRepository", APIVersion: "test", MixedCase: true, Plural: "imageRepositories", Singular: "imageRepository"}, - {Kind: "ImageRepository", APIVersion: "test", MixedCase: false, Plural: "imagerepositories", Singular: "imagerepository"}, - - {Kind: "Status", APIVersion: "test", MixedCase: true, Plural: "statuses", Singular: "status"}, - {Kind: "Status", APIVersion: "test", MixedCase: false, Plural: "statuses", Singular: "status"}, - - {Kind: "lowercase", APIVersion: "test", MixedCase: false, Plural: "lowercases", Singular: "lowercase"}, - // Don't add extra s if the original object is already plural - {Kind: "lowercases", APIVersion: "test", MixedCase: false, Plural: "lowercases", Singular: "lowercases"}, + {Kind: "lowercase", Plural: "lowercases", Singular: "lowercase"}, + // TODO this test is broken. This updates to reflect actual behavior. Kinds are expected to be singular + // old (incorrect), coment: Don't add extra s if the original object is already plural + {Kind: "lowercases", Plural: "lowercaseses", Singular: "lowercases"}, } for i, testCase := range testCases { - mapper := NewDefaultRESTMapper("tgroup", []string{"test"}, fakeInterfaces) + mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{testGroupVersion}, fakeInterfaces) // create singular/plural mapping - mapper.Add(RESTScopeNamespace, testCase.Kind, testCase.APIVersion, testCase.MixedCase) - singular, _ := mapper.ResourceSingularizer(testCase.Plural) + mapper.Add(testGroupVersion.WithKind(testCase.Kind), RESTScopeNamespace) + + singular, err := mapper.ResourceSingularizer(testCase.Plural) + if err != nil { + t.Errorf("%d: unexpected error: %v", i, err) + } if singular != testCase.Singular { - t.Errorf("%d: mismatched singular: %s, should be %s", i, singular, testCase.Singular) + t.Errorf("%d: mismatched singular: got %v, expected %v", i, singular, testCase.Singular) } } } func TestRESTMapperRESTMapping(t *testing.T) { - testCases := []struct { - Kind string - APIVersions []string - MixedCase bool - DefaultVersions []string + testGroup := "tgroup" + testGroupVersion := unversioned.GroupVersion{Group: testGroup, Version: "test"} + internalGroupVersion := unversioned.GroupVersion{Group: testGroup, Version: "test"} - Resource string - Version string - Err bool + testCases := []struct { + Kind string + APIGroupVersions []unversioned.GroupVersion + DefaultVersions []unversioned.GroupVersion + + Resource string + ExpectedGroupVersion *unversioned.GroupVersion + Err bool }{ {Kind: "Unknown", Err: true}, {Kind: "InternalObject", Err: true}, - {DefaultVersions: []string{"test"}, Kind: "Unknown", Err: true}, + {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "Unknown", Err: true}, - {DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, Resource: "internalobjects"}, - {DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, Resource: "internalobjects"}, + {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: "internalobjects"}, + {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: "internalobjects"}, - {DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, Resource: "internalobjects"}, + {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: "internalobjects"}, - {DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{}, Resource: "internalobjects", Version: "test"}, + {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{}, Resource: "internalobjects", ExpectedGroupVersion: &unversioned.GroupVersion{Group: testGroup, Version: "test"}}, - {DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, Resource: "internalobjects"}, - {DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, MixedCase: true, Resource: "internalObjects"}, + {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: "internalobjects"}, // TODO: add test for a resource that exists in one version but not another } for i, testCase := range testCases { - mapper := NewDefaultRESTMapper("tgroup", testCase.DefaultVersions, fakeInterfaces) - mapper.Add(RESTScopeNamespace, "InternalObject", "test", testCase.MixedCase) - mapping, err := mapper.RESTMapping(testCase.Kind, testCase.APIVersions...) + mapper := NewDefaultRESTMapper(testCase.DefaultVersions, fakeInterfaces) + mapper.Add(internalGroupVersion.WithKind("InternalObject"), RESTScopeNamespace) + + preferredVersions := []string{} + for _, gv := range testCase.APIGroupVersions { + preferredVersions = append(preferredVersions, gv.Version) + } + gk := unversioned.GroupKind{Group: testGroup, Kind: testCase.Kind} + + mapping, err := mapper.RESTMapping(gk, preferredVersions...) hasErr := err != nil if hasErr != testCase.Err { t.Errorf("%d: unexpected error behavior %t: %v", i, testCase.Err, err) @@ -243,76 +461,89 @@ func TestRESTMapperRESTMapping(t *testing.T) { if mapping.Resource != testCase.Resource { t.Errorf("%d: unexpected resource: %#v", i, mapping) } - version := testCase.Version - if version == "" { - version = testCase.APIVersions[0] - } - if mapping.APIVersion != version { - t.Errorf("%d: unexpected version: %#v", i, mapping) - } - if mapping.Codec == nil || mapping.MetadataAccessor == nil || mapping.ObjectConvertor == nil { + + if mapping.MetadataAccessor == nil || mapping.ObjectConvertor == nil { t.Errorf("%d: missing codec and accessor: %#v", i, mapping) } + + groupVersion := testCase.ExpectedGroupVersion + if groupVersion == nil { + groupVersion = &testCase.APIGroupVersions[0] + } + if mapping.GroupVersionKind.GroupVersion() != *groupVersion { + t.Errorf("%d: unexpected version: %#v", i, mapping) + } + } } func TestRESTMapperRESTMappingSelectsVersion(t *testing.T) { - mapper := NewDefaultRESTMapper("tgroup", []string{"test1", "test2"}, fakeInterfaces) - mapper.Add(RESTScopeNamespace, "InternalObject", "test1", false) - mapper.Add(RESTScopeNamespace, "OtherObject", "test2", false) + expectedGroupVersion1 := unversioned.GroupVersion{Group: "tgroup", Version: "test1"} + expectedGroupVersion2 := unversioned.GroupVersion{Group: "tgroup", Version: "test2"} + expectedGroupVersion3 := unversioned.GroupVersion{Group: "tgroup", Version: "test3"} + internalObjectGK := unversioned.GroupKind{Group: "tgroup", Kind: "InternalObject"} + otherObjectGK := unversioned.GroupKind{Group: "tgroup", Kind: "OtherObject"} + + mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{expectedGroupVersion1, expectedGroupVersion2}, fakeInterfaces) + mapper.Add(expectedGroupVersion1.WithKind("InternalObject"), RESTScopeNamespace) + mapper.Add(expectedGroupVersion2.WithKind("OtherObject"), RESTScopeNamespace) // pick default matching object kind based on search order - mapping, err := mapper.RESTMapping("OtherObject") + mapping, err := mapper.RESTMapping(otherObjectGK) if err != nil { t.Fatalf("unexpected error: %v", err) } - if mapping.Resource != "otherobjects" || mapping.APIVersion != "test2" { + if mapping.Resource != "otherobjects" || mapping.GroupVersionKind.GroupVersion() != expectedGroupVersion2 { t.Errorf("unexpected mapping: %#v", mapping) } - mapping, err = mapper.RESTMapping("InternalObject") + mapping, err = mapper.RESTMapping(internalObjectGK) if err != nil { t.Fatalf("unexpected error: %v", err) } - if mapping.Resource != "internalobjects" || mapping.APIVersion != "test1" { + if mapping.Resource != "internalobjects" || mapping.GroupVersionKind.GroupVersion() != expectedGroupVersion1 { t.Errorf("unexpected mapping: %#v", mapping) } // mismatch of version - mapping, err = mapper.RESTMapping("InternalObject", "test2") + mapping, err = mapper.RESTMapping(internalObjectGK, expectedGroupVersion2.Version) if err == nil { t.Errorf("unexpected non-error") } - mapping, err = mapper.RESTMapping("OtherObject", "test1") + mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion1.Version) if err == nil { t.Errorf("unexpected non-error") } // not in the search versions - mapping, err = mapper.RESTMapping("OtherObject", "test3") + mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version) if err == nil { t.Errorf("unexpected non-error") } // explicit search order - mapping, err = mapper.RESTMapping("OtherObject", "test3", "test1") + mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version, expectedGroupVersion1.Version) if err == nil { t.Errorf("unexpected non-error") } - mapping, err = mapper.RESTMapping("OtherObject", "test3", "test2") + mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version, expectedGroupVersion2.Version) if err != nil { - t.Fatalf("unexpected non-error") + t.Fatalf("unexpected error: %v", err) } - if mapping.Resource != "otherobjects" || mapping.APIVersion != "test2" { + if mapping.Resource != "otherobjects" || mapping.GroupVersionKind.GroupVersion() != expectedGroupVersion2 { t.Errorf("unexpected mapping: %#v", mapping) } } func TestRESTMapperReportsErrorOnBadVersion(t *testing.T) { - mapper := NewDefaultRESTMapper("tgroup", []string{"test1", "test2"}, unmatchedVersionInterfaces) - mapper.Add(RESTScopeNamespace, "InternalObject", "test1", false) - _, err := mapper.RESTMapping("InternalObject", "test1") + expectedGroupVersion1 := unversioned.GroupVersion{Group: "tgroup", Version: "test1"} + expectedGroupVersion2 := unversioned.GroupVersion{Group: "tgroup", Version: "test2"} + internalObjectGK := unversioned.GroupKind{Group: "tgroup", Kind: "InternalObject"} + + mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{expectedGroupVersion1, expectedGroupVersion2}, unmatchedVersionInterfaces) + mapper.Add(expectedGroupVersion1.WithKind("InternalObject"), RESTScopeNamespace) + _, err := mapper.RESTMapping(internalObjectGK, expectedGroupVersion1.Version) if err == nil { t.Errorf("unexpected non-error") } diff --git a/vendor/k8s.io/kubernetes/pkg/api/meta_test.go b/vendor/k8s.io/kubernetes/pkg/api/meta_test.go index f3b293cd9..e4a9657a0 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/meta_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/meta_test.go @@ -20,8 +20,11 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" ) +var _ meta.Object = &api.ObjectMeta{} + // TestFillObjectMetaSystemFields validates that system populated fields are set on an object func TestFillObjectMetaSystemFields(t *testing.T) { ctx := api.NewDefaultContext() diff --git a/vendor/k8s.io/kubernetes/pkg/api/pod/util.go b/vendor/k8s.io/kubernetes/pkg/api/pod/util.go new file mode 100644 index 000000000..8e70104aa --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/pod/util.go @@ -0,0 +1,47 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pod + +import ( + "fmt" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/util/intstr" +) + +// FindPort locates the container port for the given pod and portName. If the +// targetPort is a number, use that. If the targetPort is a string, look that +// string up in all named ports in all containers in the target pod. If no +// match is found, fail. +func FindPort(pod *api.Pod, svcPort *api.ServicePort) (int, error) { + portName := svcPort.TargetPort + switch portName.Type { + case intstr.String: + name := portName.StrVal + for _, container := range pod.Spec.Containers { + for _, port := range container.Ports { + if port.Name == name && port.Protocol == svcPort.Protocol { + return port.ContainerPort, nil + } + } + } + case intstr.Int: + return portName.IntValue(), nil + } + + return 0, fmt.Errorf("no suitable port for manifest: %s", pod.UID) +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/pod/util_test.go b/vendor/k8s.io/kubernetes/pkg/api/pod/util_test.go new file mode 100644 index 000000000..428f2bdcd --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/pod/util_test.go @@ -0,0 +1,110 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pod + +import ( + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/util/intstr" +) + +func TestFindPort(t *testing.T) { + testCases := []struct { + name string + containers []api.Container + port intstr.IntOrString + expected int + pass bool + }{{ + name: "valid int, no ports", + containers: []api.Container{{}}, + port: intstr.FromInt(93), + expected: 93, + pass: true, + }, { + name: "valid int, with ports", + containers: []api.Container{{Ports: []api.ContainerPort{{ + Name: "", + ContainerPort: 11, + Protocol: "TCP", + }, { + Name: "p", + ContainerPort: 22, + Protocol: "TCP", + }}}}, + port: intstr.FromInt(93), + expected: 93, + pass: true, + }, { + name: "valid str, no ports", + containers: []api.Container{{}}, + port: intstr.FromString("p"), + expected: 0, + pass: false, + }, { + name: "valid str, one ctr with ports", + containers: []api.Container{{Ports: []api.ContainerPort{{ + Name: "", + ContainerPort: 11, + Protocol: "UDP", + }, { + Name: "p", + ContainerPort: 22, + Protocol: "TCP", + }, { + Name: "q", + ContainerPort: 33, + Protocol: "TCP", + }}}}, + port: intstr.FromString("q"), + expected: 33, + pass: true, + }, { + name: "valid str, two ctr with ports", + containers: []api.Container{{}, {Ports: []api.ContainerPort{{ + Name: "", + ContainerPort: 11, + Protocol: "UDP", + }, { + Name: "p", + ContainerPort: 22, + Protocol: "TCP", + }, { + Name: "q", + ContainerPort: 33, + Protocol: "TCP", + }}}}, + port: intstr.FromString("q"), + expected: 33, + pass: true, + }} + + for _, tc := range testCases { + port, err := FindPort(&api.Pod{Spec: api.PodSpec{Containers: tc.containers}}, + &api.ServicePort{Protocol: "TCP", TargetPort: tc.port}) + if err != nil && tc.pass { + t.Errorf("unexpected error for %s: %v", tc.name, err) + } + if err == nil && !tc.pass { + t.Errorf("unexpected non-error for %s: %d", tc.name, port) + } + if port != tc.expected { + t.Errorf("wrong result for %s: expected %d, got %d", tc.name, tc.expected, port) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/ref.go b/vendor/k8s.io/kubernetes/pkg/api/ref.go index 9a8cc117c..95690b821 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/ref.go +++ b/vendor/k8s.io/kubernetes/pkg/api/ref.go @@ -23,6 +23,7 @@ import ( "strings" "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" ) @@ -32,10 +33,6 @@ var ( ErrNoSelfLink = errors.New("selfLink was empty, can't make reference") ) -// ForTesting_ReferencesAllowBlankSelfLinks can be set to true in tests to avoid -// "ErrNoSelfLink" errors. -var ForTesting_ReferencesAllowBlankSelfLinks = false - // GetReference returns an ObjectReference which refers to the given // object, or an error if the object doesn't follow the conventions // that would allow this. @@ -53,47 +50,52 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) { return nil, err } + gvk := obj.GetObjectKind().GroupVersionKind() + // if the object referenced is actually persisted, we can just get kind from meta // if we are building an object reference to something not yet persisted, we should fallback to scheme - kind := meta.Kind() - if kind == "" { - _, kind, err = Scheme.ObjectVersionAndKind(obj) + var kind string + if gvk != nil { + kind = gvk.Kind + } + if len(kind) == 0 { + // TODO: this is wrong + gvk, err := Scheme.ObjectKind(obj) if err != nil { return nil, err } + kind = gvk.Kind } // if the object referenced is actually persisted, we can also get version from meta - version := meta.APIVersion() - if version == "" { - selfLink := meta.SelfLink() - if selfLink == "" { - if ForTesting_ReferencesAllowBlankSelfLinks { - version = "testing" - } else { - return nil, ErrNoSelfLink - } - } else { - selfLinkUrl, err := url.Parse(selfLink) - if err != nil { - return nil, err - } - // example paths: ///* - parts := strings.Split(selfLinkUrl.Path, "/") - if len(parts) < 3 { - return nil, fmt.Errorf("unexpected self link format: '%v'; got version '%v'", selfLink, version) - } - version = parts[2] + var version string + if gvk != nil { + version = gvk.GroupVersion().String() + } + if len(version) == 0 { + selfLink := meta.GetSelfLink() + if len(selfLink) == 0 { + return nil, ErrNoSelfLink } + selfLinkUrl, err := url.Parse(selfLink) + if err != nil { + return nil, err + } + // example paths: ///* + parts := strings.Split(selfLinkUrl.Path, "/") + if len(parts) < 3 { + return nil, fmt.Errorf("unexpected self link format: '%v'; got version '%v'", selfLink, version) + } + version = parts[2] } return &ObjectReference{ Kind: kind, APIVersion: version, - Name: meta.Name(), - Namespace: meta.Namespace(), - UID: meta.UID(), - ResourceVersion: meta.ResourceVersion(), + Name: meta.GetName(), + Namespace: meta.GetNamespace(), + UID: meta.GetUID(), + ResourceVersion: meta.GetResourceVersion(), }, nil } @@ -109,4 +111,9 @@ func GetPartialReference(obj runtime.Object, fieldPath string) (*ObjectReference // IsAnAPIObject allows clients to preemptively get a reference to an API object and pass it to places that // intend only to get a reference to that object. This simplifies the event recording interface. -func (*ObjectReference) IsAnAPIObject() {} +func (obj *ObjectReference) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() +} +func (obj *ObjectReference) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/ref_test.go b/vendor/k8s.io/kubernetes/pkg/api/ref_test.go index cec77d545..4f716672e 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/ref_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/ref_test.go @@ -26,14 +26,14 @@ import ( type FakeAPIObject struct{} -func (*FakeAPIObject) IsAnAPIObject() {} +func (obj *FakeAPIObject) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } type ExtensionAPIObject struct { unversioned.TypeMeta ObjectMeta } -func (*ExtensionAPIObject) IsAnAPIObject() {} +func (obj *ExtensionAPIObject) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } func TestGetReference(t *testing.T) { table := map[string]struct { diff --git a/vendor/k8s.io/kubernetes/pkg/api/register.go b/vendor/k8s.io/kubernetes/pkg/api/register.go index 917b4a231..b01547b5a 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/register.go +++ b/vendor/k8s.io/kubernetes/pkg/api/register.go @@ -17,15 +17,46 @@ limitations under the License. package api import ( + "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer" ) // Scheme is the default instance of runtime.Scheme to which types in the Kubernetes API are already registered. var Scheme = runtime.NewScheme() -func init() { - Scheme.AddKnownTypes("", +// Codecs provides access to encoding and decoding for the scheme +var Codecs = serializer.NewCodecFactory(Scheme) + +// GroupName is the group name use in this package +const GroupName = "" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Unversiond is group version for unversioned API objects +// TODO: this should be v1 probably +var Unversioned = unversioned.GroupVersion{Group: "", Version: "v1"} + +// ParameterCodec handles versioning of objects that are converted to query parameters. +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) unversioned.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns back a Group qualified GroupResource +func Resource(resource string) unversioned.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func AddToScheme(scheme *runtime.Scheme) { + if err := Scheme.AddIgnoredConversionType(&unversioned.TypeMeta{}, &unversioned.TypeMeta{}); err != nil { + panic(err) + } + scheme.AddKnownTypes(SchemeGroupVersion, &Pod{}, &PodList{}, &PodStatusResult{}, @@ -67,50 +98,82 @@ func init() { &ComponentStatusList{}, &SerializedReference{}, &RangeAllocation{}, + &ConfigMap{}, + &ConfigMapList{}, ) - // Register Unversioned types - Scheme.AddKnownTypes("", &unversioned.Status{}) + // Register Unversioned types under their own special group + Scheme.AddUnversionedTypes(Unversioned, + &unversioned.ExportOptions{}, + &unversioned.Status{}, + &unversioned.APIVersions{}, + &unversioned.APIGroupList{}, + &unversioned.APIGroup{}, + &unversioned.APIResourceList{}, + ) } -func (*Pod) IsAnAPIObject() {} -func (*PodList) IsAnAPIObject() {} -func (*PodStatusResult) IsAnAPIObject() {} -func (*PodTemplate) IsAnAPIObject() {} -func (*PodTemplateList) IsAnAPIObject() {} -func (*ReplicationController) IsAnAPIObject() {} -func (*ReplicationControllerList) IsAnAPIObject() {} -func (*Service) IsAnAPIObject() {} -func (*ServiceList) IsAnAPIObject() {} -func (*Endpoints) IsAnAPIObject() {} -func (*EndpointsList) IsAnAPIObject() {} -func (*Node) IsAnAPIObject() {} -func (*NodeList) IsAnAPIObject() {} -func (*Binding) IsAnAPIObject() {} -func (*Event) IsAnAPIObject() {} -func (*EventList) IsAnAPIObject() {} -func (*List) IsAnAPIObject() {} -func (*LimitRange) IsAnAPIObject() {} -func (*LimitRangeList) IsAnAPIObject() {} -func (*ResourceQuota) IsAnAPIObject() {} -func (*ResourceQuotaList) IsAnAPIObject() {} -func (*Namespace) IsAnAPIObject() {} -func (*NamespaceList) IsAnAPIObject() {} -func (*ServiceAccount) IsAnAPIObject() {} -func (*ServiceAccountList) IsAnAPIObject() {} -func (*Secret) IsAnAPIObject() {} -func (*SecretList) IsAnAPIObject() {} -func (*PersistentVolume) IsAnAPIObject() {} -func (*PersistentVolumeList) IsAnAPIObject() {} -func (*PersistentVolumeClaim) IsAnAPIObject() {} -func (*PersistentVolumeClaimList) IsAnAPIObject() {} -func (*DeleteOptions) IsAnAPIObject() {} -func (*ListOptions) IsAnAPIObject() {} -func (*PodAttachOptions) IsAnAPIObject() {} -func (*PodLogOptions) IsAnAPIObject() {} -func (*PodExecOptions) IsAnAPIObject() {} -func (*PodProxyOptions) IsAnAPIObject() {} -func (*ComponentStatus) IsAnAPIObject() {} -func (*ComponentStatusList) IsAnAPIObject() {} -func (*SerializedReference) IsAnAPIObject() {} -func (*RangeAllocation) IsAnAPIObject() {} +func (obj *Pod) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *Pod) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodStatusResult) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *PodStatusResult) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodTemplate) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *PodTemplate) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodTemplateList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicationController) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *ReplicationController) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicationControllerList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Service) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *Service) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ServiceList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Endpoints) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *Endpoints) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *EndpointsList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Node) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *Node) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *NodeList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Binding) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *Binding) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Event) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *Event) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *EventList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *List) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ListOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *LimitRange) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *LimitRange) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *LimitRangeList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ResourceQuota) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *ResourceQuota) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ResourceQuotaList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Namespace) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *Namespace) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *NamespaceList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ServiceAccount) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *ServiceAccount) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ServiceAccountList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Secret) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *Secret) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *SecretList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PersistentVolume) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *PersistentVolume) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PersistentVolumeList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PersistentVolumeClaim) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *PersistentVolumeClaim) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PersistentVolumeClaimList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DeleteOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodAttachOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodLogOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodExecOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodProxyOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ComponentStatus) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *ComponentStatus) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ComponentStatusList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *SerializedReference) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *RangeAllocation) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *RangeAllocation) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ObjectReference) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *ExportOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ConfigMap) GetObjectMeta() meta.Object { return &obj.ObjectMeta } +func (obj *ConfigMap) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ConfigMapList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/api/registered/registered.go b/vendor/k8s.io/kubernetes/pkg/api/registered/registered.go deleted file mode 100644 index a3f8ddfbf..000000000 --- a/vendor/k8s.io/kubernetes/pkg/api/registered/registered.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package to keep track of API Versions that should be registered in api.Scheme. -package registered - -import ( - "os" - "strings" - - "github.com/golang/glog" - apiutil "k8s.io/kubernetes/pkg/api/util" -) - -// List of registered API versions. -// The list is in the order of most preferred to the least. -var RegisteredVersions []string - -func init() { - // TODO: caesarxuchao: rename this variable to validGroupVersions - validAPIVersions := map[string]bool{ - "v1": true, - "extensions/v1beta1": true, - } - - // The default list of supported api versions, in order of most preferred to the least. - defaultSupportedVersions := "v1,extensions/v1beta1" - // Env var KUBE_API_VERSIONS is a comma separated list of API versions that should be registered in the scheme. - // The versions should be in the order of most preferred to the least. - supportedVersions := os.Getenv("KUBE_API_VERSIONS") - if supportedVersions == "" { - supportedVersions = defaultSupportedVersions - } - versions := strings.Split(supportedVersions, ",") - for _, version := range versions { - // Verify that the version is valid. - valid, ok := validAPIVersions[version] - if !ok || !valid { - // Not a valid API version. - glog.Fatalf("invalid api version: %s in KUBE_API_VERSIONS: %s. List of valid API versions: %v", - version, os.Getenv("KUBE_API_VERSIONS"), validAPIVersions) - } - RegisteredVersions = append(RegisteredVersions, version) - } -} - -// Returns true if the given api version is one of the registered api versions. -func IsRegisteredAPIVersion(version string) bool { - for _, apiVersion := range RegisteredVersions { - if apiVersion == version { - return true - } - } - return false -} - -// GroupVersionsForGroup returns the registered versions of a group in the form -// of "group/version". -func GroupVersionsForGroup(group string) []string { - ret := []string{} - for _, v := range RegisteredVersions { - if apiutil.GetGroup(v) == group { - ret = append(ret, v) - } - } - return ret -} diff --git a/vendor/k8s.io/kubernetes/pkg/api/resource/quantity.go b/vendor/k8s.io/kubernetes/pkg/api/resource/quantity.go index 5b4a99dbc..aeb43c897 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/resource/quantity.go +++ b/vendor/k8s.io/kubernetes/pkg/api/resource/quantity.go @@ -83,6 +83,11 @@ import ( // This format is intended to make it difficult to use these numbers without // writing some sort of special handling code in the hopes that that will // cause implementors to also use a fixed point implementation. +// +// +protobuf=true +// +protobuf.embed=QuantityProto +// +protobuf.options.marshal=false +// +protobuf.options.(gogoproto.goproto_stringer)=false type Quantity struct { // Amount is public, so you can manipulate it if the accessor // functions are not sufficient. @@ -112,10 +117,27 @@ func MustParse(str string) Quantity { return *q } +// Scale is used for getting and setting the base-10 scaled value. +// Base-2 scales are omitted for mathematical simplicity. +// See Quantity.ScaledValue for more details. +type Scale int + +const ( + Nano Scale = -9 + Micro Scale = -6 + Milli Scale = -3 + Kilo Scale = 3 + Mega Scale = 6 + Giga Scale = 9 + Tera Scale = 12 + Peta Scale = 15 + Exa Scale = 18 +) + const ( // splitREString is used to separate a number from its suffix; as such, // this is overly permissive, but that's OK-- it will be checked later. - splitREString = "^([+-]?[0-9.]+)([eEimkKMGTP]*[-+]?[0-9]*)$" + splitREString = "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$" ) var ( @@ -171,7 +193,7 @@ func ParseQuantity(str string) (*Quantity, error) { // So that no one but us has to think about suffixes, remove it. if base == 10 { - amount.SetScale(amount.Scale() + inf.Scale(-exponent)) + amount.SetScale(amount.Scale() + Scale(exponent).infScale()) } else if base == 2 { // numericSuffix = 2 ** exponent numericSuffix := big.NewInt(1).Lsh(bigOne, uint(exponent)) @@ -184,14 +206,13 @@ func ParseQuantity(str string) (*Quantity, error) { if sign == -1 { amount.Neg(amount) } - // This rounds non-zero values up to the minimum representable - // value, under the theory that if you want some resources, you - // should get some resources, even if you asked for way too small - // of an amount. - // Arguably, this should be inf.RoundHalfUp (normal rounding), but - // that would have the side effect of rounding values < .5m to zero. + + // This rounds non-zero values up to the minimum representable value, under the theory that + // if you want some resources, you should get some resources, even if you asked for way too small + // of an amount. Arguably, this should be inf.RoundHalfUp (normal rounding), but that would have + // the side effect of rounding values < .5n to zero. if v, ok := amount.Unscaled(); v != int64(0) || !ok { - amount.Round(amount, 3, inf.RoundUp) + amount.Round(amount, Nano.infScale(), inf.RoundUp) } // The max is just a simple cap. @@ -308,30 +329,67 @@ func (q *Quantity) String() string { // +1 if q > y // func (q *Quantity) Cmp(y Quantity) int { - num1 := q.Value() - num2 := y.Value() - if num1 < MaxMilliValue && num2 < MaxMilliValue { - num1 = q.MilliValue() - num2 = y.MilliValue() + if q.Amount == nil { + if y.Amount == nil { + return 0 + } + return -y.Amount.Sign() } - if num1 < num2 { - return -1 - } else if num1 > num2 { - return 1 + if y.Amount == nil { + return q.Amount.Sign() } - return 0 + return q.Amount.Cmp(y.Amount) } func (q *Quantity) Add(y Quantity) error { - q.Amount.Add(q.Amount, y.Amount) + switch { + case y.Amount == nil: + // Adding 0: do nothing. + case q.Amount == nil: + q.Amount = &inf.Dec{} + return q.Add(y) + default: + // we want to preserve the format of the non-zero value + zero := &inf.Dec{} + if q.Amount.Cmp(zero) == 0 && y.Amount.Cmp(zero) != 0 { + q.Format = y.Format + } + q.Amount.Add(q.Amount, y.Amount) + } return nil } func (q *Quantity) Sub(y Quantity) error { - if q.Format != y.Format { - return fmt.Errorf("format mismatch: %v vs. %v", q.Format, y.Format) + switch { + case y.Amount == nil: + // Subtracting 0: do nothing. + case q.Amount == nil: + q.Amount = &inf.Dec{} + return q.Sub(y) + default: + // we want to preserve the format of the non-zero value + zero := &inf.Dec{} + if q.Amount.Cmp(zero) == 0 && y.Amount.Cmp(zero) != 0 { + q.Format = y.Format + } + q.Amount.Sub(q.Amount, y.Amount) + } + return nil +} + +// Neg sets q to the negative value of y. +// It updates the format of q to match y. +func (q *Quantity) Neg(y Quantity) error { + switch { + case y.Amount == nil: + *q = y + case q.Amount == nil: + q.Amount = &inf.Dec{} + fallthrough + default: + q.Amount.Neg(y.Amount) + q.Format = y.Format } - q.Amount.Sub(q.Amount, y.Amount) return nil } @@ -372,41 +430,52 @@ func NewMilliQuantity(value int64, format Format) *Quantity { } } -// Value returns the value of q; any fractional part will be lost. -func (q *Quantity) Value() int64 { - if q.Amount == nil { - return 0 +// NewScaledQuantity returns a new Quantity representing the given +// value * 10^scale in DecimalSI format. +func NewScaledQuantity(value int64, scale Scale) *Quantity { + return &Quantity{ + Amount: inf.NewDec(value, scale.infScale()), + Format: DecimalSI, } - tmp := &inf.Dec{} - return tmp.Round(q.Amount, 0, inf.RoundUp).UnscaledBig().Int64() } -// MilliValue returns the value of q * 1000; this could overflow an int64; +// Value returns the value of q; any fractional part will be lost. +func (q *Quantity) Value() int64 { + return q.ScaledValue(0) +} + +// MilliValue returns the value of ceil(q * 1000); this could overflow an int64; // if that's a concern, call Value() first to verify the number is small enough. func (q *Quantity) MilliValue() int64 { + return q.ScaledValue(Milli) +} + +// ScaledValue returns the value of ceil(q * 10^scale); this could overflow an int64. +// To detect overflow, call Value() first and verify the expected magnitude. +func (q *Quantity) ScaledValue(scale Scale) int64 { if q.Amount == nil { return 0 } - tmp := &inf.Dec{} - return tmp.Round(tmp.Mul(q.Amount, decThousand), 0, inf.RoundUp).UnscaledBig().Int64() + return scaledValue(q.Amount.UnscaledBig(), int(q.Amount.Scale()), int(scale.infScale())) } // Set sets q's value to be value. func (q *Quantity) Set(value int64) { - if q.Amount == nil { - q.Amount = &inf.Dec{} - } - q.Amount.SetUnscaled(value) - q.Amount.SetScale(0) + q.SetScaled(value, 0) } // SetMilli sets q's value to be value * 1/1000. func (q *Quantity) SetMilli(value int64) { + q.SetScaled(value, Milli) +} + +// SetScaled sets q's value to be value * 10^scale +func (q *Quantity) SetScaled(value int64, scale Scale) { if q.Amount == nil { q.Amount = &inf.Dec{} } q.Amount.SetUnscaled(value) - q.Amount.SetScale(3) + q.Amount.SetScale(scale.infScale()) } // Copy is a convenience function that makes a deep copy for you. Non-deep @@ -461,3 +530,8 @@ func QuantityFlag(flagName, defaultValue, description string) *Quantity { func NewQuantityFlagValue(q *Quantity) flag.Value { return qFlag{q} } + +// infScale adapts a Scale value to an inf.Scale value. +func (s Scale) infScale() inf.Scale { + return inf.Scale(-s) // inf.Scale is upside-down +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/resource/quantity_proto.go b/vendor/k8s.io/kubernetes/pkg/api/resource/quantity_proto.go new file mode 100644 index 000000000..986d84608 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/resource/quantity_proto.go @@ -0,0 +1,80 @@ +// +build proto + +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package resource + +import ( + "math/big" + + "speter.net/go/exp/math/dec/inf" +) + +// QuantityProto is a struct that is equivalent to Quantity, but intended for +// protobuf marshalling/unmarshalling. It is generated into a serialization +// that matches Quantity. Do not use in Go structs. +// +// +protobuf=true +type QuantityProto struct { + // The format of the quantity + Format Format + // The scale dimension of the value + Scale int32 + // Bigint is serialized as a raw bytes array + Bigint []byte +} + +// ProtoTime returns the Time as a new ProtoTime value. +func (q *Quantity) QuantityProto() *QuantityProto { + if q == nil { + return &QuantityProto{} + } + p := &QuantityProto{ + Format: q.Format, + } + if q.Amount != nil { + p.Scale = int32(q.Amount.Scale()) + p.Bigint = q.Amount.UnscaledBig().Bytes() + } + return p +} + +// Size implements the protobuf marshalling interface. +func (q *Quantity) Size() (n int) { return q.QuantityProto().Size() } + +// Reset implements the protobuf marshalling interface. +func (q *Quantity) Unmarshal(data []byte) error { + p := QuantityProto{} + if err := p.Unmarshal(data); err != nil { + return err + } + q.Format = p.Format + b := big.NewInt(0) + b.SetBytes(p.Bigint) + q.Amount = inf.NewDecBig(b, inf.Scale(p.Scale)) + return nil +} + +// Marshal implements the protobuf marshalling interface. +func (q *Quantity) Marshal() (data []byte, err error) { + return q.QuantityProto().Marshal() +} + +// MarshalTo implements the protobuf marshalling interface. +func (q *Quantity) MarshalTo(data []byte) (int, error) { + return q.QuantityProto().MarshalTo(data) +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/resource/quantity_test.go b/vendor/k8s.io/kubernetes/pkg/api/resource/quantity_test.go index da8858ea9..bb62251e2 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/resource/quantity_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/resource/quantity_test.go @@ -65,6 +65,70 @@ func TestQuantityParseZero(t *testing.T) { } } +// TestQuantityAddZeroPreservesSuffix verifies that a suffix is preserved +// independent of the order of operations when adding a zero and non-zero val +func TestQuantityAddZeroPreservesSuffix(t *testing.T) { + testValues := []string{"100m", "1Gi"} + zero := MustParse("0") + for _, testValue := range testValues { + value := MustParse(testValue) + v1 := *value.Copy() + // ensure non-zero + zero = non-zero (suffix preserved) + err := v1.Add(zero) + if err != nil { + t.Errorf("Unexpected error %v", err) + } + // ensure zero + non-zero = non-zero (suffix preserved) + v2 := *zero.Copy() + err = v2.Add(value) + if err != nil { + t.Errorf("Unexpected error %v", err) + } + // ensure we preserved the input value + if v1.String() != testValue { + t.Errorf("Expected %v, actual %v", testValue, v1.String()) + } + if v2.String() != testValue { + t.Errorf("Expected %v, actual %v", testValue, v2.String()) + } + } +} + +// TestQuantitySubZeroPreservesSuffix verifies that a suffix is preserved +// independent of the order of operations when subtracting a zero and non-zero val +func TestQuantitySubZeroPreservesSuffix(t *testing.T) { + testValues := []string{"100m", "1Gi"} + zero := MustParse("0") + for _, testValue := range testValues { + value := MustParse(testValue) + v1 := *value.Copy() + // ensure non-zero - zero = non-zero (suffix preserved) + err := v1.Sub(zero) + if err != nil { + t.Errorf("Unexpected error %v", err) + } + // ensure we preserved the input value + if v1.String() != testValue { + t.Errorf("Expected %v, actual %v", testValue, v1.String()) + } + + // ensure zero - non-zero = -non-zero (suffix preserved) + v2 := *zero.Copy() + err = v2.Sub(value) + if err != nil { + t.Errorf("Unexpected error %v", err) + } + negVal := *value.Copy() + err = negVal.Neg(negVal) + if err != nil { + t.Errorf("Unexpected error %v", err) + } + if v2.String() != negVal.String() { + t.Errorf("Expected %v, actual %v", negVal.String(), v2.String()) + } + } +} + // Verifies that you get 0 as canonical value if internal value is 0, and not 0 func TestQuantityCanocicalizeZero(t *testing.T) { val := MustParse("1000m") @@ -95,6 +159,28 @@ func TestQuantityCmp(t *testing.T) { t.Errorf("X: %v, Y: %v, Expected: %v, Actual: %v", testCase.x, testCase.y, testCase.expect, result) } } + + nils := []struct { + x *inf.Dec + y *inf.Dec + expect int + }{ + {dec(0, 0), dec(0, 0), 0}, + {nil, dec(0, 0), 0}, + {dec(0, 0), nil, 0}, + {nil, nil, 0}, + {nil, dec(10, 0), -1}, + {nil, dec(-10, 0), 1}, + {dec(10, 0), nil, 1}, + {dec(-10, 0), nil, -1}, + } + for _, nilCase := range nils { + q1 := Quantity{nilCase.x, DecimalSI} + q2 := Quantity{nilCase.y, DecimalSI} + if result := q1.Cmp(q2); result != nilCase.expect { + t.Errorf("X: %v, Y: %v, Expected: %v, Actual: %v", nilCase.x, nilCase.y, nilCase.expect, result) + } + } } func TestQuantityParse(t *testing.T) { @@ -103,6 +189,8 @@ func TestQuantityParse(t *testing.T) { expect Quantity }{ {"0", Quantity{dec(0, 0), DecimalSI}}, + {"0n", Quantity{dec(0, 0), DecimalSI}}, + {"0u", Quantity{dec(0, 0), DecimalSI}}, {"0m", Quantity{dec(0, 0), DecimalSI}}, {"0Ki", Quantity{dec(0, 0), BinarySI}}, {"0k", Quantity{dec(0, 0), DecimalSI}}, @@ -126,6 +214,8 @@ func TestQuantityParse(t *testing.T) { {"100Ti", Quantity{dec(100*1024*1024*1024*1024, 0), BinarySI}}, // Decimal suffixes + {"5n", Quantity{dec(5, -9), DecimalSI}}, + {"4u", Quantity{dec(4, -6), DecimalSI}}, {"3m", Quantity{dec(3, -3), DecimalSI}}, {"9", Quantity{dec(9, 0), DecimalSI}}, {"8k", Quantity{dec(8, 3), DecimalSI}}, @@ -186,15 +276,15 @@ func TestQuantityParse(t *testing.T) { {"1.01E", Quantity{dec(101, 16), DecimalSI}}, // Things that saturate/round - {"3.001m", Quantity{dec(4, -3), DecimalSI}}, - {"1.1E-3", Quantity{dec(2, -3), DecimalExponent}}, - {"0.0001", Quantity{dec(1, -3), DecimalSI}}, - {"0.0005", Quantity{dec(1, -3), DecimalSI}}, - {"0.00050", Quantity{dec(1, -3), DecimalSI}}, - {"0.5e-3", Quantity{dec(1, -3), DecimalExponent}}, - {"0.9m", Quantity{dec(1, -3), DecimalSI}}, - {"0.12345", Quantity{dec(124, -3), DecimalSI}}, - {"0.12354", Quantity{dec(124, -3), DecimalSI}}, + {"3.001n", Quantity{dec(4, -9), DecimalSI}}, + {"1.1E-9", Quantity{dec(2, -9), DecimalExponent}}, + {"0.0000000001", Quantity{dec(1, -9), DecimalSI}}, + {"0.0000000005", Quantity{dec(1, -9), DecimalSI}}, + {"0.00000000050", Quantity{dec(1, -9), DecimalSI}}, + {"0.5e-9", Quantity{dec(1, -9), DecimalExponent}}, + {"0.9n", Quantity{dec(1, -9), DecimalSI}}, + {"0.00000012345", Quantity{dec(124, -9), DecimalSI}}, + {"0.00000012354", Quantity{dec(124, -9), DecimalSI}}, {"9Ei", Quantity{maxAllowed, BinarySI}}, {"9223372036854775807Ki", Quantity{maxAllowed, BinarySI}}, {"12E", Quantity{maxAllowed, DecimalSI}}, @@ -206,7 +296,7 @@ func TestQuantityParse(t *testing.T) { {"0.025Ti", Quantity{dec(274877906944, -1), BinarySI}}, // Things written by trolls - {"0.000001Ki", Quantity{dec(2, -3), DecimalSI}}, // rounds up, changes format + {"0.000000000001Ki", Quantity{dec(2, -9), DecimalSI}}, // rounds up, changes format {".001", Quantity{dec(1, -3), DecimalSI}}, {".0001k", Quantity{dec(100, -3), DecimalSI}}, {"1.", Quantity{dec(1, 0), DecimalSI}}, @@ -308,6 +398,7 @@ func TestQuantityString(t *testing.T) { {Quantity{dec(0, 0), BinarySI}, "0"}, {Quantity{dec(1, 9), DecimalExponent}, "1e9"}, {Quantity{dec(1, -3), DecimalExponent}, "1e-3"}, + {Quantity{dec(1, -9), DecimalExponent}, "1e-9"}, {Quantity{dec(80, -3), DecimalExponent}, "80e-3"}, {Quantity{dec(300, 6), DecimalExponent}, "300e6"}, {Quantity{dec(1, 12), DecimalExponent}, "1e12"}, @@ -315,6 +406,14 @@ func TestQuantityString(t *testing.T) { {Quantity{dec(3, 3), DecimalExponent}, "3e3"}, {Quantity{dec(3, 3), DecimalSI}, "3k"}, {Quantity{dec(0, 0), DecimalExponent}, "0"}, + {Quantity{dec(1, -9), DecimalSI}, "1n"}, + {Quantity{dec(80, -9), DecimalSI}, "80n"}, + {Quantity{dec(1080, -9), DecimalSI}, "1080n"}, + {Quantity{dec(108, -8), DecimalSI}, "1080n"}, + {Quantity{dec(10800, -10), DecimalSI}, "1080n"}, + {Quantity{dec(1, -6), DecimalSI}, "1u"}, + {Quantity{dec(80, -6), DecimalSI}, "80u"}, + {Quantity{dec(1080, -6), DecimalSI}, "1080u"}, } for _, item := range table { got := item.in.String() @@ -346,7 +445,10 @@ func TestQuantityParseEmit(t *testing.T) { {"1Gi", "1Gi"}, {"1024Mi", "1Gi"}, {"1000M", "1G"}, - {".000001Ki", "2m"}, + {".001Ki", "1024m"}, + {".000001Ki", "1024u"}, + {".000000001Ki", "1024n"}, + {".000000000001Ki", "2n"}, } for _, item := range table { @@ -502,6 +604,77 @@ func TestNewSet(t *testing.T) { } } +func TestNewScaledSet(t *testing.T) { + table := []struct { + value int64 + scale Scale + expect string + }{ + {1, Nano, "1n"}, + {1000, Nano, "1u"}, + {1, Micro, "1u"}, + {1000, Micro, "1m"}, + {1, Milli, "1m"}, + {1000, Milli, "1"}, + {1, 0, "1"}, + {0, Nano, "0"}, + {0, Micro, "0"}, + {0, Milli, "0"}, + {0, 0, "0"}, + } + + for _, item := range table { + q := NewScaledQuantity(item.value, item.scale) + if e, a := item.expect, q.String(); e != a { + t.Errorf("Expected %v, got %v; %#v", e, a, q) + } + q2, err := ParseQuantity(q.String()) + if err != nil { + t.Errorf("Round trip failed on %v", q) + } + if e, a := item.value, q2.ScaledValue(item.scale); e != a { + t.Errorf("Expected %v, got %v", e, a) + } + q3 := NewQuantity(0, DecimalSI) + q3.SetScaled(item.value, item.scale) + if q.Cmp(*q3) != 0 { + t.Errorf("Expected %v and %v to be equal", q, q3) + } + } +} + +func TestScaledValue(t *testing.T) { + table := []struct { + fromScale Scale + toScale Scale + expected int64 + }{ + {Nano, Nano, 1}, + {Nano, Micro, 1}, + {Nano, Milli, 1}, + {Nano, 0, 1}, + {Micro, Nano, 1000}, + {Micro, Micro, 1}, + {Micro, Milli, 1}, + {Micro, 0, 1}, + {Milli, Nano, 1000 * 1000}, + {Milli, Micro, 1000}, + {Milli, Milli, 1}, + {Milli, 0, 1}, + {0, Nano, 1000 * 1000 * 1000}, + {0, Micro, 1000 * 1000}, + {0, Milli, 1000}, + {0, 0, 1}, + } + + for _, item := range table { + q := NewScaledQuantity(1, item.fromScale) + if e, a := item.expected, q.ScaledValue(item.toScale); e != a { + t.Errorf("%v to %v: Expected %v, got %v", item.fromScale, item.toScale, e, a) + } + } +} + func TestUninitializedNoCrash(t *testing.T) { var q Quantity @@ -535,3 +708,103 @@ func TestQFlagIsPFlag(t *testing.T) { t.Errorf("Unexpected result %v != %v", e, a) } } + +func TestSub(t *testing.T) { + tests := []struct { + a Quantity + b Quantity + expected Quantity + }{ + {Quantity{dec(10, 0), DecimalSI}, Quantity{dec(1, 1), DecimalSI}, Quantity{dec(0, 0), DecimalSI}}, + {Quantity{dec(10, 0), DecimalSI}, Quantity{dec(1, 0), BinarySI}, Quantity{dec(9, 0), DecimalSI}}, + {Quantity{dec(10, 0), BinarySI}, Quantity{dec(1, 0), DecimalSI}, Quantity{dec(9, 0), BinarySI}}, + {Quantity{nil, DecimalSI}, Quantity{dec(50, 0), DecimalSI}, Quantity{dec(-50, 0), DecimalSI}}, + {Quantity{dec(50, 0), DecimalSI}, Quantity{nil, DecimalSI}, Quantity{dec(50, 0), DecimalSI}}, + {Quantity{nil, DecimalSI}, Quantity{nil, DecimalSI}, Quantity{dec(0, 0), DecimalSI}}, + } + + for i, test := range tests { + test.a.Sub(test.b) + if test.a.Cmp(test.expected) != 0 { + t.Errorf("[%d] Expected %q, got %q", i, test.expected.String(), test.a.String()) + } + } +} + +func TestNeg(t *testing.T) { + tests := []struct { + a Quantity + b Quantity + expected Quantity + }{ + { + a: Quantity{dec(0, 0), DecimalSI}, + b: Quantity{dec(10, 0), DecimalSI}, + expected: Quantity{dec(-10, 0), DecimalSI}, + }, + { + a: Quantity{dec(0, 0), DecimalSI}, + b: Quantity{dec(-10, 0), DecimalSI}, + expected: Quantity{dec(10, 0), DecimalSI}, + }, + { + a: Quantity{dec(0, 0), DecimalSI}, + b: Quantity{dec(10, 0), BinarySI}, + expected: Quantity{dec(-10, 0), BinarySI}, + }, + { + a: Quantity{dec(0, 0), DecimalSI}, + b: Quantity{dec(0, 0), BinarySI}, + expected: Quantity{dec(0, 0), BinarySI}, + }, + { + a: Quantity{}, + b: Quantity{dec(10, 0), BinarySI}, + expected: Quantity{dec(-10, 0), BinarySI}, + }, + { + a: Quantity{dec(10, 0), BinarySI}, + b: Quantity{}, + expected: Quantity{}, + }, + { + a: Quantity{dec(10, 0), BinarySI}, + b: Quantity{Format: DecimalSI}, + expected: Quantity{dec(0, 0), DecimalSI}, + }, + } + + for i, test := range tests { + test.a.Neg(test.b) + // ensure value is same + if test.a.Cmp(test.expected) != 0 { + t.Errorf("[%d] Expected %q, got %q", i, test.expected.String(), test.a.String()) + } + // ensure format is updated + if test.a.Format != test.expected.Format { + t.Errorf("[%d] Expected format %v, got format %v", i, test.expected.Format, test.a.Format) + } + } +} + +func TestAdd(t *testing.T) { + tests := []struct { + a Quantity + b Quantity + expected Quantity + }{ + {Quantity{dec(10, 0), DecimalSI}, Quantity{dec(1, 1), DecimalSI}, Quantity{dec(20, 0), DecimalSI}}, + {Quantity{dec(10, 0), DecimalSI}, Quantity{dec(1, 0), BinarySI}, Quantity{dec(11, 0), DecimalSI}}, + {Quantity{dec(10, 0), BinarySI}, Quantity{dec(1, 0), DecimalSI}, Quantity{dec(11, 0), BinarySI}}, + {Quantity{nil, DecimalSI}, Quantity{dec(50, 0), DecimalSI}, Quantity{dec(50, 0), DecimalSI}}, + {Quantity{dec(50, 0), DecimalSI}, Quantity{nil, DecimalSI}, Quantity{dec(50, 0), DecimalSI}}, + {Quantity{nil, DecimalSI}, Quantity{nil, DecimalSI}, Quantity{dec(0, 0), DecimalSI}}, + } + + for i, test := range tests { + test.a.Add(test.b) + if test.a.Cmp(test.expected) != 0 { + t.Errorf("[%d] Expected %q, got %q", i, test.expected.String(), test.a.String()) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/resource/scale_int.go b/vendor/k8s.io/kubernetes/pkg/api/resource/scale_int.go new file mode 100644 index 000000000..173de1a21 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/resource/scale_int.go @@ -0,0 +1,95 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package resource + +import ( + "math" + "math/big" + "sync" +) + +var ( + // A sync pool to reduce allocation. + intPool sync.Pool + maxInt64 = big.NewInt(math.MaxInt64) +) + +func init() { + intPool.New = func() interface{} { + return &big.Int{} + } +} + +// scaledValue scales given unscaled value from scale to new Scale and returns +// an int64. It ALWAYS rounds up the result when scale down. The final result might +// overflow. +// +// scale, newScale represents the scale of the unscaled decimal. +// The mathematical value of the decimal is unscaled * 10**(-scale). +func scaledValue(unscaled *big.Int, scale, newScale int) int64 { + dif := scale - newScale + if dif == 0 { + return unscaled.Int64() + } + + // Handle scale up + // This is an easy case, we do not need to care about rounding and overflow. + // If any intermediate operation causes overflow, the result will overflow. + if dif < 0 { + return unscaled.Int64() * int64(math.Pow10(-dif)) + } + + // Handle scale down + // We have to be careful about the intermediate operations. + + // fast path when unscaled < max.Int64 and exp(10,dif) < max.Int64 + const log10MaxInt64 = 19 + if unscaled.Cmp(maxInt64) < 0 && dif < log10MaxInt64 { + divide := int64(math.Pow10(dif)) + result := unscaled.Int64() / divide + mod := unscaled.Int64() % divide + if mod != 0 { + return result + 1 + } + return result + } + + // We should only convert back to int64 when getting the result. + divisor := intPool.Get().(*big.Int) + exp := intPool.Get().(*big.Int) + result := intPool.Get().(*big.Int) + defer func() { + intPool.Put(divisor) + intPool.Put(exp) + intPool.Put(result) + }() + + // divisor = 10^(dif) + // TODO: create loop up table if exp costs too much. + divisor.Exp(bigTen, exp.SetInt64(int64(dif)), nil) + // reuse exp + remainder := exp + + // result = unscaled / divisor + // remainder = unscaled % divisor + result.DivMod(unscaled, divisor, remainder) + if remainder.Sign() != 0 { + return result.Int64() + 1 + } + + return result.Int64() +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/resource/scale_int_test.go b/vendor/k8s.io/kubernetes/pkg/api/resource/scale_int_test.go new file mode 100644 index 000000000..1b4390e55 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/resource/scale_int_test.go @@ -0,0 +1,85 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package resource + +import ( + "math" + "math/big" + "testing" +) + +func TestScaledValueInternal(t *testing.T) { + tests := []struct { + unscaled *big.Int + scale int + newScale int + + want int64 + }{ + // remain scale + {big.NewInt(1000), 0, 0, 1000}, + + // scale down + {big.NewInt(1000), 0, -3, 1}, + {big.NewInt(1000), 3, 0, 1}, + {big.NewInt(0), 3, 0, 0}, + + // always round up + {big.NewInt(999), 3, 0, 1}, + {big.NewInt(500), 3, 0, 1}, + {big.NewInt(499), 3, 0, 1}, + {big.NewInt(1), 3, 0, 1}, + // large scaled value does not lose precision + {big.NewInt(0).Sub(maxInt64, bigOne), 1, 0, (math.MaxInt64-1)/10 + 1}, + // large intermidiate result. + {big.NewInt(1).Exp(big.NewInt(10), big.NewInt(100), nil), 100, 0, 1}, + + // scale up + {big.NewInt(0), 0, 3, 0}, + {big.NewInt(1), 0, 3, 1000}, + {big.NewInt(1), -3, 0, 1000}, + {big.NewInt(1000), -3, 2, 100000000}, + {big.NewInt(0).Div(big.NewInt(math.MaxInt64), bigThousand), 0, 3, + (math.MaxInt64 / 1000) * 1000}, + } + + for i, tt := range tests { + old := (&big.Int{}).Set(tt.unscaled) + got := scaledValue(tt.unscaled, tt.scale, tt.newScale) + if got != tt.want { + t.Errorf("#%d: got = %v, want %v", i, got, tt.want) + } + if tt.unscaled.Cmp(old) != 0 { + t.Errorf("#%d: unscaled = %v, want %v", i, tt.unscaled, old) + } + } +} + +func BenchmarkScaledValueSmall(b *testing.B) { + s := big.NewInt(1000) + for i := 0; i < b.N; i++ { + scaledValue(s, 3, 0) + } +} + +func BenchmarkScaledValueLarge(b *testing.B) { + s := big.NewInt(math.MaxInt64) + s.Mul(s, big.NewInt(1000)) + for i := 0; i < b.N; i++ { + scaledValue(s, 10, 0) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/resource/suffix.go b/vendor/k8s.io/kubernetes/pkg/api/resource/suffix.go index 5dc837dc1..529712365 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/resource/suffix.go +++ b/vendor/k8s.io/kubernetes/pkg/api/resource/suffix.go @@ -83,6 +83,8 @@ func newSuffixer() suffixer { // a suffix for 2^0. sh.decSuffixes.addSuffix("", bePair{2, 0}) + sh.decSuffixes.addSuffix("n", bePair{10, -9}) + sh.decSuffixes.addSuffix("u", bePair{10, -6}) sh.decSuffixes.addSuffix("m", bePair{10, -3}) sh.decSuffixes.addSuffix("", bePair{10, 0}) sh.decSuffixes.addSuffix("k", bePair{10, 3}) diff --git a/vendor/k8s.io/kubernetes/pkg/api/resource_helpers.go b/vendor/k8s.io/kubernetes/pkg/api/resource_helpers.go index 72f3c7f04..7a98a4c2f 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/resource_helpers.go +++ b/vendor/k8s.io/kubernetes/pkg/api/resource_helpers.go @@ -30,7 +30,7 @@ func (self *ResourceList) Cpu() *resource.Quantity { if val, ok := (*self)[ResourceCPU]; ok { return &val } - return &resource.Quantity{} + return &resource.Quantity{Format: resource.DecimalSI} } // Returns the Memory limit if specified. @@ -38,7 +38,7 @@ func (self *ResourceList) Memory() *resource.Quantity { if val, ok := (*self)[ResourceMemory]; ok { return &val } - return &resource.Quantity{} + return &resource.Quantity{Format: resource.BinarySI} } func (self *ResourceList) Pods() *resource.Quantity { @@ -87,3 +87,36 @@ func GetPodReadyCondition(status PodStatus) *PodCondition { } return nil } + +// IsNodeReady returns true if a node is ready; false otherwise. +func IsNodeReady(node *Node) bool { + for _, c := range node.Status.Conditions { + if c.Type == NodeReady { + return c.Status == ConditionTrue + } + } + return false +} + +// PodRequestsAndLimits returns a dictionary of all defined resources summed up for all +// containers of the pod. +func PodRequestsAndLimits(pod *Pod) (reqs map[ResourceName]resource.Quantity, limits map[ResourceName]resource.Quantity, err error) { + reqs, limits = map[ResourceName]resource.Quantity{}, map[ResourceName]resource.Quantity{} + for _, container := range pod.Spec.Containers { + for name, quantity := range container.Resources.Requests { + if value, ok := reqs[name]; !ok { + reqs[name] = *quantity.Copy() + } else if err = value.Add(quantity); err != nil { + return nil, nil, err + } + } + for name, quantity := range container.Resources.Limits { + if value, ok := limits[name]; !ok { + limits[name] = *quantity.Copy() + } else if err = value.Add(quantity); err != nil { + return nil, nil, err + } + } + } + return +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/resource_helpers_test.go b/vendor/k8s.io/kubernetes/pkg/api/resource_helpers_test.go index b3bc1a961..12c0ce7db 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/resource_helpers_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/resource_helpers_test.go @@ -51,3 +51,13 @@ func TestResourceHelpers(t *testing.T) { t.Errorf("expected memorylimit %v, got %v", memoryLimit, res) } } + +func TestDefaultResourceHelpers(t *testing.T) { + resourceList := ResourceList{} + if resourceList.Cpu().Format != resource.DecimalSI { + t.Errorf("expected %v, actual %v", resource.DecimalSI, resourceList.Cpu().Format) + } + if resourceList.Memory().Format != resource.BinarySI { + t.Errorf("expected %v, actual %v", resource.BinarySI, resourceList.Memory().Format) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/rest/create.go b/vendor/k8s.io/kubernetes/pkg/api/rest/create.go index 2886d3753..4e3a8938b 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/rest/create.go +++ b/vendor/k8s.io/kubernetes/pkg/api/rest/create.go @@ -19,9 +19,10 @@ package rest import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/validation" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/validation/field" ) // RESTCreateStrategy defines the minimum validation, accepted input, and @@ -37,11 +38,15 @@ type RESTCreateStrategy interface { NamespaceScoped() bool // PrepareForCreate is invoked on create before validation to normalize // the object. For example: remove fields that are not to be persisted, - // sort order-insensitive list fields, etc. + // sort order-insensitive list fields, etc. This should not remove fields + // whose presence would be considered a validation error. PrepareForCreate(obj runtime.Object) // Validate is invoked after default fields in the object have been filled in before - // the object is persisted. - Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList + // the object is persisted. This method should not mutate the object. + Validate(ctx api.Context, obj runtime.Object) field.ErrorList + // Canonicalize is invoked after validation has succeeded but before the + // object has been persisted. This method may mutate the object. + Canonicalize(obj runtime.Object) } // BeforeCreate ensures that common operations for all resources are performed on creation. It only returns @@ -67,16 +72,18 @@ func BeforeCreate(strategy RESTCreateStrategy, ctx api.Context, obj runtime.Obje api.GenerateName(strategy, objectMeta) if errs := strategy.Validate(ctx, obj); len(errs) > 0 { - return errors.NewInvalid(kind, objectMeta.Name, errs) + return errors.NewInvalid(kind.GroupKind(), objectMeta.Name, errs) } // Custom validation (including name validation) passed // Now run common validation on object meta // Do this *after* custom validation so that specific error messages are shown whenever possible - if errs := validation.ValidateObjectMeta(objectMeta, strategy.NamespaceScoped(), validation.ValidatePathSegmentName); len(errs) > 0 { - return errors.NewInvalid(kind, objectMeta.Name, errs) + if errs := validation.ValidateObjectMeta(objectMeta, strategy.NamespaceScoped(), validation.ValidatePathSegmentName, field.NewPath("metadata")); len(errs) > 0 { + return errors.NewInvalid(kind.GroupKind(), objectMeta.Name, errs) } + strategy.Canonicalize(obj) + return nil } @@ -96,18 +103,24 @@ func CheckGeneratedNameError(strategy RESTCreateStrategy, err error, obj runtime return err } - return errors.NewServerTimeout(kind, "POST", 0) + return errors.NewServerTimeoutForKind(kind.GroupKind(), "POST", 0) } // objectMetaAndKind retrieves kind and ObjectMeta from a runtime object, or returns an error. -func objectMetaAndKind(typer runtime.ObjectTyper, obj runtime.Object) (*api.ObjectMeta, string, error) { +func objectMetaAndKind(typer runtime.ObjectTyper, obj runtime.Object) (*api.ObjectMeta, unversioned.GroupVersionKind, error) { objectMeta, err := api.ObjectMetaFor(obj) if err != nil { - return nil, "", errors.NewInternalError(err) + return nil, unversioned.GroupVersionKind{}, errors.NewInternalError(err) } - _, kind, err := typer.ObjectVersionAndKind(obj) + kind, err := typer.ObjectKind(obj) if err != nil { - return nil, "", errors.NewInternalError(err) + return nil, unversioned.GroupVersionKind{}, errors.NewInternalError(err) } return objectMeta, kind, nil } + +// NamespaceScopedStrategy has a method to tell if the object must be in a namespace. +type NamespaceScopedStrategy interface { + // NamespaceScoped returns if the object must be in a namespace. + NamespaceScoped() bool +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/rest/create_test.go b/vendor/k8s.io/kubernetes/pkg/api/rest/create_test.go deleted file mode 100644 index 8bf7ef696..000000000 --- a/vendor/k8s.io/kubernetes/pkg/api/rest/create_test.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package rest - -import ( - "testing" - - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/errors" -) - -func TestCheckGeneratedNameError(t *testing.T) { - expect := errors.NewNotFound("foo", "bar") - if err := CheckGeneratedNameError(Services, expect, &api.Pod{}); err != expect { - t.Errorf("NotFoundError should be ignored: %v", err) - } - - expect = errors.NewAlreadyExists("foo", "bar") - if err := CheckGeneratedNameError(Services, expect, &api.Pod{}); err != expect { - t.Errorf("AlreadyExists should be returned when no GenerateName field: %v", err) - } - - expect = errors.NewAlreadyExists("foo", "bar") - if err := CheckGeneratedNameError(Services, expect, &api.Pod{ObjectMeta: api.ObjectMeta{GenerateName: "foo"}}); err == nil || !errors.IsServerTimeout(err) { - t.Errorf("expected try again later error: %v", err) - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/api/rest/export.go b/vendor/k8s.io/kubernetes/pkg/api/rest/export.go new file mode 100644 index 000000000..e12f65de3 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/rest/export.go @@ -0,0 +1,28 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rest + +import ( + "k8s.io/kubernetes/pkg/runtime" +) + +// RESTExportStrategy is the interface that defines how to export a Kubernetes object +type RESTExportStrategy interface { + // Export strips fields that can not be set by the user. If 'exact' is false + // fields specific to the cluster are also stripped + Export(obj runtime.Object, exact bool) error +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/rest/rest.go b/vendor/k8s.io/kubernetes/pkg/api/rest/rest.go index 57be322a7..584670f77 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/rest/rest.go +++ b/vendor/k8s.io/kubernetes/pkg/api/rest/rest.go @@ -22,8 +22,7 @@ import ( "net/url" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/watch" ) @@ -56,13 +55,29 @@ type Storage interface { New() runtime.Object } +// KindProvider specifies a different kind for its API than for its internal storage. This is necessary for external +// objects that are not compiled into the api server. For such objects, there is no in-memory representation for +// the object, so they must be represented as generic objects (e.g. RawJSON), but when we present the object as part of +// API discovery we want to present the specific kind, not the generic internal representation. +type KindProvider interface { + Kind() string +} + // Lister is an object that can retrieve resources that match the provided field and label criteria. type Lister interface { // NewList returns an empty object that can be used with the List call. // This object must be a pointer type for use with Codec.DecodeInto([]byte, runtime.Object) NewList() runtime.Object - // List selects resources in the storage which match to the selector. - List(ctx api.Context, label labels.Selector, field fields.Selector) (runtime.Object, error) + // List selects resources in the storage which match to the selector. 'options' can be nil. + List(ctx api.Context, options *api.ListOptions) (runtime.Object, error) +} + +// Exporter is an object that knows how to strip a RESTful resource for export +type Exporter interface { + // Export an object. Fields that are not user specified (e.g. Status, ObjectMeta.ResourceVersion) are stripped out + // Returns the stripped object. If 'exact' is true, fields that are specific to the cluster (e.g. namespace) are + // retained, otherwise they are stripped also. + Export(ctx api.Context, name string, opts unversioned.ExportOptions) (runtime.Object, error) } // Getter is an object that can retrieve a named RESTful resource. @@ -126,6 +141,17 @@ func (w GracefulDeleteAdapter) Delete(ctx api.Context, name string, options *api return w.Deleter.Delete(ctx, name) } +// CollectionDeleter is an object that can delete a collection +// of RESTful resources. +type CollectionDeleter interface { + // DeleteCollection selects all resources in the storage matching given 'listOptions' + // and deletes them. If 'options' are provided, the resource will attempt to honor + // them or return an invalid request error. + // DeleteCollection may not be atomic - i.e. it may delete some objects and still + // return an error after it. On success, returns a list of deleted objects. + DeleteCollection(ctx api.Context, options *api.DeleteOptions, listOptions *api.ListOptions) (runtime.Object, error) +} + // Creater is an object that can create an instance of a RESTful object. type Creater interface { // New returns an empty object that can be used with Create after request data has been put into it. @@ -183,7 +209,7 @@ type Watcher interface { // are supported; an error should be returned if 'field' tries to select on a field that // isn't supported. 'resourceVersion' allows for continuing/starting a watch at a // particular version. - Watch(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(ctx api.Context, options *api.ListOptions) (watch.Interface, error) } // StandardStorage is an interface covering the common verbs. Provided for testing whether a @@ -193,6 +219,7 @@ type StandardStorage interface { Lister CreaterUpdater GracefulDeleter + CollectionDeleter Watcher } @@ -263,5 +290,4 @@ type ConnectRequest struct { ResourcePath string } -// IsAnAPIObject makes ConnectRequest a runtime.Object -func (*ConnectRequest) IsAnAPIObject() {} +func (obj *ConnectRequest) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } diff --git a/vendor/k8s.io/kubernetes/pkg/api/rest/resttest/resttest.go b/vendor/k8s.io/kubernetes/pkg/api/rest/resttest/resttest.go index 7d8bed11b..fbf0bf87d 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/rest/resttest/resttest.go +++ b/vendor/k8s.io/kubernetes/pkg/api/rest/resttest/resttest.go @@ -32,36 +32,25 @@ import ( "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/tools" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/wait" ) type Tester struct { *testing.T storage rest.Storage - storageError injectErrorFunc clusterScope bool createOnUpdate bool generatesName bool returnDeletedObject bool } -type injectErrorFunc func(err error) - -func New(t *testing.T, storage rest.Storage, storageError injectErrorFunc) *Tester { +func New(t *testing.T, storage rest.Storage) *Tester { return &Tester{ - T: t, - storage: storage, - storageError: storageError, + T: t, + storage: storage, } } -func (t *Tester) withStorageError(err error, fn func()) { - t.storageError(err) - defer t.storageError(nil) - fn() -} - func (t *Tester) ClusterScope() *Tester { t.clusterScope = true return t @@ -142,7 +131,6 @@ func (t *Tester) TestCreate(valid runtime.Object, setFn SetFunc, getFn GetFunc, t.testCreateHasMetadata(copyOrDie(valid)) if !t.generatesName { t.testCreateGeneratesName(copyOrDie(valid)) - t.testCreateGeneratesNameReturnsServerTimeout(copyOrDie(valid)) } t.testCreateEquals(copyOrDie(valid), getFn) t.testCreateAlreadyExisting(copyOrDie(valid), setFn) @@ -158,9 +146,9 @@ func (t *Tester) TestCreate(valid runtime.Object, setFn SetFunc, getFn GetFunc, } // Test updating an object. -func (t *Tester) TestUpdate(valid runtime.Object, setFn SetFunc, setRVFn SetRVFunc, getFn GetFunc, updateFn UpdateFunc, invalidUpdateFn ...UpdateFunc) { +func (t *Tester) TestUpdate(valid runtime.Object, setFn SetFunc, getFn GetFunc, updateFn UpdateFunc, invalidUpdateFn ...UpdateFunc) { t.testUpdateEquals(copyOrDie(valid), setFn, getFn, updateFn) - t.testUpdateFailsOnVersionTooOld(copyOrDie(valid), setFn, setRVFn) + t.testUpdateFailsOnVersionTooOld(copyOrDie(valid), setFn, getFn) t.testUpdateOnNotFound(copyOrDie(valid)) if !t.clusterScope { t.testUpdateRejectsMismatchedNamespace(copyOrDie(valid), setFn) @@ -194,20 +182,18 @@ func (t *Tester) TestGet(valid runtime.Object) { } // Test listing objects. -func (t *Tester) TestList(valid runtime.Object, assignFn AssignFunc, setRVFn SetRVFunc) { - t.testListError() +func (t *Tester) TestList(valid runtime.Object, assignFn AssignFunc) { + t.testListNotFound(assignFn) t.testListFound(copyOrDie(valid), assignFn) - t.testListNotFound(assignFn, setRVFn) t.testListMatchLabels(copyOrDie(valid), assignFn) } // Test watching objects. func (t *Tester) TestWatch( - valid runtime.Object, initWatchFn InitWatchFunc, injectErrFn InjectErrFunc, emitFn EmitFunc, + valid runtime.Object, emitFn EmitFunc, labelsPass, labelsFail []labels.Set, fieldsPass, fieldsFail []fields.Set, actions []string) { - t.testWatch(initWatchFn, injectErrFn) - t.testWatchLabels(copyOrDie(valid), initWatchFn, emitFn, labelsPass, labelsFail, actions) - t.testWatchFields(copyOrDie(valid), initWatchFn, emitFn, fieldsPass, fieldsFail, actions) + t.testWatchLabels(copyOrDie(valid), emitFn, labelsPass, labelsFail, actions) + t.testWatchFields(copyOrDie(valid), emitFn, fieldsPass, fieldsFail, actions) } // ============================================================================= @@ -285,18 +271,6 @@ func (t *Tester) testCreateGeneratesName(valid runtime.Object) { } } -func (t *Tester) testCreateGeneratesNameReturnsServerTimeout(valid runtime.Object) { - objectMeta := t.getObjectMetaOrFail(valid) - objectMeta.Name = "" - objectMeta.GenerateName = "test-" - t.withStorageError(errors.NewAlreadyExists("kind", "thing"), func() { - _, err := t.storage.(rest.Creater).Create(t.TestContext(), valid) - if err == nil || !errors.IsServerTimeout(err) { - t.Fatalf("Unexpected error: %v", err) - } - }) -} - func (t *Tester) testCreateHasMetadata(valid runtime.Object) { objectMeta := t.getObjectMetaOrFail(valid) objectMeta.Name = "" @@ -452,22 +426,26 @@ func (t *Tester) testUpdateEquals(obj runtime.Object, setFn SetFunc, getFn GetFu } } -func (t *Tester) testUpdateFailsOnVersionTooOld(obj runtime.Object, setFn SetFunc, setRVFn SetRVFunc) { +func (t *Tester) testUpdateFailsOnVersionTooOld(obj runtime.Object, setFn SetFunc, getFn GetFunc) { ctx := t.TestContext() foo := copyOrDie(obj) t.setObjectMeta(foo, "foo3") - setRVFn(10) if err := setFn(ctx, foo); err != nil { t.Errorf("unexpected error: %v", err) } - older := copyOrDie(foo) - olderMeta := t.getObjectMetaOrFail(older) - olderMeta.ResourceVersion = "8" + storedFoo, err := getFn(ctx, foo) + if err != nil { + t.Errorf("unexpected error: %v", err) + } - _, _, err := t.storage.(rest.Updater).Update(t.TestContext(), older) + older := copyOrDie(storedFoo) + olderMeta := t.getObjectMetaOrFail(older) + olderMeta.ResourceVersion = "1" + + _, _, err = t.storage.(rest.Updater).Update(t.TestContext(), older) if err == nil { t.Errorf("Expected an error, but we didn't get one") } else if !errors.IsConflict(err) { @@ -572,12 +550,11 @@ func (t *Tester) testDeleteNoGraceful(obj runtime.Object, setFn SetFunc, getFn G func (t *Tester) testDeleteNonExist(obj runtime.Object) { objectMeta := t.getObjectMetaOrFail(obj) - t.withStorageError(tools.EtcdErrorNotFound, func() { - _, err := t.storage.(rest.GracefulDeleter).Delete(t.TestContext(), objectMeta.Name, nil) - if err == nil || !errors.IsNotFound(err) { - t.Errorf("unexpected error: %v", err) - } - }) + _, err := t.storage.(rest.GracefulDeleter).Delete(t.TestContext(), objectMeta.Name, nil) + if err == nil || !errors.IsNotFound(err) { + t.Errorf("unexpected error: %v", err) + } + } // ============================================================================= @@ -696,7 +673,8 @@ func (t *Tester) testDeleteGracefulImmediate(obj runtime.Object, setFn SetFunc, t.Errorf("unexpected error, object should be deleted immediately: %v", err) } objectMeta = t.getObjectMetaOrFail(out) - if objectMeta.DeletionTimestamp == nil || objectMeta.DeletionGracePeriodSeconds == nil || *objectMeta.DeletionGracePeriodSeconds != 0 { + // the second delete shouldn't update the object, so the objectMeta.DeletionGracePeriodSeconds should eqaul to the value set in the first delete. + if objectMeta.DeletionTimestamp == nil || objectMeta.DeletionGracePeriodSeconds == nil || *objectMeta.DeletionGracePeriodSeconds != expectedGrace { t.Errorf("unexpected deleted meta: %#v", objectMeta) } } @@ -848,18 +826,6 @@ func listToItems(listObj runtime.Object) ([]runtime.Object, error) { return result, nil } -func (t *Tester) testListError() { - ctx := t.TestContext() - - storageError := fmt.Errorf("test error") - t.withStorageError(storageError, func() { - _, err := t.storage.(rest.Lister).List(ctx, labels.Everything(), fields.Everything()) - if err != storageError { - t.Errorf("unexpected error: %v", err) - } - }) -} - func (t *Tester) testListFound(obj runtime.Object, assignFn AssignFunc) { ctx := t.TestContext() @@ -870,7 +836,7 @@ func (t *Tester) testListFound(obj runtime.Object, assignFn AssignFunc) { existing := assignFn([]runtime.Object{foo1, foo2}) - listObj, err := t.storage.(rest.Lister).List(ctx, labels.Everything(), fields.Everything()) + listObj, err := t.storage.(rest.Lister).List(ctx, nil) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -890,19 +856,22 @@ func (t *Tester) testListMatchLabels(obj runtime.Object, assignFn AssignFunc) { ctx := t.TestContext() testLabels := map[string]string{"key": "value"} - foo1 := copyOrDie(obj) - t.setObjectMeta(foo1, "foo1") - foo2 := copyOrDie(obj) - foo2Meta := t.getObjectMetaOrFail(foo2) - foo2Meta.Name = "foo2" - foo2Meta.Namespace = api.NamespaceValue(ctx) - foo2Meta.Labels = testLabels + foo3 := copyOrDie(obj) + t.setObjectMeta(foo3, "foo3") + foo4 := copyOrDie(obj) + foo4Meta := t.getObjectMetaOrFail(foo4) + foo4Meta.Name = "foo4" + foo4Meta.Namespace = api.NamespaceValue(ctx) + foo4Meta.Labels = testLabels - existing := assignFn([]runtime.Object{foo1, foo2}) - filtered := []runtime.Object{existing[1]} + objs := ([]runtime.Object{foo3, foo4}) + + assignFn(objs) + filtered := []runtime.Object{objs[1]} selector := labels.SelectorFromSet(labels.Set(testLabels)) - listObj, err := t.storage.(rest.Lister).List(ctx, selector, fields.Everything()) + options := &api.ListOptions{LabelSelector: selector} + listObj, err := t.storage.(rest.Lister).List(ctx, options) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -918,13 +887,11 @@ func (t *Tester) testListMatchLabels(obj runtime.Object, assignFn AssignFunc) { } } -func (t *Tester) testListNotFound(assignFn AssignFunc, setRVFn SetRVFunc) { +func (t *Tester) testListNotFound(assignFn AssignFunc) { ctx := t.TestContext() - - setRVFn(uint64(123)) _ = assignFn([]runtime.Object{}) - listObj, err := t.storage.(rest.Lister).List(ctx, labels.Everything(), fields.Everything()) + listObj, err := t.storage.(rest.Lister).List(ctx, nil) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -933,54 +900,24 @@ func (t *Tester) testListNotFound(assignFn AssignFunc, setRVFn SetRVFunc) { t.Errorf("unexpected error: %v", err) } if len(items) != 0 { - t.Errorf("unexpected items: %v", items) - } - - meta, err := api.ListMetaFor(listObj) - if err != nil { - t.Errorf("unexpected error: %v", err) - } - if meta.ResourceVersion != "123" { - t.Errorf("unexpected resource version: %d", meta.ResourceVersion) + t.Errorf("unexpected items: %#v", items) } } // ============================================================================= // Watching tests. -func (t *Tester) testWatch(initWatchFn InitWatchFunc, injectErrFn InjectErrFunc) { - ctx := t.TestContext() - watcher, err := t.storage.(rest.Watcher).Watch(ctx, labels.Everything(), fields.Everything(), "1") - if err != nil { - t.Errorf("unexpected error: %v", err) - } - initWatchFn() - - select { - case _, ok := <-watcher.ResultChan(): - if !ok { - t.Errorf("watch channel should be open") - } - default: - } - - injectErrFn(nil) - if _, ok := <-watcher.ResultChan(); ok { - t.Errorf("watch channel should be closed") - } - watcher.Stop() -} - -func (t *Tester) testWatchFields(obj runtime.Object, initWatchFn InitWatchFunc, emitFn EmitFunc, fieldsPass, fieldsFail []fields.Set, actions []string) { +func (t *Tester) testWatchFields(obj runtime.Object, emitFn EmitFunc, fieldsPass, fieldsFail []fields.Set, actions []string) { ctx := t.TestContext() for _, field := range fieldsPass { for _, action := range actions { - watcher, err := t.storage.(rest.Watcher).Watch(ctx, labels.Everything(), field.AsSelector(), "1") + options := &api.ListOptions{FieldSelector: field.AsSelector(), ResourceVersion: "1"} + watcher, err := t.storage.(rest.Watcher).Watch(ctx, options) if err != nil { - t.Errorf("unexpected error: %v", err) + t.Errorf("unexpected error: %v, %v", err, action) } - initWatchFn() + if err := emitFn(obj, action); err != nil { t.Errorf("unexpected error: %v", err) } @@ -990,7 +927,7 @@ func (t *Tester) testWatchFields(obj runtime.Object, initWatchFn InitWatchFunc, if !ok { t.Errorf("watch channel should be open") } - case <-time.After(util.ForeverTestTimeout): + case <-time.After(wait.ForeverTestTimeout): t.Errorf("unexpected timeout from result channel") } watcher.Stop() @@ -999,11 +936,11 @@ func (t *Tester) testWatchFields(obj runtime.Object, initWatchFn InitWatchFunc, for _, field := range fieldsFail { for _, action := range actions { - watcher, err := t.storage.(rest.Watcher).Watch(ctx, labels.Everything(), field.AsSelector(), "1") + options := &api.ListOptions{FieldSelector: field.AsSelector(), ResourceVersion: "1"} + watcher, err := t.storage.(rest.Watcher).Watch(ctx, options) if err != nil { t.Errorf("unexpected error: %v", err) } - initWatchFn() if err := emitFn(obj, action); err != nil { t.Errorf("unexpected error: %v", err) } @@ -1019,16 +956,16 @@ func (t *Tester) testWatchFields(obj runtime.Object, initWatchFn InitWatchFunc, } } -func (t *Tester) testWatchLabels(obj runtime.Object, initWatchFn InitWatchFunc, emitFn EmitFunc, labelsPass, labelsFail []labels.Set, actions []string) { +func (t *Tester) testWatchLabels(obj runtime.Object, emitFn EmitFunc, labelsPass, labelsFail []labels.Set, actions []string) { ctx := t.TestContext() for _, label := range labelsPass { for _, action := range actions { - watcher, err := t.storage.(rest.Watcher).Watch(ctx, label.AsSelector(), fields.Everything(), "1") + options := &api.ListOptions{LabelSelector: label.AsSelector(), ResourceVersion: "1"} + watcher, err := t.storage.(rest.Watcher).Watch(ctx, options) if err != nil { t.Errorf("unexpected error: %v", err) } - initWatchFn() if err := emitFn(obj, action); err != nil { t.Errorf("unexpected error: %v", err) } @@ -1038,7 +975,7 @@ func (t *Tester) testWatchLabels(obj runtime.Object, initWatchFn InitWatchFunc, if !ok { t.Errorf("watch channel should be open") } - case <-time.After(util.ForeverTestTimeout): + case <-time.After(wait.ForeverTestTimeout): t.Errorf("unexpected timeout from result channel") } watcher.Stop() @@ -1047,11 +984,11 @@ func (t *Tester) testWatchLabels(obj runtime.Object, initWatchFn InitWatchFunc, for _, label := range labelsFail { for _, action := range actions { - watcher, err := t.storage.(rest.Watcher).Watch(ctx, label.AsSelector(), fields.Everything(), "1") + options := &api.ListOptions{LabelSelector: label.AsSelector(), ResourceVersion: "1"} + watcher, err := t.storage.(rest.Watcher).Watch(ctx, options) if err != nil { t.Errorf("unexpected error: %v", err) } - initWatchFn() if err := emitFn(obj, action); err != nil { t.Errorf("unexpected error: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/rest/types.go b/vendor/k8s.io/kubernetes/pkg/api/rest/types.go index 8701f9c04..0e7f048ba 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/rest/types.go +++ b/vendor/k8s.io/kubernetes/pkg/api/rest/types.go @@ -17,10 +17,7 @@ limitations under the License. package rest import ( - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/validation" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util/fielderrors" ) // ObjectFunc is a function to act on a given object. An error may be returned @@ -43,51 +40,3 @@ func AllFuncs(fns ...ObjectFunc) ObjectFunc { return nil } } - -// svcStrategy implements behavior for Services -// TODO: move to a service specific package. -type svcStrategy struct { - runtime.ObjectTyper - api.NameGenerator -} - -// Services is the default logic that applies when creating and updating Service -// objects. -var Services = svcStrategy{api.Scheme, api.SimpleNameGenerator} - -// NamespaceScoped is true for services. -func (svcStrategy) NamespaceScoped() bool { - return true -} - -// PrepareForCreate clears fields that are not allowed to be set by end users on creation. -func (svcStrategy) PrepareForCreate(obj runtime.Object) { - service := obj.(*api.Service) - service.Status = api.ServiceStatus{} -} - -// PrepareForUpdate clears fields that are not allowed to be set by end users on update. -func (svcStrategy) PrepareForUpdate(obj, old runtime.Object) { - // TODO: once service has a status sub-resource we can enable this. - //newService := obj.(*api.Service) - //oldService := old.(*api.Service) - //newService.Status = oldService.Status -} - -// Validate validates a new service. -func (svcStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList { - service := obj.(*api.Service) - return validation.ValidateService(service) -} - -func (svcStrategy) AllowCreateOnUpdate() bool { - return true -} - -func (svcStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList { - return validation.ValidateServiceUpdate(old.(*api.Service), obj.(*api.Service)) -} - -func (svcStrategy) AllowUnconditionalUpdate() bool { - return true -} diff --git a/vendor/k8s.io/kubernetes/pkg/api/rest/update.go b/vendor/k8s.io/kubernetes/pkg/api/rest/update.go index 394cb3d5f..80ad14f86 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/rest/update.go +++ b/vendor/k8s.io/kubernetes/pkg/api/rest/update.go @@ -17,11 +17,13 @@ limitations under the License. package rest import ( + "fmt" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/validation" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/validation/field" ) // RESTUpdateStrategy defines the minimum validation, accepted input, and @@ -36,29 +38,36 @@ type RESTUpdateStrategy interface { AllowCreateOnUpdate() bool // PrepareForUpdate is invoked on update before validation to normalize // the object. For example: remove fields that are not to be persisted, - // sort order-insensitive list fields, etc. + // sort order-insensitive list fields, etc. This should not remove fields + // whose presence would be considered a validation error. PrepareForUpdate(obj, old runtime.Object) - // ValidateUpdate is invoked after default fields in the object have been filled in before - // the object is persisted. - ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList - // AllowUnconditionalUpdate returns true if the object can be updated unconditionally (irrespective of the latest resource version), when there is no resource version specified in the object. + // ValidateUpdate is invoked after default fields in the object have been + // filled in before the object is persisted. This method should not mutate + // the object. + ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList + // Canonicalize is invoked after validation has succeeded but before the + // object has been persisted. This method may mutate the object. + Canonicalize(obj runtime.Object) + // AllowUnconditionalUpdate returns true if the object can be updated + // unconditionally (irrespective of the latest resource version), when + // there is no resource version specified in the object. AllowUnconditionalUpdate() bool } // TODO: add other common fields that require global validation. -func validateCommonFields(obj, old runtime.Object) fielderrors.ValidationErrorList { - allErrs := fielderrors.ValidationErrorList{} +func validateCommonFields(obj, old runtime.Object) (field.ErrorList, error) { + allErrs := field.ErrorList{} objectMeta, err := api.ObjectMetaFor(obj) if err != nil { - return append(allErrs, errors.NewInternalError(err)) + return nil, fmt.Errorf("failed to get new object metadata: %v", err) } oldObjectMeta, err := api.ObjectMetaFor(old) if err != nil { - return append(allErrs, errors.NewInternalError(err)) + return nil, fmt.Errorf("failed to get old object metadata: %v", err) } - allErrs = append(allErrs, validation.ValidateObjectMetaUpdate(objectMeta, oldObjectMeta)...) + allErrs = append(allErrs, validation.ValidateObjectMetaUpdate(objectMeta, oldObjectMeta, field.NewPath("metadata"))...) - return allErrs + return allErrs, nil } // BeforeUpdate ensures that common operations for all resources are performed on update. It only returns @@ -80,11 +89,17 @@ func BeforeUpdate(strategy RESTUpdateStrategy, ctx api.Context, obj, old runtime strategy.PrepareForUpdate(obj, old) // Ensure some common fields, like UID, are validated for all resources. - errs := validateCommonFields(obj, old) + errs, err := validateCommonFields(obj, old) + if err != nil { + return errors.NewInternalError(err) + } errs = append(errs, strategy.ValidateUpdate(ctx, obj, old)...) if len(errs) > 0 { - return errors.NewInvalid(kind, objectMeta.Name, errs) + return errors.NewInvalid(kind.GroupKind(), objectMeta.Name, errs) } + + strategy.Canonicalize(obj) + return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/api/rest/update_test.go b/vendor/k8s.io/kubernetes/pkg/api/rest/update_test.go deleted file mode 100644 index d5512cbad..000000000 --- a/vendor/k8s.io/kubernetes/pkg/api/rest/update_test.go +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package rest - -import ( - "testing" - - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" -) - -func makeValidService() api.Service { - return api.Service{ - ObjectMeta: api.ObjectMeta{ - Name: "valid", - Namespace: "default", - Labels: map[string]string{}, - Annotations: map[string]string{}, - ResourceVersion: "1", - }, - Spec: api.ServiceSpec{ - Selector: map[string]string{"key": "val"}, - SessionAffinity: "None", - Type: api.ServiceTypeClusterIP, - Ports: []api.ServicePort{{Name: "p", Protocol: "TCP", Port: 8675, TargetPort: util.NewIntOrStringFromInt(8675)}}, - }, - } -} - -// TODO: This should be done on types that are not part of our API -func TestBeforeUpdate(t *testing.T) { - testCases := []struct { - name string - tweakSvc func(oldSvc, newSvc *api.Service) // given basic valid services, each test case can customize them - expectErr bool - }{ - { - name: "no change", - tweakSvc: func(oldSvc, newSvc *api.Service) { - // nothing - }, - expectErr: false, - }, - { - name: "change port", - tweakSvc: func(oldSvc, newSvc *api.Service) { - newSvc.Spec.Ports[0].Port++ - }, - expectErr: false, - }, - { - name: "bad namespace", - tweakSvc: func(oldSvc, newSvc *api.Service) { - newSvc.Namespace = "#$%%invalid" - }, - expectErr: true, - }, - { - name: "change name", - tweakSvc: func(oldSvc, newSvc *api.Service) { - newSvc.Name += "2" - }, - expectErr: true, - }, - { - name: "change ClusterIP", - tweakSvc: func(oldSvc, newSvc *api.Service) { - oldSvc.Spec.ClusterIP = "1.2.3.4" - newSvc.Spec.ClusterIP = "4.3.2.1" - }, - expectErr: true, - }, - { - name: "change selectpor", - tweakSvc: func(oldSvc, newSvc *api.Service) { - newSvc.Spec.Selector = map[string]string{"newkey": "newvalue"} - }, - expectErr: false, - }, - } - - for _, tc := range testCases { - oldSvc := makeValidService() - newSvc := makeValidService() - tc.tweakSvc(&oldSvc, &newSvc) - ctx := api.NewDefaultContext() - err := BeforeUpdate(Services, ctx, runtime.Object(&oldSvc), runtime.Object(&newSvc)) - if tc.expectErr && err == nil { - t.Errorf("unexpected non-error for %q", tc.name) - } - if !tc.expectErr && err != nil { - t.Errorf("unexpected error for %q: %v", tc.name, err) - } - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/api/serialization_proto_test.go b/vendor/k8s.io/kubernetes/pkg/api/serialization_proto_test.go new file mode 100644 index 000000000..d74c1865d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/serialization_proto_test.go @@ -0,0 +1,95 @@ +// +build proto + +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package api_test + +import ( + "encoding/hex" + "math/rand" + "testing" + + "github.com/gogo/protobuf/proto" + "k8s.io/kubernetes/pkg/api" + apitesting "k8s.io/kubernetes/pkg/api/testing" + "k8s.io/kubernetes/pkg/api/v1" + _ "k8s.io/kubernetes/pkg/apis/extensions" + _ "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/protobuf" + "k8s.io/kubernetes/pkg/util" +) + +func init() { + codecsToTest = append(codecsToTest, func(version string, item runtime.Object) (runtime.Codec, error) { + return protobuf.NewCodec(version, api.Scheme, api.Scheme, api.Scheme), nil + }) +} + +func TestProtobufRoundTrip(t *testing.T) { + obj := &v1.Pod{} + apitesting.FuzzerFor(t, "v1", rand.NewSource(benchmarkSeed)).Fuzz(obj) + data, err := obj.Marshal() + if err != nil { + t.Fatal(err) + } + out := &v1.Pod{} + if err := out.Unmarshal(data); err != nil { + t.Fatal(err) + } + if !api.Semantic.Equalities.DeepEqual(out, obj) { + t.Logf("marshal\n%s", hex.Dump(data)) + t.Fatalf("Unmarshal is unequal\n%s", util.ObjectGoPrintSideBySide(out, obj)) + } +} + +func BenchmarkEncodeProtobufGeneratedMarshal(b *testing.B) { + items := benchmarkItems() + width := len(items) + b.ResetTimer() + for i := 0; i < b.N; i++ { + if _, err := items[i%width].Marshal(); err != nil { + b.Fatal(err) + } + } + b.StopTimer() +} + +// BenchmarkDecodeJSON provides a baseline for regular JSON decode performance +func BenchmarkDecodeIntoProtobuf(b *testing.B) { + items := benchmarkItems() + width := len(items) + encoded := make([][]byte, width) + for i := range items { + data, err := (&items[i]).Marshal() + if err != nil { + b.Fatal(err) + } + encoded[i] = data + validate := &v1.Pod{} + if err := proto.Unmarshal(data, validate); err != nil { + b.Fatalf("Failed to unmarshal %d: %v\n%#v", i, err, items[i]) + } + } + + for i := 0; i < b.N; i++ { + obj := v1.Pod{} + if err := proto.Unmarshal(encoded[i%width], &obj); err != nil { + b.Fatal(err) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/serialization_test.go b/vendor/k8s.io/kubernetes/pkg/api/serialization_test.go index 3a631af74..f95e9a277 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/serialization_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/serialization_test.go @@ -18,29 +18,34 @@ package api_test import ( "encoding/json" - "math/rand" "reflect" "testing" "github.com/davecgh/go-spew/spew" + flag "github.com/spf13/pflag" + "github.com/ugorji/go/codec" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/testapi" apitesting "k8s.io/kubernetes/pkg/api/testing" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util/sets" - - _ "k8s.io/kubernetes/pkg/apis/extensions" - _ "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" - - flag "github.com/spf13/pflag" ) var fuzzIters = flag.Int("fuzz-iters", 20, "How many fuzzing iterations to do.") -func fuzzInternalObject(t *testing.T, forVersion string, item runtime.Object, seed int64) runtime.Object { +var codecsToTest = []func(version unversioned.GroupVersion, item runtime.Object) (runtime.Codec, error){ + func(version unversioned.GroupVersion, item runtime.Object) (runtime.Codec, error) { + return testapi.GetCodecForObject(item) + }, +} + +func fuzzInternalObject(t *testing.T, forVersion unversioned.GroupVersion, item runtime.Object, seed int64) runtime.Object { apitesting.FuzzerFor(t, forVersion, rand.NewSource(seed)).Fuzz(item) j, err := meta.TypeAccessor(item) @@ -54,28 +59,29 @@ func fuzzInternalObject(t *testing.T, forVersion string, item runtime.Object, se } func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) { + //t.Logf("codec: %#v", codec) + printer := spew.ConfigState{DisableMethods: true} name := reflect.TypeOf(item).Elem().Name() - data, err := codec.Encode(item) + data, err := runtime.Encode(codec, item) if err != nil { t.Errorf("%v: %v (%s)", name, err, printer.Sprintf("%#v", item)) return } - obj2, err := codec.Decode(data) + obj2, err := runtime.Decode(codec, data) if err != nil { t.Errorf("0: %v: %v\nCodec: %v\nData: %s\nSource: %#v", name, err, codec, string(data), printer.Sprintf("%#v", item)) return } if !api.Semantic.DeepEqual(item, obj2) { - t.Errorf("1: %v: diff: %v\nCodec: %v\nSource:\n\n%#v\n\nEncoded:\n\n%s\n\nFinal:\n\n%#v", name, util.ObjectGoPrintDiff(item, obj2), codec, printer.Sprintf("%#v", item), string(data), printer.Sprintf("%#v", obj2)) + t.Errorf("\n1: %v: diff: %v\nCodec: %v\nSource:\n\n%#v\n\nEncoded:\n\n%s\n\nFinal:\n\n%#v", name, util.ObjectGoPrintDiff(item, obj2), codec, printer.Sprintf("%#v", item), string(data), printer.Sprintf("%#v", obj2)) return } obj3 := reflect.New(reflect.TypeOf(item).Elem()).Interface().(runtime.Object) - err = codec.DecodeInto(data, obj3) - if err != nil { + if err := runtime.DecodeInto(codec, data, obj3); err != nil { t.Errorf("2: %v: %v", name, err) return } @@ -86,75 +92,96 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) { } // roundTripSame verifies the same source object is tested in all API versions. -func roundTripSame(t *testing.T, item runtime.Object, except ...string) { +func roundTripSame(t *testing.T, group testapi.TestGroup, item runtime.Object, except ...string) { set := sets.NewString(except...) seed := rand.Int63() - fuzzInternalObject(t, "", item, seed) + fuzzInternalObject(t, group.InternalGroupVersion(), item, seed) - codec, err := testapi.GetCodecForObject(item) - if err != nil { - t.Errorf("unexpected error: %v", err) + version := *group.GroupVersion() + codecs := []runtime.Codec{} + for _, fn := range codecsToTest { + codec, err := fn(version, item) + if err != nil { + t.Errorf("unable to get codec: %v", err) + return + } + codecs = append(codecs, codec) } - version := testapi.Default.Version() - if !set.Has(version) { + if !set.Has(version.String()) { fuzzInternalObject(t, version, item, seed) - roundTrip(t, codec, item) + for _, codec := range codecs { + roundTrip(t, codec, item) + } } } // For debugging problems func TestSpecificKind(t *testing.T) { - api.Scheme.Log(t) - defer api.Scheme.Log(nil) + // api.Scheme.Log(t) + // defer api.Scheme.Log(nil) - kind := "Pod" - doRoundTripTest(kind, t) + kind := "DaemonSet" + for i := 0; i < *fuzzIters; i++ { + doRoundTripTest(testapi.Groups["extensions"], kind, t) + if t.Failed() { + break + } + } } func TestList(t *testing.T) { - api.Scheme.Log(t) - defer api.Scheme.Log(nil) + // api.Scheme.Log(t) + // defer api.Scheme.Log(nil) kind := "List" - item, err := api.Scheme.New("", kind) + item, err := api.Scheme.New(api.SchemeGroupVersion.WithKind(kind)) if err != nil { t.Errorf("Couldn't make a %v? %v", kind, err) return } - roundTripSame(t, item) + roundTripSame(t, testapi.Default, item) } -var nonRoundTrippableTypes = sets.NewString() -var nonInternalRoundTrippableTypes = sets.NewString("List", "ListOptions", "PodExecOptions", "PodAttachOptions") +var nonRoundTrippableTypes = sets.NewString("ExportOptions") + +var nonInternalRoundTrippableTypes = sets.NewString("List", "ListOptions", "ExportOptions") var nonRoundTrippableTypesByVersion = map[string][]string{} func TestRoundTripTypes(t *testing.T) { // api.Scheme.Log(t) // defer api.Scheme.Log(nil) - for kind := range api.Scheme.KnownTypes("") { - if nonRoundTrippableTypes.Has(kind) { - continue - } - // Try a few times, since runTest uses random values. - for i := 0; i < *fuzzIters; i++ { - doRoundTripTest(kind, t) + for groupKey, group := range testapi.Groups { + for kind := range api.Scheme.KnownTypes(group.InternalGroupVersion()) { + t.Logf("working on %v in %v", kind, groupKey) + if nonRoundTrippableTypes.Has(kind) { + continue + } + // Try a few times, since runTest uses random values. + for i := 0; i < *fuzzIters; i++ { + doRoundTripTest(group, kind, t) + if t.Failed() { + break + } + } } } } -func doRoundTripTest(kind string, t *testing.T) { - item, err := api.Scheme.New("", kind) +func doRoundTripTest(group testapi.TestGroup, kind string, t *testing.T) { + item, err := api.Scheme.New(group.InternalGroupVersion().WithKind(kind)) if err != nil { t.Fatalf("Couldn't make a %v? %v", kind, err) } if _, err := meta.TypeAccessor(item); err != nil { t.Fatalf("%q is not a TypeMeta and cannot be tested - add it to nonRoundTrippableTypes: %v", kind, err) } - roundTripSame(t, item, nonRoundTrippableTypesByVersion[kind]...) + if api.Scheme.Recognizes(group.GroupVersion().WithKind(kind)) { + roundTripSame(t, group, item, nonRoundTrippableTypesByVersion[kind]...) + } if !nonInternalRoundTrippableTypes.Has(kind) { - roundTrip(t, api.Codec, fuzzInternalObject(t, "", item, rand.Int63())) + roundTrip(t, group.Codec(), fuzzInternalObject(t, group.InternalGroupVersion(), item, rand.Int63())) } } @@ -174,8 +201,8 @@ func TestEncode_Ptr(t *testing.T) { }, } obj := runtime.Object(pod) - data, err := testapi.Default.Codec().Encode(obj) - obj2, err2 := testapi.Default.Codec().Decode(data) + data, err := runtime.Encode(testapi.Default.Codec(), obj) + obj2, err2 := runtime.Decode(testapi.Default.Codec(), data) if err != nil || err2 != nil { t.Fatalf("Failure: '%v' '%v'", err, err2) } @@ -190,11 +217,11 @@ func TestEncode_Ptr(t *testing.T) { func TestBadJSONRejection(t *testing.T) { badJSONMissingKind := []byte(`{ }`) - if _, err := testapi.Default.Codec().Decode(badJSONMissingKind); err == nil { + if _, err := runtime.Decode(testapi.Default.Codec(), badJSONMissingKind); err == nil { t.Errorf("Did not reject despite lack of kind field: %s", badJSONMissingKind) } badJSONUnknownType := []byte(`{"kind": "bar"}`) - if _, err1 := testapi.Default.Codec().Decode(badJSONUnknownType); err1 == nil { + if _, err1 := runtime.Decode(testapi.Default.Codec(), badJSONUnknownType); err1 == nil { t.Errorf("Did not reject despite use of unknown type: %s", badJSONUnknownType) } /*badJSONKindMismatch := []byte(`{"kind": "Pod"}`) @@ -203,56 +230,188 @@ func TestBadJSONRejection(t *testing.T) { }*/ } +func TestUnversionedTypes(t *testing.T) { + testcases := []runtime.Object{ + &unversioned.Status{Status: "Failure", Message: "something went wrong"}, + &unversioned.APIVersions{Versions: []string{"A", "B", "C"}}, + &unversioned.APIGroupList{Groups: []unversioned.APIGroup{{Name: "mygroup"}}}, + &unversioned.APIGroup{Name: "mygroup"}, + &unversioned.APIResourceList{GroupVersion: "mygroup/myversion"}, + } + + for _, obj := range testcases { + // Make sure the unversioned codec can encode + unversionedJSON, err := runtime.Encode(testapi.Default.Codec(), obj) + if err != nil { + t.Errorf("%v: unexpected error: %v", obj, err) + continue + } + + // Make sure the versioned codec under test can decode + versionDecodedObject, err := runtime.Decode(testapi.Default.Codec(), unversionedJSON) + if err != nil { + t.Errorf("%v: unexpected error: %v", obj, err) + continue + } + // Make sure it decodes correctly + if !reflect.DeepEqual(obj, versionDecodedObject) { + t.Errorf("%v: expected %#v, got %#v", obj, obj, versionDecodedObject) + continue + } + } +} + const benchmarkSeed = 100 -func BenchmarkEncode(b *testing.B) { - pod := api.Pod{} - apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(benchmarkSeed)) - apiObjectFuzzer.Fuzz(&pod) - for i := 0; i < b.N; i++ { - testapi.Default.Codec().Encode(&pod) +func benchmarkItems() []v1.Pod { + apiObjectFuzzer := apitesting.FuzzerFor(nil, api.SchemeGroupVersion, rand.NewSource(benchmarkSeed)) + items := make([]v1.Pod, 2) + for i := range items { + apiObjectFuzzer.Fuzz(&items[i]) } + return items } -// BenchmarkEncodeJSON provides a baseline for regular JSON encode performance -func BenchmarkEncodeJSON(b *testing.B) { - pod := api.Pod{} - apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(benchmarkSeed)) - apiObjectFuzzer.Fuzz(&pod) +// BenchmarkEncodeCodec measures the cost of performing a codec encode, which includes +// reflection (to clear APIVersion and Kind) +func BenchmarkEncodeCodec(b *testing.B) { + items := benchmarkItems() + width := len(items) + b.ResetTimer() for i := 0; i < b.N; i++ { - json.Marshal(&pod) + if _, err := runtime.Encode(testapi.Default.Codec(), &items[i%width]); err != nil { + b.Fatal(err) + } } + b.StopTimer() } -func BenchmarkDecode(b *testing.B) { - pod := api.Pod{} - apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(benchmarkSeed)) - apiObjectFuzzer.Fuzz(&pod) - data, _ := testapi.Default.Codec().Encode(&pod) +// BenchmarkEncodeJSONMarshal provides a baseline for regular JSON encode performance +func BenchmarkEncodeJSONMarshal(b *testing.B) { + items := benchmarkItems() + width := len(items) + b.ResetTimer() for i := 0; i < b.N; i++ { - testapi.Default.Codec().Decode(data) + if _, err := json.Marshal(&items[i%width]); err != nil { + b.Fatal(err) + } } + b.StopTimer() } -func BenchmarkDecodeInto(b *testing.B) { - pod := api.Pod{} - apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(benchmarkSeed)) - apiObjectFuzzer.Fuzz(&pod) - data, _ := testapi.Default.Codec().Encode(&pod) +func BenchmarkDecodeCodec(b *testing.B) { + codec := testapi.Default.Codec() + items := benchmarkItems() + width := len(items) + encoded := make([][]byte, width) + for i := range items { + data, err := runtime.Encode(codec, &items[i]) + if err != nil { + b.Fatal(err) + } + encoded[i] = data + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + if _, err := runtime.Decode(codec, encoded[i%width]); err != nil { + b.Fatal(err) + } + } + b.StopTimer() +} + +func BenchmarkDecodeIntoExternalCodec(b *testing.B) { + codec := testapi.Default.Codec() + items := benchmarkItems() + width := len(items) + encoded := make([][]byte, width) + for i := range items { + data, err := runtime.Encode(codec, &items[i]) + if err != nil { + b.Fatal(err) + } + encoded[i] = data + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + obj := v1.Pod{} + if err := runtime.DecodeInto(codec, encoded[i%width], &obj); err != nil { + b.Fatal(err) + } + } + b.StopTimer() +} + +func BenchmarkDecodeIntoInternalCodec(b *testing.B) { + codec := testapi.Default.Codec() + items := benchmarkItems() + width := len(items) + encoded := make([][]byte, width) + for i := range items { + data, err := runtime.Encode(codec, &items[i]) + if err != nil { + b.Fatal(err) + } + encoded[i] = data + } + + b.ResetTimer() for i := 0; i < b.N; i++ { obj := api.Pod{} - testapi.Default.Codec().DecodeInto(data, &obj) + if err := runtime.DecodeInto(codec, encoded[i%width], &obj); err != nil { + b.Fatal(err) + } } + b.StopTimer() } // BenchmarkDecodeJSON provides a baseline for regular JSON decode performance -func BenchmarkDecodeJSON(b *testing.B) { - pod := api.Pod{} - apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(benchmarkSeed)) - apiObjectFuzzer.Fuzz(&pod) - data, _ := testapi.Default.Codec().Encode(&pod) - for i := 0; i < b.N; i++ { - obj := api.Pod{} - json.Unmarshal(data, &obj) +func BenchmarkDecodeIntoJSON(b *testing.B) { + codec := testapi.Default.Codec() + items := benchmarkItems() + width := len(items) + encoded := make([][]byte, width) + for i := range items { + data, err := runtime.Encode(codec, &items[i]) + if err != nil { + b.Fatal(err) + } + encoded[i] = data } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + obj := v1.Pod{} + if err := json.Unmarshal(encoded[i%width], &obj); err != nil { + b.Fatal(err) + } + } + b.StopTimer() +} + +// BenchmarkDecodeJSON provides a baseline for codecgen JSON decode performance +func BenchmarkDecodeIntoJSONCodecGen(b *testing.B) { + kcodec := testapi.Default.Codec() + items := benchmarkItems() + width := len(items) + encoded := make([][]byte, width) + for i := range items { + data, err := runtime.Encode(kcodec, &items[i]) + if err != nil { + b.Fatal(err) + } + encoded[i] = data + } + handler := &codec.JsonHandle{} + + b.ResetTimer() + for i := 0; i < b.N; i++ { + obj := v1.Pod{} + if err := codec.NewDecoderBytes(encoded[i%width], handler).Decode(&obj); err != nil { + b.Fatal(err) + } + } + b.StopTimer() } diff --git a/vendor/k8s.io/kubernetes/pkg/api/testapi/testapi.go b/vendor/k8s.io/kubernetes/pkg/api/testapi/testapi.go index e0a73bd0b..d3fc91aae 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/testapi/testapi.go +++ b/vendor/k8s.io/kubernetes/pkg/api/testapi/testapi.go @@ -23,13 +23,16 @@ import ( "strings" "k8s.io/kubernetes/pkg/api" - _ "k8s.io/kubernetes/pkg/api/install" - _ "k8s.io/kubernetes/pkg/apis/extensions/install" - - "k8s.io/kubernetes/pkg/api/latest" "k8s.io/kubernetes/pkg/api/meta" - apiutil "k8s.io/kubernetes/pkg/api/util" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/runtime" + + _ "k8s.io/kubernetes/pkg/api/install" + _ "k8s.io/kubernetes/pkg/apis/componentconfig/install" + _ "k8s.io/kubernetes/pkg/apis/extensions/install" + _ "k8s.io/kubernetes/pkg/apis/metrics/install" ) var ( @@ -39,133 +42,101 @@ var ( ) type TestGroup struct { - // Name of the group - Group string - // Version of the group Group under test - VersionUnderTest string - // Group and Version. In most cases equals to Group + "/" + VersionUnverTest - GroupVersionUnderTest string + externalGroupVersion unversioned.GroupVersion + internalGroupVersion unversioned.GroupVersion } func init() { kubeTestAPI := os.Getenv("KUBE_TEST_API") - if kubeTestAPI != "" { + if len(kubeTestAPI) != 0 { testGroupVersions := strings.Split(kubeTestAPI, ",") - for _, groupVersion := range testGroupVersions { - // TODO: caesarxuchao: the apiutil package is hacky, it will be replaced - // by a following PR. - Groups[apiutil.GetGroup(groupVersion)] = - TestGroup{apiutil.GetGroup(groupVersion), apiutil.GetVersion(groupVersion), groupVersion} + for _, gvString := range testGroupVersions { + groupVersion, err := unversioned.ParseGroupVersion(gvString) + if err != nil { + panic(fmt.Sprintf("Error parsing groupversion %v: %v", gvString, err)) + } + + Groups[groupVersion.Group] = TestGroup{ + externalGroupVersion: groupVersion, + internalGroupVersion: unversioned.GroupVersion{Group: groupVersion.Group, Version: runtime.APIVersionInternal}, + } } } - // TODO: caesarxuchao: we need a central place to store all available API - // groups and their metadata. - if _, ok := Groups[""]; !ok { - // TODO: The second latest.GroupOrDie("").Version will be latest.GroupVersion after we - // have multiple group support - Groups[""] = TestGroup{"", latest.GroupOrDie("").Version, latest.GroupOrDie("").GroupVersion} + if _, ok := Groups[api.GroupName]; !ok { + Groups[api.GroupName] = TestGroup{ + externalGroupVersion: unversioned.GroupVersion{Group: api.GroupName, Version: registered.GroupOrDie(api.GroupName).GroupVersion.Version}, + internalGroupVersion: api.SchemeGroupVersion, + } } - if _, ok := Groups["extensions"]; !ok { - Groups["extensions"] = TestGroup{"extensions", latest.GroupOrDie("extensions").Version, latest.GroupOrDie("extensions").GroupVersion} + if _, ok := Groups[extensions.GroupName]; !ok { + Groups[extensions.GroupName] = TestGroup{ + externalGroupVersion: unversioned.GroupVersion{Group: extensions.GroupName, Version: registered.GroupOrDie(extensions.GroupName).GroupVersion.Version}, + internalGroupVersion: extensions.SchemeGroupVersion, + } } - Default = Groups[""] - Extensions = Groups["extensions"] + Default = Groups[api.GroupName] + Extensions = Groups[extensions.GroupName] } -// Version returns the API version to test against, as set by the KUBE_TEST_API env var. -func (g TestGroup) Version() string { - return g.VersionUnderTest +func (g TestGroup) ContentConfig() (string, *unversioned.GroupVersion, runtime.Codec) { + return "application/json", g.GroupVersion(), g.Codec() } -// GroupAndVersion returns the API version to test against for a group, as set -// by the KUBE_TEST_API env var. -// Return value is in the form of "group/version". -func (g TestGroup) GroupAndVersion() string { - return g.GroupVersionUnderTest +func (g TestGroup) GroupVersion() *unversioned.GroupVersion { + copyOfGroupVersion := g.externalGroupVersion + return ©OfGroupVersion +} + +// InternalGroupVersion returns the group,version used to identify the internal +// types for this API +func (g TestGroup) InternalGroupVersion() unversioned.GroupVersion { + return g.internalGroupVersion } // Codec returns the codec for the API version to test against, as set by the // KUBE_TEST_API env var. func (g TestGroup) Codec() runtime.Codec { - // TODO: caesarxuchao: Restructure the body once we have a central `latest`. - if g.Group == "" { - interfaces, err := latest.GroupOrDie("").InterfacesFor(g.GroupVersionUnderTest) - if err != nil { - panic(err) - } - return interfaces.Codec - } - if g.Group == "extensions" { - interfaces, err := latest.GroupOrDie("extensions").InterfacesFor(g.GroupVersionUnderTest) - if err != nil { - panic(err) - } - return interfaces.Codec - } - panic(fmt.Errorf("cannot test group %s", g.Group)) + return api.Codecs.LegacyCodec(g.externalGroupVersion) } // Converter returns the api.Scheme for the API version to test against, as set by the // KUBE_TEST_API env var. func (g TestGroup) Converter() runtime.ObjectConvertor { - // TODO: caesarxuchao: Restructure the body once we have a central `latest`. - if g.Group == "" { - interfaces, err := latest.GroupOrDie("").InterfacesFor(g.VersionUnderTest) - if err != nil { - panic(err) - } - return interfaces.ObjectConvertor + interfaces, err := registered.GroupOrDie(g.externalGroupVersion.Group).InterfacesFor(g.externalGroupVersion) + if err != nil { + panic(err) } - if g.Group == "extensions" { - interfaces, err := latest.GroupOrDie("extensions").InterfacesFor(g.VersionUnderTest) - if err != nil { - panic(err) - } - return interfaces.ObjectConvertor - } - panic(fmt.Errorf("cannot test group %s", g.Group)) - + return interfaces.ObjectConvertor } // MetadataAccessor returns the MetadataAccessor for the API version to test against, // as set by the KUBE_TEST_API env var. func (g TestGroup) MetadataAccessor() meta.MetadataAccessor { - // TODO: caesarxuchao: Restructure the body once we have a central `latest`. - if g.Group == "" { - interfaces, err := latest.GroupOrDie("").InterfacesFor(g.VersionUnderTest) - if err != nil { - panic(err) - } - return interfaces.MetadataAccessor + interfaces, err := registered.GroupOrDie(g.externalGroupVersion.Group).InterfacesFor(g.externalGroupVersion) + if err != nil { + panic(err) } - if g.Group == "extensions" { - interfaces, err := latest.GroupOrDie("extensions").InterfacesFor(g.VersionUnderTest) - if err != nil { - panic(err) - } - return interfaces.MetadataAccessor - } - panic(fmt.Errorf("cannot test group %s", g.Group)) + return interfaces.MetadataAccessor } // SelfLink returns a self link that will appear to be for the version Version(). // 'resource' should be the resource path, e.g. "pods" for the Pod type. 'name' should be // empty for lists. func (g TestGroup) SelfLink(resource, name string) string { - if g.Group == "" { + if g.externalGroupVersion.Group == api.GroupName { if name == "" { - return fmt.Sprintf("/api/%s/%s", g.Version(), resource) + return fmt.Sprintf("/api/%s/%s", g.externalGroupVersion.Version, resource) } - return fmt.Sprintf("/api/%s/%s/%s", g.Version(), resource, name) + return fmt.Sprintf("/api/%s/%s/%s", g.externalGroupVersion.Version, resource, name) } else { // TODO: will need a /apis prefix once we have proper multi-group // support if name == "" { - return fmt.Sprintf("/apis/%s/%s/%s", g.Group, g.Version(), resource) + return fmt.Sprintf("/apis/%s/%s/%s", g.externalGroupVersion.Group, g.externalGroupVersion.Version, resource) } - return fmt.Sprintf("/apis/%s/%s/%s/%s", g.Group, g.Version(), resource, name) + return fmt.Sprintf("/apis/%s/%s/%s/%s", g.externalGroupVersion.Group, g.externalGroupVersion.Version, resource, name) } } @@ -174,12 +145,12 @@ func (g TestGroup) SelfLink(resource, name string) string { // /api/v1/watch/namespaces/foo/pods/pod0 for v1. func (g TestGroup) ResourcePathWithPrefix(prefix, resource, namespace, name string) string { var path string - if len(g.Group) == 0 { - path = "/api/" + g.Version() + if g.externalGroupVersion.Group == api.GroupName { + path = "/api/" + g.externalGroupVersion.Version } else { // TODO: switch back once we have proper multiple group support // path = "/apis/" + g.Group + "/" + Version(group...) - path = "/apis/" + g.Group + "/" + g.Version() + path = "/apis/" + g.externalGroupVersion.Group + "/" + g.externalGroupVersion.Version } if prefix != "" { @@ -207,23 +178,36 @@ func (g TestGroup) ResourcePath(resource, namespace, name string) string { } func (g TestGroup) RESTMapper() meta.RESTMapper { - return latest.GroupOrDie(g.Group).RESTMapper + return registered.GroupOrDie(g.externalGroupVersion.Group).RESTMapper } // Get codec based on runtime.Object func GetCodecForObject(obj runtime.Object) (runtime.Codec, error) { - _, kind, err := api.Scheme.ObjectVersionAndKind(obj) + kind, err := api.Scheme.ObjectKind(obj) if err != nil { return nil, fmt.Errorf("unexpected encoding error: %v", err) } - // TODO: caesarxuchao: we should detect which group an object belongs to - // by using the version returned by Schem.ObjectVersionAndKind() once we - // split the schemes for internal objects. - // TODO: caesarxuchao: we should add a map from kind to group in Scheme. + for _, group := range Groups { - if api.Scheme.Recognizes(group.GroupAndVersion(), kind) { + if group.GroupVersion().Group != kind.Group { + continue + } + + if api.Scheme.Recognizes(kind) { return group.Codec(), nil } } + // Codec used for unversioned types + if api.Scheme.Recognizes(kind) { + serializer, ok := api.Codecs.SerializerForFileExtension("json") + if !ok { + return nil, fmt.Errorf("no serializer registered for json") + } + return serializer, nil + } return nil, fmt.Errorf("unexpected kind: %v", kind) } + +func NewTestGroup(external, internal unversioned.GroupVersion) TestGroup { + return TestGroup{external, internal} +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/testapi/testapi_test.go b/vendor/k8s.io/kubernetes/pkg/api/testapi/testapi_test.go index 056c76970..7b8bb02ba 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/testapi/testapi_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/testapi/testapi_test.go @@ -17,9 +17,16 @@ limitations under the License. package testapi import ( + "encoding/json" + "reflect" "testing" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" ) +// TODO these tests don't add much value for testing things that have groups + func TestResourcePathWithPrefix(t *testing.T) { testCases := []struct { prefix string @@ -28,11 +35,11 @@ func TestResourcePathWithPrefix(t *testing.T) { name string expected string }{ - {"prefix", "resource", "mynamespace", "myresource", "/api/" + Default.Version() + "/prefix/namespaces/mynamespace/resource/myresource"}, - {"prefix", "resource", "", "myresource", "/api/" + Default.Version() + "/prefix/resource/myresource"}, - {"prefix", "resource", "mynamespace", "", "/api/" + Default.Version() + "/prefix/namespaces/mynamespace/resource"}, - {"prefix", "resource", "", "", "/api/" + Default.Version() + "/prefix/resource"}, - {"", "resource", "mynamespace", "myresource", "/api/" + Default.Version() + "/namespaces/mynamespace/resource/myresource"}, + {"prefix", "resource", "mynamespace", "myresource", "/api/" + Default.GroupVersion().Version + "/prefix/namespaces/mynamespace/resource/myresource"}, + {"prefix", "resource", "", "myresource", "/api/" + Default.GroupVersion().Version + "/prefix/resource/myresource"}, + {"prefix", "resource", "mynamespace", "", "/api/" + Default.GroupVersion().Version + "/prefix/namespaces/mynamespace/resource"}, + {"prefix", "resource", "", "", "/api/" + Default.GroupVersion().Version + "/prefix/resource"}, + {"", "resource", "mynamespace", "myresource", "/api/" + Default.GroupVersion().Version + "/namespaces/mynamespace/resource/myresource"}, } for _, item := range testCases { if actual := Default.ResourcePathWithPrefix(item.prefix, item.resource, item.namespace, item.name); actual != item.expected { @@ -48,10 +55,10 @@ func TestResourcePath(t *testing.T) { name string expected string }{ - {"resource", "mynamespace", "myresource", "/api/" + Default.Version() + "/namespaces/mynamespace/resource/myresource"}, - {"resource", "", "myresource", "/api/" + Default.Version() + "/resource/myresource"}, - {"resource", "mynamespace", "", "/api/" + Default.Version() + "/namespaces/mynamespace/resource"}, - {"resource", "", "", "/api/" + Default.Version() + "/resource"}, + {"resource", "mynamespace", "myresource", "/api/" + Default.GroupVersion().Version + "/namespaces/mynamespace/resource/myresource"}, + {"resource", "", "myresource", "/api/" + Default.GroupVersion().Version + "/resource/myresource"}, + {"resource", "mynamespace", "", "/api/" + Default.GroupVersion().Version + "/namespaces/mynamespace/resource"}, + {"resource", "", "", "/api/" + Default.GroupVersion().Version + "/resource"}, } for _, item := range testCases { if actual := Default.ResourcePath(item.resource, item.namespace, item.name); actual != item.expected { @@ -59,3 +66,61 @@ func TestResourcePath(t *testing.T) { } } } + +var status = &unversioned.Status{ + Status: unversioned.StatusFailure, + Code: 200, + Reason: unversioned.StatusReasonUnknown, + Message: "", +} + +func TestV1EncodeDecodeStatus(t *testing.T) { + v1Codec := Default.Codec() + + encoded, err := runtime.Encode(v1Codec, status) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + typeMeta := unversioned.TypeMeta{} + if err := json.Unmarshal(encoded, &typeMeta); err != nil { + t.Errorf("unexpected error: %v", err) + } + if typeMeta.Kind != "Status" { + t.Errorf("Kind is not set to \"Status\". Got %v", string(encoded)) + } + if typeMeta.APIVersion != "v1" { + t.Errorf("APIVersion is not set to \"v1\". Got %v", string(encoded)) + } + decoded, err := runtime.Decode(v1Codec, encoded) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + if !reflect.DeepEqual(status, decoded) { + t.Errorf("expected: %#v, got: %#v", status, decoded) + } +} + +func TestExperimentalEncodeDecodeStatus(t *testing.T) { + extensionCodec := Extensions.Codec() + encoded, err := runtime.Encode(extensionCodec, status) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + typeMeta := unversioned.TypeMeta{} + if err := json.Unmarshal(encoded, &typeMeta); err != nil { + t.Errorf("unexpected error: %v", err) + } + if typeMeta.Kind != "Status" { + t.Errorf("Kind is not set to \"Status\". Got %s", encoded) + } + if typeMeta.APIVersion != "v1" { + t.Errorf("APIVersion is not set to \"\". Got %s", encoded) + } + decoded, err := runtime.Decode(extensionCodec, encoded) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + if !reflect.DeepEqual(status, decoded) { + t.Errorf("expected: %v, got: %v", status, decoded) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/testing/compat/compatibility_tester.go b/vendor/k8s.io/kubernetes/pkg/api/testing/compat/compatibility_tester.go index 42314d186..82f165a33 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/testing/compat/compatibility_tester.go +++ b/vendor/k8s.io/kubernetes/pkg/api/testing/compat/compatibility_tester.go @@ -27,10 +27,10 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util/fielderrors" - + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/kubectl" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/validation/field" ) // Based on: https://github.com/openshift/origin/blob/master/pkg/api/compatibility_test.go @@ -40,16 +40,16 @@ import ( // keys in the resulting JSON. func TestCompatibility( t *testing.T, - version string, + version unversioned.GroupVersion, input []byte, - validator func(obj runtime.Object) fielderrors.ValidationErrorList, + validator func(obj runtime.Object) field.ErrorList, expectedKeys map[string]string, absentKeys []string, ) { // Decode - codec := runtime.CodecFor(api.Scheme, version) - obj, err := codec.Decode(input) + codec := api.Codecs.LegacyCodec(version) + obj, err := runtime.Decode(codec, input) if err != nil { t.Fatalf("Unexpected error: %v", err) } @@ -61,7 +61,7 @@ func TestCompatibility( } // Encode - output, err := codec.Encode(obj) + output, err := runtime.Encode(codec, obj) if err != nil { t.Fatalf("Unexpected error: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/testing/conversion.go b/vendor/k8s.io/kubernetes/pkg/api/testing/conversion.go new file mode 100644 index 000000000..6f91427e7 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/testing/conversion.go @@ -0,0 +1,72 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testing + +import ( + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/labels" +) + +// TestSelectableFieldLabelConversions verifies that given resource have field +// label conversion defined for each its selectable field. +// fields contains selectable fields of the resource. +// labelMap maps deprecated labels to their canonical names. +func TestSelectableFieldLabelConversionsOfKind(t *testing.T, apiVersion string, kind string, fields labels.Set, labelMap map[string]string) { + badFieldLabels := []string{ + "name", + ".name", + "bad", + "metadata", + "foo.bar", + } + + value := "value" + + if len(fields) == 0 { + t.Logf("no selectable fields for kind %q, skipping", kind) + } + for label := range fields { + if label == "name" { + t.Logf("FIXME: \"name\" is deprecated by \"metadata.name\", it should be removed from selectable fields of kind=%s", kind) + continue + } + newLabel, newValue, err := api.Scheme.ConvertFieldLabel(apiVersion, kind, label, value) + if err != nil { + t.Errorf("kind=%s label=%s: got unexpected error: %v", kind, label, err) + } else { + expectedLabel := label + if l, exists := labelMap[label]; exists { + expectedLabel = l + } + if newLabel != expectedLabel { + t.Errorf("kind=%s label=%s: got unexpected label name (%q != %q)", kind, label, newLabel, expectedLabel) + } + if newValue != value { + t.Errorf("kind=%s label=%s: got unexpected new value (%q != %q)", kind, label, newValue, value) + } + } + } + + for _, label := range badFieldLabels { + _, _, err := api.Scheme.ConvertFieldLabel(apiVersion, kind, label, "value") + if err == nil { + t.Errorf("kind=%s label=%s: got unexpected non-error", kind, label) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/testing/fuzzer.go b/vendor/k8s.io/kubernetes/pkg/api/testing/fuzzer.go index 69a933f87..4375d2661 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/testing/fuzzer.go +++ b/vendor/k8s.io/kubernetes/pkg/api/testing/fuzzer.go @@ -25,29 +25,39 @@ import ( docker "github.com/fsouza/go-dockerclient" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/registered" "k8s.io/kubernetes/pkg/api/resource" + "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/types" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" "github.com/google/gofuzz" - "speter.net/go/exp/math/dec/inf" ) // FuzzerFor can randomly populate api objects that are destined for version. -func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { +func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source) *fuzz.Fuzzer { f := fuzz.New().NilChance(.5).NumElements(1, 1) if src != nil { f.RandSource(src) } f.Funcs( - func(j *runtime.PluginBase, c fuzz.Continue) { - // Do nothing; this struct has only a Kind field and it must stay blank in memory. + func(j *int, c fuzz.Continue) { + *j = int(c.Int31()) + }, + func(j **int, c fuzz.Continue) { + if c.RandBool() { + i := int(c.Int31()) + *j = &i + } else { + *j = nil + } + }, + func(q *resource.Quantity, c fuzz.Continue) { + *q = *resource.NewQuantity(c.Int63n(1000), resource.DecimalExponent) }, func(j *runtime.TypeMeta, c fuzz.Continue) { // We have to customize the randomization of TypeMetas because their @@ -88,9 +98,18 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { j.SelfLink = c.RandString() }, func(j *api.ListOptions, c fuzz.Continue) { - // TODO: add some parsing - j.LabelSelector, _ = labels.Parse("a=b") - j.FieldSelector, _ = fields.ParseSelector("a=b") + label, _ := labels.Parse("a=b") + j.LabelSelector = label + field, _ := fields.ParseSelector("a=b") + j.FieldSelector = field + }, + func(j *api.PodExecOptions, c fuzz.Continue) { + j.Stdout = true + j.Stderr = true + }, + func(j *api.PodAttachOptions, c fuzz.Continue) { + j.Stdout = true + j.Stderr = true }, func(s *api.PodSpec, c fuzz.Continue) { c.FuzzNoCustom(s) @@ -111,15 +130,6 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { statuses := []api.PodPhase{api.PodPending, api.PodRunning, api.PodFailed, api.PodUnknown} *j = statuses[c.Rand.Intn(len(statuses))] }, - func(j *api.PodTemplateSpec, c fuzz.Continue) { - // TODO: v1beta1/2 can't round trip a nil template correctly, fix by having v1beta1/2 - // conversion compare converted object to nil via DeepEqual - j.ObjectMeta = api.ObjectMeta{} - c.Fuzz(&j.ObjectMeta) - j.ObjectMeta = api.ObjectMeta{Labels: j.ObjectMeta.Labels} - j.Spec = api.PodSpec{} - c.Fuzz(&j.Spec) - }, func(j *api.Binding, c fuzz.Continue) { c.Fuzz(&j.ObjectMeta) j.Target.Name = c.RandString() @@ -138,18 +148,18 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { } else { rollingUpdate := extensions.RollingUpdateDeployment{} if c.RandBool() { - rollingUpdate.MaxUnavailable = util.NewIntOrStringFromInt(int(c.RandUint64())) - rollingUpdate.MaxSurge = util.NewIntOrStringFromInt(int(c.RandUint64())) + rollingUpdate.MaxUnavailable = intstr.FromInt(int(c.RandUint64())) + rollingUpdate.MaxSurge = intstr.FromInt(int(c.RandUint64())) } else { - rollingUpdate.MaxSurge = util.NewIntOrStringFromString(fmt.Sprintf("%d%%", c.RandUint64())) + rollingUpdate.MaxSurge = intstr.FromString(fmt.Sprintf("%d%%", c.RandUint64())) } j.RollingUpdate = &rollingUpdate } }, func(j *extensions.JobSpec, c fuzz.Continue) { c.FuzzNoCustom(j) // fuzz self without calling this function again - completions := c.Rand.Int() - parallelism := c.Rand.Int() + completions := int(c.Rand.Int31()) + parallelism := int(c.Rand.Int31()) j.Completions = &completions j.Parallelism = ¶llelism }, @@ -164,8 +174,8 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { // TODO: uncomment when round trip starts from a versioned object if true { //c.RandBool() { *j = &runtime.Unknown{ - TypeMeta: runtime.TypeMeta{Kind: "Something", APIVersion: "unknown"}, - RawJSON: []byte(`{"apiVersion":"unknown","kind":"Something","someKey":"someValue"}`), + // We do not set TypeMeta here because it is not carried through a round trip + RawJSON: []byte(`{"apiVersion":"unknown.group/unknown","kind":"Something","someKey":"someValue"}`), } } else { types := []runtime.Object{&api.Pod{}, &api.ReplicationController{}} @@ -189,18 +199,11 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { c.RandString(): c.RandString(), } }, - func(q *resource.Quantity, c fuzz.Continue) { - // Real Quantity fuzz testing is done elsewhere; - // this limited subset of functionality survives - // round-tripping to v1beta1/2. - q.Amount = &inf.Dec{} - q.Format = resource.DecimalExponent - //q.Amount.SetScale(inf.Scale(-c.Intn(12))) - q.Amount.SetUnscaled(c.Int63n(1000)) - }, func(q *api.ResourceRequirements, c fuzz.Continue) { randomQuantity := func() resource.Quantity { - return *resource.NewQuantity(c.Int63n(1000), resource.DecimalExponent) + var q resource.Quantity + c.Fuzz(&q) + return q } q.Limits = make(api.ResourceList) q.Requests = make(api.ResourceList) @@ -215,10 +218,8 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { q.Requests[api.ResourceStorage] = *storageLimit.Copy() }, func(q *api.LimitRangeItem, c fuzz.Continue) { - randomQuantity := func() resource.Quantity { - return *resource.NewQuantity(c.Int63n(1000), resource.DecimalExponent) - } - cpuLimit := randomQuantity() + var cpuLimit resource.Quantity + c.Fuzz(&cpuLimit) q.Type = api.LimitTypeContainer q.Default = make(api.ResourceList) @@ -244,24 +245,29 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { policies := []api.RestartPolicy{api.RestartPolicyAlways, api.RestartPolicyNever, api.RestartPolicyOnFailure} *rp = policies[c.Rand.Intn(len(policies))] }, + // Only api.DownwardAPIVolumeFile needs to have a specific func since FieldRef has to be + // defaulted to a version otherwise roundtrip will fail + // For the remaining volume plugins the default fuzzer is enough. + func(m *api.DownwardAPIVolumeFile, c fuzz.Continue) { + m.Path = c.RandString() + versions := []string{"v1"} + m.FieldRef.APIVersion = versions[c.Rand.Intn(len(versions))] + m.FieldRef.FieldPath = c.RandString() + }, func(vs *api.VolumeSource, c fuzz.Continue) { // Exactly one of the fields must be set. v := reflect.ValueOf(vs).Elem() i := int(c.RandUint64() % uint64(v.NumField())) - v = v.Field(i).Addr() - // Use a new fuzzer which cannot populate nil to ensure one field will be set. - f := fuzz.New().NilChance(0).NumElements(1, 1) - f.Funcs( - // Only api.DownwardAPIVolumeFile needs to have a specific func since FieldRef has to be - // defaulted to a version otherwise roundtrip will fail - // For the remaining volume plugins the default fuzzer is enough. - func(m *api.DownwardAPIVolumeFile, c fuzz.Continue) { - m.Path = c.RandString() - versions := []string{"v1"} - m.FieldRef.APIVersion = versions[c.Rand.Intn(len(versions))] - m.FieldRef.FieldPath = c.RandString() - }, - ).Fuzz(v.Interface()) + t := v.Field(i).Addr() + for v.Field(i).IsNil() { + c.Fuzz(t.Interface()) + } + }, + func(i *api.ISCSIVolumeSource, c fuzz.Continue) { + i.ISCSIInterface = c.RandString() + if i.ISCSIInterface == "" { + i.ISCSIInterface = "default" + } }, func(d *api.DNSPolicy, c fuzz.Continue) { policies := []api.DNSPolicy{api.DNSClusterFirst, api.DNSDefault} @@ -283,6 +289,18 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { c.FuzzNoCustom(ct) // fuzz self without calling this function again ct.TerminationMessagePath = "/" + ct.TerminationMessagePath // Must be non-empty }, + func(p *api.Probe, c fuzz.Continue) { + c.FuzzNoCustom(p) + // These fields have default values. + intFieldsWithDefaults := [...]string{"TimeoutSeconds", "PeriodSeconds", "SuccessThreshold", "FailureThreshold"} + v := reflect.ValueOf(p).Elem() + for _, field := range intFieldsWithDefaults { + f := v.FieldByName(field) + if f.Int() == 0 { + f.SetInt(1) + } + } + }, func(ev *api.EnvVar, c fuzz.Continue) { ev.Name = c.RandString() if c.RandBool() { @@ -291,9 +309,12 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { ev.ValueFrom = &api.EnvVarSource{} ev.ValueFrom.FieldRef = &api.ObjectFieldSelector{} - versions := registered.RegisteredVersions + var versions []unversioned.GroupVersion + for _, testGroup := range testapi.Groups { + versions = append(versions, *testGroup.GroupVersion()) + } - ev.ValueFrom.FieldRef.APIVersion = versions[c.Rand.Intn(len(versions))] + ev.ValueFrom.FieldRef.APIVersion = versions[c.Rand.Intn(len(versions))].String() ev.ValueFrom.FieldRef.FieldPath = c.RandString() } }, @@ -313,15 +334,6 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { c.Fuzz(&sc.Capabilities.Drop) } }, - func(e *api.Event, c fuzz.Continue) { - c.FuzzNoCustom(e) // fuzz self without calling this function again - // Fix event count to 1, otherwise, if a v1beta1 or v1beta2 event has a count set arbitrarily, it's count is ignored - if e.FirstTimestamp.IsZero() { - e.Count = 1 - } else { - c.Fuzz(&e.Count) - } - }, func(s *api.Secret, c fuzz.Continue) { c.FuzzNoCustom(s) // fuzz self without calling this function again s.Type = api.SecretTypeOpaque @@ -358,10 +370,10 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { c.Fuzz(&ss.Ports[0]) } for i := range ss.Ports { - switch ss.Ports[i].TargetPort.Kind { - case util.IntstrInt: + switch ss.Ports[i].TargetPort.Type { + case intstr.Int: ss.Ports[i].TargetPort.IntVal = 1 + ss.Ports[i].TargetPort.IntVal%65535 // non-zero - case util.IntstrString: + case intstr.String: ss.Ports[i].TargetPort.StrVal = "x" + ss.Ports[i].TargetPort.StrVal // non-empty } } @@ -370,6 +382,10 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { c.FuzzNoCustom(n) n.Spec.ExternalID = "external" }, + func(s *api.NodeStatus, c fuzz.Continue) { + c.FuzzNoCustom(s) + s.Allocatable = s.Capacity + }, func(s *extensions.APIVersion, c fuzz.Continue) { // We can't use c.RandString() here because it may generate empty // string, which will cause tests failure. @@ -377,9 +393,16 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { }, func(s *extensions.HorizontalPodAutoscalerSpec, c fuzz.Continue) { c.FuzzNoCustom(s) // fuzz self without calling this function again - minReplicas := c.Rand.Int() + minReplicas := int(c.Rand.Int31()) s.MinReplicas = &minReplicas - s.CPUUtilization = &extensions.CPUTargetUtilization{TargetPercentage: int(c.RandUint64())} + s.CPUUtilization = &extensions.CPUTargetUtilization{TargetPercentage: int(int32(c.RandUint64()))} + }, + func(psp *extensions.PodSecurityPolicySpec, c fuzz.Continue) { + c.FuzzNoCustom(psp) // fuzz self without calling this function again + userTypes := []extensions.RunAsUserStrategy{extensions.RunAsUserStrategyMustRunAsNonRoot, extensions.RunAsUserStrategyMustRunAs, extensions.RunAsUserStrategyRunAsAny} + psp.RunAsUser.Type = userTypes[c.Rand.Intn(len(userTypes))] + seLinuxTypes := []extensions.SELinuxContextStrategy{extensions.SELinuxStrategyRunAsAny, extensions.SELinuxStrategyMustRunAs} + psp.SELinuxContext.Type = seLinuxTypes[c.Rand.Intn(len(seLinuxTypes))] }, ) return f diff --git a/vendor/k8s.io/kubernetes/pkg/api/types.generated.go b/vendor/k8s.io/kubernetes/pkg/api/types.generated.go index bf030de15..5cd4a3883 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/types.generated.go +++ b/vendor/k8s.io/kubernetes/pkg/api/types.generated.go @@ -31,7 +31,7 @@ import ( pkg6_labels "k8s.io/kubernetes/pkg/labels" pkg8_runtime "k8s.io/kubernetes/pkg/runtime" pkg1_types "k8s.io/kubernetes/pkg/types" - pkg5_util "k8s.io/kubernetes/pkg/util" + pkg5_intstr "k8s.io/kubernetes/pkg/util/intstr" "reflect" "runtime" pkg4_inf "speter.net/go/exp/math/dec/inf" @@ -39,10 +39,18 @@ import ( ) const ( - codecSelferC_UTF81234 = 1 - codecSelferC_RAW1234 = 0 + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- codecSelferValueTypeArray1234 = 10 codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 ) var ( @@ -53,10 +61,10 @@ var ( type codecSelfer1234 struct{} func init() { - if codec1978.GenVersion != 4 { + if codec1978.GenVersion != 5 { _, file, _, _ := runtime.Caller(0) err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", - 4, codec1978.GenVersion, file) + 5, codec1978.GenVersion, file) panic(err) } if false { // reference the types, but skip this branch at build/run time @@ -66,7 +74,7 @@ func init() { var v3 pkg6_labels.Selector var v4 pkg8_runtime.Object var v5 pkg1_types.UID - var v6 pkg5_util.IntOrString + var v6 pkg5_intstr.IntOrString var v7 pkg4_inf.Dec var v8 time.Time _, _, _, _, _, _, _, _, _ = v0, v1, v2, v3, v4, v5, v6, v7, v8 @@ -102,18 +110,21 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { yyq2[9] = x.DeletionGracePeriodSeconds != nil yyq2[10] = len(x.Labels) != 0 yyq2[11] = len(x.Annotations) != 0 + var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(12) } else { - var yynn2 int = 0 + yynn2 = 0 for _, b := range yyq2 { if b { yynn2++ } } r.EncodeMapStart(yynn2) + yynn2 = 0 } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[0] { yym4 := z.EncBinary() _ = yym4 @@ -126,7 +137,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym5 := z.EncBinary() _ = yym5 if false { @@ -136,6 +149,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[1] { yym7 := z.EncBinary() _ = yym7 @@ -148,7 +162,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("generateName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym8 := z.EncBinary() _ = yym8 if false { @@ -158,6 +174,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[2] { yym10 := z.EncBinary() _ = yym10 @@ -170,7 +187,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("namespace")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym11 := z.EncBinary() _ = yym11 if false { @@ -180,6 +199,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[3] { yym13 := z.EncBinary() _ = yym13 @@ -192,7 +212,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selfLink")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym14 := z.EncBinary() _ = yym14 if false { @@ -202,6 +224,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[4] { yym16 := z.EncBinary() _ = yym16 @@ -215,7 +238,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("uid")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym17 := z.EncBinary() _ = yym17 if false { @@ -226,6 +251,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[5] { yym19 := z.EncBinary() _ = yym19 @@ -238,7 +264,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resourceVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym20 := z.EncBinary() _ = yym20 if false { @@ -248,6 +276,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[6] { yym22 := z.EncBinary() _ = yym22 @@ -260,7 +289,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("generation")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym23 := z.EncBinary() _ = yym23 if false { @@ -270,6 +301,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[7] { yy25 := &x.CreationTimestamp yym26 := z.EncBinary() @@ -288,7 +320,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("creationTimestamp")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yy27 := &x.CreationTimestamp yym28 := z.EncBinary() _ = yym28 @@ -304,6 +338,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[8] { if x.DeletionTimestamp == nil { r.EncodeNil() @@ -325,7 +360,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("deletionTimestamp")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.DeletionTimestamp == nil { r.EncodeNil() } else { @@ -344,6 +381,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[9] { if x.DeletionGracePeriodSeconds == nil { r.EncodeNil() @@ -361,7 +399,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("deletionGracePeriodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.DeletionGracePeriodSeconds == nil { r.EncodeNil() } else { @@ -376,6 +416,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[10] { if x.Labels == nil { r.EncodeNil() @@ -392,7 +433,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("labels")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Labels == nil { r.EncodeNil() } else { @@ -406,6 +449,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[11] { if x.Annotations == nil { r.EncodeNil() @@ -422,7 +466,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("annotations")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Annotations == nil { r.EncodeNil() } else { @@ -435,8 +481,10 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep2 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -446,24 +494,25 @@ func (x *ObjectMeta) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym43 := z.DecBinary() - _ = yym43 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl44 := r.ReadMapStart() - if yyl44 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl44, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl44 := r.ReadArrayStart() - if yyl44 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl44, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -475,12 +524,12 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys45Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys45Slc - var yyhl45 bool = l >= 0 - for yyj45 := 0; ; yyj45++ { - if yyhl45 { - if yyj45 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -488,9 +537,11 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys45Slc = r.DecodeBytes(yys45Slc, true, true) - yys45 := string(yys45Slc) - switch yys45 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -537,17 +588,17 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.CreationTimestamp = pkg2_unversioned.Time{} } else { - yyv53 := &x.CreationTimestamp - yym54 := z.DecBinary() - _ = yym54 + yyv11 := &x.CreationTimestamp + yym12 := z.DecBinary() + _ = yym12 if false { - } else if z.HasExtensions() && z.DecExt(yyv53) { - } else if yym54 { - z.DecBinaryUnmarshal(yyv53) - } else if !yym54 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv53) + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else if yym12 { + z.DecBinaryUnmarshal(yyv11) + } else if !yym12 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv11) } else { - z.DecFallback(yyv53, false) + z.DecFallback(yyv11, false) } } case "deletionTimestamp": @@ -559,13 +610,13 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.DeletionTimestamp == nil { x.DeletionTimestamp = new(pkg2_unversioned.Time) } - yym56 := z.DecBinary() - _ = yym56 + yym14 := z.DecBinary() + _ = yym14 if false { } else if z.HasExtensions() && z.DecExt(x.DeletionTimestamp) { - } else if yym56 { + } else if yym14 { z.DecBinaryUnmarshal(x.DeletionTimestamp) - } else if !yym56 && z.IsJSONHandle() { + } else if !yym14 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.DeletionTimestamp) } else { z.DecFallback(x.DeletionTimestamp, false) @@ -580,8 +631,8 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.DeletionGracePeriodSeconds == nil { x.DeletionGracePeriodSeconds = new(int64) } - yym58 := z.DecBinary() - _ = yym58 + yym16 := z.DecBinary() + _ = yym16 if false { } else { *((*int64)(x.DeletionGracePeriodSeconds)) = int64(r.DecodeInt(64)) @@ -591,183 +642,190 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Labels = nil } else { - yyv59 := &x.Labels - yym60 := z.DecBinary() - _ = yym60 + yyv17 := &x.Labels + yym18 := z.DecBinary() + _ = yym18 if false { } else { - z.F.DecMapStringStringX(yyv59, false, d) + z.F.DecMapStringStringX(yyv17, false, d) } } case "annotations": if r.TryDecodeAsNil() { x.Annotations = nil } else { - yyv61 := &x.Annotations - yym62 := z.DecBinary() - _ = yym62 + yyv19 := &x.Annotations + yym20 := z.DecBinary() + _ = yym20 if false { } else { - z.F.DecMapStringStringX(yyv61, false, d) + z.F.DecMapStringStringX(yyv19, false, d) } } default: - z.DecStructFieldNotFound(-1, yys45) - } // end switch yys45 - } // end for yyj45 - if !yyhl45 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ObjectMeta) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj63 int - var yyb63 bool - var yyhl63 bool = l >= 0 - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + var yyj21 int + var yyb21 bool + var yyhl21 bool = l >= 0 + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.GenerateName = "" } else { x.GenerateName = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Namespace = "" } else { x.Namespace = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SelfLink = "" } else { x.SelfLink = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.UID = "" } else { x.UID = pkg1_types.UID(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ResourceVersion = "" } else { x.ResourceVersion = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Generation = 0 } else { x.Generation = int64(r.DecodeInt(64)) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.CreationTimestamp = pkg2_unversioned.Time{} } else { - yyv71 := &x.CreationTimestamp - yym72 := z.DecBinary() - _ = yym72 + yyv29 := &x.CreationTimestamp + yym30 := z.DecBinary() + _ = yym30 if false { - } else if z.HasExtensions() && z.DecExt(yyv71) { - } else if yym72 { - z.DecBinaryUnmarshal(yyv71) - } else if !yym72 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv71) + } else if z.HasExtensions() && z.DecExt(yyv29) { + } else if yym30 { + z.DecBinaryUnmarshal(yyv29) + } else if !yym30 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv29) } else { - z.DecFallback(yyv71, false) + z.DecFallback(yyv29, false) } } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.DeletionTimestamp != nil { x.DeletionTimestamp = nil @@ -776,28 +834,29 @@ func (x *ObjectMeta) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.DeletionTimestamp == nil { x.DeletionTimestamp = new(pkg2_unversioned.Time) } - yym74 := z.DecBinary() - _ = yym74 + yym32 := z.DecBinary() + _ = yym32 if false { } else if z.HasExtensions() && z.DecExt(x.DeletionTimestamp) { - } else if yym74 { + } else if yym32 { z.DecBinaryUnmarshal(x.DeletionTimestamp) - } else if !yym74 && z.IsJSONHandle() { + } else if !yym32 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.DeletionTimestamp) } else { z.DecFallback(x.DeletionTimestamp, false) } } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.DeletionGracePeriodSeconds != nil { x.DeletionGracePeriodSeconds = nil @@ -806,68 +865,71 @@ func (x *ObjectMeta) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.DeletionGracePeriodSeconds == nil { x.DeletionGracePeriodSeconds = new(int64) } - yym76 := z.DecBinary() - _ = yym76 + yym34 := z.DecBinary() + _ = yym34 if false { } else { *((*int64)(x.DeletionGracePeriodSeconds)) = int64(r.DecodeInt(64)) } } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Labels = nil } else { - yyv77 := &x.Labels - yym78 := z.DecBinary() - _ = yym78 + yyv35 := &x.Labels + yym36 := z.DecBinary() + _ = yym36 if false { } else { - z.F.DecMapStringStringX(yyv77, false, d) + z.F.DecMapStringStringX(yyv35, false, d) } } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Annotations = nil } else { - yyv79 := &x.Annotations - yym80 := z.DecBinary() - _ = yym80 + yyv37 := &x.Annotations + yym38 := z.DecBinary() + _ = yym38 if false { } else { - z.F.DecMapStringStringX(yyv79, false, d) + z.F.DecMapStringStringX(yyv37, false, d) } } for { - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { + if yyb21 { break } - z.DecStructFieldNotFound(yyj63-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj21-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { @@ -877,70 +939,79 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym81 := z.EncBinary() - _ = yym81 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep82 := !z.EncBinary() - yy2arr82 := z.EncBasicHandle().StructToArray - var yyq82 [17]bool - _, _, _ = yysep82, yyq82, yy2arr82 - const yyr82 bool = false - yyq82[1] = x.VolumeSource.HostPath != nil && x.HostPath != nil - yyq82[2] = x.VolumeSource.EmptyDir != nil && x.EmptyDir != nil - yyq82[3] = x.VolumeSource.GCEPersistentDisk != nil && x.GCEPersistentDisk != nil - yyq82[4] = x.VolumeSource.AWSElasticBlockStore != nil && x.AWSElasticBlockStore != nil - yyq82[5] = x.VolumeSource.GitRepo != nil && x.GitRepo != nil - yyq82[6] = x.VolumeSource.Secret != nil && x.Secret != nil - yyq82[7] = x.VolumeSource.NFS != nil && x.NFS != nil - yyq82[8] = x.VolumeSource.ISCSI != nil && x.ISCSI != nil - yyq82[9] = x.VolumeSource.Glusterfs != nil && x.Glusterfs != nil - yyq82[10] = x.VolumeSource.PersistentVolumeClaim != nil && x.PersistentVolumeClaim != nil - yyq82[11] = x.VolumeSource.RBD != nil && x.RBD != nil - yyq82[12] = x.VolumeSource.Cinder != nil && x.Cinder != nil - yyq82[13] = x.VolumeSource.CephFS != nil && x.CephFS != nil - yyq82[14] = x.VolumeSource.Flocker != nil && x.Flocker != nil - yyq82[15] = x.VolumeSource.DownwardAPI != nil && x.DownwardAPI != nil - yyq82[16] = x.VolumeSource.FC != nil && x.FC != nil - if yyr82 || yy2arr82 { - r.EncodeArrayStart(17) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [20]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.VolumeSource.HostPath != nil && x.HostPath != nil + yyq2[2] = x.VolumeSource.EmptyDir != nil && x.EmptyDir != nil + yyq2[3] = x.VolumeSource.GCEPersistentDisk != nil && x.GCEPersistentDisk != nil + yyq2[4] = x.VolumeSource.AWSElasticBlockStore != nil && x.AWSElasticBlockStore != nil + yyq2[5] = x.VolumeSource.GitRepo != nil && x.GitRepo != nil + yyq2[6] = x.VolumeSource.Secret != nil && x.Secret != nil + yyq2[7] = x.VolumeSource.NFS != nil && x.NFS != nil + yyq2[8] = x.VolumeSource.ISCSI != nil && x.ISCSI != nil + yyq2[9] = x.VolumeSource.Glusterfs != nil && x.Glusterfs != nil + yyq2[10] = x.VolumeSource.PersistentVolumeClaim != nil && x.PersistentVolumeClaim != nil + yyq2[11] = x.VolumeSource.RBD != nil && x.RBD != nil + yyq2[12] = x.VolumeSource.FlexVolume != nil && x.FlexVolume != nil + yyq2[13] = x.VolumeSource.Cinder != nil && x.Cinder != nil + yyq2[14] = x.VolumeSource.CephFS != nil && x.CephFS != nil + yyq2[15] = x.VolumeSource.Flocker != nil && x.Flocker != nil + yyq2[16] = x.VolumeSource.DownwardAPI != nil && x.DownwardAPI != nil + yyq2[17] = x.VolumeSource.FC != nil && x.FC != nil + yyq2[18] = x.VolumeSource.AzureFile != nil && x.AzureFile != nil + yyq2[19] = x.VolumeSource.ConfigMap != nil && x.ConfigMap != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(20) } else { - var yynn82 int = 1 - for _, b := range yyq82 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn82++ + yynn2++ } } - r.EncodeMapStart(yynn82) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr82 || yy2arr82 { - yym84 := z.EncBinary() - _ = yym84 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym85 := z.EncBinary() - _ = yym85 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - var yyn86 bool + var yyn6 bool if x.VolumeSource.HostPath == nil { - yyn86 = true - goto LABEL86 + yyn6 = true + goto LABEL6 } - LABEL86: - if yyr82 || yy2arr82 { - if yyn86 { + LABEL6: + if yyr2 || yy2arr2 { + if yyn6 { r.EncodeNil() } else { - if yyq82[1] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.HostPath == nil { r.EncodeNil() } else { @@ -951,9 +1022,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPath")) - if yyn86 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn6 { r.EncodeNil() } else { if x.HostPath == nil { @@ -964,17 +1037,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn87 bool + var yyn9 bool if x.VolumeSource.EmptyDir == nil { - yyn87 = true - goto LABEL87 + yyn9 = true + goto LABEL9 } - LABEL87: - if yyr82 || yy2arr82 { - if yyn87 { + LABEL9: + if yyr2 || yy2arr2 { + if yyn9 { r.EncodeNil() } else { - if yyq82[2] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.EmptyDir == nil { r.EncodeNil() } else { @@ -985,9 +1059,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("emptyDir")) - if yyn87 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn9 { r.EncodeNil() } else { if x.EmptyDir == nil { @@ -998,17 +1074,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn88 bool + var yyn12 bool if x.VolumeSource.GCEPersistentDisk == nil { - yyn88 = true - goto LABEL88 + yyn12 = true + goto LABEL12 } - LABEL88: - if yyr82 || yy2arr82 { - if yyn88 { + LABEL12: + if yyr2 || yy2arr2 { + if yyn12 { r.EncodeNil() } else { - if yyq82[3] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -1019,9 +1096,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) - if yyn88 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn12 { r.EncodeNil() } else { if x.GCEPersistentDisk == nil { @@ -1032,17 +1111,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn89 bool + var yyn15 bool if x.VolumeSource.AWSElasticBlockStore == nil { - yyn89 = true - goto LABEL89 + yyn15 = true + goto LABEL15 } - LABEL89: - if yyr82 || yy2arr82 { - if yyn89 { + LABEL15: + if yyr2 || yy2arr2 { + if yyn15 { r.EncodeNil() } else { - if yyq82[4] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -1053,9 +1133,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) - if yyn89 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn15 { r.EncodeNil() } else { if x.AWSElasticBlockStore == nil { @@ -1066,17 +1148,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn90 bool + var yyn18 bool if x.VolumeSource.GitRepo == nil { - yyn90 = true - goto LABEL90 + yyn18 = true + goto LABEL18 } - LABEL90: - if yyr82 || yy2arr82 { - if yyn90 { + LABEL18: + if yyr2 || yy2arr2 { + if yyn18 { r.EncodeNil() } else { - if yyq82[5] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.GitRepo == nil { r.EncodeNil() } else { @@ -1087,9 +1170,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gitRepo")) - if yyn90 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn18 { r.EncodeNil() } else { if x.GitRepo == nil { @@ -1100,17 +1185,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn91 bool + var yyn21 bool if x.VolumeSource.Secret == nil { - yyn91 = true - goto LABEL91 + yyn21 = true + goto LABEL21 } - LABEL91: - if yyr82 || yy2arr82 { - if yyn91 { + LABEL21: + if yyr2 || yy2arr2 { + if yyn21 { r.EncodeNil() } else { - if yyq82[6] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.Secret == nil { r.EncodeNil() } else { @@ -1121,9 +1207,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secret")) - if yyn91 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn21 { r.EncodeNil() } else { if x.Secret == nil { @@ -1134,17 +1222,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn92 bool + var yyn24 bool if x.VolumeSource.NFS == nil { - yyn92 = true - goto LABEL92 + yyn24 = true + goto LABEL24 } - LABEL92: - if yyr82 || yy2arr82 { - if yyn92 { + LABEL24: + if yyr2 || yy2arr2 { + if yyn24 { r.EncodeNil() } else { - if yyq82[7] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { if x.NFS == nil { r.EncodeNil() } else { @@ -1155,9 +1244,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nfs")) - if yyn92 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn24 { r.EncodeNil() } else { if x.NFS == nil { @@ -1168,17 +1259,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn93 bool + var yyn27 bool if x.VolumeSource.ISCSI == nil { - yyn93 = true - goto LABEL93 + yyn27 = true + goto LABEL27 } - LABEL93: - if yyr82 || yy2arr82 { - if yyn93 { + LABEL27: + if yyr2 || yy2arr2 { + if yyn27 { r.EncodeNil() } else { - if yyq82[8] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { if x.ISCSI == nil { r.EncodeNil() } else { @@ -1189,9 +1281,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[8] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("iscsi")) - if yyn93 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn27 { r.EncodeNil() } else { if x.ISCSI == nil { @@ -1202,17 +1296,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn94 bool + var yyn30 bool if x.VolumeSource.Glusterfs == nil { - yyn94 = true - goto LABEL94 + yyn30 = true + goto LABEL30 } - LABEL94: - if yyr82 || yy2arr82 { - if yyn94 { + LABEL30: + if yyr2 || yy2arr2 { + if yyn30 { r.EncodeNil() } else { - if yyq82[9] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { if x.Glusterfs == nil { r.EncodeNil() } else { @@ -1223,9 +1318,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[9] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) - if yyn94 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn30 { r.EncodeNil() } else { if x.Glusterfs == nil { @@ -1236,17 +1333,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn95 bool + var yyn33 bool if x.VolumeSource.PersistentVolumeClaim == nil { - yyn95 = true - goto LABEL95 + yyn33 = true + goto LABEL33 } - LABEL95: - if yyr82 || yy2arr82 { - if yyn95 { + LABEL33: + if yyr2 || yy2arr2 { + if yyn33 { r.EncodeNil() } else { - if yyq82[10] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { if x.PersistentVolumeClaim == nil { r.EncodeNil() } else { @@ -1257,9 +1355,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[10] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("persistentVolumeClaim")) - if yyn95 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn33 { r.EncodeNil() } else { if x.PersistentVolumeClaim == nil { @@ -1270,17 +1370,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn96 bool + var yyn36 bool if x.VolumeSource.RBD == nil { - yyn96 = true - goto LABEL96 + yyn36 = true + goto LABEL36 } - LABEL96: - if yyr82 || yy2arr82 { - if yyn96 { + LABEL36: + if yyr2 || yy2arr2 { + if yyn36 { r.EncodeNil() } else { - if yyq82[11] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { if x.RBD == nil { r.EncodeNil() } else { @@ -1291,9 +1392,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[11] { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rbd")) - if yyn96 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn36 { r.EncodeNil() } else { if x.RBD == nil { @@ -1304,17 +1407,55 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn97 bool + var yyn39 bool + if x.VolumeSource.FlexVolume == nil { + yyn39 = true + goto LABEL39 + } + LABEL39: + if yyr2 || yy2arr2 { + if yyn39 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flexVolume")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn39 { + r.EncodeNil() + } else { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } + } + } + var yyn42 bool if x.VolumeSource.Cinder == nil { - yyn97 = true - goto LABEL97 + yyn42 = true + goto LABEL42 } - LABEL97: - if yyr82 || yy2arr82 { - if yyn97 { + LABEL42: + if yyr2 || yy2arr2 { + if yyn42 { r.EncodeNil() } else { - if yyq82[12] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[13] { if x.Cinder == nil { r.EncodeNil() } else { @@ -1325,9 +1466,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[12] { + if yyq2[13] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cinder")) - if yyn97 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn42 { r.EncodeNil() } else { if x.Cinder == nil { @@ -1338,17 +1481,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn98 bool + var yyn45 bool if x.VolumeSource.CephFS == nil { - yyn98 = true - goto LABEL98 + yyn45 = true + goto LABEL45 } - LABEL98: - if yyr82 || yy2arr82 { - if yyn98 { + LABEL45: + if yyr2 || yy2arr2 { + if yyn45 { r.EncodeNil() } else { - if yyq82[13] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { if x.CephFS == nil { r.EncodeNil() } else { @@ -1359,9 +1503,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[13] { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cephfs")) - if yyn98 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn45 { r.EncodeNil() } else { if x.CephFS == nil { @@ -1372,17 +1518,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn99 bool + var yyn48 bool if x.VolumeSource.Flocker == nil { - yyn99 = true - goto LABEL99 + yyn48 = true + goto LABEL48 } - LABEL99: - if yyr82 || yy2arr82 { - if yyn99 { + LABEL48: + if yyr2 || yy2arr2 { + if yyn48 { r.EncodeNil() } else { - if yyq82[14] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[15] { if x.Flocker == nil { r.EncodeNil() } else { @@ -1393,9 +1540,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[14] { + if yyq2[15] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("flocker")) - if yyn99 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn48 { r.EncodeNil() } else { if x.Flocker == nil { @@ -1406,17 +1555,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn100 bool + var yyn51 bool if x.VolumeSource.DownwardAPI == nil { - yyn100 = true - goto LABEL100 + yyn51 = true + goto LABEL51 } - LABEL100: - if yyr82 || yy2arr82 { - if yyn100 { + LABEL51: + if yyr2 || yy2arr2 { + if yyn51 { r.EncodeNil() } else { - if yyq82[15] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[16] { if x.DownwardAPI == nil { r.EncodeNil() } else { @@ -1427,9 +1577,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[15] { + if yyq2[16] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("downwardAPI")) - if yyn100 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn51 { r.EncodeNil() } else { if x.DownwardAPI == nil { @@ -1440,17 +1592,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn101 bool + var yyn54 bool if x.VolumeSource.FC == nil { - yyn101 = true - goto LABEL101 + yyn54 = true + goto LABEL54 } - LABEL101: - if yyr82 || yy2arr82 { - if yyn101 { + LABEL54: + if yyr2 || yy2arr2 { + if yyn54 { r.EncodeNil() } else { - if yyq82[16] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[17] { if x.FC == nil { r.EncodeNil() } else { @@ -1461,9 +1614,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[16] { + if yyq2[17] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fc")) - if yyn101 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn54 { r.EncodeNil() } else { if x.FC == nil { @@ -1474,8 +1629,84 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep82 { - r.EncodeEnd() + var yyn57 bool + if x.VolumeSource.AzureFile == nil { + yyn57 = true + goto LABEL57 + } + LABEL57: + if yyr2 || yy2arr2 { + if yyn57 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[18] { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[18] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("azureFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn57 { + r.EncodeNil() + } else { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } + } + } + var yyn60 bool + if x.VolumeSource.ConfigMap == nil { + yyn60 = true + goto LABEL60 + } + LABEL60: + if yyr2 || yy2arr2 { + if yyn60 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[19] { + if x.ConfigMap == nil { + r.EncodeNil() + } else { + x.ConfigMap.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[19] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("configMap")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn60 { + r.EncodeNil() + } else { + if x.ConfigMap == nil { + r.EncodeNil() + } else { + x.ConfigMap.CodecEncodeSelf(e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1485,24 +1716,25 @@ func (x *Volume) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym102 := z.DecBinary() - _ = yym102 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl103 := r.ReadMapStart() - if yyl103 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl103, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl103 := r.ReadArrayStart() - if yyl103 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl103, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1514,12 +1746,12 @@ func (x *Volume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys104Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys104Slc - var yyhl104 bool = l >= 0 - for yyj104 := 0; ; yyj104++ { - if yyhl104 { - if yyj104 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1527,9 +1759,11 @@ func (x *Volume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys104Slc = r.DecodeBytes(yys104Slc, true, true) - yys104 := string(yys104Slc) - switch yys104 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -1690,6 +1924,20 @@ func (x *Volume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.RBD.CodecDecodeSelf(d) } + case "flexVolume": + if x.VolumeSource.FlexVolume == nil { + x.VolumeSource.FlexVolume = new(FlexVolumeSource) + } + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } case "cinder": if x.VolumeSource.Cinder == nil { x.VolumeSource.Cinder = new(CinderVolumeSource) @@ -1760,47 +2008,78 @@ func (x *Volume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.FC.CodecDecodeSelf(d) } + case "azureFile": + if x.VolumeSource.AzureFile == nil { + x.VolumeSource.AzureFile = new(AzureFileVolumeSource) + } + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil + } + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + case "configMap": + if x.VolumeSource.ConfigMap == nil { + x.VolumeSource.ConfigMap = new(ConfigMapVolumeSource) + } + if r.TryDecodeAsNil() { + if x.ConfigMap != nil { + x.ConfigMap = nil + } + } else { + if x.ConfigMap == nil { + x.ConfigMap = new(ConfigMapVolumeSource) + } + x.ConfigMap.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys104) - } // end switch yys104 - } // end for yyj104 - if !yyhl104 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj122 int - var yyb122 bool - var yyhl122 bool = l >= 0 - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l + var yyj24 int + var yyb24 bool + var yyhl24 bool = l >= 0 + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l } else { - yyb122 = r.CheckBreak() + yyb24 = r.CheckBreak() } - if yyb122 { - r.ReadEnd() + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.HostPath == nil { + x.VolumeSource.HostPath = new(HostPathVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HostPath != nil { x.HostPath = nil @@ -1811,16 +2090,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.HostPath.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.EmptyDir == nil { + x.VolumeSource.EmptyDir = new(EmptyDirVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.EmptyDir != nil { x.EmptyDir = nil @@ -1831,16 +2114,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.EmptyDir.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.GCEPersistentDisk == nil { + x.VolumeSource.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GCEPersistentDisk != nil { x.GCEPersistentDisk = nil @@ -1851,16 +2138,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.GCEPersistentDisk.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.AWSElasticBlockStore == nil { + x.VolumeSource.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.AWSElasticBlockStore != nil { x.AWSElasticBlockStore = nil @@ -1871,16 +2162,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.AWSElasticBlockStore.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.GitRepo == nil { + x.VolumeSource.GitRepo = new(GitRepoVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GitRepo != nil { x.GitRepo = nil @@ -1891,16 +2186,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.GitRepo.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.Secret == nil { + x.VolumeSource.Secret = new(SecretVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Secret != nil { x.Secret = nil @@ -1911,16 +2210,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Secret.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.NFS == nil { + x.VolumeSource.NFS = new(NFSVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.NFS != nil { x.NFS = nil @@ -1931,16 +2234,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.NFS.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.ISCSI == nil { + x.VolumeSource.ISCSI = new(ISCSIVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ISCSI != nil { x.ISCSI = nil @@ -1951,16 +2258,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.ISCSI.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.Glusterfs == nil { + x.VolumeSource.Glusterfs = new(GlusterfsVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Glusterfs != nil { x.Glusterfs = nil @@ -1971,16 +2282,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Glusterfs.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.PersistentVolumeClaim == nil { + x.VolumeSource.PersistentVolumeClaim = new(PersistentVolumeClaimVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.PersistentVolumeClaim != nil { x.PersistentVolumeClaim = nil @@ -1991,16 +2306,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.PersistentVolumeClaim.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.RBD == nil { + x.VolumeSource.RBD = new(RBDVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RBD != nil { x.RBD = nil @@ -2011,16 +2330,44 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.RBD.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.FlexVolume == nil { + x.VolumeSource.FlexVolume = new(FlexVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } + if x.VolumeSource.Cinder == nil { + x.VolumeSource.Cinder = new(CinderVolumeSource) + } + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Cinder != nil { x.Cinder = nil @@ -2031,16 +2378,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Cinder.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.CephFS == nil { + x.VolumeSource.CephFS = new(CephFSVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CephFS != nil { x.CephFS = nil @@ -2051,16 +2402,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.CephFS.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.Flocker == nil { + x.VolumeSource.Flocker = new(FlockerVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Flocker != nil { x.Flocker = nil @@ -2071,16 +2426,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Flocker.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.DownwardAPI == nil { + x.VolumeSource.DownwardAPI = new(DownwardAPIVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.DownwardAPI != nil { x.DownwardAPI = nil @@ -2091,16 +2450,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.DownwardAPI.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.FC == nil { + x.VolumeSource.FC = new(FCVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.FC != nil { x.FC = nil @@ -2111,19 +2474,68 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.FC.CodecDecodeSelf(d) } - for { - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.AzureFile == nil { + x.VolumeSource.AzureFile = new(AzureFileVolumeSource) + } + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil } - if yyb122 { + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + if x.VolumeSource.ConfigMap == nil { + x.VolumeSource.ConfigMap = new(ConfigMapVolumeSource) + } + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ConfigMap != nil { + x.ConfigMap = nil + } + } else { + if x.ConfigMap == nil { + x.ConfigMap = new(ConfigMapVolumeSource) + } + x.ConfigMap.CodecDecodeSelf(d) + } + for { + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { break } - z.DecStructFieldNotFound(yyj122-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj24-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -2133,45 +2545,51 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym140 := z.EncBinary() - _ = yym140 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep141 := !z.EncBinary() - yy2arr141 := z.EncBasicHandle().StructToArray - var yyq141 [16]bool - _, _, _ = yysep141, yyq141, yy2arr141 - const yyr141 bool = false - yyq141[0] = x.HostPath != nil - yyq141[1] = x.EmptyDir != nil - yyq141[2] = x.GCEPersistentDisk != nil - yyq141[3] = x.AWSElasticBlockStore != nil - yyq141[4] = x.GitRepo != nil - yyq141[5] = x.Secret != nil - yyq141[6] = x.NFS != nil - yyq141[7] = x.ISCSI != nil - yyq141[8] = x.Glusterfs != nil - yyq141[9] = x.PersistentVolumeClaim != nil - yyq141[10] = x.RBD != nil - yyq141[11] = x.Cinder != nil - yyq141[12] = x.CephFS != nil - yyq141[13] = x.Flocker != nil - yyq141[14] = x.DownwardAPI != nil - yyq141[15] = x.FC != nil - if yyr141 || yy2arr141 { - r.EncodeArrayStart(16) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [19]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.HostPath != nil + yyq2[1] = x.EmptyDir != nil + yyq2[2] = x.GCEPersistentDisk != nil + yyq2[3] = x.AWSElasticBlockStore != nil + yyq2[4] = x.GitRepo != nil + yyq2[5] = x.Secret != nil + yyq2[6] = x.NFS != nil + yyq2[7] = x.ISCSI != nil + yyq2[8] = x.Glusterfs != nil + yyq2[9] = x.PersistentVolumeClaim != nil + yyq2[10] = x.RBD != nil + yyq2[11] = x.FlexVolume != nil + yyq2[12] = x.Cinder != nil + yyq2[13] = x.CephFS != nil + yyq2[14] = x.Flocker != nil + yyq2[15] = x.DownwardAPI != nil + yyq2[16] = x.FC != nil + yyq2[17] = x.AzureFile != nil + yyq2[18] = x.ConfigMap != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(19) } else { - var yynn141 int = 0 - for _, b := range yyq141 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn141++ + yynn2++ } } - r.EncodeMapStart(yynn141) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr141 || yy2arr141 { - if yyq141[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.HostPath == nil { r.EncodeNil() } else { @@ -2181,8 +2599,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.HostPath == nil { r.EncodeNil() } else { @@ -2190,8 +2610,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.EmptyDir == nil { r.EncodeNil() } else { @@ -2201,8 +2622,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("emptyDir")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.EmptyDir == nil { r.EncodeNil() } else { @@ -2210,8 +2633,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -2221,8 +2645,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -2230,8 +2656,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -2241,8 +2668,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -2250,8 +2679,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.GitRepo == nil { r.EncodeNil() } else { @@ -2261,8 +2691,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gitRepo")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.GitRepo == nil { r.EncodeNil() } else { @@ -2270,8 +2702,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.Secret == nil { r.EncodeNil() } else { @@ -2281,8 +2714,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secret")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Secret == nil { r.EncodeNil() } else { @@ -2290,8 +2725,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.NFS == nil { r.EncodeNil() } else { @@ -2301,8 +2737,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.NFS == nil { r.EncodeNil() } else { @@ -2310,8 +2748,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[7] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { if x.ISCSI == nil { r.EncodeNil() } else { @@ -2321,8 +2760,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("iscsi")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ISCSI == nil { r.EncodeNil() } else { @@ -2330,8 +2771,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[8] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { if x.Glusterfs == nil { r.EncodeNil() } else { @@ -2341,8 +2783,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[8] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Glusterfs == nil { r.EncodeNil() } else { @@ -2350,8 +2794,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[9] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { if x.PersistentVolumeClaim == nil { r.EncodeNil() } else { @@ -2361,8 +2806,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[9] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("persistentVolumeClaim")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.PersistentVolumeClaim == nil { r.EncodeNil() } else { @@ -2370,8 +2817,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[10] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { if x.RBD == nil { r.EncodeNil() } else { @@ -2381,8 +2829,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[10] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rbd")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RBD == nil { r.EncodeNil() } else { @@ -2390,8 +2840,32 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[11] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flexVolume")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { if x.Cinder == nil { r.EncodeNil() } else { @@ -2401,8 +2875,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[11] { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cinder")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Cinder == nil { r.EncodeNil() } else { @@ -2410,8 +2886,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[12] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[13] { if x.CephFS == nil { r.EncodeNil() } else { @@ -2421,8 +2898,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[12] { + if yyq2[13] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cephfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CephFS == nil { r.EncodeNil() } else { @@ -2430,8 +2909,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[13] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { if x.Flocker == nil { r.EncodeNil() } else { @@ -2441,8 +2921,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[13] { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("flocker")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Flocker == nil { r.EncodeNil() } else { @@ -2450,8 +2932,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[14] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[15] { if x.DownwardAPI == nil { r.EncodeNil() } else { @@ -2461,8 +2944,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[14] { + if yyq2[15] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("downwardAPI")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.DownwardAPI == nil { r.EncodeNil() } else { @@ -2470,8 +2955,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[15] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[16] { if x.FC == nil { r.EncodeNil() } else { @@ -2481,8 +2967,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[15] { + if yyq2[16] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fc")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.FC == nil { r.EncodeNil() } else { @@ -2490,8 +2978,56 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep141 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[17] { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[17] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("azureFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[18] { + if x.ConfigMap == nil { + r.EncodeNil() + } else { + x.ConfigMap.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[18] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("configMap")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ConfigMap == nil { + r.EncodeNil() + } else { + x.ConfigMap.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -2501,24 +3037,25 @@ func (x *VolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym158 := z.DecBinary() - _ = yym158 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl159 := r.ReadMapStart() - if yyl159 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl159, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl159 := r.ReadArrayStart() - if yyl159 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl159, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -2530,12 +3067,12 @@ func (x *VolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys160Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys160Slc - var yyhl160 bool = l >= 0 - for yyj160 := 0; ; yyj160++ { - if yyhl160 { - if yyj160 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -2543,9 +3080,11 @@ func (x *VolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys160Slc = r.DecodeBytes(yys160Slc, true, true) - yys160 := string(yys160Slc) - switch yys160 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "hostPath": if r.TryDecodeAsNil() { if x.HostPath != nil { @@ -2667,6 +3206,17 @@ func (x *VolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.RBD.CodecDecodeSelf(d) } + case "flexVolume": + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } case "cinder": if r.TryDecodeAsNil() { if x.Cinder != nil { @@ -2722,32 +3272,53 @@ func (x *VolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.FC.CodecDecodeSelf(d) } + case "azureFile": + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil + } + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + case "configMap": + if r.TryDecodeAsNil() { + if x.ConfigMap != nil { + x.ConfigMap = nil + } + } else { + if x.ConfigMap == nil { + x.ConfigMap = new(ConfigMapVolumeSource) + } + x.ConfigMap.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys160) - } // end switch yys160 - } // end for yyj160 - if !yyhl160 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj177 int - var yyb177 bool - var yyhl177 bool = l >= 0 - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + var yyj23 int + var yyb23 bool + var yyhl23 bool = l >= 0 + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HostPath != nil { x.HostPath = nil @@ -2758,16 +3329,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.HostPath.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.EmptyDir != nil { x.EmptyDir = nil @@ -2778,16 +3350,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.EmptyDir.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GCEPersistentDisk != nil { x.GCEPersistentDisk = nil @@ -2798,16 +3371,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.GCEPersistentDisk.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.AWSElasticBlockStore != nil { x.AWSElasticBlockStore = nil @@ -2818,16 +3392,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.AWSElasticBlockStore.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GitRepo != nil { x.GitRepo = nil @@ -2838,16 +3413,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.GitRepo.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Secret != nil { x.Secret = nil @@ -2858,16 +3434,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Secret.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.NFS != nil { x.NFS = nil @@ -2878,16 +3455,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.NFS.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ISCSI != nil { x.ISCSI = nil @@ -2898,16 +3476,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.ISCSI.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Glusterfs != nil { x.Glusterfs = nil @@ -2918,16 +3497,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Glusterfs.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.PersistentVolumeClaim != nil { x.PersistentVolumeClaim = nil @@ -2938,16 +3518,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.PersistentVolumeClaim.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RBD != nil { x.RBD = nil @@ -2958,16 +3539,38 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.RBD.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Cinder != nil { x.Cinder = nil @@ -2978,16 +3581,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Cinder.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CephFS != nil { x.CephFS = nil @@ -2998,16 +3602,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.CephFS.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Flocker != nil { x.Flocker = nil @@ -3018,16 +3623,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Flocker.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.DownwardAPI != nil { x.DownwardAPI = nil @@ -3038,16 +3644,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.DownwardAPI.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.FC != nil { x.FC = nil @@ -3058,19 +3665,62 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.FC.CodecDecodeSelf(d) } - for { - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l - } else { - yyb177 = r.CheckBreak() + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil } - if yyb177 { + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ConfigMap != nil { + x.ConfigMap = nil + } + } else { + if x.ConfigMap == nil { + x.ConfigMap = new(ConfigMapVolumeSource) + } + x.ConfigMap.CodecDecodeSelf(d) + } + for { + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { break } - z.DecStructFieldNotFound(yyj177-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj23-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3080,40 +3730,45 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym194 := z.EncBinary() - _ = yym194 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep195 := !z.EncBinary() - yy2arr195 := z.EncBasicHandle().StructToArray - var yyq195 [11]bool - _, _, _ = yysep195, yyq195, yy2arr195 - const yyr195 bool = false - yyq195[0] = x.GCEPersistentDisk != nil - yyq195[1] = x.AWSElasticBlockStore != nil - yyq195[2] = x.HostPath != nil - yyq195[3] = x.Glusterfs != nil - yyq195[4] = x.NFS != nil - yyq195[5] = x.RBD != nil - yyq195[6] = x.ISCSI != nil - yyq195[7] = x.Cinder != nil - yyq195[8] = x.CephFS != nil - yyq195[9] = x.FC != nil - yyq195[10] = x.Flocker != nil - if yyr195 || yy2arr195 { - r.EncodeArrayStart(11) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [13]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.GCEPersistentDisk != nil + yyq2[1] = x.AWSElasticBlockStore != nil + yyq2[2] = x.HostPath != nil + yyq2[3] = x.Glusterfs != nil + yyq2[4] = x.NFS != nil + yyq2[5] = x.RBD != nil + yyq2[6] = x.ISCSI != nil + yyq2[7] = x.FlexVolume != nil + yyq2[8] = x.Cinder != nil + yyq2[9] = x.CephFS != nil + yyq2[10] = x.FC != nil + yyq2[11] = x.Flocker != nil + yyq2[12] = x.AzureFile != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(13) } else { - var yynn195 int = 0 - for _, b := range yyq195 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn195++ + yynn2++ } } - r.EncodeMapStart(yynn195) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr195 || yy2arr195 { - if yyq195[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -3123,8 +3778,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -3132,8 +3789,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -3143,8 +3801,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -3152,8 +3812,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.HostPath == nil { r.EncodeNil() } else { @@ -3163,8 +3824,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.HostPath == nil { r.EncodeNil() } else { @@ -3172,8 +3835,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.Glusterfs == nil { r.EncodeNil() } else { @@ -3183,8 +3847,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Glusterfs == nil { r.EncodeNil() } else { @@ -3192,8 +3858,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.NFS == nil { r.EncodeNil() } else { @@ -3203,8 +3870,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.NFS == nil { r.EncodeNil() } else { @@ -3212,8 +3881,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.RBD == nil { r.EncodeNil() } else { @@ -3223,8 +3893,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rbd")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RBD == nil { r.EncodeNil() } else { @@ -3232,8 +3904,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.ISCSI == nil { r.EncodeNil() } else { @@ -3243,8 +3916,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("iscsi")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ISCSI == nil { r.EncodeNil() } else { @@ -3252,8 +3927,32 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[7] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flexVolume")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { if x.Cinder == nil { r.EncodeNil() } else { @@ -3263,8 +3962,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[7] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cinder")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Cinder == nil { r.EncodeNil() } else { @@ -3272,8 +3973,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[8] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { if x.CephFS == nil { r.EncodeNil() } else { @@ -3283,8 +3985,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[8] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cephfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CephFS == nil { r.EncodeNil() } else { @@ -3292,8 +3996,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[9] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { if x.FC == nil { r.EncodeNil() } else { @@ -3303,8 +4008,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[9] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fc")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.FC == nil { r.EncodeNil() } else { @@ -3312,8 +4019,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr195 || yy2arr195 { - if yyq195[10] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { if x.Flocker == nil { r.EncodeNil() } else { @@ -3323,8 +4031,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq195[10] { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("flocker")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Flocker == nil { r.EncodeNil() } else { @@ -3332,8 +4042,33 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep195 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("azureFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -3343,24 +4078,25 @@ func (x *PersistentVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym207 := z.DecBinary() - _ = yym207 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl208 := r.ReadMapStart() - if yyl208 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl208, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl208 := r.ReadArrayStart() - if yyl208 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl208, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3372,12 +4108,12 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Deco var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys209Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys209Slc - var yyhl209 bool = l >= 0 - for yyj209 := 0; ; yyj209++ { - if yyhl209 { - if yyj209 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3385,9 +4121,11 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Deco break } } - yys209Slc = r.DecodeBytes(yys209Slc, true, true) - yys209 := string(yys209Slc) - switch yys209 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "gcePersistentDisk": if r.TryDecodeAsNil() { if x.GCEPersistentDisk != nil { @@ -3465,6 +4203,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Deco } x.ISCSI.CodecDecodeSelf(d) } + case "flexVolume": + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } case "cinder": if r.TryDecodeAsNil() { if x.Cinder != nil { @@ -3509,32 +4258,42 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Deco } x.Flocker.CodecDecodeSelf(d) } + case "azureFile": + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil + } + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys209) - } // end switch yys209 - } // end for yyj209 - if !yyhl209 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj221 int - var yyb221 bool - var yyhl221 bool = l >= 0 - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + var yyj17 int + var yyb17 bool + var yyhl17 bool = l >= 0 + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GCEPersistentDisk != nil { x.GCEPersistentDisk = nil @@ -3545,16 +4304,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.GCEPersistentDisk.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.AWSElasticBlockStore != nil { x.AWSElasticBlockStore = nil @@ -3565,16 +4325,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.AWSElasticBlockStore.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HostPath != nil { x.HostPath = nil @@ -3585,16 +4346,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.HostPath.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Glusterfs != nil { x.Glusterfs = nil @@ -3605,16 +4367,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.Glusterfs.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.NFS != nil { x.NFS = nil @@ -3625,16 +4388,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.NFS.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RBD != nil { x.RBD = nil @@ -3645,16 +4409,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.RBD.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ISCSI != nil { x.ISCSI = nil @@ -3665,16 +4430,38 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.ISCSI.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Cinder != nil { x.Cinder = nil @@ -3685,16 +4472,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.Cinder.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CephFS != nil { x.CephFS = nil @@ -3705,16 +4493,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.CephFS.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.FC != nil { x.FC = nil @@ -3725,16 +4514,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.FC.CodecDecodeSelf(d) } - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb221 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb221 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Flocker != nil { x.Flocker = nil @@ -3745,19 +4535,41 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.Flocker.CodecDecodeSelf(d) } - for { - yyj221++ - if yyhl221 { - yyb221 = yyj221 > l - } else { - yyb221 = r.CheckBreak() + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil } - if yyb221 { + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + for { + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { break } - z.DecStructFieldNotFound(yyj221-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj17-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaimVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3767,48 +4579,54 @@ func (x *PersistentVolumeClaimVolumeSource) CodecEncodeSelf(e *codec1978.Encoder if x == nil { r.EncodeNil() } else { - yym233 := z.EncBinary() - _ = yym233 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep234 := !z.EncBinary() - yy2arr234 := z.EncBasicHandle().StructToArray - var yyq234 [2]bool - _, _, _ = yysep234, yyq234, yy2arr234 - const yyr234 bool = false - yyq234[1] = x.ReadOnly != false - if yyr234 || yy2arr234 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn234 int = 1 - for _, b := range yyq234 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn234++ + yynn2++ } } - r.EncodeMapStart(yynn234) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr234 || yy2arr234 { - yym236 := z.EncBinary() - _ = yym236 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ClaimName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("claimName")) - yym237 := z.EncBinary() - _ = yym237 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ClaimName)) } } - if yyr234 || yy2arr234 { - if yyq234[1] { - yym239 := z.EncBinary() - _ = yym239 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -3817,18 +4635,22 @@ func (x *PersistentVolumeClaimVolumeSource) CodecEncodeSelf(e *codec1978.Encoder r.EncodeBool(false) } } else { - if yyq234[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym240 := z.EncBinary() - _ = yym240 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep234 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -3838,24 +4660,25 @@ func (x *PersistentVolumeClaimVolumeSource) CodecDecodeSelf(d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym241 := z.DecBinary() - _ = yym241 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl242 := r.ReadMapStart() - if yyl242 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl242, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl242 := r.ReadArrayStart() - if yyl242 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl242, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3867,12 +4690,12 @@ func (x *PersistentVolumeClaimVolumeSource) codecDecodeSelfFromMap(l int, d *cod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys243Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys243Slc - var yyhl243 bool = l >= 0 - for yyj243 := 0; ; yyj243++ { - if yyhl243 { - if yyj243 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3880,9 +4703,11 @@ func (x *PersistentVolumeClaimVolumeSource) codecDecodeSelfFromMap(l int, d *cod break } } - yys243Slc = r.DecodeBytes(yys243Slc, true, true) - yys243 := string(yys243Slc) - switch yys243 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "claimName": if r.TryDecodeAsNil() { x.ClaimName = "" @@ -3896,64 +4721,65 @@ func (x *PersistentVolumeClaimVolumeSource) codecDecodeSelfFromMap(l int, d *cod x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys243) - } // end switch yys243 - } // end for yyj243 - if !yyhl243 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaimVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj246 int - var yyb246 bool - var yyhl246 bool = l >= 0 - yyj246++ - if yyhl246 { - yyb246 = yyj246 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb246 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb246 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ClaimName = "" } else { x.ClaimName = string(r.DecodeString()) } - yyj246++ - if yyhl246 { - yyb246 = yyj246 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb246 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb246 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj246++ - if yyhl246 { - yyb246 = yyj246 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb246 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb246 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj246-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolume) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3963,120 +4789,139 @@ func (x *PersistentVolume) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym249 := z.EncBinary() - _ = yym249 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep250 := !z.EncBinary() - yy2arr250 := z.EncBasicHandle().StructToArray - var yyq250 [5]bool - _, _, _ = yysep250, yyq250, yy2arr250 - const yyr250 bool = false - yyq250[0] = x.Kind != "" - yyq250[1] = x.APIVersion != "" - yyq250[2] = true - yyq250[3] = true - yyq250[4] = true - if yyr250 || yy2arr250 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn250 int = 0 - for _, b := range yyq250 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn250++ + yynn2++ } } - r.EncodeMapStart(yynn250) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr250 || yy2arr250 { - if yyq250[0] { - yym252 := z.EncBinary() - _ = yym252 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq250[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym253 := z.EncBinary() - _ = yym253 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr250 || yy2arr250 { - if yyq250[1] { - yym255 := z.EncBinary() - _ = yym255 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq250[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym256 := z.EncBinary() - _ = yym256 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr250 || yy2arr250 { - if yyq250[2] { - yy258 := &x.ObjectMeta - yy258.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq250[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy259 := &x.ObjectMeta - yy259.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr250 || yy2arr250 { - if yyq250[3] { - yy261 := &x.Spec - yy261.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq250[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy262 := &x.Spec - yy262.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr250 || yy2arr250 { - if yyq250[4] { - yy264 := &x.Status - yy264.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq250[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy265 := &x.Status - yy265.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep250 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4086,24 +4931,25 @@ func (x *PersistentVolume) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym266 := z.DecBinary() - _ = yym266 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl267 := r.ReadMapStart() - if yyl267 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl267, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl267 := r.ReadArrayStart() - if yyl267 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl267, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4115,12 +4961,12 @@ func (x *PersistentVolume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys268Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys268Slc - var yyhl268 bool = l >= 0 - for yyj268 := 0; ; yyj268++ { - if yyhl268 { - if yyj268 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4128,9 +4974,32 @@ func (x *PersistentVolume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys268Slc = r.DecodeBytes(yys268Slc, true, true) - yys268 := string(yys268Slc) - switch yys268 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = PersistentVolumeSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = PersistentVolumeStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -4143,134 +5012,117 @@ func (x *PersistentVolume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv271 := &x.ObjectMeta - yyv271.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = PersistentVolumeSpec{} - } else { - yyv272 := &x.Spec - yyv272.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = PersistentVolumeStatus{} - } else { - yyv273 := &x.Status - yyv273.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys268) - } // end switch yys268 - } // end for yyj268 - if !yyhl268 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj274 int - var yyb274 bool - var yyhl274 bool = l >= 0 - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb274 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb274 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = PersistentVolumeSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = PersistentVolumeStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb274 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb274 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l - } else { - yyb274 = r.CheckBreak() - } - if yyb274 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv277 := &x.ObjectMeta - yyv277.CodecDecodeSelf(d) - } - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l - } else { - yyb274 = r.CheckBreak() - } - if yyb274 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = PersistentVolumeSpec{} - } else { - yyv278 := &x.Spec - yyv278.CodecDecodeSelf(d) - } - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l - } else { - yyb274 = r.CheckBreak() - } - if yyb274 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = PersistentVolumeStatus{} - } else { - yyv279 := &x.Status - yyv279.CodecDecodeSelf(d) - } for { - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb274 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb274 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj274-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -4280,436 +5132,70 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym280 := z.EncBinary() - _ = yym280 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep281 := !z.EncBinary() - yy2arr281 := z.EncBasicHandle().StructToArray - var yyq281 [15]bool - _, _, _ = yysep281, yyq281, yy2arr281 - const yyr281 bool = false - yyq281[1] = x.PersistentVolumeSource.GCEPersistentDisk != nil && x.GCEPersistentDisk != nil - yyq281[2] = x.PersistentVolumeSource.AWSElasticBlockStore != nil && x.AWSElasticBlockStore != nil - yyq281[3] = x.PersistentVolumeSource.HostPath != nil && x.HostPath != nil - yyq281[4] = x.PersistentVolumeSource.Glusterfs != nil && x.Glusterfs != nil - yyq281[5] = x.PersistentVolumeSource.NFS != nil && x.NFS != nil - yyq281[6] = x.PersistentVolumeSource.RBD != nil && x.RBD != nil - yyq281[7] = x.PersistentVolumeSource.ISCSI != nil && x.ISCSI != nil - yyq281[8] = x.PersistentVolumeSource.Cinder != nil && x.Cinder != nil - yyq281[9] = x.PersistentVolumeSource.CephFS != nil && x.CephFS != nil - yyq281[10] = x.PersistentVolumeSource.FC != nil && x.FC != nil - yyq281[11] = x.PersistentVolumeSource.Flocker != nil && x.Flocker != nil - yyq281[12] = len(x.AccessModes) != 0 - yyq281[13] = x.ClaimRef != nil - yyq281[14] = x.PersistentVolumeReclaimPolicy != "" - if yyr281 || yy2arr281 { - r.EncodeArrayStart(15) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [17]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = len(x.AccessModes) != 0 + yyq2[2] = x.ClaimRef != nil + yyq2[3] = x.PersistentVolumeReclaimPolicy != "" + yyq2[4] = x.PersistentVolumeSource.GCEPersistentDisk != nil && x.GCEPersistentDisk != nil + yyq2[5] = x.PersistentVolumeSource.AWSElasticBlockStore != nil && x.AWSElasticBlockStore != nil + yyq2[6] = x.PersistentVolumeSource.HostPath != nil && x.HostPath != nil + yyq2[7] = x.PersistentVolumeSource.Glusterfs != nil && x.Glusterfs != nil + yyq2[8] = x.PersistentVolumeSource.NFS != nil && x.NFS != nil + yyq2[9] = x.PersistentVolumeSource.RBD != nil && x.RBD != nil + yyq2[10] = x.PersistentVolumeSource.ISCSI != nil && x.ISCSI != nil + yyq2[11] = x.PersistentVolumeSource.FlexVolume != nil && x.FlexVolume != nil + yyq2[12] = x.PersistentVolumeSource.Cinder != nil && x.Cinder != nil + yyq2[13] = x.PersistentVolumeSource.CephFS != nil && x.CephFS != nil + yyq2[14] = x.PersistentVolumeSource.FC != nil && x.FC != nil + yyq2[15] = x.PersistentVolumeSource.Flocker != nil && x.Flocker != nil + yyq2[16] = x.PersistentVolumeSource.AzureFile != nil && x.AzureFile != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(17) } else { - var yynn281 int = 1 - for _, b := range yyq281 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn281++ + yynn2++ } } - r.EncodeMapStart(yynn281) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr281 || yy2arr281 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Capacity == nil { r.EncodeNil() } else { x.Capacity.CodecEncodeSelf(e) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("capacity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Capacity == nil { r.EncodeNil() } else { x.Capacity.CodecEncodeSelf(e) } } - var yyn283 bool - if x.PersistentVolumeSource.GCEPersistentDisk == nil { - yyn283 = true - goto LABEL283 - } - LABEL283: - if yyr281 || yy2arr281 { - if yyn283 { - r.EncodeNil() - } else { - if yyq281[1] { - if x.GCEPersistentDisk == nil { - r.EncodeNil() - } else { - x.GCEPersistentDisk.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[1] { - r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) - if yyn283 { - r.EncodeNil() - } else { - if x.GCEPersistentDisk == nil { - r.EncodeNil() - } else { - x.GCEPersistentDisk.CodecEncodeSelf(e) - } - } - } - } - var yyn284 bool - if x.PersistentVolumeSource.AWSElasticBlockStore == nil { - yyn284 = true - goto LABEL284 - } - LABEL284: - if yyr281 || yy2arr281 { - if yyn284 { - r.EncodeNil() - } else { - if yyq281[2] { - if x.AWSElasticBlockStore == nil { - r.EncodeNil() - } else { - x.AWSElasticBlockStore.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[2] { - r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) - if yyn284 { - r.EncodeNil() - } else { - if x.AWSElasticBlockStore == nil { - r.EncodeNil() - } else { - x.AWSElasticBlockStore.CodecEncodeSelf(e) - } - } - } - } - var yyn285 bool - if x.PersistentVolumeSource.HostPath == nil { - yyn285 = true - goto LABEL285 - } - LABEL285: - if yyr281 || yy2arr281 { - if yyn285 { - r.EncodeNil() - } else { - if yyq281[3] { - if x.HostPath == nil { - r.EncodeNil() - } else { - x.HostPath.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[3] { - r.EncodeString(codecSelferC_UTF81234, string("hostPath")) - if yyn285 { - r.EncodeNil() - } else { - if x.HostPath == nil { - r.EncodeNil() - } else { - x.HostPath.CodecEncodeSelf(e) - } - } - } - } - var yyn286 bool - if x.PersistentVolumeSource.Glusterfs == nil { - yyn286 = true - goto LABEL286 - } - LABEL286: - if yyr281 || yy2arr281 { - if yyn286 { - r.EncodeNil() - } else { - if yyq281[4] { - if x.Glusterfs == nil { - r.EncodeNil() - } else { - x.Glusterfs.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[4] { - r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) - if yyn286 { - r.EncodeNil() - } else { - if x.Glusterfs == nil { - r.EncodeNil() - } else { - x.Glusterfs.CodecEncodeSelf(e) - } - } - } - } - var yyn287 bool - if x.PersistentVolumeSource.NFS == nil { - yyn287 = true - goto LABEL287 - } - LABEL287: - if yyr281 || yy2arr281 { - if yyn287 { - r.EncodeNil() - } else { - if yyq281[5] { - if x.NFS == nil { - r.EncodeNil() - } else { - x.NFS.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[5] { - r.EncodeString(codecSelferC_UTF81234, string("nfs")) - if yyn287 { - r.EncodeNil() - } else { - if x.NFS == nil { - r.EncodeNil() - } else { - x.NFS.CodecEncodeSelf(e) - } - } - } - } - var yyn288 bool - if x.PersistentVolumeSource.RBD == nil { - yyn288 = true - goto LABEL288 - } - LABEL288: - if yyr281 || yy2arr281 { - if yyn288 { - r.EncodeNil() - } else { - if yyq281[6] { - if x.RBD == nil { - r.EncodeNil() - } else { - x.RBD.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[6] { - r.EncodeString(codecSelferC_UTF81234, string("rbd")) - if yyn288 { - r.EncodeNil() - } else { - if x.RBD == nil { - r.EncodeNil() - } else { - x.RBD.CodecEncodeSelf(e) - } - } - } - } - var yyn289 bool - if x.PersistentVolumeSource.ISCSI == nil { - yyn289 = true - goto LABEL289 - } - LABEL289: - if yyr281 || yy2arr281 { - if yyn289 { - r.EncodeNil() - } else { - if yyq281[7] { - if x.ISCSI == nil { - r.EncodeNil() - } else { - x.ISCSI.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[7] { - r.EncodeString(codecSelferC_UTF81234, string("iscsi")) - if yyn289 { - r.EncodeNil() - } else { - if x.ISCSI == nil { - r.EncodeNil() - } else { - x.ISCSI.CodecEncodeSelf(e) - } - } - } - } - var yyn290 bool - if x.PersistentVolumeSource.Cinder == nil { - yyn290 = true - goto LABEL290 - } - LABEL290: - if yyr281 || yy2arr281 { - if yyn290 { - r.EncodeNil() - } else { - if yyq281[8] { - if x.Cinder == nil { - r.EncodeNil() - } else { - x.Cinder.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[8] { - r.EncodeString(codecSelferC_UTF81234, string("cinder")) - if yyn290 { - r.EncodeNil() - } else { - if x.Cinder == nil { - r.EncodeNil() - } else { - x.Cinder.CodecEncodeSelf(e) - } - } - } - } - var yyn291 bool - if x.PersistentVolumeSource.CephFS == nil { - yyn291 = true - goto LABEL291 - } - LABEL291: - if yyr281 || yy2arr281 { - if yyn291 { - r.EncodeNil() - } else { - if yyq281[9] { - if x.CephFS == nil { - r.EncodeNil() - } else { - x.CephFS.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[9] { - r.EncodeString(codecSelferC_UTF81234, string("cephfs")) - if yyn291 { - r.EncodeNil() - } else { - if x.CephFS == nil { - r.EncodeNil() - } else { - x.CephFS.CodecEncodeSelf(e) - } - } - } - } - var yyn292 bool - if x.PersistentVolumeSource.FC == nil { - yyn292 = true - goto LABEL292 - } - LABEL292: - if yyr281 || yy2arr281 { - if yyn292 { - r.EncodeNil() - } else { - if yyq281[10] { - if x.FC == nil { - r.EncodeNil() - } else { - x.FC.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[10] { - r.EncodeString(codecSelferC_UTF81234, string("fc")) - if yyn292 { - r.EncodeNil() - } else { - if x.FC == nil { - r.EncodeNil() - } else { - x.FC.CodecEncodeSelf(e) - } - } - } - } - var yyn293 bool - if x.PersistentVolumeSource.Flocker == nil { - yyn293 = true - goto LABEL293 - } - LABEL293: - if yyr281 || yy2arr281 { - if yyn293 { - r.EncodeNil() - } else { - if yyq281[11] { - if x.Flocker == nil { - r.EncodeNil() - } else { - x.Flocker.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[11] { - r.EncodeString(codecSelferC_UTF81234, string("flocker")) - if yyn293 { - r.EncodeNil() - } else { - if x.Flocker == nil { - r.EncodeNil() - } else { - x.Flocker.CodecEncodeSelf(e) - } - } - } - } - if yyr281 || yy2arr281 { - if yyq281[12] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.AccessModes == nil { r.EncodeNil() } else { - yym295 := z.EncBinary() - _ = yym295 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -4719,13 +5205,15 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq281[12] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("accessModes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AccessModes == nil { r.EncodeNil() } else { - yym296 := z.EncBinary() - _ = yym296 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -4733,8 +5221,9 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr281 || yy2arr281 { - if yyq281[13] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.ClaimRef == nil { r.EncodeNil() } else { @@ -4744,8 +5233,10 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq281[13] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("claimRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ClaimRef == nil { r.EncodeNil() } else { @@ -4753,20 +5244,506 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr281 || yy2arr281 { - if yyq281[14] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { x.PersistentVolumeReclaimPolicy.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq281[14] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("persistentVolumeReclaimPolicy")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.PersistentVolumeReclaimPolicy.CodecEncodeSelf(e) } } - if yysep281 { - r.EncodeEnd() + var yyn15 bool + if x.PersistentVolumeSource.GCEPersistentDisk == nil { + yyn15 = true + goto LABEL15 + } + LABEL15: + if yyr2 || yy2arr2 { + if yyn15 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.GCEPersistentDisk == nil { + r.EncodeNil() + } else { + x.GCEPersistentDisk.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn15 { + r.EncodeNil() + } else { + if x.GCEPersistentDisk == nil { + r.EncodeNil() + } else { + x.GCEPersistentDisk.CodecEncodeSelf(e) + } + } + } + } + var yyn18 bool + if x.PersistentVolumeSource.AWSElasticBlockStore == nil { + yyn18 = true + goto LABEL18 + } + LABEL18: + if yyr2 || yy2arr2 { + if yyn18 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + if x.AWSElasticBlockStore == nil { + r.EncodeNil() + } else { + x.AWSElasticBlockStore.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn18 { + r.EncodeNil() + } else { + if x.AWSElasticBlockStore == nil { + r.EncodeNil() + } else { + x.AWSElasticBlockStore.CodecEncodeSelf(e) + } + } + } + } + var yyn21 bool + if x.PersistentVolumeSource.HostPath == nil { + yyn21 = true + goto LABEL21 + } + LABEL21: + if yyr2 || yy2arr2 { + if yyn21 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + if x.HostPath == nil { + r.EncodeNil() + } else { + x.HostPath.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn21 { + r.EncodeNil() + } else { + if x.HostPath == nil { + r.EncodeNil() + } else { + x.HostPath.CodecEncodeSelf(e) + } + } + } + } + var yyn24 bool + if x.PersistentVolumeSource.Glusterfs == nil { + yyn24 = true + goto LABEL24 + } + LABEL24: + if yyr2 || yy2arr2 { + if yyn24 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + if x.Glusterfs == nil { + r.EncodeNil() + } else { + x.Glusterfs.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn24 { + r.EncodeNil() + } else { + if x.Glusterfs == nil { + r.EncodeNil() + } else { + x.Glusterfs.CodecEncodeSelf(e) + } + } + } + } + var yyn27 bool + if x.PersistentVolumeSource.NFS == nil { + yyn27 = true + goto LABEL27 + } + LABEL27: + if yyr2 || yy2arr2 { + if yyn27 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + if x.NFS == nil { + r.EncodeNil() + } else { + x.NFS.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn27 { + r.EncodeNil() + } else { + if x.NFS == nil { + r.EncodeNil() + } else { + x.NFS.CodecEncodeSelf(e) + } + } + } + } + var yyn30 bool + if x.PersistentVolumeSource.RBD == nil { + yyn30 = true + goto LABEL30 + } + LABEL30: + if yyr2 || yy2arr2 { + if yyn30 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { + if x.RBD == nil { + r.EncodeNil() + } else { + x.RBD.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rbd")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn30 { + r.EncodeNil() + } else { + if x.RBD == nil { + r.EncodeNil() + } else { + x.RBD.CodecEncodeSelf(e) + } + } + } + } + var yyn33 bool + if x.PersistentVolumeSource.ISCSI == nil { + yyn33 = true + goto LABEL33 + } + LABEL33: + if yyr2 || yy2arr2 { + if yyn33 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { + if x.ISCSI == nil { + r.EncodeNil() + } else { + x.ISCSI.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("iscsi")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn33 { + r.EncodeNil() + } else { + if x.ISCSI == nil { + r.EncodeNil() + } else { + x.ISCSI.CodecEncodeSelf(e) + } + } + } + } + var yyn36 bool + if x.PersistentVolumeSource.FlexVolume == nil { + yyn36 = true + goto LABEL36 + } + LABEL36: + if yyr2 || yy2arr2 { + if yyn36 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flexVolume")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn36 { + r.EncodeNil() + } else { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } + } + } + var yyn39 bool + if x.PersistentVolumeSource.Cinder == nil { + yyn39 = true + goto LABEL39 + } + LABEL39: + if yyr2 || yy2arr2 { + if yyn39 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + if x.Cinder == nil { + r.EncodeNil() + } else { + x.Cinder.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cinder")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn39 { + r.EncodeNil() + } else { + if x.Cinder == nil { + r.EncodeNil() + } else { + x.Cinder.CodecEncodeSelf(e) + } + } + } + } + var yyn42 bool + if x.PersistentVolumeSource.CephFS == nil { + yyn42 = true + goto LABEL42 + } + LABEL42: + if yyr2 || yy2arr2 { + if yyn42 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[13] { + if x.CephFS == nil { + r.EncodeNil() + } else { + x.CephFS.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[13] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cephfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn42 { + r.EncodeNil() + } else { + if x.CephFS == nil { + r.EncodeNil() + } else { + x.CephFS.CodecEncodeSelf(e) + } + } + } + } + var yyn45 bool + if x.PersistentVolumeSource.FC == nil { + yyn45 = true + goto LABEL45 + } + LABEL45: + if yyr2 || yy2arr2 { + if yyn45 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { + if x.FC == nil { + r.EncodeNil() + } else { + x.FC.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fc")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn45 { + r.EncodeNil() + } else { + if x.FC == nil { + r.EncodeNil() + } else { + x.FC.CodecEncodeSelf(e) + } + } + } + } + var yyn48 bool + if x.PersistentVolumeSource.Flocker == nil { + yyn48 = true + goto LABEL48 + } + LABEL48: + if yyr2 || yy2arr2 { + if yyn48 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[15] { + if x.Flocker == nil { + r.EncodeNil() + } else { + x.Flocker.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[15] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flocker")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn48 { + r.EncodeNil() + } else { + if x.Flocker == nil { + r.EncodeNil() + } else { + x.Flocker.CodecEncodeSelf(e) + } + } + } + } + var yyn51 bool + if x.PersistentVolumeSource.AzureFile == nil { + yyn51 = true + goto LABEL51 + } + LABEL51: + if yyr2 || yy2arr2 { + if yyn51 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[16] { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[16] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("azureFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn51 { + r.EncodeNil() + } else { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4776,24 +5753,25 @@ func (x *PersistentVolumeSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym299 := z.DecBinary() - _ = yym299 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl300 := r.ReadMapStart() - if yyl300 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl300, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl300 := r.ReadArrayStart() - if yyl300 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl300, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4805,12 +5783,12 @@ func (x *PersistentVolumeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys301Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys301Slc - var yyhl301 bool = l >= 0 - for yyj301 := 0; ; yyj301++ { - if yyhl301 { - if yyj301 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4818,15 +5796,46 @@ func (x *PersistentVolumeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys301Slc = r.DecodeBytes(yys301Slc, true, true) - yys301 := string(yys301Slc) - switch yys301 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "capacity": if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv302 := &x.Capacity - yyv302.CodecDecodeSelf(d) + yyv4 := &x.Capacity + yyv4.CodecDecodeSelf(d) + } + case "accessModes": + if r.TryDecodeAsNil() { + x.AccessModes = nil + } else { + yyv5 := &x.AccessModes + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv5), d) + } + } + case "claimRef": + if r.TryDecodeAsNil() { + if x.ClaimRef != nil { + x.ClaimRef = nil + } + } else { + if x.ClaimRef == nil { + x.ClaimRef = new(ObjectReference) + } + x.ClaimRef.CodecDecodeSelf(d) + } + case "persistentVolumeReclaimPolicy": + if r.TryDecodeAsNil() { + x.PersistentVolumeReclaimPolicy = "" + } else { + x.PersistentVolumeReclaimPolicy = PersistentVolumeReclaimPolicy(r.DecodeString()) } case "gcePersistentDisk": if x.PersistentVolumeSource.GCEPersistentDisk == nil { @@ -4926,6 +5935,20 @@ func (x *PersistentVolumeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decode } x.ISCSI.CodecDecodeSelf(d) } + case "flexVolume": + if x.PersistentVolumeSource.FlexVolume == nil { + x.PersistentVolumeSource.FlexVolume = new(FlexVolumeSource) + } + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } case "cinder": if x.PersistentVolumeSource.Cinder == nil { x.PersistentVolumeSource.Cinder = new(CinderVolumeSource) @@ -4982,318 +6005,84 @@ func (x *PersistentVolumeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decode } x.Flocker.CodecDecodeSelf(d) } - case "accessModes": - if r.TryDecodeAsNil() { - x.AccessModes = nil - } else { - yyv314 := &x.AccessModes - yym315 := z.DecBinary() - _ = yym315 - if false { - } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv314), d) - } + case "azureFile": + if x.PersistentVolumeSource.AzureFile == nil { + x.PersistentVolumeSource.AzureFile = new(AzureFileVolumeSource) } - case "claimRef": if r.TryDecodeAsNil() { - if x.ClaimRef != nil { - x.ClaimRef = nil + if x.AzureFile != nil { + x.AzureFile = nil } } else { - if x.ClaimRef == nil { - x.ClaimRef = new(ObjectReference) + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) } - x.ClaimRef.CodecDecodeSelf(d) - } - case "persistentVolumeReclaimPolicy": - if r.TryDecodeAsNil() { - x.PersistentVolumeReclaimPolicy = "" - } else { - x.PersistentVolumeReclaimPolicy = PersistentVolumeReclaimPolicy(r.DecodeString()) + x.AzureFile.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys301) - } // end switch yys301 - } // end for yyj301 - if !yyhl301 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj318 int - var yyb318 bool - var yyhl318 bool = l >= 0 - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l + var yyj22 int + var yyb22 bool + var yyhl22 bool = l >= 0 + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l } else { - yyb318 = r.CheckBreak() + yyb22 = r.CheckBreak() } - if yyb318 { - r.ReadEnd() + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv319 := &x.Capacity - yyv319.CodecDecodeSelf(d) + yyv23 := &x.Capacity + yyv23.CodecDecodeSelf(d) } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l } else { - yyb318 = r.CheckBreak() + yyb22 = r.CheckBreak() } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.GCEPersistentDisk != nil { - x.GCEPersistentDisk = nil - } - } else { - if x.GCEPersistentDisk == nil { - x.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) - } - x.GCEPersistentDisk.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.AWSElasticBlockStore != nil { - x.AWSElasticBlockStore = nil - } - } else { - if x.AWSElasticBlockStore == nil { - x.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) - } - x.AWSElasticBlockStore.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.HostPath != nil { - x.HostPath = nil - } - } else { - if x.HostPath == nil { - x.HostPath = new(HostPathVolumeSource) - } - x.HostPath.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.Glusterfs != nil { - x.Glusterfs = nil - } - } else { - if x.Glusterfs == nil { - x.Glusterfs = new(GlusterfsVolumeSource) - } - x.Glusterfs.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.NFS != nil { - x.NFS = nil - } - } else { - if x.NFS == nil { - x.NFS = new(NFSVolumeSource) - } - x.NFS.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.RBD != nil { - x.RBD = nil - } - } else { - if x.RBD == nil { - x.RBD = new(RBDVolumeSource) - } - x.RBD.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.ISCSI != nil { - x.ISCSI = nil - } - } else { - if x.ISCSI == nil { - x.ISCSI = new(ISCSIVolumeSource) - } - x.ISCSI.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.Cinder != nil { - x.Cinder = nil - } - } else { - if x.Cinder == nil { - x.Cinder = new(CinderVolumeSource) - } - x.Cinder.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.CephFS != nil { - x.CephFS = nil - } - } else { - if x.CephFS == nil { - x.CephFS = new(CephFSVolumeSource) - } - x.CephFS.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.FC != nil { - x.FC = nil - } - } else { - if x.FC == nil { - x.FC = new(FCVolumeSource) - } - x.FC.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.Flocker != nil { - x.Flocker = nil - } - } else { - if x.Flocker == nil { - x.Flocker = new(FlockerVolumeSource) - } - x.Flocker.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv331 := &x.AccessModes - yym332 := z.DecBinary() - _ = yym332 + yyv24 := &x.AccessModes + yym25 := z.DecBinary() + _ = yym25 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv331), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv24), d) } } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l } else { - yyb318 = r.CheckBreak() + yyb22 = r.CheckBreak() } - if yyb318 { - r.ReadEnd() + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ClaimRef != nil { x.ClaimRef = nil @@ -5304,42 +6093,356 @@ func (x *PersistentVolumeSpec) codecDecodeSelfFromArray(l int, d *codec1978.Deco } x.ClaimRef.CodecDecodeSelf(d) } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l } else { - yyb318 = r.CheckBreak() + yyb22 = r.CheckBreak() } - if yyb318 { - r.ReadEnd() + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.PersistentVolumeReclaimPolicy = "" } else { x.PersistentVolumeReclaimPolicy = PersistentVolumeReclaimPolicy(r.DecodeString()) } - for { - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() + if x.PersistentVolumeSource.GCEPersistentDisk == nil { + x.PersistentVolumeSource.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.GCEPersistentDisk != nil { + x.GCEPersistentDisk = nil } - if yyb318 { + } else { + if x.GCEPersistentDisk == nil { + x.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) + } + x.GCEPersistentDisk.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.AWSElasticBlockStore == nil { + x.PersistentVolumeSource.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AWSElasticBlockStore != nil { + x.AWSElasticBlockStore = nil + } + } else { + if x.AWSElasticBlockStore == nil { + x.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) + } + x.AWSElasticBlockStore.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.HostPath == nil { + x.PersistentVolumeSource.HostPath = new(HostPathVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.HostPath != nil { + x.HostPath = nil + } + } else { + if x.HostPath == nil { + x.HostPath = new(HostPathVolumeSource) + } + x.HostPath.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.Glusterfs == nil { + x.PersistentVolumeSource.Glusterfs = new(GlusterfsVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Glusterfs != nil { + x.Glusterfs = nil + } + } else { + if x.Glusterfs == nil { + x.Glusterfs = new(GlusterfsVolumeSource) + } + x.Glusterfs.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.NFS == nil { + x.PersistentVolumeSource.NFS = new(NFSVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.NFS != nil { + x.NFS = nil + } + } else { + if x.NFS == nil { + x.NFS = new(NFSVolumeSource) + } + x.NFS.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.RBD == nil { + x.PersistentVolumeSource.RBD = new(RBDVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.RBD != nil { + x.RBD = nil + } + } else { + if x.RBD == nil { + x.RBD = new(RBDVolumeSource) + } + x.RBD.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.ISCSI == nil { + x.PersistentVolumeSource.ISCSI = new(ISCSIVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ISCSI != nil { + x.ISCSI = nil + } + } else { + if x.ISCSI == nil { + x.ISCSI = new(ISCSIVolumeSource) + } + x.ISCSI.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.FlexVolume == nil { + x.PersistentVolumeSource.FlexVolume = new(FlexVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.Cinder == nil { + x.PersistentVolumeSource.Cinder = new(CinderVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Cinder != nil { + x.Cinder = nil + } + } else { + if x.Cinder == nil { + x.Cinder = new(CinderVolumeSource) + } + x.Cinder.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.CephFS == nil { + x.PersistentVolumeSource.CephFS = new(CephFSVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.CephFS != nil { + x.CephFS = nil + } + } else { + if x.CephFS == nil { + x.CephFS = new(CephFSVolumeSource) + } + x.CephFS.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.FC == nil { + x.PersistentVolumeSource.FC = new(FCVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FC != nil { + x.FC = nil + } + } else { + if x.FC == nil { + x.FC = new(FCVolumeSource) + } + x.FC.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.Flocker == nil { + x.PersistentVolumeSource.Flocker = new(FlockerVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Flocker != nil { + x.Flocker = nil + } + } else { + if x.Flocker == nil { + x.Flocker = new(FlockerVolumeSource) + } + x.Flocker.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.AzureFile == nil { + x.PersistentVolumeSource.AzureFile = new(AzureFileVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil + } + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + for { + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { break } - z.DecStructFieldNotFound(yyj318-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj22-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x PersistentVolumeReclaimPolicy) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym335 := z.EncBinary() - _ = yym335 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -5351,8 +6454,8 @@ func (x *PersistentVolumeReclaimPolicy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym336 := z.DecBinary() - _ = yym336 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -5367,46 +6470,52 @@ func (x *PersistentVolumeStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym337 := z.EncBinary() - _ = yym337 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep338 := !z.EncBinary() - yy2arr338 := z.EncBasicHandle().StructToArray - var yyq338 [3]bool - _, _, _ = yysep338, yyq338, yy2arr338 - const yyr338 bool = false - yyq338[0] = x.Phase != "" - yyq338[1] = x.Message != "" - yyq338[2] = x.Reason != "" - if yyr338 || yy2arr338 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Phase != "" + yyq2[1] = x.Message != "" + yyq2[2] = x.Reason != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn338 int = 0 - for _, b := range yyq338 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn338++ + yynn2++ } } - r.EncodeMapStart(yynn338) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr338 || yy2arr338 { - if yyq338[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq338[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yyr338 || yy2arr338 { - if yyq338[1] { - yym341 := z.EncBinary() - _ = yym341 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -5415,20 +6524,23 @@ func (x *PersistentVolumeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq338[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym342 := z.EncBinary() - _ = yym342 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr338 || yy2arr338 { - if yyq338[2] { - yym344 := z.EncBinary() - _ = yym344 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -5437,18 +6549,22 @@ func (x *PersistentVolumeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq338[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym345 := z.EncBinary() - _ = yym345 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yysep338 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5458,24 +6574,25 @@ func (x *PersistentVolumeStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym346 := z.DecBinary() - _ = yym346 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl347 := r.ReadMapStart() - if yyl347 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl347, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl347 := r.ReadArrayStart() - if yyl347 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl347, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5487,12 +6604,12 @@ func (x *PersistentVolumeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Deco var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys348Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys348Slc - var yyhl348 bool = l >= 0 - for yyj348 := 0; ; yyj348++ { - if yyhl348 { - if yyj348 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5500,9 +6617,11 @@ func (x *PersistentVolumeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Deco break } } - yys348Slc = r.DecodeBytes(yys348Slc, true, true) - yys348 := string(yys348Slc) - switch yys348 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "phase": if r.TryDecodeAsNil() { x.Phase = "" @@ -5522,79 +6641,81 @@ func (x *PersistentVolumeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Deco x.Reason = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys348) - } // end switch yys348 - } // end for yyj348 - if !yyhl348 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj352 int - var yyb352 bool - var yyhl352 bool = l >= 0 - yyj352++ - if yyhl352 { - yyb352 = yyj352 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb352 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb352 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = PersistentVolumePhase(r.DecodeString()) } - yyj352++ - if yyhl352 { - yyb352 = yyj352 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb352 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb352 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj352++ - if yyhl352 { - yyb352 = yyj352 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb352 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb352 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } for { - yyj352++ - if yyhl352 { - yyb352 = yyj352 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb352 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb352 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj352-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5604,126 +6725,142 @@ func (x *PersistentVolumeList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym356 := z.EncBinary() - _ = yym356 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep357 := !z.EncBinary() - yy2arr357 := z.EncBasicHandle().StructToArray - var yyq357 [4]bool - _, _, _ = yysep357, yyq357, yy2arr357 - const yyr357 bool = false - yyq357[0] = x.Kind != "" - yyq357[1] = x.APIVersion != "" - yyq357[2] = true - if yyr357 || yy2arr357 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn357 int = 1 - for _, b := range yyq357 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn357++ + yynn2++ } } - r.EncodeMapStart(yynn357) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr357 || yy2arr357 { - if yyq357[0] { - yym359 := z.EncBinary() - _ = yym359 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq357[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym360 := z.EncBinary() - _ = yym360 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr357 || yy2arr357 { - if yyq357[1] { - yym362 := z.EncBinary() - _ = yym362 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq357[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym363 := z.EncBinary() - _ = yym363 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr357 || yy2arr357 { - if yyq357[2] { - yy365 := &x.ListMeta - yym366 := z.EncBinary() - _ = yym366 - if false { - } else if z.HasExtensions() && z.EncExt(yy365) { - } else { - z.EncFallback(yy365) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq357[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy367 := &x.ListMeta - yym368 := z.EncBinary() - _ = yym368 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy367) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy367) + z.EncFallback(yy6) } } } - if yyr357 || yy2arr357 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym370 := z.EncBinary() - _ = yym370 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSlicePersistentVolume(([]PersistentVolume)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym371 := z.EncBinary() - _ = yym371 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSlicePersistentVolume(([]PersistentVolume)(x.Items), e) } } } - if yysep357 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5733,24 +6870,25 @@ func (x *PersistentVolumeList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym372 := z.DecBinary() - _ = yym372 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl373 := r.ReadMapStart() - if yyl373 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl373, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl373 := r.ReadArrayStart() - if yyl373 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl373, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5762,12 +6900,12 @@ func (x *PersistentVolumeList) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys374Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys374Slc - var yyhl374 bool = l >= 0 - for yyj374 := 0; ; yyj374++ { - if yyhl374 { - if yyj374 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5775,9 +6913,36 @@ func (x *PersistentVolumeList) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys374Slc = r.DecodeBytes(yys374Slc, true, true) - yys374 := string(yys374Slc) - switch yys374 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePersistentVolume((*[]PersistentVolume)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -5790,133 +6955,111 @@ func (x *PersistentVolumeList) codecDecodeSelfFromMap(l int, d *codec1978.Decode } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv377 := &x.ListMeta - yym378 := z.DecBinary() - _ = yym378 - if false { - } else if z.HasExtensions() && z.DecExt(yyv377) { - } else { - z.DecFallback(yyv377, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv379 := &x.Items - yym380 := z.DecBinary() - _ = yym380 - if false { - } else { - h.decSlicePersistentVolume((*[]PersistentVolume)(yyv379), d) - } - } default: - z.DecStructFieldNotFound(-1, yys374) - } // end switch yys374 - } // end for yyj374 - if !yyhl374 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj381 int - var yyb381 bool - var yyhl381 bool = l >= 0 - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb381 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb381 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePersistentVolume((*[]PersistentVolume)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb381 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb381 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l - } else { - yyb381 = r.CheckBreak() - } - if yyb381 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv384 := &x.ListMeta - yym385 := z.DecBinary() - _ = yym385 - if false { - } else if z.HasExtensions() && z.DecExt(yyv384) { - } else { - z.DecFallback(yyv384, false) - } - } - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l - } else { - yyb381 = r.CheckBreak() - } - if yyb381 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv386 := &x.Items - yym387 := z.DecBinary() - _ = yym387 - if false { - } else { - h.decSlicePersistentVolume((*[]PersistentVolume)(yyv386), d) - } - } for { - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb381 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb381 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj381-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaim) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5926,120 +7069,139 @@ func (x *PersistentVolumeClaim) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym388 := z.EncBinary() - _ = yym388 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep389 := !z.EncBinary() - yy2arr389 := z.EncBasicHandle().StructToArray - var yyq389 [5]bool - _, _, _ = yysep389, yyq389, yy2arr389 - const yyr389 bool = false - yyq389[0] = x.Kind != "" - yyq389[1] = x.APIVersion != "" - yyq389[2] = true - yyq389[3] = true - yyq389[4] = true - if yyr389 || yy2arr389 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn389 int = 0 - for _, b := range yyq389 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn389++ + yynn2++ } } - r.EncodeMapStart(yynn389) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr389 || yy2arr389 { - if yyq389[0] { - yym391 := z.EncBinary() - _ = yym391 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq389[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym392 := z.EncBinary() - _ = yym392 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr389 || yy2arr389 { - if yyq389[1] { - yym394 := z.EncBinary() - _ = yym394 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq389[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym395 := z.EncBinary() - _ = yym395 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr389 || yy2arr389 { - if yyq389[2] { - yy397 := &x.ObjectMeta - yy397.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq389[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy398 := &x.ObjectMeta - yy398.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr389 || yy2arr389 { - if yyq389[3] { - yy400 := &x.Spec - yy400.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq389[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy401 := &x.Spec - yy401.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr389 || yy2arr389 { - if yyq389[4] { - yy403 := &x.Status - yy403.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq389[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy404 := &x.Status - yy404.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep389 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6049,24 +7211,25 @@ func (x *PersistentVolumeClaim) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym405 := z.DecBinary() - _ = yym405 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl406 := r.ReadMapStart() - if yyl406 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl406, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl406 := r.ReadArrayStart() - if yyl406 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl406, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6078,12 +7241,12 @@ func (x *PersistentVolumeClaim) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys407Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys407Slc - var yyhl407 bool = l >= 0 - for yyj407 := 0; ; yyj407++ { - if yyhl407 { - if yyj407 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6091,9 +7254,32 @@ func (x *PersistentVolumeClaim) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys407Slc = r.DecodeBytes(yys407Slc, true, true) - yys407 := string(yys407Slc) - switch yys407 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = PersistentVolumeClaimSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = PersistentVolumeClaimStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -6106,134 +7292,117 @@ func (x *PersistentVolumeClaim) codecDecodeSelfFromMap(l int, d *codec1978.Decod } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv410 := &x.ObjectMeta - yyv410.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = PersistentVolumeClaimSpec{} - } else { - yyv411 := &x.Spec - yyv411.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = PersistentVolumeClaimStatus{} - } else { - yyv412 := &x.Status - yyv412.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys407) - } // end switch yys407 - } // end for yyj407 - if !yyhl407 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaim) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj413 int - var yyb413 bool - var yyhl413 bool = l >= 0 - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb413 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb413 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = PersistentVolumeClaimSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = PersistentVolumeClaimStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb413 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb413 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l - } else { - yyb413 = r.CheckBreak() - } - if yyb413 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv416 := &x.ObjectMeta - yyv416.CodecDecodeSelf(d) - } - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l - } else { - yyb413 = r.CheckBreak() - } - if yyb413 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = PersistentVolumeClaimSpec{} - } else { - yyv417 := &x.Spec - yyv417.CodecDecodeSelf(d) - } - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l - } else { - yyb413 = r.CheckBreak() - } - if yyb413 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = PersistentVolumeClaimStatus{} - } else { - yyv418 := &x.Status - yyv418.CodecDecodeSelf(d) - } for { - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb413 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb413 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj413-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaimList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6243,126 +7412,142 @@ func (x *PersistentVolumeClaimList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym419 := z.EncBinary() - _ = yym419 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep420 := !z.EncBinary() - yy2arr420 := z.EncBasicHandle().StructToArray - var yyq420 [4]bool - _, _, _ = yysep420, yyq420, yy2arr420 - const yyr420 bool = false - yyq420[0] = x.Kind != "" - yyq420[1] = x.APIVersion != "" - yyq420[2] = true - if yyr420 || yy2arr420 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn420 int = 1 - for _, b := range yyq420 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn420++ + yynn2++ } } - r.EncodeMapStart(yynn420) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr420 || yy2arr420 { - if yyq420[0] { - yym422 := z.EncBinary() - _ = yym422 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq420[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym423 := z.EncBinary() - _ = yym423 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr420 || yy2arr420 { - if yyq420[1] { - yym425 := z.EncBinary() - _ = yym425 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq420[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym426 := z.EncBinary() - _ = yym426 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr420 || yy2arr420 { - if yyq420[2] { - yy428 := &x.ListMeta - yym429 := z.EncBinary() - _ = yym429 - if false { - } else if z.HasExtensions() && z.EncExt(yy428) { - } else { - z.EncFallback(yy428) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq420[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy430 := &x.ListMeta - yym431 := z.EncBinary() - _ = yym431 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy430) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy430) + z.EncFallback(yy6) } } } - if yyr420 || yy2arr420 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym433 := z.EncBinary() - _ = yym433 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSlicePersistentVolumeClaim(([]PersistentVolumeClaim)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym434 := z.EncBinary() - _ = yym434 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSlicePersistentVolumeClaim(([]PersistentVolumeClaim)(x.Items), e) } } } - if yysep420 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6372,24 +7557,25 @@ func (x *PersistentVolumeClaimList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym435 := z.DecBinary() - _ = yym435 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl436 := r.ReadMapStart() - if yyl436 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl436, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl436 := r.ReadArrayStart() - if yyl436 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl436, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6401,12 +7587,12 @@ func (x *PersistentVolumeClaimList) codecDecodeSelfFromMap(l int, d *codec1978.D var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys437Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys437Slc - var yyhl437 bool = l >= 0 - for yyj437 := 0; ; yyj437++ { - if yyhl437 { - if yyj437 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6414,9 +7600,36 @@ func (x *PersistentVolumeClaimList) codecDecodeSelfFromMap(l int, d *codec1978.D break } } - yys437Slc = r.DecodeBytes(yys437Slc, true, true) - yys437 := string(yys437Slc) - switch yys437 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePersistentVolumeClaim((*[]PersistentVolumeClaim)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -6429,133 +7642,111 @@ func (x *PersistentVolumeClaimList) codecDecodeSelfFromMap(l int, d *codec1978.D } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv440 := &x.ListMeta - yym441 := z.DecBinary() - _ = yym441 - if false { - } else if z.HasExtensions() && z.DecExt(yyv440) { - } else { - z.DecFallback(yyv440, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv442 := &x.Items - yym443 := z.DecBinary() - _ = yym443 - if false { - } else { - h.decSlicePersistentVolumeClaim((*[]PersistentVolumeClaim)(yyv442), d) - } - } default: - z.DecStructFieldNotFound(-1, yys437) - } // end switch yys437 - } // end for yyj437 - if !yyhl437 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaimList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj444 int - var yyb444 bool - var yyhl444 bool = l >= 0 - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb444 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb444 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePersistentVolumeClaim((*[]PersistentVolumeClaim)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb444 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb444 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l - } else { - yyb444 = r.CheckBreak() - } - if yyb444 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv447 := &x.ListMeta - yym448 := z.DecBinary() - _ = yym448 - if false { - } else if z.HasExtensions() && z.DecExt(yyv447) { - } else { - z.DecFallback(yyv447, false) - } - } - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l - } else { - yyb444 = r.CheckBreak() - } - if yyb444 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv449 := &x.Items - yym450 := z.DecBinary() - _ = yym450 - if false { - } else { - h.decSlicePersistentVolumeClaim((*[]PersistentVolumeClaim)(yyv449), d) - } - } for { - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb444 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb444 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj444-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6565,37 +7756,40 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym451 := z.EncBinary() - _ = yym451 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep452 := !z.EncBinary() - yy2arr452 := z.EncBasicHandle().StructToArray - var yyq452 [3]bool - _, _, _ = yysep452, yyq452, yy2arr452 - const yyr452 bool = false - yyq452[0] = len(x.AccessModes) != 0 - yyq452[1] = true - yyq452[2] = x.VolumeName != "" - if yyr452 || yy2arr452 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.AccessModes) != 0 + yyq2[1] = true + yyq2[2] = x.VolumeName != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn452 int = 0 - for _, b := range yyq452 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn452++ + yynn2++ } } - r.EncodeMapStart(yynn452) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr452 || yy2arr452 { - if yyq452[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.AccessModes == nil { r.EncodeNil() } else { - yym454 := z.EncBinary() - _ = yym454 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -6605,13 +7799,15 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq452[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("accessModes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AccessModes == nil { r.EncodeNil() } else { - yym455 := z.EncBinary() - _ = yym455 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -6619,24 +7815,28 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr452 || yy2arr452 { - if yyq452[1] { - yy457 := &x.Resources - yy457.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy7 := &x.Resources + yy7.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq452[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resources")) - yy458 := &x.Resources - yy458.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Resources + yy9.CodecEncodeSelf(e) } } - if yyr452 || yy2arr452 { - if yyq452[2] { - yym460 := z.EncBinary() - _ = yym460 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeName)) @@ -6645,18 +7845,22 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq452[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeName")) - yym461 := z.EncBinary() - _ = yym461 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeName)) } } } - if yysep452 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6666,24 +7870,25 @@ func (x *PersistentVolumeClaimSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym462 := z.DecBinary() - _ = yym462 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl463 := r.ReadMapStart() - if yyl463 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl463, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl463 := r.ReadArrayStart() - if yyl463 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl463, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6695,12 +7900,12 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromMap(l int, d *codec1978.D var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys464Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys464Slc - var yyhl464 bool = l >= 0 - for yyj464 := 0; ; yyj464++ { - if yyhl464 { - if yyj464 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6708,27 +7913,29 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromMap(l int, d *codec1978.D break } } - yys464Slc = r.DecodeBytes(yys464Slc, true, true) - yys464 := string(yys464Slc) - switch yys464 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "accessModes": if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv465 := &x.AccessModes - yym466 := z.DecBinary() - _ = yym466 + yyv4 := &x.AccessModes + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv465), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv4), d) } } case "resources": if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv467 := &x.Resources - yyv467.CodecDecodeSelf(d) + yyv6 := &x.Resources + yyv6.CodecDecodeSelf(d) } case "volumeName": if r.TryDecodeAsNil() { @@ -6737,86 +7944,88 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromMap(l int, d *codec1978.D x.VolumeName = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys464) - } // end switch yys464 - } // end for yyj464 - if !yyhl464 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj469 int - var yyb469 bool - var yyhl469 bool = l >= 0 - yyj469++ - if yyhl469 { - yyb469 = yyj469 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb469 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb469 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv470 := &x.AccessModes - yym471 := z.DecBinary() - _ = yym471 + yyv9 := &x.AccessModes + yym10 := z.DecBinary() + _ = yym10 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv470), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv9), d) } } - yyj469++ - if yyhl469 { - yyb469 = yyj469 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb469 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb469 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv472 := &x.Resources - yyv472.CodecDecodeSelf(d) + yyv11 := &x.Resources + yyv11.CodecDecodeSelf(d) } - yyj469++ - if yyhl469 { - yyb469 = yyj469 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb469 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb469 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.VolumeName = "" } else { x.VolumeName = string(r.DecodeString()) } for { - yyj469++ - if yyhl469 { - yyb469 = yyj469 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb469 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb469 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj469-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6826,49 +8035,55 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym474 := z.EncBinary() - _ = yym474 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep475 := !z.EncBinary() - yy2arr475 := z.EncBasicHandle().StructToArray - var yyq475 [3]bool - _, _, _ = yysep475, yyq475, yy2arr475 - const yyr475 bool = false - yyq475[0] = x.Phase != "" - yyq475[1] = len(x.AccessModes) != 0 - yyq475[2] = len(x.Capacity) != 0 - if yyr475 || yy2arr475 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Phase != "" + yyq2[1] = len(x.AccessModes) != 0 + yyq2[2] = len(x.Capacity) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn475 int = 0 - for _, b := range yyq475 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn475++ + yynn2++ } } - r.EncodeMapStart(yynn475) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr475 || yy2arr475 { - if yyq475[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq475[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yyr475 || yy2arr475 { - if yyq475[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.AccessModes == nil { r.EncodeNil() } else { - yym478 := z.EncBinary() - _ = yym478 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -6878,13 +8093,15 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq475[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("accessModes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AccessModes == nil { r.EncodeNil() } else { - yym479 := z.EncBinary() - _ = yym479 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -6892,8 +8109,9 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr475 || yy2arr475 { - if yyq475[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Capacity == nil { r.EncodeNil() } else { @@ -6903,8 +8121,10 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq475[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("capacity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Capacity == nil { r.EncodeNil() } else { @@ -6912,8 +8132,10 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep475 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6923,24 +8145,25 @@ func (x *PersistentVolumeClaimStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym481 := z.DecBinary() - _ = yym481 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl482 := r.ReadMapStart() - if yyl482 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl482, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl482 := r.ReadArrayStart() - if yyl482 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl482, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6952,12 +8175,12 @@ func (x *PersistentVolumeClaimStatus) codecDecodeSelfFromMap(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys483Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys483Slc - var yyhl483 bool = l >= 0 - for yyj483 := 0; ; yyj483++ { - if yyhl483 { - if yyj483 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6965,9 +8188,11 @@ func (x *PersistentVolumeClaimStatus) codecDecodeSelfFromMap(l int, d *codec1978 break } } - yys483Slc = r.DecodeBytes(yys483Slc, true, true) - yys483 := string(yys483Slc) - switch yys483 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "phase": if r.TryDecodeAsNil() { x.Phase = "" @@ -6978,110 +8203,112 @@ func (x *PersistentVolumeClaimStatus) codecDecodeSelfFromMap(l int, d *codec1978 if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv485 := &x.AccessModes - yym486 := z.DecBinary() - _ = yym486 + yyv5 := &x.AccessModes + yym6 := z.DecBinary() + _ = yym6 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv485), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv5), d) } } case "capacity": if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv487 := &x.Capacity - yyv487.CodecDecodeSelf(d) + yyv7 := &x.Capacity + yyv7.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys483) - } // end switch yys483 - } // end for yyj483 - if !yyhl483 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaimStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj488 int - var yyb488 bool - var yyhl488 bool = l >= 0 - yyj488++ - if yyhl488 { - yyb488 = yyj488 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb488 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb488 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = PersistentVolumeClaimPhase(r.DecodeString()) } - yyj488++ - if yyhl488 { - yyb488 = yyj488 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb488 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb488 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv490 := &x.AccessModes - yym491 := z.DecBinary() - _ = yym491 + yyv10 := &x.AccessModes + yym11 := z.DecBinary() + _ = yym11 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv490), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv10), d) } } - yyj488++ - if yyhl488 { - yyb488 = yyj488 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb488 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb488 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv492 := &x.Capacity - yyv492.CodecDecodeSelf(d) + yyv12 := &x.Capacity + yyv12.CodecDecodeSelf(d) } for { - yyj488++ - if yyhl488 { - yyb488 = yyj488 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb488 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb488 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj488-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x PersistentVolumeAccessMode) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym493 := z.EncBinary() - _ = yym493 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -7093,8 +8320,8 @@ func (x *PersistentVolumeAccessMode) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym494 := z.DecBinary() - _ = yym494 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -7106,8 +8333,8 @@ func (x PersistentVolumePhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym495 := z.EncBinary() - _ = yym495 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -7119,8 +8346,8 @@ func (x *PersistentVolumePhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym496 := z.DecBinary() - _ = yym496 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -7132,8 +8359,8 @@ func (x PersistentVolumeClaimPhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym497 := z.EncBinary() - _ = yym497 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -7145,8 +8372,8 @@ func (x *PersistentVolumeClaimPhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym498 := z.DecBinary() - _ = yym498 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -7161,45 +8388,52 @@ func (x *HostPathVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym499 := z.EncBinary() - _ = yym499 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep500 := !z.EncBinary() - yy2arr500 := z.EncBasicHandle().StructToArray - var yyq500 [1]bool - _, _, _ = yysep500, yyq500, yy2arr500 - const yyr500 bool = false - if yyr500 || yy2arr500 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn500 int = 1 - for _, b := range yyq500 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn500++ + yynn2++ } } - r.EncodeMapStart(yynn500) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr500 || yy2arr500 { - yym502 := z.EncBinary() - _ = yym502 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym503 := z.EncBinary() - _ = yym503 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } - if yysep500 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7209,24 +8443,25 @@ func (x *HostPathVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym504 := z.DecBinary() - _ = yym504 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl505 := r.ReadMapStart() - if yyl505 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl505, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl505 := r.ReadArrayStart() - if yyl505 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl505, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7238,12 +8473,12 @@ func (x *HostPathVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys506Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys506Slc - var yyhl506 bool = l >= 0 - for yyj506 := 0; ; yyj506++ { - if yyhl506 { - if yyj506 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7251,9 +8486,11 @@ func (x *HostPathVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys506Slc = r.DecodeBytes(yys506Slc, true, true) - yys506 := string(yys506Slc) - switch yys506 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "path": if r.TryDecodeAsNil() { x.Path = "" @@ -7261,49 +8498,49 @@ func (x *HostPathVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode x.Path = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys506) - } // end switch yys506 - } // end for yyj506 - if !yyhl506 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HostPathVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj508 int - var yyb508 bool - var yyhl508 bool = l >= 0 - yyj508++ - if yyhl508 { - yyb508 = yyj508 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb508 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb508 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } for { - yyj508++ - if yyhl508 { - yyb508 = yyj508 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb508 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb508 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj508-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EmptyDirVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7313,35 +8550,49 @@ func (x *EmptyDirVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym510 := z.EncBinary() - _ = yym510 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep511 := !z.EncBinary() - yy2arr511 := z.EncBasicHandle().StructToArray - var yyq511 [1]bool - _, _, _ = yysep511, yyq511, yy2arr511 - const yyr511 bool = false - if yyr511 || yy2arr511 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Medium != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn511 int = 1 - for _, b := range yyq511 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn511++ + yynn2++ } } - r.EncodeMapStart(yynn511) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr511 || yy2arr511 { - x.Medium.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + x.Medium.CodecEncodeSelf(e) + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } } else { - r.EncodeString(codecSelferC_UTF81234, string("medium")) - x.Medium.CodecEncodeSelf(e) + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("medium")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + x.Medium.CodecEncodeSelf(e) + } } - if yysep511 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7351,24 +8602,25 @@ func (x *EmptyDirVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym513 := z.DecBinary() - _ = yym513 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl514 := r.ReadMapStart() - if yyl514 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl514, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl514 := r.ReadArrayStart() - if yyl514 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl514, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7380,12 +8632,12 @@ func (x *EmptyDirVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys515Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys515Slc - var yyhl515 bool = l >= 0 - for yyj515 := 0; ; yyj515++ { - if yyhl515 { - if yyj515 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7393,9 +8645,11 @@ func (x *EmptyDirVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys515Slc = r.DecodeBytes(yys515Slc, true, true) - yys515 := string(yys515Slc) - switch yys515 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "medium": if r.TryDecodeAsNil() { x.Medium = "" @@ -7403,57 +8657,57 @@ func (x *EmptyDirVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode x.Medium = StorageMedium(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys515) - } // end switch yys515 - } // end for yyj515 - if !yyhl515 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EmptyDirVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj517 int - var yyb517 bool - var yyhl517 bool = l >= 0 - yyj517++ - if yyhl517 { - yyb517 = yyj517 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb517 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb517 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Medium = "" } else { x.Medium = StorageMedium(r.DecodeString()) } for { - yyj517++ - if yyhl517 { - yyb517 = yyj517 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb517 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb517 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj517-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x StorageMedium) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym519 := z.EncBinary() - _ = yym519 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -7465,8 +8719,8 @@ func (x *StorageMedium) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym520 := z.DecBinary() - _ = yym520 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -7478,8 +8732,8 @@ func (x Protocol) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym521 := z.EncBinary() - _ = yym521 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -7491,8 +8745,8 @@ func (x *Protocol) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym522 := z.DecBinary() - _ = yym522 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -7507,50 +8761,56 @@ func (x *GCEPersistentDiskVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym523 := z.EncBinary() - _ = yym523 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep524 := !z.EncBinary() - yy2arr524 := z.EncBasicHandle().StructToArray - var yyq524 [4]bool - _, _, _ = yysep524, yyq524, yy2arr524 - const yyr524 bool = false - yyq524[1] = x.FSType != "" - yyq524[2] = x.Partition != 0 - yyq524[3] = x.ReadOnly != false - if yyr524 || yy2arr524 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.FSType != "" + yyq2[2] = x.Partition != 0 + yyq2[3] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn524 int = 1 - for _, b := range yyq524 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn524++ + yynn2++ } } - r.EncodeMapStart(yynn524) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr524 || yy2arr524 { - yym526 := z.EncBinary() - _ = yym526 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PDName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("pdName")) - yym527 := z.EncBinary() - _ = yym527 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PDName)) } } - if yyr524 || yy2arr524 { - if yyq524[1] { - yym529 := z.EncBinary() - _ = yym529 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) @@ -7559,20 +8819,23 @@ func (x *GCEPersistentDiskVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq524[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym530 := z.EncBinary() - _ = yym530 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) } } } - if yyr524 || yy2arr524 { - if yyq524[2] { - yym532 := z.EncBinary() - _ = yym532 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.Partition)) @@ -7581,20 +8844,23 @@ func (x *GCEPersistentDiskVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq524[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("partition")) - yym533 := z.EncBinary() - _ = yym533 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.Partition)) } } } - if yyr524 || yy2arr524 { - if yyq524[3] { - yym535 := z.EncBinary() - _ = yym535 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -7603,18 +8869,22 @@ func (x *GCEPersistentDiskVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq524[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym536 := z.EncBinary() - _ = yym536 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep524 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7624,24 +8894,25 @@ func (x *GCEPersistentDiskVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym537 := z.DecBinary() - _ = yym537 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl538 := r.ReadMapStart() - if yyl538 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl538, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl538 := r.ReadArrayStart() - if yyl538 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl538, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7653,12 +8924,12 @@ func (x *GCEPersistentDiskVolumeSource) codecDecodeSelfFromMap(l int, d *codec19 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys539Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys539Slc - var yyhl539 bool = l >= 0 - for yyj539 := 0; ; yyj539++ { - if yyhl539 { - if yyj539 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7666,9 +8937,11 @@ func (x *GCEPersistentDiskVolumeSource) codecDecodeSelfFromMap(l int, d *codec19 break } } - yys539Slc = r.DecodeBytes(yys539Slc, true, true) - yys539 := string(yys539Slc) - switch yys539 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "pdName": if r.TryDecodeAsNil() { x.PDName = "" @@ -7694,94 +8967,97 @@ func (x *GCEPersistentDiskVolumeSource) codecDecodeSelfFromMap(l int, d *codec19 x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys539) - } // end switch yys539 - } // end for yyj539 - if !yyhl539 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *GCEPersistentDiskVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj544 int - var yyb544 bool - var yyhl544 bool = l >= 0 - yyj544++ - if yyhl544 { - yyb544 = yyj544 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb544 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb544 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.PDName = "" } else { x.PDName = string(r.DecodeString()) } - yyj544++ - if yyhl544 { - yyb544 = yyj544 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb544 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb544 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj544++ - if yyhl544 { - yyb544 = yyj544 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb544 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb544 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Partition = 0 } else { x.Partition = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj544++ - if yyhl544 { - yyb544 = yyj544 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb544 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb544 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj544++ - if yyhl544 { - yyb544 = yyj544 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb544 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb544 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj544-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7791,36 +9067,40 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym549 := z.EncBinary() - _ = yym549 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep550 := !z.EncBinary() - yy2arr550 := z.EncBasicHandle().StructToArray - var yyq550 [5]bool - _, _, _ = yysep550, yyq550, yy2arr550 - const yyr550 bool = false - yyq550[0] = x.TargetPortal != "" - yyq550[1] = x.IQN != "" - yyq550[2] = x.Lun != 0 - yyq550[3] = x.FSType != "" - yyq550[4] = x.ReadOnly != false - if yyr550 || yy2arr550 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.TargetPortal != "" + yyq2[1] = x.IQN != "" + yyq2[2] = x.Lun != 0 + yyq2[3] = x.ISCSIInterface != "" + yyq2[4] = x.FSType != "" + yyq2[5] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(6) } else { - var yynn550 int = 0 - for _, b := range yyq550 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn550++ + yynn2++ } } - r.EncodeMapStart(yynn550) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr550 || yy2arr550 { - if yyq550[0] { - yym552 := z.EncBinary() - _ = yym552 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.TargetPortal)) @@ -7829,20 +9109,23 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq550[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("targetPortal")) - yym553 := z.EncBinary() - _ = yym553 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.TargetPortal)) } } } - if yyr550 || yy2arr550 { - if yyq550[1] { - yym555 := z.EncBinary() - _ = yym555 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IQN)) @@ -7851,20 +9134,23 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq550[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("iqn")) - yym556 := z.EncBinary() - _ = yym556 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IQN)) } } } - if yyr550 || yy2arr550 { - if yyq550[2] { - yym558 := z.EncBinary() - _ = yym558 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.Lun)) @@ -7873,20 +9159,48 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq550[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lun")) - yym559 := z.EncBinary() - _ = yym559 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.Lun)) } } } - if yyr550 || yy2arr550 { - if yyq550[3] { - yym561 := z.EncBinary() - _ = yym561 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ISCSIInterface)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("iscsiInterface")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ISCSIInterface)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) @@ -7895,20 +9209,23 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq550[3] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym562 := z.EncBinary() - _ = yym562 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) } } } - if yyr550 || yy2arr550 { - if yyq550[4] { - yym564 := z.EncBinary() - _ = yym564 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -7917,18 +9234,22 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq550[4] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym565 := z.EncBinary() - _ = yym565 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep550 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7938,24 +9259,25 @@ func (x *ISCSIVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym566 := z.DecBinary() - _ = yym566 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl567 := r.ReadMapStart() - if yyl567 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl567, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl567 := r.ReadArrayStart() - if yyl567 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl567, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7967,12 +9289,12 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys568Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys568Slc - var yyhl568 bool = l >= 0 - for yyj568 := 0; ; yyj568++ { - if yyhl568 { - if yyj568 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7980,9 +9302,11 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys568Slc = r.DecodeBytes(yys568Slc, true, true) - yys568 := string(yys568Slc) - switch yys568 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "targetPortal": if r.TryDecodeAsNil() { x.TargetPortal = "" @@ -8001,6 +9325,12 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) } else { x.Lun = int(r.DecodeInt(codecSelferBitsize1234)) } + case "iscsiInterface": + if r.TryDecodeAsNil() { + x.ISCSIInterface = "" + } else { + x.ISCSIInterface = string(r.DecodeString()) + } case "fsType": if r.TryDecodeAsNil() { x.FSType = "" @@ -8014,109 +9344,129 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys568) - } // end switch yys568 - } // end for yyj568 - if !yyhl568 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj574 int - var yyb574 bool - var yyhl574 bool = l >= 0 - yyj574++ - if yyhl574 { - yyb574 = yyj574 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb574 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb574 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TargetPortal = "" } else { x.TargetPortal = string(r.DecodeString()) } - yyj574++ - if yyhl574 { - yyb574 = yyj574 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb574 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb574 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.IQN = "" } else { x.IQN = string(r.DecodeString()) } - yyj574++ - if yyhl574 { - yyb574 = yyj574 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb574 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb574 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Lun = 0 } else { x.Lun = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj574++ - if yyhl574 { - yyb574 = yyj574 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb574 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb574 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ISCSIInterface = "" + } else { + x.ISCSIInterface = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj574++ - if yyhl574 { - yyb574 = yyj574 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb574 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb574 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj574++ - if yyhl574 { - yyb574 = yyj574 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb574 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb574 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj574-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *FCVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -8126,98 +9476,117 @@ func (x *FCVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym580 := z.EncBinary() - _ = yym580 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep581 := !z.EncBinary() - yy2arr581 := z.EncBasicHandle().StructToArray - var yyq581 [4]bool - _, _, _ = yysep581, yyq581, yy2arr581 - const yyr581 bool = false - yyq581[3] = x.ReadOnly != false - if yyr581 || yy2arr581 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.FSType != "" + yyq2[3] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn581 int = 3 - for _, b := range yyq581 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn581++ + yynn2++ } } - r.EncodeMapStart(yynn581) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr581 || yy2arr581 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.TargetWWNs == nil { r.EncodeNil() } else { - yym583 := z.EncBinary() - _ = yym583 + yym4 := z.EncBinary() + _ = yym4 if false { } else { z.F.EncSliceStringV(x.TargetWWNs, false, e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("targetWWNs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TargetWWNs == nil { r.EncodeNil() } else { - yym584 := z.EncBinary() - _ = yym584 + yym5 := z.EncBinary() + _ = yym5 if false { } else { z.F.EncSliceStringV(x.TargetWWNs, false, e) } } } - if yyr581 || yy2arr581 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Lun == nil { r.EncodeNil() } else { - yy586 := *x.Lun - yym587 := z.EncBinary() - _ = yym587 + yy7 := *x.Lun + yym8 := z.EncBinary() + _ = yym8 if false { } else { - r.EncodeInt(int64(yy586)) + r.EncodeInt(int64(yy7)) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lun")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Lun == nil { r.EncodeNil() } else { - yy588 := *x.Lun - yym589 := z.EncBinary() - _ = yym589 + yy9 := *x.Lun + yym10 := z.EncBinary() + _ = yym10 if false { } else { - r.EncodeInt(int64(yy588)) + r.EncodeInt(int64(yy9)) } } } - if yyr581 || yy2arr581 { - yym591 := z.EncBinary() - _ = yym591 - if false { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym592 := z.EncBinary() - _ = yym592 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fsType")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } } } - if yyr581 || yy2arr581 { - if yyq581[3] { - yym594 := z.EncBinary() - _ = yym594 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -8226,18 +9595,22 @@ func (x *FCVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq581[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym595 := z.EncBinary() - _ = yym595 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep581 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8247,24 +9620,25 @@ func (x *FCVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym596 := z.DecBinary() - _ = yym596 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl597 := r.ReadMapStart() - if yyl597 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl597, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl597 := r.ReadArrayStart() - if yyl597 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl597, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8276,12 +9650,12 @@ func (x *FCVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys598Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys598Slc - var yyhl598 bool = l >= 0 - for yyj598 := 0; ; yyj598++ { - if yyhl598 { - if yyj598 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8289,19 +9663,21 @@ func (x *FCVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys598Slc = r.DecodeBytes(yys598Slc, true, true) - yys598 := string(yys598Slc) - switch yys598 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "targetWWNs": if r.TryDecodeAsNil() { x.TargetWWNs = nil } else { - yyv599 := &x.TargetWWNs - yym600 := z.DecBinary() - _ = yym600 + yyv4 := &x.TargetWWNs + yym5 := z.DecBinary() + _ = yym5 if false { } else { - z.F.DecSliceStringX(yyv599, false, d) + z.F.DecSliceStringX(yyv4, false, d) } } case "lun": @@ -8313,8 +9689,8 @@ func (x *FCVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.Lun == nil { x.Lun = new(int) } - yym602 := z.DecBinary() - _ = yym602 + yym7 := z.DecBinary() + _ = yym7 if false { } else { *((*int)(x.Lun)) = int(r.DecodeInt(codecSelferBitsize1234)) @@ -8333,52 +9709,52 @@ func (x *FCVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys598) - } // end switch yys598 - } // end for yyj598 - if !yyhl598 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *FCVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj605 int - var yyb605 bool - var yyhl605 bool = l >= 0 - yyj605++ - if yyhl605 { - yyb605 = yyj605 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb605 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb605 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TargetWWNs = nil } else { - yyv606 := &x.TargetWWNs - yym607 := z.DecBinary() - _ = yym607 + yyv11 := &x.TargetWWNs + yym12 := z.DecBinary() + _ = yym12 if false { } else { - z.F.DecSliceStringX(yyv606, false, d) + z.F.DecSliceStringX(yyv11, false, d) } } - yyj605++ - if yyhl605 { - yyb605 = yyj605 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb605 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb605 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Lun != nil { x.Lun = nil @@ -8387,56 +9763,441 @@ func (x *FCVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.Lun == nil { x.Lun = new(int) } - yym609 := z.DecBinary() - _ = yym609 + yym14 := z.DecBinary() + _ = yym14 if false { } else { *((*int)(x.Lun)) = int(r.DecodeInt(codecSelferBitsize1234)) } } - yyj605++ - if yyhl605 { - yyb605 = yyj605 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb605 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb605 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj605++ - if yyhl605 { - yyb605 = yyj605 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb605 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb605 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj605++ - if yyhl605 { - yyb605 = yyj605 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb605 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb605 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj605-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *FlexVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.FSType != "" + yyq2[2] = x.SecretRef != nil + yyq2[3] = x.ReadOnly != false + yyq2[4] = len(x.Options) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Driver)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("driver")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Driver)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fsType")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.SecretRef == nil { + r.EncodeNil() + } else { + x.SecretRef.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SecretRef == nil { + r.EncodeNil() + } else { + x.SecretRef.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.ReadOnly)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("readOnly")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.ReadOnly)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.Options == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + z.F.EncMapStringStringV(x.Options, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("options")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Options == nil { + r.EncodeNil() + } else { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + z.F.EncMapStringStringV(x.Options, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *FlexVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *FlexVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "driver": + if r.TryDecodeAsNil() { + x.Driver = "" + } else { + x.Driver = string(r.DecodeString()) + } + case "fsType": + if r.TryDecodeAsNil() { + x.FSType = "" + } else { + x.FSType = string(r.DecodeString()) + } + case "secretRef": + if r.TryDecodeAsNil() { + if x.SecretRef != nil { + x.SecretRef = nil + } + } else { + if x.SecretRef == nil { + x.SecretRef = new(LocalObjectReference) + } + x.SecretRef.CodecDecodeSelf(d) + } + case "readOnly": + if r.TryDecodeAsNil() { + x.ReadOnly = false + } else { + x.ReadOnly = bool(r.DecodeBool()) + } + case "options": + if r.TryDecodeAsNil() { + x.Options = nil + } else { + yyv8 := &x.Options + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + z.F.DecMapStringStringX(yyv8, false, d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *FlexVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Driver = "" + } else { + x.Driver = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.FSType = "" + } else { + x.FSType = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SecretRef != nil { + x.SecretRef = nil + } + } else { + if x.SecretRef == nil { + x.SecretRef = new(LocalObjectReference) + } + x.SecretRef.CodecDecodeSelf(d) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ReadOnly = false + } else { + x.ReadOnly = bool(r.DecodeBool()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Options = nil + } else { + yyv15 := &x.Options + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + z.F.DecMapStringStringX(yyv15, false, d) + } + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *AWSElasticBlockStoreVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -8446,50 +10207,56 @@ func (x *AWSElasticBlockStoreVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) if x == nil { r.EncodeNil() } else { - yym612 := z.EncBinary() - _ = yym612 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep613 := !z.EncBinary() - yy2arr613 := z.EncBasicHandle().StructToArray - var yyq613 [4]bool - _, _, _ = yysep613, yyq613, yy2arr613 - const yyr613 bool = false - yyq613[1] = x.FSType != "" - yyq613[2] = x.Partition != 0 - yyq613[3] = x.ReadOnly != false - if yyr613 || yy2arr613 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.FSType != "" + yyq2[2] = x.Partition != 0 + yyq2[3] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn613 int = 1 - for _, b := range yyq613 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn613++ + yynn2++ } } - r.EncodeMapStart(yynn613) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr613 || yy2arr613 { - yym615 := z.EncBinary() - _ = yym615 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeID")) - yym616 := z.EncBinary() - _ = yym616 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeID)) } } - if yyr613 || yy2arr613 { - if yyq613[1] { - yym618 := z.EncBinary() - _ = yym618 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) @@ -8498,20 +10265,23 @@ func (x *AWSElasticBlockStoreVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq613[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym619 := z.EncBinary() - _ = yym619 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) } } } - if yyr613 || yy2arr613 { - if yyq613[2] { - yym621 := z.EncBinary() - _ = yym621 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.Partition)) @@ -8520,20 +10290,23 @@ func (x *AWSElasticBlockStoreVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) r.EncodeInt(0) } } else { - if yyq613[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("partition")) - yym622 := z.EncBinary() - _ = yym622 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.Partition)) } } } - if yyr613 || yy2arr613 { - if yyq613[3] { - yym624 := z.EncBinary() - _ = yym624 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -8542,18 +10315,22 @@ func (x *AWSElasticBlockStoreVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) r.EncodeBool(false) } } else { - if yyq613[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym625 := z.EncBinary() - _ = yym625 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep613 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8563,24 +10340,25 @@ func (x *AWSElasticBlockStoreVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym626 := z.DecBinary() - _ = yym626 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl627 := r.ReadMapStart() - if yyl627 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl627, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl627 := r.ReadArrayStart() - if yyl627 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl627, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8592,12 +10370,12 @@ func (x *AWSElasticBlockStoreVolumeSource) codecDecodeSelfFromMap(l int, d *code var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys628Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys628Slc - var yyhl628 bool = l >= 0 - for yyj628 := 0; ; yyj628++ { - if yyhl628 { - if yyj628 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8605,9 +10383,11 @@ func (x *AWSElasticBlockStoreVolumeSource) codecDecodeSelfFromMap(l int, d *code break } } - yys628Slc = r.DecodeBytes(yys628Slc, true, true) - yys628 := string(yys628Slc) - switch yys628 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "volumeID": if r.TryDecodeAsNil() { x.VolumeID = "" @@ -8633,94 +10413,97 @@ func (x *AWSElasticBlockStoreVolumeSource) codecDecodeSelfFromMap(l int, d *code x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys628) - } // end switch yys628 - } // end for yyj628 - if !yyhl628 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *AWSElasticBlockStoreVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj633 int - var yyb633 bool - var yyhl633 bool = l >= 0 - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb633 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb633 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.VolumeID = "" } else { x.VolumeID = string(r.DecodeString()) } - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb633 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb633 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb633 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb633 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Partition = 0 } else { x.Partition = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb633 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb633 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb633 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb633 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj633-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *GitRepoVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -8730,61 +10513,104 @@ func (x *GitRepoVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym638 := z.EncBinary() - _ = yym638 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep639 := !z.EncBinary() - yy2arr639 := z.EncBasicHandle().StructToArray - var yyq639 [2]bool - _, _, _ = yysep639, yyq639, yy2arr639 - const yyr639 bool = false - if yyr639 || yy2arr639 { - r.EncodeArrayStart(2) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Revision != "" + yyq2[2] = x.Directory != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) } else { - var yynn639 int = 2 - for _, b := range yyq639 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn639++ + yynn2++ } } - r.EncodeMapStart(yynn639) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr639 || yy2arr639 { - yym641 := z.EncBinary() - _ = yym641 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Repository)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("repository")) - yym642 := z.EncBinary() - _ = yym642 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Repository)) } } - if yyr639 || yy2arr639 { - yym644 := z.EncBinary() - _ = yym644 - if false { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Revision)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Revision)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - r.EncodeString(codecSelferC_UTF81234, string("revision")) - yym645 := z.EncBinary() - _ = yym645 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Revision)) + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("revision")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Revision)) + } } } - if yysep639 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Directory)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("directory")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Directory)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8794,24 +10620,25 @@ func (x *GitRepoVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym646 := z.DecBinary() - _ = yym646 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl647 := r.ReadMapStart() - if yyl647 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl647, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl647 := r.ReadArrayStart() - if yyl647 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl647, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8823,12 +10650,12 @@ func (x *GitRepoVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys648Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys648Slc - var yyhl648 bool = l >= 0 - for yyj648 := 0; ; yyj648++ { - if yyhl648 { - if yyj648 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8836,9 +10663,11 @@ func (x *GitRepoVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys648Slc = r.DecodeBytes(yys648Slc, true, true) - yys648 := string(yys648Slc) - switch yys648 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "repository": if r.TryDecodeAsNil() { x.Repository = "" @@ -8851,65 +10680,88 @@ func (x *GitRepoVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder } else { x.Revision = string(r.DecodeString()) } + case "directory": + if r.TryDecodeAsNil() { + x.Directory = "" + } else { + x.Directory = string(r.DecodeString()) + } default: - z.DecStructFieldNotFound(-1, yys648) - } // end switch yys648 - } // end for yyj648 - if !yyhl648 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *GitRepoVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj651 int - var yyb651 bool - var yyhl651 bool = l >= 0 - yyj651++ - if yyhl651 { - yyb651 = yyj651 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb651 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb651 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Repository = "" } else { x.Repository = string(r.DecodeString()) } - yyj651++ - if yyhl651 { - yyb651 = yyj651 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb651 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb651 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Revision = "" } else { x.Revision = string(r.DecodeString()) } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Directory = "" + } else { + x.Directory = string(r.DecodeString()) + } for { - yyj651++ - if yyhl651 { - yyb651 = yyj651 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb651 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb651 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj651-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SecretVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -8919,45 +10771,59 @@ func (x *SecretVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym654 := z.EncBinary() - _ = yym654 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep655 := !z.EncBinary() - yy2arr655 := z.EncBasicHandle().StructToArray - var yyq655 [1]bool - _, _, _ = yysep655, yyq655, yy2arr655 - const yyr655 bool = false - if yyr655 || yy2arr655 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.SecretName != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn655 int = 1 - for _, b := range yyq655 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn655++ + yynn2++ } } - r.EncodeMapStart(yynn655) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr655 || yy2arr655 { - yym657 := z.EncBinary() - _ = yym657 - if false { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - r.EncodeString(codecSelferC_UTF81234, string("secretName")) - yym658 := z.EncBinary() - _ = yym658 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } } } - if yysep655 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8967,24 +10833,25 @@ func (x *SecretVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym659 := z.DecBinary() - _ = yym659 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl660 := r.ReadMapStart() - if yyl660 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl660, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl660 := r.ReadArrayStart() - if yyl660 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl660, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8996,12 +10863,12 @@ func (x *SecretVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys661Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys661Slc - var yyhl661 bool = l >= 0 - for yyj661 := 0; ; yyj661++ { - if yyhl661 { - if yyj661 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9009,9 +10876,11 @@ func (x *SecretVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys661Slc = r.DecodeBytes(yys661Slc, true, true) - yys661 := string(yys661Slc) - switch yys661 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "secretName": if r.TryDecodeAsNil() { x.SecretName = "" @@ -9019,49 +10888,49 @@ func (x *SecretVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.SecretName = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys661) - } // end switch yys661 - } // end for yyj661 - if !yyhl661 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SecretVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj663 int - var yyb663 bool - var yyhl663 bool = l >= 0 - yyj663++ - if yyhl663 { - yyb663 = yyj663 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb663 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb663 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SecretName = "" } else { x.SecretName = string(r.DecodeString()) } for { - yyj663++ - if yyhl663 { - yyb663 = yyj663 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb663 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb663 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj663-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9071,64 +10940,73 @@ func (x *NFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym665 := z.EncBinary() - _ = yym665 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep666 := !z.EncBinary() - yy2arr666 := z.EncBasicHandle().StructToArray - var yyq666 [3]bool - _, _, _ = yysep666, yyq666, yy2arr666 - const yyr666 bool = false - yyq666[2] = x.ReadOnly != false - if yyr666 || yy2arr666 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn666 int = 2 - for _, b := range yyq666 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn666++ + yynn2++ } } - r.EncodeMapStart(yynn666) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr666 || yy2arr666 { - yym668 := z.EncBinary() - _ = yym668 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Server)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("server")) - yym669 := z.EncBinary() - _ = yym669 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Server)) } } - if yyr666 || yy2arr666 { - yym671 := z.EncBinary() - _ = yym671 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym672 := z.EncBinary() - _ = yym672 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } - if yyr666 || yy2arr666 { - if yyq666[2] { - yym674 := z.EncBinary() - _ = yym674 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -9137,18 +11015,22 @@ func (x *NFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq666[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym675 := z.EncBinary() - _ = yym675 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep666 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9158,24 +11040,25 @@ func (x *NFSVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym676 := z.DecBinary() - _ = yym676 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl677 := r.ReadMapStart() - if yyl677 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl677, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl677 := r.ReadArrayStart() - if yyl677 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl677, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9187,12 +11070,12 @@ func (x *NFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys678Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys678Slc - var yyhl678 bool = l >= 0 - for yyj678 := 0; ; yyj678++ { - if yyhl678 { - if yyj678 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9200,9 +11083,11 @@ func (x *NFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys678Slc = r.DecodeBytes(yys678Slc, true, true) - yys678 := string(yys678Slc) - switch yys678 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "server": if r.TryDecodeAsNil() { x.Server = "" @@ -9222,79 +11107,81 @@ func (x *NFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys678) - } // end switch yys678 - } // end for yyj678 - if !yyhl678 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NFSVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj682 int - var yyb682 bool - var yyhl682 bool = l >= 0 - yyj682++ - if yyhl682 { - yyb682 = yyj682 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb682 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb682 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Server = "" } else { x.Server = string(r.DecodeString()) } - yyj682++ - if yyhl682 { - yyb682 = yyj682 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb682 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb682 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj682++ - if yyhl682 { - yyb682 = yyj682 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb682 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb682 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj682++ - if yyhl682 { - yyb682 = yyj682 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb682 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb682 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj682-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *GlusterfsVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9304,64 +11191,73 @@ func (x *GlusterfsVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym686 := z.EncBinary() - _ = yym686 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep687 := !z.EncBinary() - yy2arr687 := z.EncBasicHandle().StructToArray - var yyq687 [3]bool - _, _, _ = yysep687, yyq687, yy2arr687 - const yyr687 bool = false - yyq687[2] = x.ReadOnly != false - if yyr687 || yy2arr687 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn687 int = 2 - for _, b := range yyq687 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn687++ + yynn2++ } } - r.EncodeMapStart(yynn687) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr687 || yy2arr687 { - yym689 := z.EncBinary() - _ = yym689 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.EndpointsName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("endpoints")) - yym690 := z.EncBinary() - _ = yym690 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.EndpointsName)) } } - if yyr687 || yy2arr687 { - yym692 := z.EncBinary() - _ = yym692 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym693 := z.EncBinary() - _ = yym693 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } - if yyr687 || yy2arr687 { - if yyq687[2] { - yym695 := z.EncBinary() - _ = yym695 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -9370,18 +11266,22 @@ func (x *GlusterfsVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq687[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym696 := z.EncBinary() - _ = yym696 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep687 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9391,24 +11291,25 @@ func (x *GlusterfsVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym697 := z.DecBinary() - _ = yym697 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl698 := r.ReadMapStart() - if yyl698 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl698, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl698 := r.ReadArrayStart() - if yyl698 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl698, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9420,12 +11321,12 @@ func (x *GlusterfsVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys699Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys699Slc - var yyhl699 bool = l >= 0 - for yyj699 := 0; ; yyj699++ { - if yyhl699 { - if yyj699 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9433,9 +11334,11 @@ func (x *GlusterfsVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys699Slc = r.DecodeBytes(yys699Slc, true, true) - yys699 := string(yys699Slc) - switch yys699 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "endpoints": if r.TryDecodeAsNil() { x.EndpointsName = "" @@ -9455,79 +11358,81 @@ func (x *GlusterfsVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decod x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys699) - } // end switch yys699 - } // end for yyj699 - if !yyhl699 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *GlusterfsVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj703 int - var yyb703 bool - var yyhl703 bool = l >= 0 - yyj703++ - if yyhl703 { - yyb703 = yyj703 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb703 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb703 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.EndpointsName = "" } else { x.EndpointsName = string(r.DecodeString()) } - yyj703++ - if yyhl703 { - yyb703 = yyj703 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb703 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb703 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj703++ - if yyhl703 { - yyb703 = yyj703 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb703 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb703 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj703++ - if yyhl703 { - yyb703 = yyj703 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb703 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb703 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj703-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9537,73 +11442,82 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym707 := z.EncBinary() - _ = yym707 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep708 := !z.EncBinary() - yy2arr708 := z.EncBasicHandle().StructToArray - var yyq708 [8]bool - _, _, _ = yysep708, yyq708, yy2arr708 - const yyr708 bool = false - yyq708[2] = x.FSType != "" - yyq708[7] = x.ReadOnly != false - if yyr708 || yy2arr708 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.FSType != "" + yyq2[7] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - var yynn708 int = 6 - for _, b := range yyq708 { + yynn2 = 6 + for _, b := range yyq2 { if b { - yynn708++ + yynn2++ } } - r.EncodeMapStart(yynn708) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr708 || yy2arr708 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.CephMonitors == nil { r.EncodeNil() } else { - yym710 := z.EncBinary() - _ = yym710 + yym4 := z.EncBinary() + _ = yym4 if false { } else { z.F.EncSliceStringV(x.CephMonitors, false, e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("monitors")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CephMonitors == nil { r.EncodeNil() } else { - yym711 := z.EncBinary() - _ = yym711 + yym5 := z.EncBinary() + _ = yym5 if false { } else { z.F.EncSliceStringV(x.CephMonitors, false, e) } } } - if yyr708 || yy2arr708 { - yym713 := z.EncBinary() - _ = yym713 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RBDImage)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("image")) - yym714 := z.EncBinary() - _ = yym714 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RBDImage)) } } - if yyr708 || yy2arr708 { - if yyq708[2] { - yym716 := z.EncBinary() - _ = yym716 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) @@ -9612,82 +11526,97 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq708[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym717 := z.EncBinary() - _ = yym717 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) } } } - if yyr708 || yy2arr708 { - yym719 := z.EncBinary() - _ = yym719 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("pool")) - yym720 := z.EncBinary() - _ = yym720 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) } } - if yyr708 || yy2arr708 { - yym722 := z.EncBinary() - _ = yym722 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("user")) - yym723 := z.EncBinary() - _ = yym723 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) } } - if yyr708 || yy2arr708 { - yym725 := z.EncBinary() - _ = yym725 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("keyring")) - yym726 := z.EncBinary() - _ = yym726 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) } } - if yyr708 || yy2arr708 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.SecretRef == nil { r.EncodeNil() } else { x.SecretRef.CodecEncodeSelf(e) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secretRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SecretRef == nil { r.EncodeNil() } else { x.SecretRef.CodecEncodeSelf(e) } } - if yyr708 || yy2arr708 { - if yyq708[7] { - yym729 := z.EncBinary() - _ = yym729 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym25 := z.EncBinary() + _ = yym25 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -9696,18 +11625,22 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq708[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym730 := z.EncBinary() - _ = yym730 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep708 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9717,24 +11650,25 @@ func (x *RBDVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym731 := z.DecBinary() - _ = yym731 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl732 := r.ReadMapStart() - if yyl732 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl732, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl732 := r.ReadArrayStart() - if yyl732 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl732, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9746,12 +11680,12 @@ func (x *RBDVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys733Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys733Slc - var yyhl733 bool = l >= 0 - for yyj733 := 0; ; yyj733++ { - if yyhl733 { - if yyj733 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9759,19 +11693,21 @@ func (x *RBDVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys733Slc = r.DecodeBytes(yys733Slc, true, true) - yys733 := string(yys733Slc) - switch yys733 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "monitors": if r.TryDecodeAsNil() { x.CephMonitors = nil } else { - yyv734 := &x.CephMonitors - yym735 := z.DecBinary() - _ = yym735 + yyv4 := &x.CephMonitors + yym5 := z.DecBinary() + _ = yym5 if false { } else { - z.F.DecSliceStringX(yyv734, false, d) + z.F.DecSliceStringX(yyv4, false, d) } } case "image": @@ -9822,127 +11758,132 @@ func (x *RBDVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys733) - } // end switch yys733 - } // end for yyj733 - if !yyhl733 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *RBDVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj743 int - var yyb743 bool - var yyhl743 bool = l >= 0 - yyj743++ - if yyhl743 { - yyb743 = yyj743 > l + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb743 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb743 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.CephMonitors = nil } else { - yyv744 := &x.CephMonitors - yym745 := z.DecBinary() - _ = yym745 + yyv14 := &x.CephMonitors + yym15 := z.DecBinary() + _ = yym15 if false { } else { - z.F.DecSliceStringX(yyv744, false, d) + z.F.DecSliceStringX(yyv14, false, d) } } - yyj743++ - if yyhl743 { - yyb743 = yyj743 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb743 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb743 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RBDImage = "" } else { x.RBDImage = string(r.DecodeString()) } - yyj743++ - if yyhl743 { - yyb743 = yyj743 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb743 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb743 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj743++ - if yyhl743 { - yyb743 = yyj743 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb743 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb743 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RBDPool = "" } else { x.RBDPool = string(r.DecodeString()) } - yyj743++ - if yyhl743 { - yyb743 = yyj743 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb743 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb743 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RadosUser = "" } else { x.RadosUser = string(r.DecodeString()) } - yyj743++ - if yyhl743 { - yyb743 = yyj743 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb743 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb743 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Keyring = "" } else { x.Keyring = string(r.DecodeString()) } - yyj743++ - if yyhl743 { - yyb743 = yyj743 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb743 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb743 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SecretRef != nil { x.SecretRef = nil @@ -9953,34 +11894,36 @@ func (x *RBDVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) } x.SecretRef.CodecDecodeSelf(d) } - yyj743++ - if yyhl743 { - yyb743 = yyj743 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb743 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb743 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj743++ - if yyhl743 { - yyb743 = yyj743 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb743 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb743 { + if yyb13 { break } - z.DecStructFieldNotFound(yyj743-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *CinderVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9990,49 +11933,55 @@ func (x *CinderVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym753 := z.EncBinary() - _ = yym753 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep754 := !z.EncBinary() - yy2arr754 := z.EncBasicHandle().StructToArray - var yyq754 [3]bool - _, _, _ = yysep754, yyq754, yy2arr754 - const yyr754 bool = false - yyq754[1] = x.FSType != "" - yyq754[2] = x.ReadOnly != false - if yyr754 || yy2arr754 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.FSType != "" + yyq2[2] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn754 int = 1 - for _, b := range yyq754 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn754++ + yynn2++ } } - r.EncodeMapStart(yynn754) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr754 || yy2arr754 { - yym756 := z.EncBinary() - _ = yym756 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeID")) - yym757 := z.EncBinary() - _ = yym757 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeID)) } } - if yyr754 || yy2arr754 { - if yyq754[1] { - yym759 := z.EncBinary() - _ = yym759 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) @@ -10041,20 +11990,23 @@ func (x *CinderVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq754[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym760 := z.EncBinary() - _ = yym760 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) } } } - if yyr754 || yy2arr754 { - if yyq754[2] { - yym762 := z.EncBinary() - _ = yym762 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -10063,18 +12015,22 @@ func (x *CinderVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq754[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym763 := z.EncBinary() - _ = yym763 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep754 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10084,24 +12040,25 @@ func (x *CinderVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym764 := z.DecBinary() - _ = yym764 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl765 := r.ReadMapStart() - if yyl765 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl765, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl765 := r.ReadArrayStart() - if yyl765 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl765, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10113,12 +12070,12 @@ func (x *CinderVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys766Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys766Slc - var yyhl766 bool = l >= 0 - for yyj766 := 0; ; yyj766++ { - if yyhl766 { - if yyj766 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10126,9 +12083,11 @@ func (x *CinderVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys766Slc = r.DecodeBytes(yys766Slc, true, true) - yys766 := string(yys766Slc) - switch yys766 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "volumeID": if r.TryDecodeAsNil() { x.VolumeID = "" @@ -10148,79 +12107,81 @@ func (x *CinderVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys766) - } // end switch yys766 - } // end for yyj766 - if !yyhl766 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *CinderVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj770 int - var yyb770 bool - var yyhl770 bool = l >= 0 - yyj770++ - if yyhl770 { - yyb770 = yyj770 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb770 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb770 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.VolumeID = "" } else { x.VolumeID = string(r.DecodeString()) } - yyj770++ - if yyhl770 { - yyb770 = yyj770 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb770 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb770 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj770++ - if yyhl770 { - yyb770 = yyj770 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb770 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb770 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj770++ - if yyhl770 { - yyb770 = yyj770 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb770 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb770 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj770-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10230,59 +12191,91 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym774 := z.EncBinary() - _ = yym774 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep775 := !z.EncBinary() - yy2arr775 := z.EncBasicHandle().StructToArray - var yyq775 [5]bool - _, _, _ = yysep775, yyq775, yy2arr775 - const yyr775 bool = false - yyq775[1] = x.User != "" - yyq775[2] = x.SecretFile != "" - yyq775[3] = x.SecretRef != nil - yyq775[4] = x.ReadOnly != false - if yyr775 || yy2arr775 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Path != "" + yyq2[2] = x.User != "" + yyq2[3] = x.SecretFile != "" + yyq2[4] = x.SecretRef != nil + yyq2[5] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(6) } else { - var yynn775 int = 1 - for _, b := range yyq775 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn775++ + yynn2++ } } - r.EncodeMapStart(yynn775) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr775 || yy2arr775 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Monitors == nil { r.EncodeNil() } else { - yym777 := z.EncBinary() - _ = yym777 + yym4 := z.EncBinary() + _ = yym4 if false { } else { z.F.EncSliceStringV(x.Monitors, false, e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("monitors")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Monitors == nil { r.EncodeNil() } else { - yym778 := z.EncBinary() - _ = yym778 + yym5 := z.EncBinary() + _ = yym5 if false { } else { z.F.EncSliceStringV(x.Monitors, false, e) } } } - if yyr775 || yy2arr775 { - if yyq775[1] { - yym780 := z.EncBinary() - _ = yym780 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("path")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.User)) @@ -10291,20 +12284,23 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq775[1] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("user")) - yym781 := z.EncBinary() - _ = yym781 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.User)) } } } - if yyr775 || yy2arr775 { - if yyq775[2] { - yym783 := z.EncBinary() - _ = yym783 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SecretFile)) @@ -10313,18 +12309,21 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq775[2] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secretFile")) - yym784 := z.EncBinary() - _ = yym784 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SecretFile)) } } } - if yyr775 || yy2arr775 { - if yyq775[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.SecretRef == nil { r.EncodeNil() } else { @@ -10334,8 +12333,10 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq775[3] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secretRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SecretRef == nil { r.EncodeNil() } else { @@ -10343,10 +12344,11 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr775 || yy2arr775 { - if yyq775[4] { - yym787 := z.EncBinary() - _ = yym787 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -10355,18 +12357,22 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq775[4] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym788 := z.EncBinary() - _ = yym788 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep775 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10376,24 +12382,25 @@ func (x *CephFSVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym789 := z.DecBinary() - _ = yym789 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl790 := r.ReadMapStart() - if yyl790 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl790, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl790 := r.ReadArrayStart() - if yyl790 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl790, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10405,12 +12412,12 @@ func (x *CephFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys791Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys791Slc - var yyhl791 bool = l >= 0 - for yyj791 := 0; ; yyj791++ { - if yyhl791 { - if yyj791 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10418,21 +12425,29 @@ func (x *CephFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys791Slc = r.DecodeBytes(yys791Slc, true, true) - yys791 := string(yys791Slc) - switch yys791 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "monitors": if r.TryDecodeAsNil() { x.Monitors = nil } else { - yyv792 := &x.Monitors - yym793 := z.DecBinary() - _ = yym793 + yyv4 := &x.Monitors + yym5 := z.DecBinary() + _ = yym5 if false { } else { - z.F.DecSliceStringX(yyv792, false, d) + z.F.DecSliceStringX(yyv4, false, d) } } + case "path": + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } case "user": if r.TryDecodeAsNil() { x.User = "" @@ -10463,82 +12478,100 @@ func (x *CephFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys791) - } // end switch yys791 - } // end for yyj791 - if !yyhl791 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *CephFSVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj798 int - var yyb798 bool - var yyhl798 bool = l >= 0 - yyj798++ - if yyhl798 { - yyb798 = yyj798 > l + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb798 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb798 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Monitors = nil } else { - yyv799 := &x.Monitors - yym800 := z.DecBinary() - _ = yym800 + yyv12 := &x.Monitors + yym13 := z.DecBinary() + _ = yym13 if false { } else { - z.F.DecSliceStringX(yyv799, false, d) + z.F.DecSliceStringX(yyv12, false, d) } } - yyj798++ - if yyhl798 { - yyb798 = yyj798 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb798 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb798 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.User = "" } else { x.User = string(r.DecodeString()) } - yyj798++ - if yyhl798 { - yyb798 = yyj798 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb798 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb798 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SecretFile = "" } else { x.SecretFile = string(r.DecodeString()) } - yyj798++ - if yyhl798 { - yyb798 = yyj798 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb798 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb798 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SecretRef != nil { x.SecretRef = nil @@ -10549,34 +12582,36 @@ func (x *CephFSVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decode } x.SecretRef.CodecDecodeSelf(d) } - yyj798++ - if yyhl798 { - yyb798 = yyj798 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb798 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb798 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj798++ - if yyhl798 { - yyb798 = yyj798 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb798 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb798 { + if yyb11 { break } - z.DecStructFieldNotFound(yyj798-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *FlockerVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10586,45 +12621,52 @@ func (x *FlockerVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym805 := z.EncBinary() - _ = yym805 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep806 := !z.EncBinary() - yy2arr806 := z.EncBasicHandle().StructToArray - var yyq806 [1]bool - _, _, _ = yysep806, yyq806, yy2arr806 - const yyr806 bool = false - if yyr806 || yy2arr806 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn806 int = 1 - for _, b := range yyq806 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn806++ + yynn2++ } } - r.EncodeMapStart(yynn806) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr806 || yy2arr806 { - yym808 := z.EncBinary() - _ = yym808 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.DatasetName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("datasetName")) - yym809 := z.EncBinary() - _ = yym809 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.DatasetName)) } } - if yysep806 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10634,24 +12676,25 @@ func (x *FlockerVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym810 := z.DecBinary() - _ = yym810 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl811 := r.ReadMapStart() - if yyl811 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl811, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl811 := r.ReadArrayStart() - if yyl811 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl811, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10663,12 +12706,12 @@ func (x *FlockerVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys812Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys812Slc - var yyhl812 bool = l >= 0 - for yyj812 := 0; ; yyj812++ { - if yyhl812 { - if yyj812 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10676,9 +12719,11 @@ func (x *FlockerVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys812Slc = r.DecodeBytes(yys812Slc, true, true) - yys812 := string(yys812Slc) - switch yys812 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "datasetName": if r.TryDecodeAsNil() { x.DatasetName = "" @@ -10686,49 +12731,49 @@ func (x *FlockerVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder x.DatasetName = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys812) - } // end switch yys812 - } // end for yyj812 - if !yyhl812 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *FlockerVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj814 int - var yyb814 bool - var yyhl814 bool = l >= 0 - yyj814++ - if yyhl814 { - yyb814 = yyj814 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb814 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb814 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DatasetName = "" } else { x.DatasetName = string(r.DecodeString()) } for { - yyj814++ - if yyhl814 { - yyb814 = yyj814 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb814 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb814 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj814-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DownwardAPIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10738,35 +12783,38 @@ func (x *DownwardAPIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym816 := z.EncBinary() - _ = yym816 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep817 := !z.EncBinary() - yy2arr817 := z.EncBasicHandle().StructToArray - var yyq817 [1]bool - _, _, _ = yysep817, yyq817, yy2arr817 - const yyr817 bool = false - yyq817[0] = len(x.Items) != 0 - if yyr817 || yy2arr817 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Items) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn817 int = 0 - for _, b := range yyq817 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn817++ + yynn2++ } } - r.EncodeMapStart(yynn817) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr817 || yy2arr817 { - if yyq817[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Items == nil { r.EncodeNil() } else { - yym819 := z.EncBinary() - _ = yym819 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceDownwardAPIVolumeFile(([]DownwardAPIVolumeFile)(x.Items), e) @@ -10776,13 +12824,15 @@ func (x *DownwardAPIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq817[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym820 := z.EncBinary() - _ = yym820 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceDownwardAPIVolumeFile(([]DownwardAPIVolumeFile)(x.Items), e) @@ -10790,8 +12840,10 @@ func (x *DownwardAPIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep817 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10801,24 +12853,25 @@ func (x *DownwardAPIVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym821 := z.DecBinary() - _ = yym821 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl822 := r.ReadMapStart() - if yyl822 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl822, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl822 := r.ReadArrayStart() - if yyl822 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl822, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10830,12 +12883,12 @@ func (x *DownwardAPIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Dec var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys823Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys823Slc - var yyhl823 bool = l >= 0 - for yyj823 := 0; ; yyj823++ { - if yyhl823 { - if yyj823 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10843,71 +12896,73 @@ func (x *DownwardAPIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Dec break } } - yys823Slc = r.DecodeBytes(yys823Slc, true, true) - yys823 := string(yys823Slc) - switch yys823 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "items": if r.TryDecodeAsNil() { x.Items = nil } else { - yyv824 := &x.Items - yym825 := z.DecBinary() - _ = yym825 + yyv4 := &x.Items + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceDownwardAPIVolumeFile((*[]DownwardAPIVolumeFile)(yyv824), d) + h.decSliceDownwardAPIVolumeFile((*[]DownwardAPIVolumeFile)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys823) - } // end switch yys823 - } // end for yyj823 - if !yyhl823 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DownwardAPIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj826 int - var yyb826 bool - var yyhl826 bool = l >= 0 - yyj826++ - if yyhl826 { - yyb826 = yyj826 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb826 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb826 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Items = nil } else { - yyv827 := &x.Items - yym828 := z.DecBinary() - _ = yym828 + yyv7 := &x.Items + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceDownwardAPIVolumeFile((*[]DownwardAPIVolumeFile)(yyv827), d) + h.decSliceDownwardAPIVolumeFile((*[]DownwardAPIVolumeFile)(yyv7), d) } } for { - yyj826++ - if yyhl826 { - yyb826 = yyj826 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb826 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb826 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj826-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DownwardAPIVolumeFile) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10917,53 +12972,63 @@ func (x *DownwardAPIVolumeFile) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym829 := z.EncBinary() - _ = yym829 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep830 := !z.EncBinary() - yy2arr830 := z.EncBasicHandle().StructToArray - var yyq830 [2]bool - _, _, _ = yysep830, yyq830, yy2arr830 - const yyr830 bool = false - if yyr830 || yy2arr830 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn830 int = 2 - for _, b := range yyq830 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn830++ + yynn2++ } } - r.EncodeMapStart(yynn830) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr830 || yy2arr830 { - yym832 := z.EncBinary() - _ = yym832 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym833 := z.EncBinary() - _ = yym833 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } - if yyr830 || yy2arr830 { - yy835 := &x.FieldRef - yy835.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.FieldRef + yy7.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fieldRef")) - yy836 := &x.FieldRef - yy836.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.FieldRef + yy9.CodecEncodeSelf(e) } - if yysep830 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10973,24 +13038,25 @@ func (x *DownwardAPIVolumeFile) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym837 := z.DecBinary() - _ = yym837 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl838 := r.ReadMapStart() - if yyl838 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl838, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl838 := r.ReadArrayStart() - if yyl838 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl838, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11002,12 +13068,12 @@ func (x *DownwardAPIVolumeFile) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys839Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys839Slc - var yyhl839 bool = l >= 0 - for yyj839 := 0; ; yyj839++ { - if yyhl839 { - if yyj839 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11015,9 +13081,11 @@ func (x *DownwardAPIVolumeFile) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys839Slc = r.DecodeBytes(yys839Slc, true, true) - yys839 := string(yys839Slc) - switch yys839 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "path": if r.TryDecodeAsNil() { x.Path = "" @@ -11028,69 +13096,754 @@ func (x *DownwardAPIVolumeFile) codecDecodeSelfFromMap(l int, d *codec1978.Decod if r.TryDecodeAsNil() { x.FieldRef = ObjectFieldSelector{} } else { - yyv841 := &x.FieldRef - yyv841.CodecDecodeSelf(d) + yyv5 := &x.FieldRef + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys839) - } // end switch yys839 - } // end for yyj839 - if !yyhl839 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DownwardAPIVolumeFile) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj842 int - var yyb842 bool - var yyhl842 bool = l >= 0 - yyj842++ - if yyhl842 { - yyb842 = yyj842 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb842 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb842 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj842++ - if yyhl842 { - yyb842 = yyj842 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb842 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb842 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FieldRef = ObjectFieldSelector{} } else { - yyv844 := &x.FieldRef - yyv844.CodecDecodeSelf(d) + yyv8 := &x.FieldRef + yyv8.CodecDecodeSelf(d) } for { - yyj842++ - if yyhl842 { - yyb842 = yyj842 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb842 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb842 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj842-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *AzureFileVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ShareName)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("shareName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ShareName)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.ReadOnly)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("readOnly")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.ReadOnly)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *AzureFileVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *AzureFileVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "secretName": + if r.TryDecodeAsNil() { + x.SecretName = "" + } else { + x.SecretName = string(r.DecodeString()) + } + case "shareName": + if r.TryDecodeAsNil() { + x.ShareName = "" + } else { + x.ShareName = string(r.DecodeString()) + } + case "readOnly": + if r.TryDecodeAsNil() { + x.ReadOnly = false + } else { + x.ReadOnly = bool(r.DecodeBool()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *AzureFileVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SecretName = "" + } else { + x.SecretName = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ShareName = "" + } else { + x.ShareName = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ReadOnly = false + } else { + x.ReadOnly = bool(r.DecodeBool()) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ConfigMapVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Items) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.Items == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceKeyToPath(([]KeyToPath)(x.Items), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceKeyToPath(([]KeyToPath)(x.Items), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ConfigMapVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ConfigMapVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv4 := &x.Items + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceKeyToPath((*[]KeyToPath)(yyv4), d) + } + } + case "Name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ConfigMapVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv8 := &x.Items + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + h.decSliceKeyToPath((*[]KeyToPath)(yyv8), d) + } + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *KeyToPath) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("key")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("path")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *KeyToPath) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *KeyToPath) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + case "path": + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *KeyToPath) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11100,35 +13853,38 @@ func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym845 := z.EncBinary() - _ = yym845 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep846 := !z.EncBinary() - yy2arr846 := z.EncBasicHandle().StructToArray - var yyq846 [5]bool - _, _, _ = yysep846, yyq846, yy2arr846 - const yyr846 bool = false - yyq846[0] = x.Name != "" - yyq846[1] = x.HostPort != 0 - yyq846[3] = x.Protocol != "" - yyq846[4] = x.HostIP != "" - if yyr846 || yy2arr846 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Name != "" + yyq2[1] = x.HostPort != 0 + yyq2[3] = x.Protocol != "" + yyq2[4] = x.HostIP != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn846 int = 1 - for _, b := range yyq846 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn846++ + yynn2++ } } - r.EncodeMapStart(yynn846) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr846 || yy2arr846 { - if yyq846[0] { - yym848 := z.EncBinary() - _ = yym848 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -11137,20 +13893,23 @@ func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq846[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym849 := z.EncBinary() - _ = yym849 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr846 || yy2arr846 { - if yyq846[1] { - yym851 := z.EncBinary() - _ = yym851 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.HostPort)) @@ -11159,48 +13918,57 @@ func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq846[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPort")) - yym852 := z.EncBinary() - _ = yym852 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.HostPort)) } } } - if yyr846 || yy2arr846 { - yym854 := z.EncBinary() - _ = yym854 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.ContainerPort)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerPort")) - yym855 := z.EncBinary() - _ = yym855 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.ContainerPort)) } } - if yyr846 || yy2arr846 { - if yyq846[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { x.Protocol.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq846[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("protocol")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Protocol.CodecEncodeSelf(e) } } - if yyr846 || yy2arr846 { - if yyq846[4] { - yym858 := z.EncBinary() - _ = yym858 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.HostIP)) @@ -11209,18 +13977,22 @@ func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq846[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostIP")) - yym859 := z.EncBinary() - _ = yym859 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.HostIP)) } } } - if yysep846 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11230,24 +14002,25 @@ func (x *ContainerPort) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym860 := z.DecBinary() - _ = yym860 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl861 := r.ReadMapStart() - if yyl861 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl861, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl861 := r.ReadArrayStart() - if yyl861 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl861, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11259,12 +14032,12 @@ func (x *ContainerPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys862Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys862Slc - var yyhl862 bool = l >= 0 - for yyj862 := 0; ; yyj862++ { - if yyhl862 { - if yyj862 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11272,9 +14045,11 @@ func (x *ContainerPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys862Slc = r.DecodeBytes(yys862Slc, true, true) - yys862 := string(yys862Slc) - switch yys862 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -11306,109 +14081,113 @@ func (x *ContainerPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.HostIP = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys862) - } // end switch yys862 - } // end for yyj862 - if !yyhl862 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerPort) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj868 int - var yyb868 bool - var yyhl868 bool = l >= 0 - yyj868++ - if yyhl868 { - yyb868 = yyj868 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb868 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb868 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj868++ - if yyhl868 { - yyb868 = yyj868 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb868 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb868 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostPort = 0 } else { x.HostPort = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj868++ - if yyhl868 { - yyb868 = yyj868 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb868 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb868 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerPort = 0 } else { x.ContainerPort = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj868++ - if yyhl868 { - yyb868 = yyj868 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb868 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb868 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Protocol = "" } else { x.Protocol = Protocol(r.DecodeString()) } - yyj868++ - if yyhl868 { - yyb868 = yyj868 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb868 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb868 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostIP = "" } else { x.HostIP = string(r.DecodeString()) } for { - yyj868++ - if yyhl868 { - yyb868 = yyj868 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb868 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb868 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj868-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *VolumeMount) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11418,48 +14197,54 @@ func (x *VolumeMount) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym874 := z.EncBinary() - _ = yym874 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep875 := !z.EncBinary() - yy2arr875 := z.EncBasicHandle().StructToArray - var yyq875 [3]bool - _, _, _ = yysep875, yyq875, yy2arr875 - const yyr875 bool = false - yyq875[1] = x.ReadOnly != false - if yyr875 || yy2arr875 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn875 int = 2 - for _, b := range yyq875 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn875++ + yynn2++ } } - r.EncodeMapStart(yynn875) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr875 || yy2arr875 { - yym877 := z.EncBinary() - _ = yym877 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym878 := z.EncBinary() - _ = yym878 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr875 || yy2arr875 { - if yyq875[1] { - yym880 := z.EncBinary() - _ = yym880 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -11468,34 +14253,41 @@ func (x *VolumeMount) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq875[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym881 := z.EncBinary() - _ = yym881 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yyr875 || yy2arr875 { - yym883 := z.EncBinary() - _ = yym883 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.MountPath)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("mountPath")) - yym884 := z.EncBinary() - _ = yym884 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.MountPath)) } } - if yysep875 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11505,24 +14297,25 @@ func (x *VolumeMount) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym885 := z.DecBinary() - _ = yym885 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl886 := r.ReadMapStart() - if yyl886 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl886, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl886 := r.ReadArrayStart() - if yyl886 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl886, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11534,12 +14327,12 @@ func (x *VolumeMount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys887Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys887Slc - var yyhl887 bool = l >= 0 - for yyj887 := 0; ; yyj887++ { - if yyhl887 { - if yyj887 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11547,9 +14340,11 @@ func (x *VolumeMount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys887Slc = r.DecodeBytes(yys887Slc, true, true) - yys887 := string(yys887Slc) - switch yys887 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -11569,79 +14364,81 @@ func (x *VolumeMount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.MountPath = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys887) - } // end switch yys887 - } // end for yyj887 - if !yyhl887 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *VolumeMount) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj891 int - var yyb891 bool - var yyhl891 bool = l >= 0 - yyj891++ - if yyhl891 { - yyb891 = yyj891 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb891 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb891 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj891++ - if yyhl891 { - yyb891 = yyj891 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb891 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb891 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } - yyj891++ - if yyhl891 { - yyb891 = yyj891 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb891 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb891 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MountPath = "" } else { x.MountPath = string(r.DecodeString()) } for { - yyj891++ - if yyhl891 { - yyb891 = yyj891 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb891 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb891 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj891-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11651,49 +14448,55 @@ func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym895 := z.EncBinary() - _ = yym895 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep896 := !z.EncBinary() - yy2arr896 := z.EncBasicHandle().StructToArray - var yyq896 [3]bool - _, _, _ = yysep896, yyq896, yy2arr896 - const yyr896 bool = false - yyq896[1] = x.Value != "" - yyq896[2] = x.ValueFrom != nil - if yyr896 || yy2arr896 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Value != "" + yyq2[2] = x.ValueFrom != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn896 int = 1 - for _, b := range yyq896 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn896++ + yynn2++ } } - r.EncodeMapStart(yynn896) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr896 || yy2arr896 { - yym898 := z.EncBinary() - _ = yym898 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym899 := z.EncBinary() - _ = yym899 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr896 || yy2arr896 { - if yyq896[1] { - yym901 := z.EncBinary() - _ = yym901 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Value)) @@ -11702,18 +14505,21 @@ func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq896[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("value")) - yym902 := z.EncBinary() - _ = yym902 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Value)) } } } - if yyr896 || yy2arr896 { - if yyq896[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.ValueFrom == nil { r.EncodeNil() } else { @@ -11723,8 +14529,10 @@ func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq896[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("valueFrom")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ValueFrom == nil { r.EncodeNil() } else { @@ -11732,8 +14540,10 @@ func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep896 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11743,24 +14553,25 @@ func (x *EnvVar) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym904 := z.DecBinary() - _ = yym904 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl905 := r.ReadMapStart() - if yyl905 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl905, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl905 := r.ReadArrayStart() - if yyl905 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl905, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11772,12 +14583,12 @@ func (x *EnvVar) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys906Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys906Slc - var yyhl906 bool = l >= 0 - for yyj906 := 0; ; yyj906++ { - if yyhl906 { - if yyj906 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11785,9 +14596,11 @@ func (x *EnvVar) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys906Slc = r.DecodeBytes(yys906Slc, true, true) - yys906 := string(yys906Slc) - switch yys906 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -11812,61 +14625,62 @@ func (x *EnvVar) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ValueFrom.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys906) - } // end switch yys906 - } // end for yyj906 - if !yyhl906 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EnvVar) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj910 int - var yyb910 bool - var yyhl910 bool = l >= 0 - yyj910++ - if yyhl910 { - yyb910 = yyj910 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb910 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb910 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj910++ - if yyhl910 { - yyb910 = yyj910 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb910 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb910 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Value = "" } else { x.Value = string(r.DecodeString()) } - yyj910++ - if yyhl910 { - yyb910 = yyj910 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb910 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb910 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ValueFrom != nil { x.ValueFrom = nil @@ -11878,18 +14692,19 @@ func (x *EnvVar) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.ValueFrom.CodecDecodeSelf(d) } for { - yyj910++ - if yyhl910 { - yyb910 = yyj910 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb910 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb910 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj910-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EnvVarSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11899,43 +14714,105 @@ func (x *EnvVarSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym914 := z.EncBinary() - _ = yym914 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep915 := !z.EncBinary() - yy2arr915 := z.EncBasicHandle().StructToArray - var yyq915 [1]bool - _, _, _ = yysep915, yyq915, yy2arr915 - const yyr915 bool = false - if yyr915 || yy2arr915 { - r.EncodeArrayStart(1) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.FieldRef != nil + yyq2[1] = x.ConfigMapKeyRef != nil + yyq2[2] = x.SecretKeyRef != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) } else { - var yynn915 int = 1 - for _, b := range yyq915 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn915++ + yynn2++ } } - r.EncodeMapStart(yynn915) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr915 || yy2arr915 { - if x.FieldRef == nil { - r.EncodeNil() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.FieldRef == nil { + r.EncodeNil() + } else { + x.FieldRef.CodecEncodeSelf(e) + } } else { - x.FieldRef.CodecEncodeSelf(e) + r.EncodeNil() } } else { - r.EncodeString(codecSelferC_UTF81234, string("fieldRef")) - if x.FieldRef == nil { - r.EncodeNil() - } else { - x.FieldRef.CodecEncodeSelf(e) + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fieldRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.FieldRef == nil { + r.EncodeNil() + } else { + x.FieldRef.CodecEncodeSelf(e) + } } } - if yysep915 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.ConfigMapKeyRef == nil { + r.EncodeNil() + } else { + x.ConfigMapKeyRef.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("configMapKeyRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ConfigMapKeyRef == nil { + r.EncodeNil() + } else { + x.ConfigMapKeyRef.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.SecretKeyRef == nil { + r.EncodeNil() + } else { + x.SecretKeyRef.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretKeyRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SecretKeyRef == nil { + r.EncodeNil() + } else { + x.SecretKeyRef.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11945,24 +14822,25 @@ func (x *EnvVarSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym917 := z.DecBinary() - _ = yym917 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl918 := r.ReadMapStart() - if yyl918 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl918, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl918 := r.ReadArrayStart() - if yyl918 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl918, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11974,12 +14852,12 @@ func (x *EnvVarSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys919Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys919Slc - var yyhl919 bool = l >= 0 - for yyj919 := 0; ; yyj919++ { - if yyhl919 { - if yyj919 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11987,9 +14865,11 @@ func (x *EnvVarSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys919Slc = r.DecodeBytes(yys919Slc, true, true) - yys919 := string(yys919Slc) - switch yys919 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "fieldRef": if r.TryDecodeAsNil() { if x.FieldRef != nil { @@ -12001,32 +14881,53 @@ func (x *EnvVarSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.FieldRef.CodecDecodeSelf(d) } + case "configMapKeyRef": + if r.TryDecodeAsNil() { + if x.ConfigMapKeyRef != nil { + x.ConfigMapKeyRef = nil + } + } else { + if x.ConfigMapKeyRef == nil { + x.ConfigMapKeyRef = new(ConfigMapKeySelector) + } + x.ConfigMapKeyRef.CodecDecodeSelf(d) + } + case "secretKeyRef": + if r.TryDecodeAsNil() { + if x.SecretKeyRef != nil { + x.SecretKeyRef = nil + } + } else { + if x.SecretKeyRef == nil { + x.SecretKeyRef = new(SecretKeySelector) + } + x.SecretKeyRef.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys919) - } // end switch yys919 - } // end for yyj919 - if !yyhl919 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EnvVarSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj921 int - var yyb921 bool - var yyhl921 bool = l >= 0 - yyj921++ - if yyhl921 { - yyb921 = yyj921 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb921 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb921 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.FieldRef != nil { x.FieldRef = nil @@ -12037,19 +14938,62 @@ func (x *EnvVarSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.FieldRef.CodecDecodeSelf(d) } - for { - yyj921++ - if yyhl921 { - yyb921 = yyj921 > l - } else { - yyb921 = r.CheckBreak() + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ConfigMapKeyRef != nil { + x.ConfigMapKeyRef = nil } - if yyb921 { + } else { + if x.ConfigMapKeyRef == nil { + x.ConfigMapKeyRef = new(ConfigMapKeySelector) + } + x.ConfigMapKeyRef.CodecDecodeSelf(d) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SecretKeyRef != nil { + x.SecretKeyRef = nil + } + } else { + if x.SecretKeyRef == nil { + x.SecretKeyRef = new(SecretKeySelector) + } + x.SecretKeyRef.CodecDecodeSelf(d) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { break } - z.DecStructFieldNotFound(yyj921-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ObjectFieldSelector) CodecEncodeSelf(e *codec1978.Encoder) { @@ -12059,61 +15003,71 @@ func (x *ObjectFieldSelector) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym923 := z.EncBinary() - _ = yym923 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep924 := !z.EncBinary() - yy2arr924 := z.EncBasicHandle().StructToArray - var yyq924 [2]bool - _, _, _ = yysep924, yyq924, yy2arr924 - const yyr924 bool = false - if yyr924 || yy2arr924 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn924 int = 2 - for _, b := range yyq924 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn924++ + yynn2++ } } - r.EncodeMapStart(yynn924) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr924 || yy2arr924 { - yym926 := z.EncBinary() - _ = yym926 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym927 := z.EncBinary() - _ = yym927 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) } } - if yyr924 || yy2arr924 { - yym929 := z.EncBinary() - _ = yym929 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldPath)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fieldPath")) - yym930 := z.EncBinary() - _ = yym930 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldPath)) } } - if yysep924 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -12123,24 +15077,25 @@ func (x *ObjectFieldSelector) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym931 := z.DecBinary() - _ = yym931 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl932 := r.ReadMapStart() - if yyl932 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl932, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl932 := r.ReadArrayStart() - if yyl932 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl932, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12152,12 +15107,12 @@ func (x *ObjectFieldSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys933Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys933Slc - var yyhl933 bool = l >= 0 - for yyj933 := 0; ; yyj933++ { - if yyhl933 { - if yyj933 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12165,9 +15120,11 @@ func (x *ObjectFieldSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys933Slc = r.DecodeBytes(yys933Slc, true, true) - yys933 := string(yys933Slc) - switch yys933 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "apiVersion": if r.TryDecodeAsNil() { x.APIVersion = "" @@ -12181,64 +15138,674 @@ func (x *ObjectFieldSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder x.FieldPath = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys933) - } // end switch yys933 - } // end for yyj933 - if !yyhl933 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ObjectFieldSelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj936 int - var yyb936 bool - var yyhl936 bool = l >= 0 - yyj936++ - if yyhl936 { - yyb936 = yyj936 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb936 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb936 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj936++ - if yyhl936 { - yyb936 = yyj936 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb936 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb936 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FieldPath = "" } else { x.FieldPath = string(r.DecodeString()) } for { - yyj936++ - if yyhl936 { - yyb936 = yyj936 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb936 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb936 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj936-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ConfigMapKeySelector) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("key")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ConfigMapKeySelector) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ConfigMapKeySelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + case "Name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ConfigMapKeySelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SecretKeySelector) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("key")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SecretKeySelector) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SecretKeySelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + case "Name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SecretKeySelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *HTTPHeader) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Value)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("value")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Value)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *HTTPHeader) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *HTTPHeader) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + case "value": + if r.TryDecodeAsNil() { + x.Value = "" + } else { + x.Value = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *HTTPHeader) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Value = "" + } else { + x.Value = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HTTPGetAction) CodecEncodeSelf(e *codec1978.Encoder) { @@ -12248,35 +15815,39 @@ func (x *HTTPGetAction) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym939 := z.EncBinary() - _ = yym939 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep940 := !z.EncBinary() - yy2arr940 := z.EncBasicHandle().StructToArray - var yyq940 [4]bool - _, _, _ = yysep940, yyq940, yy2arr940 - const yyr940 bool = false - yyq940[0] = x.Path != "" - yyq940[1] = true - yyq940[2] = x.Host != "" - yyq940[3] = x.Scheme != "" - if yyr940 || yy2arr940 { - r.EncodeArrayStart(4) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Path != "" + yyq2[1] = true + yyq2[2] = x.Host != "" + yyq2[3] = x.Scheme != "" + yyq2[4] = len(x.HTTPHeaders) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) } else { - var yynn940 int = 0 - for _, b := range yyq940 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn940++ + yynn2++ } } - r.EncodeMapStart(yynn940) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr940 || yy2arr940 { - if yyq940[0] { - yym942 := z.EncBinary() - _ = yym942 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) @@ -12285,50 +15856,56 @@ func (x *HTTPGetAction) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq940[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym943 := z.EncBinary() - _ = yym943 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } } - if yyr940 || yy2arr940 { - if yyq940[1] { - yy945 := &x.Port - yym946 := z.EncBinary() - _ = yym946 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy7 := &x.Port + yym8 := z.EncBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.EncExt(yy945) { - } else if !yym946 && z.IsJSONHandle() { - z.EncJSONMarshal(yy945) + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) } else { - z.EncFallback(yy945) + z.EncFallback(yy7) } } else { r.EncodeNil() } } else { - if yyq940[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("port")) - yy947 := &x.Port - yym948 := z.EncBinary() - _ = yym948 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Port + yym10 := z.EncBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.EncExt(yy947) { - } else if !yym948 && z.IsJSONHandle() { - z.EncJSONMarshal(yy947) + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) } else { - z.EncFallback(yy947) + z.EncFallback(yy9) } } } - if yyr940 || yy2arr940 { - if yyq940[2] { - yym950 := z.EncBinary() - _ = yym950 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) @@ -12337,30 +15914,70 @@ func (x *HTTPGetAction) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq940[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("host")) - yym951 := z.EncBinary() - _ = yym951 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) } } } - if yyr940 || yy2arr940 { - if yyq940[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { x.Scheme.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq940[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("scheme")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Scheme.CodecEncodeSelf(e) } } - if yysep940 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.HTTPHeaders == nil { + r.EncodeNil() + } else { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + h.encSliceHTTPHeader(([]HTTPHeader)(x.HTTPHeaders), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("httpHeaders")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.HTTPHeaders == nil { + r.EncodeNil() + } else { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + h.encSliceHTTPHeader(([]HTTPHeader)(x.HTTPHeaders), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -12370,24 +15987,25 @@ func (x *HTTPGetAction) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym953 := z.DecBinary() - _ = yym953 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl954 := r.ReadMapStart() - if yyl954 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl954, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl954 := r.ReadArrayStart() - if yyl954 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl954, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12399,12 +16017,12 @@ func (x *HTTPGetAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys955Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys955Slc - var yyhl955 bool = l >= 0 - for yyj955 := 0; ; yyj955++ { - if yyhl955 { - if yyj955 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12412,9 +16030,11 @@ func (x *HTTPGetAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys955Slc = r.DecodeBytes(yys955Slc, true, true) - yys955 := string(yys955Slc) - switch yys955 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "path": if r.TryDecodeAsNil() { x.Path = "" @@ -12423,17 +16043,17 @@ func (x *HTTPGetAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "port": if r.TryDecodeAsNil() { - x.Port = pkg5_util.IntOrString{} + x.Port = pkg5_intstr.IntOrString{} } else { - yyv957 := &x.Port - yym958 := z.DecBinary() - _ = yym958 + yyv5 := &x.Port + yym6 := z.DecBinary() + _ = yym6 if false { - } else if z.HasExtensions() && z.DecExt(yyv957) { - } else if !yym958 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv957) + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) } else { - z.DecFallback(yyv957, false) + z.DecFallback(yyv5, false) } } case "host": @@ -12448,112 +16068,149 @@ func (x *HTTPGetAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.Scheme = URIScheme(r.DecodeString()) } + case "httpHeaders": + if r.TryDecodeAsNil() { + x.HTTPHeaders = nil + } else { + yyv9 := &x.HTTPHeaders + yym10 := z.DecBinary() + _ = yym10 + if false { + } else { + h.decSliceHTTPHeader((*[]HTTPHeader)(yyv9), d) + } + } default: - z.DecStructFieldNotFound(-1, yys955) - } // end switch yys955 - } // end for yyj955 - if !yyhl955 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HTTPGetAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj961 int - var yyb961 bool - var yyhl961 bool = l >= 0 - yyj961++ - if yyhl961 { - yyb961 = yyj961 > l + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb961 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb961 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj961++ - if yyhl961 { - yyb961 = yyj961 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb961 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb961 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Port = pkg5_util.IntOrString{} + x.Port = pkg5_intstr.IntOrString{} } else { - yyv963 := &x.Port - yym964 := z.DecBinary() - _ = yym964 + yyv13 := &x.Port + yym14 := z.DecBinary() + _ = yym14 if false { - } else if z.HasExtensions() && z.DecExt(yyv963) { - } else if !yym964 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv963) + } else if z.HasExtensions() && z.DecExt(yyv13) { + } else if !yym14 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv13) } else { - z.DecFallback(yyv963, false) + z.DecFallback(yyv13, false) } } - yyj961++ - if yyhl961 { - yyb961 = yyj961 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb961 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb961 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Host = "" } else { x.Host = string(r.DecodeString()) } - yyj961++ - if yyhl961 { - yyb961 = yyj961 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb961 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb961 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Scheme = "" } else { x.Scheme = URIScheme(r.DecodeString()) } - for { - yyj961++ - if yyhl961 { - yyb961 = yyj961 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HTTPHeaders = nil + } else { + yyv17 := &x.HTTPHeaders + yym18 := z.DecBinary() + _ = yym18 + if false { } else { - yyb961 = r.CheckBreak() + h.decSliceHTTPHeader((*[]HTTPHeader)(yyv17), d) } - if yyb961 { + } + for { + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { break } - z.DecStructFieldNotFound(yyj961-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x URIScheme) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym967 := z.EncBinary() - _ = yym967 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -12565,8 +16222,8 @@ func (x *URIScheme) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym968 := z.DecBinary() - _ = yym968 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -12581,60 +16238,67 @@ func (x *TCPSocketAction) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym969 := z.EncBinary() - _ = yym969 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep970 := !z.EncBinary() - yy2arr970 := z.EncBasicHandle().StructToArray - var yyq970 [1]bool - _, _, _ = yysep970, yyq970, yy2arr970 - const yyr970 bool = false - yyq970[0] = true - if yyr970 || yy2arr970 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn970 int = 0 - for _, b := range yyq970 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn970++ + yynn2++ } } - r.EncodeMapStart(yynn970) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr970 || yy2arr970 { - if yyq970[0] { - yy972 := &x.Port - yym973 := z.EncBinary() - _ = yym973 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.Port + yym5 := z.EncBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.EncExt(yy972) { - } else if !yym973 && z.IsJSONHandle() { - z.EncJSONMarshal(yy972) + } else if z.HasExtensions() && z.EncExt(yy4) { + } else if !yym5 && z.IsJSONHandle() { + z.EncJSONMarshal(yy4) } else { - z.EncFallback(yy972) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq970[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("port")) - yy974 := &x.Port - yym975 := z.EncBinary() - _ = yym975 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Port + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy974) { - } else if !yym975 && z.IsJSONHandle() { - z.EncJSONMarshal(yy974) + } else if z.HasExtensions() && z.EncExt(yy6) { + } else if !yym7 && z.IsJSONHandle() { + z.EncJSONMarshal(yy6) } else { - z.EncFallback(yy974) + z.EncFallback(yy6) } } } - if yysep970 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -12644,24 +16308,25 @@ func (x *TCPSocketAction) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym976 := z.DecBinary() - _ = yym976 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl977 := r.ReadMapStart() - if yyl977 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl977, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl977 := r.ReadArrayStart() - if yyl977 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl977, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12673,12 +16338,12 @@ func (x *TCPSocketAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys978Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys978Slc - var yyhl978 bool = l >= 0 - for yyj978 := 0; ; yyj978++ { - if yyhl978 { - if yyj978 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12686,77 +16351,79 @@ func (x *TCPSocketAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys978Slc = r.DecodeBytes(yys978Slc, true, true) - yys978 := string(yys978Slc) - switch yys978 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "port": if r.TryDecodeAsNil() { - x.Port = pkg5_util.IntOrString{} + x.Port = pkg5_intstr.IntOrString{} } else { - yyv979 := &x.Port - yym980 := z.DecBinary() - _ = yym980 + yyv4 := &x.Port + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv979) { - } else if !yym980 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv979) + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else if !yym5 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv4) } else { - z.DecFallback(yyv979, false) + z.DecFallback(yyv4, false) } } default: - z.DecStructFieldNotFound(-1, yys978) - } // end switch yys978 - } // end for yyj978 - if !yyhl978 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *TCPSocketAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj981 int - var yyb981 bool - var yyhl981 bool = l >= 0 - yyj981++ - if yyhl981 { - yyb981 = yyj981 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb981 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb981 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Port = pkg5_util.IntOrString{} + x.Port = pkg5_intstr.IntOrString{} } else { - yyv982 := &x.Port - yym983 := z.DecBinary() - _ = yym983 + yyv7 := &x.Port + yym8 := z.DecBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.DecExt(yyv982) { - } else if !yym983 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv982) + } else if z.HasExtensions() && z.DecExt(yyv7) { + } else if !yym8 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv7) } else { - z.DecFallback(yyv982, false) + z.DecFallback(yyv7, false) } } for { - yyj981++ - if yyhl981 { - yyb981 = yyj981 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb981 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb981 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj981-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ExecAction) CodecEncodeSelf(e *codec1978.Encoder) { @@ -12766,35 +16433,38 @@ func (x *ExecAction) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym984 := z.EncBinary() - _ = yym984 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep985 := !z.EncBinary() - yy2arr985 := z.EncBasicHandle().StructToArray - var yyq985 [1]bool - _, _, _ = yysep985, yyq985, yy2arr985 - const yyr985 bool = false - yyq985[0] = len(x.Command) != 0 - if yyr985 || yy2arr985 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Command) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn985 int = 0 - for _, b := range yyq985 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn985++ + yynn2++ } } - r.EncodeMapStart(yynn985) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr985 || yy2arr985 { - if yyq985[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Command == nil { r.EncodeNil() } else { - yym987 := z.EncBinary() - _ = yym987 + yym4 := z.EncBinary() + _ = yym4 if false { } else { z.F.EncSliceStringV(x.Command, false, e) @@ -12804,13 +16474,15 @@ func (x *ExecAction) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq985[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("command")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Command == nil { r.EncodeNil() } else { - yym988 := z.EncBinary() - _ = yym988 + yym5 := z.EncBinary() + _ = yym5 if false { } else { z.F.EncSliceStringV(x.Command, false, e) @@ -12818,8 +16490,10 @@ func (x *ExecAction) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep985 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -12829,24 +16503,25 @@ func (x *ExecAction) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym989 := z.DecBinary() - _ = yym989 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl990 := r.ReadMapStart() - if yyl990 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl990, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl990 := r.ReadArrayStart() - if yyl990 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl990, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12858,12 +16533,12 @@ func (x *ExecAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys991Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys991Slc - var yyhl991 bool = l >= 0 - for yyj991 := 0; ; yyj991++ { - if yyhl991 { - if yyj991 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12871,71 +16546,73 @@ func (x *ExecAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys991Slc = r.DecodeBytes(yys991Slc, true, true) - yys991 := string(yys991Slc) - switch yys991 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "command": if r.TryDecodeAsNil() { x.Command = nil } else { - yyv992 := &x.Command - yym993 := z.DecBinary() - _ = yym993 + yyv4 := &x.Command + yym5 := z.DecBinary() + _ = yym5 if false { } else { - z.F.DecSliceStringX(yyv992, false, d) + z.F.DecSliceStringX(yyv4, false, d) } } default: - z.DecStructFieldNotFound(-1, yys991) - } // end switch yys991 - } // end for yyj991 - if !yyhl991 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ExecAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj994 int - var yyb994 bool - var yyhl994 bool = l >= 0 - yyj994++ - if yyhl994 { - yyb994 = yyj994 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb994 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb994 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Command = nil } else { - yyv995 := &x.Command - yym996 := z.DecBinary() - _ = yym996 + yyv7 := &x.Command + yym8 := z.DecBinary() + _ = yym8 if false { } else { - z.F.DecSliceStringX(yyv995, false, d) + z.F.DecSliceStringX(yyv7, false, d) } } for { - yyj994++ - if yyhl994 { - yyb994 = yyj994 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb994 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb994 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj994-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Probe) CodecEncodeSelf(e *codec1978.Encoder) { @@ -12945,138 +16622,42 @@ func (x *Probe) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym997 := z.EncBinary() - _ = yym997 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep998 := !z.EncBinary() - yy2arr998 := z.EncBasicHandle().StructToArray - var yyq998 [5]bool - _, _, _ = yysep998, yyq998, yy2arr998 - const yyr998 bool = false - yyq998[0] = x.Handler.Exec != nil && x.Exec != nil - yyq998[1] = x.Handler.HTTPGet != nil && x.HTTPGet != nil - yyq998[2] = x.Handler.TCPSocket != nil && x.TCPSocket != nil - yyq998[3] = x.InitialDelaySeconds != 0 - yyq998[4] = x.TimeoutSeconds != 0 - if yyr998 || yy2arr998 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.InitialDelaySeconds != 0 + yyq2[1] = x.TimeoutSeconds != 0 + yyq2[2] = x.PeriodSeconds != 0 + yyq2[3] = x.SuccessThreshold != 0 + yyq2[4] = x.FailureThreshold != 0 + yyq2[5] = x.Handler.Exec != nil && x.Exec != nil + yyq2[6] = x.Handler.HTTPGet != nil && x.HTTPGet != nil + yyq2[7] = x.Handler.TCPSocket != nil && x.TCPSocket != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(8) } else { - var yynn998 int = 0 - for _, b := range yyq998 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn998++ + yynn2++ } } - r.EncodeMapStart(yynn998) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - var yyn999 bool - if x.Handler.Exec == nil { - yyn999 = true - goto LABEL999 - } - LABEL999: - if yyr998 || yy2arr998 { - if yyn999 { - r.EncodeNil() - } else { - if yyq998[0] { - if x.Exec == nil { - r.EncodeNil() - } else { - x.Exec.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq998[0] { - r.EncodeString(codecSelferC_UTF81234, string("exec")) - if yyn999 { - r.EncodeNil() - } else { - if x.Exec == nil { - r.EncodeNil() - } else { - x.Exec.CodecEncodeSelf(e) - } - } - } - } - var yyn1000 bool - if x.Handler.HTTPGet == nil { - yyn1000 = true - goto LABEL1000 - } - LABEL1000: - if yyr998 || yy2arr998 { - if yyn1000 { - r.EncodeNil() - } else { - if yyq998[1] { - if x.HTTPGet == nil { - r.EncodeNil() - } else { - x.HTTPGet.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq998[1] { - r.EncodeString(codecSelferC_UTF81234, string("httpGet")) - if yyn1000 { - r.EncodeNil() - } else { - if x.HTTPGet == nil { - r.EncodeNil() - } else { - x.HTTPGet.CodecEncodeSelf(e) - } - } - } - } - var yyn1001 bool - if x.Handler.TCPSocket == nil { - yyn1001 = true - goto LABEL1001 - } - LABEL1001: - if yyr998 || yy2arr998 { - if yyn1001 { - r.EncodeNil() - } else { - if yyq998[2] { - if x.TCPSocket == nil { - r.EncodeNil() - } else { - x.TCPSocket.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq998[2] { - r.EncodeString(codecSelferC_UTF81234, string("tcpSocket")) - if yyn1001 { - r.EncodeNil() - } else { - if x.TCPSocket == nil { - r.EncodeNil() - } else { - x.TCPSocket.CodecEncodeSelf(e) - } - } - } - } - if yyr998 || yy2arr998 { - if yyq998[3] { - yym1003 := z.EncBinary() - _ = yym1003 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.InitialDelaySeconds)) @@ -13085,20 +16666,23 @@ func (x *Probe) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq998[3] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("initialDelaySeconds")) - yym1004 := z.EncBinary() - _ = yym1004 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.InitialDelaySeconds)) } } } - if yyr998 || yy2arr998 { - if yyq998[4] { - yym1006 := z.EncBinary() - _ = yym1006 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.TimeoutSeconds)) @@ -13107,18 +16691,208 @@ func (x *Probe) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq998[4] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("timeoutSeconds")) - yym1007 := z.EncBinary() - _ = yym1007 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.TimeoutSeconds)) } } } - if yysep998 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeInt(int64(x.PeriodSeconds)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("periodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeInt(int64(x.PeriodSeconds)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeInt(int64(x.SuccessThreshold)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("successThreshold")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeInt(int64(x.SuccessThreshold)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeInt(int64(x.FailureThreshold)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("failureThreshold")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeInt(int64(x.FailureThreshold)) + } + } + } + var yyn18 bool + if x.Handler.Exec == nil { + yyn18 = true + goto LABEL18 + } + LABEL18: + if yyr2 || yy2arr2 { + if yyn18 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + if x.Exec == nil { + r.EncodeNil() + } else { + x.Exec.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("exec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn18 { + r.EncodeNil() + } else { + if x.Exec == nil { + r.EncodeNil() + } else { + x.Exec.CodecEncodeSelf(e) + } + } + } + } + var yyn21 bool + if x.Handler.HTTPGet == nil { + yyn21 = true + goto LABEL21 + } + LABEL21: + if yyr2 || yy2arr2 { + if yyn21 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + if x.HTTPGet == nil { + r.EncodeNil() + } else { + x.HTTPGet.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("httpGet")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn21 { + r.EncodeNil() + } else { + if x.HTTPGet == nil { + r.EncodeNil() + } else { + x.HTTPGet.CodecEncodeSelf(e) + } + } + } + } + var yyn24 bool + if x.Handler.TCPSocket == nil { + yyn24 = true + goto LABEL24 + } + LABEL24: + if yyr2 || yy2arr2 { + if yyn24 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + if x.TCPSocket == nil { + r.EncodeNil() + } else { + x.TCPSocket.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tcpSocket")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn24 { + r.EncodeNil() + } else { + if x.TCPSocket == nil { + r.EncodeNil() + } else { + x.TCPSocket.CodecEncodeSelf(e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -13128,24 +16902,25 @@ func (x *Probe) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1008 := z.DecBinary() - _ = yym1008 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1009 := r.ReadMapStart() - if yyl1009 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1009, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1009 := r.ReadArrayStart() - if yyl1009 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1009, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -13157,12 +16932,12 @@ func (x *Probe) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1010Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1010Slc - var yyhl1010 bool = l >= 0 - for yyj1010 := 0; ; yyj1010++ { - if yyhl1010 { - if yyj1010 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -13170,9 +16945,41 @@ func (x *Probe) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1010Slc = r.DecodeBytes(yys1010Slc, true, true) - yys1010 := string(yys1010Slc) - switch yys1010 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "initialDelaySeconds": + if r.TryDecodeAsNil() { + x.InitialDelaySeconds = 0 + } else { + x.InitialDelaySeconds = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "timeoutSeconds": + if r.TryDecodeAsNil() { + x.TimeoutSeconds = 0 + } else { + x.TimeoutSeconds = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "periodSeconds": + if r.TryDecodeAsNil() { + x.PeriodSeconds = 0 + } else { + x.PeriodSeconds = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "successThreshold": + if r.TryDecodeAsNil() { + x.SuccessThreshold = 0 + } else { + x.SuccessThreshold = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "failureThreshold": + if r.TryDecodeAsNil() { + x.FailureThreshold = 0 + } else { + x.FailureThreshold = int(r.DecodeInt(codecSelferBitsize1234)) + } case "exec": if x.Handler.Exec == nil { x.Handler.Exec = new(ExecAction) @@ -13215,44 +17022,114 @@ func (x *Probe) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.TCPSocket.CodecDecodeSelf(d) } - case "initialDelaySeconds": - if r.TryDecodeAsNil() { - x.InitialDelaySeconds = 0 - } else { - x.InitialDelaySeconds = int64(r.DecodeInt(64)) - } - case "timeoutSeconds": - if r.TryDecodeAsNil() { - x.TimeoutSeconds = 0 - } else { - x.TimeoutSeconds = int64(r.DecodeInt(64)) - } default: - z.DecStructFieldNotFound(-1, yys1010) - } // end switch yys1010 - } // end for yyj1010 - if !yyhl1010 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Probe) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1016 int - var yyb1016 bool - var yyhl1016 bool = l >= 0 - yyj1016++ - if yyhl1016 { - yyb1016 = yyj1016 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1016 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1016 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.InitialDelaySeconds = 0 + } else { + x.InitialDelaySeconds = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TimeoutSeconds = 0 + } else { + x.TimeoutSeconds = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PeriodSeconds = 0 + } else { + x.PeriodSeconds = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SuccessThreshold = 0 + } else { + x.SuccessThreshold = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.FailureThreshold = 0 + } else { + x.FailureThreshold = int(r.DecodeInt(codecSelferBitsize1234)) + } + if x.Handler.Exec == nil { + x.Handler.Exec = new(ExecAction) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Exec != nil { x.Exec = nil @@ -13263,16 +17140,20 @@ func (x *Probe) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Exec.CodecDecodeSelf(d) } - yyj1016++ - if yyhl1016 { - yyb1016 = yyj1016 > l - } else { - yyb1016 = r.CheckBreak() + if x.Handler.HTTPGet == nil { + x.Handler.HTTPGet = new(HTTPGetAction) } - if yyb1016 { - r.ReadEnd() + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HTTPGet != nil { x.HTTPGet = nil @@ -13283,16 +17164,20 @@ func (x *Probe) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.HTTPGet.CodecDecodeSelf(d) } - yyj1016++ - if yyhl1016 { - yyb1016 = yyj1016 > l - } else { - yyb1016 = r.CheckBreak() + if x.Handler.TCPSocket == nil { + x.Handler.TCPSocket = new(TCPSocketAction) } - if yyb1016 { - r.ReadEnd() + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.TCPSocket != nil { x.TCPSocket = nil @@ -13303,57 +17188,28 @@ func (x *Probe) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.TCPSocket.CodecDecodeSelf(d) } - yyj1016++ - if yyhl1016 { - yyb1016 = yyj1016 > l - } else { - yyb1016 = r.CheckBreak() - } - if yyb1016 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.InitialDelaySeconds = 0 - } else { - x.InitialDelaySeconds = int64(r.DecodeInt(64)) - } - yyj1016++ - if yyhl1016 { - yyb1016 = yyj1016 > l - } else { - yyb1016 = r.CheckBreak() - } - if yyb1016 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.TimeoutSeconds = 0 - } else { - x.TimeoutSeconds = int64(r.DecodeInt(64)) - } for { - yyj1016++ - if yyhl1016 { - yyb1016 = yyj1016 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1016 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1016 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj1016-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x PullPolicy) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1022 := z.EncBinary() - _ = yym1022 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -13365,8 +17221,8 @@ func (x *PullPolicy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1023 := z.DecBinary() - _ = yym1023 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -13378,8 +17234,8 @@ func (x Capability) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1024 := z.EncBinary() - _ = yym1024 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -13391,8 +17247,8 @@ func (x *Capability) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1025 := z.DecBinary() - _ = yym1025 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -13407,36 +17263,39 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1026 := z.EncBinary() - _ = yym1026 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1027 := !z.EncBinary() - yy2arr1027 := z.EncBasicHandle().StructToArray - var yyq1027 [2]bool - _, _, _ = yysep1027, yyq1027, yy2arr1027 - const yyr1027 bool = false - yyq1027[0] = len(x.Add) != 0 - yyq1027[1] = len(x.Drop) != 0 - if yyr1027 || yy2arr1027 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Add) != 0 + yyq2[1] = len(x.Drop) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1027 int = 0 - for _, b := range yyq1027 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1027++ + yynn2++ } } - r.EncodeMapStart(yynn1027) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1027 || yy2arr1027 { - if yyq1027[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Add == nil { r.EncodeNil() } else { - yym1029 := z.EncBinary() - _ = yym1029 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceCapability(([]Capability)(x.Add), e) @@ -13446,13 +17305,15 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1027[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("add")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Add == nil { r.EncodeNil() } else { - yym1030 := z.EncBinary() - _ = yym1030 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceCapability(([]Capability)(x.Add), e) @@ -13460,13 +17321,14 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1027 || yy2arr1027 { - if yyq1027[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Drop == nil { r.EncodeNil() } else { - yym1032 := z.EncBinary() - _ = yym1032 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSliceCapability(([]Capability)(x.Drop), e) @@ -13476,13 +17338,15 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1027[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("drop")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Drop == nil { r.EncodeNil() } else { - yym1033 := z.EncBinary() - _ = yym1033 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSliceCapability(([]Capability)(x.Drop), e) @@ -13490,8 +17354,10 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1027 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -13501,24 +17367,25 @@ func (x *Capabilities) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1034 := z.DecBinary() - _ = yym1034 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1035 := r.ReadMapStart() - if yyl1035 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1035, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1035 := r.ReadArrayStart() - if yyl1035 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1035, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -13530,12 +17397,12 @@ func (x *Capabilities) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1036Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1036Slc - var yyhl1036 bool = l >= 0 - for yyj1036 := 0; ; yyj1036++ { - if yyhl1036 { - if yyj1036 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -13543,104 +17410,107 @@ func (x *Capabilities) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1036Slc = r.DecodeBytes(yys1036Slc, true, true) - yys1036 := string(yys1036Slc) - switch yys1036 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "add": if r.TryDecodeAsNil() { x.Add = nil } else { - yyv1037 := &x.Add - yym1038 := z.DecBinary() - _ = yym1038 + yyv4 := &x.Add + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceCapability((*[]Capability)(yyv1037), d) + h.decSliceCapability((*[]Capability)(yyv4), d) } } case "drop": if r.TryDecodeAsNil() { x.Drop = nil } else { - yyv1039 := &x.Drop - yym1040 := z.DecBinary() - _ = yym1040 + yyv6 := &x.Drop + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceCapability((*[]Capability)(yyv1039), d) + h.decSliceCapability((*[]Capability)(yyv6), d) } } default: - z.DecStructFieldNotFound(-1, yys1036) - } // end switch yys1036 - } // end for yyj1036 - if !yyhl1036 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Capabilities) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1041 int - var yyb1041 bool - var yyhl1041 bool = l >= 0 - yyj1041++ - if yyhl1041 { - yyb1041 = yyj1041 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1041 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1041 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Add = nil } else { - yyv1042 := &x.Add - yym1043 := z.DecBinary() - _ = yym1043 + yyv9 := &x.Add + yym10 := z.DecBinary() + _ = yym10 if false { } else { - h.decSliceCapability((*[]Capability)(yyv1042), d) + h.decSliceCapability((*[]Capability)(yyv9), d) } } - yyj1041++ - if yyhl1041 { - yyb1041 = yyj1041 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1041 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1041 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Drop = nil } else { - yyv1044 := &x.Drop - yym1045 := z.DecBinary() - _ = yym1045 + yyv11 := &x.Drop + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSliceCapability((*[]Capability)(yyv1044), d) + h.decSliceCapability((*[]Capability)(yyv11), d) } } for { - yyj1041++ - if yyhl1041 { - yyb1041 = yyj1041 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1041 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1041 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1041-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { @@ -13650,31 +17520,34 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1046 := z.EncBinary() - _ = yym1046 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1047 := !z.EncBinary() - yy2arr1047 := z.EncBasicHandle().StructToArray - var yyq1047 [2]bool - _, _, _ = yysep1047, yyq1047, yy2arr1047 - const yyr1047 bool = false - yyq1047[0] = len(x.Limits) != 0 - yyq1047[1] = len(x.Requests) != 0 - if yyr1047 || yy2arr1047 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Limits) != 0 + yyq2[1] = len(x.Requests) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1047 int = 0 - for _, b := range yyq1047 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1047++ + yynn2++ } } - r.EncodeMapStart(yynn1047) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1047 || yy2arr1047 { - if yyq1047[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Limits == nil { r.EncodeNil() } else { @@ -13684,8 +17557,10 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1047[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("limits")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Limits == nil { r.EncodeNil() } else { @@ -13693,8 +17568,9 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1047 || yy2arr1047 { - if yyq1047[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Requests == nil { r.EncodeNil() } else { @@ -13704,8 +17580,10 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1047[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("requests")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Requests == nil { r.EncodeNil() } else { @@ -13713,8 +17591,10 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1047 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -13724,24 +17604,25 @@ func (x *ResourceRequirements) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1050 := z.DecBinary() - _ = yym1050 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1051 := r.ReadMapStart() - if yyl1051 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1051, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1051 := r.ReadArrayStart() - if yyl1051 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1051, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -13753,12 +17634,12 @@ func (x *ResourceRequirements) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1052Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1052Slc - var yyhl1052 bool = l >= 0 - for yyj1052 := 0; ; yyj1052++ { - if yyhl1052 { - if yyj1052 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -13766,84 +17647,87 @@ func (x *ResourceRequirements) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys1052Slc = r.DecodeBytes(yys1052Slc, true, true) - yys1052 := string(yys1052Slc) - switch yys1052 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "limits": if r.TryDecodeAsNil() { x.Limits = nil } else { - yyv1053 := &x.Limits - yyv1053.CodecDecodeSelf(d) + yyv4 := &x.Limits + yyv4.CodecDecodeSelf(d) } case "requests": if r.TryDecodeAsNil() { x.Requests = nil } else { - yyv1054 := &x.Requests - yyv1054.CodecDecodeSelf(d) + yyv5 := &x.Requests + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1052) - } // end switch yys1052 - } // end for yyj1052 - if !yyhl1052 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceRequirements) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1055 int - var yyb1055 bool - var yyhl1055 bool = l >= 0 - yyj1055++ - if yyhl1055 { - yyb1055 = yyj1055 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1055 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1055 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Limits = nil } else { - yyv1056 := &x.Limits - yyv1056.CodecDecodeSelf(d) + yyv7 := &x.Limits + yyv7.CodecDecodeSelf(d) } - yyj1055++ - if yyhl1055 { - yyb1055 = yyj1055 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1055 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1055 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Requests = nil } else { - yyv1057 := &x.Requests - yyv1057.CodecDecodeSelf(d) + yyv8 := &x.Requests + yyv8.CodecDecodeSelf(d) } for { - yyj1055++ - if yyhl1055 { - yyb1055 = yyj1055 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1055 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1055 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1055-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { @@ -13853,81 +17737,90 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1058 := z.EncBinary() - _ = yym1058 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1059 := !z.EncBinary() - yy2arr1059 := z.EncBasicHandle().StructToArray - var yyq1059 [18]bool - _, _, _ = yysep1059, yyq1059, yy2arr1059 - const yyr1059 bool = false - yyq1059[2] = len(x.Command) != 0 - yyq1059[3] = len(x.Args) != 0 - yyq1059[4] = x.WorkingDir != "" - yyq1059[5] = len(x.Ports) != 0 - yyq1059[6] = len(x.Env) != 0 - yyq1059[7] = true - yyq1059[8] = len(x.VolumeMounts) != 0 - yyq1059[9] = x.LivenessProbe != nil - yyq1059[10] = x.ReadinessProbe != nil - yyq1059[11] = x.Lifecycle != nil - yyq1059[12] = x.TerminationMessagePath != "" - yyq1059[14] = x.SecurityContext != nil - yyq1059[15] = x.Stdin != false - yyq1059[16] = x.StdinOnce != false - yyq1059[17] = x.TTY != false - if yyr1059 || yy2arr1059 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [18]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = len(x.Command) != 0 + yyq2[3] = len(x.Args) != 0 + yyq2[4] = x.WorkingDir != "" + yyq2[5] = len(x.Ports) != 0 + yyq2[6] = len(x.Env) != 0 + yyq2[7] = true + yyq2[8] = len(x.VolumeMounts) != 0 + yyq2[9] = x.LivenessProbe != nil + yyq2[10] = x.ReadinessProbe != nil + yyq2[11] = x.Lifecycle != nil + yyq2[12] = x.TerminationMessagePath != "" + yyq2[14] = x.SecurityContext != nil + yyq2[15] = x.Stdin != false + yyq2[16] = x.StdinOnce != false + yyq2[17] = x.TTY != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(18) } else { - var yynn1059 int = 3 - for _, b := range yyq1059 { + yynn2 = 3 + for _, b := range yyq2 { if b { - yynn1059++ + yynn2++ } } - r.EncodeMapStart(yynn1059) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1059 || yy2arr1059 { - yym1061 := z.EncBinary() - _ = yym1061 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym1062 := z.EncBinary() - _ = yym1062 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr1059 || yy2arr1059 { - yym1064 := z.EncBinary() - _ = yym1064 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Image)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("image")) - yym1065 := z.EncBinary() - _ = yym1065 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Image)) } } - if yyr1059 || yy2arr1059 { - if yyq1059[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Command == nil { r.EncodeNil() } else { - yym1067 := z.EncBinary() - _ = yym1067 + yym10 := z.EncBinary() + _ = yym10 if false { } else { z.F.EncSliceStringV(x.Command, false, e) @@ -13937,13 +17830,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1059[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("command")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Command == nil { r.EncodeNil() } else { - yym1068 := z.EncBinary() - _ = yym1068 + yym11 := z.EncBinary() + _ = yym11 if false { } else { z.F.EncSliceStringV(x.Command, false, e) @@ -13951,13 +17846,14 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1059 || yy2arr1059 { - if yyq1059[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.Args == nil { r.EncodeNil() } else { - yym1070 := z.EncBinary() - _ = yym1070 + yym13 := z.EncBinary() + _ = yym13 if false { } else { z.F.EncSliceStringV(x.Args, false, e) @@ -13967,13 +17863,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1059[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("args")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Args == nil { r.EncodeNil() } else { - yym1071 := z.EncBinary() - _ = yym1071 + yym14 := z.EncBinary() + _ = yym14 if false { } else { z.F.EncSliceStringV(x.Args, false, e) @@ -13981,10 +17879,11 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1059 || yy2arr1059 { - if yyq1059[4] { - yym1073 := z.EncBinary() - _ = yym1073 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.WorkingDir)) @@ -13993,23 +17892,26 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1059[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("workingDir")) - yym1074 := z.EncBinary() - _ = yym1074 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.WorkingDir)) } } } - if yyr1059 || yy2arr1059 { - if yyq1059[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.Ports == nil { r.EncodeNil() } else { - yym1076 := z.EncBinary() - _ = yym1076 + yym19 := z.EncBinary() + _ = yym19 if false { } else { h.encSliceContainerPort(([]ContainerPort)(x.Ports), e) @@ -14019,13 +17921,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1059[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ports")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Ports == nil { r.EncodeNil() } else { - yym1077 := z.EncBinary() - _ = yym1077 + yym20 := z.EncBinary() + _ = yym20 if false { } else { h.encSliceContainerPort(([]ContainerPort)(x.Ports), e) @@ -14033,13 +17937,14 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1059 || yy2arr1059 { - if yyq1059[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.Env == nil { r.EncodeNil() } else { - yym1079 := z.EncBinary() - _ = yym1079 + yym22 := z.EncBinary() + _ = yym22 if false { } else { h.encSliceEnvVar(([]EnvVar)(x.Env), e) @@ -14049,13 +17954,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1059[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("env")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Env == nil { r.EncodeNil() } else { - yym1080 := z.EncBinary() - _ = yym1080 + yym23 := z.EncBinary() + _ = yym23 if false { } else { h.encSliceEnvVar(([]EnvVar)(x.Env), e) @@ -14063,27 +17970,31 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1059 || yy2arr1059 { - if yyq1059[7] { - yy1082 := &x.Resources - yy1082.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yy25 := &x.Resources + yy25.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1059[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resources")) - yy1083 := &x.Resources - yy1083.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy27 := &x.Resources + yy27.CodecEncodeSelf(e) } } - if yyr1059 || yy2arr1059 { - if yyq1059[8] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { if x.VolumeMounts == nil { r.EncodeNil() } else { - yym1085 := z.EncBinary() - _ = yym1085 + yym30 := z.EncBinary() + _ = yym30 if false { } else { h.encSliceVolumeMount(([]VolumeMount)(x.VolumeMounts), e) @@ -14093,13 +18004,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1059[8] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeMounts")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.VolumeMounts == nil { r.EncodeNil() } else { - yym1086 := z.EncBinary() - _ = yym1086 + yym31 := z.EncBinary() + _ = yym31 if false { } else { h.encSliceVolumeMount(([]VolumeMount)(x.VolumeMounts), e) @@ -14107,8 +18020,9 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1059 || yy2arr1059 { - if yyq1059[9] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { if x.LivenessProbe == nil { r.EncodeNil() } else { @@ -14118,8 +18032,10 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1059[9] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("livenessProbe")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.LivenessProbe == nil { r.EncodeNil() } else { @@ -14127,8 +18043,9 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1059 || yy2arr1059 { - if yyq1059[10] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { if x.ReadinessProbe == nil { r.EncodeNil() } else { @@ -14138,8 +18055,10 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1059[10] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readinessProbe")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ReadinessProbe == nil { r.EncodeNil() } else { @@ -14147,8 +18066,9 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1059 || yy2arr1059 { - if yyq1059[11] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { if x.Lifecycle == nil { r.EncodeNil() } else { @@ -14158,8 +18078,10 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1059[11] { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lifecycle")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Lifecycle == nil { r.EncodeNil() } else { @@ -14167,10 +18089,11 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1059 || yy2arr1059 { - if yyq1059[12] { - yym1091 := z.EncBinary() - _ = yym1091 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + yym42 := z.EncBinary() + _ = yym42 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.TerminationMessagePath)) @@ -14179,24 +18102,30 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1059[12] { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("terminationMessagePath")) - yym1092 := z.EncBinary() - _ = yym1092 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym43 := z.EncBinary() + _ = yym43 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.TerminationMessagePath)) } } } - if yyr1059 || yy2arr1059 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.ImagePullPolicy.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("imagePullPolicy")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.ImagePullPolicy.CodecEncodeSelf(e) } - if yyr1059 || yy2arr1059 { - if yyq1059[14] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { if x.SecurityContext == nil { r.EncodeNil() } else { @@ -14206,8 +18135,10 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1059[14] { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("securityContext")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SecurityContext == nil { r.EncodeNil() } else { @@ -14215,10 +18146,11 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1059 || yy2arr1059 { - if yyq1059[15] { - yym1096 := z.EncBinary() - _ = yym1096 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[15] { + yym51 := z.EncBinary() + _ = yym51 if false { } else { r.EncodeBool(bool(x.Stdin)) @@ -14227,20 +18159,23 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1059[15] { + if yyq2[15] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("stdin")) - yym1097 := z.EncBinary() - _ = yym1097 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym52 := z.EncBinary() + _ = yym52 if false { } else { r.EncodeBool(bool(x.Stdin)) } } } - if yyr1059 || yy2arr1059 { - if yyq1059[16] { - yym1099 := z.EncBinary() - _ = yym1099 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[16] { + yym54 := z.EncBinary() + _ = yym54 if false { } else { r.EncodeBool(bool(x.StdinOnce)) @@ -14249,20 +18184,23 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1059[16] { + if yyq2[16] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("stdinOnce")) - yym1100 := z.EncBinary() - _ = yym1100 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym55 := z.EncBinary() + _ = yym55 if false { } else { r.EncodeBool(bool(x.StdinOnce)) } } } - if yyr1059 || yy2arr1059 { - if yyq1059[17] { - yym1102 := z.EncBinary() - _ = yym1102 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[17] { + yym57 := z.EncBinary() + _ = yym57 if false { } else { r.EncodeBool(bool(x.TTY)) @@ -14271,18 +18209,22 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1059[17] { + if yyq2[17] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("tty")) - yym1103 := z.EncBinary() - _ = yym1103 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym58 := z.EncBinary() + _ = yym58 if false { } else { r.EncodeBool(bool(x.TTY)) } } } - if yysep1059 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -14292,24 +18234,25 @@ func (x *Container) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1104 := z.DecBinary() - _ = yym1104 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1105 := r.ReadMapStart() - if yyl1105 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1105, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1105 := r.ReadArrayStart() - if yyl1105 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1105, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -14321,12 +18264,12 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1106Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1106Slc - var yyhl1106 bool = l >= 0 - for yyj1106 := 0; ; yyj1106++ { - if yyhl1106 { - if yyj1106 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -14334,9 +18277,11 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1106Slc = r.DecodeBytes(yys1106Slc, true, true) - yys1106 := string(yys1106Slc) - switch yys1106 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -14353,24 +18298,24 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Command = nil } else { - yyv1109 := &x.Command - yym1110 := z.DecBinary() - _ = yym1110 + yyv6 := &x.Command + yym7 := z.DecBinary() + _ = yym7 if false { } else { - z.F.DecSliceStringX(yyv1109, false, d) + z.F.DecSliceStringX(yyv6, false, d) } } case "args": if r.TryDecodeAsNil() { x.Args = nil } else { - yyv1111 := &x.Args - yym1112 := z.DecBinary() - _ = yym1112 + yyv8 := &x.Args + yym9 := z.DecBinary() + _ = yym9 if false { } else { - z.F.DecSliceStringX(yyv1111, false, d) + z.F.DecSliceStringX(yyv8, false, d) } } case "workingDir": @@ -14383,43 +18328,43 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv1114 := &x.Ports - yym1115 := z.DecBinary() - _ = yym1115 + yyv11 := &x.Ports + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSliceContainerPort((*[]ContainerPort)(yyv1114), d) + h.decSliceContainerPort((*[]ContainerPort)(yyv11), d) } } case "env": if r.TryDecodeAsNil() { x.Env = nil } else { - yyv1116 := &x.Env - yym1117 := z.DecBinary() - _ = yym1117 + yyv13 := &x.Env + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceEnvVar((*[]EnvVar)(yyv1116), d) + h.decSliceEnvVar((*[]EnvVar)(yyv13), d) } } case "resources": if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv1118 := &x.Resources - yyv1118.CodecDecodeSelf(d) + yyv15 := &x.Resources + yyv15.CodecDecodeSelf(d) } case "volumeMounts": if r.TryDecodeAsNil() { x.VolumeMounts = nil } else { - yyv1119 := &x.VolumeMounts - yym1120 := z.DecBinary() - _ = yym1120 + yyv16 := &x.VolumeMounts + yym17 := z.DecBinary() + _ = yym17 if false { } else { - h.decSliceVolumeMount((*[]VolumeMount)(yyv1119), d) + h.decSliceVolumeMount((*[]VolumeMount)(yyv16), d) } } case "livenessProbe": @@ -14497,197 +18442,205 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.TTY = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys1106) - } // end switch yys1106 - } // end for yyj1106 - if !yyhl1106 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1130 int - var yyb1130 bool - var yyhl1130 bool = l >= 0 - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + var yyj27 int + var yyb27 bool + var yyhl27 bool = l >= 0 + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Image = "" } else { x.Image = string(r.DecodeString()) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Command = nil } else { - yyv1133 := &x.Command - yym1134 := z.DecBinary() - _ = yym1134 + yyv30 := &x.Command + yym31 := z.DecBinary() + _ = yym31 if false { } else { - z.F.DecSliceStringX(yyv1133, false, d) + z.F.DecSliceStringX(yyv30, false, d) } } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Args = nil } else { - yyv1135 := &x.Args - yym1136 := z.DecBinary() - _ = yym1136 + yyv32 := &x.Args + yym33 := z.DecBinary() + _ = yym33 if false { } else { - z.F.DecSliceStringX(yyv1135, false, d) + z.F.DecSliceStringX(yyv32, false, d) } } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.WorkingDir = "" } else { x.WorkingDir = string(r.DecodeString()) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv1138 := &x.Ports - yym1139 := z.DecBinary() - _ = yym1139 + yyv35 := &x.Ports + yym36 := z.DecBinary() + _ = yym36 if false { } else { - h.decSliceContainerPort((*[]ContainerPort)(yyv1138), d) + h.decSliceContainerPort((*[]ContainerPort)(yyv35), d) } } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Env = nil } else { - yyv1140 := &x.Env - yym1141 := z.DecBinary() - _ = yym1141 + yyv37 := &x.Env + yym38 := z.DecBinary() + _ = yym38 if false { } else { - h.decSliceEnvVar((*[]EnvVar)(yyv1140), d) + h.decSliceEnvVar((*[]EnvVar)(yyv37), d) } } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv1142 := &x.Resources - yyv1142.CodecDecodeSelf(d) + yyv39 := &x.Resources + yyv39.CodecDecodeSelf(d) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.VolumeMounts = nil } else { - yyv1143 := &x.VolumeMounts - yym1144 := z.DecBinary() - _ = yym1144 + yyv40 := &x.VolumeMounts + yym41 := z.DecBinary() + _ = yym41 if false { } else { - h.decSliceVolumeMount((*[]VolumeMount)(yyv1143), d) + h.decSliceVolumeMount((*[]VolumeMount)(yyv40), d) } } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.LivenessProbe != nil { x.LivenessProbe = nil @@ -14698,16 +18651,17 @@ func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.LivenessProbe.CodecDecodeSelf(d) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ReadinessProbe != nil { x.ReadinessProbe = nil @@ -14718,16 +18672,17 @@ func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.ReadinessProbe.CodecDecodeSelf(d) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Lifecycle != nil { x.Lifecycle = nil @@ -14738,46 +18693,49 @@ func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Lifecycle.CodecDecodeSelf(d) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TerminationMessagePath = "" } else { x.TerminationMessagePath = string(r.DecodeString()) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ImagePullPolicy = "" } else { x.ImagePullPolicy = PullPolicy(r.DecodeString()) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SecurityContext != nil { x.SecurityContext = nil @@ -14788,64 +18746,68 @@ func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.SecurityContext.CodecDecodeSelf(d) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Stdin = false } else { x.Stdin = bool(r.DecodeBool()) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.StdinOnce = false } else { x.StdinOnce = bool(r.DecodeBool()) } - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TTY = false } else { x.TTY = bool(r.DecodeBool()) } for { - yyj1130++ - if yyhl1130 { - yyb1130 = yyj1130 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1130 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1130 { + if yyb27 { break } - z.DecStructFieldNotFound(yyj1130-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj27-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { @@ -14855,32 +18817,35 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1154 := z.EncBinary() - _ = yym1154 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1155 := !z.EncBinary() - yy2arr1155 := z.EncBasicHandle().StructToArray - var yyq1155 [3]bool - _, _, _ = yysep1155, yyq1155, yy2arr1155 - const yyr1155 bool = false - yyq1155[0] = x.Exec != nil - yyq1155[1] = x.HTTPGet != nil - yyq1155[2] = x.TCPSocket != nil - if yyr1155 || yy2arr1155 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Exec != nil + yyq2[1] = x.HTTPGet != nil + yyq2[2] = x.TCPSocket != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1155 int = 0 - for _, b := range yyq1155 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1155++ + yynn2++ } } - r.EncodeMapStart(yynn1155) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1155 || yy2arr1155 { - if yyq1155[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Exec == nil { r.EncodeNil() } else { @@ -14890,8 +18855,10 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1155[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("exec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Exec == nil { r.EncodeNil() } else { @@ -14899,8 +18866,9 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1155 || yy2arr1155 { - if yyq1155[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.HTTPGet == nil { r.EncodeNil() } else { @@ -14910,8 +18878,10 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1155[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("httpGet")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.HTTPGet == nil { r.EncodeNil() } else { @@ -14919,8 +18889,9 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1155 || yy2arr1155 { - if yyq1155[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.TCPSocket == nil { r.EncodeNil() } else { @@ -14930,8 +18901,10 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1155[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("tcpSocket")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TCPSocket == nil { r.EncodeNil() } else { @@ -14939,8 +18912,10 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1155 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -14950,24 +18925,25 @@ func (x *Handler) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1159 := z.DecBinary() - _ = yym1159 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1160 := r.ReadMapStart() - if yyl1160 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1160, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1160 := r.ReadArrayStart() - if yyl1160 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1160, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -14979,12 +18955,12 @@ func (x *Handler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1161Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1161Slc - var yyhl1161 bool = l >= 0 - for yyj1161 := 0; ; yyj1161++ { - if yyhl1161 { - if yyj1161 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -14992,9 +18968,11 @@ func (x *Handler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1161Slc = r.DecodeBytes(yys1161Slc, true, true) - yys1161 := string(yys1161Slc) - switch yys1161 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "exec": if r.TryDecodeAsNil() { if x.Exec != nil { @@ -15029,31 +19007,30 @@ func (x *Handler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.TCPSocket.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1161) - } // end switch yys1161 - } // end for yyj1161 - if !yyhl1161 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Handler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1165 int - var yyb1165 bool - var yyhl1165 bool = l >= 0 - yyj1165++ - if yyhl1165 { - yyb1165 = yyj1165 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1165 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1165 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Exec != nil { x.Exec = nil @@ -15064,16 +19041,17 @@ func (x *Handler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Exec.CodecDecodeSelf(d) } - yyj1165++ - if yyhl1165 { - yyb1165 = yyj1165 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1165 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1165 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HTTPGet != nil { x.HTTPGet = nil @@ -15084,16 +19062,17 @@ func (x *Handler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.HTTPGet.CodecDecodeSelf(d) } - yyj1165++ - if yyhl1165 { - yyb1165 = yyj1165 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1165 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1165 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.TCPSocket != nil { x.TCPSocket = nil @@ -15105,18 +19084,19 @@ func (x *Handler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.TCPSocket.CodecDecodeSelf(d) } for { - yyj1165++ - if yyhl1165 { - yyb1165 = yyj1165 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1165 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1165 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj1165-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { @@ -15126,31 +19106,34 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1169 := z.EncBinary() - _ = yym1169 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1170 := !z.EncBinary() - yy2arr1170 := z.EncBasicHandle().StructToArray - var yyq1170 [2]bool - _, _, _ = yysep1170, yyq1170, yy2arr1170 - const yyr1170 bool = false - yyq1170[0] = x.PostStart != nil - yyq1170[1] = x.PreStop != nil - if yyr1170 || yy2arr1170 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.PostStart != nil + yyq2[1] = x.PreStop != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1170 int = 0 - for _, b := range yyq1170 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1170++ + yynn2++ } } - r.EncodeMapStart(yynn1170) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1170 || yy2arr1170 { - if yyq1170[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.PostStart == nil { r.EncodeNil() } else { @@ -15160,8 +19143,10 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1170[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("postStart")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.PostStart == nil { r.EncodeNil() } else { @@ -15169,8 +19154,9 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1170 || yy2arr1170 { - if yyq1170[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.PreStop == nil { r.EncodeNil() } else { @@ -15180,8 +19166,10 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1170[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("preStop")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.PreStop == nil { r.EncodeNil() } else { @@ -15189,8 +19177,10 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1170 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -15200,24 +19190,25 @@ func (x *Lifecycle) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1173 := z.DecBinary() - _ = yym1173 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1174 := r.ReadMapStart() - if yyl1174 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1174, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1174 := r.ReadArrayStart() - if yyl1174 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1174, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -15229,12 +19220,12 @@ func (x *Lifecycle) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1175Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1175Slc - var yyhl1175 bool = l >= 0 - for yyj1175 := 0; ; yyj1175++ { - if yyhl1175 { - if yyj1175 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -15242,9 +19233,11 @@ func (x *Lifecycle) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1175Slc = r.DecodeBytes(yys1175Slc, true, true) - yys1175 := string(yys1175Slc) - switch yys1175 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "postStart": if r.TryDecodeAsNil() { if x.PostStart != nil { @@ -15268,31 +19261,30 @@ func (x *Lifecycle) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.PreStop.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1175) - } // end switch yys1175 - } // end for yyj1175 - if !yyhl1175 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Lifecycle) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1178 int - var yyb1178 bool - var yyhl1178 bool = l >= 0 - yyj1178++ - if yyhl1178 { - yyb1178 = yyj1178 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1178 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1178 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.PostStart != nil { x.PostStart = nil @@ -15303,16 +19295,17 @@ func (x *Lifecycle) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.PostStart.CodecDecodeSelf(d) } - yyj1178++ - if yyhl1178 { - yyb1178 = yyj1178 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1178 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1178 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.PreStop != nil { x.PreStop = nil @@ -15324,26 +19317,27 @@ func (x *Lifecycle) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.PreStop.CodecDecodeSelf(d) } for { - yyj1178++ - if yyhl1178 { - yyb1178 = yyj1178 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1178 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1178 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1178-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x ConditionStatus) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1181 := z.EncBinary() - _ = yym1181 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -15355,8 +19349,8 @@ func (x *ConditionStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1182 := z.DecBinary() - _ = yym1182 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -15371,33 +19365,36 @@ func (x *ContainerStateWaiting) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1183 := z.EncBinary() - _ = yym1183 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1184 := !z.EncBinary() - yy2arr1184 := z.EncBasicHandle().StructToArray - var yyq1184 [2]bool - _, _, _ = yysep1184, yyq1184, yy2arr1184 - const yyr1184 bool = false - yyq1184[0] = x.Reason != "" - yyq1184[1] = x.Message != "" - if yyr1184 || yy2arr1184 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Reason != "" + yyq2[1] = x.Message != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1184 int = 0 - for _, b := range yyq1184 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1184++ + yynn2++ } } - r.EncodeMapStart(yynn1184) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1184 || yy2arr1184 { - if yyq1184[0] { - yym1186 := z.EncBinary() - _ = yym1186 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -15406,20 +19403,23 @@ func (x *ContainerStateWaiting) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1184[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym1187 := z.EncBinary() - _ = yym1187 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr1184 || yy2arr1184 { - if yyq1184[1] { - yym1189 := z.EncBinary() - _ = yym1189 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -15428,18 +19428,22 @@ func (x *ContainerStateWaiting) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1184[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym1190 := z.EncBinary() - _ = yym1190 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yysep1184 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -15449,24 +19453,25 @@ func (x *ContainerStateWaiting) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1191 := z.DecBinary() - _ = yym1191 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1192 := r.ReadMapStart() - if yyl1192 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1192, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1192 := r.ReadArrayStart() - if yyl1192 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1192, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -15478,12 +19483,12 @@ func (x *ContainerStateWaiting) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1193Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1193Slc - var yyhl1193 bool = l >= 0 - for yyj1193 := 0; ; yyj1193++ { - if yyhl1193 { - if yyj1193 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -15491,9 +19496,11 @@ func (x *ContainerStateWaiting) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1193Slc = r.DecodeBytes(yys1193Slc, true, true) - yys1193 := string(yys1193Slc) - switch yys1193 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "reason": if r.TryDecodeAsNil() { x.Reason = "" @@ -15507,64 +19514,65 @@ func (x *ContainerStateWaiting) codecDecodeSelfFromMap(l int, d *codec1978.Decod x.Message = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1193) - } // end switch yys1193 - } // end for yyj1193 - if !yyhl1193 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerStateWaiting) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1196 int - var yyb1196 bool - var yyhl1196 bool = l >= 0 - yyj1196++ - if yyhl1196 { - yyb1196 = yyj1196 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1196 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1196 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj1196++ - if yyhl1196 { - yyb1196 = yyj1196 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1196 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1196 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } for { - yyj1196++ - if yyhl1196 { - yyb1196 = yyj1196 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1196 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1196 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1196-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerStateRunning) CodecEncodeSelf(e *codec1978.Encoder) { @@ -15574,64 +19582,71 @@ func (x *ContainerStateRunning) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1199 := z.EncBinary() - _ = yym1199 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1200 := !z.EncBinary() - yy2arr1200 := z.EncBasicHandle().StructToArray - var yyq1200 [1]bool - _, _, _ = yysep1200, yyq1200, yy2arr1200 - const yyr1200 bool = false - yyq1200[0] = true - if yyr1200 || yy2arr1200 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn1200 int = 0 - for _, b := range yyq1200 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1200++ + yynn2++ } } - r.EncodeMapStart(yynn1200) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1200 || yy2arr1200 { - if yyq1200[0] { - yy1202 := &x.StartedAt - yym1203 := z.EncBinary() - _ = yym1203 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.StartedAt + yym5 := z.EncBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.EncExt(yy1202) { - } else if yym1203 { - z.EncBinaryMarshal(yy1202) - } else if !yym1203 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1202) + } else if z.HasExtensions() && z.EncExt(yy4) { + } else if yym5 { + z.EncBinaryMarshal(yy4) + } else if !yym5 && z.IsJSONHandle() { + z.EncJSONMarshal(yy4) } else { - z.EncFallback(yy1202) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1200[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("startedAt")) - yy1204 := &x.StartedAt - yym1205 := z.EncBinary() - _ = yym1205 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.StartedAt + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1204) { - } else if yym1205 { - z.EncBinaryMarshal(yy1204) - } else if !yym1205 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1204) + } else if z.HasExtensions() && z.EncExt(yy6) { + } else if yym7 { + z.EncBinaryMarshal(yy6) + } else if !yym7 && z.IsJSONHandle() { + z.EncJSONMarshal(yy6) } else { - z.EncFallback(yy1204) + z.EncFallback(yy6) } } } - if yysep1200 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -15641,24 +19656,25 @@ func (x *ContainerStateRunning) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1206 := z.DecBinary() - _ = yym1206 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1207 := r.ReadMapStart() - if yyl1207 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1207, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1207 := r.ReadArrayStart() - if yyl1207 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1207, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -15670,12 +19686,12 @@ func (x *ContainerStateRunning) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1208Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1208Slc - var yyhl1208 bool = l >= 0 - for yyj1208 := 0; ; yyj1208++ { - if yyhl1208 { - if yyj1208 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -15683,81 +19699,83 @@ func (x *ContainerStateRunning) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1208Slc = r.DecodeBytes(yys1208Slc, true, true) - yys1208 := string(yys1208Slc) - switch yys1208 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "startedAt": if r.TryDecodeAsNil() { x.StartedAt = pkg2_unversioned.Time{} } else { - yyv1209 := &x.StartedAt - yym1210 := z.DecBinary() - _ = yym1210 + yyv4 := &x.StartedAt + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv1209) { - } else if yym1210 { - z.DecBinaryUnmarshal(yyv1209) - } else if !yym1210 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1209) + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else if yym5 { + z.DecBinaryUnmarshal(yyv4) + } else if !yym5 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv4) } else { - z.DecFallback(yyv1209, false) + z.DecFallback(yyv4, false) } } default: - z.DecStructFieldNotFound(-1, yys1208) - } // end switch yys1208 - } // end for yyj1208 - if !yyhl1208 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerStateRunning) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1211 int - var yyb1211 bool - var yyhl1211 bool = l >= 0 - yyj1211++ - if yyhl1211 { - yyb1211 = yyj1211 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1211 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1211 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.StartedAt = pkg2_unversioned.Time{} } else { - yyv1212 := &x.StartedAt - yym1213 := z.DecBinary() - _ = yym1213 + yyv7 := &x.StartedAt + yym8 := z.DecBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.DecExt(yyv1212) { - } else if yym1213 { - z.DecBinaryUnmarshal(yyv1212) - } else if !yym1213 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1212) + } else if z.HasExtensions() && z.DecExt(yyv7) { + } else if yym8 { + z.DecBinaryUnmarshal(yyv7) + } else if !yym8 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv7) } else { - z.DecFallback(yyv1212, false) + z.DecFallback(yyv7, false) } } for { - yyj1211++ - if yyhl1211 { - yyb1211 = yyj1211 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1211 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1211 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1211-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { @@ -15767,53 +19785,59 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1214 := z.EncBinary() - _ = yym1214 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1215 := !z.EncBinary() - yy2arr1215 := z.EncBasicHandle().StructToArray - var yyq1215 [7]bool - _, _, _ = yysep1215, yyq1215, yy2arr1215 - const yyr1215 bool = false - yyq1215[1] = x.Signal != 0 - yyq1215[2] = x.Reason != "" - yyq1215[3] = x.Message != "" - yyq1215[4] = true - yyq1215[5] = true - yyq1215[6] = x.ContainerID != "" - if yyr1215 || yy2arr1215 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Signal != 0 + yyq2[2] = x.Reason != "" + yyq2[3] = x.Message != "" + yyq2[4] = true + yyq2[5] = true + yyq2[6] = x.ContainerID != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(7) } else { - var yynn1215 int = 1 - for _, b := range yyq1215 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1215++ + yynn2++ } } - r.EncodeMapStart(yynn1215) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1215 || yy2arr1215 { - yym1217 := z.EncBinary() - _ = yym1217 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.ExitCode)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("exitCode")) - yym1218 := z.EncBinary() - _ = yym1218 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.ExitCode)) } } - if yyr1215 || yy2arr1215 { - if yyq1215[1] { - yym1220 := z.EncBinary() - _ = yym1220 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.Signal)) @@ -15822,20 +19846,23 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq1215[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("signal")) - yym1221 := z.EncBinary() - _ = yym1221 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.Signal)) } } } - if yyr1215 || yy2arr1215 { - if yyq1215[2] { - yym1223 := z.EncBinary() - _ = yym1223 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -15844,20 +19871,23 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1215[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym1224 := z.EncBinary() - _ = yym1224 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr1215 || yy2arr1215 { - if yyq1215[3] { - yym1226 := z.EncBinary() - _ = yym1226 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -15866,88 +19896,97 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1215[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym1227 := z.EncBinary() - _ = yym1227 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr1215 || yy2arr1215 { - if yyq1215[4] { - yy1229 := &x.StartedAt - yym1230 := z.EncBinary() - _ = yym1230 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yy16 := &x.StartedAt + yym17 := z.EncBinary() + _ = yym17 if false { - } else if z.HasExtensions() && z.EncExt(yy1229) { - } else if yym1230 { - z.EncBinaryMarshal(yy1229) - } else if !yym1230 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1229) + } else if z.HasExtensions() && z.EncExt(yy16) { + } else if yym17 { + z.EncBinaryMarshal(yy16) + } else if !yym17 && z.IsJSONHandle() { + z.EncJSONMarshal(yy16) } else { - z.EncFallback(yy1229) + z.EncFallback(yy16) } } else { r.EncodeNil() } } else { - if yyq1215[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("startedAt")) - yy1231 := &x.StartedAt - yym1232 := z.EncBinary() - _ = yym1232 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy18 := &x.StartedAt + yym19 := z.EncBinary() + _ = yym19 if false { - } else if z.HasExtensions() && z.EncExt(yy1231) { - } else if yym1232 { - z.EncBinaryMarshal(yy1231) - } else if !yym1232 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1231) + } else if z.HasExtensions() && z.EncExt(yy18) { + } else if yym19 { + z.EncBinaryMarshal(yy18) + } else if !yym19 && z.IsJSONHandle() { + z.EncJSONMarshal(yy18) } else { - z.EncFallback(yy1231) + z.EncFallback(yy18) } } } - if yyr1215 || yy2arr1215 { - if yyq1215[5] { - yy1234 := &x.FinishedAt - yym1235 := z.EncBinary() - _ = yym1235 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yy21 := &x.FinishedAt + yym22 := z.EncBinary() + _ = yym22 if false { - } else if z.HasExtensions() && z.EncExt(yy1234) { - } else if yym1235 { - z.EncBinaryMarshal(yy1234) - } else if !yym1235 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1234) + } else if z.HasExtensions() && z.EncExt(yy21) { + } else if yym22 { + z.EncBinaryMarshal(yy21) + } else if !yym22 && z.IsJSONHandle() { + z.EncJSONMarshal(yy21) } else { - z.EncFallback(yy1234) + z.EncFallback(yy21) } } else { r.EncodeNil() } } else { - if yyq1215[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("finishedAt")) - yy1236 := &x.FinishedAt - yym1237 := z.EncBinary() - _ = yym1237 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy23 := &x.FinishedAt + yym24 := z.EncBinary() + _ = yym24 if false { - } else if z.HasExtensions() && z.EncExt(yy1236) { - } else if yym1237 { - z.EncBinaryMarshal(yy1236) - } else if !yym1237 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1236) + } else if z.HasExtensions() && z.EncExt(yy23) { + } else if yym24 { + z.EncBinaryMarshal(yy23) + } else if !yym24 && z.IsJSONHandle() { + z.EncJSONMarshal(yy23) } else { - z.EncFallback(yy1236) + z.EncFallback(yy23) } } } - if yyr1215 || yy2arr1215 { - if yyq1215[6] { - yym1239 := z.EncBinary() - _ = yym1239 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym26 := z.EncBinary() + _ = yym26 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerID)) @@ -15956,18 +19995,22 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1215[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerID")) - yym1240 := z.EncBinary() - _ = yym1240 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym27 := z.EncBinary() + _ = yym27 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerID)) } } } - if yysep1215 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -15977,24 +20020,25 @@ func (x *ContainerStateTerminated) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1241 := z.DecBinary() - _ = yym1241 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1242 := r.ReadMapStart() - if yyl1242 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1242, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1242 := r.ReadArrayStart() - if yyl1242 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1242, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -16006,12 +20050,12 @@ func (x *ContainerStateTerminated) codecDecodeSelfFromMap(l int, d *codec1978.De var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1243Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1243Slc - var yyhl1243 bool = l >= 0 - for yyj1243 := 0; ; yyj1243++ { - if yyhl1243 { - if yyj1243 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -16019,9 +20063,11 @@ func (x *ContainerStateTerminated) codecDecodeSelfFromMap(l int, d *codec1978.De break } } - yys1243Slc = r.DecodeBytes(yys1243Slc, true, true) - yys1243 := string(yys1243Slc) - switch yys1243 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "exitCode": if r.TryDecodeAsNil() { x.ExitCode = 0 @@ -16050,34 +20096,34 @@ func (x *ContainerStateTerminated) codecDecodeSelfFromMap(l int, d *codec1978.De if r.TryDecodeAsNil() { x.StartedAt = pkg2_unversioned.Time{} } else { - yyv1248 := &x.StartedAt - yym1249 := z.DecBinary() - _ = yym1249 + yyv8 := &x.StartedAt + yym9 := z.DecBinary() + _ = yym9 if false { - } else if z.HasExtensions() && z.DecExt(yyv1248) { - } else if yym1249 { - z.DecBinaryUnmarshal(yyv1248) - } else if !yym1249 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1248) + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else if yym9 { + z.DecBinaryUnmarshal(yyv8) + } else if !yym9 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv8) } else { - z.DecFallback(yyv1248, false) + z.DecFallback(yyv8, false) } } case "finishedAt": if r.TryDecodeAsNil() { x.FinishedAt = pkg2_unversioned.Time{} } else { - yyv1250 := &x.FinishedAt - yym1251 := z.DecBinary() - _ = yym1251 + yyv10 := &x.FinishedAt + yym11 := z.DecBinary() + _ = yym11 if false { - } else if z.HasExtensions() && z.DecExt(yyv1250) { - } else if yym1251 { - z.DecBinaryUnmarshal(yyv1250) - } else if !yym1251 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1250) + } else if z.HasExtensions() && z.DecExt(yyv10) { + } else if yym11 { + z.DecBinaryUnmarshal(yyv10) + } else if !yym11 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv10) } else { - z.DecFallback(yyv1250, false) + z.DecFallback(yyv10, false) } } case "containerID": @@ -16087,161 +20133,167 @@ func (x *ContainerStateTerminated) codecDecodeSelfFromMap(l int, d *codec1978.De x.ContainerID = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1243) - } // end switch yys1243 - } // end for yyj1243 - if !yyhl1243 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerStateTerminated) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1253 int - var yyb1253 bool - var yyhl1253 bool = l >= 0 - yyj1253++ - if yyhl1253 { - yyb1253 = yyj1253 > l + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1253 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1253 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ExitCode = 0 } else { x.ExitCode = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj1253++ - if yyhl1253 { - yyb1253 = yyj1253 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1253 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1253 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Signal = 0 } else { x.Signal = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj1253++ - if yyhl1253 { - yyb1253 = yyj1253 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1253 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1253 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj1253++ - if yyhl1253 { - yyb1253 = yyj1253 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1253 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1253 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj1253++ - if yyhl1253 { - yyb1253 = yyj1253 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1253 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1253 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.StartedAt = pkg2_unversioned.Time{} } else { - yyv1258 := &x.StartedAt - yym1259 := z.DecBinary() - _ = yym1259 + yyv18 := &x.StartedAt + yym19 := z.DecBinary() + _ = yym19 if false { - } else if z.HasExtensions() && z.DecExt(yyv1258) { - } else if yym1259 { - z.DecBinaryUnmarshal(yyv1258) - } else if !yym1259 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1258) + } else if z.HasExtensions() && z.DecExt(yyv18) { + } else if yym19 { + z.DecBinaryUnmarshal(yyv18) + } else if !yym19 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv18) } else { - z.DecFallback(yyv1258, false) + z.DecFallback(yyv18, false) } } - yyj1253++ - if yyhl1253 { - yyb1253 = yyj1253 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1253 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1253 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FinishedAt = pkg2_unversioned.Time{} } else { - yyv1260 := &x.FinishedAt - yym1261 := z.DecBinary() - _ = yym1261 + yyv20 := &x.FinishedAt + yym21 := z.DecBinary() + _ = yym21 if false { - } else if z.HasExtensions() && z.DecExt(yyv1260) { - } else if yym1261 { - z.DecBinaryUnmarshal(yyv1260) - } else if !yym1261 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1260) + } else if z.HasExtensions() && z.DecExt(yyv20) { + } else if yym21 { + z.DecBinaryUnmarshal(yyv20) + } else if !yym21 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv20) } else { - z.DecFallback(yyv1260, false) + z.DecFallback(yyv20, false) } } - yyj1253++ - if yyhl1253 { - yyb1253 = yyj1253 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1253 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1253 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerID = "" } else { x.ContainerID = string(r.DecodeString()) } for { - yyj1253++ - if yyhl1253 { - yyb1253 = yyj1253 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1253 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1253 { + if yyb13 { break } - z.DecStructFieldNotFound(yyj1253-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { @@ -16251,32 +20303,35 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1263 := z.EncBinary() - _ = yym1263 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1264 := !z.EncBinary() - yy2arr1264 := z.EncBasicHandle().StructToArray - var yyq1264 [3]bool - _, _, _ = yysep1264, yyq1264, yy2arr1264 - const yyr1264 bool = false - yyq1264[0] = x.Waiting != nil - yyq1264[1] = x.Running != nil - yyq1264[2] = x.Terminated != nil - if yyr1264 || yy2arr1264 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Waiting != nil + yyq2[1] = x.Running != nil + yyq2[2] = x.Terminated != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1264 int = 0 - for _, b := range yyq1264 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1264++ + yynn2++ } } - r.EncodeMapStart(yynn1264) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1264 || yy2arr1264 { - if yyq1264[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Waiting == nil { r.EncodeNil() } else { @@ -16286,8 +20341,10 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1264[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("waiting")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Waiting == nil { r.EncodeNil() } else { @@ -16295,8 +20352,9 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1264 || yy2arr1264 { - if yyq1264[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Running == nil { r.EncodeNil() } else { @@ -16306,8 +20364,10 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1264[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("running")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Running == nil { r.EncodeNil() } else { @@ -16315,8 +20375,9 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1264 || yy2arr1264 { - if yyq1264[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Terminated == nil { r.EncodeNil() } else { @@ -16326,8 +20387,10 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1264[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("terminated")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Terminated == nil { r.EncodeNil() } else { @@ -16335,8 +20398,10 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1264 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -16346,24 +20411,25 @@ func (x *ContainerState) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1268 := z.DecBinary() - _ = yym1268 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1269 := r.ReadMapStart() - if yyl1269 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1269, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1269 := r.ReadArrayStart() - if yyl1269 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1269, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -16375,12 +20441,12 @@ func (x *ContainerState) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1270Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1270Slc - var yyhl1270 bool = l >= 0 - for yyj1270 := 0; ; yyj1270++ { - if yyhl1270 { - if yyj1270 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -16388,9 +20454,11 @@ func (x *ContainerState) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1270Slc = r.DecodeBytes(yys1270Slc, true, true) - yys1270 := string(yys1270Slc) - switch yys1270 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "waiting": if r.TryDecodeAsNil() { if x.Waiting != nil { @@ -16425,31 +20493,30 @@ func (x *ContainerState) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Terminated.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1270) - } // end switch yys1270 - } // end for yyj1270 - if !yyhl1270 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerState) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1274 int - var yyb1274 bool - var yyhl1274 bool = l >= 0 - yyj1274++ - if yyhl1274 { - yyb1274 = yyj1274 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1274 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1274 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Waiting != nil { x.Waiting = nil @@ -16460,16 +20527,17 @@ func (x *ContainerState) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Waiting.CodecDecodeSelf(d) } - yyj1274++ - if yyhl1274 { - yyb1274 = yyj1274 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1274 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1274 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Running != nil { x.Running = nil @@ -16480,16 +20548,17 @@ func (x *ContainerState) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Running.CodecDecodeSelf(d) } - yyj1274++ - if yyhl1274 { - yyb1274 = yyj1274 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1274 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1274 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Terminated != nil { x.Terminated = nil @@ -16501,18 +20570,19 @@ func (x *ContainerState) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.Terminated.CodecDecodeSelf(d) } for { - yyj1274++ - if yyhl1274 { - yyb1274 = yyj1274 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1274 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1274 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj1274-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -16522,142 +20592,166 @@ func (x *ContainerStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1278 := z.EncBinary() - _ = yym1278 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1279 := !z.EncBinary() - yy2arr1279 := z.EncBasicHandle().StructToArray - var yyq1279 [8]bool - _, _, _ = yysep1279, yyq1279, yy2arr1279 - const yyr1279 bool = false - yyq1279[1] = true - yyq1279[2] = true - yyq1279[7] = x.ContainerID != "" - if yyr1279 || yy2arr1279 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = true + yyq2[2] = true + yyq2[7] = x.ContainerID != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - var yynn1279 int = 5 - for _, b := range yyq1279 { + yynn2 = 5 + for _, b := range yyq2 { if b { - yynn1279++ + yynn2++ } } - r.EncodeMapStart(yynn1279) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1279 || yy2arr1279 { - yym1281 := z.EncBinary() - _ = yym1281 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym1282 := z.EncBinary() - _ = yym1282 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr1279 || yy2arr1279 { - if yyq1279[1] { - yy1284 := &x.State - yy1284.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy7 := &x.State + yy7.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1279[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("state")) - yy1285 := &x.State - yy1285.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.State + yy9.CodecEncodeSelf(e) } } - if yyr1279 || yy2arr1279 { - if yyq1279[2] { - yy1287 := &x.LastTerminationState - yy1287.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy12 := &x.LastTerminationState + yy12.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1279[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastState")) - yy1288 := &x.LastTerminationState - yy1288.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy14 := &x.LastTerminationState + yy14.CodecEncodeSelf(e) } } - if yyr1279 || yy2arr1279 { - yym1290 := z.EncBinary() - _ = yym1290 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeBool(bool(x.Ready)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ready")) - yym1291 := z.EncBinary() - _ = yym1291 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 if false { } else { r.EncodeBool(bool(x.Ready)) } } - if yyr1279 || yy2arr1279 { - yym1293 := z.EncBinary() - _ = yym1293 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeInt(int64(x.RestartCount)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("restartCount")) - yym1294 := z.EncBinary() - _ = yym1294 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym21 := z.EncBinary() + _ = yym21 if false { } else { r.EncodeInt(int64(x.RestartCount)) } } - if yyr1279 || yy2arr1279 { - yym1296 := z.EncBinary() - _ = yym1296 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Image)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("image")) - yym1297 := z.EncBinary() - _ = yym1297 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym24 := z.EncBinary() + _ = yym24 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Image)) } } - if yyr1279 || yy2arr1279 { - yym1299 := z.EncBinary() - _ = yym1299 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym26 := z.EncBinary() + _ = yym26 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ImageID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("imageID")) - yym1300 := z.EncBinary() - _ = yym1300 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym27 := z.EncBinary() + _ = yym27 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ImageID)) } } - if yyr1279 || yy2arr1279 { - if yyq1279[7] { - yym1302 := z.EncBinary() - _ = yym1302 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym29 := z.EncBinary() + _ = yym29 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerID)) @@ -16666,18 +20760,22 @@ func (x *ContainerStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1279[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerID")) - yym1303 := z.EncBinary() - _ = yym1303 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym30 := z.EncBinary() + _ = yym30 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerID)) } } } - if yysep1279 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -16687,24 +20785,25 @@ func (x *ContainerStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1304 := z.DecBinary() - _ = yym1304 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1305 := r.ReadMapStart() - if yyl1305 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1305, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1305 := r.ReadArrayStart() - if yyl1305 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1305, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -16716,12 +20815,12 @@ func (x *ContainerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1306Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1306Slc - var yyhl1306 bool = l >= 0 - for yyj1306 := 0; ; yyj1306++ { - if yyhl1306 { - if yyj1306 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -16729,9 +20828,11 @@ func (x *ContainerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1306Slc = r.DecodeBytes(yys1306Slc, true, true) - yys1306 := string(yys1306Slc) - switch yys1306 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -16742,15 +20843,15 @@ func (x *ContainerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.State = ContainerState{} } else { - yyv1308 := &x.State - yyv1308.CodecDecodeSelf(d) + yyv5 := &x.State + yyv5.CodecDecodeSelf(d) } case "lastState": if r.TryDecodeAsNil() { x.LastTerminationState = ContainerState{} } else { - yyv1309 := &x.LastTerminationState - yyv1309.CodecDecodeSelf(d) + yyv6 := &x.LastTerminationState + yyv6.CodecDecodeSelf(d) } case "ready": if r.TryDecodeAsNil() { @@ -16783,164 +20884,171 @@ func (x *ContainerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ContainerID = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1306) - } // end switch yys1306 - } // end for yyj1306 - if !yyhl1306 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1315 int - var yyb1315 bool - var yyhl1315 bool = l >= 0 - yyj1315++ - if yyhl1315 { - yyb1315 = yyj1315 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1315 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1315 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj1315++ - if yyhl1315 { - yyb1315 = yyj1315 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1315 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1315 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.State = ContainerState{} } else { - yyv1317 := &x.State - yyv1317.CodecDecodeSelf(d) + yyv14 := &x.State + yyv14.CodecDecodeSelf(d) } - yyj1315++ - if yyhl1315 { - yyb1315 = yyj1315 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1315 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1315 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTerminationState = ContainerState{} } else { - yyv1318 := &x.LastTerminationState - yyv1318.CodecDecodeSelf(d) + yyv15 := &x.LastTerminationState + yyv15.CodecDecodeSelf(d) } - yyj1315++ - if yyhl1315 { - yyb1315 = yyj1315 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1315 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1315 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ready = false } else { x.Ready = bool(r.DecodeBool()) } - yyj1315++ - if yyhl1315 { - yyb1315 = yyj1315 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1315 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1315 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RestartCount = 0 } else { x.RestartCount = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj1315++ - if yyhl1315 { - yyb1315 = yyj1315 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1315 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1315 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Image = "" } else { x.Image = string(r.DecodeString()) } - yyj1315++ - if yyhl1315 { - yyb1315 = yyj1315 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1315 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1315 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ImageID = "" } else { x.ImageID = string(r.DecodeString()) } - yyj1315++ - if yyhl1315 { - yyb1315 = yyj1315 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1315 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1315 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerID = "" } else { x.ContainerID = string(r.DecodeString()) } for { - yyj1315++ - if yyhl1315 { - yyb1315 = yyj1315 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1315 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1315 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj1315-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x PodPhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1324 := z.EncBinary() - _ = yym1324 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -16952,8 +21060,8 @@ func (x *PodPhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1325 := z.DecBinary() - _ = yym1325 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -16965,8 +21073,8 @@ func (x PodConditionType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1326 := z.EncBinary() - _ = yym1326 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -16978,8 +21086,8 @@ func (x *PodConditionType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1327 := z.DecBinary() - _ = yym1327 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -16994,115 +21102,130 @@ func (x *PodCondition) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1328 := z.EncBinary() - _ = yym1328 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1329 := !z.EncBinary() - yy2arr1329 := z.EncBasicHandle().StructToArray - var yyq1329 [6]bool - _, _, _ = yysep1329, yyq1329, yy2arr1329 - const yyr1329 bool = false - yyq1329[2] = true - yyq1329[3] = true - yyq1329[4] = x.Reason != "" - yyq1329[5] = x.Message != "" - if yyr1329 || yy2arr1329 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = true + yyq2[3] = true + yyq2[4] = x.Reason != "" + yyq2[5] = x.Message != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn1329 int = 2 - for _, b := range yyq1329 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn1329++ + yynn2++ } } - r.EncodeMapStart(yynn1329) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1329 || yy2arr1329 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr1329 || yy2arr1329 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Status.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Status.CodecEncodeSelf(e) } - if yyr1329 || yy2arr1329 { - if yyq1329[2] { - yy1333 := &x.LastProbeTime - yym1334 := z.EncBinary() - _ = yym1334 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.LastProbeTime + yym11 := z.EncBinary() + _ = yym11 if false { - } else if z.HasExtensions() && z.EncExt(yy1333) { - } else if yym1334 { - z.EncBinaryMarshal(yy1333) - } else if !yym1334 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1333) + } else if z.HasExtensions() && z.EncExt(yy10) { + } else if yym11 { + z.EncBinaryMarshal(yy10) + } else if !yym11 && z.IsJSONHandle() { + z.EncJSONMarshal(yy10) } else { - z.EncFallback(yy1333) + z.EncFallback(yy10) } } else { r.EncodeNil() } } else { - if yyq1329[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastProbeTime")) - yy1335 := &x.LastProbeTime - yym1336 := z.EncBinary() - _ = yym1336 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.LastProbeTime + yym13 := z.EncBinary() + _ = yym13 if false { - } else if z.HasExtensions() && z.EncExt(yy1335) { - } else if yym1336 { - z.EncBinaryMarshal(yy1335) - } else if !yym1336 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1335) + } else if z.HasExtensions() && z.EncExt(yy12) { + } else if yym13 { + z.EncBinaryMarshal(yy12) + } else if !yym13 && z.IsJSONHandle() { + z.EncJSONMarshal(yy12) } else { - z.EncFallback(yy1335) + z.EncFallback(yy12) } } } - if yyr1329 || yy2arr1329 { - if yyq1329[3] { - yy1338 := &x.LastTransitionTime - yym1339 := z.EncBinary() - _ = yym1339 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yy15 := &x.LastTransitionTime + yym16 := z.EncBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.EncExt(yy1338) { - } else if yym1339 { - z.EncBinaryMarshal(yy1338) - } else if !yym1339 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1338) + } else if z.HasExtensions() && z.EncExt(yy15) { + } else if yym16 { + z.EncBinaryMarshal(yy15) + } else if !yym16 && z.IsJSONHandle() { + z.EncJSONMarshal(yy15) } else { - z.EncFallback(yy1338) + z.EncFallback(yy15) } } else { r.EncodeNil() } } else { - if yyq1329[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastTransitionTime")) - yy1340 := &x.LastTransitionTime - yym1341 := z.EncBinary() - _ = yym1341 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy17 := &x.LastTransitionTime + yym18 := z.EncBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.EncExt(yy1340) { - } else if yym1341 { - z.EncBinaryMarshal(yy1340) - } else if !yym1341 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1340) + } else if z.HasExtensions() && z.EncExt(yy17) { + } else if yym18 { + z.EncBinaryMarshal(yy17) + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(yy17) } else { - z.EncFallback(yy1340) + z.EncFallback(yy17) } } } - if yyr1329 || yy2arr1329 { - if yyq1329[4] { - yym1343 := z.EncBinary() - _ = yym1343 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -17111,20 +21234,23 @@ func (x *PodCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1329[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym1344 := z.EncBinary() - _ = yym1344 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym21 := z.EncBinary() + _ = yym21 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr1329 || yy2arr1329 { - if yyq1329[5] { - yym1346 := z.EncBinary() - _ = yym1346 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -17133,18 +21259,22 @@ func (x *PodCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1329[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym1347 := z.EncBinary() - _ = yym1347 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym24 := z.EncBinary() + _ = yym24 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yysep1329 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -17154,24 +21284,25 @@ func (x *PodCondition) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1348 := z.DecBinary() - _ = yym1348 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1349 := r.ReadMapStart() - if yyl1349 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1349, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1349 := r.ReadArrayStart() - if yyl1349 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1349, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -17183,12 +21314,12 @@ func (x *PodCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1350Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1350Slc - var yyhl1350 bool = l >= 0 - for yyj1350 := 0; ; yyj1350++ { - if yyhl1350 { - if yyj1350 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -17196,9 +21327,11 @@ func (x *PodCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1350Slc = r.DecodeBytes(yys1350Slc, true, true) - yys1350 := string(yys1350Slc) - switch yys1350 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -17215,34 +21348,34 @@ func (x *PodCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.LastProbeTime = pkg2_unversioned.Time{} } else { - yyv1353 := &x.LastProbeTime - yym1354 := z.DecBinary() - _ = yym1354 + yyv6 := &x.LastProbeTime + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv1353) { - } else if yym1354 { - z.DecBinaryUnmarshal(yyv1353) - } else if !yym1354 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1353) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if yym7 { + z.DecBinaryUnmarshal(yyv6) + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv1353, false) + z.DecFallback(yyv6, false) } } case "lastTransitionTime": if r.TryDecodeAsNil() { x.LastTransitionTime = pkg2_unversioned.Time{} } else { - yyv1355 := &x.LastTransitionTime - yym1356 := z.DecBinary() - _ = yym1356 + yyv8 := &x.LastTransitionTime + yym9 := z.DecBinary() + _ = yym9 if false { - } else if z.HasExtensions() && z.DecExt(yyv1355) { - } else if yym1356 { - z.DecBinaryUnmarshal(yyv1355) - } else if !yym1356 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1355) + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else if yym9 { + z.DecBinaryUnmarshal(yyv8) + } else if !yym9 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv8) } else { - z.DecFallback(yyv1355, false) + z.DecFallback(yyv8, false) } } case "reason": @@ -17258,154 +21391,159 @@ func (x *PodCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Message = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1350) - } // end switch yys1350 - } // end for yyj1350 - if !yyhl1350 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1359 int - var yyb1359 bool - var yyhl1359 bool = l >= 0 - yyj1359++ - if yyhl1359 { - yyb1359 = yyj1359 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1359 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1359 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = PodConditionType(r.DecodeString()) } - yyj1359++ - if yyhl1359 { - yyb1359 = yyj1359 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1359 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1359 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Status = "" } else { x.Status = ConditionStatus(r.DecodeString()) } - yyj1359++ - if yyhl1359 { - yyb1359 = yyj1359 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1359 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1359 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastProbeTime = pkg2_unversioned.Time{} } else { - yyv1362 := &x.LastProbeTime - yym1363 := z.DecBinary() - _ = yym1363 + yyv15 := &x.LastProbeTime + yym16 := z.DecBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.DecExt(yyv1362) { - } else if yym1363 { - z.DecBinaryUnmarshal(yyv1362) - } else if !yym1363 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1362) + } else if z.HasExtensions() && z.DecExt(yyv15) { + } else if yym16 { + z.DecBinaryUnmarshal(yyv15) + } else if !yym16 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv15) } else { - z.DecFallback(yyv1362, false) + z.DecFallback(yyv15, false) } } - yyj1359++ - if yyhl1359 { - yyb1359 = yyj1359 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1359 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1359 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTransitionTime = pkg2_unversioned.Time{} } else { - yyv1364 := &x.LastTransitionTime - yym1365 := z.DecBinary() - _ = yym1365 + yyv17 := &x.LastTransitionTime + yym18 := z.DecBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.DecExt(yyv1364) { - } else if yym1365 { - z.DecBinaryUnmarshal(yyv1364) - } else if !yym1365 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1364) + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else if yym18 { + z.DecBinaryUnmarshal(yyv17) + } else if !yym18 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv17) } else { - z.DecFallback(yyv1364, false) + z.DecFallback(yyv17, false) } } - yyj1359++ - if yyhl1359 { - yyb1359 = yyj1359 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1359 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1359 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj1359++ - if yyhl1359 { - yyb1359 = yyj1359 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1359 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1359 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } for { - yyj1359++ - if yyhl1359 { - yyb1359 = yyj1359 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1359 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1359 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj1359-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x RestartPolicy) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1368 := z.EncBinary() - _ = yym1368 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -17417,8 +21555,8 @@ func (x *RestartPolicy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1369 := z.DecBinary() - _ = yym1369 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -17433,126 +21571,142 @@ func (x *PodList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1370 := z.EncBinary() - _ = yym1370 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1371 := !z.EncBinary() - yy2arr1371 := z.EncBasicHandle().StructToArray - var yyq1371 [4]bool - _, _, _ = yysep1371, yyq1371, yy2arr1371 - const yyr1371 bool = false - yyq1371[0] = x.Kind != "" - yyq1371[1] = x.APIVersion != "" - yyq1371[2] = true - if yyr1371 || yy2arr1371 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1371 int = 1 - for _, b := range yyq1371 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1371++ + yynn2++ } } - r.EncodeMapStart(yynn1371) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1371 || yy2arr1371 { - if yyq1371[0] { - yym1373 := z.EncBinary() - _ = yym1373 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1371[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1374 := z.EncBinary() - _ = yym1374 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1371 || yy2arr1371 { - if yyq1371[1] { - yym1376 := z.EncBinary() - _ = yym1376 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1371[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1377 := z.EncBinary() - _ = yym1377 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1371 || yy2arr1371 { - if yyq1371[2] { - yy1379 := &x.ListMeta - yym1380 := z.EncBinary() - _ = yym1380 - if false { - } else if z.HasExtensions() && z.EncExt(yy1379) { - } else { - z.EncFallback(yy1379) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1371[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1381 := &x.ListMeta - yym1382 := z.EncBinary() - _ = yym1382 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1381) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1381) + z.EncFallback(yy6) } } } - if yyr1371 || yy2arr1371 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1384 := z.EncBinary() - _ = yym1384 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSlicePod(([]Pod)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1385 := z.EncBinary() - _ = yym1385 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSlicePod(([]Pod)(x.Items), e) } } } - if yysep1371 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -17562,24 +21716,25 @@ func (x *PodList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1386 := z.DecBinary() - _ = yym1386 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1387 := r.ReadMapStart() - if yyl1387 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1387, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1387 := r.ReadArrayStart() - if yyl1387 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1387, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -17591,12 +21746,12 @@ func (x *PodList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1388Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1388Slc - var yyhl1388 bool = l >= 0 - for yyj1388 := 0; ; yyj1388++ { - if yyhl1388 { - if yyj1388 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -17604,9 +21759,36 @@ func (x *PodList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1388Slc = r.DecodeBytes(yys1388Slc, true, true) - yys1388 := string(yys1388Slc) - switch yys1388 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePod((*[]Pod)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -17619,141 +21801,119 @@ func (x *PodList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1391 := &x.ListMeta - yym1392 := z.DecBinary() - _ = yym1392 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1391) { - } else { - z.DecFallback(yyv1391, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1393 := &x.Items - yym1394 := z.DecBinary() - _ = yym1394 - if false { - } else { - h.decSlicePod((*[]Pod)(yyv1393), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1388) - } // end switch yys1388 - } // end for yyj1388 - if !yyhl1388 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1395 int - var yyb1395 bool - var yyhl1395 bool = l >= 0 - yyj1395++ - if yyhl1395 { - yyb1395 = yyj1395 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1395 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1395 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePod((*[]Pod)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1395++ - if yyhl1395 { - yyb1395 = yyj1395 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1395 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1395 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1395++ - if yyhl1395 { - yyb1395 = yyj1395 > l - } else { - yyb1395 = r.CheckBreak() - } - if yyb1395 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1398 := &x.ListMeta - yym1399 := z.DecBinary() - _ = yym1399 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1398) { - } else { - z.DecFallback(yyv1398, false) - } - } - yyj1395++ - if yyhl1395 { - yyb1395 = yyj1395 > l - } else { - yyb1395 = r.CheckBreak() - } - if yyb1395 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1400 := &x.Items - yym1401 := z.DecBinary() - _ = yym1401 - if false { - } else { - h.decSlicePod((*[]Pod)(yyv1400), d) - } - } for { - yyj1395++ - if yyhl1395 { - yyb1395 = yyj1395 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1395 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1395 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1395-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x DNSPolicy) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1402 := z.EncBinary() - _ = yym1402 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -17765,8 +21925,8 @@ func (x *DNSPolicy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1403 := z.DecBinary() - _ = yym1403 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -17774,6 +21934,1276 @@ func (x *DNSPolicy) CodecDecodeSelf(d *codec1978.Decoder) { } } +func (x *NodeSelector) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.NodeSelectorTerms == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceNodeSelectorTerm(([]NodeSelectorTerm)(x.NodeSelectorTerms), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeSelectorTerms")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NodeSelectorTerms == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceNodeSelectorTerm(([]NodeSelectorTerm)(x.NodeSelectorTerms), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NodeSelector) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NodeSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "nodeSelectorTerms": + if r.TryDecodeAsNil() { + x.NodeSelectorTerms = nil + } else { + yyv4 := &x.NodeSelectorTerms + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceNodeSelectorTerm((*[]NodeSelectorTerm)(yyv4), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NodeSelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NodeSelectorTerms = nil + } else { + yyv7 := &x.NodeSelectorTerms + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceNodeSelectorTerm((*[]NodeSelectorTerm)(yyv7), d) + } + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *NodeSelectorTerm) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.MatchExpressions == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceNodeSelectorRequirement(([]NodeSelectorRequirement)(x.MatchExpressions), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("matchExpressions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.MatchExpressions == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceNodeSelectorRequirement(([]NodeSelectorRequirement)(x.MatchExpressions), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NodeSelectorTerm) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NodeSelectorTerm) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "matchExpressions": + if r.TryDecodeAsNil() { + x.MatchExpressions = nil + } else { + yyv4 := &x.MatchExpressions + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceNodeSelectorRequirement((*[]NodeSelectorRequirement)(yyv4), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NodeSelectorTerm) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MatchExpressions = nil + } else { + yyv7 := &x.MatchExpressions + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceNodeSelectorRequirement((*[]NodeSelectorRequirement)(yyv7), d) + } + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *NodeSelectorRequirement) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = len(x.Values) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("key")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + x.Operator.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("operator")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + x.Operator.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.Values == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + z.F.EncSliceStringV(x.Values, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("values")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Values == nil { + r.EncodeNil() + } else { + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + z.F.EncSliceStringV(x.Values, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NodeSelectorRequirement) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NodeSelectorRequirement) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + case "operator": + if r.TryDecodeAsNil() { + x.Operator = "" + } else { + x.Operator = NodeSelectorOperator(r.DecodeString()) + } + case "values": + if r.TryDecodeAsNil() { + x.Values = nil + } else { + yyv6 := &x.Values + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + z.F.DecSliceStringX(yyv6, false, d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NodeSelectorRequirement) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Operator = "" + } else { + x.Operator = NodeSelectorOperator(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Values = nil + } else { + yyv11 := &x.Values + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + z.F.DecSliceStringX(yyv11, false, d) + } + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x NodeSelectorOperator) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x)) + } +} + +func (x *NodeSelectorOperator) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() + } +} + +func (x *Affinity) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.NodeAffinity != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.NodeAffinity == nil { + r.EncodeNil() + } else { + x.NodeAffinity.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeAffinity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NodeAffinity == nil { + r.EncodeNil() + } else { + x.NodeAffinity.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *Affinity) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *Affinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "nodeAffinity": + if r.TryDecodeAsNil() { + if x.NodeAffinity != nil { + x.NodeAffinity = nil + } + } else { + if x.NodeAffinity == nil { + x.NodeAffinity = new(NodeAffinity) + } + x.NodeAffinity.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *Affinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l + } else { + yyb5 = r.CheckBreak() + } + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.NodeAffinity != nil { + x.NodeAffinity = nil + } + } else { + if x.NodeAffinity == nil { + x.NodeAffinity = new(NodeAffinity) + } + x.NodeAffinity.CodecDecodeSelf(d) + } + for { + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l + } else { + yyb5 = r.CheckBreak() + } + if yyb5 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil + yyq2[1] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { + r.EncodeNil() + } else { + x.RequiredDuringSchedulingIgnoredDuringExecution.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingIgnoredDuringExecution")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { + r.EncodeNil() + } else { + x.RequiredDuringSchedulingIgnoredDuringExecution.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("preferredDuringSchedulingIgnoredDuringExecution")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NodeAffinity) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "requiredDuringSchedulingIgnoredDuringExecution": + if r.TryDecodeAsNil() { + if x.RequiredDuringSchedulingIgnoredDuringExecution != nil { + x.RequiredDuringSchedulingIgnoredDuringExecution = nil + } + } else { + if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { + x.RequiredDuringSchedulingIgnoredDuringExecution = new(NodeSelector) + } + x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d) + } + case "preferredDuringSchedulingIgnoredDuringExecution": + if r.TryDecodeAsNil() { + x.PreferredDuringSchedulingIgnoredDuringExecution = nil + } else { + yyv5 := &x.PreferredDuringSchedulingIgnoredDuringExecution + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv5), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.RequiredDuringSchedulingIgnoredDuringExecution != nil { + x.RequiredDuringSchedulingIgnoredDuringExecution = nil + } + } else { + if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { + x.RequiredDuringSchedulingIgnoredDuringExecution = new(NodeSelector) + } + x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PreferredDuringSchedulingIgnoredDuringExecution = nil + } else { + yyv9 := &x.PreferredDuringSchedulingIgnoredDuringExecution + yym10 := z.DecBinary() + _ = yym10 + if false { + } else { + h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv9), d) + } + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PreferredSchedulingTerm) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Weight)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("weight")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Weight)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.Preference + yy7.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("preference")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Preference + yy9.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PreferredSchedulingTerm) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PreferredSchedulingTerm) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "weight": + if r.TryDecodeAsNil() { + x.Weight = 0 + } else { + x.Weight = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "preference": + if r.TryDecodeAsNil() { + x.Preference = NodeSelectorTerm{} + } else { + yyv5 := &x.Preference + yyv5.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PreferredSchedulingTerm) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Weight = 0 + } else { + x.Weight = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Preference = NodeSelectorTerm{} + } else { + yyv8 := &x.Preference + yyv8.CodecDecodeSelf(d) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) @@ -17781,178 +23211,199 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1404 := z.EncBinary() - _ = yym1404 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1405 := !z.EncBinary() - yy2arr1405 := z.EncBasicHandle().StructToArray - var yyq1405 [11]bool - _, _, _ = yysep1405, yyq1405, yy2arr1405 - const yyr1405 bool = false - yyq1405[2] = x.RestartPolicy != "" - yyq1405[3] = x.TerminationGracePeriodSeconds != nil - yyq1405[4] = x.ActiveDeadlineSeconds != nil - yyq1405[5] = x.DNSPolicy != "" - yyq1405[6] = len(x.NodeSelector) != 0 - yyq1405[8] = x.NodeName != "" - yyq1405[9] = x.SecurityContext != nil - yyq1405[10] = len(x.ImagePullSecrets) != 0 - if yyr1405 || yy2arr1405 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [11]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.RestartPolicy != "" + yyq2[3] = x.TerminationGracePeriodSeconds != nil + yyq2[4] = x.ActiveDeadlineSeconds != nil + yyq2[5] = x.DNSPolicy != "" + yyq2[6] = len(x.NodeSelector) != 0 + yyq2[8] = x.NodeName != "" + yyq2[9] = x.SecurityContext != nil + yyq2[10] = len(x.ImagePullSecrets) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(11) } else { - var yynn1405 int = 3 - for _, b := range yyq1405 { + yynn2 = 3 + for _, b := range yyq2 { if b { - yynn1405++ + yynn2++ } } - r.EncodeMapStart(yynn1405) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1405 || yy2arr1405 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Volumes == nil { r.EncodeNil() } else { - yym1407 := z.EncBinary() - _ = yym1407 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceVolume(([]Volume)(x.Volumes), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Volumes == nil { r.EncodeNil() } else { - yym1408 := z.EncBinary() - _ = yym1408 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceVolume(([]Volume)(x.Volumes), e) } } } - if yyr1405 || yy2arr1405 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Containers == nil { r.EncodeNil() } else { - yym1410 := z.EncBinary() - _ = yym1410 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSliceContainer(([]Container)(x.Containers), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containers")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Containers == nil { r.EncodeNil() } else { - yym1411 := z.EncBinary() - _ = yym1411 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSliceContainer(([]Container)(x.Containers), e) } } } - if yyr1405 || yy2arr1405 { - if yyq1405[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { x.RestartPolicy.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1405[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("restartPolicy")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.RestartPolicy.CodecEncodeSelf(e) } } - if yyr1405 || yy2arr1405 { - if yyq1405[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.TerminationGracePeriodSeconds == nil { r.EncodeNil() } else { - yy1414 := *x.TerminationGracePeriodSeconds - yym1415 := z.EncBinary() - _ = yym1415 + yy13 := *x.TerminationGracePeriodSeconds + yym14 := z.EncBinary() + _ = yym14 if false { } else { - r.EncodeInt(int64(yy1414)) + r.EncodeInt(int64(yy13)) } } } else { r.EncodeNil() } } else { - if yyq1405[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("terminationGracePeriodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TerminationGracePeriodSeconds == nil { r.EncodeNil() } else { - yy1416 := *x.TerminationGracePeriodSeconds - yym1417 := z.EncBinary() - _ = yym1417 + yy15 := *x.TerminationGracePeriodSeconds + yym16 := z.EncBinary() + _ = yym16 if false { } else { - r.EncodeInt(int64(yy1416)) + r.EncodeInt(int64(yy15)) } } } } - if yyr1405 || yy2arr1405 { - if yyq1405[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.ActiveDeadlineSeconds == nil { r.EncodeNil() } else { - yy1419 := *x.ActiveDeadlineSeconds - yym1420 := z.EncBinary() - _ = yym1420 + yy18 := *x.ActiveDeadlineSeconds + yym19 := z.EncBinary() + _ = yym19 if false { } else { - r.EncodeInt(int64(yy1419)) + r.EncodeInt(int64(yy18)) } } } else { r.EncodeNil() } } else { - if yyq1405[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("activeDeadlineSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ActiveDeadlineSeconds == nil { r.EncodeNil() } else { - yy1421 := *x.ActiveDeadlineSeconds - yym1422 := z.EncBinary() - _ = yym1422 + yy20 := *x.ActiveDeadlineSeconds + yym21 := z.EncBinary() + _ = yym21 if false { } else { - r.EncodeInt(int64(yy1421)) + r.EncodeInt(int64(yy20)) } } } } - if yyr1405 || yy2arr1405 { - if yyq1405[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { x.DNSPolicy.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1405[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("dnsPolicy")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.DNSPolicy.CodecEncodeSelf(e) } } - if yyr1405 || yy2arr1405 { - if yyq1405[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.NodeSelector == nil { r.EncodeNil() } else { - yym1425 := z.EncBinary() - _ = yym1425 + yym26 := z.EncBinary() + _ = yym26 if false { } else { z.F.EncMapStringStringV(x.NodeSelector, false, e) @@ -17962,13 +23413,15 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1405[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nodeSelector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.NodeSelector == nil { r.EncodeNil() } else { - yym1426 := z.EncBinary() - _ = yym1426 + yym27 := z.EncBinary() + _ = yym27 if false { } else { z.F.EncMapStringStringV(x.NodeSelector, false, e) @@ -17976,26 +23429,30 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1405 || yy2arr1405 { - yym1428 := z.EncBinary() - _ = yym1428 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym29 := z.EncBinary() + _ = yym29 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ServiceAccountName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("serviceAccountName")) - yym1429 := z.EncBinary() - _ = yym1429 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym30 := z.EncBinary() + _ = yym30 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ServiceAccountName)) } } - if yyr1405 || yy2arr1405 { - if yyq1405[8] { - yym1431 := z.EncBinary() - _ = yym1431 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + yym32 := z.EncBinary() + _ = yym32 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.NodeName)) @@ -18004,18 +23461,21 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1405[8] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nodeName")) - yym1432 := z.EncBinary() - _ = yym1432 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym33 := z.EncBinary() + _ = yym33 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.NodeName)) } } } - if yyr1405 || yy2arr1405 { - if yyq1405[9] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { if x.SecurityContext == nil { r.EncodeNil() } else { @@ -18025,8 +23485,10 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1405[9] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("securityContext")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SecurityContext == nil { r.EncodeNil() } else { @@ -18034,13 +23496,14 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1405 || yy2arr1405 { - if yyq1405[10] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { if x.ImagePullSecrets == nil { r.EncodeNil() } else { - yym1435 := z.EncBinary() - _ = yym1435 + yym38 := z.EncBinary() + _ = yym38 if false { } else { h.encSliceLocalObjectReference(([]LocalObjectReference)(x.ImagePullSecrets), e) @@ -18050,13 +23513,15 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1405[10] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("imagePullSecrets")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ImagePullSecrets == nil { r.EncodeNil() } else { - yym1436 := z.EncBinary() - _ = yym1436 + yym39 := z.EncBinary() + _ = yym39 if false { } else { h.encSliceLocalObjectReference(([]LocalObjectReference)(x.ImagePullSecrets), e) @@ -18064,8 +23529,10 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1405 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -18075,24 +23542,25 @@ func (x *PodSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1437 := z.DecBinary() - _ = yym1437 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1438 := r.ReadMapStart() - if yyl1438 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1438, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1438 := r.ReadArrayStart() - if yyl1438 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1438, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -18104,12 +23572,12 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1439Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1439Slc - var yyhl1439 bool = l >= 0 - for yyj1439 := 0; ; yyj1439++ { - if yyhl1439 { - if yyj1439 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -18117,31 +23585,33 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1439Slc = r.DecodeBytes(yys1439Slc, true, true) - yys1439 := string(yys1439Slc) - switch yys1439 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "volumes": if r.TryDecodeAsNil() { x.Volumes = nil } else { - yyv1440 := &x.Volumes - yym1441 := z.DecBinary() - _ = yym1441 + yyv4 := &x.Volumes + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceVolume((*[]Volume)(yyv1440), d) + h.decSliceVolume((*[]Volume)(yyv4), d) } } case "containers": if r.TryDecodeAsNil() { x.Containers = nil } else { - yyv1442 := &x.Containers - yym1443 := z.DecBinary() - _ = yym1443 + yyv6 := &x.Containers + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceContainer((*[]Container)(yyv1442), d) + h.decSliceContainer((*[]Container)(yyv6), d) } } case "restartPolicy": @@ -18159,8 +23629,8 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.TerminationGracePeriodSeconds == nil { x.TerminationGracePeriodSeconds = new(int64) } - yym1446 := z.DecBinary() - _ = yym1446 + yym10 := z.DecBinary() + _ = yym10 if false { } else { *((*int64)(x.TerminationGracePeriodSeconds)) = int64(r.DecodeInt(64)) @@ -18175,8 +23645,8 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.ActiveDeadlineSeconds == nil { x.ActiveDeadlineSeconds = new(int64) } - yym1448 := z.DecBinary() - _ = yym1448 + yym12 := z.DecBinary() + _ = yym12 if false { } else { *((*int64)(x.ActiveDeadlineSeconds)) = int64(r.DecodeInt(64)) @@ -18192,12 +23662,12 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.NodeSelector = nil } else { - yyv1450 := &x.NodeSelector - yym1451 := z.DecBinary() - _ = yym1451 + yyv14 := &x.NodeSelector + yym15 := z.DecBinary() + _ = yym15 if false { } else { - z.F.DecMapStringStringX(yyv1450, false, d) + z.F.DecMapStringStringX(yyv14, false, d) } } case "serviceAccountName": @@ -18227,97 +23697,99 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.ImagePullSecrets = nil } else { - yyv1455 := &x.ImagePullSecrets - yym1456 := z.DecBinary() - _ = yym1456 + yyv19 := &x.ImagePullSecrets + yym20 := z.DecBinary() + _ = yym20 if false { } else { - h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv1455), d) + h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv19), d) } } default: - z.DecStructFieldNotFound(-1, yys1439) - } // end switch yys1439 - } // end for yyj1439 - if !yyhl1439 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1457 int - var yyb1457 bool - var yyhl1457 bool = l >= 0 - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + var yyj21 int + var yyb21 bool + var yyhl21 bool = l >= 0 + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Volumes = nil } else { - yyv1458 := &x.Volumes - yym1459 := z.DecBinary() - _ = yym1459 + yyv22 := &x.Volumes + yym23 := z.DecBinary() + _ = yym23 if false { } else { - h.decSliceVolume((*[]Volume)(yyv1458), d) + h.decSliceVolume((*[]Volume)(yyv22), d) } } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Containers = nil } else { - yyv1460 := &x.Containers - yym1461 := z.DecBinary() - _ = yym1461 + yyv24 := &x.Containers + yym25 := z.DecBinary() + _ = yym25 if false { } else { - h.decSliceContainer((*[]Container)(yyv1460), d) + h.decSliceContainer((*[]Container)(yyv24), d) } } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RestartPolicy = "" } else { x.RestartPolicy = RestartPolicy(r.DecodeString()) } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.TerminationGracePeriodSeconds != nil { x.TerminationGracePeriodSeconds = nil @@ -18326,23 +23798,24 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.TerminationGracePeriodSeconds == nil { x.TerminationGracePeriodSeconds = new(int64) } - yym1464 := z.DecBinary() - _ = yym1464 + yym28 := z.DecBinary() + _ = yym28 if false { } else { *((*int64)(x.TerminationGracePeriodSeconds)) = int64(r.DecodeInt(64)) } } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ActiveDeadlineSeconds != nil { x.ActiveDeadlineSeconds = nil @@ -18351,89 +23824,94 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.ActiveDeadlineSeconds == nil { x.ActiveDeadlineSeconds = new(int64) } - yym1466 := z.DecBinary() - _ = yym1466 + yym30 := z.DecBinary() + _ = yym30 if false { } else { *((*int64)(x.ActiveDeadlineSeconds)) = int64(r.DecodeInt(64)) } } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DNSPolicy = "" } else { x.DNSPolicy = DNSPolicy(r.DecodeString()) } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NodeSelector = nil } else { - yyv1468 := &x.NodeSelector - yym1469 := z.DecBinary() - _ = yym1469 + yyv32 := &x.NodeSelector + yym33 := z.DecBinary() + _ = yym33 if false { } else { - z.F.DecMapStringStringX(yyv1468, false, d) + z.F.DecMapStringStringX(yyv32, false, d) } } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ServiceAccountName = "" } else { x.ServiceAccountName = string(r.DecodeString()) } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NodeName = "" } else { x.NodeName = string(r.DecodeString()) } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SecurityContext != nil { x.SecurityContext = nil @@ -18444,40 +23922,42 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.SecurityContext.CodecDecodeSelf(d) } - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ImagePullSecrets = nil } else { - yyv1473 := &x.ImagePullSecrets - yym1474 := z.DecBinary() - _ = yym1474 + yyv37 := &x.ImagePullSecrets + yym38 := z.DecBinary() + _ = yym38 if false { } else { - h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv1473), d) + h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv37), d) } } for { - yyj1457++ - if yyhl1457 { - yyb1457 = yyj1457 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb1457 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb1457 { + if yyb21 { break } - z.DecStructFieldNotFound(yyj1457-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj21-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { @@ -18487,38 +23967,42 @@ func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1475 := z.EncBinary() - _ = yym1475 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1476 := !z.EncBinary() - yy2arr1476 := z.EncBasicHandle().StructToArray - var yyq1476 [7]bool - _, _, _ = yysep1476, yyq1476, yy2arr1476 - const yyr1476 bool = false - yyq1476[0] = x.HostNetwork != false - yyq1476[1] = x.HostPID != false - yyq1476[2] = x.HostIPC != false - yyq1476[3] = len(x.SupplementalGroups) != 0 - yyq1476[4] = x.SELinuxOptions != nil - yyq1476[5] = x.RunAsUser != nil - yyq1476[6] = x.RunAsNonRoot != nil - if yyr1476 || yy2arr1476 { - r.EncodeArrayStart(7) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.HostNetwork != false + yyq2[1] = x.HostPID != false + yyq2[2] = x.HostIPC != false + yyq2[3] = x.SELinuxOptions != nil + yyq2[4] = x.RunAsUser != nil + yyq2[5] = x.RunAsNonRoot != nil + yyq2[6] = len(x.SupplementalGroups) != 0 + yyq2[7] = x.FSGroup != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(8) } else { - var yynn1476 int = 0 - for _, b := range yyq1476 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1476++ + yynn2++ } } - r.EncodeMapStart(yynn1476) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1476 || yy2arr1476 { - if yyq1476[0] { - yym1478 := z.EncBinary() - _ = yym1478 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeBool(bool(x.HostNetwork)) @@ -18527,20 +24011,23 @@ func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1476[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostNetwork")) - yym1479 := z.EncBinary() - _ = yym1479 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeBool(bool(x.HostNetwork)) } } } - if yyr1476 || yy2arr1476 { - if yyq1476[1] { - yym1481 := z.EncBinary() - _ = yym1481 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeBool(bool(x.HostPID)) @@ -18549,20 +24036,23 @@ func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1476[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPID")) - yym1482 := z.EncBinary() - _ = yym1482 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeBool(bool(x.HostPID)) } } } - if yyr1476 || yy2arr1476 { - if yyq1476[2] { - yym1484 := z.EncBinary() - _ = yym1484 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeBool(bool(x.HostIPC)) @@ -18571,48 +24061,21 @@ func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1476[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostIPC")) - yym1485 := z.EncBinary() - _ = yym1485 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeBool(bool(x.HostIPC)) } } } - if yyr1476 || yy2arr1476 { - if yyq1476[3] { - if x.SupplementalGroups == nil { - r.EncodeNil() - } else { - yym1487 := z.EncBinary() - _ = yym1487 - if false { - } else { - z.F.EncSliceInt64V(x.SupplementalGroups, false, e) - } - } - } else { - r.EncodeNil() - } - } else { - if yyq1476[3] { - r.EncodeString(codecSelferC_UTF81234, string("supplementalGroups")) - if x.SupplementalGroups == nil { - r.EncodeNil() - } else { - yym1488 := z.EncBinary() - _ = yym1488 - if false { - } else { - z.F.EncSliceInt64V(x.SupplementalGroups, false, e) - } - } - } - } - if yyr1476 || yy2arr1476 { - if yyq1476[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.SELinuxOptions == nil { r.EncodeNil() } else { @@ -18622,8 +24085,10 @@ func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1476[4] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("seLinuxOptions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SELinuxOptions == nil { r.EncodeNil() } else { @@ -18631,72 +24096,148 @@ func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1476 || yy2arr1476 { - if yyq1476[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.RunAsUser == nil { r.EncodeNil() } else { - yy1491 := *x.RunAsUser - yym1492 := z.EncBinary() - _ = yym1492 + yy16 := *x.RunAsUser + yym17 := z.EncBinary() + _ = yym17 if false { } else { - r.EncodeInt(int64(yy1491)) + r.EncodeInt(int64(yy16)) } } } else { r.EncodeNil() } } else { - if yyq1476[5] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("runAsUser")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RunAsUser == nil { r.EncodeNil() } else { - yy1493 := *x.RunAsUser - yym1494 := z.EncBinary() - _ = yym1494 + yy18 := *x.RunAsUser + yym19 := z.EncBinary() + _ = yym19 if false { } else { - r.EncodeInt(int64(yy1493)) + r.EncodeInt(int64(yy18)) } } } } - if yyr1476 || yy2arr1476 { - if yyq1476[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.RunAsNonRoot == nil { r.EncodeNil() } else { - yy1496 := *x.RunAsNonRoot - yym1497 := z.EncBinary() - _ = yym1497 + yy21 := *x.RunAsNonRoot + yym22 := z.EncBinary() + _ = yym22 if false { } else { - r.EncodeBool(bool(yy1496)) + r.EncodeBool(bool(yy21)) } } } else { r.EncodeNil() } } else { - if yyq1476[6] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("runAsNonRoot")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RunAsNonRoot == nil { r.EncodeNil() } else { - yy1498 := *x.RunAsNonRoot - yym1499 := z.EncBinary() - _ = yym1499 + yy23 := *x.RunAsNonRoot + yym24 := z.EncBinary() + _ = yym24 if false { } else { - r.EncodeBool(bool(yy1498)) + r.EncodeBool(bool(yy23)) } } } } - if yysep1476 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + if x.SupplementalGroups == nil { + r.EncodeNil() + } else { + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + z.F.EncSliceInt64V(x.SupplementalGroups, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("supplementalGroups")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SupplementalGroups == nil { + r.EncodeNil() + } else { + yym27 := z.EncBinary() + _ = yym27 + if false { + } else { + z.F.EncSliceInt64V(x.SupplementalGroups, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + if x.FSGroup == nil { + r.EncodeNil() + } else { + yy29 := *x.FSGroup + yym30 := z.EncBinary() + _ = yym30 + if false { + } else { + r.EncodeInt(int64(yy29)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fsGroup")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.FSGroup == nil { + r.EncodeNil() + } else { + yy31 := *x.FSGroup + yym32 := z.EncBinary() + _ = yym32 + if false { + } else { + r.EncodeInt(int64(yy31)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -18706,24 +24247,25 @@ func (x *PodSecurityContext) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1500 := z.DecBinary() - _ = yym1500 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1501 := r.ReadMapStart() - if yyl1501 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1501, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1501 := r.ReadArrayStart() - if yyl1501 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1501, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -18735,12 +24277,12 @@ func (x *PodSecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1502Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1502Slc - var yyhl1502 bool = l >= 0 - for yyj1502 := 0; ; yyj1502++ { - if yyhl1502 { - if yyj1502 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -18748,9 +24290,11 @@ func (x *PodSecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys1502Slc = r.DecodeBytes(yys1502Slc, true, true) - yys1502 := string(yys1502Slc) - switch yys1502 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "hostNetwork": if r.TryDecodeAsNil() { x.HostNetwork = false @@ -18769,18 +24313,6 @@ func (x *PodSecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) } else { x.HostIPC = bool(r.DecodeBool()) } - case "supplementalGroups": - if r.TryDecodeAsNil() { - x.SupplementalGroups = nil - } else { - yyv1506 := &x.SupplementalGroups - yym1507 := z.DecBinary() - _ = yym1507 - if false { - } else { - z.F.DecSliceInt64X(yyv1506, false, d) - } - } case "seLinuxOptions": if r.TryDecodeAsNil() { if x.SELinuxOptions != nil { @@ -18801,8 +24333,8 @@ func (x *PodSecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) if x.RunAsUser == nil { x.RunAsUser = new(int64) } - yym1510 := z.DecBinary() - _ = yym1510 + yym9 := z.DecBinary() + _ = yym9 if false { } else { *((*int64)(x.RunAsUser)) = int64(r.DecodeInt(64)) @@ -18817,105 +24349,114 @@ func (x *PodSecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) if x.RunAsNonRoot == nil { x.RunAsNonRoot = new(bool) } - yym1512 := z.DecBinary() - _ = yym1512 + yym11 := z.DecBinary() + _ = yym11 if false { } else { *((*bool)(x.RunAsNonRoot)) = r.DecodeBool() } } + case "supplementalGroups": + if r.TryDecodeAsNil() { + x.SupplementalGroups = nil + } else { + yyv12 := &x.SupplementalGroups + yym13 := z.DecBinary() + _ = yym13 + if false { + } else { + z.F.DecSliceInt64X(yyv12, false, d) + } + } + case "fsGroup": + if r.TryDecodeAsNil() { + if x.FSGroup != nil { + x.FSGroup = nil + } + } else { + if x.FSGroup == nil { + x.FSGroup = new(int64) + } + yym15 := z.DecBinary() + _ = yym15 + if false { + } else { + *((*int64)(x.FSGroup)) = int64(r.DecodeInt(64)) + } + } default: - z.DecStructFieldNotFound(-1, yys1502) - } // end switch yys1502 - } // end for yyj1502 - if !yyhl1502 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodSecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1513 int - var yyb1513 bool - var yyhl1513 bool = l >= 0 - yyj1513++ - if yyhl1513 { - yyb1513 = yyj1513 > l + var yyj16 int + var yyb16 bool + var yyhl16 bool = l >= 0 + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1513 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1513 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostNetwork = false } else { x.HostNetwork = bool(r.DecodeBool()) } - yyj1513++ - if yyhl1513 { - yyb1513 = yyj1513 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1513 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1513 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostPID = false } else { x.HostPID = bool(r.DecodeBool()) } - yyj1513++ - if yyhl1513 { - yyb1513 = yyj1513 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1513 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1513 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostIPC = false } else { x.HostIPC = bool(r.DecodeBool()) } - yyj1513++ - if yyhl1513 { - yyb1513 = yyj1513 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1513 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1513 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.SupplementalGroups = nil - } else { - yyv1517 := &x.SupplementalGroups - yym1518 := z.DecBinary() - _ = yym1518 - if false { - } else { - z.F.DecSliceInt64X(yyv1517, false, d) - } - } - yyj1513++ - if yyhl1513 { - yyb1513 = yyj1513 > l - } else { - yyb1513 = r.CheckBreak() - } - if yyb1513 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SELinuxOptions != nil { x.SELinuxOptions = nil @@ -18926,16 +24467,17 @@ func (x *PodSecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decode } x.SELinuxOptions.CodecDecodeSelf(d) } - yyj1513++ - if yyhl1513 { - yyb1513 = yyj1513 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1513 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1513 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RunAsUser != nil { x.RunAsUser = nil @@ -18944,23 +24486,24 @@ func (x *PodSecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decode if x.RunAsUser == nil { x.RunAsUser = new(int64) } - yym1521 := z.DecBinary() - _ = yym1521 + yym22 := z.DecBinary() + _ = yym22 if false { } else { *((*int64)(x.RunAsUser)) = int64(r.DecodeInt(64)) } } - yyj1513++ - if yyhl1513 { - yyb1513 = yyj1513 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1513 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1513 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RunAsNonRoot != nil { x.RunAsNonRoot = nil @@ -18969,26 +24512,75 @@ func (x *PodSecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decode if x.RunAsNonRoot == nil { x.RunAsNonRoot = new(bool) } - yym1523 := z.DecBinary() - _ = yym1523 + yym24 := z.DecBinary() + _ = yym24 if false { } else { *((*bool)(x.RunAsNonRoot)) = r.DecodeBool() } } - for { - yyj1513++ - if yyhl1513 { - yyb1513 = yyj1513 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SupplementalGroups = nil + } else { + yyv25 := &x.SupplementalGroups + yym26 := z.DecBinary() + _ = yym26 + if false { } else { - yyb1513 = r.CheckBreak() + z.F.DecSliceInt64X(yyv25, false, d) } - if yyb1513 { + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FSGroup != nil { + x.FSGroup = nil + } + } else { + if x.FSGroup == nil { + x.FSGroup = new(int64) + } + yym28 := z.DecBinary() + _ = yym28 + if false { + } else { + *((*int64)(x.FSGroup)) = int64(r.DecodeInt(64)) + } + } + for { + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { break } - z.DecStructFieldNotFound(yyj1513-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj16-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -18998,54 +24590,60 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1524 := z.EncBinary() - _ = yym1524 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1525 := !z.EncBinary() - yy2arr1525 := z.EncBasicHandle().StructToArray - var yyq1525 [8]bool - _, _, _ = yysep1525, yyq1525, yy2arr1525 - const yyr1525 bool = false - yyq1525[0] = x.Phase != "" - yyq1525[1] = len(x.Conditions) != 0 - yyq1525[2] = x.Message != "" - yyq1525[3] = x.Reason != "" - yyq1525[4] = x.HostIP != "" - yyq1525[5] = x.PodIP != "" - yyq1525[6] = x.StartTime != nil - yyq1525[7] = len(x.ContainerStatuses) != 0 - if yyr1525 || yy2arr1525 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Phase != "" + yyq2[1] = len(x.Conditions) != 0 + yyq2[2] = x.Message != "" + yyq2[3] = x.Reason != "" + yyq2[4] = x.HostIP != "" + yyq2[5] = x.PodIP != "" + yyq2[6] = x.StartTime != nil + yyq2[7] = len(x.ContainerStatuses) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - var yynn1525 int = 0 - for _, b := range yyq1525 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1525++ + yynn2++ } } - r.EncodeMapStart(yynn1525) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1525 || yy2arr1525 { - if yyq1525[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1525[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yyr1525 || yy2arr1525 { - if yyq1525[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Conditions == nil { r.EncodeNil() } else { - yym1528 := z.EncBinary() - _ = yym1528 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSlicePodCondition(([]PodCondition)(x.Conditions), e) @@ -19055,13 +24653,15 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1525[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("conditions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Conditions == nil { r.EncodeNil() } else { - yym1529 := z.EncBinary() - _ = yym1529 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSlicePodCondition(([]PodCondition)(x.Conditions), e) @@ -19069,10 +24669,11 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1525 || yy2arr1525 { - if yyq1525[2] { - yym1531 := z.EncBinary() - _ = yym1531 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -19081,20 +24682,23 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1525[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym1532 := z.EncBinary() - _ = yym1532 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr1525 || yy2arr1525 { - if yyq1525[3] { - yym1534 := z.EncBinary() - _ = yym1534 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -19103,20 +24707,23 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1525[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym1535 := z.EncBinary() - _ = yym1535 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr1525 || yy2arr1525 { - if yyq1525[4] { - yym1537 := z.EncBinary() - _ = yym1537 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.HostIP)) @@ -19125,20 +24732,23 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1525[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostIP")) - yym1538 := z.EncBinary() - _ = yym1538 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.HostIP)) } } } - if yyr1525 || yy2arr1525 { - if yyq1525[5] { - yym1540 := z.EncBinary() - _ = yym1540 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PodIP)) @@ -19147,28 +24757,31 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1525[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("podIP")) - yym1541 := z.EncBinary() - _ = yym1541 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PodIP)) } } } - if yyr1525 || yy2arr1525 { - if yyq1525[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.StartTime == nil { r.EncodeNil() } else { - yym1543 := z.EncBinary() - _ = yym1543 + yym22 := z.EncBinary() + _ = yym22 if false { } else if z.HasExtensions() && z.EncExt(x.StartTime) { - } else if yym1543 { + } else if yym22 { z.EncBinaryMarshal(x.StartTime) - } else if !yym1543 && z.IsJSONHandle() { + } else if !yym22 && z.IsJSONHandle() { z.EncJSONMarshal(x.StartTime) } else { z.EncFallback(x.StartTime) @@ -19178,18 +24791,20 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1525[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("startTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.StartTime == nil { r.EncodeNil() } else { - yym1544 := z.EncBinary() - _ = yym1544 + yym23 := z.EncBinary() + _ = yym23 if false { } else if z.HasExtensions() && z.EncExt(x.StartTime) { - } else if yym1544 { + } else if yym23 { z.EncBinaryMarshal(x.StartTime) - } else if !yym1544 && z.IsJSONHandle() { + } else if !yym23 && z.IsJSONHandle() { z.EncJSONMarshal(x.StartTime) } else { z.EncFallback(x.StartTime) @@ -19197,13 +24812,14 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1525 || yy2arr1525 { - if yyq1525[7] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { if x.ContainerStatuses == nil { r.EncodeNil() } else { - yym1546 := z.EncBinary() - _ = yym1546 + yym25 := z.EncBinary() + _ = yym25 if false { } else { h.encSliceContainerStatus(([]ContainerStatus)(x.ContainerStatuses), e) @@ -19213,13 +24829,15 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1525[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerStatuses")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ContainerStatuses == nil { r.EncodeNil() } else { - yym1547 := z.EncBinary() - _ = yym1547 + yym26 := z.EncBinary() + _ = yym26 if false { } else { h.encSliceContainerStatus(([]ContainerStatus)(x.ContainerStatuses), e) @@ -19227,8 +24845,10 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1525 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -19238,24 +24858,25 @@ func (x *PodStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1548 := z.DecBinary() - _ = yym1548 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1549 := r.ReadMapStart() - if yyl1549 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1549, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1549 := r.ReadArrayStart() - if yyl1549 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1549, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -19267,12 +24888,12 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1550Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1550Slc - var yyhl1550 bool = l >= 0 - for yyj1550 := 0; ; yyj1550++ { - if yyhl1550 { - if yyj1550 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -19280,9 +24901,11 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1550Slc = r.DecodeBytes(yys1550Slc, true, true) - yys1550 := string(yys1550Slc) - switch yys1550 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "phase": if r.TryDecodeAsNil() { x.Phase = "" @@ -19293,12 +24916,12 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv1552 := &x.Conditions - yym1553 := z.DecBinary() - _ = yym1553 + yyv5 := &x.Conditions + yym6 := z.DecBinary() + _ = yym6 if false { } else { - h.decSlicePodCondition((*[]PodCondition)(yyv1552), d) + h.decSlicePodCondition((*[]PodCondition)(yyv5), d) } } case "message": @@ -19334,13 +24957,13 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.StartTime == nil { x.StartTime = new(pkg2_unversioned.Time) } - yym1559 := z.DecBinary() - _ = yym1559 + yym12 := z.DecBinary() + _ = yym12 if false { } else if z.HasExtensions() && z.DecExt(x.StartTime) { - } else if yym1559 { + } else if yym12 { z.DecBinaryUnmarshal(x.StartTime) - } else if !yym1559 && z.IsJSONHandle() { + } else if !yym12 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.StartTime) } else { z.DecFallback(x.StartTime, false) @@ -19350,136 +24973,141 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.ContainerStatuses = nil } else { - yyv1560 := &x.ContainerStatuses - yym1561 := z.DecBinary() - _ = yym1561 + yyv13 := &x.ContainerStatuses + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceContainerStatus((*[]ContainerStatus)(yyv1560), d) + h.decSliceContainerStatus((*[]ContainerStatus)(yyv13), d) } } default: - z.DecStructFieldNotFound(-1, yys1550) - } // end switch yys1550 - } // end for yyj1550 - if !yyhl1550 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1562 int - var yyb1562 bool - var yyhl1562 bool = l >= 0 - yyj1562++ - if yyhl1562 { - yyb1562 = yyj1562 > l + var yyj15 int + var yyb15 bool + var yyhl15 bool = l >= 0 + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1562 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1562 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = PodPhase(r.DecodeString()) } - yyj1562++ - if yyhl1562 { - yyb1562 = yyj1562 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1562 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1562 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv1564 := &x.Conditions - yym1565 := z.DecBinary() - _ = yym1565 + yyv17 := &x.Conditions + yym18 := z.DecBinary() + _ = yym18 if false { } else { - h.decSlicePodCondition((*[]PodCondition)(yyv1564), d) + h.decSlicePodCondition((*[]PodCondition)(yyv17), d) } } - yyj1562++ - if yyhl1562 { - yyb1562 = yyj1562 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1562 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1562 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj1562++ - if yyhl1562 { - yyb1562 = yyj1562 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1562 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1562 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj1562++ - if yyhl1562 { - yyb1562 = yyj1562 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1562 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1562 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostIP = "" } else { x.HostIP = string(r.DecodeString()) } - yyj1562++ - if yyhl1562 { - yyb1562 = yyj1562 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1562 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1562 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.PodIP = "" } else { x.PodIP = string(r.DecodeString()) } - yyj1562++ - if yyhl1562 { - yyb1562 = yyj1562 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1562 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1562 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.StartTime != nil { x.StartTime = nil @@ -19488,52 +25116,54 @@ func (x *PodStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.StartTime == nil { x.StartTime = new(pkg2_unversioned.Time) } - yym1571 := z.DecBinary() - _ = yym1571 + yym24 := z.DecBinary() + _ = yym24 if false { } else if z.HasExtensions() && z.DecExt(x.StartTime) { - } else if yym1571 { + } else if yym24 { z.DecBinaryUnmarshal(x.StartTime) - } else if !yym1571 && z.IsJSONHandle() { + } else if !yym24 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.StartTime) } else { z.DecFallback(x.StartTime, false) } } - yyj1562++ - if yyhl1562 { - yyb1562 = yyj1562 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1562 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1562 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerStatuses = nil } else { - yyv1572 := &x.ContainerStatuses - yym1573 := z.DecBinary() - _ = yym1573 + yyv25 := &x.ContainerStatuses + yym26 := z.DecBinary() + _ = yym26 if false { } else { - h.decSliceContainerStatus((*[]ContainerStatus)(yyv1572), d) + h.decSliceContainerStatus((*[]ContainerStatus)(yyv25), d) } } for { - yyj1562++ - if yyhl1562 { - yyb1562 = yyj1562 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1562 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1562 { + if yyb15 { break } - z.DecStructFieldNotFound(yyj1562-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj15-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodStatusResult) CodecEncodeSelf(e *codec1978.Encoder) { @@ -19543,105 +25173,121 @@ func (x *PodStatusResult) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1574 := z.EncBinary() - _ = yym1574 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1575 := !z.EncBinary() - yy2arr1575 := z.EncBasicHandle().StructToArray - var yyq1575 [4]bool - _, _, _ = yysep1575, yyq1575, yy2arr1575 - const yyr1575 bool = false - yyq1575[0] = x.Kind != "" - yyq1575[1] = x.APIVersion != "" - yyq1575[2] = true - yyq1575[3] = true - if yyr1575 || yy2arr1575 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1575 int = 0 - for _, b := range yyq1575 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1575++ + yynn2++ } } - r.EncodeMapStart(yynn1575) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1575 || yy2arr1575 { - if yyq1575[0] { - yym1577 := z.EncBinary() - _ = yym1577 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1575[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1578 := z.EncBinary() - _ = yym1578 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1575 || yy2arr1575 { - if yyq1575[1] { - yym1580 := z.EncBinary() - _ = yym1580 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1575[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1581 := z.EncBinary() - _ = yym1581 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1575 || yy2arr1575 { - if yyq1575[2] { - yy1583 := &x.ObjectMeta - yy1583.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1575[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1584 := &x.ObjectMeta - yy1584.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1575 || yy2arr1575 { - if yyq1575[3] { - yy1586 := &x.Status - yy1586.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Status + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1575[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy1587 := &x.Status - yy1587.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Status + yy11.CodecEncodeSelf(e) } } - if yysep1575 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -19651,24 +25297,25 @@ func (x *PodStatusResult) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1588 := z.DecBinary() - _ = yym1588 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1589 := r.ReadMapStart() - if yyl1589 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1589, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1589 := r.ReadArrayStart() - if yyl1589 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1589, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -19680,12 +25327,12 @@ func (x *PodStatusResult) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1590Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1590Slc - var yyhl1590 bool = l >= 0 - for yyj1590 := 0; ; yyj1590++ { - if yyhl1590 { - if yyj1590 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -19693,9 +25340,25 @@ func (x *PodStatusResult) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1590Slc = r.DecodeBytes(yys1590Slc, true, true) - yys1590 := string(yys1590Slc) - switch yys1590 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = PodStatus{} + } else { + yyv5 := &x.Status + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -19708,111 +25371,100 @@ func (x *PodStatusResult) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1593 := &x.ObjectMeta - yyv1593.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = PodStatus{} - } else { - yyv1594 := &x.Status - yyv1594.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1590) - } // end switch yys1590 - } // end for yyj1590 - if !yyhl1590 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodStatusResult) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1595 int - var yyb1595 bool - var yyhl1595 bool = l >= 0 - yyj1595++ - if yyhl1595 { - yyb1595 = yyj1595 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1595 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1595 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = PodStatus{} + } else { + yyv10 := &x.Status + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1595++ - if yyhl1595 { - yyb1595 = yyj1595 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1595 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1595 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1595++ - if yyhl1595 { - yyb1595 = yyj1595 > l - } else { - yyb1595 = r.CheckBreak() - } - if yyb1595 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1598 := &x.ObjectMeta - yyv1598.CodecDecodeSelf(d) - } - yyj1595++ - if yyhl1595 { - yyb1595 = yyj1595 > l - } else { - yyb1595 = r.CheckBreak() - } - if yyb1595 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = PodStatus{} - } else { - yyv1599 := &x.Status - yyv1599.CodecDecodeSelf(d) - } for { - yyj1595++ - if yyhl1595 { - yyb1595 = yyj1595 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1595 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1595 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1595-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Pod) CodecEncodeSelf(e *codec1978.Encoder) { @@ -19822,120 +25474,139 @@ func (x *Pod) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1600 := z.EncBinary() - _ = yym1600 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1601 := !z.EncBinary() - yy2arr1601 := z.EncBasicHandle().StructToArray - var yyq1601 [5]bool - _, _, _ = yysep1601, yyq1601, yy2arr1601 - const yyr1601 bool = false - yyq1601[0] = x.Kind != "" - yyq1601[1] = x.APIVersion != "" - yyq1601[2] = true - yyq1601[3] = true - yyq1601[4] = true - if yyr1601 || yy2arr1601 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1601 int = 0 - for _, b := range yyq1601 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1601++ + yynn2++ } } - r.EncodeMapStart(yynn1601) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1601 || yy2arr1601 { - if yyq1601[0] { - yym1603 := z.EncBinary() - _ = yym1603 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1601[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1604 := z.EncBinary() - _ = yym1604 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1601 || yy2arr1601 { - if yyq1601[1] { - yym1606 := z.EncBinary() - _ = yym1606 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1601[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1607 := z.EncBinary() - _ = yym1607 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1601 || yy2arr1601 { - if yyq1601[2] { - yy1609 := &x.ObjectMeta - yy1609.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1601[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1610 := &x.ObjectMeta - yy1610.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1601 || yy2arr1601 { - if yyq1601[3] { - yy1612 := &x.Spec - yy1612.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1601[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1613 := &x.Spec - yy1613.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr1601 || yy2arr1601 { - if yyq1601[4] { - yy1615 := &x.Status - yy1615.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1601[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy1616 := &x.Status - yy1616.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep1601 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -19945,24 +25616,25 @@ func (x *Pod) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1617 := z.DecBinary() - _ = yym1617 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1618 := r.ReadMapStart() - if yyl1618 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1618, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1618 := r.ReadArrayStart() - if yyl1618 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1618, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -19974,12 +25646,12 @@ func (x *Pod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1619Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1619Slc - var yyhl1619 bool = l >= 0 - for yyj1619 := 0; ; yyj1619++ { - if yyhl1619 { - if yyj1619 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -19987,9 +25659,32 @@ func (x *Pod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1619Slc = r.DecodeBytes(yys1619Slc, true, true) - yys1619 := string(yys1619Slc) - switch yys1619 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = PodSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = PodStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -20002,134 +25697,117 @@ func (x *Pod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1622 := &x.ObjectMeta - yyv1622.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = PodSpec{} - } else { - yyv1623 := &x.Spec - yyv1623.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = PodStatus{} - } else { - yyv1624 := &x.Status - yyv1624.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1619) - } // end switch yys1619 - } // end for yyj1619 - if !yyhl1619 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Pod) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1625 int - var yyb1625 bool - var yyhl1625 bool = l >= 0 - yyj1625++ - if yyhl1625 { - yyb1625 = yyj1625 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1625 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1625 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = PodSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = PodStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1625++ - if yyhl1625 { - yyb1625 = yyj1625 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1625 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1625 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1625++ - if yyhl1625 { - yyb1625 = yyj1625 > l - } else { - yyb1625 = r.CheckBreak() - } - if yyb1625 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1628 := &x.ObjectMeta - yyv1628.CodecDecodeSelf(d) - } - yyj1625++ - if yyhl1625 { - yyb1625 = yyj1625 > l - } else { - yyb1625 = r.CheckBreak() - } - if yyb1625 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = PodSpec{} - } else { - yyv1629 := &x.Spec - yyv1629.CodecDecodeSelf(d) - } - yyj1625++ - if yyhl1625 { - yyb1625 = yyj1625 > l - } else { - yyb1625 = r.CheckBreak() - } - if yyb1625 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = PodStatus{} - } else { - yyv1630 := &x.Status - yyv1630.CodecDecodeSelf(d) - } for { - yyj1625++ - if yyhl1625 { - yyb1625 = yyj1625 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1625 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1625 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj1625-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodTemplateSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -20139,59 +25817,69 @@ func (x *PodTemplateSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1631 := z.EncBinary() - _ = yym1631 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1632 := !z.EncBinary() - yy2arr1632 := z.EncBasicHandle().StructToArray - var yyq1632 [2]bool - _, _, _ = yysep1632, yyq1632, yy2arr1632 - const yyr1632 bool = false - yyq1632[0] = true - yyq1632[1] = true - if yyr1632 || yy2arr1632 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1632 int = 0 - for _, b := range yyq1632 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1632++ + yynn2++ } } - r.EncodeMapStart(yynn1632) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1632 || yy2arr1632 { - if yyq1632[0] { - yy1634 := &x.ObjectMeta - yy1634.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1632[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1635 := &x.ObjectMeta - yy1635.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1632 || yy2arr1632 { - if yyq1632[1] { - yy1637 := &x.Spec - yy1637.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1632[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1638 := &x.Spec - yy1638.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yysep1632 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -20201,24 +25889,25 @@ func (x *PodTemplateSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1639 := z.DecBinary() - _ = yym1639 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1640 := r.ReadMapStart() - if yyl1640 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1640, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1640 := r.ReadArrayStart() - if yyl1640 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1640, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -20230,12 +25919,12 @@ func (x *PodTemplateSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1641Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1641Slc - var yyhl1641 bool = l >= 0 - for yyj1641 := 0; ; yyj1641++ { - if yyhl1641 { - if yyj1641 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -20243,84 +25932,87 @@ func (x *PodTemplateSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1641Slc = r.DecodeBytes(yys1641Slc, true, true) - yys1641 := string(yys1641Slc) - switch yys1641 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "metadata": if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv1642 := &x.ObjectMeta - yyv1642.CodecDecodeSelf(d) + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) } case "spec": if r.TryDecodeAsNil() { x.Spec = PodSpec{} } else { - yyv1643 := &x.Spec - yyv1643.CodecDecodeSelf(d) + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1641) - } // end switch yys1641 - } // end for yyj1641 - if !yyhl1641 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodTemplateSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1644 int - var yyb1644 bool - var yyhl1644 bool = l >= 0 - yyj1644++ - if yyhl1644 { - yyb1644 = yyj1644 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1644 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1644 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv1645 := &x.ObjectMeta - yyv1645.CodecDecodeSelf(d) + yyv7 := &x.ObjectMeta + yyv7.CodecDecodeSelf(d) } - yyj1644++ - if yyhl1644 { - yyb1644 = yyj1644 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1644 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1644 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Spec = PodSpec{} } else { - yyv1646 := &x.Spec - yyv1646.CodecDecodeSelf(d) + yyv8 := &x.Spec + yyv8.CodecDecodeSelf(d) } for { - yyj1644++ - if yyhl1644 { - yyb1644 = yyj1644 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1644 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1644 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1644-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodTemplate) CodecEncodeSelf(e *codec1978.Encoder) { @@ -20330,105 +26022,121 @@ func (x *PodTemplate) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1647 := z.EncBinary() - _ = yym1647 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1648 := !z.EncBinary() - yy2arr1648 := z.EncBasicHandle().StructToArray - var yyq1648 [4]bool - _, _, _ = yysep1648, yyq1648, yy2arr1648 - const yyr1648 bool = false - yyq1648[0] = x.Kind != "" - yyq1648[1] = x.APIVersion != "" - yyq1648[2] = true - yyq1648[3] = true - if yyr1648 || yy2arr1648 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1648 int = 0 - for _, b := range yyq1648 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1648++ + yynn2++ } } - r.EncodeMapStart(yynn1648) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1648 || yy2arr1648 { - if yyq1648[0] { - yym1650 := z.EncBinary() - _ = yym1650 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1648[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1651 := z.EncBinary() - _ = yym1651 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1648 || yy2arr1648 { - if yyq1648[1] { - yym1653 := z.EncBinary() - _ = yym1653 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1648[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1654 := z.EncBinary() - _ = yym1654 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1648 || yy2arr1648 { - if yyq1648[2] { - yy1656 := &x.ObjectMeta - yy1656.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1648[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1657 := &x.ObjectMeta - yy1657.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1648 || yy2arr1648 { - if yyq1648[3] { - yy1659 := &x.Template - yy1659.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Template + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1648[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("template")) - yy1660 := &x.Template - yy1660.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Template + yy11.CodecEncodeSelf(e) } } - if yysep1648 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -20438,24 +26146,25 @@ func (x *PodTemplate) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1661 := z.DecBinary() - _ = yym1661 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1662 := r.ReadMapStart() - if yyl1662 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1662, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1662 := r.ReadArrayStart() - if yyl1662 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1662, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -20467,12 +26176,12 @@ func (x *PodTemplate) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1663Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1663Slc - var yyhl1663 bool = l >= 0 - for yyj1663 := 0; ; yyj1663++ { - if yyhl1663 { - if yyj1663 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -20480,9 +26189,25 @@ func (x *PodTemplate) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1663Slc = r.DecodeBytes(yys1663Slc, true, true) - yys1663 := string(yys1663Slc) - switch yys1663 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "template": + if r.TryDecodeAsNil() { + x.Template = PodTemplateSpec{} + } else { + yyv5 := &x.Template + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -20495,111 +26220,100 @@ func (x *PodTemplate) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1666 := &x.ObjectMeta - yyv1666.CodecDecodeSelf(d) - } - case "template": - if r.TryDecodeAsNil() { - x.Template = PodTemplateSpec{} - } else { - yyv1667 := &x.Template - yyv1667.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1663) - } // end switch yys1663 - } // end for yyj1663 - if !yyhl1663 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodTemplate) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1668 int - var yyb1668 bool - var yyhl1668 bool = l >= 0 - yyj1668++ - if yyhl1668 { - yyb1668 = yyj1668 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1668 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1668 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Template = PodTemplateSpec{} + } else { + yyv10 := &x.Template + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1668++ - if yyhl1668 { - yyb1668 = yyj1668 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1668 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1668 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1668++ - if yyhl1668 { - yyb1668 = yyj1668 > l - } else { - yyb1668 = r.CheckBreak() - } - if yyb1668 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1671 := &x.ObjectMeta - yyv1671.CodecDecodeSelf(d) - } - yyj1668++ - if yyhl1668 { - yyb1668 = yyj1668 > l - } else { - yyb1668 = r.CheckBreak() - } - if yyb1668 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Template = PodTemplateSpec{} - } else { - yyv1672 := &x.Template - yyv1672.CodecDecodeSelf(d) - } for { - yyj1668++ - if yyhl1668 { - yyb1668 = yyj1668 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1668 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1668 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1668-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodTemplateList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -20609,126 +26323,142 @@ func (x *PodTemplateList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1673 := z.EncBinary() - _ = yym1673 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1674 := !z.EncBinary() - yy2arr1674 := z.EncBasicHandle().StructToArray - var yyq1674 [4]bool - _, _, _ = yysep1674, yyq1674, yy2arr1674 - const yyr1674 bool = false - yyq1674[0] = x.Kind != "" - yyq1674[1] = x.APIVersion != "" - yyq1674[2] = true - if yyr1674 || yy2arr1674 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1674 int = 1 - for _, b := range yyq1674 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1674++ + yynn2++ } } - r.EncodeMapStart(yynn1674) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1674 || yy2arr1674 { - if yyq1674[0] { - yym1676 := z.EncBinary() - _ = yym1676 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1674[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1677 := z.EncBinary() - _ = yym1677 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1674 || yy2arr1674 { - if yyq1674[1] { - yym1679 := z.EncBinary() - _ = yym1679 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1674[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1680 := z.EncBinary() - _ = yym1680 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1674 || yy2arr1674 { - if yyq1674[2] { - yy1682 := &x.ListMeta - yym1683 := z.EncBinary() - _ = yym1683 - if false { - } else if z.HasExtensions() && z.EncExt(yy1682) { - } else { - z.EncFallback(yy1682) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1674[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1684 := &x.ListMeta - yym1685 := z.EncBinary() - _ = yym1685 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1684) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1684) + z.EncFallback(yy6) } } } - if yyr1674 || yy2arr1674 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1687 := z.EncBinary() - _ = yym1687 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSlicePodTemplate(([]PodTemplate)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1688 := z.EncBinary() - _ = yym1688 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSlicePodTemplate(([]PodTemplate)(x.Items), e) } } } - if yysep1674 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -20738,24 +26468,25 @@ func (x *PodTemplateList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1689 := z.DecBinary() - _ = yym1689 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1690 := r.ReadMapStart() - if yyl1690 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1690, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1690 := r.ReadArrayStart() - if yyl1690 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1690, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -20767,12 +26498,12 @@ func (x *PodTemplateList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1691Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1691Slc - var yyhl1691 bool = l >= 0 - for yyj1691 := 0; ; yyj1691++ { - if yyhl1691 { - if yyj1691 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -20780,9 +26511,36 @@ func (x *PodTemplateList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1691Slc = r.DecodeBytes(yys1691Slc, true, true) - yys1691 := string(yys1691Slc) - switch yys1691 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePodTemplate((*[]PodTemplate)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -20795,133 +26553,111 @@ func (x *PodTemplateList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1694 := &x.ListMeta - yym1695 := z.DecBinary() - _ = yym1695 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1694) { - } else { - z.DecFallback(yyv1694, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1696 := &x.Items - yym1697 := z.DecBinary() - _ = yym1697 - if false { - } else { - h.decSlicePodTemplate((*[]PodTemplate)(yyv1696), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1691) - } // end switch yys1691 - } // end for yyj1691 - if !yyhl1691 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodTemplateList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1698 int - var yyb1698 bool - var yyhl1698 bool = l >= 0 - yyj1698++ - if yyhl1698 { - yyb1698 = yyj1698 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1698 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1698 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePodTemplate((*[]PodTemplate)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1698++ - if yyhl1698 { - yyb1698 = yyj1698 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1698 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1698 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1698++ - if yyhl1698 { - yyb1698 = yyj1698 > l - } else { - yyb1698 = r.CheckBreak() - } - if yyb1698 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1701 := &x.ListMeta - yym1702 := z.DecBinary() - _ = yym1702 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1701) { - } else { - z.DecFallback(yyv1701, false) - } - } - yyj1698++ - if yyhl1698 { - yyb1698 = yyj1698 > l - } else { - yyb1698 = r.CheckBreak() - } - if yyb1698 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1703 := &x.Items - yym1704 := z.DecBinary() - _ = yym1704 - if false { - } else { - h.decSlicePodTemplate((*[]PodTemplate)(yyv1703), d) - } - } for { - yyj1698++ - if yyhl1698 { - yyb1698 = yyj1698 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1698 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1698 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1698-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -20931,70 +26667,79 @@ func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1705 := z.EncBinary() - _ = yym1705 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1706 := !z.EncBinary() - yy2arr1706 := z.EncBasicHandle().StructToArray - var yyq1706 [3]bool - _, _, _ = yysep1706, yyq1706, yy2arr1706 - const yyr1706 bool = false - yyq1706[2] = x.Template != nil - if yyr1706 || yy2arr1706 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Template != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1706 int = 2 - for _, b := range yyq1706 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn1706++ + yynn2++ } } - r.EncodeMapStart(yynn1706) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1706 || yy2arr1706 { - yym1708 := z.EncBinary() - _ = yym1708 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Replicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) - yym1709 := z.EncBinary() - _ = yym1709 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Replicas)) } } - if yyr1706 || yy2arr1706 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Selector == nil { r.EncodeNil() } else { - yym1711 := z.EncBinary() - _ = yym1711 + yym7 := z.EncBinary() + _ = yym7 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym1712 := z.EncBinary() - _ = yym1712 + yym8 := z.EncBinary() + _ = yym8 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) } } } - if yyr1706 || yy2arr1706 { - if yyq1706[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Template == nil { r.EncodeNil() } else { @@ -21004,8 +26749,10 @@ func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1706[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("template")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Template == nil { r.EncodeNil() } else { @@ -21013,8 +26760,10 @@ func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1706 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -21024,24 +26773,25 @@ func (x *ReplicationControllerSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1714 := z.DecBinary() - _ = yym1714 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1715 := r.ReadMapStart() - if yyl1715 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1715, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1715 := r.ReadArrayStart() - if yyl1715 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1715, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -21053,12 +26803,12 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromMap(l int, d *codec1978.D var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1716Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1716Slc - var yyhl1716 bool = l >= 0 - for yyj1716 := 0; ; yyj1716++ { - if yyhl1716 { - if yyj1716 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -21066,9 +26816,11 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromMap(l int, d *codec1978.D break } } - yys1716Slc = r.DecodeBytes(yys1716Slc, true, true) - yys1716 := string(yys1716Slc) - switch yys1716 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 @@ -21079,12 +26831,12 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromMap(l int, d *codec1978.D if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv1718 := &x.Selector - yym1719 := z.DecBinary() - _ = yym1719 + yyv5 := &x.Selector + yym6 := z.DecBinary() + _ = yym6 if false { } else { - z.F.DecMapStringStringX(yyv1718, false, d) + z.F.DecMapStringStringX(yyv5, false, d) } } case "template": @@ -21099,67 +26851,68 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromMap(l int, d *codec1978.D x.Template.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1716) - } // end switch yys1716 - } // end for yyj1716 - if !yyhl1716 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationControllerSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1721 int - var yyb1721 bool - var yyhl1721 bool = l >= 0 - yyj1721++ - if yyhl1721 { - yyb1721 = yyj1721 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1721 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1721 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj1721++ - if yyhl1721 { - yyb1721 = yyj1721 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1721 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1721 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv1723 := &x.Selector - yym1724 := z.DecBinary() - _ = yym1724 + yyv10 := &x.Selector + yym11 := z.DecBinary() + _ = yym11 if false { } else { - z.F.DecMapStringStringX(yyv1723, false, d) + z.F.DecMapStringStringX(yyv10, false, d) } } - yyj1721++ - if yyhl1721 { - yyb1721 = yyj1721 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1721 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1721 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Template != nil { x.Template = nil @@ -21171,18 +26924,19 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromArray(l int, d *codec1978 x.Template.CodecDecodeSelf(d) } for { - yyj1721++ - if yyhl1721 { - yyb1721 = yyj1721 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1721 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1721 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1721-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationControllerStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -21192,48 +26946,54 @@ func (x *ReplicationControllerStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1726 := z.EncBinary() - _ = yym1726 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1727 := !z.EncBinary() - yy2arr1727 := z.EncBasicHandle().StructToArray - var yyq1727 [2]bool - _, _, _ = yysep1727, yyq1727, yy2arr1727 - const yyr1727 bool = false - yyq1727[1] = x.ObservedGeneration != 0 - if yyr1727 || yy2arr1727 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.ObservedGeneration != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1727 int = 1 - for _, b := range yyq1727 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1727++ + yynn2++ } } - r.EncodeMapStart(yynn1727) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1727 || yy2arr1727 { - yym1729 := z.EncBinary() - _ = yym1729 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Replicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) - yym1730 := z.EncBinary() - _ = yym1730 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Replicas)) } } - if yyr1727 || yy2arr1727 { - if yyq1727[1] { - yym1732 := z.EncBinary() - _ = yym1732 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.ObservedGeneration)) @@ -21242,18 +27002,22 @@ func (x *ReplicationControllerStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq1727[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("observedGeneration")) - yym1733 := z.EncBinary() - _ = yym1733 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.ObservedGeneration)) } } } - if yysep1727 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -21263,24 +27027,25 @@ func (x *ReplicationControllerStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1734 := z.DecBinary() - _ = yym1734 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1735 := r.ReadMapStart() - if yyl1735 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1735, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1735 := r.ReadArrayStart() - if yyl1735 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1735, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -21292,12 +27057,12 @@ func (x *ReplicationControllerStatus) codecDecodeSelfFromMap(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1736Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1736Slc - var yyhl1736 bool = l >= 0 - for yyj1736 := 0; ; yyj1736++ { - if yyhl1736 { - if yyj1736 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -21305,9 +27070,11 @@ func (x *ReplicationControllerStatus) codecDecodeSelfFromMap(l int, d *codec1978 break } } - yys1736Slc = r.DecodeBytes(yys1736Slc, true, true) - yys1736 := string(yys1736Slc) - switch yys1736 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 @@ -21321,64 +27088,65 @@ func (x *ReplicationControllerStatus) codecDecodeSelfFromMap(l int, d *codec1978 x.ObservedGeneration = int64(r.DecodeInt(64)) } default: - z.DecStructFieldNotFound(-1, yys1736) - } // end switch yys1736 - } // end for yyj1736 - if !yyhl1736 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationControllerStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1739 int - var yyb1739 bool - var yyhl1739 bool = l >= 0 - yyj1739++ - if yyhl1739 { - yyb1739 = yyj1739 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1739 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1739 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj1739++ - if yyhl1739 { - yyb1739 = yyj1739 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1739 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1739 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObservedGeneration = 0 } else { x.ObservedGeneration = int64(r.DecodeInt(64)) } for { - yyj1739++ - if yyhl1739 { - yyb1739 = yyj1739 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1739 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1739 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1739-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationController) CodecEncodeSelf(e *codec1978.Encoder) { @@ -21388,120 +27156,139 @@ func (x *ReplicationController) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1742 := z.EncBinary() - _ = yym1742 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1743 := !z.EncBinary() - yy2arr1743 := z.EncBasicHandle().StructToArray - var yyq1743 [5]bool - _, _, _ = yysep1743, yyq1743, yy2arr1743 - const yyr1743 bool = false - yyq1743[0] = x.Kind != "" - yyq1743[1] = x.APIVersion != "" - yyq1743[2] = true - yyq1743[3] = true - yyq1743[4] = true - if yyr1743 || yy2arr1743 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1743 int = 0 - for _, b := range yyq1743 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1743++ + yynn2++ } } - r.EncodeMapStart(yynn1743) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1743 || yy2arr1743 { - if yyq1743[0] { - yym1745 := z.EncBinary() - _ = yym1745 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1743[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1746 := z.EncBinary() - _ = yym1746 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1743 || yy2arr1743 { - if yyq1743[1] { - yym1748 := z.EncBinary() - _ = yym1748 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1743[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1749 := z.EncBinary() - _ = yym1749 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1743 || yy2arr1743 { - if yyq1743[2] { - yy1751 := &x.ObjectMeta - yy1751.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1743[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1752 := &x.ObjectMeta - yy1752.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1743 || yy2arr1743 { - if yyq1743[3] { - yy1754 := &x.Spec - yy1754.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1743[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1755 := &x.Spec - yy1755.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr1743 || yy2arr1743 { - if yyq1743[4] { - yy1757 := &x.Status - yy1757.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1743[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy1758 := &x.Status - yy1758.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep1743 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -21511,24 +27298,25 @@ func (x *ReplicationController) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1759 := z.DecBinary() - _ = yym1759 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1760 := r.ReadMapStart() - if yyl1760 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1760, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1760 := r.ReadArrayStart() - if yyl1760 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1760, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -21540,12 +27328,12 @@ func (x *ReplicationController) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1761Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1761Slc - var yyhl1761 bool = l >= 0 - for yyj1761 := 0; ; yyj1761++ { - if yyhl1761 { - if yyj1761 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -21553,9 +27341,32 @@ func (x *ReplicationController) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1761Slc = r.DecodeBytes(yys1761Slc, true, true) - yys1761 := string(yys1761Slc) - switch yys1761 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ReplicationControllerSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ReplicationControllerStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -21568,134 +27379,117 @@ func (x *ReplicationController) codecDecodeSelfFromMap(l int, d *codec1978.Decod } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1764 := &x.ObjectMeta - yyv1764.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ReplicationControllerSpec{} - } else { - yyv1765 := &x.Spec - yyv1765.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = ReplicationControllerStatus{} - } else { - yyv1766 := &x.Status - yyv1766.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1761) - } // end switch yys1761 - } // end for yyj1761 - if !yyhl1761 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationController) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1767 int - var yyb1767 bool - var yyhl1767 bool = l >= 0 - yyj1767++ - if yyhl1767 { - yyb1767 = yyj1767 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1767 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1767 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ReplicationControllerSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ReplicationControllerStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1767++ - if yyhl1767 { - yyb1767 = yyj1767 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1767 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1767 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1767++ - if yyhl1767 { - yyb1767 = yyj1767 > l - } else { - yyb1767 = r.CheckBreak() - } - if yyb1767 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1770 := &x.ObjectMeta - yyv1770.CodecDecodeSelf(d) - } - yyj1767++ - if yyhl1767 { - yyb1767 = yyj1767 > l - } else { - yyb1767 = r.CheckBreak() - } - if yyb1767 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ReplicationControllerSpec{} - } else { - yyv1771 := &x.Spec - yyv1771.CodecDecodeSelf(d) - } - yyj1767++ - if yyhl1767 { - yyb1767 = yyj1767 > l - } else { - yyb1767 = r.CheckBreak() - } - if yyb1767 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = ReplicationControllerStatus{} - } else { - yyv1772 := &x.Status - yyv1772.CodecDecodeSelf(d) - } for { - yyj1767++ - if yyhl1767 { - yyb1767 = yyj1767 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1767 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1767 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj1767-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationControllerList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -21705,126 +27499,142 @@ func (x *ReplicationControllerList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1773 := z.EncBinary() - _ = yym1773 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1774 := !z.EncBinary() - yy2arr1774 := z.EncBasicHandle().StructToArray - var yyq1774 [4]bool - _, _, _ = yysep1774, yyq1774, yy2arr1774 - const yyr1774 bool = false - yyq1774[0] = x.Kind != "" - yyq1774[1] = x.APIVersion != "" - yyq1774[2] = true - if yyr1774 || yy2arr1774 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1774 int = 1 - for _, b := range yyq1774 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1774++ + yynn2++ } } - r.EncodeMapStart(yynn1774) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1774 || yy2arr1774 { - if yyq1774[0] { - yym1776 := z.EncBinary() - _ = yym1776 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1774[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1777 := z.EncBinary() - _ = yym1777 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1774 || yy2arr1774 { - if yyq1774[1] { - yym1779 := z.EncBinary() - _ = yym1779 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1774[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1780 := z.EncBinary() - _ = yym1780 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1774 || yy2arr1774 { - if yyq1774[2] { - yy1782 := &x.ListMeta - yym1783 := z.EncBinary() - _ = yym1783 - if false { - } else if z.HasExtensions() && z.EncExt(yy1782) { - } else { - z.EncFallback(yy1782) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1774[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1784 := &x.ListMeta - yym1785 := z.EncBinary() - _ = yym1785 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1784) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1784) + z.EncFallback(yy6) } } } - if yyr1774 || yy2arr1774 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1787 := z.EncBinary() - _ = yym1787 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceReplicationController(([]ReplicationController)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1788 := z.EncBinary() - _ = yym1788 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceReplicationController(([]ReplicationController)(x.Items), e) } } } - if yysep1774 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -21834,24 +27644,25 @@ func (x *ReplicationControllerList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1789 := z.DecBinary() - _ = yym1789 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1790 := r.ReadMapStart() - if yyl1790 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1790, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1790 := r.ReadArrayStart() - if yyl1790 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1790, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -21863,12 +27674,12 @@ func (x *ReplicationControllerList) codecDecodeSelfFromMap(l int, d *codec1978.D var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1791Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1791Slc - var yyhl1791 bool = l >= 0 - for yyj1791 := 0; ; yyj1791++ { - if yyhl1791 { - if yyj1791 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -21876,9 +27687,36 @@ func (x *ReplicationControllerList) codecDecodeSelfFromMap(l int, d *codec1978.D break } } - yys1791Slc = r.DecodeBytes(yys1791Slc, true, true) - yys1791 := string(yys1791Slc) - switch yys1791 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceReplicationController((*[]ReplicationController)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -21891,133 +27729,111 @@ func (x *ReplicationControllerList) codecDecodeSelfFromMap(l int, d *codec1978.D } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1794 := &x.ListMeta - yym1795 := z.DecBinary() - _ = yym1795 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1794) { - } else { - z.DecFallback(yyv1794, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1796 := &x.Items - yym1797 := z.DecBinary() - _ = yym1797 - if false { - } else { - h.decSliceReplicationController((*[]ReplicationController)(yyv1796), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1791) - } // end switch yys1791 - } // end for yyj1791 - if !yyhl1791 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationControllerList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1798 int - var yyb1798 bool - var yyhl1798 bool = l >= 0 - yyj1798++ - if yyhl1798 { - yyb1798 = yyj1798 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1798 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1798 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceReplicationController((*[]ReplicationController)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1798++ - if yyhl1798 { - yyb1798 = yyj1798 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1798 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1798 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1798++ - if yyhl1798 { - yyb1798 = yyj1798 > l - } else { - yyb1798 = r.CheckBreak() - } - if yyb1798 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1801 := &x.ListMeta - yym1802 := z.DecBinary() - _ = yym1802 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1801) { - } else { - z.DecFallback(yyv1801, false) - } - } - yyj1798++ - if yyhl1798 { - yyb1798 = yyj1798 > l - } else { - yyb1798 = r.CheckBreak() - } - if yyb1798 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1803 := &x.Items - yym1804 := z.DecBinary() - _ = yym1804 - if false { - } else { - h.decSliceReplicationController((*[]ReplicationController)(yyv1803), d) - } - } for { - yyj1798++ - if yyhl1798 { - yyb1798 = yyj1798 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1798 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1798 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1798-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServiceList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -22027,126 +27843,142 @@ func (x *ServiceList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1805 := z.EncBinary() - _ = yym1805 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1806 := !z.EncBinary() - yy2arr1806 := z.EncBasicHandle().StructToArray - var yyq1806 [4]bool - _, _, _ = yysep1806, yyq1806, yy2arr1806 - const yyr1806 bool = false - yyq1806[0] = x.Kind != "" - yyq1806[1] = x.APIVersion != "" - yyq1806[2] = true - if yyr1806 || yy2arr1806 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1806 int = 1 - for _, b := range yyq1806 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1806++ + yynn2++ } } - r.EncodeMapStart(yynn1806) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1806 || yy2arr1806 { - if yyq1806[0] { - yym1808 := z.EncBinary() - _ = yym1808 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1806[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1809 := z.EncBinary() - _ = yym1809 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1806 || yy2arr1806 { - if yyq1806[1] { - yym1811 := z.EncBinary() - _ = yym1811 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1806[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1812 := z.EncBinary() - _ = yym1812 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1806 || yy2arr1806 { - if yyq1806[2] { - yy1814 := &x.ListMeta - yym1815 := z.EncBinary() - _ = yym1815 - if false { - } else if z.HasExtensions() && z.EncExt(yy1814) { - } else { - z.EncFallback(yy1814) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1806[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1816 := &x.ListMeta - yym1817 := z.EncBinary() - _ = yym1817 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1816) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1816) + z.EncFallback(yy6) } } } - if yyr1806 || yy2arr1806 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1819 := z.EncBinary() - _ = yym1819 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceService(([]Service)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1820 := z.EncBinary() - _ = yym1820 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceService(([]Service)(x.Items), e) } } } - if yysep1806 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -22156,24 +27988,25 @@ func (x *ServiceList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1821 := z.DecBinary() - _ = yym1821 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1822 := r.ReadMapStart() - if yyl1822 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1822, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1822 := r.ReadArrayStart() - if yyl1822 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1822, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -22185,12 +28018,12 @@ func (x *ServiceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1823Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1823Slc - var yyhl1823 bool = l >= 0 - for yyj1823 := 0; ; yyj1823++ { - if yyhl1823 { - if yyj1823 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -22198,9 +28031,36 @@ func (x *ServiceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1823Slc = r.DecodeBytes(yys1823Slc, true, true) - yys1823 := string(yys1823Slc) - switch yys1823 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceService((*[]Service)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -22213,141 +28073,119 @@ func (x *ServiceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1826 := &x.ListMeta - yym1827 := z.DecBinary() - _ = yym1827 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1826) { - } else { - z.DecFallback(yyv1826, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1828 := &x.Items - yym1829 := z.DecBinary() - _ = yym1829 - if false { - } else { - h.decSliceService((*[]Service)(yyv1828), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1823) - } // end switch yys1823 - } // end for yyj1823 - if !yyhl1823 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1830 int - var yyb1830 bool - var yyhl1830 bool = l >= 0 - yyj1830++ - if yyhl1830 { - yyb1830 = yyj1830 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1830 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1830 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceService((*[]Service)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1830++ - if yyhl1830 { - yyb1830 = yyj1830 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1830 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1830 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1830++ - if yyhl1830 { - yyb1830 = yyj1830 > l - } else { - yyb1830 = r.CheckBreak() - } - if yyb1830 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1833 := &x.ListMeta - yym1834 := z.DecBinary() - _ = yym1834 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1833) { - } else { - z.DecFallback(yyv1833, false) - } - } - yyj1830++ - if yyhl1830 { - yyb1830 = yyj1830 > l - } else { - yyb1830 = r.CheckBreak() - } - if yyb1830 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1835 := &x.Items - yym1836 := z.DecBinary() - _ = yym1836 - if false { - } else { - h.decSliceService((*[]Service)(yyv1835), d) - } - } for { - yyj1830++ - if yyhl1830 { - yyb1830 = yyj1830 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1830 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1830 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1830-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x ServiceAffinity) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1837 := z.EncBinary() - _ = yym1837 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -22359,8 +28197,8 @@ func (x *ServiceAffinity) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1838 := z.DecBinary() - _ = yym1838 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -22372,8 +28210,8 @@ func (x ServiceType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1839 := z.EncBinary() - _ = yym1839 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -22385,8 +28223,8 @@ func (x *ServiceType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1840 := z.DecBinary() - _ = yym1840 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -22401,44 +28239,51 @@ func (x *ServiceStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1841 := z.EncBinary() - _ = yym1841 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1842 := !z.EncBinary() - yy2arr1842 := z.EncBasicHandle().StructToArray - var yyq1842 [1]bool - _, _, _ = yysep1842, yyq1842, yy2arr1842 - const yyr1842 bool = false - yyq1842[0] = true - if yyr1842 || yy2arr1842 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn1842 int = 0 - for _, b := range yyq1842 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1842++ + yynn2++ } } - r.EncodeMapStart(yynn1842) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1842 || yy2arr1842 { - if yyq1842[0] { - yy1844 := &x.LoadBalancer - yy1844.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.LoadBalancer + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1842[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("loadBalancer")) - yy1845 := &x.LoadBalancer - yy1845.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.LoadBalancer + yy6.CodecEncodeSelf(e) } } - if yysep1842 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -22448,24 +28293,25 @@ func (x *ServiceStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1846 := z.DecBinary() - _ = yym1846 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1847 := r.ReadMapStart() - if yyl1847 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1847, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1847 := r.ReadArrayStart() - if yyl1847 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1847, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -22477,12 +28323,12 @@ func (x *ServiceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1848Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1848Slc - var yyhl1848 bool = l >= 0 - for yyj1848 := 0; ; yyj1848++ { - if yyhl1848 { - if yyj1848 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -22490,61 +28336,63 @@ func (x *ServiceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1848Slc = r.DecodeBytes(yys1848Slc, true, true) - yys1848 := string(yys1848Slc) - switch yys1848 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "loadBalancer": if r.TryDecodeAsNil() { x.LoadBalancer = LoadBalancerStatus{} } else { - yyv1849 := &x.LoadBalancer - yyv1849.CodecDecodeSelf(d) + yyv4 := &x.LoadBalancer + yyv4.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1848) - } // end switch yys1848 - } // end for yyj1848 - if !yyhl1848 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1850 int - var yyb1850 bool - var yyhl1850 bool = l >= 0 - yyj1850++ - if yyhl1850 { - yyb1850 = yyj1850 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb1850 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb1850 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LoadBalancer = LoadBalancerStatus{} } else { - yyv1851 := &x.LoadBalancer - yyv1851.CodecDecodeSelf(d) + yyv6 := &x.LoadBalancer + yyv6.CodecDecodeSelf(d) } for { - yyj1850++ - if yyhl1850 { - yyb1850 = yyj1850 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb1850 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb1850 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj1850-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LoadBalancerStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -22554,35 +28402,38 @@ func (x *LoadBalancerStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1852 := z.EncBinary() - _ = yym1852 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1853 := !z.EncBinary() - yy2arr1853 := z.EncBasicHandle().StructToArray - var yyq1853 [1]bool - _, _, _ = yysep1853, yyq1853, yy2arr1853 - const yyr1853 bool = false - yyq1853[0] = len(x.Ingress) != 0 - if yyr1853 || yy2arr1853 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Ingress) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn1853 int = 0 - for _, b := range yyq1853 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1853++ + yynn2++ } } - r.EncodeMapStart(yynn1853) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1853 || yy2arr1853 { - if yyq1853[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Ingress == nil { r.EncodeNil() } else { - yym1855 := z.EncBinary() - _ = yym1855 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceLoadBalancerIngress(([]LoadBalancerIngress)(x.Ingress), e) @@ -22592,13 +28443,15 @@ func (x *LoadBalancerStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1853[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ingress")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Ingress == nil { r.EncodeNil() } else { - yym1856 := z.EncBinary() - _ = yym1856 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceLoadBalancerIngress(([]LoadBalancerIngress)(x.Ingress), e) @@ -22606,8 +28459,10 @@ func (x *LoadBalancerStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1853 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -22617,24 +28472,25 @@ func (x *LoadBalancerStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1857 := z.DecBinary() - _ = yym1857 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1858 := r.ReadMapStart() - if yyl1858 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1858, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1858 := r.ReadArrayStart() - if yyl1858 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1858, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -22646,12 +28502,12 @@ func (x *LoadBalancerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1859Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1859Slc - var yyhl1859 bool = l >= 0 - for yyj1859 := 0; ; yyj1859++ { - if yyhl1859 { - if yyj1859 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -22659,71 +28515,73 @@ func (x *LoadBalancerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys1859Slc = r.DecodeBytes(yys1859Slc, true, true) - yys1859 := string(yys1859Slc) - switch yys1859 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "ingress": if r.TryDecodeAsNil() { x.Ingress = nil } else { - yyv1860 := &x.Ingress - yym1861 := z.DecBinary() - _ = yym1861 + yyv4 := &x.Ingress + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceLoadBalancerIngress((*[]LoadBalancerIngress)(yyv1860), d) + h.decSliceLoadBalancerIngress((*[]LoadBalancerIngress)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys1859) - } // end switch yys1859 - } // end for yyj1859 - if !yyhl1859 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LoadBalancerStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1862 int - var yyb1862 bool - var yyhl1862 bool = l >= 0 - yyj1862++ - if yyhl1862 { - yyb1862 = yyj1862 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1862 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1862 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ingress = nil } else { - yyv1863 := &x.Ingress - yym1864 := z.DecBinary() - _ = yym1864 + yyv7 := &x.Ingress + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceLoadBalancerIngress((*[]LoadBalancerIngress)(yyv1863), d) + h.decSliceLoadBalancerIngress((*[]LoadBalancerIngress)(yyv7), d) } } for { - yyj1862++ - if yyhl1862 { - yyb1862 = yyj1862 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1862 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1862 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1862-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LoadBalancerIngress) CodecEncodeSelf(e *codec1978.Encoder) { @@ -22733,33 +28591,36 @@ func (x *LoadBalancerIngress) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1865 := z.EncBinary() - _ = yym1865 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1866 := !z.EncBinary() - yy2arr1866 := z.EncBasicHandle().StructToArray - var yyq1866 [2]bool - _, _, _ = yysep1866, yyq1866, yy2arr1866 - const yyr1866 bool = false - yyq1866[0] = x.IP != "" - yyq1866[1] = x.Hostname != "" - if yyr1866 || yy2arr1866 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.IP != "" + yyq2[1] = x.Hostname != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1866 int = 0 - for _, b := range yyq1866 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1866++ + yynn2++ } } - r.EncodeMapStart(yynn1866) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1866 || yy2arr1866 { - if yyq1866[0] { - yym1868 := z.EncBinary() - _ = yym1868 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IP)) @@ -22768,20 +28629,23 @@ func (x *LoadBalancerIngress) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1866[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ip")) - yym1869 := z.EncBinary() - _ = yym1869 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IP)) } } } - if yyr1866 || yy2arr1866 { - if yyq1866[1] { - yym1871 := z.EncBinary() - _ = yym1871 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Hostname)) @@ -22790,18 +28654,22 @@ func (x *LoadBalancerIngress) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1866[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostname")) - yym1872 := z.EncBinary() - _ = yym1872 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Hostname)) } } } - if yysep1866 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -22811,24 +28679,25 @@ func (x *LoadBalancerIngress) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1873 := z.DecBinary() - _ = yym1873 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1874 := r.ReadMapStart() - if yyl1874 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1874, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1874 := r.ReadArrayStart() - if yyl1874 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1874, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -22840,12 +28709,12 @@ func (x *LoadBalancerIngress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1875Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1875Slc - var yyhl1875 bool = l >= 0 - for yyj1875 := 0; ; yyj1875++ { - if yyhl1875 { - if yyj1875 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -22853,9 +28722,11 @@ func (x *LoadBalancerIngress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys1875Slc = r.DecodeBytes(yys1875Slc, true, true) - yys1875 := string(yys1875Slc) - switch yys1875 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "ip": if r.TryDecodeAsNil() { x.IP = "" @@ -22869,64 +28740,65 @@ func (x *LoadBalancerIngress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder x.Hostname = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1875) - } // end switch yys1875 - } // end for yyj1875 - if !yyhl1875 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LoadBalancerIngress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1878 int - var yyb1878 bool - var yyhl1878 bool = l >= 0 - yyj1878++ - if yyhl1878 { - yyb1878 = yyj1878 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1878 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1878 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.IP = "" } else { x.IP = string(r.DecodeString()) } - yyj1878++ - if yyhl1878 { - yyb1878 = yyj1878 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1878 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1878 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Hostname = "" } else { x.Hostname = string(r.DecodeString()) } for { - yyj1878++ - if yyhl1878 { - yyb1878 = yyj1878 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1878 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1878 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1878-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -22936,96 +28808,108 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1881 := z.EncBinary() - _ = yym1881 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1882 := !z.EncBinary() - yy2arr1882 := z.EncBasicHandle().StructToArray - var yyq1882 [7]bool - _, _, _ = yysep1882, yyq1882, yy2arr1882 - const yyr1882 bool = false - yyq1882[0] = x.Type != "" - yyq1882[3] = x.ClusterIP != "" - yyq1882[4] = len(x.ExternalIPs) != 0 - yyq1882[5] = x.LoadBalancerIP != "" - yyq1882[6] = x.SessionAffinity != "" - if yyr1882 || yy2arr1882 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Type != "" + yyq2[3] = x.ClusterIP != "" + yyq2[4] = len(x.ExternalIPs) != 0 + yyq2[5] = x.LoadBalancerIP != "" + yyq2[6] = x.SessionAffinity != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(7) } else { - var yynn1882 int = 2 - for _, b := range yyq1882 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn1882++ + yynn2++ } } - r.EncodeMapStart(yynn1882) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1882 || yy2arr1882 { - if yyq1882[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Type.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1882[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } } - if yyr1882 || yy2arr1882 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Ports == nil { r.EncodeNil() } else { - yym1885 := z.EncBinary() - _ = yym1885 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSliceServicePort(([]ServicePort)(x.Ports), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ports")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Ports == nil { r.EncodeNil() } else { - yym1886 := z.EncBinary() - _ = yym1886 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSliceServicePort(([]ServicePort)(x.Ports), e) } } } - if yyr1882 || yy2arr1882 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Selector == nil { r.EncodeNil() } else { - yym1888 := z.EncBinary() - _ = yym1888 + yym10 := z.EncBinary() + _ = yym10 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym1889 := z.EncBinary() - _ = yym1889 + yym11 := z.EncBinary() + _ = yym11 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) } } } - if yyr1882 || yy2arr1882 { - if yyq1882[3] { - yym1891 := z.EncBinary() - _ = yym1891 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ClusterIP)) @@ -23034,23 +28918,26 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1882[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("clusterIP")) - yym1892 := z.EncBinary() - _ = yym1892 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ClusterIP)) } } } - if yyr1882 || yy2arr1882 { - if yyq1882[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.ExternalIPs == nil { r.EncodeNil() } else { - yym1894 := z.EncBinary() - _ = yym1894 + yym16 := z.EncBinary() + _ = yym16 if false { } else { z.F.EncSliceStringV(x.ExternalIPs, false, e) @@ -23060,13 +28947,15 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1882[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("externalIPs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ExternalIPs == nil { r.EncodeNil() } else { - yym1895 := z.EncBinary() - _ = yym1895 + yym17 := z.EncBinary() + _ = yym17 if false { } else { z.F.EncSliceStringV(x.ExternalIPs, false, e) @@ -23074,10 +28963,11 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1882 || yy2arr1882 { - if yyq1882[5] { - yym1897 := z.EncBinary() - _ = yym1897 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.LoadBalancerIP)) @@ -23086,30 +28976,37 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1882[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("loadBalancerIP")) - yym1898 := z.EncBinary() - _ = yym1898 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.LoadBalancerIP)) } } } - if yyr1882 || yy2arr1882 { - if yyq1882[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { x.SessionAffinity.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1882[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("sessionAffinity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.SessionAffinity.CodecEncodeSelf(e) } } - if yysep1882 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -23119,24 +29016,25 @@ func (x *ServiceSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1900 := z.DecBinary() - _ = yym1900 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1901 := r.ReadMapStart() - if yyl1901 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1901, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1901 := r.ReadArrayStart() - if yyl1901 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1901, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -23148,12 +29046,12 @@ func (x *ServiceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1902Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1902Slc - var yyhl1902 bool = l >= 0 - for yyj1902 := 0; ; yyj1902++ { - if yyhl1902 { - if yyj1902 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -23161,9 +29059,11 @@ func (x *ServiceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1902Slc = r.DecodeBytes(yys1902Slc, true, true) - yys1902 := string(yys1902Slc) - switch yys1902 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -23174,24 +29074,24 @@ func (x *ServiceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv1904 := &x.Ports - yym1905 := z.DecBinary() - _ = yym1905 + yyv5 := &x.Ports + yym6 := z.DecBinary() + _ = yym6 if false { } else { - h.decSliceServicePort((*[]ServicePort)(yyv1904), d) + h.decSliceServicePort((*[]ServicePort)(yyv5), d) } } case "selector": if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv1906 := &x.Selector - yym1907 := z.DecBinary() - _ = yym1907 + yyv7 := &x.Selector + yym8 := z.DecBinary() + _ = yym8 if false { } else { - z.F.DecMapStringStringX(yyv1906, false, d) + z.F.DecMapStringStringX(yyv7, false, d) } } case "clusterIP": @@ -23204,12 +29104,12 @@ func (x *ServiceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.ExternalIPs = nil } else { - yyv1909 := &x.ExternalIPs - yym1910 := z.DecBinary() - _ = yym1910 + yyv10 := &x.ExternalIPs + yym11 := z.DecBinary() + _ = yym11 if false { } else { - z.F.DecSliceStringX(yyv1909, false, d) + z.F.DecSliceStringX(yyv10, false, d) } } case "loadBalancerIP": @@ -23225,157 +29125,163 @@ func (x *ServiceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.SessionAffinity = ServiceAffinity(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1902) - } // end switch yys1902 - } // end for yyj1902 - if !yyhl1902 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1913 int - var yyb1913 bool - var yyhl1913 bool = l >= 0 - yyj1913++ - if yyhl1913 { - yyb1913 = yyj1913 > l + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb1913 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb1913 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = ServiceType(r.DecodeString()) } - yyj1913++ - if yyhl1913 { - yyb1913 = yyj1913 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb1913 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb1913 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv1915 := &x.Ports - yym1916 := z.DecBinary() - _ = yym1916 + yyv16 := &x.Ports + yym17 := z.DecBinary() + _ = yym17 if false { } else { - h.decSliceServicePort((*[]ServicePort)(yyv1915), d) + h.decSliceServicePort((*[]ServicePort)(yyv16), d) } } - yyj1913++ - if yyhl1913 { - yyb1913 = yyj1913 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb1913 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb1913 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv1917 := &x.Selector - yym1918 := z.DecBinary() - _ = yym1918 + yyv18 := &x.Selector + yym19 := z.DecBinary() + _ = yym19 if false { } else { - z.F.DecMapStringStringX(yyv1917, false, d) + z.F.DecMapStringStringX(yyv18, false, d) } } - yyj1913++ - if yyhl1913 { - yyb1913 = yyj1913 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb1913 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb1913 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ClusterIP = "" } else { x.ClusterIP = string(r.DecodeString()) } - yyj1913++ - if yyhl1913 { - yyb1913 = yyj1913 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb1913 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb1913 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ExternalIPs = nil } else { - yyv1920 := &x.ExternalIPs - yym1921 := z.DecBinary() - _ = yym1921 + yyv21 := &x.ExternalIPs + yym22 := z.DecBinary() + _ = yym22 if false { } else { - z.F.DecSliceStringX(yyv1920, false, d) + z.F.DecSliceStringX(yyv21, false, d) } } - yyj1913++ - if yyhl1913 { - yyb1913 = yyj1913 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb1913 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb1913 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LoadBalancerIP = "" } else { x.LoadBalancerIP = string(r.DecodeString()) } - yyj1913++ - if yyhl1913 { - yyb1913 = yyj1913 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb1913 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb1913 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SessionAffinity = "" } else { x.SessionAffinity = ServiceAffinity(r.DecodeString()) } for { - yyj1913++ - if yyhl1913 { - yyb1913 = yyj1913 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb1913 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb1913 { + if yyb14 { break } - z.DecStructFieldNotFound(yyj1913-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj14-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServicePort) CodecEncodeSelf(e *codec1978.Encoder) { @@ -23385,107 +29291,126 @@ func (x *ServicePort) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1924 := z.EncBinary() - _ = yym1924 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1925 := !z.EncBinary() - yy2arr1925 := z.EncBasicHandle().StructToArray - var yyq1925 [5]bool - _, _, _ = yysep1925, yyq1925, yy2arr1925 - const yyr1925 bool = false - if yyr1925 || yy2arr1925 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1925 int = 5 - for _, b := range yyq1925 { + yynn2 = 5 + for _, b := range yyq2 { if b { - yynn1925++ + yynn2++ } } - r.EncodeMapStart(yynn1925) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1925 || yy2arr1925 { - yym1927 := z.EncBinary() - _ = yym1927 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym1928 := z.EncBinary() - _ = yym1928 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr1925 || yy2arr1925 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Protocol.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("protocol")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Protocol.CodecEncodeSelf(e) } - if yyr1925 || yy2arr1925 { - yym1931 := z.EncBinary() - _ = yym1931 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.Port)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("port")) - yym1932 := z.EncBinary() - _ = yym1932 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.Port)) } } - if yyr1925 || yy2arr1925 { - yy1934 := &x.TargetPort - yym1935 := z.EncBinary() - _ = yym1935 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy13 := &x.TargetPort + yym14 := z.EncBinary() + _ = yym14 if false { - } else if z.HasExtensions() && z.EncExt(yy1934) { - } else if !yym1935 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1934) + } else if z.HasExtensions() && z.EncExt(yy13) { + } else if !yym14 && z.IsJSONHandle() { + z.EncJSONMarshal(yy13) } else { - z.EncFallback(yy1934) + z.EncFallback(yy13) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("targetPort")) - yy1936 := &x.TargetPort - yym1937 := z.EncBinary() - _ = yym1937 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy15 := &x.TargetPort + yym16 := z.EncBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.EncExt(yy1936) { - } else if !yym1937 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1936) + } else if z.HasExtensions() && z.EncExt(yy15) { + } else if !yym16 && z.IsJSONHandle() { + z.EncJSONMarshal(yy15) } else { - z.EncFallback(yy1936) + z.EncFallback(yy15) } } - if yyr1925 || yy2arr1925 { - yym1939 := z.EncBinary() - _ = yym1939 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym18 := z.EncBinary() + _ = yym18 if false { } else { r.EncodeInt(int64(x.NodePort)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nodePort")) - yym1940 := z.EncBinary() - _ = yym1940 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeInt(int64(x.NodePort)) } } - if yysep1925 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -23495,24 +29420,25 @@ func (x *ServicePort) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1941 := z.DecBinary() - _ = yym1941 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1942 := r.ReadMapStart() - if yyl1942 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1942, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1942 := r.ReadArrayStart() - if yyl1942 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1942, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -23524,12 +29450,12 @@ func (x *ServicePort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1943Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1943Slc - var yyhl1943 bool = l >= 0 - for yyj1943 := 0; ; yyj1943++ { - if yyhl1943 { - if yyj1943 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -23537,9 +29463,11 @@ func (x *ServicePort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1943Slc = r.DecodeBytes(yys1943Slc, true, true) - yys1943 := string(yys1943Slc) - switch yys1943 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -23560,17 +29488,17 @@ func (x *ServicePort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "targetPort": if r.TryDecodeAsNil() { - x.TargetPort = pkg5_util.IntOrString{} + x.TargetPort = pkg5_intstr.IntOrString{} } else { - yyv1947 := &x.TargetPort - yym1948 := z.DecBinary() - _ = yym1948 + yyv7 := &x.TargetPort + yym8 := z.DecBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.DecExt(yyv1947) { - } else if !yym1948 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1947) + } else if z.HasExtensions() && z.DecExt(yyv7) { + } else if !yym8 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv7) } else { - z.DecFallback(yyv1947, false) + z.DecFallback(yyv7, false) } } case "nodePort": @@ -23580,118 +29508,122 @@ func (x *ServicePort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.NodePort = int(r.DecodeInt(codecSelferBitsize1234)) } default: - z.DecStructFieldNotFound(-1, yys1943) - } // end switch yys1943 - } // end for yyj1943 - if !yyhl1943 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServicePort) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1950 int - var yyb1950 bool - var yyhl1950 bool = l >= 0 - yyj1950++ - if yyhl1950 { - yyb1950 = yyj1950 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1950 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1950 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj1950++ - if yyhl1950 { - yyb1950 = yyj1950 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1950 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1950 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Protocol = "" } else { x.Protocol = Protocol(r.DecodeString()) } - yyj1950++ - if yyhl1950 { - yyb1950 = yyj1950 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1950 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1950 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Port = 0 } else { x.Port = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj1950++ - if yyhl1950 { - yyb1950 = yyj1950 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1950 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1950 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.TargetPort = pkg5_util.IntOrString{} + x.TargetPort = pkg5_intstr.IntOrString{} } else { - yyv1954 := &x.TargetPort - yym1955 := z.DecBinary() - _ = yym1955 + yyv14 := &x.TargetPort + yym15 := z.DecBinary() + _ = yym15 if false { - } else if z.HasExtensions() && z.DecExt(yyv1954) { - } else if !yym1955 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1954) + } else if z.HasExtensions() && z.DecExt(yyv14) { + } else if !yym15 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv14) } else { - z.DecFallback(yyv1954, false) + z.DecFallback(yyv14, false) } } - yyj1950++ - if yyhl1950 { - yyb1950 = yyj1950 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1950 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1950 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NodePort = 0 } else { x.NodePort = int(r.DecodeInt(codecSelferBitsize1234)) } for { - yyj1950++ - if yyhl1950 { - yyb1950 = yyj1950 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1950 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1950 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1950-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Service) CodecEncodeSelf(e *codec1978.Encoder) { @@ -23701,120 +29633,139 @@ func (x *Service) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1957 := z.EncBinary() - _ = yym1957 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1958 := !z.EncBinary() - yy2arr1958 := z.EncBasicHandle().StructToArray - var yyq1958 [5]bool - _, _, _ = yysep1958, yyq1958, yy2arr1958 - const yyr1958 bool = false - yyq1958[0] = x.Kind != "" - yyq1958[1] = x.APIVersion != "" - yyq1958[2] = true - yyq1958[3] = true - yyq1958[4] = true - if yyr1958 || yy2arr1958 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1958 int = 0 - for _, b := range yyq1958 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1958++ + yynn2++ } } - r.EncodeMapStart(yynn1958) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1958 || yy2arr1958 { - if yyq1958[0] { - yym1960 := z.EncBinary() - _ = yym1960 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1958[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1961 := z.EncBinary() - _ = yym1961 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1958 || yy2arr1958 { - if yyq1958[1] { - yym1963 := z.EncBinary() - _ = yym1963 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1958[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1964 := z.EncBinary() - _ = yym1964 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1958 || yy2arr1958 { - if yyq1958[2] { - yy1966 := &x.ObjectMeta - yy1966.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1958[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1967 := &x.ObjectMeta - yy1967.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1958 || yy2arr1958 { - if yyq1958[3] { - yy1969 := &x.Spec - yy1969.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1958[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1970 := &x.Spec - yy1970.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr1958 || yy2arr1958 { - if yyq1958[4] { - yy1972 := &x.Status - yy1972.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1958[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy1973 := &x.Status - yy1973.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep1958 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -23824,24 +29775,25 @@ func (x *Service) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1974 := z.DecBinary() - _ = yym1974 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1975 := r.ReadMapStart() - if yyl1975 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1975, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1975 := r.ReadArrayStart() - if yyl1975 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1975, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -23853,12 +29805,12 @@ func (x *Service) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1976Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1976Slc - var yyhl1976 bool = l >= 0 - for yyj1976 := 0; ; yyj1976++ { - if yyhl1976 { - if yyj1976 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -23866,9 +29818,32 @@ func (x *Service) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1976Slc = r.DecodeBytes(yys1976Slc, true, true) - yys1976 := string(yys1976Slc) - switch yys1976 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ServiceSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ServiceStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -23881,134 +29856,117 @@ func (x *Service) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1979 := &x.ObjectMeta - yyv1979.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ServiceSpec{} - } else { - yyv1980 := &x.Spec - yyv1980.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = ServiceStatus{} - } else { - yyv1981 := &x.Status - yyv1981.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1976) - } // end switch yys1976 - } // end for yyj1976 - if !yyhl1976 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Service) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1982 int - var yyb1982 bool - var yyhl1982 bool = l >= 0 - yyj1982++ - if yyhl1982 { - yyb1982 = yyj1982 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1982 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1982 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ServiceSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ServiceStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1982++ - if yyhl1982 { - yyb1982 = yyj1982 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1982 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1982 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1982++ - if yyhl1982 { - yyb1982 = yyj1982 > l - } else { - yyb1982 = r.CheckBreak() - } - if yyb1982 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1985 := &x.ObjectMeta - yyv1985.CodecDecodeSelf(d) - } - yyj1982++ - if yyhl1982 { - yyb1982 = yyj1982 > l - } else { - yyb1982 = r.CheckBreak() - } - if yyb1982 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ServiceSpec{} - } else { - yyv1986 := &x.Spec - yyv1986.CodecDecodeSelf(d) - } - yyj1982++ - if yyhl1982 { - yyb1982 = yyj1982 > l - } else { - yyb1982 = r.CheckBreak() - } - if yyb1982 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = ServiceStatus{} - } else { - yyv1987 := &x.Status - yyv1987.CodecDecodeSelf(d) - } for { - yyj1982++ - if yyhl1982 { - yyb1982 = yyj1982 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1982 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1982 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj1982-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { @@ -24018,120 +29976,85 @@ func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1988 := z.EncBinary() - _ = yym1988 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1989 := !z.EncBinary() - yy2arr1989 := z.EncBasicHandle().StructToArray - var yyq1989 [5]bool - _, _, _ = yysep1989, yyq1989, yy2arr1989 - const yyr1989 bool = false - yyq1989[0] = x.Kind != "" - yyq1989[1] = x.APIVersion != "" - yyq1989[2] = true - yyq1989[4] = len(x.ImagePullSecrets) != 0 - if yyr1989 || yy2arr1989 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = len(x.ImagePullSecrets) != 0 + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1989 int = 1 - for _, b := range yyq1989 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1989++ + yynn2++ } } - r.EncodeMapStart(yynn1989) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1989 || yy2arr1989 { - if yyq1989[0] { - yym1991 := z.EncBinary() - _ = yym1991 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1989[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1992 := z.EncBinary() - _ = yym1992 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1989 || yy2arr1989 { - if yyq1989[1] { - yym1994 := z.EncBinary() - _ = yym1994 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1989[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1995 := z.EncBinary() - _ = yym1995 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1989 || yy2arr1989 { - if yyq1989[2] { - yy1997 := &x.ObjectMeta - yy1997.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1989[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1998 := &x.ObjectMeta - yy1998.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1989 || yy2arr1989 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Secrets == nil { r.EncodeNil() } else { - yym2000 := z.EncBinary() - _ = yym2000 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceObjectReference(([]ObjectReference)(x.Secrets), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secrets")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Secrets == nil { r.EncodeNil() } else { - yym2001 := z.EncBinary() - _ = yym2001 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceObjectReference(([]ObjectReference)(x.Secrets), e) } } } - if yyr1989 || yy2arr1989 { - if yyq1989[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.ImagePullSecrets == nil { r.EncodeNil() } else { - yym2003 := z.EncBinary() - _ = yym2003 + yym12 := z.EncBinary() + _ = yym12 if false { } else { h.encSliceLocalObjectReference(([]LocalObjectReference)(x.ImagePullSecrets), e) @@ -24141,13 +30064,15 @@ func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1989[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("imagePullSecrets")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ImagePullSecrets == nil { r.EncodeNil() } else { - yym2004 := z.EncBinary() - _ = yym2004 + yym13 := z.EncBinary() + _ = yym13 if false { } else { h.encSliceLocalObjectReference(([]LocalObjectReference)(x.ImagePullSecrets), e) @@ -24155,8 +30080,60 @@ func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1989 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -24166,24 +30143,25 @@ func (x *ServiceAccount) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2005 := z.DecBinary() - _ = yym2005 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2006 := r.ReadMapStart() - if yyl2006 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2006, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2006 := r.ReadArrayStart() - if yyl2006 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2006, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -24195,12 +30173,12 @@ func (x *ServiceAccount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2007Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2007Slc - var yyhl2007 bool = l >= 0 - for yyj2007 := 0; ; yyj2007++ { - if yyhl2007 { - if yyj2007 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -24208,9 +30186,42 @@ func (x *ServiceAccount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2007Slc = r.DecodeBytes(yys2007Slc, true, true) - yys2007 := string(yys2007Slc) - switch yys2007 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "secrets": + if r.TryDecodeAsNil() { + x.Secrets = nil + } else { + yyv5 := &x.Secrets + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceObjectReference((*[]ObjectReference)(yyv5), d) + } + } + case "imagePullSecrets": + if r.TryDecodeAsNil() { + x.ImagePullSecrets = nil + } else { + yyv7 := &x.ImagePullSecrets + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv7), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -24223,154 +30234,127 @@ func (x *ServiceAccount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2010 := &x.ObjectMeta - yyv2010.CodecDecodeSelf(d) - } - case "secrets": - if r.TryDecodeAsNil() { - x.Secrets = nil - } else { - yyv2011 := &x.Secrets - yym2012 := z.DecBinary() - _ = yym2012 - if false { - } else { - h.decSliceObjectReference((*[]ObjectReference)(yyv2011), d) - } - } - case "imagePullSecrets": - if r.TryDecodeAsNil() { - x.ImagePullSecrets = nil - } else { - yyv2013 := &x.ImagePullSecrets - yym2014 := z.DecBinary() - _ = yym2014 - if false { - } else { - h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv2013), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2007) - } // end switch yys2007 - } // end for yyj2007 - if !yyhl2007 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceAccount) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2015 int - var yyb2015 bool - var yyhl2015 bool = l >= 0 - yyj2015++ - if yyhl2015 { - yyb2015 = yyj2015 > l + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2015 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2015 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv12 := &x.ObjectMeta + yyv12.CodecDecodeSelf(d) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Secrets = nil + } else { + yyv13 := &x.Secrets + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceObjectReference((*[]ObjectReference)(yyv13), d) + } + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ImagePullSecrets = nil + } else { + yyv15 := &x.ImagePullSecrets + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv15), d) + } + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2015++ - if yyhl2015 { - yyb2015 = yyj2015 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2015 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2015 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2015++ - if yyhl2015 { - yyb2015 = yyj2015 > l - } else { - yyb2015 = r.CheckBreak() - } - if yyb2015 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2018 := &x.ObjectMeta - yyv2018.CodecDecodeSelf(d) - } - yyj2015++ - if yyhl2015 { - yyb2015 = yyj2015 > l - } else { - yyb2015 = r.CheckBreak() - } - if yyb2015 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Secrets = nil - } else { - yyv2019 := &x.Secrets - yym2020 := z.DecBinary() - _ = yym2020 - if false { - } else { - h.decSliceObjectReference((*[]ObjectReference)(yyv2019), d) - } - } - yyj2015++ - if yyhl2015 { - yyb2015 = yyj2015 > l - } else { - yyb2015 = r.CheckBreak() - } - if yyb2015 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ImagePullSecrets = nil - } else { - yyv2021 := &x.ImagePullSecrets - yym2022 := z.DecBinary() - _ = yym2022 - if false { - } else { - h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv2021), d) - } - } for { - yyj2015++ - if yyhl2015 { - yyb2015 = yyj2015 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2015 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2015 { + if yyb11 { break } - z.DecStructFieldNotFound(yyj2015-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServiceAccountList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -24380,126 +30364,142 @@ func (x *ServiceAccountList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2023 := z.EncBinary() - _ = yym2023 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2024 := !z.EncBinary() - yy2arr2024 := z.EncBasicHandle().StructToArray - var yyq2024 [4]bool - _, _, _ = yysep2024, yyq2024, yy2arr2024 - const yyr2024 bool = false - yyq2024[0] = x.Kind != "" - yyq2024[1] = x.APIVersion != "" - yyq2024[2] = true - if yyr2024 || yy2arr2024 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2024 int = 1 - for _, b := range yyq2024 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2024++ + yynn2++ } } - r.EncodeMapStart(yynn2024) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2024 || yy2arr2024 { - if yyq2024[0] { - yym2026 := z.EncBinary() - _ = yym2026 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2024[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2027 := z.EncBinary() - _ = yym2027 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2024 || yy2arr2024 { - if yyq2024[1] { - yym2029 := z.EncBinary() - _ = yym2029 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2024[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2030 := z.EncBinary() - _ = yym2030 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2024 || yy2arr2024 { - if yyq2024[2] { - yy2032 := &x.ListMeta - yym2033 := z.EncBinary() - _ = yym2033 - if false { - } else if z.HasExtensions() && z.EncExt(yy2032) { - } else { - z.EncFallback(yy2032) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2024[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2034 := &x.ListMeta - yym2035 := z.EncBinary() - _ = yym2035 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2034) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2034) + z.EncFallback(yy6) } } } - if yyr2024 || yy2arr2024 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2037 := z.EncBinary() - _ = yym2037 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceServiceAccount(([]ServiceAccount)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2038 := z.EncBinary() - _ = yym2038 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceServiceAccount(([]ServiceAccount)(x.Items), e) } } } - if yysep2024 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -24509,24 +30509,25 @@ func (x *ServiceAccountList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2039 := z.DecBinary() - _ = yym2039 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2040 := r.ReadMapStart() - if yyl2040 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2040, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2040 := r.ReadArrayStart() - if yyl2040 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2040, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -24538,12 +30539,12 @@ func (x *ServiceAccountList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2041Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2041Slc - var yyhl2041 bool = l >= 0 - for yyj2041 := 0; ; yyj2041++ { - if yyhl2041 { - if yyj2041 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -24551,9 +30552,36 @@ func (x *ServiceAccountList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys2041Slc = r.DecodeBytes(yys2041Slc, true, true) - yys2041 := string(yys2041Slc) - switch yys2041 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceServiceAccount((*[]ServiceAccount)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -24566,133 +30594,111 @@ func (x *ServiceAccountList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2044 := &x.ListMeta - yym2045 := z.DecBinary() - _ = yym2045 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2044) { - } else { - z.DecFallback(yyv2044, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2046 := &x.Items - yym2047 := z.DecBinary() - _ = yym2047 - if false { - } else { - h.decSliceServiceAccount((*[]ServiceAccount)(yyv2046), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2041) - } // end switch yys2041 - } // end for yyj2041 - if !yyhl2041 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceAccountList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2048 int - var yyb2048 bool - var yyhl2048 bool = l >= 0 - yyj2048++ - if yyhl2048 { - yyb2048 = yyj2048 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2048 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2048 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceServiceAccount((*[]ServiceAccount)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2048++ - if yyhl2048 { - yyb2048 = yyj2048 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2048 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2048 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2048++ - if yyhl2048 { - yyb2048 = yyj2048 > l - } else { - yyb2048 = r.CheckBreak() - } - if yyb2048 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2051 := &x.ListMeta - yym2052 := z.DecBinary() - _ = yym2052 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2051) { - } else { - z.DecFallback(yyv2051, false) - } - } - yyj2048++ - if yyhl2048 { - yyb2048 = yyj2048 > l - } else { - yyb2048 = r.CheckBreak() - } - if yyb2048 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2053 := &x.Items - yym2054 := z.DecBinary() - _ = yym2054 - if false { - } else { - h.decSliceServiceAccount((*[]ServiceAccount)(yyv2053), d) - } - } for { - yyj2048++ - if yyhl2048 { - yyb2048 = yyj2048 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2048 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2048 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2048-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Endpoints) CodecEncodeSelf(e *codec1978.Encoder) { @@ -24702,114 +30708,130 @@ func (x *Endpoints) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2055 := z.EncBinary() - _ = yym2055 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2056 := !z.EncBinary() - yy2arr2056 := z.EncBasicHandle().StructToArray - var yyq2056 [4]bool - _, _, _ = yysep2056, yyq2056, yy2arr2056 - const yyr2056 bool = false - yyq2056[0] = x.Kind != "" - yyq2056[1] = x.APIVersion != "" - yyq2056[2] = true - if yyr2056 || yy2arr2056 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2056 int = 1 - for _, b := range yyq2056 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2056++ + yynn2++ } } - r.EncodeMapStart(yynn2056) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2056 || yy2arr2056 { - if yyq2056[0] { - yym2058 := z.EncBinary() - _ = yym2058 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2056[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2059 := z.EncBinary() - _ = yym2059 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2056 || yy2arr2056 { - if yyq2056[1] { - yym2061 := z.EncBinary() - _ = yym2061 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2056[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2062 := z.EncBinary() - _ = yym2062 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2056 || yy2arr2056 { - if yyq2056[2] { - yy2064 := &x.ObjectMeta - yy2064.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2056[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2065 := &x.ObjectMeta - yy2065.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr2056 || yy2arr2056 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Subsets == nil { r.EncodeNil() } else { - yym2067 := z.EncBinary() - _ = yym2067 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceEndpointSubset(([]EndpointSubset)(x.Subsets), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Subsets")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Subsets == nil { r.EncodeNil() } else { - yym2068 := z.EncBinary() - _ = yym2068 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceEndpointSubset(([]EndpointSubset)(x.Subsets), e) } } } - if yysep2056 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -24819,24 +30841,25 @@ func (x *Endpoints) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2069 := z.DecBinary() - _ = yym2069 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2070 := r.ReadMapStart() - if yyl2070 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2070, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2070 := r.ReadArrayStart() - if yyl2070 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2070, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -24848,12 +30871,12 @@ func (x *Endpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2071Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2071Slc - var yyhl2071 bool = l >= 0 - for yyj2071 := 0; ; yyj2071++ { - if yyhl2071 { - if yyj2071 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -24861,9 +30884,30 @@ func (x *Endpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2071Slc = r.DecodeBytes(yys2071Slc, true, true) - yys2071 := string(yys2071Slc) - switch yys2071 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "Subsets": + if r.TryDecodeAsNil() { + x.Subsets = nil + } else { + yyv5 := &x.Subsets + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceEndpointSubset((*[]EndpointSubset)(yyv5), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -24876,121 +30920,105 @@ func (x *Endpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2074 := &x.ObjectMeta - yyv2074.CodecDecodeSelf(d) - } - case "Subsets": - if r.TryDecodeAsNil() { - x.Subsets = nil - } else { - yyv2075 := &x.Subsets - yym2076 := z.DecBinary() - _ = yym2076 - if false { - } else { - h.decSliceEndpointSubset((*[]EndpointSubset)(yyv2075), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2071) - } // end switch yys2071 - } // end for yyj2071 - if !yyhl2071 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Endpoints) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2077 int - var yyb2077 bool - var yyhl2077 bool = l >= 0 - yyj2077++ - if yyhl2077 { - yyb2077 = yyj2077 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2077 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2077 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Subsets = nil + } else { + yyv11 := &x.Subsets + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + h.decSliceEndpointSubset((*[]EndpointSubset)(yyv11), d) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2077++ - if yyhl2077 { - yyb2077 = yyj2077 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2077 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2077 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2077++ - if yyhl2077 { - yyb2077 = yyj2077 > l - } else { - yyb2077 = r.CheckBreak() - } - if yyb2077 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2080 := &x.ObjectMeta - yyv2080.CodecDecodeSelf(d) - } - yyj2077++ - if yyhl2077 { - yyb2077 = yyj2077 > l - } else { - yyb2077 = r.CheckBreak() - } - if yyb2077 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Subsets = nil - } else { - yyv2081 := &x.Subsets - yym2082 := z.DecBinary() - _ = yym2082 - if false { - } else { - h.decSliceEndpointSubset((*[]EndpointSubset)(yyv2081), d) - } - } for { - yyj2077++ - if yyhl2077 { - yyb2077 = yyj2077 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2077 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2077 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj2077-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { @@ -25000,101 +31028,114 @@ func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2083 := z.EncBinary() - _ = yym2083 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2084 := !z.EncBinary() - yy2arr2084 := z.EncBasicHandle().StructToArray - var yyq2084 [3]bool - _, _, _ = yysep2084, yyq2084, yy2arr2084 - const yyr2084 bool = false - if yyr2084 || yy2arr2084 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn2084 int = 3 - for _, b := range yyq2084 { + yynn2 = 3 + for _, b := range yyq2 { if b { - yynn2084++ + yynn2++ } } - r.EncodeMapStart(yynn2084) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2084 || yy2arr2084 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Addresses == nil { r.EncodeNil() } else { - yym2086 := z.EncBinary() - _ = yym2086 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceEndpointAddress(([]EndpointAddress)(x.Addresses), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Addresses")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Addresses == nil { r.EncodeNil() } else { - yym2087 := z.EncBinary() - _ = yym2087 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceEndpointAddress(([]EndpointAddress)(x.Addresses), e) } } } - if yyr2084 || yy2arr2084 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.NotReadyAddresses == nil { r.EncodeNil() } else { - yym2089 := z.EncBinary() - _ = yym2089 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSliceEndpointAddress(([]EndpointAddress)(x.NotReadyAddresses), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("NotReadyAddresses")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.NotReadyAddresses == nil { r.EncodeNil() } else { - yym2090 := z.EncBinary() - _ = yym2090 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSliceEndpointAddress(([]EndpointAddress)(x.NotReadyAddresses), e) } } } - if yyr2084 || yy2arr2084 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Ports == nil { r.EncodeNil() } else { - yym2092 := z.EncBinary() - _ = yym2092 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceEndpointPort(([]EndpointPort)(x.Ports), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Ports")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Ports == nil { r.EncodeNil() } else { - yym2093 := z.EncBinary() - _ = yym2093 + yym11 := z.EncBinary() + _ = yym11 if false { } else { h.encSliceEndpointPort(([]EndpointPort)(x.Ports), e) } } } - if yysep2084 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -25104,24 +31145,25 @@ func (x *EndpointSubset) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2094 := z.DecBinary() - _ = yym2094 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2095 := r.ReadMapStart() - if yyl2095 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2095, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2095 := r.ReadArrayStart() - if yyl2095 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2095, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -25133,12 +31175,12 @@ func (x *EndpointSubset) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2096Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2096Slc - var yyhl2096 bool = l >= 0 - for yyj2096 := 0; ; yyj2096++ { - if yyhl2096 { - if yyj2096 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -25146,137 +31188,141 @@ func (x *EndpointSubset) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2096Slc = r.DecodeBytes(yys2096Slc, true, true) - yys2096 := string(yys2096Slc) - switch yys2096 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "Addresses": if r.TryDecodeAsNil() { x.Addresses = nil } else { - yyv2097 := &x.Addresses - yym2098 := z.DecBinary() - _ = yym2098 + yyv4 := &x.Addresses + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceEndpointAddress((*[]EndpointAddress)(yyv2097), d) + h.decSliceEndpointAddress((*[]EndpointAddress)(yyv4), d) } } case "NotReadyAddresses": if r.TryDecodeAsNil() { x.NotReadyAddresses = nil } else { - yyv2099 := &x.NotReadyAddresses - yym2100 := z.DecBinary() - _ = yym2100 + yyv6 := &x.NotReadyAddresses + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceEndpointAddress((*[]EndpointAddress)(yyv2099), d) + h.decSliceEndpointAddress((*[]EndpointAddress)(yyv6), d) } } case "Ports": if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv2101 := &x.Ports - yym2102 := z.DecBinary() - _ = yym2102 + yyv8 := &x.Ports + yym9 := z.DecBinary() + _ = yym9 if false { } else { - h.decSliceEndpointPort((*[]EndpointPort)(yyv2101), d) + h.decSliceEndpointPort((*[]EndpointPort)(yyv8), d) } } default: - z.DecStructFieldNotFound(-1, yys2096) - } // end switch yys2096 - } // end for yyj2096 - if !yyhl2096 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EndpointSubset) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2103 int - var yyb2103 bool - var yyhl2103 bool = l >= 0 - yyj2103++ - if yyhl2103 { - yyb2103 = yyj2103 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2103 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2103 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Addresses = nil } else { - yyv2104 := &x.Addresses - yym2105 := z.DecBinary() - _ = yym2105 + yyv11 := &x.Addresses + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSliceEndpointAddress((*[]EndpointAddress)(yyv2104), d) + h.decSliceEndpointAddress((*[]EndpointAddress)(yyv11), d) } } - yyj2103++ - if yyhl2103 { - yyb2103 = yyj2103 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2103 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2103 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NotReadyAddresses = nil } else { - yyv2106 := &x.NotReadyAddresses - yym2107 := z.DecBinary() - _ = yym2107 + yyv13 := &x.NotReadyAddresses + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceEndpointAddress((*[]EndpointAddress)(yyv2106), d) + h.decSliceEndpointAddress((*[]EndpointAddress)(yyv13), d) } } - yyj2103++ - if yyhl2103 { - yyb2103 = yyj2103 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2103 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2103 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv2108 := &x.Ports - yym2109 := z.DecBinary() - _ = yym2109 + yyv15 := &x.Ports + yym16 := z.DecBinary() + _ = yym16 if false { } else { - h.decSliceEndpointPort((*[]EndpointPort)(yyv2108), d) + h.decSliceEndpointPort((*[]EndpointPort)(yyv15), d) } } for { - yyj2103++ - if yyhl2103 { - yyb2103 = yyj2103 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2103 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2103 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2103-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EndpointAddress) CodecEncodeSelf(e *codec1978.Encoder) { @@ -25286,59 +31332,69 @@ func (x *EndpointAddress) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2110 := z.EncBinary() - _ = yym2110 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2111 := !z.EncBinary() - yy2arr2111 := z.EncBasicHandle().StructToArray - var yyq2111 [2]bool - _, _, _ = yysep2111, yyq2111, yy2arr2111 - const yyr2111 bool = false - if yyr2111 || yy2arr2111 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn2111 int = 2 - for _, b := range yyq2111 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn2111++ + yynn2++ } } - r.EncodeMapStart(yynn2111) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2111 || yy2arr2111 { - yym2113 := z.EncBinary() - _ = yym2113 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IP)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("IP")) - yym2114 := z.EncBinary() - _ = yym2114 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IP)) } } - if yyr2111 || yy2arr2111 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.TargetRef == nil { r.EncodeNil() } else { x.TargetRef.CodecEncodeSelf(e) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("TargetRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TargetRef == nil { r.EncodeNil() } else { x.TargetRef.CodecEncodeSelf(e) } } - if yysep2111 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -25348,24 +31404,25 @@ func (x *EndpointAddress) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2116 := z.DecBinary() - _ = yym2116 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2117 := r.ReadMapStart() - if yyl2117 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2117, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2117 := r.ReadArrayStart() - if yyl2117 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2117, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -25377,12 +31434,12 @@ func (x *EndpointAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2118Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2118Slc - var yyhl2118 bool = l >= 0 - for yyj2118 := 0; ; yyj2118++ { - if yyhl2118 { - if yyj2118 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -25390,9 +31447,11 @@ func (x *EndpointAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2118Slc = r.DecodeBytes(yys2118Slc, true, true) - yys2118 := string(yys2118Slc) - switch yys2118 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "IP": if r.TryDecodeAsNil() { x.IP = "" @@ -25411,46 +31470,46 @@ func (x *EndpointAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.TargetRef.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys2118) - } // end switch yys2118 - } // end for yyj2118 - if !yyhl2118 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EndpointAddress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2121 int - var yyb2121 bool - var yyhl2121 bool = l >= 0 - yyj2121++ - if yyhl2121 { - yyb2121 = yyj2121 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2121 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2121 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.IP = "" } else { x.IP = string(r.DecodeString()) } - yyj2121++ - if yyhl2121 { - yyb2121 = yyj2121 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2121 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2121 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.TargetRef != nil { x.TargetRef = nil @@ -25462,18 +31521,19 @@ func (x *EndpointAddress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) x.TargetRef.CodecDecodeSelf(d) } for { - yyj2121++ - if yyhl2121 { - yyb2121 = yyj2121 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2121 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2121 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj2121-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EndpointPort) CodecEncodeSelf(e *codec1978.Encoder) { @@ -25483,67 +31543,80 @@ func (x *EndpointPort) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2124 := z.EncBinary() - _ = yym2124 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2125 := !z.EncBinary() - yy2arr2125 := z.EncBasicHandle().StructToArray - var yyq2125 [3]bool - _, _, _ = yysep2125, yyq2125, yy2arr2125 - const yyr2125 bool = false - if yyr2125 || yy2arr2125 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn2125 int = 3 - for _, b := range yyq2125 { + yynn2 = 3 + for _, b := range yyq2 { if b { - yynn2125++ + yynn2++ } } - r.EncodeMapStart(yynn2125) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2125 || yy2arr2125 { - yym2127 := z.EncBinary() - _ = yym2127 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Name")) - yym2128 := z.EncBinary() - _ = yym2128 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr2125 || yy2arr2125 { - yym2130 := z.EncBinary() - _ = yym2130 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.Port)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Port")) - yym2131 := z.EncBinary() - _ = yym2131 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.Port)) } } - if yyr2125 || yy2arr2125 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Protocol.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Protocol")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Protocol.CodecEncodeSelf(e) } - if yysep2125 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -25553,24 +31626,25 @@ func (x *EndpointPort) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2133 := z.DecBinary() - _ = yym2133 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2134 := r.ReadMapStart() - if yyl2134 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2134, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2134 := r.ReadArrayStart() - if yyl2134 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2134, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -25582,12 +31656,12 @@ func (x *EndpointPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2135Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2135Slc - var yyhl2135 bool = l >= 0 - for yyj2135 := 0; ; yyj2135++ { - if yyhl2135 { - if yyj2135 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -25595,9 +31669,11 @@ func (x *EndpointPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2135Slc = r.DecodeBytes(yys2135Slc, true, true) - yys2135 := string(yys2135Slc) - switch yys2135 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "Name": if r.TryDecodeAsNil() { x.Name = "" @@ -25617,79 +31693,81 @@ func (x *EndpointPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Protocol = Protocol(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2135) - } // end switch yys2135 - } // end for yyj2135 - if !yyhl2135 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EndpointPort) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2139 int - var yyb2139 bool - var yyhl2139 bool = l >= 0 - yyj2139++ - if yyhl2139 { - yyb2139 = yyj2139 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2139 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2139 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj2139++ - if yyhl2139 { - yyb2139 = yyj2139 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2139 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2139 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Port = 0 } else { x.Port = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj2139++ - if yyhl2139 { - yyb2139 = yyj2139 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2139 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2139 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Protocol = "" } else { x.Protocol = Protocol(r.DecodeString()) } for { - yyj2139++ - if yyhl2139 { - yyb2139 = yyj2139 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2139 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2139 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj2139-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EndpointsList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -25699,126 +31777,142 @@ func (x *EndpointsList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2143 := z.EncBinary() - _ = yym2143 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2144 := !z.EncBinary() - yy2arr2144 := z.EncBasicHandle().StructToArray - var yyq2144 [4]bool - _, _, _ = yysep2144, yyq2144, yy2arr2144 - const yyr2144 bool = false - yyq2144[0] = x.Kind != "" - yyq2144[1] = x.APIVersion != "" - yyq2144[2] = true - if yyr2144 || yy2arr2144 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2144 int = 1 - for _, b := range yyq2144 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2144++ + yynn2++ } } - r.EncodeMapStart(yynn2144) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2144 || yy2arr2144 { - if yyq2144[0] { - yym2146 := z.EncBinary() - _ = yym2146 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2144[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2147 := z.EncBinary() - _ = yym2147 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2144 || yy2arr2144 { - if yyq2144[1] { - yym2149 := z.EncBinary() - _ = yym2149 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2144[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2150 := z.EncBinary() - _ = yym2150 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2144 || yy2arr2144 { - if yyq2144[2] { - yy2152 := &x.ListMeta - yym2153 := z.EncBinary() - _ = yym2153 - if false { - } else if z.HasExtensions() && z.EncExt(yy2152) { - } else { - z.EncFallback(yy2152) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2144[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2154 := &x.ListMeta - yym2155 := z.EncBinary() - _ = yym2155 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2154) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2154) + z.EncFallback(yy6) } } } - if yyr2144 || yy2arr2144 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2157 := z.EncBinary() - _ = yym2157 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceEndpoints(([]Endpoints)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2158 := z.EncBinary() - _ = yym2158 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceEndpoints(([]Endpoints)(x.Items), e) } } } - if yysep2144 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -25828,24 +31922,25 @@ func (x *EndpointsList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2159 := z.DecBinary() - _ = yym2159 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2160 := r.ReadMapStart() - if yyl2160 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2160, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2160 := r.ReadArrayStart() - if yyl2160 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2160, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -25857,12 +31952,12 @@ func (x *EndpointsList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2161Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2161Slc - var yyhl2161 bool = l >= 0 - for yyj2161 := 0; ; yyj2161++ { - if yyhl2161 { - if yyj2161 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -25870,9 +31965,36 @@ func (x *EndpointsList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2161Slc = r.DecodeBytes(yys2161Slc, true, true) - yys2161 := string(yys2161Slc) - switch yys2161 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceEndpoints((*[]Endpoints)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -25885,133 +32007,111 @@ func (x *EndpointsList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2164 := &x.ListMeta - yym2165 := z.DecBinary() - _ = yym2165 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2164) { - } else { - z.DecFallback(yyv2164, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2166 := &x.Items - yym2167 := z.DecBinary() - _ = yym2167 - if false { - } else { - h.decSliceEndpoints((*[]Endpoints)(yyv2166), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2161) - } // end switch yys2161 - } // end for yyj2161 - if !yyhl2161 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EndpointsList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2168 int - var yyb2168 bool - var yyhl2168 bool = l >= 0 - yyj2168++ - if yyhl2168 { - yyb2168 = yyj2168 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2168 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2168 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceEndpoints((*[]Endpoints)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2168++ - if yyhl2168 { - yyb2168 = yyj2168 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2168 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2168 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2168++ - if yyhl2168 { - yyb2168 = yyj2168 > l - } else { - yyb2168 = r.CheckBreak() - } - if yyb2168 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2171 := &x.ListMeta - yym2172 := z.DecBinary() - _ = yym2172 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2171) { - } else { - z.DecFallback(yyv2171, false) - } - } - yyj2168++ - if yyhl2168 { - yyb2168 = yyj2168 > l - } else { - yyb2168 = r.CheckBreak() - } - if yyb2168 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2173 := &x.Items - yym2174 := z.DecBinary() - _ = yym2174 - if false { - } else { - h.decSliceEndpoints((*[]Endpoints)(yyv2173), d) - } - } for { - yyj2168++ - if yyhl2168 { - yyb2168 = yyj2168 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2168 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2168 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2168-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -26021,35 +32121,38 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2175 := z.EncBinary() - _ = yym2175 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2176 := !z.EncBinary() - yy2arr2176 := z.EncBasicHandle().StructToArray - var yyq2176 [4]bool - _, _, _ = yysep2176, yyq2176, yy2arr2176 - const yyr2176 bool = false - yyq2176[0] = x.PodCIDR != "" - yyq2176[1] = x.ExternalID != "" - yyq2176[2] = x.ProviderID != "" - yyq2176[3] = x.Unschedulable != false - if yyr2176 || yy2arr2176 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.PodCIDR != "" + yyq2[1] = x.ExternalID != "" + yyq2[2] = x.ProviderID != "" + yyq2[3] = x.Unschedulable != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2176 int = 0 - for _, b := range yyq2176 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2176++ + yynn2++ } } - r.EncodeMapStart(yynn2176) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2176 || yy2arr2176 { - if yyq2176[0] { - yym2178 := z.EncBinary() - _ = yym2178 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PodCIDR)) @@ -26058,20 +32161,23 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2176[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("podCIDR")) - yym2179 := z.EncBinary() - _ = yym2179 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PodCIDR)) } } } - if yyr2176 || yy2arr2176 { - if yyq2176[1] { - yym2181 := z.EncBinary() - _ = yym2181 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ExternalID)) @@ -26080,20 +32186,23 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2176[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("externalID")) - yym2182 := z.EncBinary() - _ = yym2182 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ExternalID)) } } } - if yyr2176 || yy2arr2176 { - if yyq2176[2] { - yym2184 := z.EncBinary() - _ = yym2184 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ProviderID)) @@ -26102,20 +32211,23 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2176[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("providerID")) - yym2185 := z.EncBinary() - _ = yym2185 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ProviderID)) } } } - if yyr2176 || yy2arr2176 { - if yyq2176[3] { - yym2187 := z.EncBinary() - _ = yym2187 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeBool(bool(x.Unschedulable)) @@ -26124,18 +32236,22 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq2176[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("unschedulable")) - yym2188 := z.EncBinary() - _ = yym2188 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeBool(bool(x.Unschedulable)) } } } - if yysep2176 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -26145,24 +32261,25 @@ func (x *NodeSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2189 := z.DecBinary() - _ = yym2189 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2190 := r.ReadMapStart() - if yyl2190 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2190, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2190 := r.ReadArrayStart() - if yyl2190 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2190, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -26174,12 +32291,12 @@ func (x *NodeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2191Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2191Slc - var yyhl2191 bool = l >= 0 - for yyj2191 := 0; ; yyj2191++ { - if yyhl2191 { - if yyj2191 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -26187,9 +32304,11 @@ func (x *NodeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2191Slc = r.DecodeBytes(yys2191Slc, true, true) - yys2191 := string(yys2191Slc) - switch yys2191 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "podCIDR": if r.TryDecodeAsNil() { x.PodCIDR = "" @@ -26215,94 +32334,97 @@ func (x *NodeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Unschedulable = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys2191) - } // end switch yys2191 - } // end for yyj2191 - if !yyhl2191 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2196 int - var yyb2196 bool - var yyhl2196 bool = l >= 0 - yyj2196++ - if yyhl2196 { - yyb2196 = yyj2196 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2196 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2196 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.PodCIDR = "" } else { x.PodCIDR = string(r.DecodeString()) } - yyj2196++ - if yyhl2196 { - yyb2196 = yyj2196 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2196 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2196 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ExternalID = "" } else { x.ExternalID = string(r.DecodeString()) } - yyj2196++ - if yyhl2196 { - yyb2196 = yyj2196 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2196 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2196 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ProviderID = "" } else { x.ProviderID = string(r.DecodeString()) } - yyj2196++ - if yyhl2196 { - yyb2196 = yyj2196 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2196 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2196 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Unschedulable = false } else { x.Unschedulable = bool(r.DecodeBool()) } for { - yyj2196++ - if yyhl2196 { - yyb2196 = yyj2196 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2196 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2196 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj2196-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonEndpoint) CodecEncodeSelf(e *codec1978.Encoder) { @@ -26312,45 +32434,52 @@ func (x *DaemonEndpoint) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2201 := z.EncBinary() - _ = yym2201 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2202 := !z.EncBinary() - yy2arr2202 := z.EncBasicHandle().StructToArray - var yyq2202 [1]bool - _, _, _ = yysep2202, yyq2202, yy2arr2202 - const yyr2202 bool = false - if yyr2202 || yy2arr2202 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2202 int = 1 - for _, b := range yyq2202 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2202++ + yynn2++ } } - r.EncodeMapStart(yynn2202) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2202 || yy2arr2202 { - yym2204 := z.EncBinary() - _ = yym2204 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Port)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Port")) - yym2205 := z.EncBinary() - _ = yym2205 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Port)) } } - if yysep2202 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -26360,24 +32489,25 @@ func (x *DaemonEndpoint) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2206 := z.DecBinary() - _ = yym2206 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2207 := r.ReadMapStart() - if yyl2207 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2207, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2207 := r.ReadArrayStart() - if yyl2207 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2207, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -26389,12 +32519,12 @@ func (x *DaemonEndpoint) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2208Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2208Slc - var yyhl2208 bool = l >= 0 - for yyj2208 := 0; ; yyj2208++ { - if yyhl2208 { - if yyj2208 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -26402,9 +32532,11 @@ func (x *DaemonEndpoint) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2208Slc = r.DecodeBytes(yys2208Slc, true, true) - yys2208 := string(yys2208Slc) - switch yys2208 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "Port": if r.TryDecodeAsNil() { x.Port = 0 @@ -26412,49 +32544,49 @@ func (x *DaemonEndpoint) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Port = int(r.DecodeInt(codecSelferBitsize1234)) } default: - z.DecStructFieldNotFound(-1, yys2208) - } // end switch yys2208 - } // end for yyj2208 - if !yyhl2208 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonEndpoint) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2210 int - var yyb2210 bool - var yyhl2210 bool = l >= 0 - yyj2210++ - if yyhl2210 { - yyb2210 = yyj2210 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2210 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2210 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Port = 0 } else { x.Port = int(r.DecodeInt(codecSelferBitsize1234)) } for { - yyj2210++ - if yyhl2210 { - yyb2210 = yyj2210 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2210 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2210 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj2210-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeDaemonEndpoints) CodecEncodeSelf(e *codec1978.Encoder) { @@ -26464,44 +32596,51 @@ func (x *NodeDaemonEndpoints) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2212 := z.EncBinary() - _ = yym2212 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2213 := !z.EncBinary() - yy2arr2213 := z.EncBasicHandle().StructToArray - var yyq2213 [1]bool - _, _, _ = yysep2213, yyq2213, yy2arr2213 - const yyr2213 bool = false - yyq2213[0] = true - if yyr2213 || yy2arr2213 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2213 int = 0 - for _, b := range yyq2213 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2213++ + yynn2++ } } - r.EncodeMapStart(yynn2213) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2213 || yy2arr2213 { - if yyq2213[0] { - yy2215 := &x.KubeletEndpoint - yy2215.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.KubeletEndpoint + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2213[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kubeletEndpoint")) - yy2216 := &x.KubeletEndpoint - yy2216.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.KubeletEndpoint + yy6.CodecEncodeSelf(e) } } - if yysep2213 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -26511,24 +32650,25 @@ func (x *NodeDaemonEndpoints) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2217 := z.DecBinary() - _ = yym2217 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2218 := r.ReadMapStart() - if yyl2218 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2218, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2218 := r.ReadArrayStart() - if yyl2218 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2218, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -26540,12 +32680,12 @@ func (x *NodeDaemonEndpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2219Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2219Slc - var yyhl2219 bool = l >= 0 - for yyj2219 := 0; ; yyj2219++ { - if yyhl2219 { - if yyj2219 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -26553,61 +32693,63 @@ func (x *NodeDaemonEndpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys2219Slc = r.DecodeBytes(yys2219Slc, true, true) - yys2219 := string(yys2219Slc) - switch yys2219 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "kubeletEndpoint": if r.TryDecodeAsNil() { x.KubeletEndpoint = DaemonEndpoint{} } else { - yyv2220 := &x.KubeletEndpoint - yyv2220.CodecDecodeSelf(d) + yyv4 := &x.KubeletEndpoint + yyv4.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys2219) - } // end switch yys2219 - } // end for yyj2219 - if !yyhl2219 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeDaemonEndpoints) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2221 int - var yyb2221 bool - var yyhl2221 bool = l >= 0 - yyj2221++ - if yyhl2221 { - yyb2221 = yyj2221 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2221 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2221 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.KubeletEndpoint = DaemonEndpoint{} } else { - yyv2222 := &x.KubeletEndpoint - yyv2222.CodecDecodeSelf(d) + yyv6 := &x.KubeletEndpoint + yyv6.CodecDecodeSelf(d) } for { - yyj2221++ - if yyhl2221 { - yyb2221 = yyj2221 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2221 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2221 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj2221-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeSystemInfo) CodecEncodeSelf(e *codec1978.Encoder) { @@ -26617,157 +32759,185 @@ func (x *NodeSystemInfo) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2223 := z.EncBinary() - _ = yym2223 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2224 := !z.EncBinary() - yy2arr2224 := z.EncBasicHandle().StructToArray - var yyq2224 [8]bool - _, _, _ = yysep2224, yyq2224, yy2arr2224 - const yyr2224 bool = false - if yyr2224 || yy2arr2224 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - var yynn2224 int = 8 - for _, b := range yyq2224 { + yynn2 = 8 + for _, b := range yyq2 { if b { - yynn2224++ + yynn2++ } } - r.EncodeMapStart(yynn2224) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2224 || yy2arr2224 { - yym2226 := z.EncBinary() - _ = yym2226 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.MachineID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("machineID")) - yym2227 := z.EncBinary() - _ = yym2227 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.MachineID)) } } - if yyr2224 || yy2arr2224 { - yym2229 := z.EncBinary() - _ = yym2229 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SystemUUID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("systemUUID")) - yym2230 := z.EncBinary() - _ = yym2230 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SystemUUID)) } } - if yyr2224 || yy2arr2224 { - yym2232 := z.EncBinary() - _ = yym2232 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.BootID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("bootID")) - yym2233 := z.EncBinary() - _ = yym2233 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.BootID)) } } - if yyr2224 || yy2arr2224 { - yym2235 := z.EncBinary() - _ = yym2235 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KernelVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kernelVersion")) - yym2236 := z.EncBinary() - _ = yym2236 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KernelVersion)) } } - if yyr2224 || yy2arr2224 { - yym2238 := z.EncBinary() - _ = yym2238 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym16 := z.EncBinary() + _ = yym16 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.OsImage)) + r.EncodeString(codecSelferC_UTF81234, string(x.OSImage)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("osImage")) - yym2239 := z.EncBinary() - _ = yym2239 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.OsImage)) + r.EncodeString(codecSelferC_UTF81234, string(x.OSImage)) } } - if yyr2224 || yy2arr2224 { - yym2241 := z.EncBinary() - _ = yym2241 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerRuntimeVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerRuntimeVersion")) - yym2242 := z.EncBinary() - _ = yym2242 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerRuntimeVersion)) } } - if yyr2224 || yy2arr2224 { - yym2244 := z.EncBinary() - _ = yym2244 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym22 := z.EncBinary() + _ = yym22 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KubeletVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kubeletVersion")) - yym2245 := z.EncBinary() - _ = yym2245 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KubeletVersion)) } } - if yyr2224 || yy2arr2224 { - yym2247 := z.EncBinary() - _ = yym2247 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym25 := z.EncBinary() + _ = yym25 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KubeProxyVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kubeProxyVersion")) - yym2248 := z.EncBinary() - _ = yym2248 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KubeProxyVersion)) } } - if yysep2224 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -26777,24 +32947,25 @@ func (x *NodeSystemInfo) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2249 := z.DecBinary() - _ = yym2249 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2250 := r.ReadMapStart() - if yyl2250 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2250, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2250 := r.ReadArrayStart() - if yyl2250 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2250, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -26806,12 +32977,12 @@ func (x *NodeSystemInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2251Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2251Slc - var yyhl2251 bool = l >= 0 - for yyj2251 := 0; ; yyj2251++ { - if yyhl2251 { - if yyj2251 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -26819,9 +32990,11 @@ func (x *NodeSystemInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2251Slc = r.DecodeBytes(yys2251Slc, true, true) - yys2251 := string(yys2251Slc) - switch yys2251 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "machineID": if r.TryDecodeAsNil() { x.MachineID = "" @@ -26848,9 +33021,9 @@ func (x *NodeSystemInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "osImage": if r.TryDecodeAsNil() { - x.OsImage = "" + x.OSImage = "" } else { - x.OsImage = string(r.DecodeString()) + x.OSImage = string(r.DecodeString()) } case "containerRuntimeVersion": if r.TryDecodeAsNil() { @@ -26871,154 +33044,161 @@ func (x *NodeSystemInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.KubeProxyVersion = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2251) - } // end switch yys2251 - } // end for yyj2251 - if !yyhl2251 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2260 int - var yyb2260 bool - var yyhl2260 bool = l >= 0 - yyj2260++ - if yyhl2260 { - yyb2260 = yyj2260 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2260 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2260 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MachineID = "" } else { x.MachineID = string(r.DecodeString()) } - yyj2260++ - if yyhl2260 { - yyb2260 = yyj2260 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2260 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2260 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SystemUUID = "" } else { x.SystemUUID = string(r.DecodeString()) } - yyj2260++ - if yyhl2260 { - yyb2260 = yyj2260 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2260 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2260 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.BootID = "" } else { x.BootID = string(r.DecodeString()) } - yyj2260++ - if yyhl2260 { - yyb2260 = yyj2260 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2260 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2260 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.KernelVersion = "" } else { x.KernelVersion = string(r.DecodeString()) } - yyj2260++ - if yyhl2260 { - yyb2260 = yyj2260 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2260 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2260 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.OsImage = "" + x.OSImage = "" } else { - x.OsImage = string(r.DecodeString()) + x.OSImage = string(r.DecodeString()) } - yyj2260++ - if yyhl2260 { - yyb2260 = yyj2260 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2260 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2260 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerRuntimeVersion = "" } else { x.ContainerRuntimeVersion = string(r.DecodeString()) } - yyj2260++ - if yyhl2260 { - yyb2260 = yyj2260 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2260 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2260 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.KubeletVersion = "" } else { x.KubeletVersion = string(r.DecodeString()) } - yyj2260++ - if yyhl2260 { - yyb2260 = yyj2260 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2260 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2260 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.KubeProxyVersion = "" } else { x.KubeProxyVersion = string(r.DecodeString()) } for { - yyj2260++ - if yyhl2260 { - yyb2260 = yyj2260 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2260 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2260 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj2260-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -27028,35 +33208,39 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2269 := z.EncBinary() - _ = yym2269 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2270 := !z.EncBinary() - yy2arr2270 := z.EncBasicHandle().StructToArray - var yyq2270 [6]bool - _, _, _ = yysep2270, yyq2270, yy2arr2270 - const yyr2270 bool = false - yyq2270[0] = len(x.Capacity) != 0 - yyq2270[1] = x.Phase != "" - yyq2270[2] = len(x.Conditions) != 0 - yyq2270[3] = len(x.Addresses) != 0 - yyq2270[4] = true - yyq2270[5] = true - if yyr2270 || yy2arr2270 { - r.EncodeArrayStart(6) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Capacity) != 0 + yyq2[1] = len(x.Allocatable) != 0 + yyq2[2] = x.Phase != "" + yyq2[3] = len(x.Conditions) != 0 + yyq2[4] = len(x.Addresses) != 0 + yyq2[5] = true + yyq2[6] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(8) } else { - var yynn2270 int = 0 - for _, b := range yyq2270 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2270++ + yynn2++ } } - r.EncodeMapStart(yynn2270) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2270 || yy2arr2270 { - if yyq2270[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Capacity == nil { r.EncodeNil() } else { @@ -27066,8 +33250,10 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2270[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("capacity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Capacity == nil { r.EncodeNil() } else { @@ -27075,25 +33261,52 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2270 || yy2arr2270 { - if yyq2270[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Allocatable == nil { + r.EncodeNil() + } else { + x.Allocatable.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("allocatable")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Allocatable == nil { + r.EncodeNil() + } else { + x.Allocatable.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2270[1] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yyr2270 || yy2arr2270 { - if yyq2270[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.Conditions == nil { r.EncodeNil() } else { - yym2274 := z.EncBinary() - _ = yym2274 + yym13 := z.EncBinary() + _ = yym13 if false { } else { h.encSliceNodeCondition(([]NodeCondition)(x.Conditions), e) @@ -27103,13 +33316,15 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2270[2] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("conditions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Conditions == nil { r.EncodeNil() } else { - yym2275 := z.EncBinary() - _ = yym2275 + yym14 := z.EncBinary() + _ = yym14 if false { } else { h.encSliceNodeCondition(([]NodeCondition)(x.Conditions), e) @@ -27117,13 +33332,14 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2270 || yy2arr2270 { - if yyq2270[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.Addresses == nil { r.EncodeNil() } else { - yym2277 := z.EncBinary() - _ = yym2277 + yym16 := z.EncBinary() + _ = yym16 if false { } else { h.encSliceNodeAddress(([]NodeAddress)(x.Addresses), e) @@ -27133,13 +33349,15 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2270[3] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("addresses")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Addresses == nil { r.EncodeNil() } else { - yym2278 := z.EncBinary() - _ = yym2278 + yym17 := z.EncBinary() + _ = yym17 if false { } else { h.encSliceNodeAddress(([]NodeAddress)(x.Addresses), e) @@ -27147,36 +33365,71 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2270 || yy2arr2270 { - if yyq2270[4] { - yy2280 := &x.DaemonEndpoints - yy2280.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yy19 := &x.DaemonEndpoints + yy19.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2270[4] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("daemonEndpoints")) - yy2281 := &x.DaemonEndpoints - yy2281.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy21 := &x.DaemonEndpoints + yy21.CodecEncodeSelf(e) } } - if yyr2270 || yy2arr2270 { - if yyq2270[5] { - yy2283 := &x.NodeInfo - yy2283.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yy24 := &x.NodeInfo + yy24.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2270[5] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nodeInfo")) - yy2284 := &x.NodeInfo - yy2284.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy26 := &x.NodeInfo + yy26.CodecEncodeSelf(e) } } - if yysep2270 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Images == nil { + r.EncodeNil() + } else { + yym29 := z.EncBinary() + _ = yym29 + if false { + } else { + h.encSliceContainerImage(([]ContainerImage)(x.Images), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("images")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Images == nil { + r.EncodeNil() + } else { + yym30 := z.EncBinary() + _ = yym30 + if false { + } else { + h.encSliceContainerImage(([]ContainerImage)(x.Images), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -27186,24 +33439,25 @@ func (x *NodeStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2285 := z.DecBinary() - _ = yym2285 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2286 := r.ReadMapStart() - if yyl2286 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2286, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2286 := r.ReadArrayStart() - if yyl2286 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2286, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -27215,12 +33469,12 @@ func (x *NodeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2287Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2287Slc - var yyhl2287 bool = l >= 0 - for yyj2287 := 0; ; yyj2287++ { - if yyhl2287 { - if yyj2287 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -27228,15 +33482,24 @@ func (x *NodeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2287Slc = r.DecodeBytes(yys2287Slc, true, true) - yys2287 := string(yys2287Slc) - switch yys2287 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "capacity": if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv2288 := &x.Capacity - yyv2288.CodecDecodeSelf(d) + yyv4 := &x.Capacity + yyv4.CodecDecodeSelf(d) + } + case "allocatable": + if r.TryDecodeAsNil() { + x.Allocatable = nil + } else { + yyv5 := &x.Allocatable + yyv5.CodecDecodeSelf(d) } case "phase": if r.TryDecodeAsNil() { @@ -27248,182 +33511,468 @@ func (x *NodeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv2290 := &x.Conditions - yym2291 := z.DecBinary() - _ = yym2291 + yyv7 := &x.Conditions + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceNodeCondition((*[]NodeCondition)(yyv2290), d) + h.decSliceNodeCondition((*[]NodeCondition)(yyv7), d) } } case "addresses": if r.TryDecodeAsNil() { x.Addresses = nil } else { - yyv2292 := &x.Addresses - yym2293 := z.DecBinary() - _ = yym2293 + yyv9 := &x.Addresses + yym10 := z.DecBinary() + _ = yym10 if false { } else { - h.decSliceNodeAddress((*[]NodeAddress)(yyv2292), d) + h.decSliceNodeAddress((*[]NodeAddress)(yyv9), d) } } case "daemonEndpoints": if r.TryDecodeAsNil() { x.DaemonEndpoints = NodeDaemonEndpoints{} } else { - yyv2294 := &x.DaemonEndpoints - yyv2294.CodecDecodeSelf(d) + yyv11 := &x.DaemonEndpoints + yyv11.CodecDecodeSelf(d) } case "nodeInfo": if r.TryDecodeAsNil() { x.NodeInfo = NodeSystemInfo{} } else { - yyv2295 := &x.NodeInfo - yyv2295.CodecDecodeSelf(d) + yyv12 := &x.NodeInfo + yyv12.CodecDecodeSelf(d) + } + case "images": + if r.TryDecodeAsNil() { + x.Images = nil + } else { + yyv13 := &x.Images + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceContainerImage((*[]ContainerImage)(yyv13), d) + } } default: - z.DecStructFieldNotFound(-1, yys2287) - } // end switch yys2287 - } // end for yyj2287 - if !yyhl2287 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2296 int - var yyb2296 bool - var yyhl2296 bool = l >= 0 - yyj2296++ - if yyhl2296 { - yyb2296 = yyj2296 > l + var yyj15 int + var yyb15 bool + var yyhl15 bool = l >= 0 + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2296 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2296 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv2297 := &x.Capacity - yyv2297.CodecDecodeSelf(d) + yyv16 := &x.Capacity + yyv16.CodecDecodeSelf(d) } - yyj2296++ - if yyhl2296 { - yyb2296 = yyj2296 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2296 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2296 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Allocatable = nil + } else { + yyv17 := &x.Allocatable + yyv17.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = NodePhase(r.DecodeString()) } - yyj2296++ - if yyhl2296 { - yyb2296 = yyj2296 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2296 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2296 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv2299 := &x.Conditions - yym2300 := z.DecBinary() - _ = yym2300 + yyv19 := &x.Conditions + yym20 := z.DecBinary() + _ = yym20 if false { } else { - h.decSliceNodeCondition((*[]NodeCondition)(yyv2299), d) + h.decSliceNodeCondition((*[]NodeCondition)(yyv19), d) } } - yyj2296++ - if yyhl2296 { - yyb2296 = yyj2296 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2296 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2296 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Addresses = nil } else { - yyv2301 := &x.Addresses - yym2302 := z.DecBinary() - _ = yym2302 + yyv21 := &x.Addresses + yym22 := z.DecBinary() + _ = yym22 if false { } else { - h.decSliceNodeAddress((*[]NodeAddress)(yyv2301), d) + h.decSliceNodeAddress((*[]NodeAddress)(yyv21), d) } } - yyj2296++ - if yyhl2296 { - yyb2296 = yyj2296 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2296 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2296 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DaemonEndpoints = NodeDaemonEndpoints{} } else { - yyv2303 := &x.DaemonEndpoints - yyv2303.CodecDecodeSelf(d) + yyv23 := &x.DaemonEndpoints + yyv23.CodecDecodeSelf(d) } - yyj2296++ - if yyhl2296 { - yyb2296 = yyj2296 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2296 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2296 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NodeInfo = NodeSystemInfo{} } else { - yyv2304 := &x.NodeInfo - yyv2304.CodecDecodeSelf(d) + yyv24 := &x.NodeInfo + yyv24.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Images = nil + } else { + yyv25 := &x.Images + yym26 := z.DecBinary() + _ = yym26 + if false { + } else { + h.decSliceContainerImage((*[]ContainerImage)(yyv25), d) + } } for { - yyj2296++ - if yyhl2296 { - yyb2296 = yyj2296 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2296 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2296 { + if yyb15 { break } - z.DecStructFieldNotFound(yyj2296-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj15-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Size != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.RepoTags == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + z.F.EncSliceStringV(x.RepoTags, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("repoTags")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.RepoTags == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + z.F.EncSliceStringV(x.RepoTags, false, e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(x.Size)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("size")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeInt(int64(x.Size)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ContainerImage) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ContainerImage) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "repoTags": + if r.TryDecodeAsNil() { + x.RepoTags = nil + } else { + yyv4 := &x.RepoTags + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + z.F.DecSliceStringX(yyv4, false, d) + } + } + case "size": + if r.TryDecodeAsNil() { + x.Size = 0 + } else { + x.Size = int64(r.DecodeInt(64)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ContainerImage) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RepoTags = nil + } else { + yyv8 := &x.RepoTags + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + z.F.DecSliceStringX(yyv8, false, d) + } + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Size = 0 + } else { + x.Size = int64(r.DecodeInt(64)) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x NodePhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2305 := z.EncBinary() - _ = yym2305 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -27435,8 +33984,8 @@ func (x *NodePhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2306 := z.DecBinary() - _ = yym2306 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -27448,8 +33997,8 @@ func (x NodeConditionType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2307 := z.EncBinary() - _ = yym2307 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -27461,8 +34010,8 @@ func (x *NodeConditionType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2308 := z.DecBinary() - _ = yym2308 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -27477,115 +34026,130 @@ func (x *NodeCondition) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2309 := z.EncBinary() - _ = yym2309 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2310 := !z.EncBinary() - yy2arr2310 := z.EncBasicHandle().StructToArray - var yyq2310 [6]bool - _, _, _ = yysep2310, yyq2310, yy2arr2310 - const yyr2310 bool = false - yyq2310[2] = true - yyq2310[3] = true - yyq2310[4] = x.Reason != "" - yyq2310[5] = x.Message != "" - if yyr2310 || yy2arr2310 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = true + yyq2[3] = true + yyq2[4] = x.Reason != "" + yyq2[5] = x.Message != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn2310 int = 2 - for _, b := range yyq2310 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn2310++ + yynn2++ } } - r.EncodeMapStart(yynn2310) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2310 || yy2arr2310 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr2310 || yy2arr2310 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Status.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Status.CodecEncodeSelf(e) } - if yyr2310 || yy2arr2310 { - if yyq2310[2] { - yy2314 := &x.LastHeartbeatTime - yym2315 := z.EncBinary() - _ = yym2315 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.LastHeartbeatTime + yym11 := z.EncBinary() + _ = yym11 if false { - } else if z.HasExtensions() && z.EncExt(yy2314) { - } else if yym2315 { - z.EncBinaryMarshal(yy2314) - } else if !yym2315 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2314) + } else if z.HasExtensions() && z.EncExt(yy10) { + } else if yym11 { + z.EncBinaryMarshal(yy10) + } else if !yym11 && z.IsJSONHandle() { + z.EncJSONMarshal(yy10) } else { - z.EncFallback(yy2314) + z.EncFallback(yy10) } } else { r.EncodeNil() } } else { - if yyq2310[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastHeartbeatTime")) - yy2316 := &x.LastHeartbeatTime - yym2317 := z.EncBinary() - _ = yym2317 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.LastHeartbeatTime + yym13 := z.EncBinary() + _ = yym13 if false { - } else if z.HasExtensions() && z.EncExt(yy2316) { - } else if yym2317 { - z.EncBinaryMarshal(yy2316) - } else if !yym2317 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2316) + } else if z.HasExtensions() && z.EncExt(yy12) { + } else if yym13 { + z.EncBinaryMarshal(yy12) + } else if !yym13 && z.IsJSONHandle() { + z.EncJSONMarshal(yy12) } else { - z.EncFallback(yy2316) + z.EncFallback(yy12) } } } - if yyr2310 || yy2arr2310 { - if yyq2310[3] { - yy2319 := &x.LastTransitionTime - yym2320 := z.EncBinary() - _ = yym2320 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yy15 := &x.LastTransitionTime + yym16 := z.EncBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.EncExt(yy2319) { - } else if yym2320 { - z.EncBinaryMarshal(yy2319) - } else if !yym2320 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2319) + } else if z.HasExtensions() && z.EncExt(yy15) { + } else if yym16 { + z.EncBinaryMarshal(yy15) + } else if !yym16 && z.IsJSONHandle() { + z.EncJSONMarshal(yy15) } else { - z.EncFallback(yy2319) + z.EncFallback(yy15) } } else { r.EncodeNil() } } else { - if yyq2310[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastTransitionTime")) - yy2321 := &x.LastTransitionTime - yym2322 := z.EncBinary() - _ = yym2322 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy17 := &x.LastTransitionTime + yym18 := z.EncBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.EncExt(yy2321) { - } else if yym2322 { - z.EncBinaryMarshal(yy2321) - } else if !yym2322 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2321) + } else if z.HasExtensions() && z.EncExt(yy17) { + } else if yym18 { + z.EncBinaryMarshal(yy17) + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(yy17) } else { - z.EncFallback(yy2321) + z.EncFallback(yy17) } } } - if yyr2310 || yy2arr2310 { - if yyq2310[4] { - yym2324 := z.EncBinary() - _ = yym2324 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -27594,20 +34158,23 @@ func (x *NodeCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2310[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym2325 := z.EncBinary() - _ = yym2325 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym21 := z.EncBinary() + _ = yym21 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr2310 || yy2arr2310 { - if yyq2310[5] { - yym2327 := z.EncBinary() - _ = yym2327 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -27616,18 +34183,22 @@ func (x *NodeCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2310[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym2328 := z.EncBinary() - _ = yym2328 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym24 := z.EncBinary() + _ = yym24 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yysep2310 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -27637,24 +34208,25 @@ func (x *NodeCondition) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2329 := z.DecBinary() - _ = yym2329 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2330 := r.ReadMapStart() - if yyl2330 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2330, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2330 := r.ReadArrayStart() - if yyl2330 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2330, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -27666,12 +34238,12 @@ func (x *NodeCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2331Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2331Slc - var yyhl2331 bool = l >= 0 - for yyj2331 := 0; ; yyj2331++ { - if yyhl2331 { - if yyj2331 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -27679,9 +34251,11 @@ func (x *NodeCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2331Slc = r.DecodeBytes(yys2331Slc, true, true) - yys2331 := string(yys2331Slc) - switch yys2331 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -27698,34 +34272,34 @@ func (x *NodeCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.LastHeartbeatTime = pkg2_unversioned.Time{} } else { - yyv2334 := &x.LastHeartbeatTime - yym2335 := z.DecBinary() - _ = yym2335 + yyv6 := &x.LastHeartbeatTime + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv2334) { - } else if yym2335 { - z.DecBinaryUnmarshal(yyv2334) - } else if !yym2335 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2334) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if yym7 { + z.DecBinaryUnmarshal(yyv6) + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv2334, false) + z.DecFallback(yyv6, false) } } case "lastTransitionTime": if r.TryDecodeAsNil() { x.LastTransitionTime = pkg2_unversioned.Time{} } else { - yyv2336 := &x.LastTransitionTime - yym2337 := z.DecBinary() - _ = yym2337 + yyv8 := &x.LastTransitionTime + yym9 := z.DecBinary() + _ = yym9 if false { - } else if z.HasExtensions() && z.DecExt(yyv2336) { - } else if yym2337 { - z.DecBinaryUnmarshal(yyv2336) - } else if !yym2337 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2336) + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else if yym9 { + z.DecBinaryUnmarshal(yyv8) + } else if !yym9 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv8) } else { - z.DecFallback(yyv2336, false) + z.DecFallback(yyv8, false) } } case "reason": @@ -27741,154 +34315,159 @@ func (x *NodeCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Message = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2331) - } // end switch yys2331 - } // end for yyj2331 - if !yyhl2331 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2340 int - var yyb2340 bool - var yyhl2340 bool = l >= 0 - yyj2340++ - if yyhl2340 { - yyb2340 = yyj2340 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2340 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2340 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = NodeConditionType(r.DecodeString()) } - yyj2340++ - if yyhl2340 { - yyb2340 = yyj2340 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2340 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2340 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Status = "" } else { x.Status = ConditionStatus(r.DecodeString()) } - yyj2340++ - if yyhl2340 { - yyb2340 = yyj2340 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2340 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2340 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastHeartbeatTime = pkg2_unversioned.Time{} } else { - yyv2343 := &x.LastHeartbeatTime - yym2344 := z.DecBinary() - _ = yym2344 + yyv15 := &x.LastHeartbeatTime + yym16 := z.DecBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.DecExt(yyv2343) { - } else if yym2344 { - z.DecBinaryUnmarshal(yyv2343) - } else if !yym2344 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2343) + } else if z.HasExtensions() && z.DecExt(yyv15) { + } else if yym16 { + z.DecBinaryUnmarshal(yyv15) + } else if !yym16 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv15) } else { - z.DecFallback(yyv2343, false) + z.DecFallback(yyv15, false) } } - yyj2340++ - if yyhl2340 { - yyb2340 = yyj2340 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2340 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2340 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTransitionTime = pkg2_unversioned.Time{} } else { - yyv2345 := &x.LastTransitionTime - yym2346 := z.DecBinary() - _ = yym2346 + yyv17 := &x.LastTransitionTime + yym18 := z.DecBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.DecExt(yyv2345) { - } else if yym2346 { - z.DecBinaryUnmarshal(yyv2345) - } else if !yym2346 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2345) + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else if yym18 { + z.DecBinaryUnmarshal(yyv17) + } else if !yym18 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv17) } else { - z.DecFallback(yyv2345, false) + z.DecFallback(yyv17, false) } } - yyj2340++ - if yyhl2340 { - yyb2340 = yyj2340 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2340 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2340 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj2340++ - if yyhl2340 { - yyb2340 = yyj2340 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2340 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2340 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } for { - yyj2340++ - if yyhl2340 { - yyb2340 = yyj2340 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2340 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2340 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj2340-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x NodeAddressType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2349 := z.EncBinary() - _ = yym2349 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -27900,8 +34479,8 @@ func (x *NodeAddressType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2350 := z.DecBinary() - _ = yym2350 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -27916,51 +34495,61 @@ func (x *NodeAddress) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2351 := z.EncBinary() - _ = yym2351 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2352 := !z.EncBinary() - yy2arr2352 := z.EncBasicHandle().StructToArray - var yyq2352 [2]bool - _, _, _ = yysep2352, yyq2352, yy2arr2352 - const yyr2352 bool = false - if yyr2352 || yy2arr2352 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn2352 int = 2 - for _, b := range yyq2352 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn2352++ + yynn2++ } } - r.EncodeMapStart(yynn2352) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2352 || yy2arr2352 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr2352 || yy2arr2352 { - yym2355 := z.EncBinary() - _ = yym2355 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Address)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("address")) - yym2356 := z.EncBinary() - _ = yym2356 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Address)) } } - if yysep2352 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -27970,24 +34559,25 @@ func (x *NodeAddress) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2357 := z.DecBinary() - _ = yym2357 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2358 := r.ReadMapStart() - if yyl2358 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2358, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2358 := r.ReadArrayStart() - if yyl2358 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2358, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -27999,12 +34589,12 @@ func (x *NodeAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2359Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2359Slc - var yyhl2359 bool = l >= 0 - for yyj2359 := 0; ; yyj2359++ { - if yyhl2359 { - if yyj2359 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -28012,9 +34602,11 @@ func (x *NodeAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2359Slc = r.DecodeBytes(yys2359Slc, true, true) - yys2359 := string(yys2359Slc) - switch yys2359 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -28028,64 +34620,65 @@ func (x *NodeAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Address = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2359) - } // end switch yys2359 - } // end for yyj2359 - if !yyhl2359 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeAddress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2362 int - var yyb2362 bool - var yyhl2362 bool = l >= 0 - yyj2362++ - if yyhl2362 { - yyb2362 = yyj2362 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2362 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2362 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = NodeAddressType(r.DecodeString()) } - yyj2362++ - if yyhl2362 { - yyb2362 = yyj2362 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2362 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2362 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Address = "" } else { x.Address = string(r.DecodeString()) } for { - yyj2362++ - if yyhl2362 { - yyb2362 = yyj2362 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2362 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2362 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj2362-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeResources) CodecEncodeSelf(e *codec1978.Encoder) { @@ -28095,30 +34688,33 @@ func (x *NodeResources) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2365 := z.EncBinary() - _ = yym2365 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2366 := !z.EncBinary() - yy2arr2366 := z.EncBasicHandle().StructToArray - var yyq2366 [1]bool - _, _, _ = yysep2366, yyq2366, yy2arr2366 - const yyr2366 bool = false - yyq2366[0] = len(x.Capacity) != 0 - if yyr2366 || yy2arr2366 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Capacity) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2366 int = 0 - for _, b := range yyq2366 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2366++ + yynn2++ } } - r.EncodeMapStart(yynn2366) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2366 || yy2arr2366 { - if yyq2366[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Capacity == nil { r.EncodeNil() } else { @@ -28128,8 +34724,10 @@ func (x *NodeResources) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2366[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("capacity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Capacity == nil { r.EncodeNil() } else { @@ -28137,8 +34735,10 @@ func (x *NodeResources) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep2366 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -28148,24 +34748,25 @@ func (x *NodeResources) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2368 := z.DecBinary() - _ = yym2368 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2369 := r.ReadMapStart() - if yyl2369 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2369, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2369 := r.ReadArrayStart() - if yyl2369 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2369, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -28177,12 +34778,12 @@ func (x *NodeResources) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2370Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2370Slc - var yyhl2370 bool = l >= 0 - for yyj2370 := 0; ; yyj2370++ { - if yyhl2370 { - if yyj2370 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -28190,69 +34791,71 @@ func (x *NodeResources) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2370Slc = r.DecodeBytes(yys2370Slc, true, true) - yys2370 := string(yys2370Slc) - switch yys2370 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "capacity": if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv2371 := &x.Capacity - yyv2371.CodecDecodeSelf(d) + yyv4 := &x.Capacity + yyv4.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys2370) - } // end switch yys2370 - } // end for yyj2370 - if !yyhl2370 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeResources) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2372 int - var yyb2372 bool - var yyhl2372 bool = l >= 0 - yyj2372++ - if yyhl2372 { - yyb2372 = yyj2372 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2372 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2372 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv2373 := &x.Capacity - yyv2373.CodecDecodeSelf(d) + yyv6 := &x.Capacity + yyv6.CodecDecodeSelf(d) } for { - yyj2372++ - if yyhl2372 { - yyb2372 = yyj2372 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2372 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2372 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj2372-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x ResourceName) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2374 := z.EncBinary() - _ = yym2374 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -28264,8 +34867,8 @@ func (x *ResourceName) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2375 := z.DecBinary() - _ = yym2375 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -28280,8 +34883,8 @@ func (x ResourceList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2376 := z.EncBinary() - _ = yym2376 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -28294,8 +34897,8 @@ func (x *ResourceList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2377 := z.DecBinary() - _ = yym2377 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -28310,120 +34913,139 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2378 := z.EncBinary() - _ = yym2378 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2379 := !z.EncBinary() - yy2arr2379 := z.EncBasicHandle().StructToArray - var yyq2379 [5]bool - _, _, _ = yysep2379, yyq2379, yy2arr2379 - const yyr2379 bool = false - yyq2379[0] = x.Kind != "" - yyq2379[1] = x.APIVersion != "" - yyq2379[2] = true - yyq2379[3] = true - yyq2379[4] = true - if yyr2379 || yy2arr2379 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn2379 int = 0 - for _, b := range yyq2379 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2379++ + yynn2++ } } - r.EncodeMapStart(yynn2379) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2379 || yy2arr2379 { - if yyq2379[0] { - yym2381 := z.EncBinary() - _ = yym2381 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2379[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2382 := z.EncBinary() - _ = yym2382 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2379 || yy2arr2379 { - if yyq2379[1] { - yym2384 := z.EncBinary() - _ = yym2384 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2379[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2385 := z.EncBinary() - _ = yym2385 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2379 || yy2arr2379 { - if yyq2379[2] { - yy2387 := &x.ObjectMeta - yy2387.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2379[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2388 := &x.ObjectMeta - yy2388.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr2379 || yy2arr2379 { - if yyq2379[3] { - yy2390 := &x.Spec - yy2390.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2379[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy2391 := &x.Spec - yy2391.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr2379 || yy2arr2379 { - if yyq2379[4] { - yy2393 := &x.Status - yy2393.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2379[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy2394 := &x.Status - yy2394.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep2379 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -28433,24 +35055,25 @@ func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2395 := z.DecBinary() - _ = yym2395 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2396 := r.ReadMapStart() - if yyl2396 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2396, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2396 := r.ReadArrayStart() - if yyl2396 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2396, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -28462,12 +35085,12 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2397Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2397Slc - var yyhl2397 bool = l >= 0 - for yyj2397 := 0; ; yyj2397++ { - if yyhl2397 { - if yyj2397 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -28475,9 +35098,32 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2397Slc = r.DecodeBytes(yys2397Slc, true, true) - yys2397 := string(yys2397Slc) - switch yys2397 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = NodeSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = NodeStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -28490,134 +35136,117 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2400 := &x.ObjectMeta - yyv2400.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = NodeSpec{} - } else { - yyv2401 := &x.Spec - yyv2401.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = NodeStatus{} - } else { - yyv2402 := &x.Status - yyv2402.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys2397) - } // end switch yys2397 - } // end for yyj2397 - if !yyhl2397 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2403 int - var yyb2403 bool - var yyhl2403 bool = l >= 0 - yyj2403++ - if yyhl2403 { - yyb2403 = yyj2403 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2403 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2403 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = NodeSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = NodeStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2403++ - if yyhl2403 { - yyb2403 = yyj2403 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2403 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2403 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2403++ - if yyhl2403 { - yyb2403 = yyj2403 > l - } else { - yyb2403 = r.CheckBreak() - } - if yyb2403 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2406 := &x.ObjectMeta - yyv2406.CodecDecodeSelf(d) - } - yyj2403++ - if yyhl2403 { - yyb2403 = yyj2403 > l - } else { - yyb2403 = r.CheckBreak() - } - if yyb2403 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = NodeSpec{} - } else { - yyv2407 := &x.Spec - yyv2407.CodecDecodeSelf(d) - } - yyj2403++ - if yyhl2403 { - yyb2403 = yyj2403 > l - } else { - yyb2403 = r.CheckBreak() - } - if yyb2403 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = NodeStatus{} - } else { - yyv2408 := &x.Status - yyv2408.CodecDecodeSelf(d) - } for { - yyj2403++ - if yyhl2403 { - yyb2403 = yyj2403 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2403 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2403 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj2403-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -28627,126 +35256,142 @@ func (x *NodeList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2409 := z.EncBinary() - _ = yym2409 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2410 := !z.EncBinary() - yy2arr2410 := z.EncBasicHandle().StructToArray - var yyq2410 [4]bool - _, _, _ = yysep2410, yyq2410, yy2arr2410 - const yyr2410 bool = false - yyq2410[0] = x.Kind != "" - yyq2410[1] = x.APIVersion != "" - yyq2410[2] = true - if yyr2410 || yy2arr2410 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2410 int = 1 - for _, b := range yyq2410 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2410++ + yynn2++ } } - r.EncodeMapStart(yynn2410) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2410 || yy2arr2410 { - if yyq2410[0] { - yym2412 := z.EncBinary() - _ = yym2412 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2410[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2413 := z.EncBinary() - _ = yym2413 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2410 || yy2arr2410 { - if yyq2410[1] { - yym2415 := z.EncBinary() - _ = yym2415 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2410[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2416 := z.EncBinary() - _ = yym2416 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2410 || yy2arr2410 { - if yyq2410[2] { - yy2418 := &x.ListMeta - yym2419 := z.EncBinary() - _ = yym2419 - if false { - } else if z.HasExtensions() && z.EncExt(yy2418) { - } else { - z.EncFallback(yy2418) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2410[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2420 := &x.ListMeta - yym2421 := z.EncBinary() - _ = yym2421 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2420) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2420) + z.EncFallback(yy6) } } } - if yyr2410 || yy2arr2410 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2423 := z.EncBinary() - _ = yym2423 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceNode(([]Node)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2424 := z.EncBinary() - _ = yym2424 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceNode(([]Node)(x.Items), e) } } } - if yysep2410 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -28756,24 +35401,25 @@ func (x *NodeList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2425 := z.DecBinary() - _ = yym2425 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2426 := r.ReadMapStart() - if yyl2426 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2426, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2426 := r.ReadArrayStart() - if yyl2426 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2426, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -28785,12 +35431,12 @@ func (x *NodeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2427Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2427Slc - var yyhl2427 bool = l >= 0 - for yyj2427 := 0; ; yyj2427++ { - if yyhl2427 { - if yyj2427 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -28798,9 +35444,36 @@ func (x *NodeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2427Slc = r.DecodeBytes(yys2427Slc, true, true) - yys2427 := string(yys2427Slc) - switch yys2427 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceNode((*[]Node)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -28813,133 +35486,111 @@ func (x *NodeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2430 := &x.ListMeta - yym2431 := z.DecBinary() - _ = yym2431 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2430) { - } else { - z.DecFallback(yyv2430, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2432 := &x.Items - yym2433 := z.DecBinary() - _ = yym2433 - if false { - } else { - h.decSliceNode((*[]Node)(yyv2432), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2427) - } // end switch yys2427 - } // end for yyj2427 - if !yyhl2427 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2434 int - var yyb2434 bool - var yyhl2434 bool = l >= 0 - yyj2434++ - if yyhl2434 { - yyb2434 = yyj2434 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2434 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2434 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceNode((*[]Node)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2434++ - if yyhl2434 { - yyb2434 = yyj2434 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2434 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2434 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2434++ - if yyhl2434 { - yyb2434 = yyj2434 > l - } else { - yyb2434 = r.CheckBreak() - } - if yyb2434 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2437 := &x.ListMeta - yym2438 := z.DecBinary() - _ = yym2438 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2437) { - } else { - z.DecFallback(yyv2437, false) - } - } - yyj2434++ - if yyhl2434 { - yyb2434 = yyj2434 > l - } else { - yyb2434 = r.CheckBreak() - } - if yyb2434 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2439 := &x.Items - yym2440 := z.DecBinary() - _ = yym2440 - if false { - } else { - h.decSliceNode((*[]Node)(yyv2439), d) - } - } for { - yyj2434++ - if yyhl2434 { - yyb2434 = yyj2434 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2434 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2434 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2434-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NamespaceSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -28949,53 +35600,60 @@ func (x *NamespaceSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2441 := z.EncBinary() - _ = yym2441 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2442 := !z.EncBinary() - yy2arr2442 := z.EncBasicHandle().StructToArray - var yyq2442 [1]bool - _, _, _ = yysep2442, yyq2442, yy2arr2442 - const yyr2442 bool = false - if yyr2442 || yy2arr2442 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2442 int = 1 - for _, b := range yyq2442 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2442++ + yynn2++ } } - r.EncodeMapStart(yynn2442) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2442 || yy2arr2442 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Finalizers == nil { r.EncodeNil() } else { - yym2444 := z.EncBinary() - _ = yym2444 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceFinalizerName(([]FinalizerName)(x.Finalizers), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Finalizers")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Finalizers == nil { r.EncodeNil() } else { - yym2445 := z.EncBinary() - _ = yym2445 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceFinalizerName(([]FinalizerName)(x.Finalizers), e) } } } - if yysep2442 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -29005,24 +35663,25 @@ func (x *NamespaceSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2446 := z.DecBinary() - _ = yym2446 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2447 := r.ReadMapStart() - if yyl2447 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2447, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2447 := r.ReadArrayStart() - if yyl2447 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2447, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -29034,12 +35693,12 @@ func (x *NamespaceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2448Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2448Slc - var yyhl2448 bool = l >= 0 - for yyj2448 := 0; ; yyj2448++ { - if yyhl2448 { - if yyj2448 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -29047,79 +35706,81 @@ func (x *NamespaceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2448Slc = r.DecodeBytes(yys2448Slc, true, true) - yys2448 := string(yys2448Slc) - switch yys2448 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "Finalizers": if r.TryDecodeAsNil() { x.Finalizers = nil } else { - yyv2449 := &x.Finalizers - yym2450 := z.DecBinary() - _ = yym2450 + yyv4 := &x.Finalizers + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceFinalizerName((*[]FinalizerName)(yyv2449), d) + h.decSliceFinalizerName((*[]FinalizerName)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys2448) - } // end switch yys2448 - } // end for yyj2448 - if !yyhl2448 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NamespaceSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2451 int - var yyb2451 bool - var yyhl2451 bool = l >= 0 - yyj2451++ - if yyhl2451 { - yyb2451 = yyj2451 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2451 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2451 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Finalizers = nil } else { - yyv2452 := &x.Finalizers - yym2453 := z.DecBinary() - _ = yym2453 + yyv7 := &x.Finalizers + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceFinalizerName((*[]FinalizerName)(yyv2452), d) + h.decSliceFinalizerName((*[]FinalizerName)(yyv7), d) } } for { - yyj2451++ - if yyhl2451 { - yyb2451 = yyj2451 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2451 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2451 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj2451-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x FinalizerName) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2454 := z.EncBinary() - _ = yym2454 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -29131,8 +35792,8 @@ func (x *FinalizerName) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2455 := z.DecBinary() - _ = yym2455 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -29147,42 +35808,49 @@ func (x *NamespaceStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2456 := z.EncBinary() - _ = yym2456 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2457 := !z.EncBinary() - yy2arr2457 := z.EncBasicHandle().StructToArray - var yyq2457 [1]bool - _, _, _ = yysep2457, yyq2457, yy2arr2457 - const yyr2457 bool = false - yyq2457[0] = x.Phase != "" - if yyr2457 || yy2arr2457 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Phase != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2457 int = 0 - for _, b := range yyq2457 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2457++ + yynn2++ } } - r.EncodeMapStart(yynn2457) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2457 || yy2arr2457 { - if yyq2457[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2457[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yysep2457 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -29192,24 +35860,25 @@ func (x *NamespaceStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2459 := z.DecBinary() - _ = yym2459 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2460 := r.ReadMapStart() - if yyl2460 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2460, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2460 := r.ReadArrayStart() - if yyl2460 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2460, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -29221,12 +35890,12 @@ func (x *NamespaceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2461Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2461Slc - var yyhl2461 bool = l >= 0 - for yyj2461 := 0; ; yyj2461++ { - if yyhl2461 { - if yyj2461 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -29234,9 +35903,11 @@ func (x *NamespaceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2461Slc = r.DecodeBytes(yys2461Slc, true, true) - yys2461 := string(yys2461Slc) - switch yys2461 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "phase": if r.TryDecodeAsNil() { x.Phase = "" @@ -29244,57 +35915,57 @@ func (x *NamespaceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Phase = NamespacePhase(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2461) - } // end switch yys2461 - } // end for yyj2461 - if !yyhl2461 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NamespaceStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2463 int - var yyb2463 bool - var yyhl2463 bool = l >= 0 - yyj2463++ - if yyhl2463 { - yyb2463 = yyj2463 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2463 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2463 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = NamespacePhase(r.DecodeString()) } for { - yyj2463++ - if yyhl2463 { - yyb2463 = yyj2463 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2463 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2463 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj2463-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x NamespacePhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2465 := z.EncBinary() - _ = yym2465 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -29306,8 +35977,8 @@ func (x *NamespacePhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2466 := z.DecBinary() - _ = yym2466 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -29322,120 +35993,139 @@ func (x *Namespace) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2467 := z.EncBinary() - _ = yym2467 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2468 := !z.EncBinary() - yy2arr2468 := z.EncBasicHandle().StructToArray - var yyq2468 [5]bool - _, _, _ = yysep2468, yyq2468, yy2arr2468 - const yyr2468 bool = false - yyq2468[0] = x.Kind != "" - yyq2468[1] = x.APIVersion != "" - yyq2468[2] = true - yyq2468[3] = true - yyq2468[4] = true - if yyr2468 || yy2arr2468 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn2468 int = 0 - for _, b := range yyq2468 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2468++ + yynn2++ } } - r.EncodeMapStart(yynn2468) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2468 || yy2arr2468 { - if yyq2468[0] { - yym2470 := z.EncBinary() - _ = yym2470 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2468[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2471 := z.EncBinary() - _ = yym2471 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2468 || yy2arr2468 { - if yyq2468[1] { - yym2473 := z.EncBinary() - _ = yym2473 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2468[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2474 := z.EncBinary() - _ = yym2474 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2468 || yy2arr2468 { - if yyq2468[2] { - yy2476 := &x.ObjectMeta - yy2476.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2468[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2477 := &x.ObjectMeta - yy2477.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr2468 || yy2arr2468 { - if yyq2468[3] { - yy2479 := &x.Spec - yy2479.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2468[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy2480 := &x.Spec - yy2480.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr2468 || yy2arr2468 { - if yyq2468[4] { - yy2482 := &x.Status - yy2482.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2468[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy2483 := &x.Status - yy2483.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep2468 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -29445,24 +36135,25 @@ func (x *Namespace) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2484 := z.DecBinary() - _ = yym2484 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2485 := r.ReadMapStart() - if yyl2485 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2485, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2485 := r.ReadArrayStart() - if yyl2485 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2485, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -29474,12 +36165,12 @@ func (x *Namespace) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2486Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2486Slc - var yyhl2486 bool = l >= 0 - for yyj2486 := 0; ; yyj2486++ { - if yyhl2486 { - if yyj2486 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -29487,9 +36178,32 @@ func (x *Namespace) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2486Slc = r.DecodeBytes(yys2486Slc, true, true) - yys2486 := string(yys2486Slc) - switch yys2486 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = NamespaceSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = NamespaceStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -29502,134 +36216,117 @@ func (x *Namespace) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2489 := &x.ObjectMeta - yyv2489.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = NamespaceSpec{} - } else { - yyv2490 := &x.Spec - yyv2490.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = NamespaceStatus{} - } else { - yyv2491 := &x.Status - yyv2491.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys2486) - } // end switch yys2486 - } // end for yyj2486 - if !yyhl2486 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Namespace) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2492 int - var yyb2492 bool - var yyhl2492 bool = l >= 0 - yyj2492++ - if yyhl2492 { - yyb2492 = yyj2492 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2492 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2492 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = NamespaceSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = NamespaceStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2492++ - if yyhl2492 { - yyb2492 = yyj2492 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2492 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2492 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2492++ - if yyhl2492 { - yyb2492 = yyj2492 > l - } else { - yyb2492 = r.CheckBreak() - } - if yyb2492 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2495 := &x.ObjectMeta - yyv2495.CodecDecodeSelf(d) - } - yyj2492++ - if yyhl2492 { - yyb2492 = yyj2492 > l - } else { - yyb2492 = r.CheckBreak() - } - if yyb2492 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = NamespaceSpec{} - } else { - yyv2496 := &x.Spec - yyv2496.CodecDecodeSelf(d) - } - yyj2492++ - if yyhl2492 { - yyb2492 = yyj2492 > l - } else { - yyb2492 = r.CheckBreak() - } - if yyb2492 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = NamespaceStatus{} - } else { - yyv2497 := &x.Status - yyv2497.CodecDecodeSelf(d) - } for { - yyj2492++ - if yyhl2492 { - yyb2492 = yyj2492 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2492 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2492 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj2492-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NamespaceList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -29639,126 +36336,142 @@ func (x *NamespaceList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2498 := z.EncBinary() - _ = yym2498 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2499 := !z.EncBinary() - yy2arr2499 := z.EncBasicHandle().StructToArray - var yyq2499 [4]bool - _, _, _ = yysep2499, yyq2499, yy2arr2499 - const yyr2499 bool = false - yyq2499[0] = x.Kind != "" - yyq2499[1] = x.APIVersion != "" - yyq2499[2] = true - if yyr2499 || yy2arr2499 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2499 int = 1 - for _, b := range yyq2499 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2499++ + yynn2++ } } - r.EncodeMapStart(yynn2499) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2499 || yy2arr2499 { - if yyq2499[0] { - yym2501 := z.EncBinary() - _ = yym2501 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2499[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2502 := z.EncBinary() - _ = yym2502 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2499 || yy2arr2499 { - if yyq2499[1] { - yym2504 := z.EncBinary() - _ = yym2504 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2499[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2505 := z.EncBinary() - _ = yym2505 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2499 || yy2arr2499 { - if yyq2499[2] { - yy2507 := &x.ListMeta - yym2508 := z.EncBinary() - _ = yym2508 - if false { - } else if z.HasExtensions() && z.EncExt(yy2507) { - } else { - z.EncFallback(yy2507) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2499[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2509 := &x.ListMeta - yym2510 := z.EncBinary() - _ = yym2510 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2509) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2509) + z.EncFallback(yy6) } } } - if yyr2499 || yy2arr2499 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2512 := z.EncBinary() - _ = yym2512 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceNamespace(([]Namespace)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2513 := z.EncBinary() - _ = yym2513 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceNamespace(([]Namespace)(x.Items), e) } } } - if yysep2499 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -29768,24 +36481,25 @@ func (x *NamespaceList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2514 := z.DecBinary() - _ = yym2514 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2515 := r.ReadMapStart() - if yyl2515 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2515, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2515 := r.ReadArrayStart() - if yyl2515 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2515, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -29797,12 +36511,12 @@ func (x *NamespaceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2516Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2516Slc - var yyhl2516 bool = l >= 0 - for yyj2516 := 0; ; yyj2516++ { - if yyhl2516 { - if yyj2516 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -29810,9 +36524,36 @@ func (x *NamespaceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2516Slc = r.DecodeBytes(yys2516Slc, true, true) - yys2516 := string(yys2516Slc) - switch yys2516 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceNamespace((*[]Namespace)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -29825,133 +36566,111 @@ func (x *NamespaceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2519 := &x.ListMeta - yym2520 := z.DecBinary() - _ = yym2520 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2519) { - } else { - z.DecFallback(yyv2519, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2521 := &x.Items - yym2522 := z.DecBinary() - _ = yym2522 - if false { - } else { - h.decSliceNamespace((*[]Namespace)(yyv2521), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2516) - } // end switch yys2516 - } // end for yyj2516 - if !yyhl2516 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NamespaceList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2523 int - var yyb2523 bool - var yyhl2523 bool = l >= 0 - yyj2523++ - if yyhl2523 { - yyb2523 = yyj2523 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2523 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2523 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceNamespace((*[]Namespace)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2523++ - if yyhl2523 { - yyb2523 = yyj2523 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2523 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2523 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2523++ - if yyhl2523 { - yyb2523 = yyj2523 > l - } else { - yyb2523 = r.CheckBreak() - } - if yyb2523 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2526 := &x.ListMeta - yym2527 := z.DecBinary() - _ = yym2527 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2526) { - } else { - z.DecFallback(yyv2526, false) - } - } - yyj2523++ - if yyhl2523 { - yyb2523 = yyj2523 > l - } else { - yyb2523 = r.CheckBreak() - } - if yyb2523 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2528 := &x.Items - yym2529 := z.DecBinary() - _ = yym2529 - if false { - } else { - h.decSliceNamespace((*[]Namespace)(yyv2528), d) - } - } for { - yyj2523++ - if yyhl2523 { - yyb2523 = yyj2523 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2523 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2523 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2523-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Binding) CodecEncodeSelf(e *codec1978.Encoder) { @@ -29961,98 +36680,114 @@ func (x *Binding) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2530 := z.EncBinary() - _ = yym2530 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2531 := !z.EncBinary() - yy2arr2531 := z.EncBasicHandle().StructToArray - var yyq2531 [4]bool - _, _, _ = yysep2531, yyq2531, yy2arr2531 - const yyr2531 bool = false - yyq2531[0] = x.Kind != "" - yyq2531[1] = x.APIVersion != "" - yyq2531[2] = true - if yyr2531 || yy2arr2531 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2531 int = 1 - for _, b := range yyq2531 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2531++ + yynn2++ } } - r.EncodeMapStart(yynn2531) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2531 || yy2arr2531 { - if yyq2531[0] { - yym2533 := z.EncBinary() - _ = yym2533 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2531[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2534 := z.EncBinary() - _ = yym2534 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2531 || yy2arr2531 { - if yyq2531[1] { - yym2536 := z.EncBinary() - _ = yym2536 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2531[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2537 := z.EncBinary() - _ = yym2537 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2531 || yy2arr2531 { - if yyq2531[2] { - yy2539 := &x.ObjectMeta - yy2539.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2531[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2540 := &x.ObjectMeta - yy2540.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr2531 || yy2arr2531 { - yy2542 := &x.Target - yy2542.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy9 := &x.Target + yy9.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("target")) - yy2543 := &x.Target - yy2543.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Target + yy11.CodecEncodeSelf(e) } - if yysep2531 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -30062,24 +36797,25 @@ func (x *Binding) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2544 := z.DecBinary() - _ = yym2544 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2545 := r.ReadMapStart() - if yyl2545 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2545, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2545 := r.ReadArrayStart() - if yyl2545 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2545, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -30091,12 +36827,12 @@ func (x *Binding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2546Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2546Slc - var yyhl2546 bool = l >= 0 - for yyj2546 := 0; ; yyj2546++ { - if yyhl2546 { - if yyj2546 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -30104,9 +36840,25 @@ func (x *Binding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2546Slc = r.DecodeBytes(yys2546Slc, true, true) - yys2546 := string(yys2546Slc) - switch yys2546 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "target": + if r.TryDecodeAsNil() { + x.Target = ObjectReference{} + } else { + yyv5 := &x.Target + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -30119,111 +36871,100 @@ func (x *Binding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2549 := &x.ObjectMeta - yyv2549.CodecDecodeSelf(d) - } - case "target": - if r.TryDecodeAsNil() { - x.Target = ObjectReference{} - } else { - yyv2550 := &x.Target - yyv2550.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys2546) - } // end switch yys2546 - } // end for yyj2546 - if !yyhl2546 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Binding) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2551 int - var yyb2551 bool - var yyhl2551 bool = l >= 0 - yyj2551++ - if yyhl2551 { - yyb2551 = yyj2551 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2551 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2551 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Target = ObjectReference{} + } else { + yyv10 := &x.Target + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2551++ - if yyhl2551 { - yyb2551 = yyj2551 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2551 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2551 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2551++ - if yyhl2551 { - yyb2551 = yyj2551 > l - } else { - yyb2551 = r.CheckBreak() - } - if yyb2551 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2554 := &x.ObjectMeta - yyv2554.CodecDecodeSelf(d) - } - yyj2551++ - if yyhl2551 { - yyb2551 = yyj2551 > l - } else { - yyb2551 = r.CheckBreak() - } - if yyb2551 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Target = ObjectReference{} - } else { - yyv2555 := &x.Target - yyv2555.CodecDecodeSelf(d) - } for { - yyj2551++ - if yyhl2551 { - yyb2551 = yyj2551 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2551 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2551 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj2551-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { @@ -30233,101 +36974,114 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2556 := z.EncBinary() - _ = yym2556 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2557 := !z.EncBinary() - yy2arr2557 := z.EncBasicHandle().StructToArray - var yyq2557 [3]bool - _, _, _ = yysep2557, yyq2557, yy2arr2557 - const yyr2557 bool = false - yyq2557[0] = x.Kind != "" - yyq2557[1] = x.APIVersion != "" - if yyr2557 || yy2arr2557 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Kind != "" + yyq2[2] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn2557 int = 1 - for _, b := range yyq2557 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2557++ + yynn2++ } } - r.EncodeMapStart(yynn2557) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2557 || yy2arr2557 { - if yyq2557[0] { - yym2559 := z.EncBinary() - _ = yym2559 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2557[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2560 := z.EncBinary() - _ = yym2560 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2557 || yy2arr2557 { - if yyq2557[1] { - yym2562 := z.EncBinary() - _ = yym2562 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2557[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2563 := z.EncBinary() - _ = yym2563 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2557 || yy2arr2557 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.GracePeriodSeconds == nil { r.EncodeNil() } else { - yy2565 := *x.GracePeriodSeconds - yym2566 := z.EncBinary() - _ = yym2566 + yy4 := *x.GracePeriodSeconds + yym5 := z.EncBinary() + _ = yym5 if false { } else { - r.EncodeInt(int64(yy2565)) + r.EncodeInt(int64(yy4)) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gracePeriodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.GracePeriodSeconds == nil { r.EncodeNil() } else { - yy2567 := *x.GracePeriodSeconds - yym2568 := z.EncBinary() - _ = yym2568 + yy6 := *x.GracePeriodSeconds + yym7 := z.EncBinary() + _ = yym7 if false { } else { - r.EncodeInt(int64(yy2567)) + r.EncodeInt(int64(yy6)) } } } - if yysep2557 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -30337,24 +37091,25 @@ func (x *DeleteOptions) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2569 := z.DecBinary() - _ = yym2569 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2570 := r.ReadMapStart() - if yyl2570 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2570, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2570 := r.ReadArrayStart() - if yyl2570 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2570, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -30366,12 +37121,12 @@ func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2571Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2571Slc - var yyhl2571 bool = l >= 0 - for yyj2571 := 0; ; yyj2571++ { - if yyhl2571 { - if yyj2571 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -30379,9 +37134,27 @@ func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2571Slc = r.DecodeBytes(yys2571Slc, true, true) - yys2571 := string(yys2571Slc) - switch yys2571 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "gracePeriodSeconds": + if r.TryDecodeAsNil() { + if x.GracePeriodSeconds != nil { + x.GracePeriodSeconds = nil + } + } else { + if x.GracePeriodSeconds == nil { + x.GracePeriodSeconds = new(int64) + } + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64)) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -30394,78 +37167,31 @@ func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "gracePeriodSeconds": - if r.TryDecodeAsNil() { - if x.GracePeriodSeconds != nil { - x.GracePeriodSeconds = nil - } - } else { - if x.GracePeriodSeconds == nil { - x.GracePeriodSeconds = new(int64) - } - yym2575 := z.DecBinary() - _ = yym2575 - if false { - } else { - *((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64)) - } - } default: - z.DecStructFieldNotFound(-1, yys2571) - } // end switch yys2571 - } // end for yyj2571 - if !yyhl2571 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2576 int - var yyb2576 bool - var yyhl2576 bool = l >= 0 - yyj2576++ - if yyhl2576 { - yyb2576 = yyj2576 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2576 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2576 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2576++ - if yyhl2576 { - yyb2576 = yyj2576 > l - } else { - yyb2576 = r.CheckBreak() - } - if yyb2576 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2576++ - if yyhl2576 { - yyb2576 = yyj2576 > l - } else { - yyb2576 = r.CheckBreak() - } - if yyb2576 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GracePeriodSeconds != nil { x.GracePeriodSeconds = nil @@ -30474,26 +37200,358 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.GracePeriodSeconds == nil { x.GracePeriodSeconds = new(int64) } - yym2580 := z.DecBinary() - _ = yym2580 + yym10 := z.DecBinary() + _ = yym10 if false { } else { *((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64)) } } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj2576++ - if yyhl2576 { - yyb2576 = yyj2576 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2576 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2576 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj2576-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ExportOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Export)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("export")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Export)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Exact)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("exact")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Exact)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ExportOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ExportOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "export": + if r.TryDecodeAsNil() { + x.Export = false + } else { + x.Export = bool(r.DecodeBool()) + } + case "exact": + if r.TryDecodeAsNil() { + x.Exact = false + } else { + x.Exact = bool(r.DecodeBool()) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ExportOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Export = false + } else { + x.Export = bool(r.DecodeBool()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Exact = false + } else { + x.Exact = bool(r.DecodeBool()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { @@ -30503,79 +37561,38 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2581 := z.EncBinary() - _ = yym2581 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2582 := !z.EncBinary() - yy2arr2582 := z.EncBasicHandle().StructToArray - var yyq2582 [6]bool - _, _, _ = yysep2582, yyq2582, yy2arr2582 - const yyr2582 bool = false - yyq2582[0] = x.Kind != "" - yyq2582[1] = x.APIVersion != "" - if yyr2582 || yy2arr2582 { - r.EncodeArrayStart(6) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[5] = x.Kind != "" + yyq2[6] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(7) } else { - var yynn2582 int = 4 - for _, b := range yyq2582 { + yynn2 = 5 + for _, b := range yyq2 { if b { - yynn2582++ + yynn2++ } } - r.EncodeMapStart(yynn2582) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2582 || yy2arr2582 { - if yyq2582[0] { - yym2584 := z.EncBinary() - _ = yym2584 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2582[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2585 := z.EncBinary() - _ = yym2585 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2582 || yy2arr2582 { - if yyq2582[1] { - yym2587 := z.EncBinary() - _ = yym2587 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2582[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2588 := z.EncBinary() - _ = yym2588 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2582 || yy2arr2582 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.LabelSelector == nil { r.EncodeNil() } else { - yym2590 := z.EncBinary() - _ = yym2590 + yym4 := z.EncBinary() + _ = yym4 if false { } else if z.HasExtensions() && z.EncExt(x.LabelSelector) { } else { @@ -30583,12 +37600,14 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("LabelSelector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.LabelSelector == nil { r.EncodeNil() } else { - yym2591 := z.EncBinary() - _ = yym2591 + yym5 := z.EncBinary() + _ = yym5 if false { } else if z.HasExtensions() && z.EncExt(x.LabelSelector) { } else { @@ -30596,12 +37615,13 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2582 || yy2arr2582 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.FieldSelector == nil { r.EncodeNil() } else { - yym2593 := z.EncBinary() - _ = yym2593 + yym7 := z.EncBinary() + _ = yym7 if false { } else if z.HasExtensions() && z.EncExt(x.FieldSelector) { } else { @@ -30609,12 +37629,14 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("FieldSelector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.FieldSelector == nil { r.EncodeNil() } else { - yym2594 := z.EncBinary() - _ = yym2594 + yym8 := z.EncBinary() + _ = yym8 if false { } else if z.HasExtensions() && z.EncExt(x.FieldSelector) { } else { @@ -30622,40 +37644,127 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2582 || yy2arr2582 { - yym2596 := z.EncBinary() - _ = yym2596 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeBool(bool(x.Watch)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Watch")) - yym2597 := z.EncBinary() - _ = yym2597 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeBool(bool(x.Watch)) } } - if yyr2582 || yy2arr2582 { - yym2599 := z.EncBinary() - _ = yym2599 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ResourceVersion")) - yym2600 := z.EncBinary() - _ = yym2600 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) } } - if yysep2582 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.TimeoutSeconds == nil { + r.EncodeNil() + } else { + yy16 := *x.TimeoutSeconds + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeInt(int64(yy16)) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("TimeoutSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.TimeoutSeconds == nil { + r.EncodeNil() + } else { + yy18 := *x.TimeoutSeconds + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeInt(int64(yy18)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym21 := z.EncBinary() + _ = yym21 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym24 := z.EncBinary() + _ = yym24 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -30665,24 +37774,25 @@ func (x *ListOptions) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2601 := z.DecBinary() - _ = yym2601 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2602 := r.ReadMapStart() - if yyl2602 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2602, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2602 := r.ReadArrayStart() - if yyl2602 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2602, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -30694,12 +37804,12 @@ func (x *ListOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2603Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2603Slc - var yyhl2603 bool = l >= 0 - for yyj2603 := 0; ; yyj2603++ { - if yyhl2603 { - if yyj2603 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -30707,45 +37817,35 @@ func (x *ListOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2603Slc = r.DecodeBytes(yys2603Slc, true, true) - yys2603 := string(yys2603Slc) - switch yys2603 { - case "kind": - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - case "apiVersion": - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "LabelSelector": if r.TryDecodeAsNil() { x.LabelSelector = nil } else { - yyv2606 := &x.LabelSelector - yym2607 := z.DecBinary() - _ = yym2607 + yyv4 := &x.LabelSelector + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv2606) { + } else if z.HasExtensions() && z.DecExt(yyv4) { } else { - z.DecFallback(yyv2606, true) + z.DecFallback(yyv4, true) } } case "FieldSelector": if r.TryDecodeAsNil() { x.FieldSelector = nil } else { - yyv2608 := &x.FieldSelector - yym2609 := z.DecBinary() - _ = yym2609 + yyv6 := &x.FieldSelector + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv2608) { + } else if z.HasExtensions() && z.DecExt(yyv6) { } else { - z.DecFallback(yyv2608, true) + z.DecFallback(yyv6, true) } } case "Watch": @@ -30760,447 +37860,22 @@ func (x *ListOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.ResourceVersion = string(r.DecodeString()) } - default: - z.DecStructFieldNotFound(-1, yys2603) - } // end switch yys2603 - } // end for yyj2603 - if !yyhl2603 { - r.ReadEnd() - } -} - -func (x *ListOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj2612 int - var yyb2612 bool - var yyhl2612 bool = l >= 0 - yyj2612++ - if yyhl2612 { - yyb2612 = yyj2612 > l - } else { - yyb2612 = r.CheckBreak() - } - if yyb2612 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2612++ - if yyhl2612 { - yyb2612 = yyj2612 > l - } else { - yyb2612 = r.CheckBreak() - } - if yyb2612 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2612++ - if yyhl2612 { - yyb2612 = yyj2612 > l - } else { - yyb2612 = r.CheckBreak() - } - if yyb2612 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.LabelSelector = nil - } else { - yyv2615 := &x.LabelSelector - yym2616 := z.DecBinary() - _ = yym2616 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2615) { - } else { - z.DecFallback(yyv2615, true) - } - } - yyj2612++ - if yyhl2612 { - yyb2612 = yyj2612 > l - } else { - yyb2612 = r.CheckBreak() - } - if yyb2612 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.FieldSelector = nil - } else { - yyv2617 := &x.FieldSelector - yym2618 := z.DecBinary() - _ = yym2618 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2617) { - } else { - z.DecFallback(yyv2617, true) - } - } - yyj2612++ - if yyhl2612 { - yyb2612 = yyj2612 > l - } else { - yyb2612 = r.CheckBreak() - } - if yyb2612 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Watch = false - } else { - x.Watch = bool(r.DecodeBool()) - } - yyj2612++ - if yyhl2612 { - yyb2612 = yyj2612 > l - } else { - yyb2612 = r.CheckBreak() - } - if yyb2612 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ResourceVersion = "" - } else { - x.ResourceVersion = string(r.DecodeString()) - } - for { - yyj2612++ - if yyhl2612 { - yyb2612 = yyj2612 > l - } else { - yyb2612 = r.CheckBreak() - } - if yyb2612 { - break - } - z.DecStructFieldNotFound(yyj2612-1, "") - } - r.ReadEnd() -} - -func (x *PodLogOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym2621 := z.EncBinary() - _ = yym2621 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2622 := !z.EncBinary() - yy2arr2622 := z.EncBasicHandle().StructToArray - var yyq2622 [10]bool - _, _, _ = yysep2622, yyq2622, yy2arr2622 - const yyr2622 bool = false - yyq2622[0] = x.Kind != "" - yyq2622[1] = x.APIVersion != "" - if yyr2622 || yy2arr2622 { - r.EncodeArrayStart(10) - } else { - var yynn2622 int = 8 - for _, b := range yyq2622 { - if b { - yynn2622++ - } - } - r.EncodeMapStart(yynn2622) - } - if yyr2622 || yy2arr2622 { - if yyq2622[0] { - yym2624 := z.EncBinary() - _ = yym2624 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") + case "TimeoutSeconds": + if r.TryDecodeAsNil() { + if x.TimeoutSeconds != nil { + x.TimeoutSeconds = nil } } else { - if yyq2622[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2625 := z.EncBinary() - _ = yym2625 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } + if x.TimeoutSeconds == nil { + x.TimeoutSeconds = new(int64) } - } - if yyr2622 || yy2arr2622 { - if yyq2622[1] { - yym2627 := z.EncBinary() - _ = yym2627 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2622[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2628 := z.EncBinary() - _ = yym2628 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2622 || yy2arr2622 { - yym2630 := z.EncBinary() - _ = yym2630 + yym11 := z.DecBinary() + _ = yym11 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Container")) - yym2631 := z.EncBinary() - _ = yym2631 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + *((*int64)(x.TimeoutSeconds)) = int64(r.DecodeInt(64)) } } - if yyr2622 || yy2arr2622 { - yym2633 := z.EncBinary() - _ = yym2633 - if false { - } else { - r.EncodeBool(bool(x.Follow)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Follow")) - yym2634 := z.EncBinary() - _ = yym2634 - if false { - } else { - r.EncodeBool(bool(x.Follow)) - } - } - if yyr2622 || yy2arr2622 { - yym2636 := z.EncBinary() - _ = yym2636 - if false { - } else { - r.EncodeBool(bool(x.Previous)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Previous")) - yym2637 := z.EncBinary() - _ = yym2637 - if false { - } else { - r.EncodeBool(bool(x.Previous)) - } - } - if yyr2622 || yy2arr2622 { - if x.SinceSeconds == nil { - r.EncodeNil() - } else { - yy2639 := *x.SinceSeconds - yym2640 := z.EncBinary() - _ = yym2640 - if false { - } else { - r.EncodeInt(int64(yy2639)) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("SinceSeconds")) - if x.SinceSeconds == nil { - r.EncodeNil() - } else { - yy2641 := *x.SinceSeconds - yym2642 := z.EncBinary() - _ = yym2642 - if false { - } else { - r.EncodeInt(int64(yy2641)) - } - } - } - if yyr2622 || yy2arr2622 { - if x.SinceTime == nil { - r.EncodeNil() - } else { - yym2644 := z.EncBinary() - _ = yym2644 - if false { - } else if z.HasExtensions() && z.EncExt(x.SinceTime) { - } else if yym2644 { - z.EncBinaryMarshal(x.SinceTime) - } else if !yym2644 && z.IsJSONHandle() { - z.EncJSONMarshal(x.SinceTime) - } else { - z.EncFallback(x.SinceTime) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("SinceTime")) - if x.SinceTime == nil { - r.EncodeNil() - } else { - yym2645 := z.EncBinary() - _ = yym2645 - if false { - } else if z.HasExtensions() && z.EncExt(x.SinceTime) { - } else if yym2645 { - z.EncBinaryMarshal(x.SinceTime) - } else if !yym2645 && z.IsJSONHandle() { - z.EncJSONMarshal(x.SinceTime) - } else { - z.EncFallback(x.SinceTime) - } - } - } - if yyr2622 || yy2arr2622 { - yym2647 := z.EncBinary() - _ = yym2647 - if false { - } else { - r.EncodeBool(bool(x.Timestamps)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Timestamps")) - yym2648 := z.EncBinary() - _ = yym2648 - if false { - } else { - r.EncodeBool(bool(x.Timestamps)) - } - } - if yyr2622 || yy2arr2622 { - if x.TailLines == nil { - r.EncodeNil() - } else { - yy2650 := *x.TailLines - yym2651 := z.EncBinary() - _ = yym2651 - if false { - } else { - r.EncodeInt(int64(yy2650)) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("TailLines")) - if x.TailLines == nil { - r.EncodeNil() - } else { - yy2652 := *x.TailLines - yym2653 := z.EncBinary() - _ = yym2653 - if false { - } else { - r.EncodeInt(int64(yy2652)) - } - } - } - if yyr2622 || yy2arr2622 { - if x.LimitBytes == nil { - r.EncodeNil() - } else { - yy2655 := *x.LimitBytes - yym2656 := z.EncBinary() - _ = yym2656 - if false { - } else { - r.EncodeInt(int64(yy2655)) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("LimitBytes")) - if x.LimitBytes == nil { - r.EncodeNil() - } else { - yy2657 := *x.LimitBytes - yym2658 := z.EncBinary() - _ = yym2658 - if false { - } else { - r.EncodeInt(int64(yy2657)) - } - } - } - if yysep2622 { - r.EncodeEnd() - } - } - } -} - -func (x *PodLogOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym2659 := z.DecBinary() - _ = yym2659 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2660 := r.ReadMapStart() - if yyl2660 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl2660, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2660 := r.ReadArrayStart() - if yyl2660 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl2660, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys2661Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2661Slc - var yyhl2661 bool = l >= 0 - for yyj2661 := 0; ; yyj2661++ { - if yyhl2661 { - if yyj2661 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys2661Slc = r.DecodeBytes(yys2661Slc, true, true) - yys2661 := string(yys2661Slc) - switch yys2661 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -31213,6 +37888,515 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ListOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LabelSelector = nil + } else { + yyv15 := &x.LabelSelector + yym16 := z.DecBinary() + _ = yym16 + if false { + } else if z.HasExtensions() && z.DecExt(yyv15) { + } else { + z.DecFallback(yyv15, true) + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.FieldSelector = nil + } else { + yyv17 := &x.FieldSelector + yym18 := z.DecBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else { + z.DecFallback(yyv17, true) + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Watch = false + } else { + x.Watch = bool(r.DecodeBool()) + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ResourceVersion = "" + } else { + x.ResourceVersion = string(r.DecodeString()) + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.TimeoutSeconds != nil { + x.TimeoutSeconds = nil + } + } else { + if x.TimeoutSeconds == nil { + x.TimeoutSeconds = new(int64) + } + yym22 := z.DecBinary() + _ = yym22 + if false { + } else { + *((*int64)(x.TimeoutSeconds)) = int64(r.DecodeInt(64)) + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj14-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodLogOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [10]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[8] = x.Kind != "" + yyq2[9] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(10) + } else { + yynn2 = 8 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Container")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Follow)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Follow")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Follow)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Previous)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Previous")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Previous)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.SinceSeconds == nil { + r.EncodeNil() + } else { + yy13 := *x.SinceSeconds + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeInt(int64(yy13)) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("SinceSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SinceSeconds == nil { + r.EncodeNil() + } else { + yy15 := *x.SinceSeconds + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeInt(int64(yy15)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.SinceTime == nil { + r.EncodeNil() + } else { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.EncExt(x.SinceTime) { + } else if yym18 { + z.EncBinaryMarshal(x.SinceTime) + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(x.SinceTime) + } else { + z.EncFallback(x.SinceTime) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("SinceTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SinceTime == nil { + r.EncodeNil() + } else { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else if z.HasExtensions() && z.EncExt(x.SinceTime) { + } else if yym19 { + z.EncBinaryMarshal(x.SinceTime) + } else if !yym19 && z.IsJSONHandle() { + z.EncJSONMarshal(x.SinceTime) + } else { + z.EncFallback(x.SinceTime) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym21 := z.EncBinary() + _ = yym21 + if false { + } else { + r.EncodeBool(bool(x.Timestamps)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Timestamps")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeBool(bool(x.Timestamps)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.TailLines == nil { + r.EncodeNil() + } else { + yy24 := *x.TailLines + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeInt(int64(yy24)) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("TailLines")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.TailLines == nil { + r.EncodeNil() + } else { + yy26 := *x.TailLines + yym27 := z.EncBinary() + _ = yym27 + if false { + } else { + r.EncodeInt(int64(yy26)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.LimitBytes == nil { + r.EncodeNil() + } else { + yy29 := *x.LimitBytes + yym30 := z.EncBinary() + _ = yym30 + if false { + } else { + r.EncodeInt(int64(yy29)) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("LimitBytes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.LimitBytes == nil { + r.EncodeNil() + } else { + yy31 := *x.LimitBytes + yym32 := z.EncBinary() + _ = yym32 + if false { + } else { + r.EncodeInt(int64(yy31)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + yym34 := z.EncBinary() + _ = yym34 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym35 := z.EncBinary() + _ = yym35 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { + yym37 := z.EncBinary() + _ = yym37 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym38 := z.EncBinary() + _ = yym38 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodLogOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "Container": if r.TryDecodeAsNil() { x.Container = "" @@ -31240,8 +38424,8 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.SinceSeconds == nil { x.SinceSeconds = new(int64) } - yym2668 := z.DecBinary() - _ = yym2668 + yym8 := z.DecBinary() + _ = yym8 if false { } else { *((*int64)(x.SinceSeconds)) = int64(r.DecodeInt(64)) @@ -31256,13 +38440,13 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.SinceTime == nil { x.SinceTime = new(pkg2_unversioned.Time) } - yym2670 := z.DecBinary() - _ = yym2670 + yym10 := z.DecBinary() + _ = yym10 if false { } else if z.HasExtensions() && z.DecExt(x.SinceTime) { - } else if yym2670 { + } else if yym10 { z.DecBinaryUnmarshal(x.SinceTime) - } else if !yym2670 && z.IsJSONHandle() { + } else if !yym10 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.SinceTime) } else { z.DecFallback(x.SinceTime, false) @@ -31283,8 +38467,8 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.TailLines == nil { x.TailLines = new(int64) } - yym2673 := z.DecBinary() - _ = yym2673 + yym13 := z.DecBinary() + _ = yym13 if false { } else { *((*int64)(x.TailLines)) = int64(r.DecodeInt(64)) @@ -31299,484 +38483,13 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.LimitBytes == nil { x.LimitBytes = new(int64) } - yym2675 := z.DecBinary() - _ = yym2675 + yym15 := z.DecBinary() + _ = yym15 if false { } else { *((*int64)(x.LimitBytes)) = int64(r.DecodeInt(64)) } } - default: - z.DecStructFieldNotFound(-1, yys2661) - } // end switch yys2661 - } // end for yyj2661 - if !yyhl2661 { - r.ReadEnd() - } -} - -func (x *PodLogOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj2676 int - var yyb2676 bool - var yyhl2676 bool = l >= 0 - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Container = "" - } else { - x.Container = string(r.DecodeString()) - } - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Follow = false - } else { - x.Follow = bool(r.DecodeBool()) - } - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Previous = false - } else { - x.Previous = bool(r.DecodeBool()) - } - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.SinceSeconds != nil { - x.SinceSeconds = nil - } - } else { - if x.SinceSeconds == nil { - x.SinceSeconds = new(int64) - } - yym2683 := z.DecBinary() - _ = yym2683 - if false { - } else { - *((*int64)(x.SinceSeconds)) = int64(r.DecodeInt(64)) - } - } - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.SinceTime != nil { - x.SinceTime = nil - } - } else { - if x.SinceTime == nil { - x.SinceTime = new(pkg2_unversioned.Time) - } - yym2685 := z.DecBinary() - _ = yym2685 - if false { - } else if z.HasExtensions() && z.DecExt(x.SinceTime) { - } else if yym2685 { - z.DecBinaryUnmarshal(x.SinceTime) - } else if !yym2685 && z.IsJSONHandle() { - z.DecJSONUnmarshal(x.SinceTime) - } else { - z.DecFallback(x.SinceTime, false) - } - } - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Timestamps = false - } else { - x.Timestamps = bool(r.DecodeBool()) - } - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.TailLines != nil { - x.TailLines = nil - } - } else { - if x.TailLines == nil { - x.TailLines = new(int64) - } - yym2688 := z.DecBinary() - _ = yym2688 - if false { - } else { - *((*int64)(x.TailLines)) = int64(r.DecodeInt(64)) - } - } - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.LimitBytes != nil { - x.LimitBytes = nil - } - } else { - if x.LimitBytes == nil { - x.LimitBytes = new(int64) - } - yym2690 := z.DecBinary() - _ = yym2690 - if false { - } else { - *((*int64)(x.LimitBytes)) = int64(r.DecodeInt(64)) - } - } - for { - yyj2676++ - if yyhl2676 { - yyb2676 = yyj2676 > l - } else { - yyb2676 = r.CheckBreak() - } - if yyb2676 { - break - } - z.DecStructFieldNotFound(yyj2676-1, "") - } - r.ReadEnd() -} - -func (x *PodAttachOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym2691 := z.EncBinary() - _ = yym2691 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2692 := !z.EncBinary() - yy2arr2692 := z.EncBasicHandle().StructToArray - var yyq2692 [7]bool - _, _, _ = yysep2692, yyq2692, yy2arr2692 - const yyr2692 bool = false - yyq2692[0] = x.Kind != "" - yyq2692[1] = x.APIVersion != "" - yyq2692[2] = x.Stdin != false - yyq2692[3] = x.Stdout != false - yyq2692[4] = x.Stderr != false - yyq2692[5] = x.TTY != false - yyq2692[6] = x.Container != "" - if yyr2692 || yy2arr2692 { - r.EncodeArrayStart(7) - } else { - var yynn2692 int = 0 - for _, b := range yyq2692 { - if b { - yynn2692++ - } - } - r.EncodeMapStart(yynn2692) - } - if yyr2692 || yy2arr2692 { - if yyq2692[0] { - yym2694 := z.EncBinary() - _ = yym2694 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2692[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2695 := z.EncBinary() - _ = yym2695 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2692 || yy2arr2692 { - if yyq2692[1] { - yym2697 := z.EncBinary() - _ = yym2697 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2692[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2698 := z.EncBinary() - _ = yym2698 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2692 || yy2arr2692 { - if yyq2692[2] { - yym2700 := z.EncBinary() - _ = yym2700 - if false { - } else { - r.EncodeBool(bool(x.Stdin)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2692[2] { - r.EncodeString(codecSelferC_UTF81234, string("stdin")) - yym2701 := z.EncBinary() - _ = yym2701 - if false { - } else { - r.EncodeBool(bool(x.Stdin)) - } - } - } - if yyr2692 || yy2arr2692 { - if yyq2692[3] { - yym2703 := z.EncBinary() - _ = yym2703 - if false { - } else { - r.EncodeBool(bool(x.Stdout)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2692[3] { - r.EncodeString(codecSelferC_UTF81234, string("stdout")) - yym2704 := z.EncBinary() - _ = yym2704 - if false { - } else { - r.EncodeBool(bool(x.Stdout)) - } - } - } - if yyr2692 || yy2arr2692 { - if yyq2692[4] { - yym2706 := z.EncBinary() - _ = yym2706 - if false { - } else { - r.EncodeBool(bool(x.Stderr)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2692[4] { - r.EncodeString(codecSelferC_UTF81234, string("stderr")) - yym2707 := z.EncBinary() - _ = yym2707 - if false { - } else { - r.EncodeBool(bool(x.Stderr)) - } - } - } - if yyr2692 || yy2arr2692 { - if yyq2692[5] { - yym2709 := z.EncBinary() - _ = yym2709 - if false { - } else { - r.EncodeBool(bool(x.TTY)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2692[5] { - r.EncodeString(codecSelferC_UTF81234, string("tty")) - yym2710 := z.EncBinary() - _ = yym2710 - if false { - } else { - r.EncodeBool(bool(x.TTY)) - } - } - } - if yyr2692 || yy2arr2692 { - if yyq2692[6] { - yym2712 := z.EncBinary() - _ = yym2712 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2692[6] { - r.EncodeString(codecSelferC_UTF81234, string("container")) - yym2713 := z.EncBinary() - _ = yym2713 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } - } - if yysep2692 { - r.EncodeEnd() - } - } - } -} - -func (x *PodAttachOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym2714 := z.DecBinary() - _ = yym2714 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2715 := r.ReadMapStart() - if yyl2715 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl2715, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2715 := r.ReadArrayStart() - if yyl2715 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl2715, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *PodAttachOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys2716Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2716Slc - var yyhl2716 bool = l >= 0 - for yyj2716 := 0; ; yyj2716++ { - if yyhl2716 { - if yyj2716 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys2716Slc = r.DecodeBytes(yys2716Slc, true, true) - yys2716 := string(yys2716Slc) - switch yys2716 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -31789,6 +38502,514 @@ func (x *PodAttachOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodLogOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj18 int + var yyb18 bool + var yyhl18 bool = l >= 0 + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Container = "" + } else { + x.Container = string(r.DecodeString()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Follow = false + } else { + x.Follow = bool(r.DecodeBool()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Previous = false + } else { + x.Previous = bool(r.DecodeBool()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SinceSeconds != nil { + x.SinceSeconds = nil + } + } else { + if x.SinceSeconds == nil { + x.SinceSeconds = new(int64) + } + yym23 := z.DecBinary() + _ = yym23 + if false { + } else { + *((*int64)(x.SinceSeconds)) = int64(r.DecodeInt(64)) + } + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SinceTime != nil { + x.SinceTime = nil + } + } else { + if x.SinceTime == nil { + x.SinceTime = new(pkg2_unversioned.Time) + } + yym25 := z.DecBinary() + _ = yym25 + if false { + } else if z.HasExtensions() && z.DecExt(x.SinceTime) { + } else if yym25 { + z.DecBinaryUnmarshal(x.SinceTime) + } else if !yym25 && z.IsJSONHandle() { + z.DecJSONUnmarshal(x.SinceTime) + } else { + z.DecFallback(x.SinceTime, false) + } + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Timestamps = false + } else { + x.Timestamps = bool(r.DecodeBool()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.TailLines != nil { + x.TailLines = nil + } + } else { + if x.TailLines == nil { + x.TailLines = new(int64) + } + yym28 := z.DecBinary() + _ = yym28 + if false { + } else { + *((*int64)(x.TailLines)) = int64(r.DecodeInt(64)) + } + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.LimitBytes != nil { + x.LimitBytes = nil + } + } else { + if x.LimitBytes == nil { + x.LimitBytes = new(int64) + } + yym30 := z.DecBinary() + _ = yym30 + if false { + } else { + *((*int64)(x.LimitBytes)) = int64(r.DecodeInt(64)) + } + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj18-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodAttachOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Stdin != false + yyq2[1] = x.Stdout != false + yyq2[2] = x.Stderr != false + yyq2[3] = x.TTY != false + yyq2[4] = x.Container != "" + yyq2[5] = x.Kind != "" + yyq2[6] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(7) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Stdin)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("stdin")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Stdin)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Stdout)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("stdout")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Stdout)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Stderr)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("stderr")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Stderr)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.TTY)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tty")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.TTY)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("container")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodAttachOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodAttachOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "stdin": if r.TryDecodeAsNil() { x.Stdin = false @@ -31819,376 +39040,6 @@ func (x *PodAttachOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.Container = string(r.DecodeString()) } - default: - z.DecStructFieldNotFound(-1, yys2716) - } // end switch yys2716 - } // end for yyj2716 - if !yyhl2716 { - r.ReadEnd() - } -} - -func (x *PodAttachOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj2724 int - var yyb2724 bool - var yyhl2724 bool = l >= 0 - yyj2724++ - if yyhl2724 { - yyb2724 = yyj2724 > l - } else { - yyb2724 = r.CheckBreak() - } - if yyb2724 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2724++ - if yyhl2724 { - yyb2724 = yyj2724 > l - } else { - yyb2724 = r.CheckBreak() - } - if yyb2724 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2724++ - if yyhl2724 { - yyb2724 = yyj2724 > l - } else { - yyb2724 = r.CheckBreak() - } - if yyb2724 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stdin = false - } else { - x.Stdin = bool(r.DecodeBool()) - } - yyj2724++ - if yyhl2724 { - yyb2724 = yyj2724 > l - } else { - yyb2724 = r.CheckBreak() - } - if yyb2724 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stdout = false - } else { - x.Stdout = bool(r.DecodeBool()) - } - yyj2724++ - if yyhl2724 { - yyb2724 = yyj2724 > l - } else { - yyb2724 = r.CheckBreak() - } - if yyb2724 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stderr = false - } else { - x.Stderr = bool(r.DecodeBool()) - } - yyj2724++ - if yyhl2724 { - yyb2724 = yyj2724 > l - } else { - yyb2724 = r.CheckBreak() - } - if yyb2724 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.TTY = false - } else { - x.TTY = bool(r.DecodeBool()) - } - yyj2724++ - if yyhl2724 { - yyb2724 = yyj2724 > l - } else { - yyb2724 = r.CheckBreak() - } - if yyb2724 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Container = "" - } else { - x.Container = string(r.DecodeString()) - } - for { - yyj2724++ - if yyhl2724 { - yyb2724 = yyj2724 > l - } else { - yyb2724 = r.CheckBreak() - } - if yyb2724 { - break - } - z.DecStructFieldNotFound(yyj2724-1, "") - } - r.ReadEnd() -} - -func (x *PodExecOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym2732 := z.EncBinary() - _ = yym2732 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2733 := !z.EncBinary() - yy2arr2733 := z.EncBasicHandle().StructToArray - var yyq2733 [8]bool - _, _, _ = yysep2733, yyq2733, yy2arr2733 - const yyr2733 bool = false - yyq2733[0] = x.Kind != "" - yyq2733[1] = x.APIVersion != "" - if yyr2733 || yy2arr2733 { - r.EncodeArrayStart(8) - } else { - var yynn2733 int = 6 - for _, b := range yyq2733 { - if b { - yynn2733++ - } - } - r.EncodeMapStart(yynn2733) - } - if yyr2733 || yy2arr2733 { - if yyq2733[0] { - yym2735 := z.EncBinary() - _ = yym2735 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2733[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2736 := z.EncBinary() - _ = yym2736 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2733 || yy2arr2733 { - if yyq2733[1] { - yym2738 := z.EncBinary() - _ = yym2738 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2733[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2739 := z.EncBinary() - _ = yym2739 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2733 || yy2arr2733 { - yym2741 := z.EncBinary() - _ = yym2741 - if false { - } else { - r.EncodeBool(bool(x.Stdin)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Stdin")) - yym2742 := z.EncBinary() - _ = yym2742 - if false { - } else { - r.EncodeBool(bool(x.Stdin)) - } - } - if yyr2733 || yy2arr2733 { - yym2744 := z.EncBinary() - _ = yym2744 - if false { - } else { - r.EncodeBool(bool(x.Stdout)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Stdout")) - yym2745 := z.EncBinary() - _ = yym2745 - if false { - } else { - r.EncodeBool(bool(x.Stdout)) - } - } - if yyr2733 || yy2arr2733 { - yym2747 := z.EncBinary() - _ = yym2747 - if false { - } else { - r.EncodeBool(bool(x.Stderr)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Stderr")) - yym2748 := z.EncBinary() - _ = yym2748 - if false { - } else { - r.EncodeBool(bool(x.Stderr)) - } - } - if yyr2733 || yy2arr2733 { - yym2750 := z.EncBinary() - _ = yym2750 - if false { - } else { - r.EncodeBool(bool(x.TTY)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("TTY")) - yym2751 := z.EncBinary() - _ = yym2751 - if false { - } else { - r.EncodeBool(bool(x.TTY)) - } - } - if yyr2733 || yy2arr2733 { - yym2753 := z.EncBinary() - _ = yym2753 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Container")) - yym2754 := z.EncBinary() - _ = yym2754 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } - if yyr2733 || yy2arr2733 { - if x.Command == nil { - r.EncodeNil() - } else { - yym2756 := z.EncBinary() - _ = yym2756 - if false { - } else { - z.F.EncSliceStringV(x.Command, false, e) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Command")) - if x.Command == nil { - r.EncodeNil() - } else { - yym2757 := z.EncBinary() - _ = yym2757 - if false { - } else { - z.F.EncSliceStringV(x.Command, false, e) - } - } - } - if yysep2733 { - r.EncodeEnd() - } - } - } -} - -func (x *PodExecOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym2758 := z.DecBinary() - _ = yym2758 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2759 := r.ReadMapStart() - if yyl2759 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl2759, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2759 := r.ReadArrayStart() - if yyl2759 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl2759, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *PodExecOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys2760Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2760Slc - var yyhl2760 bool = l >= 0 - for yyj2760 := 0; ; yyj2760++ { - if yyhl2760 { - if yyj2760 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys2760Slc = r.DecodeBytes(yys2760Slc, true, true) - yys2760 := string(yys2760Slc) - switch yys2760 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -32201,6 +39052,413 @@ func (x *PodExecOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodAttachOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stdin = false + } else { + x.Stdin = bool(r.DecodeBool()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stdout = false + } else { + x.Stdout = bool(r.DecodeBool()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stderr = false + } else { + x.Stderr = bool(r.DecodeBool()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TTY = false + } else { + x.TTY = bool(r.DecodeBool()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Container = "" + } else { + x.Container = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodExecOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[6] = x.Kind != "" + yyq2[7] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(8) + } else { + yynn2 = 6 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Stdin)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Stdin")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Stdin)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Stdout)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Stdout")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Stdout)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Stderr)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Stderr")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Stderr)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.TTY)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("TTY")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.TTY)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Container")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Command == nil { + r.EncodeNil() + } else { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + z.F.EncSliceStringV(x.Command, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Command")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Command == nil { + r.EncodeNil() + } else { + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + z.F.EncSliceStringV(x.Command, false, e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodExecOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodExecOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "Stdin": if r.TryDecodeAsNil() { x.Stdin = false @@ -32235,317 +39493,14 @@ func (x *PodExecOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Command = nil } else { - yyv2768 := &x.Command - yym2769 := z.DecBinary() - _ = yym2769 + yyv9 := &x.Command + yym10 := z.DecBinary() + _ = yym10 if false { } else { - z.F.DecSliceStringX(yyv2768, false, d) + z.F.DecSliceStringX(yyv9, false, d) } } - default: - z.DecStructFieldNotFound(-1, yys2760) - } // end switch yys2760 - } // end for yyj2760 - if !yyhl2760 { - r.ReadEnd() - } -} - -func (x *PodExecOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj2770 int - var yyb2770 bool - var yyhl2770 bool = l >= 0 - yyj2770++ - if yyhl2770 { - yyb2770 = yyj2770 > l - } else { - yyb2770 = r.CheckBreak() - } - if yyb2770 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2770++ - if yyhl2770 { - yyb2770 = yyj2770 > l - } else { - yyb2770 = r.CheckBreak() - } - if yyb2770 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2770++ - if yyhl2770 { - yyb2770 = yyj2770 > l - } else { - yyb2770 = r.CheckBreak() - } - if yyb2770 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stdin = false - } else { - x.Stdin = bool(r.DecodeBool()) - } - yyj2770++ - if yyhl2770 { - yyb2770 = yyj2770 > l - } else { - yyb2770 = r.CheckBreak() - } - if yyb2770 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stdout = false - } else { - x.Stdout = bool(r.DecodeBool()) - } - yyj2770++ - if yyhl2770 { - yyb2770 = yyj2770 > l - } else { - yyb2770 = r.CheckBreak() - } - if yyb2770 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stderr = false - } else { - x.Stderr = bool(r.DecodeBool()) - } - yyj2770++ - if yyhl2770 { - yyb2770 = yyj2770 > l - } else { - yyb2770 = r.CheckBreak() - } - if yyb2770 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.TTY = false - } else { - x.TTY = bool(r.DecodeBool()) - } - yyj2770++ - if yyhl2770 { - yyb2770 = yyj2770 > l - } else { - yyb2770 = r.CheckBreak() - } - if yyb2770 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Container = "" - } else { - x.Container = string(r.DecodeString()) - } - yyj2770++ - if yyhl2770 { - yyb2770 = yyj2770 > l - } else { - yyb2770 = r.CheckBreak() - } - if yyb2770 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Command = nil - } else { - yyv2778 := &x.Command - yym2779 := z.DecBinary() - _ = yym2779 - if false { - } else { - z.F.DecSliceStringX(yyv2778, false, d) - } - } - for { - yyj2770++ - if yyhl2770 { - yyb2770 = yyj2770 > l - } else { - yyb2770 = r.CheckBreak() - } - if yyb2770 { - break - } - z.DecStructFieldNotFound(yyj2770-1, "") - } - r.ReadEnd() -} - -func (x *PodProxyOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym2780 := z.EncBinary() - _ = yym2780 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2781 := !z.EncBinary() - yy2arr2781 := z.EncBasicHandle().StructToArray - var yyq2781 [3]bool - _, _, _ = yysep2781, yyq2781, yy2arr2781 - const yyr2781 bool = false - yyq2781[0] = x.Kind != "" - yyq2781[1] = x.APIVersion != "" - if yyr2781 || yy2arr2781 { - r.EncodeArrayStart(3) - } else { - var yynn2781 int = 1 - for _, b := range yyq2781 { - if b { - yynn2781++ - } - } - r.EncodeMapStart(yynn2781) - } - if yyr2781 || yy2arr2781 { - if yyq2781[0] { - yym2783 := z.EncBinary() - _ = yym2783 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2781[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2784 := z.EncBinary() - _ = yym2784 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2781 || yy2arr2781 { - if yyq2781[1] { - yym2786 := z.EncBinary() - _ = yym2786 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2781[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2787 := z.EncBinary() - _ = yym2787 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2781 || yy2arr2781 { - yym2789 := z.EncBinary() - _ = yym2789 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Path)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Path")) - yym2790 := z.EncBinary() - _ = yym2790 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Path)) - } - } - if yysep2781 { - r.EncodeEnd() - } - } - } -} - -func (x *PodProxyOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym2791 := z.DecBinary() - _ = yym2791 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2792 := r.ReadMapStart() - if yyl2792 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl2792, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2792 := r.ReadArrayStart() - if yyl2792 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl2792, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *PodProxyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys2793Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2793Slc - var yyhl2793 bool = l >= 0 - for yyj2793 := 0; ; yyj2793++ { - if yyhl2793 { - if yyj2793 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys2793Slc = r.DecodeBytes(yys2793Slc, true, true) - yys2793 := string(yys2793Slc) - switch yys2793 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -32558,86 +39513,426 @@ func (x *PodProxyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodExecOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stdin = false + } else { + x.Stdin = bool(r.DecodeBool()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stdout = false + } else { + x.Stdout = bool(r.DecodeBool()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stderr = false + } else { + x.Stderr = bool(r.DecodeBool()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TTY = false + } else { + x.TTY = bool(r.DecodeBool()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Container = "" + } else { + x.Container = string(r.DecodeString()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Command = nil + } else { + yyv19 := &x.Command + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + z.F.DecSliceStringX(yyv19, false, d) + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodProxyOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Kind != "" + yyq2[2] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Path")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodProxyOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodProxyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "Path": if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } default: - z.DecStructFieldNotFound(-1, yys2793) - } // end switch yys2793 - } // end for yyj2793 - if !yyhl2793 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodProxyOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2797 int - var yyb2797 bool - var yyhl2797 bool = l >= 0 - yyj2797++ - if yyhl2797 { - yyb2797 = yyj2797 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2797 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2797 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2797++ - if yyhl2797 { - yyb2797 = yyj2797 > l - } else { - yyb2797 = r.CheckBreak() - } - if yyb2797 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2797++ - if yyhl2797 { - yyb2797 = yyj2797 > l - } else { - yyb2797 = r.CheckBreak() - } - if yyb2797 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj2797++ - if yyhl2797 { - yyb2797 = yyj2797 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2797 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2797 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj2797-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { @@ -32647,38 +39942,41 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2801 := z.EncBinary() - _ = yym2801 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2802 := !z.EncBinary() - yy2arr2802 := z.EncBasicHandle().StructToArray - var yyq2802 [7]bool - _, _, _ = yysep2802, yyq2802, yy2arr2802 - const yyr2802 bool = false - yyq2802[0] = x.Kind != "" - yyq2802[1] = x.Namespace != "" - yyq2802[2] = x.Name != "" - yyq2802[3] = x.UID != "" - yyq2802[4] = x.APIVersion != "" - yyq2802[5] = x.ResourceVersion != "" - yyq2802[6] = x.FieldPath != "" - if yyr2802 || yy2arr2802 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.Namespace != "" + yyq2[2] = x.Name != "" + yyq2[3] = x.UID != "" + yyq2[4] = x.APIVersion != "" + yyq2[5] = x.ResourceVersion != "" + yyq2[6] = x.FieldPath != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(7) } else { - var yynn2802 int = 0 - for _, b := range yyq2802 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2802++ + yynn2++ } } - r.EncodeMapStart(yynn2802) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2802 || yy2arr2802 { - if yyq2802[0] { - yym2804 := z.EncBinary() - _ = yym2804 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) @@ -32687,20 +39985,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2802[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2805 := z.EncBinary() - _ = yym2805 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) } } } - if yyr2802 || yy2arr2802 { - if yyq2802[1] { - yym2807 := z.EncBinary() - _ = yym2807 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) @@ -32709,20 +40010,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2802[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("namespace")) - yym2808 := z.EncBinary() - _ = yym2808 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) } } } - if yyr2802 || yy2arr2802 { - if yyq2802[2] { - yym2810 := z.EncBinary() - _ = yym2810 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -32731,20 +40035,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2802[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym2811 := z.EncBinary() - _ = yym2811 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr2802 || yy2arr2802 { - if yyq2802[3] { - yym2813 := z.EncBinary() - _ = yym2813 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else if z.HasExtensions() && z.EncExt(x.UID) { } else { @@ -32754,10 +40061,12 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2802[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("uid")) - yym2814 := z.EncBinary() - _ = yym2814 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else if z.HasExtensions() && z.EncExt(x.UID) { } else { @@ -32765,10 +40074,11 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2802 || yy2arr2802 { - if yyq2802[4] { - yym2816 := z.EncBinary() - _ = yym2816 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) @@ -32777,20 +40087,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2802[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2817 := z.EncBinary() - _ = yym2817 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) } } } - if yyr2802 || yy2arr2802 { - if yyq2802[5] { - yym2819 := z.EncBinary() - _ = yym2819 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) @@ -32799,20 +40112,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2802[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resourceVersion")) - yym2820 := z.EncBinary() - _ = yym2820 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) } } } - if yyr2802 || yy2arr2802 { - if yyq2802[6] { - yym2822 := z.EncBinary() - _ = yym2822 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldPath)) @@ -32821,18 +40137,22 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2802[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fieldPath")) - yym2823 := z.EncBinary() - _ = yym2823 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldPath)) } } } - if yysep2802 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -32842,24 +40162,25 @@ func (x *ObjectReference) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2824 := z.DecBinary() - _ = yym2824 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2825 := r.ReadMapStart() - if yyl2825 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2825, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2825 := r.ReadArrayStart() - if yyl2825 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2825, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -32871,12 +40192,12 @@ func (x *ObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2826Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2826Slc - var yyhl2826 bool = l >= 0 - for yyj2826 := 0; ; yyj2826++ { - if yyhl2826 { - if yyj2826 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -32884,9 +40205,11 @@ func (x *ObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2826Slc = r.DecodeBytes(yys2826Slc, true, true) - yys2826 := string(yys2826Slc) - switch yys2826 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -32930,139 +40253,145 @@ func (x *ObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.FieldPath = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2826) - } // end switch yys2826 - } // end for yyj2826 - if !yyhl2826 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ObjectReference) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2834 int - var yyb2834 bool - var yyhl2834 bool = l >= 0 - yyj2834++ - if yyhl2834 { - yyb2834 = yyj2834 > l + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2834 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2834 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2834++ - if yyhl2834 { - yyb2834 = yyj2834 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2834 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2834 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Namespace = "" } else { x.Namespace = string(r.DecodeString()) } - yyj2834++ - if yyhl2834 { - yyb2834 = yyj2834 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2834 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2834 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj2834++ - if yyhl2834 { - yyb2834 = yyj2834 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2834 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2834 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.UID = "" } else { x.UID = pkg1_types.UID(r.DecodeString()) } - yyj2834++ - if yyhl2834 { - yyb2834 = yyj2834 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2834 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2834 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2834++ - if yyhl2834 { - yyb2834 = yyj2834 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2834 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2834 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ResourceVersion = "" } else { x.ResourceVersion = string(r.DecodeString()) } - yyj2834++ - if yyhl2834 { - yyb2834 = yyj2834 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2834 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2834 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FieldPath = "" } else { x.FieldPath = string(r.DecodeString()) } for { - yyj2834++ - if yyhl2834 { - yyb2834 = yyj2834 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2834 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2834 { + if yyb11 { break } - z.DecStructFieldNotFound(yyj2834-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LocalObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { @@ -33072,45 +40401,52 @@ func (x *LocalObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2842 := z.EncBinary() - _ = yym2842 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2843 := !z.EncBinary() - yy2arr2843 := z.EncBasicHandle().StructToArray - var yyq2843 [1]bool - _, _, _ = yysep2843, yyq2843, yy2arr2843 - const yyr2843 bool = false - if yyr2843 || yy2arr2843 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2843 int = 1 - for _, b := range yyq2843 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2843++ + yynn2++ } } - r.EncodeMapStart(yynn2843) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2843 || yy2arr2843 { - yym2845 := z.EncBinary() - _ = yym2845 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Name")) - yym2846 := z.EncBinary() - _ = yym2846 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yysep2843 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -33120,24 +40456,25 @@ func (x *LocalObjectReference) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2847 := z.DecBinary() - _ = yym2847 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2848 := r.ReadMapStart() - if yyl2848 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2848, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2848 := r.ReadArrayStart() - if yyl2848 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2848, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -33149,12 +40486,12 @@ func (x *LocalObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2849Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2849Slc - var yyhl2849 bool = l >= 0 - for yyj2849 := 0; ; yyj2849++ { - if yyhl2849 { - if yyj2849 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -33162,9 +40499,11 @@ func (x *LocalObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys2849Slc = r.DecodeBytes(yys2849Slc, true, true) - yys2849 := string(yys2849Slc) - switch yys2849 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "Name": if r.TryDecodeAsNil() { x.Name = "" @@ -33172,49 +40511,49 @@ func (x *LocalObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode x.Name = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2849) - } // end switch yys2849 - } // end for yyj2849 - if !yyhl2849 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LocalObjectReference) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2851 int - var yyb2851 bool - var yyhl2851 bool = l >= 0 - yyj2851++ - if yyhl2851 { - yyb2851 = yyj2851 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2851 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2851 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } for { - yyj2851++ - if yyhl2851 { - yyb2851 = yyj2851 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2851 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2851 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj2851-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SerializedReference) CodecEncodeSelf(e *codec1978.Encoder) { @@ -33224,90 +40563,103 @@ func (x *SerializedReference) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2853 := z.EncBinary() - _ = yym2853 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2854 := !z.EncBinary() - yy2arr2854 := z.EncBasicHandle().StructToArray - var yyq2854 [3]bool - _, _, _ = yysep2854, yyq2854, yy2arr2854 - const yyr2854 bool = false - yyq2854[0] = x.Kind != "" - yyq2854[1] = x.APIVersion != "" - yyq2854[2] = true - if yyr2854 || yy2arr2854 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = x.Kind != "" + yyq2[2] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn2854 int = 0 - for _, b := range yyq2854 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2854++ + yynn2++ } } - r.EncodeMapStart(yynn2854) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2854 || yy2arr2854 { - if yyq2854[0] { - yym2856 := z.EncBinary() - _ = yym2856 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2854[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2857 := z.EncBinary() - _ = yym2857 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2854 || yy2arr2854 { - if yyq2854[1] { - yym2859 := z.EncBinary() - _ = yym2859 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2854[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2860 := z.EncBinary() - _ = yym2860 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2854 || yy2arr2854 { - if yyq2854[2] { - yy2862 := &x.Reference - yy2862.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.Reference + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2854[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reference")) - yy2863 := &x.Reference - yy2863.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Reference + yy6.CodecEncodeSelf(e) } } - if yysep2854 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -33317,24 +40669,25 @@ func (x *SerializedReference) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2864 := z.DecBinary() - _ = yym2864 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2865 := r.ReadMapStart() - if yyl2865 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2865, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2865 := r.ReadArrayStart() - if yyl2865 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2865, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -33346,12 +40699,12 @@ func (x *SerializedReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2866Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2866Slc - var yyhl2866 bool = l >= 0 - for yyj2866 := 0; ; yyj2866++ { - if yyhl2866 { - if yyj2866 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -33359,9 +40712,18 @@ func (x *SerializedReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys2866Slc = r.DecodeBytes(yys2866Slc, true, true) - yys2866 := string(yys2866Slc) - switch yys2866 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "reference": + if r.TryDecodeAsNil() { + x.Reference = ObjectReference{} + } else { + yyv4 := &x.Reference + yyv4.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -33374,88 +40736,83 @@ func (x *SerializedReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder } else { x.APIVersion = string(r.DecodeString()) } - case "reference": - if r.TryDecodeAsNil() { - x.Reference = ObjectReference{} - } else { - yyv2869 := &x.Reference - yyv2869.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys2866) - } // end switch yys2866 - } // end for yyj2866 - if !yyhl2866 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SerializedReference) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2870 int - var yyb2870 bool - var yyhl2870 bool = l >= 0 - yyj2870++ - if yyhl2870 { - yyb2870 = yyj2870 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2870 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2870 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Reference = ObjectReference{} + } else { + yyv8 := &x.Reference + yyv8.CodecDecodeSelf(d) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2870++ - if yyhl2870 { - yyb2870 = yyj2870 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2870 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2870 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2870++ - if yyhl2870 { - yyb2870 = yyj2870 > l - } else { - yyb2870 = r.CheckBreak() - } - if yyb2870 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Reference = ObjectReference{} - } else { - yyv2873 := &x.Reference - yyv2873.CodecDecodeSelf(d) - } for { - yyj2870++ - if yyhl2870 { - yyb2870 = yyj2870 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2870 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2870 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj2870-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EventSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -33465,33 +40822,36 @@ func (x *EventSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2874 := z.EncBinary() - _ = yym2874 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2875 := !z.EncBinary() - yy2arr2875 := z.EncBasicHandle().StructToArray - var yyq2875 [2]bool - _, _, _ = yysep2875, yyq2875, yy2arr2875 - const yyr2875 bool = false - yyq2875[0] = x.Component != "" - yyq2875[1] = x.Host != "" - if yyr2875 || yy2arr2875 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Component != "" + yyq2[1] = x.Host != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn2875 int = 0 - for _, b := range yyq2875 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2875++ + yynn2++ } } - r.EncodeMapStart(yynn2875) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2875 || yy2arr2875 { - if yyq2875[0] { - yym2877 := z.EncBinary() - _ = yym2877 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Component)) @@ -33500,20 +40860,23 @@ func (x *EventSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2875[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("component")) - yym2878 := z.EncBinary() - _ = yym2878 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Component)) } } } - if yyr2875 || yy2arr2875 { - if yyq2875[1] { - yym2880 := z.EncBinary() - _ = yym2880 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) @@ -33522,18 +40885,22 @@ func (x *EventSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2875[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("host")) - yym2881 := z.EncBinary() - _ = yym2881 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) } } } - if yysep2875 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -33543,24 +40910,25 @@ func (x *EventSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2882 := z.DecBinary() - _ = yym2882 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2883 := r.ReadMapStart() - if yyl2883 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2883, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2883 := r.ReadArrayStart() - if yyl2883 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2883, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -33572,12 +40940,12 @@ func (x *EventSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2884Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2884Slc - var yyhl2884 bool = l >= 0 - for yyj2884 := 0; ; yyj2884++ { - if yyhl2884 { - if yyj2884 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -33585,9 +40953,11 @@ func (x *EventSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2884Slc = r.DecodeBytes(yys2884Slc, true, true) - yys2884 := string(yys2884Slc) - switch yys2884 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "component": if r.TryDecodeAsNil() { x.Component = "" @@ -33601,64 +40971,65 @@ func (x *EventSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Host = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2884) - } // end switch yys2884 - } // end for yyj2884 - if !yyhl2884 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EventSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2887 int - var yyb2887 bool - var yyhl2887 bool = l >= 0 - yyj2887++ - if yyhl2887 { - yyb2887 = yyj2887 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2887 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2887 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Component = "" } else { x.Component = string(r.DecodeString()) } - yyj2887++ - if yyhl2887 { - yyb2887 = yyj2887 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2887 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2887 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Host = "" } else { x.Host = string(r.DecodeString()) } for { - yyj2887++ - if yyhl2887 { - yyb2887 = yyj2887 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2887 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2887 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj2887-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { @@ -33668,113 +41039,79 @@ func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2890 := z.EncBinary() - _ = yym2890 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2891 := !z.EncBinary() - yy2arr2891 := z.EncBasicHandle().StructToArray - var yyq2891 [10]bool - _, _, _ = yysep2891, yyq2891, yy2arr2891 - const yyr2891 bool = false - yyq2891[0] = x.Kind != "" - yyq2891[1] = x.APIVersion != "" - yyq2891[2] = true - yyq2891[3] = true - yyq2891[4] = x.Reason != "" - yyq2891[5] = x.Message != "" - yyq2891[6] = true - yyq2891[7] = true - yyq2891[8] = true - yyq2891[9] = x.Count != 0 - if yyr2891 || yy2arr2891 { - r.EncodeArrayStart(10) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [11]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Reason != "" + yyq2[3] = x.Message != "" + yyq2[4] = true + yyq2[5] = true + yyq2[6] = true + yyq2[7] = x.Count != 0 + yyq2[8] = x.Type != "" + yyq2[9] = x.Kind != "" + yyq2[10] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(11) } else { - var yynn2891 int = 0 - for _, b := range yyq2891 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2891++ + yynn2++ } } - r.EncodeMapStart(yynn2891) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2891 || yy2arr2891 { - if yyq2891[0] { - yym2893 := z.EncBinary() - _ = yym2893 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2891[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2894 := z.EncBinary() - _ = yym2894 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2891 || yy2arr2891 { - if yyq2891[1] { - yym2896 := z.EncBinary() - _ = yym2896 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2891[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2897 := z.EncBinary() - _ = yym2897 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2891 || yy2arr2891 { - if yyq2891[2] { - yy2899 := &x.ObjectMeta - yy2899.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2891[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2900 := &x.ObjectMeta - yy2900.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr2891 || yy2arr2891 { - if yyq2891[3] { - yy2902 := &x.InvolvedObject - yy2902.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.InvolvedObject + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2891[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("involvedObject")) - yy2903 := &x.InvolvedObject - yy2903.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.InvolvedObject + yy11.CodecEncodeSelf(e) } } - if yyr2891 || yy2arr2891 { - if yyq2891[4] { - yym2905 := z.EncBinary() - _ = yym2905 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -33783,20 +41120,23 @@ func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2891[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym2906 := z.EncBinary() - _ = yym2906 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr2891 || yy2arr2891 { - if yyq2891[5] { - yym2908 := z.EncBinary() - _ = yym2908 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -33805,102 +41145,114 @@ func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2891[5] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym2909 := z.EncBinary() - _ = yym2909 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr2891 || yy2arr2891 { - if yyq2891[6] { - yy2911 := &x.Source - yy2911.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yy20 := &x.Source + yy20.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2891[6] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("source")) - yy2912 := &x.Source - yy2912.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy22 := &x.Source + yy22.CodecEncodeSelf(e) } } - if yyr2891 || yy2arr2891 { - if yyq2891[7] { - yy2914 := &x.FirstTimestamp - yym2915 := z.EncBinary() - _ = yym2915 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yy25 := &x.FirstTimestamp + yym26 := z.EncBinary() + _ = yym26 if false { - } else if z.HasExtensions() && z.EncExt(yy2914) { - } else if yym2915 { - z.EncBinaryMarshal(yy2914) - } else if !yym2915 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2914) + } else if z.HasExtensions() && z.EncExt(yy25) { + } else if yym26 { + z.EncBinaryMarshal(yy25) + } else if !yym26 && z.IsJSONHandle() { + z.EncJSONMarshal(yy25) } else { - z.EncFallback(yy2914) + z.EncFallback(yy25) } } else { r.EncodeNil() } } else { - if yyq2891[7] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("firstTimestamp")) - yy2916 := &x.FirstTimestamp - yym2917 := z.EncBinary() - _ = yym2917 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy27 := &x.FirstTimestamp + yym28 := z.EncBinary() + _ = yym28 if false { - } else if z.HasExtensions() && z.EncExt(yy2916) { - } else if yym2917 { - z.EncBinaryMarshal(yy2916) - } else if !yym2917 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2916) + } else if z.HasExtensions() && z.EncExt(yy27) { + } else if yym28 { + z.EncBinaryMarshal(yy27) + } else if !yym28 && z.IsJSONHandle() { + z.EncJSONMarshal(yy27) } else { - z.EncFallback(yy2916) + z.EncFallback(yy27) } } } - if yyr2891 || yy2arr2891 { - if yyq2891[8] { - yy2919 := &x.LastTimestamp - yym2920 := z.EncBinary() - _ = yym2920 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yy30 := &x.LastTimestamp + yym31 := z.EncBinary() + _ = yym31 if false { - } else if z.HasExtensions() && z.EncExt(yy2919) { - } else if yym2920 { - z.EncBinaryMarshal(yy2919) - } else if !yym2920 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2919) + } else if z.HasExtensions() && z.EncExt(yy30) { + } else if yym31 { + z.EncBinaryMarshal(yy30) + } else if !yym31 && z.IsJSONHandle() { + z.EncJSONMarshal(yy30) } else { - z.EncFallback(yy2919) + z.EncFallback(yy30) } } else { r.EncodeNil() } } else { - if yyq2891[8] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastTimestamp")) - yy2921 := &x.LastTimestamp - yym2922 := z.EncBinary() - _ = yym2922 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy32 := &x.LastTimestamp + yym33 := z.EncBinary() + _ = yym33 if false { - } else if z.HasExtensions() && z.EncExt(yy2921) { - } else if yym2922 { - z.EncBinaryMarshal(yy2921) - } else if !yym2922 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2921) + } else if z.HasExtensions() && z.EncExt(yy32) { + } else if yym33 { + z.EncBinaryMarshal(yy32) + } else if !yym33 && z.IsJSONHandle() { + z.EncJSONMarshal(yy32) } else { - z.EncFallback(yy2921) + z.EncFallback(yy32) } } } - if yyr2891 || yy2arr2891 { - if yyq2891[9] { - yym2924 := z.EncBinary() - _ = yym2924 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym35 := z.EncBinary() + _ = yym35 if false { } else { r.EncodeInt(int64(x.Count)) @@ -33909,18 +41261,97 @@ func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq2891[9] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("count")) - yym2925 := z.EncBinary() - _ = yym2925 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym36 := z.EncBinary() + _ = yym36 if false { } else { r.EncodeInt(int64(x.Count)) } } } - if yysep2891 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + yym38 := z.EncBinary() + _ = yym38 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Type)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym39 := z.EncBinary() + _ = yym39 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Type)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { + yym41 := z.EncBinary() + _ = yym41 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym42 := z.EncBinary() + _ = yym42 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { + yym44 := z.EncBinary() + _ = yym44 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym45 := z.EncBinary() + _ = yym45 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -33930,24 +41361,25 @@ func (x *Event) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2926 := z.DecBinary() - _ = yym2926 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2927 := r.ReadMapStart() - if yyl2927 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2927, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2927 := r.ReadArrayStart() - if yyl2927 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2927, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -33959,12 +41391,12 @@ func (x *Event) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2928Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2928Slc - var yyhl2928 bool = l >= 0 - for yyj2928 := 0; ; yyj2928++ { - if yyhl2928 { - if yyj2928 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -33972,34 +41404,24 @@ func (x *Event) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2928Slc = r.DecodeBytes(yys2928Slc, true, true) - yys2928 := string(yys2928Slc) - switch yys2928 { - case "kind": - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - case "apiVersion": - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "metadata": if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv2931 := &x.ObjectMeta - yyv2931.CodecDecodeSelf(d) + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) } case "involvedObject": if r.TryDecodeAsNil() { x.InvolvedObject = ObjectReference{} } else { - yyv2932 := &x.InvolvedObject - yyv2932.CodecDecodeSelf(d) + yyv5 := &x.InvolvedObject + yyv5.CodecDecodeSelf(d) } case "reason": if r.TryDecodeAsNil() { @@ -34017,41 +41439,41 @@ func (x *Event) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Source = EventSource{} } else { - yyv2935 := &x.Source - yyv2935.CodecDecodeSelf(d) + yyv8 := &x.Source + yyv8.CodecDecodeSelf(d) } case "firstTimestamp": if r.TryDecodeAsNil() { x.FirstTimestamp = pkg2_unversioned.Time{} } else { - yyv2936 := &x.FirstTimestamp - yym2937 := z.DecBinary() - _ = yym2937 + yyv9 := &x.FirstTimestamp + yym10 := z.DecBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.DecExt(yyv2936) { - } else if yym2937 { - z.DecBinaryUnmarshal(yyv2936) - } else if !yym2937 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2936) + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if yym10 { + z.DecBinaryUnmarshal(yyv9) + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) } else { - z.DecFallback(yyv2936, false) + z.DecFallback(yyv9, false) } } case "lastTimestamp": if r.TryDecodeAsNil() { x.LastTimestamp = pkg2_unversioned.Time{} } else { - yyv2938 := &x.LastTimestamp - yym2939 := z.DecBinary() - _ = yym2939 + yyv11 := &x.LastTimestamp + yym12 := z.DecBinary() + _ = yym12 if false { - } else if z.HasExtensions() && z.DecExt(yyv2938) { - } else if yym2939 { - z.DecBinaryUnmarshal(yyv2938) - } else if !yym2939 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2938) + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else if yym12 { + z.DecBinaryUnmarshal(yyv11) + } else if !yym12 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv11) } else { - z.DecFallback(yyv2938, false) + z.DecFallback(yyv11, false) } } case "count": @@ -34060,210 +41482,253 @@ func (x *Event) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.Count = int(r.DecodeInt(codecSelferBitsize1234)) } + case "type": + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = string(r.DecodeString()) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } default: - z.DecStructFieldNotFound(-1, yys2928) - } // end switch yys2928 - } // end for yyj2928 - if !yyhl2928 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Event) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2941 int - var yyb2941 bool - var yyhl2941 bool = l >= 0 - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l + var yyj17 int + var yyb17 bool + var yyhl17 bool = l >= 0 + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2941 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2941 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l - } else { - yyb2941 = r.CheckBreak() - } - if yyb2941 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l - } else { - yyb2941 = r.CheckBreak() - } - if yyb2941 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv2944 := &x.ObjectMeta - yyv2944.CodecDecodeSelf(d) + yyv18 := &x.ObjectMeta + yyv18.CodecDecodeSelf(d) } - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2941 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2941 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.InvolvedObject = ObjectReference{} } else { - yyv2945 := &x.InvolvedObject - yyv2945.CodecDecodeSelf(d) + yyv19 := &x.InvolvedObject + yyv19.CodecDecodeSelf(d) } - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2941 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2941 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2941 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2941 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2941 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2941 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Source = EventSource{} } else { - yyv2948 := &x.Source - yyv2948.CodecDecodeSelf(d) + yyv22 := &x.Source + yyv22.CodecDecodeSelf(d) } - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2941 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2941 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FirstTimestamp = pkg2_unversioned.Time{} } else { - yyv2949 := &x.FirstTimestamp - yym2950 := z.DecBinary() - _ = yym2950 + yyv23 := &x.FirstTimestamp + yym24 := z.DecBinary() + _ = yym24 if false { - } else if z.HasExtensions() && z.DecExt(yyv2949) { - } else if yym2950 { - z.DecBinaryUnmarshal(yyv2949) - } else if !yym2950 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2949) + } else if z.HasExtensions() && z.DecExt(yyv23) { + } else if yym24 { + z.DecBinaryUnmarshal(yyv23) + } else if !yym24 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv23) } else { - z.DecFallback(yyv2949, false) + z.DecFallback(yyv23, false) } } - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2941 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2941 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTimestamp = pkg2_unversioned.Time{} } else { - yyv2951 := &x.LastTimestamp - yym2952 := z.DecBinary() - _ = yym2952 + yyv25 := &x.LastTimestamp + yym26 := z.DecBinary() + _ = yym26 if false { - } else if z.HasExtensions() && z.DecExt(yyv2951) { - } else if yym2952 { - z.DecBinaryUnmarshal(yyv2951) - } else if !yym2952 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2951) + } else if z.HasExtensions() && z.DecExt(yyv25) { + } else if yym26 { + z.DecBinaryUnmarshal(yyv25) + } else if !yym26 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv25) } else { - z.DecFallback(yyv2951, false) + z.DecFallback(yyv25, false) } } - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2941 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2941 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Count = 0 } else { x.Count = int(r.DecodeInt(codecSelferBitsize1234)) } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = string(r.DecodeString()) + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj2941++ - if yyhl2941 { - yyb2941 = yyj2941 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2941 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2941 { + if yyb17 { break } - z.DecStructFieldNotFound(yyj2941-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj17-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EventList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -34273,126 +41738,142 @@ func (x *EventList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2954 := z.EncBinary() - _ = yym2954 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2955 := !z.EncBinary() - yy2arr2955 := z.EncBasicHandle().StructToArray - var yyq2955 [4]bool - _, _, _ = yysep2955, yyq2955, yy2arr2955 - const yyr2955 bool = false - yyq2955[0] = x.Kind != "" - yyq2955[1] = x.APIVersion != "" - yyq2955[2] = true - if yyr2955 || yy2arr2955 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2955 int = 1 - for _, b := range yyq2955 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2955++ + yynn2++ } } - r.EncodeMapStart(yynn2955) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2955 || yy2arr2955 { - if yyq2955[0] { - yym2957 := z.EncBinary() - _ = yym2957 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2955[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2958 := z.EncBinary() - _ = yym2958 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2955 || yy2arr2955 { - if yyq2955[1] { - yym2960 := z.EncBinary() - _ = yym2960 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2955[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2961 := z.EncBinary() - _ = yym2961 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2955 || yy2arr2955 { - if yyq2955[2] { - yy2963 := &x.ListMeta - yym2964 := z.EncBinary() - _ = yym2964 - if false { - } else if z.HasExtensions() && z.EncExt(yy2963) { - } else { - z.EncFallback(yy2963) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2955[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2965 := &x.ListMeta - yym2966 := z.EncBinary() - _ = yym2966 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2965) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2965) + z.EncFallback(yy6) } } } - if yyr2955 || yy2arr2955 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2968 := z.EncBinary() - _ = yym2968 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceEvent(([]Event)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2969 := z.EncBinary() - _ = yym2969 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceEvent(([]Event)(x.Items), e) } } } - if yysep2955 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -34402,24 +41883,25 @@ func (x *EventList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2970 := z.DecBinary() - _ = yym2970 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2971 := r.ReadMapStart() - if yyl2971 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2971, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2971 := r.ReadArrayStart() - if yyl2971 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2971, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -34431,12 +41913,12 @@ func (x *EventList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2972Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2972Slc - var yyhl2972 bool = l >= 0 - for yyj2972 := 0; ; yyj2972++ { - if yyhl2972 { - if yyj2972 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -34444,9 +41926,36 @@ func (x *EventList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2972Slc = r.DecodeBytes(yys2972Slc, true, true) - yys2972 := string(yys2972Slc) - switch yys2972 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceEvent((*[]Event)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -34459,133 +41968,111 @@ func (x *EventList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2975 := &x.ListMeta - yym2976 := z.DecBinary() - _ = yym2976 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2975) { - } else { - z.DecFallback(yyv2975, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2977 := &x.Items - yym2978 := z.DecBinary() - _ = yym2978 - if false { - } else { - h.decSliceEvent((*[]Event)(yyv2977), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2972) - } // end switch yys2972 - } // end for yyj2972 - if !yyhl2972 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EventList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2979 int - var yyb2979 bool - var yyhl2979 bool = l >= 0 - yyj2979++ - if yyhl2979 { - yyb2979 = yyj2979 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2979 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2979 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceEvent((*[]Event)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2979++ - if yyhl2979 { - yyb2979 = yyj2979 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2979 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2979 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2979++ - if yyhl2979 { - yyb2979 = yyj2979 > l - } else { - yyb2979 = r.CheckBreak() - } - if yyb2979 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2982 := &x.ListMeta - yym2983 := z.DecBinary() - _ = yym2983 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2982) { - } else { - z.DecFallback(yyv2982, false) - } - } - yyj2979++ - if yyhl2979 { - yyb2979 = yyj2979 > l - } else { - yyb2979 = r.CheckBreak() - } - if yyb2979 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2984 := &x.Items - yym2985 := z.DecBinary() - _ = yym2985 - if false { - } else { - h.decSliceEvent((*[]Event)(yyv2984), d) - } - } for { - yyj2979++ - if yyhl2979 { - yyb2979 = yyj2979 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2979 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2979 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2979-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *List) CodecEncodeSelf(e *codec1978.Encoder) { @@ -34595,126 +42082,142 @@ func (x *List) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2986 := z.EncBinary() - _ = yym2986 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2987 := !z.EncBinary() - yy2arr2987 := z.EncBasicHandle().StructToArray - var yyq2987 [4]bool - _, _, _ = yysep2987, yyq2987, yy2arr2987 - const yyr2987 bool = false - yyq2987[0] = x.Kind != "" - yyq2987[1] = x.APIVersion != "" - yyq2987[2] = true - if yyr2987 || yy2arr2987 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2987 int = 1 - for _, b := range yyq2987 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2987++ + yynn2++ } } - r.EncodeMapStart(yynn2987) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2987 || yy2arr2987 { - if yyq2987[0] { - yym2989 := z.EncBinary() - _ = yym2989 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2987[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2990 := z.EncBinary() - _ = yym2990 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2987 || yy2arr2987 { - if yyq2987[1] { - yym2992 := z.EncBinary() - _ = yym2992 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2987[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2993 := z.EncBinary() - _ = yym2993 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2987 || yy2arr2987 { - if yyq2987[2] { - yy2995 := &x.ListMeta - yym2996 := z.EncBinary() - _ = yym2996 - if false { - } else if z.HasExtensions() && z.EncExt(yy2995) { - } else { - z.EncFallback(yy2995) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2987[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2997 := &x.ListMeta - yym2998 := z.EncBinary() - _ = yym2998 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2997) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2997) + z.EncFallback(yy6) } } } - if yyr2987 || yy2arr2987 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym3000 := z.EncBinary() - _ = yym3000 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceruntime_Object(([]pkg8_runtime.Object)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3001 := z.EncBinary() - _ = yym3001 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceruntime_Object(([]pkg8_runtime.Object)(x.Items), e) } } } - if yysep2987 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -34724,24 +42227,25 @@ func (x *List) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3002 := z.DecBinary() - _ = yym3002 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3003 := r.ReadMapStart() - if yyl3003 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3003, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3003 := r.ReadArrayStart() - if yyl3003 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3003, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -34753,12 +42257,12 @@ func (x *List) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3004Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3004Slc - var yyhl3004 bool = l >= 0 - for yyj3004 := 0; ; yyj3004++ { - if yyhl3004 { - if yyj3004 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -34766,9 +42270,36 @@ func (x *List) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3004Slc = r.DecodeBytes(yys3004Slc, true, true) - yys3004 := string(yys3004Slc) - switch yys3004 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceruntime_Object((*[]pkg8_runtime.Object)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -34781,141 +42312,119 @@ func (x *List) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3007 := &x.ListMeta - yym3008 := z.DecBinary() - _ = yym3008 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3007) { - } else { - z.DecFallback(yyv3007, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3009 := &x.Items - yym3010 := z.DecBinary() - _ = yym3010 - if false { - } else { - h.decSliceruntime_Object((*[]pkg8_runtime.Object)(yyv3009), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3004) - } // end switch yys3004 - } // end for yyj3004 - if !yyhl3004 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *List) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3011 int - var yyb3011 bool - var yyhl3011 bool = l >= 0 - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceruntime_Object((*[]pkg8_runtime.Object)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l - } else { - yyb3011 = r.CheckBreak() - } - if yyb3011 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3014 := &x.ListMeta - yym3015 := z.DecBinary() - _ = yym3015 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3014) { - } else { - z.DecFallback(yyv3014, false) - } - } - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l - } else { - yyb3011 = r.CheckBreak() - } - if yyb3011 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3016 := &x.Items - yym3017 := z.DecBinary() - _ = yym3017 - if false { - } else { - h.decSliceruntime_Object((*[]pkg8_runtime.Object)(yyv3016), d) - } - } for { - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3011-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x LimitType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym3018 := z.EncBinary() - _ = yym3018 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -34927,8 +42436,8 @@ func (x *LimitType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3019 := z.DecBinary() - _ = yym3019 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -34943,47 +42452,53 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3020 := z.EncBinary() - _ = yym3020 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3021 := !z.EncBinary() - yy2arr3021 := z.EncBasicHandle().StructToArray - var yyq3021 [6]bool - _, _, _ = yysep3021, yyq3021, yy2arr3021 - const yyr3021 bool = false - yyq3021[0] = x.Type != "" - yyq3021[1] = len(x.Max) != 0 - yyq3021[2] = len(x.Min) != 0 - yyq3021[3] = len(x.Default) != 0 - yyq3021[4] = len(x.DefaultRequest) != 0 - yyq3021[5] = len(x.MaxLimitRequestRatio) != 0 - if yyr3021 || yy2arr3021 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Type != "" + yyq2[1] = len(x.Max) != 0 + yyq2[2] = len(x.Min) != 0 + yyq2[3] = len(x.Default) != 0 + yyq2[4] = len(x.DefaultRequest) != 0 + yyq2[5] = len(x.MaxLimitRequestRatio) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn3021 int = 0 - for _, b := range yyq3021 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3021++ + yynn2++ } } - r.EncodeMapStart(yynn3021) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3021 || yy2arr3021 { - if yyq3021[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Type.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3021[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } } - if yyr3021 || yy2arr3021 { - if yyq3021[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Max == nil { r.EncodeNil() } else { @@ -34993,8 +42508,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3021[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("max")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Max == nil { r.EncodeNil() } else { @@ -35002,8 +42519,9 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3021 || yy2arr3021 { - if yyq3021[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Min == nil { r.EncodeNil() } else { @@ -35013,8 +42531,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3021[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("min")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Min == nil { r.EncodeNil() } else { @@ -35022,8 +42542,9 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3021 || yy2arr3021 { - if yyq3021[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.Default == nil { r.EncodeNil() } else { @@ -35033,8 +42554,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3021[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("default")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Default == nil { r.EncodeNil() } else { @@ -35042,8 +42565,9 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3021 || yy2arr3021 { - if yyq3021[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.DefaultRequest == nil { r.EncodeNil() } else { @@ -35053,8 +42577,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3021[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("defaultRequest")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.DefaultRequest == nil { r.EncodeNil() } else { @@ -35062,8 +42588,9 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3021 || yy2arr3021 { - if yyq3021[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.MaxLimitRequestRatio == nil { r.EncodeNil() } else { @@ -35073,8 +42600,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3021[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxLimitRequestRatio")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.MaxLimitRequestRatio == nil { r.EncodeNil() } else { @@ -35082,8 +42611,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep3021 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -35093,24 +42624,25 @@ func (x *LimitRangeItem) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3028 := z.DecBinary() - _ = yym3028 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3029 := r.ReadMapStart() - if yyl3029 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3029, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3029 := r.ReadArrayStart() - if yyl3029 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3029, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -35122,12 +42654,12 @@ func (x *LimitRangeItem) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3030Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3030Slc - var yyhl3030 bool = l >= 0 - for yyj3030 := 0; ; yyj3030++ { - if yyhl3030 { - if yyj3030 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -35135,9 +42667,11 @@ func (x *LimitRangeItem) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3030Slc = r.DecodeBytes(yys3030Slc, true, true) - yys3030 := string(yys3030Slc) - switch yys3030 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -35148,161 +42682,166 @@ func (x *LimitRangeItem) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Max = nil } else { - yyv3032 := &x.Max - yyv3032.CodecDecodeSelf(d) + yyv5 := &x.Max + yyv5.CodecDecodeSelf(d) } case "min": if r.TryDecodeAsNil() { x.Min = nil } else { - yyv3033 := &x.Min - yyv3033.CodecDecodeSelf(d) + yyv6 := &x.Min + yyv6.CodecDecodeSelf(d) } case "default": if r.TryDecodeAsNil() { x.Default = nil } else { - yyv3034 := &x.Default - yyv3034.CodecDecodeSelf(d) + yyv7 := &x.Default + yyv7.CodecDecodeSelf(d) } case "defaultRequest": if r.TryDecodeAsNil() { x.DefaultRequest = nil } else { - yyv3035 := &x.DefaultRequest - yyv3035.CodecDecodeSelf(d) + yyv8 := &x.DefaultRequest + yyv8.CodecDecodeSelf(d) } case "maxLimitRequestRatio": if r.TryDecodeAsNil() { x.MaxLimitRequestRatio = nil } else { - yyv3036 := &x.MaxLimitRequestRatio - yyv3036.CodecDecodeSelf(d) + yyv9 := &x.MaxLimitRequestRatio + yyv9.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys3030) - } // end switch yys3030 - } // end for yyj3030 - if !yyhl3030 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LimitRangeItem) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3037 int - var yyb3037 bool - var yyhl3037 bool = l >= 0 - yyj3037++ - if yyhl3037 { - yyb3037 = yyj3037 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3037 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3037 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = LimitType(r.DecodeString()) } - yyj3037++ - if yyhl3037 { - yyb3037 = yyj3037 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3037 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3037 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Max = nil } else { - yyv3039 := &x.Max - yyv3039.CodecDecodeSelf(d) + yyv12 := &x.Max + yyv12.CodecDecodeSelf(d) } - yyj3037++ - if yyhl3037 { - yyb3037 = yyj3037 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3037 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3037 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Min = nil } else { - yyv3040 := &x.Min - yyv3040.CodecDecodeSelf(d) + yyv13 := &x.Min + yyv13.CodecDecodeSelf(d) } - yyj3037++ - if yyhl3037 { - yyb3037 = yyj3037 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3037 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3037 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Default = nil } else { - yyv3041 := &x.Default - yyv3041.CodecDecodeSelf(d) + yyv14 := &x.Default + yyv14.CodecDecodeSelf(d) } - yyj3037++ - if yyhl3037 { - yyb3037 = yyj3037 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3037 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3037 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DefaultRequest = nil } else { - yyv3042 := &x.DefaultRequest - yyv3042.CodecDecodeSelf(d) + yyv15 := &x.DefaultRequest + yyv15.CodecDecodeSelf(d) } - yyj3037++ - if yyhl3037 { - yyb3037 = yyj3037 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3037 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3037 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MaxLimitRequestRatio = nil } else { - yyv3043 := &x.MaxLimitRequestRatio - yyv3043.CodecDecodeSelf(d) + yyv16 := &x.MaxLimitRequestRatio + yyv16.CodecDecodeSelf(d) } for { - yyj3037++ - if yyhl3037 { - yyb3037 = yyj3037 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3037 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3037 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3037-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LimitRangeSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -35312,53 +42851,60 @@ func (x *LimitRangeSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3044 := z.EncBinary() - _ = yym3044 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3045 := !z.EncBinary() - yy2arr3045 := z.EncBasicHandle().StructToArray - var yyq3045 [1]bool - _, _, _ = yysep3045, yyq3045, yy2arr3045 - const yyr3045 bool = false - if yyr3045 || yy2arr3045 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn3045 int = 1 - for _, b := range yyq3045 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3045++ + yynn2++ } } - r.EncodeMapStart(yynn3045) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3045 || yy2arr3045 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Limits == nil { r.EncodeNil() } else { - yym3047 := z.EncBinary() - _ = yym3047 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceLimitRangeItem(([]LimitRangeItem)(x.Limits), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("limits")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Limits == nil { r.EncodeNil() } else { - yym3048 := z.EncBinary() - _ = yym3048 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceLimitRangeItem(([]LimitRangeItem)(x.Limits), e) } } } - if yysep3045 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -35368,24 +42914,25 @@ func (x *LimitRangeSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3049 := z.DecBinary() - _ = yym3049 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3050 := r.ReadMapStart() - if yyl3050 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3050, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3050 := r.ReadArrayStart() - if yyl3050 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3050, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -35397,12 +42944,12 @@ func (x *LimitRangeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3051Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3051Slc - var yyhl3051 bool = l >= 0 - for yyj3051 := 0; ; yyj3051++ { - if yyhl3051 { - if yyj3051 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -35410,71 +42957,73 @@ func (x *LimitRangeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3051Slc = r.DecodeBytes(yys3051Slc, true, true) - yys3051 := string(yys3051Slc) - switch yys3051 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "limits": if r.TryDecodeAsNil() { x.Limits = nil } else { - yyv3052 := &x.Limits - yym3053 := z.DecBinary() - _ = yym3053 + yyv4 := &x.Limits + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceLimitRangeItem((*[]LimitRangeItem)(yyv3052), d) + h.decSliceLimitRangeItem((*[]LimitRangeItem)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys3051) - } // end switch yys3051 - } // end for yyj3051 - if !yyhl3051 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LimitRangeSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3054 int - var yyb3054 bool - var yyhl3054 bool = l >= 0 - yyj3054++ - if yyhl3054 { - yyb3054 = yyj3054 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3054 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3054 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Limits = nil } else { - yyv3055 := &x.Limits - yym3056 := z.DecBinary() - _ = yym3056 + yyv7 := &x.Limits + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceLimitRangeItem((*[]LimitRangeItem)(yyv3055), d) + h.decSliceLimitRangeItem((*[]LimitRangeItem)(yyv7), d) } } for { - yyj3054++ - if yyhl3054 { - yyb3054 = yyj3054 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3054 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3054 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj3054-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LimitRange) CodecEncodeSelf(e *codec1978.Encoder) { @@ -35484,105 +43033,121 @@ func (x *LimitRange) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3057 := z.EncBinary() - _ = yym3057 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3058 := !z.EncBinary() - yy2arr3058 := z.EncBasicHandle().StructToArray - var yyq3058 [4]bool - _, _, _ = yysep3058, yyq3058, yy2arr3058 - const yyr3058 bool = false - yyq3058[0] = x.Kind != "" - yyq3058[1] = x.APIVersion != "" - yyq3058[2] = true - yyq3058[3] = true - if yyr3058 || yy2arr3058 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3058 int = 0 - for _, b := range yyq3058 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3058++ + yynn2++ } } - r.EncodeMapStart(yynn3058) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3058 || yy2arr3058 { - if yyq3058[0] { - yym3060 := z.EncBinary() - _ = yym3060 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3058[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3061 := z.EncBinary() - _ = yym3061 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3058 || yy2arr3058 { - if yyq3058[1] { - yym3063 := z.EncBinary() - _ = yym3063 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3058[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3064 := z.EncBinary() - _ = yym3064 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3058 || yy2arr3058 { - if yyq3058[2] { - yy3066 := &x.ObjectMeta - yy3066.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3058[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3067 := &x.ObjectMeta - yy3067.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3058 || yy2arr3058 { - if yyq3058[3] { - yy3069 := &x.Spec - yy3069.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3058[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy3070 := &x.Spec - yy3070.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yysep3058 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -35592,24 +43157,25 @@ func (x *LimitRange) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3071 := z.DecBinary() - _ = yym3071 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3072 := r.ReadMapStart() - if yyl3072 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3072, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3072 := r.ReadArrayStart() - if yyl3072 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3072, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -35621,12 +43187,12 @@ func (x *LimitRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3073Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3073Slc - var yyhl3073 bool = l >= 0 - for yyj3073 := 0; ; yyj3073++ { - if yyhl3073 { - if yyj3073 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -35634,9 +43200,25 @@ func (x *LimitRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3073Slc = r.DecodeBytes(yys3073Slc, true, true) - yys3073 := string(yys3073Slc) - switch yys3073 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = LimitRangeSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -35649,111 +43231,100 @@ func (x *LimitRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3076 := &x.ObjectMeta - yyv3076.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = LimitRangeSpec{} - } else { - yyv3077 := &x.Spec - yyv3077.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys3073) - } // end switch yys3073 - } // end for yyj3073 - if !yyhl3073 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LimitRange) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3078 int - var yyb3078 bool - var yyhl3078 bool = l >= 0 - yyj3078++ - if yyhl3078 { - yyb3078 = yyj3078 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3078 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3078 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = LimitRangeSpec{} + } else { + yyv10 := &x.Spec + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3078++ - if yyhl3078 { - yyb3078 = yyj3078 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3078 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3078 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3078++ - if yyhl3078 { - yyb3078 = yyj3078 > l - } else { - yyb3078 = r.CheckBreak() - } - if yyb3078 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3081 := &x.ObjectMeta - yyv3081.CodecDecodeSelf(d) - } - yyj3078++ - if yyhl3078 { - yyb3078 = yyj3078 > l - } else { - yyb3078 = r.CheckBreak() - } - if yyb3078 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = LimitRangeSpec{} - } else { - yyv3082 := &x.Spec - yyv3082.CodecDecodeSelf(d) - } for { - yyj3078++ - if yyhl3078 { - yyb3078 = yyj3078 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3078 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3078 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj3078-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LimitRangeList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -35763,126 +43334,142 @@ func (x *LimitRangeList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3083 := z.EncBinary() - _ = yym3083 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3084 := !z.EncBinary() - yy2arr3084 := z.EncBasicHandle().StructToArray - var yyq3084 [4]bool - _, _, _ = yysep3084, yyq3084, yy2arr3084 - const yyr3084 bool = false - yyq3084[0] = x.Kind != "" - yyq3084[1] = x.APIVersion != "" - yyq3084[2] = true - if yyr3084 || yy2arr3084 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3084 int = 1 - for _, b := range yyq3084 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3084++ + yynn2++ } } - r.EncodeMapStart(yynn3084) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3084 || yy2arr3084 { - if yyq3084[0] { - yym3086 := z.EncBinary() - _ = yym3086 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3084[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3087 := z.EncBinary() - _ = yym3087 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3084 || yy2arr3084 { - if yyq3084[1] { - yym3089 := z.EncBinary() - _ = yym3089 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3084[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3090 := z.EncBinary() - _ = yym3090 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3084 || yy2arr3084 { - if yyq3084[2] { - yy3092 := &x.ListMeta - yym3093 := z.EncBinary() - _ = yym3093 - if false { - } else if z.HasExtensions() && z.EncExt(yy3092) { - } else { - z.EncFallback(yy3092) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq3084[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3094 := &x.ListMeta - yym3095 := z.EncBinary() - _ = yym3095 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy3094) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy3094) + z.EncFallback(yy6) } } } - if yyr3084 || yy2arr3084 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym3097 := z.EncBinary() - _ = yym3097 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceLimitRange(([]LimitRange)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3098 := z.EncBinary() - _ = yym3098 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceLimitRange(([]LimitRange)(x.Items), e) } } } - if yysep3084 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -35892,24 +43479,25 @@ func (x *LimitRangeList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3099 := z.DecBinary() - _ = yym3099 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3100 := r.ReadMapStart() - if yyl3100 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3100, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3100 := r.ReadArrayStart() - if yyl3100 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3100, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -35921,12 +43509,12 @@ func (x *LimitRangeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3101Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3101Slc - var yyhl3101 bool = l >= 0 - for yyj3101 := 0; ; yyj3101++ { - if yyhl3101 { - if yyj3101 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -35934,9 +43522,36 @@ func (x *LimitRangeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3101Slc = r.DecodeBytes(yys3101Slc, true, true) - yys3101 := string(yys3101Slc) - switch yys3101 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceLimitRange((*[]LimitRange)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -35949,133 +43564,111 @@ func (x *LimitRangeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3104 := &x.ListMeta - yym3105 := z.DecBinary() - _ = yym3105 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3104) { - } else { - z.DecFallback(yyv3104, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3106 := &x.Items - yym3107 := z.DecBinary() - _ = yym3107 - if false { - } else { - h.decSliceLimitRange((*[]LimitRange)(yyv3106), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3101) - } // end switch yys3101 - } // end for yyj3101 - if !yyhl3101 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LimitRangeList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3108 int - var yyb3108 bool - var yyhl3108 bool = l >= 0 - yyj3108++ - if yyhl3108 { - yyb3108 = yyj3108 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3108 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3108 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceLimitRange((*[]LimitRange)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3108++ - if yyhl3108 { - yyb3108 = yyj3108 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3108 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3108 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3108++ - if yyhl3108 { - yyb3108 = yyj3108 > l - } else { - yyb3108 = r.CheckBreak() - } - if yyb3108 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3111 := &x.ListMeta - yym3112 := z.DecBinary() - _ = yym3112 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3111) { - } else { - z.DecFallback(yyv3111, false) - } - } - yyj3108++ - if yyhl3108 { - yyb3108 = yyj3108 > l - } else { - yyb3108 = r.CheckBreak() - } - if yyb3108 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3113 := &x.Items - yym3114 := z.DecBinary() - _ = yym3114 - if false { - } else { - h.decSliceLimitRange((*[]LimitRange)(yyv3113), d) - } - } for { - yyj3108++ - if yyhl3108 { - yyb3108 = yyj3108 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3108 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3108 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3108-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceQuotaSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -36085,30 +43678,33 @@ func (x *ResourceQuotaSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3115 := z.EncBinary() - _ = yym3115 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3116 := !z.EncBinary() - yy2arr3116 := z.EncBasicHandle().StructToArray - var yyq3116 [1]bool - _, _, _ = yysep3116, yyq3116, yy2arr3116 - const yyr3116 bool = false - yyq3116[0] = len(x.Hard) != 0 - if yyr3116 || yy2arr3116 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Hard) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn3116 int = 0 - for _, b := range yyq3116 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3116++ + yynn2++ } } - r.EncodeMapStart(yynn3116) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3116 || yy2arr3116 { - if yyq3116[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Hard == nil { r.EncodeNil() } else { @@ -36118,8 +43714,10 @@ func (x *ResourceQuotaSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3116[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hard")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Hard == nil { r.EncodeNil() } else { @@ -36127,8 +43725,10 @@ func (x *ResourceQuotaSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep3116 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -36138,24 +43738,25 @@ func (x *ResourceQuotaSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3118 := z.DecBinary() - _ = yym3118 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3119 := r.ReadMapStart() - if yyl3119 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3119, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3119 := r.ReadArrayStart() - if yyl3119 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3119, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -36167,12 +43768,12 @@ func (x *ResourceQuotaSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3120Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3120Slc - var yyhl3120 bool = l >= 0 - for yyj3120 := 0; ; yyj3120++ { - if yyhl3120 { - if yyj3120 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -36180,61 +43781,63 @@ func (x *ResourceQuotaSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys3120Slc = r.DecodeBytes(yys3120Slc, true, true) - yys3120 := string(yys3120Slc) - switch yys3120 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "hard": if r.TryDecodeAsNil() { x.Hard = nil } else { - yyv3121 := &x.Hard - yyv3121.CodecDecodeSelf(d) + yyv4 := &x.Hard + yyv4.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys3120) - } // end switch yys3120 - } // end for yyj3120 - if !yyhl3120 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceQuotaSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3122 int - var yyb3122 bool - var yyhl3122 bool = l >= 0 - yyj3122++ - if yyhl3122 { - yyb3122 = yyj3122 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb3122 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb3122 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Hard = nil } else { - yyv3123 := &x.Hard - yyv3123.CodecDecodeSelf(d) + yyv6 := &x.Hard + yyv6.CodecDecodeSelf(d) } for { - yyj3122++ - if yyhl3122 { - yyb3122 = yyj3122 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb3122 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb3122 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj3122-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -36244,31 +43847,34 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3124 := z.EncBinary() - _ = yym3124 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3125 := !z.EncBinary() - yy2arr3125 := z.EncBasicHandle().StructToArray - var yyq3125 [2]bool - _, _, _ = yysep3125, yyq3125, yy2arr3125 - const yyr3125 bool = false - yyq3125[0] = len(x.Hard) != 0 - yyq3125[1] = len(x.Used) != 0 - if yyr3125 || yy2arr3125 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Hard) != 0 + yyq2[1] = len(x.Used) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn3125 int = 0 - for _, b := range yyq3125 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3125++ + yynn2++ } } - r.EncodeMapStart(yynn3125) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3125 || yy2arr3125 { - if yyq3125[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Hard == nil { r.EncodeNil() } else { @@ -36278,8 +43884,10 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3125[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hard")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Hard == nil { r.EncodeNil() } else { @@ -36287,8 +43895,9 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3125 || yy2arr3125 { - if yyq3125[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Used == nil { r.EncodeNil() } else { @@ -36298,8 +43907,10 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3125[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("used")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Used == nil { r.EncodeNil() } else { @@ -36307,8 +43918,10 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep3125 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -36318,24 +43931,25 @@ func (x *ResourceQuotaStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3128 := z.DecBinary() - _ = yym3128 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3129 := r.ReadMapStart() - if yyl3129 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3129, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3129 := r.ReadArrayStart() - if yyl3129 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3129, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -36347,12 +43961,12 @@ func (x *ResourceQuotaStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3130Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3130Slc - var yyhl3130 bool = l >= 0 - for yyj3130 := 0; ; yyj3130++ { - if yyhl3130 { - if yyj3130 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -36360,84 +43974,87 @@ func (x *ResourceQuotaStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys3130Slc = r.DecodeBytes(yys3130Slc, true, true) - yys3130 := string(yys3130Slc) - switch yys3130 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "hard": if r.TryDecodeAsNil() { x.Hard = nil } else { - yyv3131 := &x.Hard - yyv3131.CodecDecodeSelf(d) + yyv4 := &x.Hard + yyv4.CodecDecodeSelf(d) } case "used": if r.TryDecodeAsNil() { x.Used = nil } else { - yyv3132 := &x.Used - yyv3132.CodecDecodeSelf(d) + yyv5 := &x.Used + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys3130) - } // end switch yys3130 - } // end for yyj3130 - if !yyhl3130 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceQuotaStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3133 int - var yyb3133 bool - var yyhl3133 bool = l >= 0 - yyj3133++ - if yyhl3133 { - yyb3133 = yyj3133 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3133 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3133 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Hard = nil } else { - yyv3134 := &x.Hard - yyv3134.CodecDecodeSelf(d) + yyv7 := &x.Hard + yyv7.CodecDecodeSelf(d) } - yyj3133++ - if yyhl3133 { - yyb3133 = yyj3133 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3133 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3133 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Used = nil } else { - yyv3135 := &x.Used - yyv3135.CodecDecodeSelf(d) + yyv8 := &x.Used + yyv8.CodecDecodeSelf(d) } for { - yyj3133++ - if yyhl3133 { - yyb3133 = yyj3133 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3133 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3133 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj3133-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceQuota) CodecEncodeSelf(e *codec1978.Encoder) { @@ -36447,120 +44064,139 @@ func (x *ResourceQuota) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3136 := z.EncBinary() - _ = yym3136 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3137 := !z.EncBinary() - yy2arr3137 := z.EncBasicHandle().StructToArray - var yyq3137 [5]bool - _, _, _ = yysep3137, yyq3137, yy2arr3137 - const yyr3137 bool = false - yyq3137[0] = x.Kind != "" - yyq3137[1] = x.APIVersion != "" - yyq3137[2] = true - yyq3137[3] = true - yyq3137[4] = true - if yyr3137 || yy2arr3137 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn3137 int = 0 - for _, b := range yyq3137 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3137++ + yynn2++ } } - r.EncodeMapStart(yynn3137) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3137 || yy2arr3137 { - if yyq3137[0] { - yym3139 := z.EncBinary() - _ = yym3139 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3137[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3140 := z.EncBinary() - _ = yym3140 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3137 || yy2arr3137 { - if yyq3137[1] { - yym3142 := z.EncBinary() - _ = yym3142 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3137[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3143 := z.EncBinary() - _ = yym3143 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3137 || yy2arr3137 { - if yyq3137[2] { - yy3145 := &x.ObjectMeta - yy3145.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3137[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3146 := &x.ObjectMeta - yy3146.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3137 || yy2arr3137 { - if yyq3137[3] { - yy3148 := &x.Spec - yy3148.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3137[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy3149 := &x.Spec - yy3149.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr3137 || yy2arr3137 { - if yyq3137[4] { - yy3151 := &x.Status - yy3151.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3137[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy3152 := &x.Status - yy3152.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep3137 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -36570,24 +44206,25 @@ func (x *ResourceQuota) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3153 := z.DecBinary() - _ = yym3153 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3154 := r.ReadMapStart() - if yyl3154 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3154, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3154 := r.ReadArrayStart() - if yyl3154 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3154, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -36599,12 +44236,12 @@ func (x *ResourceQuota) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3155Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3155Slc - var yyhl3155 bool = l >= 0 - for yyj3155 := 0; ; yyj3155++ { - if yyhl3155 { - if yyj3155 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -36612,9 +44249,32 @@ func (x *ResourceQuota) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3155Slc = r.DecodeBytes(yys3155Slc, true, true) - yys3155 := string(yys3155Slc) - switch yys3155 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ResourceQuotaSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ResourceQuotaStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -36627,134 +44287,117 @@ func (x *ResourceQuota) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3158 := &x.ObjectMeta - yyv3158.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ResourceQuotaSpec{} - } else { - yyv3159 := &x.Spec - yyv3159.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = ResourceQuotaStatus{} - } else { - yyv3160 := &x.Status - yyv3160.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys3155) - } // end switch yys3155 - } // end for yyj3155 - if !yyhl3155 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceQuota) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3161 int - var yyb3161 bool - var yyhl3161 bool = l >= 0 - yyj3161++ - if yyhl3161 { - yyb3161 = yyj3161 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3161 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3161 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ResourceQuotaSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ResourceQuotaStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3161++ - if yyhl3161 { - yyb3161 = yyj3161 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3161 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3161 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3161++ - if yyhl3161 { - yyb3161 = yyj3161 > l - } else { - yyb3161 = r.CheckBreak() - } - if yyb3161 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3164 := &x.ObjectMeta - yyv3164.CodecDecodeSelf(d) - } - yyj3161++ - if yyhl3161 { - yyb3161 = yyj3161 > l - } else { - yyb3161 = r.CheckBreak() - } - if yyb3161 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ResourceQuotaSpec{} - } else { - yyv3165 := &x.Spec - yyv3165.CodecDecodeSelf(d) - } - yyj3161++ - if yyhl3161 { - yyb3161 = yyj3161 > l - } else { - yyb3161 = r.CheckBreak() - } - if yyb3161 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = ResourceQuotaStatus{} - } else { - yyv3166 := &x.Status - yyv3166.CodecDecodeSelf(d) - } for { - yyj3161++ - if yyhl3161 { - yyb3161 = yyj3161 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3161 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3161 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj3161-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceQuotaList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -36764,126 +44407,142 @@ func (x *ResourceQuotaList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3167 := z.EncBinary() - _ = yym3167 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3168 := !z.EncBinary() - yy2arr3168 := z.EncBasicHandle().StructToArray - var yyq3168 [4]bool - _, _, _ = yysep3168, yyq3168, yy2arr3168 - const yyr3168 bool = false - yyq3168[0] = x.Kind != "" - yyq3168[1] = x.APIVersion != "" - yyq3168[2] = true - if yyr3168 || yy2arr3168 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3168 int = 1 - for _, b := range yyq3168 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3168++ + yynn2++ } } - r.EncodeMapStart(yynn3168) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3168 || yy2arr3168 { - if yyq3168[0] { - yym3170 := z.EncBinary() - _ = yym3170 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3168[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3171 := z.EncBinary() - _ = yym3171 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3168 || yy2arr3168 { - if yyq3168[1] { - yym3173 := z.EncBinary() - _ = yym3173 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3168[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3174 := z.EncBinary() - _ = yym3174 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3168 || yy2arr3168 { - if yyq3168[2] { - yy3176 := &x.ListMeta - yym3177 := z.EncBinary() - _ = yym3177 - if false { - } else if z.HasExtensions() && z.EncExt(yy3176) { - } else { - z.EncFallback(yy3176) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq3168[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3178 := &x.ListMeta - yym3179 := z.EncBinary() - _ = yym3179 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy3178) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy3178) + z.EncFallback(yy6) } } } - if yyr3168 || yy2arr3168 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym3181 := z.EncBinary() - _ = yym3181 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceResourceQuota(([]ResourceQuota)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3182 := z.EncBinary() - _ = yym3182 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceResourceQuota(([]ResourceQuota)(x.Items), e) } } } - if yysep3168 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -36893,24 +44552,25 @@ func (x *ResourceQuotaList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3183 := z.DecBinary() - _ = yym3183 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3184 := r.ReadMapStart() - if yyl3184 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3184, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3184 := r.ReadArrayStart() - if yyl3184 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3184, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -36922,12 +44582,12 @@ func (x *ResourceQuotaList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3185Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3185Slc - var yyhl3185 bool = l >= 0 - for yyj3185 := 0; ; yyj3185++ { - if yyhl3185 { - if yyj3185 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -36935,9 +44595,36 @@ func (x *ResourceQuotaList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys3185Slc = r.DecodeBytes(yys3185Slc, true, true) - yys3185 := string(yys3185Slc) - switch yys3185 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceResourceQuota((*[]ResourceQuota)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -36950,133 +44637,111 @@ func (x *ResourceQuotaList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3188 := &x.ListMeta - yym3189 := z.DecBinary() - _ = yym3189 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3188) { - } else { - z.DecFallback(yyv3188, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3190 := &x.Items - yym3191 := z.DecBinary() - _ = yym3191 - if false { - } else { - h.decSliceResourceQuota((*[]ResourceQuota)(yyv3190), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3185) - } // end switch yys3185 - } // end for yyj3185 - if !yyhl3185 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceQuotaList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3192 int - var yyb3192 bool - var yyhl3192 bool = l >= 0 - yyj3192++ - if yyhl3192 { - yyb3192 = yyj3192 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3192 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3192 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceResourceQuota((*[]ResourceQuota)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3192++ - if yyhl3192 { - yyb3192 = yyj3192 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3192 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3192 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3192++ - if yyhl3192 { - yyb3192 = yyj3192 > l - } else { - yyb3192 = r.CheckBreak() - } - if yyb3192 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3195 := &x.ListMeta - yym3196 := z.DecBinary() - _ = yym3196 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3195) { - } else { - z.DecFallback(yyv3195, false) - } - } - yyj3192++ - if yyhl3192 { - yyb3192 = yyj3192 > l - } else { - yyb3192 = r.CheckBreak() - } - if yyb3192 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3197 := &x.Items - yym3198 := z.DecBinary() - _ = yym3198 - if false { - } else { - h.decSliceResourceQuota((*[]ResourceQuota)(yyv3197), d) - } - } for { - yyj3192++ - if yyhl3192 { - yyb3192 = yyj3192 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3192 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3192 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3192-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Secret) CodecEncodeSelf(e *codec1978.Encoder) { @@ -37086,97 +44751,59 @@ func (x *Secret) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3199 := z.EncBinary() - _ = yym3199 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3200 := !z.EncBinary() - yy2arr3200 := z.EncBasicHandle().StructToArray - var yyq3200 [5]bool - _, _, _ = yysep3200, yyq3200, yy2arr3200 - const yyr3200 bool = false - yyq3200[0] = x.Kind != "" - yyq3200[1] = x.APIVersion != "" - yyq3200[2] = true - yyq3200[3] = len(x.Data) != 0 - yyq3200[4] = x.Type != "" - if yyr3200 || yy2arr3200 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Data) != 0 + yyq2[2] = x.Type != "" + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn3200 int = 0 - for _, b := range yyq3200 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3200++ + yynn2++ } } - r.EncodeMapStart(yynn3200) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3200 || yy2arr3200 { - if yyq3200[0] { - yym3202 := z.EncBinary() - _ = yym3202 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3200[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3203 := z.EncBinary() - _ = yym3203 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3200 || yy2arr3200 { - if yyq3200[1] { - yym3205 := z.EncBinary() - _ = yym3205 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3200[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3206 := z.EncBinary() - _ = yym3206 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3200 || yy2arr3200 { - if yyq3200[2] { - yy3208 := &x.ObjectMeta - yy3208.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3200[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3209 := &x.ObjectMeta - yy3209.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3200 || yy2arr3200 { - if yyq3200[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Data == nil { r.EncodeNil() } else { - yym3211 := z.EncBinary() - _ = yym3211 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encMapstringSliceuint8((map[string][]uint8)(x.Data), e) @@ -37186,13 +44813,15 @@ func (x *Secret) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3200[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("data")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Data == nil { r.EncodeNil() } else { - yym3212 := z.EncBinary() - _ = yym3212 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encMapstringSliceuint8((map[string][]uint8)(x.Data), e) @@ -37200,20 +44829,75 @@ func (x *Secret) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3200 || yy2arr3200 { - if yyq3200[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { x.Type.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3200[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } } - if yysep3200 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -37223,24 +44907,25 @@ func (x *Secret) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3214 := z.DecBinary() - _ = yym3214 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3215 := r.ReadMapStart() - if yyl3215 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3215, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3215 := r.ReadArrayStart() - if yyl3215 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3215, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -37252,12 +44937,12 @@ func (x *Secret) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3216Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3216Slc - var yyhl3216 bool = l >= 0 - for yyj3216 := 0; ; yyj3216++ { - if yyhl3216 { - if yyj3216 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -37265,9 +44950,36 @@ func (x *Secret) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3216Slc = r.DecodeBytes(yys3216Slc, true, true) - yys3216 := string(yys3216Slc) - switch yys3216 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "data": + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv5 := &x.Data + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decMapstringSliceuint8((*map[string][]uint8)(yyv5), d) + } + } + case "type": + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = SecretType(r.DecodeString()) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -37280,150 +44992,129 @@ func (x *Secret) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3219 := &x.ObjectMeta - yyv3219.CodecDecodeSelf(d) - } - case "data": - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv3220 := &x.Data - yym3221 := z.DecBinary() - _ = yym3221 - if false { - } else { - h.decMapstringSliceuint8((*map[string][]uint8)(yyv3220), d) - } - } - case "type": - if r.TryDecodeAsNil() { - x.Type = "" - } else { - x.Type = SecretType(r.DecodeString()) - } default: - z.DecStructFieldNotFound(-1, yys3216) - } // end switch yys3216 - } // end for yyj3216 - if !yyhl3216 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Secret) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3223 int - var yyb3223 bool - var yyhl3223 bool = l >= 0 - yyj3223++ - if yyhl3223 { - yyb3223 = yyj3223 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3223 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3223 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj3223++ - if yyhl3223 { - yyb3223 = yyj3223 > l - } else { - yyb3223 = r.CheckBreak() - } - if yyb3223 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj3223++ - if yyhl3223 { - yyb3223 = yyj3223 > l - } else { - yyb3223 = r.CheckBreak() - } - if yyb3223 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv3226 := &x.ObjectMeta - yyv3226.CodecDecodeSelf(d) + yyv11 := &x.ObjectMeta + yyv11.CodecDecodeSelf(d) } - yyj3223++ - if yyhl3223 { - yyb3223 = yyj3223 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3223 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3223 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Data = nil } else { - yyv3227 := &x.Data - yym3228 := z.DecBinary() - _ = yym3228 + yyv12 := &x.Data + yym13 := z.DecBinary() + _ = yym13 if false { } else { - h.decMapstringSliceuint8((*map[string][]uint8)(yyv3227), d) + h.decMapstringSliceuint8((*map[string][]uint8)(yyv12), d) } } - yyj3223++ - if yyhl3223 { - yyb3223 = yyj3223 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3223 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3223 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = SecretType(r.DecodeString()) } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj3223++ - if yyhl3223 { - yyb3223 = yyj3223 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3223 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3223 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3223-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x SecretType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym3230 := z.EncBinary() - _ = yym3230 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -37435,8 +45126,8 @@ func (x *SecretType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3231 := z.DecBinary() - _ = yym3231 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -37451,126 +45142,142 @@ func (x *SecretList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3232 := z.EncBinary() - _ = yym3232 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3233 := !z.EncBinary() - yy2arr3233 := z.EncBasicHandle().StructToArray - var yyq3233 [4]bool - _, _, _ = yysep3233, yyq3233, yy2arr3233 - const yyr3233 bool = false - yyq3233[0] = x.Kind != "" - yyq3233[1] = x.APIVersion != "" - yyq3233[2] = true - if yyr3233 || yy2arr3233 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3233 int = 1 - for _, b := range yyq3233 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3233++ + yynn2++ } } - r.EncodeMapStart(yynn3233) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3233 || yy2arr3233 { - if yyq3233[0] { - yym3235 := z.EncBinary() - _ = yym3235 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3233[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3236 := z.EncBinary() - _ = yym3236 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3233 || yy2arr3233 { - if yyq3233[1] { - yym3238 := z.EncBinary() - _ = yym3238 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3233[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3239 := z.EncBinary() - _ = yym3239 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3233 || yy2arr3233 { - if yyq3233[2] { - yy3241 := &x.ListMeta - yym3242 := z.EncBinary() - _ = yym3242 - if false { - } else if z.HasExtensions() && z.EncExt(yy3241) { - } else { - z.EncFallback(yy3241) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq3233[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3243 := &x.ListMeta - yym3244 := z.EncBinary() - _ = yym3244 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy3243) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy3243) + z.EncFallback(yy6) } } } - if yyr3233 || yy2arr3233 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym3246 := z.EncBinary() - _ = yym3246 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceSecret(([]Secret)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3247 := z.EncBinary() - _ = yym3247 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceSecret(([]Secret)(x.Items), e) } } } - if yysep3233 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -37580,24 +45287,25 @@ func (x *SecretList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3248 := z.DecBinary() - _ = yym3248 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3249 := r.ReadMapStart() - if yyl3249 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3249, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3249 := r.ReadArrayStart() - if yyl3249 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3249, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -37609,12 +45317,12 @@ func (x *SecretList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3250Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3250Slc - var yyhl3250 bool = l >= 0 - for yyj3250 := 0; ; yyj3250++ { - if yyhl3250 { - if yyj3250 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -37622,9 +45330,36 @@ func (x *SecretList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3250Slc = r.DecodeBytes(yys3250Slc, true, true) - yys3250 := string(yys3250Slc) - switch yys3250 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceSecret((*[]Secret)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -37637,141 +45372,797 @@ func (x *SecretList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3253 := &x.ListMeta - yym3254 := z.DecBinary() - _ = yym3254 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3253) { - } else { - z.DecFallback(yyv3253, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3255 := &x.Items - yym3256 := z.DecBinary() - _ = yym3256 - if false { - } else { - h.decSliceSecret((*[]Secret)(yyv3255), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3250) - } // end switch yys3250 - } // end for yyj3250 - if !yyhl3250 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SecretList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3257 int - var yyb3257 bool - var yyhl3257 bool = l >= 0 - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3257 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3257 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceSecret((*[]Secret)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3257 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3257 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l - } else { - yyb3257 = r.CheckBreak() + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - if yyb3257 { - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ConfigMap) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Data) != 0 + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Data == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + z.F.EncMapStringStringV(x.Data, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("data")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Data == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + z.F.EncMapStringStringV(x.Data, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ConfigMap) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ConfigMap) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "data": + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv5 := &x.Data + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + z.F.DecMapStringStringX(yyv5, false, d) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ConfigMap) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv11 := &x.Data + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + z.F.DecMapStringStringX(yyv11, false, d) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ConfigMapList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Items) != 0 + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.EncExt(yy4) { + } else { + z.EncFallback(yy4) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(yy6) { + } else { + z.EncFallback(yy6) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Items == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + h.encSliceConfigMap(([]ConfigMap)(x.Items), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSliceConfigMap(([]ConfigMap)(x.Items), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ConfigMapList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ConfigMapList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceConfigMap((*[]ConfigMap)(yyv6), d) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ConfigMapList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ListMeta = pkg2_unversioned.ListMeta{} } else { - yyv3260 := &x.ListMeta - yym3261 := z.DecBinary() - _ = yym3261 + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 if false { - } else if z.HasExtensions() && z.DecExt(yyv3260) { + } else if z.HasExtensions() && z.DecExt(yyv11) { } else { - z.DecFallback(yyv3260, false) + z.DecFallback(yyv11, false) } } - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3257 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3257 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Items = nil } else { - yyv3262 := &x.Items - yym3263 := z.DecBinary() - _ = yym3263 + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceSecret((*[]Secret)(yyv3262), d) + h.decSliceConfigMap((*[]ConfigMap)(yyv13), d) } } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3257 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3257 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3257-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x PatchType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym3264 := z.EncBinary() - _ = yym3264 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -37783,8 +46174,8 @@ func (x *PatchType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3265 := z.DecBinary() - _ = yym3265 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -37796,8 +46187,8 @@ func (x ComponentConditionType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym3266 := z.EncBinary() - _ = yym3266 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -37809,8 +46200,8 @@ func (x *ComponentConditionType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3267 := z.DecBinary() - _ = yym3267 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -37825,45 +46216,54 @@ func (x *ComponentCondition) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3268 := z.EncBinary() - _ = yym3268 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3269 := !z.EncBinary() - yy2arr3269 := z.EncBasicHandle().StructToArray - var yyq3269 [4]bool - _, _, _ = yysep3269, yyq3269, yy2arr3269 - const yyr3269 bool = false - yyq3269[2] = x.Message != "" - yyq3269[3] = x.Error != "" - if yyr3269 || yy2arr3269 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Message != "" + yyq2[3] = x.Error != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3269 int = 2 - for _, b := range yyq3269 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn3269++ + yynn2++ } } - r.EncodeMapStart(yynn3269) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3269 || yy2arr3269 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr3269 || yy2arr3269 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Status.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Status.CodecEncodeSelf(e) } - if yyr3269 || yy2arr3269 { - if yyq3269[2] { - yym3273 := z.EncBinary() - _ = yym3273 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -37872,20 +46272,23 @@ func (x *ComponentCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3269[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym3274 := z.EncBinary() - _ = yym3274 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr3269 || yy2arr3269 { - if yyq3269[3] { - yym3276 := z.EncBinary() - _ = yym3276 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Error)) @@ -37894,18 +46297,22 @@ func (x *ComponentCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3269[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("error")) - yym3277 := z.EncBinary() - _ = yym3277 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Error)) } } } - if yysep3269 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -37915,24 +46322,25 @@ func (x *ComponentCondition) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3278 := z.DecBinary() - _ = yym3278 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3279 := r.ReadMapStart() - if yyl3279 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3279, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3279 := r.ReadArrayStart() - if yyl3279 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3279, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -37944,12 +46352,12 @@ func (x *ComponentCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3280Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3280Slc - var yyhl3280 bool = l >= 0 - for yyj3280 := 0; ; yyj3280++ { - if yyhl3280 { - if yyj3280 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -37957,9 +46365,11 @@ func (x *ComponentCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys3280Slc = r.DecodeBytes(yys3280Slc, true, true) - yys3280 := string(yys3280Slc) - switch yys3280 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -37985,94 +46395,97 @@ func (x *ComponentCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.Error = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys3280) - } // end switch yys3280 - } // end for yyj3280 - if !yyhl3280 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ComponentCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3285 int - var yyb3285 bool - var yyhl3285 bool = l >= 0 - yyj3285++ - if yyhl3285 { - yyb3285 = yyj3285 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3285 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3285 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = ComponentConditionType(r.DecodeString()) } - yyj3285++ - if yyhl3285 { - yyb3285 = yyj3285 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3285 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3285 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Status = "" } else { x.Status = ConditionStatus(r.DecodeString()) } - yyj3285++ - if yyhl3285 { - yyb3285 = yyj3285 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3285 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3285 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj3285++ - if yyhl3285 { - yyb3285 = yyj3285 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3285 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3285 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Error = "" } else { x.Error = string(r.DecodeString()) } for { - yyj3285++ - if yyhl3285 { - yyb3285 = yyj3285 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3285 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3285 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj3285-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ComponentStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -38082,96 +46495,58 @@ func (x *ComponentStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3290 := z.EncBinary() - _ = yym3290 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3291 := !z.EncBinary() - yy2arr3291 := z.EncBasicHandle().StructToArray - var yyq3291 [4]bool - _, _, _ = yysep3291, yyq3291, yy2arr3291 - const yyr3291 bool = false - yyq3291[0] = x.Kind != "" - yyq3291[1] = x.APIVersion != "" - yyq3291[2] = true - yyq3291[3] = len(x.Conditions) != 0 - if yyr3291 || yy2arr3291 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Conditions) != 0 + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3291 int = 0 - for _, b := range yyq3291 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3291++ + yynn2++ } } - r.EncodeMapStart(yynn3291) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3291 || yy2arr3291 { - if yyq3291[0] { - yym3293 := z.EncBinary() - _ = yym3293 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3291[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3294 := z.EncBinary() - _ = yym3294 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3291 || yy2arr3291 { - if yyq3291[1] { - yym3296 := z.EncBinary() - _ = yym3296 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3291[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3297 := z.EncBinary() - _ = yym3297 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3291 || yy2arr3291 { - if yyq3291[2] { - yy3299 := &x.ObjectMeta - yy3299.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3291[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3300 := &x.ObjectMeta - yy3300.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3291 || yy2arr3291 { - if yyq3291[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Conditions == nil { r.EncodeNil() } else { - yym3302 := z.EncBinary() - _ = yym3302 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceComponentCondition(([]ComponentCondition)(x.Conditions), e) @@ -38181,13 +46556,15 @@ func (x *ComponentStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3291[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("conditions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Conditions == nil { r.EncodeNil() } else { - yym3303 := z.EncBinary() - _ = yym3303 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceComponentCondition(([]ComponentCondition)(x.Conditions), e) @@ -38195,8 +46572,60 @@ func (x *ComponentStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep3291 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -38206,24 +46635,25 @@ func (x *ComponentStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3304 := z.DecBinary() - _ = yym3304 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3305 := r.ReadMapStart() - if yyl3305 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3305, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3305 := r.ReadArrayStart() - if yyl3305 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3305, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -38235,12 +46665,12 @@ func (x *ComponentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3306Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3306Slc - var yyhl3306 bool = l >= 0 - for yyj3306 := 0; ; yyj3306++ { - if yyhl3306 { - if yyj3306 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -38248,9 +46678,30 @@ func (x *ComponentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3306Slc = r.DecodeBytes(yys3306Slc, true, true) - yys3306 := string(yys3306Slc) - switch yys3306 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "conditions": + if r.TryDecodeAsNil() { + x.Conditions = nil + } else { + yyv5 := &x.Conditions + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceComponentCondition((*[]ComponentCondition)(yyv5), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -38263,121 +46714,105 @@ func (x *ComponentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3309 := &x.ObjectMeta - yyv3309.CodecDecodeSelf(d) - } - case "conditions": - if r.TryDecodeAsNil() { - x.Conditions = nil - } else { - yyv3310 := &x.Conditions - yym3311 := z.DecBinary() - _ = yym3311 - if false { - } else { - h.decSliceComponentCondition((*[]ComponentCondition)(yyv3310), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3306) - } // end switch yys3306 - } // end for yyj3306 - if !yyhl3306 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ComponentStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3312 int - var yyb3312 bool - var yyhl3312 bool = l >= 0 - yyj3312++ - if yyhl3312 { - yyb3312 = yyj3312 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3312 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3312 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Conditions = nil + } else { + yyv11 := &x.Conditions + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + h.decSliceComponentCondition((*[]ComponentCondition)(yyv11), d) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3312++ - if yyhl3312 { - yyb3312 = yyj3312 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3312 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3312 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3312++ - if yyhl3312 { - yyb3312 = yyj3312 > l - } else { - yyb3312 = r.CheckBreak() - } - if yyb3312 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3315 := &x.ObjectMeta - yyv3315.CodecDecodeSelf(d) - } - yyj3312++ - if yyhl3312 { - yyb3312 = yyj3312 > l - } else { - yyb3312 = r.CheckBreak() - } - if yyb3312 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Conditions = nil - } else { - yyv3316 := &x.Conditions - yym3317 := z.DecBinary() - _ = yym3317 - if false { - } else { - h.decSliceComponentCondition((*[]ComponentCondition)(yyv3316), d) - } - } for { - yyj3312++ - if yyhl3312 { - yyb3312 = yyj3312 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3312 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3312 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj3312-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ComponentStatusList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -38387,126 +46822,142 @@ func (x *ComponentStatusList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3318 := z.EncBinary() - _ = yym3318 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3319 := !z.EncBinary() - yy2arr3319 := z.EncBasicHandle().StructToArray - var yyq3319 [4]bool - _, _, _ = yysep3319, yyq3319, yy2arr3319 - const yyr3319 bool = false - yyq3319[0] = x.Kind != "" - yyq3319[1] = x.APIVersion != "" - yyq3319[2] = true - if yyr3319 || yy2arr3319 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3319 int = 1 - for _, b := range yyq3319 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3319++ + yynn2++ } } - r.EncodeMapStart(yynn3319) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3319 || yy2arr3319 { - if yyq3319[0] { - yym3321 := z.EncBinary() - _ = yym3321 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3319[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3322 := z.EncBinary() - _ = yym3322 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3319 || yy2arr3319 { - if yyq3319[1] { - yym3324 := z.EncBinary() - _ = yym3324 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3319[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3325 := z.EncBinary() - _ = yym3325 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3319 || yy2arr3319 { - if yyq3319[2] { - yy3327 := &x.ListMeta - yym3328 := z.EncBinary() - _ = yym3328 - if false { - } else if z.HasExtensions() && z.EncExt(yy3327) { - } else { - z.EncFallback(yy3327) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq3319[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3329 := &x.ListMeta - yym3330 := z.EncBinary() - _ = yym3330 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy3329) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy3329) + z.EncFallback(yy6) } } } - if yyr3319 || yy2arr3319 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym3332 := z.EncBinary() - _ = yym3332 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceComponentStatus(([]ComponentStatus)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3333 := z.EncBinary() - _ = yym3333 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceComponentStatus(([]ComponentStatus)(x.Items), e) } } } - if yysep3319 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -38516,24 +46967,25 @@ func (x *ComponentStatusList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3334 := z.DecBinary() - _ = yym3334 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3335 := r.ReadMapStart() - if yyl3335 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3335, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3335 := r.ReadArrayStart() - if yyl3335 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3335, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -38545,12 +46997,12 @@ func (x *ComponentStatusList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3336Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3336Slc - var yyhl3336 bool = l >= 0 - for yyj3336 := 0; ; yyj3336++ { - if yyhl3336 { - if yyj3336 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -38558,9 +47010,36 @@ func (x *ComponentStatusList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys3336Slc = r.DecodeBytes(yys3336Slc, true, true) - yys3336 := string(yys3336Slc) - switch yys3336 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceComponentStatus((*[]ComponentStatus)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -38573,133 +47052,111 @@ func (x *ComponentStatusList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3339 := &x.ListMeta - yym3340 := z.DecBinary() - _ = yym3340 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3339) { - } else { - z.DecFallback(yyv3339, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3341 := &x.Items - yym3342 := z.DecBinary() - _ = yym3342 - if false { - } else { - h.decSliceComponentStatus((*[]ComponentStatus)(yyv3341), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3336) - } // end switch yys3336 - } // end for yyj3336 - if !yyhl3336 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ComponentStatusList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3343 int - var yyb3343 bool - var yyhl3343 bool = l >= 0 - yyj3343++ - if yyhl3343 { - yyb3343 = yyj3343 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3343 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3343 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceComponentStatus((*[]ComponentStatus)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3343++ - if yyhl3343 { - yyb3343 = yyj3343 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3343 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3343 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3343++ - if yyhl3343 { - yyb3343 = yyj3343 > l - } else { - yyb3343 = r.CheckBreak() - } - if yyb3343 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3346 := &x.ListMeta - yym3347 := z.DecBinary() - _ = yym3347 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3346) { - } else { - z.DecFallback(yyv3346, false) - } - } - yyj3343++ - if yyhl3343 { - yyb3343 = yyj3343 > l - } else { - yyb3343 = r.CheckBreak() - } - if yyb3343 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3348 := &x.Items - yym3349 := z.DecBinary() - _ = yym3349 - if false { - } else { - h.decSliceComponentStatus((*[]ComponentStatus)(yyv3348), d) - } - } for { - yyj3343++ - if yyhl3343 { - yyb3343 = yyj3343 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3343 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3343 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3343-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { @@ -38709,34 +47166,38 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3350 := z.EncBinary() - _ = yym3350 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3351 := !z.EncBinary() - yy2arr3351 := z.EncBasicHandle().StructToArray - var yyq3351 [5]bool - _, _, _ = yysep3351, yyq3351, yy2arr3351 - const yyr3351 bool = false - yyq3351[0] = x.Capabilities != nil - yyq3351[1] = x.Privileged != nil - yyq3351[2] = x.SELinuxOptions != nil - yyq3351[3] = x.RunAsUser != nil - yyq3351[4] = x.RunAsNonRoot != nil - if yyr3351 || yy2arr3351 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Capabilities != nil + yyq2[1] = x.Privileged != nil + yyq2[2] = x.SELinuxOptions != nil + yyq2[3] = x.RunAsUser != nil + yyq2[4] = x.RunAsNonRoot != nil + yyq2[5] = x.ReadOnlyRootFilesystem != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(6) } else { - var yynn3351 int = 0 - for _, b := range yyq3351 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3351++ + yynn2++ } } - r.EncodeMapStart(yynn3351) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3351 || yy2arr3351 { - if yyq3351[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Capabilities == nil { r.EncodeNil() } else { @@ -38746,8 +47207,10 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3351[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("capabilities")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Capabilities == nil { r.EncodeNil() } else { @@ -38755,40 +47218,44 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3351 || yy2arr3351 { - if yyq3351[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Privileged == nil { r.EncodeNil() } else { - yy3354 := *x.Privileged - yym3355 := z.EncBinary() - _ = yym3355 + yy7 := *x.Privileged + yym8 := z.EncBinary() + _ = yym8 if false { } else { - r.EncodeBool(bool(yy3354)) + r.EncodeBool(bool(yy7)) } } } else { r.EncodeNil() } } else { - if yyq3351[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("privileged")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Privileged == nil { r.EncodeNil() } else { - yy3356 := *x.Privileged - yym3357 := z.EncBinary() - _ = yym3357 + yy9 := *x.Privileged + yym10 := z.EncBinary() + _ = yym10 if false { } else { - r.EncodeBool(bool(yy3356)) + r.EncodeBool(bool(yy9)) } } } } - if yyr3351 || yy2arr3351 { - if yyq3351[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.SELinuxOptions == nil { r.EncodeNil() } else { @@ -38798,8 +47265,10 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3351[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("seLinuxOptions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SELinuxOptions == nil { r.EncodeNil() } else { @@ -38807,72 +47276,115 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3351 || yy2arr3351 { - if yyq3351[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.RunAsUser == nil { r.EncodeNil() } else { - yy3360 := *x.RunAsUser - yym3361 := z.EncBinary() - _ = yym3361 + yy15 := *x.RunAsUser + yym16 := z.EncBinary() + _ = yym16 if false { } else { - r.EncodeInt(int64(yy3360)) + r.EncodeInt(int64(yy15)) } } } else { r.EncodeNil() } } else { - if yyq3351[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("runAsUser")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RunAsUser == nil { r.EncodeNil() } else { - yy3362 := *x.RunAsUser - yym3363 := z.EncBinary() - _ = yym3363 + yy17 := *x.RunAsUser + yym18 := z.EncBinary() + _ = yym18 if false { } else { - r.EncodeInt(int64(yy3362)) + r.EncodeInt(int64(yy17)) } } } } - if yyr3351 || yy2arr3351 { - if yyq3351[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.RunAsNonRoot == nil { r.EncodeNil() } else { - yy3365 := *x.RunAsNonRoot - yym3366 := z.EncBinary() - _ = yym3366 + yy20 := *x.RunAsNonRoot + yym21 := z.EncBinary() + _ = yym21 if false { } else { - r.EncodeBool(bool(yy3365)) + r.EncodeBool(bool(yy20)) } } } else { r.EncodeNil() } } else { - if yyq3351[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("runAsNonRoot")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RunAsNonRoot == nil { r.EncodeNil() } else { - yy3367 := *x.RunAsNonRoot - yym3368 := z.EncBinary() - _ = yym3368 + yy22 := *x.RunAsNonRoot + yym23 := z.EncBinary() + _ = yym23 if false { } else { - r.EncodeBool(bool(yy3367)) + r.EncodeBool(bool(yy22)) } } } } - if yysep3351 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + if x.ReadOnlyRootFilesystem == nil { + r.EncodeNil() + } else { + yy25 := *x.ReadOnlyRootFilesystem + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeBool(bool(yy25)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("readOnlyRootFilesystem")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ReadOnlyRootFilesystem == nil { + r.EncodeNil() + } else { + yy27 := *x.ReadOnlyRootFilesystem + yym28 := z.EncBinary() + _ = yym28 + if false { + } else { + r.EncodeBool(bool(yy27)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -38882,24 +47394,25 @@ func (x *SecurityContext) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3369 := z.DecBinary() - _ = yym3369 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3370 := r.ReadMapStart() - if yyl3370 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3370, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3370 := r.ReadArrayStart() - if yyl3370 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3370, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -38911,12 +47424,12 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3371Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3371Slc - var yyhl3371 bool = l >= 0 - for yyj3371 := 0; ; yyj3371++ { - if yyhl3371 { - if yyj3371 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -38924,9 +47437,11 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3371Slc = r.DecodeBytes(yys3371Slc, true, true) - yys3371 := string(yys3371Slc) - switch yys3371 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "capabilities": if r.TryDecodeAsNil() { if x.Capabilities != nil { @@ -38947,8 +47462,8 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.Privileged == nil { x.Privileged = new(bool) } - yym3374 := z.DecBinary() - _ = yym3374 + yym6 := z.DecBinary() + _ = yym6 if false { } else { *((*bool)(x.Privileged)) = r.DecodeBool() @@ -38974,8 +47489,8 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.RunAsUser == nil { x.RunAsUser = new(int64) } - yym3377 := z.DecBinary() - _ = yym3377 + yym9 := z.DecBinary() + _ = yym9 if false { } else { *((*int64)(x.RunAsUser)) = int64(r.DecodeInt(64)) @@ -38990,39 +47505,54 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.RunAsNonRoot == nil { x.RunAsNonRoot = new(bool) } - yym3379 := z.DecBinary() - _ = yym3379 + yym11 := z.DecBinary() + _ = yym11 if false { } else { *((*bool)(x.RunAsNonRoot)) = r.DecodeBool() } } + case "readOnlyRootFilesystem": + if r.TryDecodeAsNil() { + if x.ReadOnlyRootFilesystem != nil { + x.ReadOnlyRootFilesystem = nil + } + } else { + if x.ReadOnlyRootFilesystem == nil { + x.ReadOnlyRootFilesystem = new(bool) + } + yym13 := z.DecBinary() + _ = yym13 + if false { + } else { + *((*bool)(x.ReadOnlyRootFilesystem)) = r.DecodeBool() + } + } default: - z.DecStructFieldNotFound(-1, yys3371) - } // end switch yys3371 - } // end for yyj3371 - if !yyhl3371 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3380 int - var yyb3380 bool - var yyhl3380 bool = l >= 0 - yyj3380++ - if yyhl3380 { - yyb3380 = yyj3380 > l + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3380 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3380 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Capabilities != nil { x.Capabilities = nil @@ -39033,16 +47563,17 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) } x.Capabilities.CodecDecodeSelf(d) } - yyj3380++ - if yyhl3380 { - yyb3380 = yyj3380 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3380 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3380 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Privileged != nil { x.Privileged = nil @@ -39051,23 +47582,24 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) if x.Privileged == nil { x.Privileged = new(bool) } - yym3383 := z.DecBinary() - _ = yym3383 + yym17 := z.DecBinary() + _ = yym17 if false { } else { *((*bool)(x.Privileged)) = r.DecodeBool() } } - yyj3380++ - if yyhl3380 { - yyb3380 = yyj3380 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3380 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3380 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SELinuxOptions != nil { x.SELinuxOptions = nil @@ -39078,16 +47610,17 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) } x.SELinuxOptions.CodecDecodeSelf(d) } - yyj3380++ - if yyhl3380 { - yyb3380 = yyj3380 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3380 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3380 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RunAsUser != nil { x.RunAsUser = nil @@ -39096,23 +47629,24 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) if x.RunAsUser == nil { x.RunAsUser = new(int64) } - yym3386 := z.DecBinary() - _ = yym3386 + yym20 := z.DecBinary() + _ = yym20 if false { } else { *((*int64)(x.RunAsUser)) = int64(r.DecodeInt(64)) } } - yyj3380++ - if yyhl3380 { - yyb3380 = yyj3380 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3380 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3380 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RunAsNonRoot != nil { x.RunAsNonRoot = nil @@ -39121,26 +47655,53 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) if x.RunAsNonRoot == nil { x.RunAsNonRoot = new(bool) } - yym3388 := z.DecBinary() - _ = yym3388 + yym22 := z.DecBinary() + _ = yym22 if false { } else { *((*bool)(x.RunAsNonRoot)) = r.DecodeBool() } } - for { - yyj3380++ - if yyhl3380 { - yyb3380 = yyj3380 > l - } else { - yyb3380 = r.CheckBreak() + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ReadOnlyRootFilesystem != nil { + x.ReadOnlyRootFilesystem = nil } - if yyb3380 { + } else { + if x.ReadOnlyRootFilesystem == nil { + x.ReadOnlyRootFilesystem = new(bool) + } + yym24 := z.DecBinary() + _ = yym24 + if false { + } else { + *((*bool)(x.ReadOnlyRootFilesystem)) = r.DecodeBool() + } + } + for { + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { break } - z.DecStructFieldNotFound(yyj3380-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj14-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { @@ -39150,35 +47711,38 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3389 := z.EncBinary() - _ = yym3389 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3390 := !z.EncBinary() - yy2arr3390 := z.EncBasicHandle().StructToArray - var yyq3390 [4]bool - _, _, _ = yysep3390, yyq3390, yy2arr3390 - const yyr3390 bool = false - yyq3390[0] = x.User != "" - yyq3390[1] = x.Role != "" - yyq3390[2] = x.Type != "" - yyq3390[3] = x.Level != "" - if yyr3390 || yy2arr3390 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.User != "" + yyq2[1] = x.Role != "" + yyq2[2] = x.Type != "" + yyq2[3] = x.Level != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3390 int = 0 - for _, b := range yyq3390 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3390++ + yynn2++ } } - r.EncodeMapStart(yynn3390) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3390 || yy2arr3390 { - if yyq3390[0] { - yym3392 := z.EncBinary() - _ = yym3392 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.User)) @@ -39187,20 +47751,23 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3390[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("user")) - yym3393 := z.EncBinary() - _ = yym3393 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.User)) } } } - if yyr3390 || yy2arr3390 { - if yyq3390[1] { - yym3395 := z.EncBinary() - _ = yym3395 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Role)) @@ -39209,20 +47776,23 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3390[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("role")) - yym3396 := z.EncBinary() - _ = yym3396 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Role)) } } } - if yyr3390 || yy2arr3390 { - if yyq3390[2] { - yym3398 := z.EncBinary() - _ = yym3398 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Type)) @@ -39231,20 +47801,23 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3390[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) - yym3399 := z.EncBinary() - _ = yym3399 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Type)) } } } - if yyr3390 || yy2arr3390 { - if yyq3390[3] { - yym3401 := z.EncBinary() - _ = yym3401 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Level)) @@ -39253,18 +47826,22 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3390[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("level")) - yym3402 := z.EncBinary() - _ = yym3402 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Level)) } } } - if yysep3390 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -39274,24 +47851,25 @@ func (x *SELinuxOptions) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3403 := z.DecBinary() - _ = yym3403 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3404 := r.ReadMapStart() - if yyl3404 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3404, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3404 := r.ReadArrayStart() - if yyl3404 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3404, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -39303,12 +47881,12 @@ func (x *SELinuxOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3405Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3405Slc - var yyhl3405 bool = l >= 0 - for yyj3405 := 0; ; yyj3405++ { - if yyhl3405 { - if yyj3405 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -39316,9 +47894,11 @@ func (x *SELinuxOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3405Slc = r.DecodeBytes(yys3405Slc, true, true) - yys3405 := string(yys3405Slc) - switch yys3405 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "user": if r.TryDecodeAsNil() { x.User = "" @@ -39344,94 +47924,97 @@ func (x *SELinuxOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Level = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys3405) - } // end switch yys3405 - } // end for yyj3405 - if !yyhl3405 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SELinuxOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3410 int - var yyb3410 bool - var yyhl3410 bool = l >= 0 - yyj3410++ - if yyhl3410 { - yyb3410 = yyj3410 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3410 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3410 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.User = "" } else { x.User = string(r.DecodeString()) } - yyj3410++ - if yyhl3410 { - yyb3410 = yyj3410 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3410 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3410 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Role = "" } else { x.Role = string(r.DecodeString()) } - yyj3410++ - if yyhl3410 { - yyb3410 = yyj3410 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3410 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3410 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = string(r.DecodeString()) } - yyj3410++ - if yyhl3410 { - yyb3410 = yyj3410 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3410 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3410 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Level = "" } else { x.Level = string(r.DecodeString()) } for { - yyj3410++ - if yyhl3410 { - yyb3410 = yyj3410 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3410 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3410 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj3410-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *RangeAllocation) CodecEncodeSelf(e *codec1978.Encoder) { @@ -39441,130 +48024,149 @@ func (x *RangeAllocation) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3415 := z.EncBinary() - _ = yym3415 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3416 := !z.EncBinary() - yy2arr3416 := z.EncBasicHandle().StructToArray - var yyq3416 [5]bool - _, _, _ = yysep3416, yyq3416, yy2arr3416 - const yyr3416 bool = false - yyq3416[0] = x.Kind != "" - yyq3416[1] = x.APIVersion != "" - yyq3416[2] = true - if yyr3416 || yy2arr3416 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn3416 int = 2 - for _, b := range yyq3416 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn3416++ + yynn2++ } } - r.EncodeMapStart(yynn3416) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3416 || yy2arr3416 { - if yyq3416[0] { - yym3418 := z.EncBinary() - _ = yym3418 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3416[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3419 := z.EncBinary() - _ = yym3419 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3416 || yy2arr3416 { - if yyq3416[1] { - yym3421 := z.EncBinary() - _ = yym3421 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3416[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3422 := z.EncBinary() - _ = yym3422 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3416 || yy2arr3416 { - if yyq3416[2] { - yy3424 := &x.ObjectMeta - yy3424.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3416[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3425 := &x.ObjectMeta - yy3425.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3416 || yy2arr3416 { - yym3427 := z.EncBinary() - _ = yym3427 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym9 := z.EncBinary() + _ = yym9 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Range)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("range")) - yym3428 := z.EncBinary() - _ = yym3428 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Range)) } } - if yyr3416 || yy2arr3416 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Data == nil { r.EncodeNil() } else { - yym3430 := z.EncBinary() - _ = yym3430 + yym12 := z.EncBinary() + _ = yym12 if false { } else { r.EncodeStringBytes(codecSelferC_RAW1234, []byte(x.Data)) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("data")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Data == nil { r.EncodeNil() } else { - yym3431 := z.EncBinary() - _ = yym3431 + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeStringBytes(codecSelferC_RAW1234, []byte(x.Data)) } } } - if yysep3416 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -39574,24 +48176,25 @@ func (x *RangeAllocation) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3432 := z.DecBinary() - _ = yym3432 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3433 := r.ReadMapStart() - if yyl3433 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3433, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3433 := r.ReadArrayStart() - if yyl3433 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3433, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -39603,12 +48206,12 @@ func (x *RangeAllocation) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3434Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3434Slc - var yyhl3434 bool = l >= 0 - for yyj3434 := 0; ; yyj3434++ { - if yyhl3434 { - if yyj3434 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -39616,9 +48219,36 @@ func (x *RangeAllocation) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3434Slc = r.DecodeBytes(yys3434Slc, true, true) - yys3434 := string(yys3434Slc) - switch yys3434 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "range": + if r.TryDecodeAsNil() { + x.Range = "" + } else { + x.Range = string(r.DecodeString()) + } + case "data": + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv6 := &x.Data + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *yyv6 = r.DecodeBytes(*(*[]byte)(yyv6), false, false) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -39631,142 +48261,121 @@ func (x *RangeAllocation) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3437 := &x.ObjectMeta - yyv3437.CodecDecodeSelf(d) - } - case "range": - if r.TryDecodeAsNil() { - x.Range = "" - } else { - x.Range = string(r.DecodeString()) - } - case "data": - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv3439 := &x.Data - yym3440 := z.DecBinary() - _ = yym3440 - if false { - } else { - *yyv3439 = r.DecodeBytes(*(*[]byte)(yyv3439), false, false) - } - } default: - z.DecStructFieldNotFound(-1, yys3434) - } // end switch yys3434 - } // end for yyj3434 - if !yyhl3434 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *RangeAllocation) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3441 int - var yyb3441 bool - var yyhl3441 bool = l >= 0 - yyj3441++ - if yyhl3441 { - yyb3441 = yyj3441 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3441 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3441 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj3441++ - if yyhl3441 { - yyb3441 = yyj3441 > l - } else { - yyb3441 = r.CheckBreak() - } - if yyb3441 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj3441++ - if yyhl3441 { - yyb3441 = yyj3441 > l - } else { - yyb3441 = r.CheckBreak() - } - if yyb3441 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv3444 := &x.ObjectMeta - yyv3444.CodecDecodeSelf(d) + yyv11 := &x.ObjectMeta + yyv11.CodecDecodeSelf(d) } - yyj3441++ - if yyhl3441 { - yyb3441 = yyj3441 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3441 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3441 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Range = "" } else { x.Range = string(r.DecodeString()) } - yyj3441++ - if yyhl3441 { - yyb3441 = yyj3441 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3441 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3441 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Data = nil } else { - yyv3446 := &x.Data - yym3447 := z.DecBinary() - _ = yym3447 + yyv13 := &x.Data + yym14 := z.DecBinary() + _ = yym14 if false { } else { - *yyv3446 = r.DecodeBytes(*(*[]byte)(yyv3446), false, false) + *yyv13 = r.DecodeBytes(*(*[]byte)(yyv13), false, false) } } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj3441++ - if yyhl3441 { - yyb3441 = yyj3441 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3441 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3441 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3441-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) encSlicePersistentVolumeAccessMode(v []PersistentVolumeAccessMode, e *codec1978.Encoder) { @@ -39774,10 +48383,11 @@ func (x codecSelfer1234) encSlicePersistentVolumeAccessMode(v []PersistentVolume z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3448 := range v { - yyv3448.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yyv1.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePersistentVolumeAccessMode(v *[]PersistentVolumeAccessMode, d *codec1978.Decoder) { @@ -39785,77 +48395,78 @@ func (x codecSelfer1234) decSlicePersistentVolumeAccessMode(v *[]PersistentVolum z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3449 := *v - yyh3449, yyl3449 := z.DecSliceHelperStart() - - var yyrr3449, yyrl3449 int - var yyc3449, yyrt3449 bool - _, _, _ = yyc3449, yyrt3449, yyrl3449 - yyrr3449 = yyl3449 - - if yyv3449 == nil { - if yyrl3449, yyrt3449 = z.DecInferLen(yyl3449, z.DecBasicHandle().MaxInitLen, 16); yyrt3449 { - yyrr3449 = yyrl3449 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PersistentVolumeAccessMode{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3449 = make([]PersistentVolumeAccessMode, yyrl3449) - yyc3449 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3449 == 0 { - if len(yyv3449) != 0 { - yyv3449 = yyv3449[:0] - yyc3449 = true - } - } else if yyl3449 > 0 { - - if yyl3449 > cap(yyv3449) { - yyrl3449, yyrt3449 = z.DecInferLen(yyl3449, z.DecBasicHandle().MaxInitLen, 16) - - yyv23449 := yyv3449 - yyv3449 = make([]PersistentVolumeAccessMode, yyrl3449) - if len(yyv3449) > 0 { - copy(yyv3449, yyv23449[:cap(yyv23449)]) - } - yyc3449 = true - - yyrr3449 = len(yyv3449) - } else if yyl3449 != len(yyv3449) { - yyv3449 = yyv3449[:yyl3449] - yyc3449 = true - } - yyj3449 := 0 - for ; yyj3449 < yyrr3449; yyj3449++ { - if r.TryDecodeAsNil() { - yyv3449[yyj3449] = "" - } else { - yyv3449[yyj3449] = PersistentVolumeAccessMode(r.DecodeString()) - } - - } - if yyrt3449 { - for ; yyj3449 < yyl3449; yyj3449++ { - yyv3449 = append(yyv3449, "") - if r.TryDecodeAsNil() { - yyv3449[yyj3449] = "" + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] } else { - yyv3449[yyj3449] = PersistentVolumeAccessMode(r.DecodeString()) + yyv1 = make([]PersistentVolumeAccessMode, yyrl1) + } + } else { + yyv1 = make([]PersistentVolumeAccessMode, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = PersistentVolumeAccessMode(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = PersistentVolumeAccessMode(r.DecodeString()) } } } } else { - for yyj3449 := 0; !r.CheckBreak(); yyj3449++ { - if yyj3449 >= len(yyv3449) { - yyv3449 = append(yyv3449, "") // var yyz3449 PersistentVolumeAccessMode - yyc3449 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3449 < len(yyv3449) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 PersistentVolumeAccessMode + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3449[yyj3449] = "" + yyv1[yyj1] = "" } else { - yyv3449[yyj3449] = PersistentVolumeAccessMode(r.DecodeString()) + yyv1[yyj1] = PersistentVolumeAccessMode(r.DecodeString()) } } else { @@ -39863,12 +48474,18 @@ func (x codecSelfer1234) decSlicePersistentVolumeAccessMode(v *[]PersistentVolum } } - yyh3449.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PersistentVolumeAccessMode{} + yyc1 = true + } } - if yyc3449 { - *v = yyv3449 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePersistentVolume(v []PersistentVolume, e *codec1978.Encoder) { @@ -39876,11 +48493,12 @@ func (x codecSelfer1234) encSlicePersistentVolume(v []PersistentVolume, e *codec z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3453 := range v { - yy3454 := &yyv3453 - yy3454.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePersistentVolume(v *[]PersistentVolume, d *codec1978.Decoder) { @@ -39888,75 +48506,86 @@ func (x codecSelfer1234) decSlicePersistentVolume(v *[]PersistentVolume, d *code z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3455 := *v - yyh3455, yyl3455 := z.DecSliceHelperStart() - - var yyrr3455, yyrl3455 int - var yyc3455, yyrt3455 bool - _, _, _ = yyc3455, yyrt3455, yyrl3455 - yyrr3455 = yyl3455 - - if yyv3455 == nil { - if yyrl3455, yyrt3455 = z.DecInferLen(yyl3455, z.DecBasicHandle().MaxInitLen, 384); yyrt3455 { - yyrr3455 = yyrl3455 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PersistentVolume{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3455 = make([]PersistentVolume, yyrl3455) - yyc3455 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3455 == 0 { - if len(yyv3455) != 0 { - yyv3455 = yyv3455[:0] - yyc3455 = true - } - } else if yyl3455 > 0 { - - if yyl3455 > cap(yyv3455) { - yyrl3455, yyrt3455 = z.DecInferLen(yyl3455, z.DecBasicHandle().MaxInitLen, 384) - yyv3455 = make([]PersistentVolume, yyrl3455) - yyc3455 = true - - yyrr3455 = len(yyv3455) - } else if yyl3455 != len(yyv3455) { - yyv3455 = yyv3455[:yyl3455] - yyc3455 = true - } - yyj3455 := 0 - for ; yyj3455 < yyrr3455; yyj3455++ { - if r.TryDecodeAsNil() { - yyv3455[yyj3455] = PersistentVolume{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 400) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PersistentVolume, yyrl1) + } } else { - yyv3456 := &yyv3455[yyj3455] - yyv3456.CodecDecodeSelf(d) + yyv1 = make([]PersistentVolume, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PersistentVolume{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3455 { - for ; yyj3455 < yyl3455; yyj3455++ { - yyv3455 = append(yyv3455, PersistentVolume{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PersistentVolume{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3455[yyj3455] = PersistentVolume{} + yyv1[yyj1] = PersistentVolume{} } else { - yyv3457 := &yyv3455[yyj3455] - yyv3457.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3455 := 0; !r.CheckBreak(); yyj3455++ { - if yyj3455 >= len(yyv3455) { - yyv3455 = append(yyv3455, PersistentVolume{}) // var yyz3455 PersistentVolume - yyc3455 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3455 < len(yyv3455) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PersistentVolume{}) // var yyz1 PersistentVolume + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3455[yyj3455] = PersistentVolume{} + yyv1[yyj1] = PersistentVolume{} } else { - yyv3458 := &yyv3455[yyj3455] - yyv3458.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -39964,12 +48593,18 @@ func (x codecSelfer1234) decSlicePersistentVolume(v *[]PersistentVolume, d *code } } - yyh3455.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PersistentVolume{} + yyc1 = true + } } - if yyc3455 { - *v = yyv3455 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePersistentVolumeClaim(v []PersistentVolumeClaim, e *codec1978.Encoder) { @@ -39977,11 +48612,12 @@ func (x codecSelfer1234) encSlicePersistentVolumeClaim(v []PersistentVolumeClaim z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3459 := range v { - yy3460 := &yyv3459 - yy3460.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePersistentVolumeClaim(v *[]PersistentVolumeClaim, d *codec1978.Decoder) { @@ -39989,75 +48625,86 @@ func (x codecSelfer1234) decSlicePersistentVolumeClaim(v *[]PersistentVolumeClai z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3461 := *v - yyh3461, yyl3461 := z.DecSliceHelperStart() - - var yyrr3461, yyrl3461 int - var yyc3461, yyrt3461 bool - _, _, _ = yyc3461, yyrt3461, yyrl3461 - yyrr3461 = yyl3461 - - if yyv3461 == nil { - if yyrl3461, yyrt3461 = z.DecInferLen(yyl3461, z.DecBasicHandle().MaxInitLen, 296); yyrt3461 { - yyrr3461 = yyrl3461 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PersistentVolumeClaim{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3461 = make([]PersistentVolumeClaim, yyrl3461) - yyc3461 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3461 == 0 { - if len(yyv3461) != 0 { - yyv3461 = yyv3461[:0] - yyc3461 = true - } - } else if yyl3461 > 0 { - - if yyl3461 > cap(yyv3461) { - yyrl3461, yyrt3461 = z.DecInferLen(yyl3461, z.DecBasicHandle().MaxInitLen, 296) - yyv3461 = make([]PersistentVolumeClaim, yyrl3461) - yyc3461 = true - - yyrr3461 = len(yyv3461) - } else if yyl3461 != len(yyv3461) { - yyv3461 = yyv3461[:yyl3461] - yyc3461 = true - } - yyj3461 := 0 - for ; yyj3461 < yyrr3461; yyj3461++ { - if r.TryDecodeAsNil() { - yyv3461[yyj3461] = PersistentVolumeClaim{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 296) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PersistentVolumeClaim, yyrl1) + } } else { - yyv3462 := &yyv3461[yyj3461] - yyv3462.CodecDecodeSelf(d) + yyv1 = make([]PersistentVolumeClaim, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PersistentVolumeClaim{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3461 { - for ; yyj3461 < yyl3461; yyj3461++ { - yyv3461 = append(yyv3461, PersistentVolumeClaim{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PersistentVolumeClaim{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3461[yyj3461] = PersistentVolumeClaim{} + yyv1[yyj1] = PersistentVolumeClaim{} } else { - yyv3463 := &yyv3461[yyj3461] - yyv3463.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3461 := 0; !r.CheckBreak(); yyj3461++ { - if yyj3461 >= len(yyv3461) { - yyv3461 = append(yyv3461, PersistentVolumeClaim{}) // var yyz3461 PersistentVolumeClaim - yyc3461 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3461 < len(yyv3461) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PersistentVolumeClaim{}) // var yyz1 PersistentVolumeClaim + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3461[yyj3461] = PersistentVolumeClaim{} + yyv1[yyj1] = PersistentVolumeClaim{} } else { - yyv3464 := &yyv3461[yyj3461] - yyv3464.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40065,12 +48712,18 @@ func (x codecSelfer1234) decSlicePersistentVolumeClaim(v *[]PersistentVolumeClai } } - yyh3461.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PersistentVolumeClaim{} + yyc1 = true + } } - if yyc3461 { - *v = yyv3461 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceDownwardAPIVolumeFile(v []DownwardAPIVolumeFile, e *codec1978.Encoder) { @@ -40078,11 +48731,12 @@ func (x codecSelfer1234) encSliceDownwardAPIVolumeFile(v []DownwardAPIVolumeFile z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3465 := range v { - yy3466 := &yyv3465 - yy3466.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceDownwardAPIVolumeFile(v *[]DownwardAPIVolumeFile, d *codec1978.Decoder) { @@ -40090,75 +48744,86 @@ func (x codecSelfer1234) decSliceDownwardAPIVolumeFile(v *[]DownwardAPIVolumeFil z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3467 := *v - yyh3467, yyl3467 := z.DecSliceHelperStart() - - var yyrr3467, yyrl3467 int - var yyc3467, yyrt3467 bool - _, _, _ = yyc3467, yyrt3467, yyrl3467 - yyrr3467 = yyl3467 - - if yyv3467 == nil { - if yyrl3467, yyrt3467 = z.DecInferLen(yyl3467, z.DecBasicHandle().MaxInitLen, 48); yyrt3467 { - yyrr3467 = yyrl3467 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []DownwardAPIVolumeFile{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3467 = make([]DownwardAPIVolumeFile, yyrl3467) - yyc3467 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3467 == 0 { - if len(yyv3467) != 0 { - yyv3467 = yyv3467[:0] - yyc3467 = true - } - } else if yyl3467 > 0 { - - if yyl3467 > cap(yyv3467) { - yyrl3467, yyrt3467 = z.DecInferLen(yyl3467, z.DecBasicHandle().MaxInitLen, 48) - yyv3467 = make([]DownwardAPIVolumeFile, yyrl3467) - yyc3467 = true - - yyrr3467 = len(yyv3467) - } else if yyl3467 != len(yyv3467) { - yyv3467 = yyv3467[:yyl3467] - yyc3467 = true - } - yyj3467 := 0 - for ; yyj3467 < yyrr3467; yyj3467++ { - if r.TryDecodeAsNil() { - yyv3467[yyj3467] = DownwardAPIVolumeFile{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 48) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]DownwardAPIVolumeFile, yyrl1) + } } else { - yyv3468 := &yyv3467[yyj3467] - yyv3468.CodecDecodeSelf(d) + yyv1 = make([]DownwardAPIVolumeFile, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = DownwardAPIVolumeFile{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3467 { - for ; yyj3467 < yyl3467; yyj3467++ { - yyv3467 = append(yyv3467, DownwardAPIVolumeFile{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, DownwardAPIVolumeFile{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3467[yyj3467] = DownwardAPIVolumeFile{} + yyv1[yyj1] = DownwardAPIVolumeFile{} } else { - yyv3469 := &yyv3467[yyj3467] - yyv3469.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3467 := 0; !r.CheckBreak(); yyj3467++ { - if yyj3467 >= len(yyv3467) { - yyv3467 = append(yyv3467, DownwardAPIVolumeFile{}) // var yyz3467 DownwardAPIVolumeFile - yyc3467 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3467 < len(yyv3467) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, DownwardAPIVolumeFile{}) // var yyz1 DownwardAPIVolumeFile + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3467[yyj3467] = DownwardAPIVolumeFile{} + yyv1[yyj1] = DownwardAPIVolumeFile{} } else { - yyv3470 := &yyv3467[yyj3467] - yyv3470.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40166,12 +48831,256 @@ func (x codecSelfer1234) decSliceDownwardAPIVolumeFile(v *[]DownwardAPIVolumeFil } } - yyh3467.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []DownwardAPIVolumeFile{} + yyc1 = true + } } - if yyc3467 { - *v = yyv3467 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceKeyToPath(v []KeyToPath, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceKeyToPath(v *[]KeyToPath, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []KeyToPath{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]KeyToPath, yyrl1) + } + } else { + yyv1 = make([]KeyToPath, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = KeyToPath{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, KeyToPath{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = KeyToPath{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, KeyToPath{}) // var yyz1 KeyToPath + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = KeyToPath{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []KeyToPath{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceHTTPHeader(v []HTTPHeader, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceHTTPHeader(v *[]HTTPHeader, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []HTTPHeader{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]HTTPHeader, yyrl1) + } + } else { + yyv1 = make([]HTTPHeader, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HTTPHeader{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, HTTPHeader{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HTTPHeader{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, HTTPHeader{}) // var yyz1 HTTPHeader + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = HTTPHeader{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []HTTPHeader{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceCapability(v []Capability, e *codec1978.Encoder) { @@ -40179,10 +49088,11 @@ func (x codecSelfer1234) encSliceCapability(v []Capability, e *codec1978.Encoder z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3471 := range v { - yyv3471.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yyv1.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceCapability(v *[]Capability, d *codec1978.Decoder) { @@ -40190,77 +49100,78 @@ func (x codecSelfer1234) decSliceCapability(v *[]Capability, d *codec1978.Decode z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3472 := *v - yyh3472, yyl3472 := z.DecSliceHelperStart() - - var yyrr3472, yyrl3472 int - var yyc3472, yyrt3472 bool - _, _, _ = yyc3472, yyrt3472, yyrl3472 - yyrr3472 = yyl3472 - - if yyv3472 == nil { - if yyrl3472, yyrt3472 = z.DecInferLen(yyl3472, z.DecBasicHandle().MaxInitLen, 16); yyrt3472 { - yyrr3472 = yyrl3472 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Capability{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3472 = make([]Capability, yyrl3472) - yyc3472 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3472 == 0 { - if len(yyv3472) != 0 { - yyv3472 = yyv3472[:0] - yyc3472 = true - } - } else if yyl3472 > 0 { - - if yyl3472 > cap(yyv3472) { - yyrl3472, yyrt3472 = z.DecInferLen(yyl3472, z.DecBasicHandle().MaxInitLen, 16) - - yyv23472 := yyv3472 - yyv3472 = make([]Capability, yyrl3472) - if len(yyv3472) > 0 { - copy(yyv3472, yyv23472[:cap(yyv23472)]) - } - yyc3472 = true - - yyrr3472 = len(yyv3472) - } else if yyl3472 != len(yyv3472) { - yyv3472 = yyv3472[:yyl3472] - yyc3472 = true - } - yyj3472 := 0 - for ; yyj3472 < yyrr3472; yyj3472++ { - if r.TryDecodeAsNil() { - yyv3472[yyj3472] = "" - } else { - yyv3472[yyj3472] = Capability(r.DecodeString()) - } - - } - if yyrt3472 { - for ; yyj3472 < yyl3472; yyj3472++ { - yyv3472 = append(yyv3472, "") - if r.TryDecodeAsNil() { - yyv3472[yyj3472] = "" + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] } else { - yyv3472[yyj3472] = Capability(r.DecodeString()) + yyv1 = make([]Capability, yyrl1) + } + } else { + yyv1 = make([]Capability, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = Capability(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = Capability(r.DecodeString()) } } } } else { - for yyj3472 := 0; !r.CheckBreak(); yyj3472++ { - if yyj3472 >= len(yyv3472) { - yyv3472 = append(yyv3472, "") // var yyz3472 Capability - yyc3472 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3472 < len(yyv3472) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 Capability + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3472[yyj3472] = "" + yyv1[yyj1] = "" } else { - yyv3472[yyj3472] = Capability(r.DecodeString()) + yyv1[yyj1] = Capability(r.DecodeString()) } } else { @@ -40268,12 +49179,18 @@ func (x codecSelfer1234) decSliceCapability(v *[]Capability, d *codec1978.Decode } } - yyh3472.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Capability{} + yyc1 = true + } } - if yyc3472 { - *v = yyv3472 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceContainerPort(v []ContainerPort, e *codec1978.Encoder) { @@ -40281,11 +49198,12 @@ func (x codecSelfer1234) encSliceContainerPort(v []ContainerPort, e *codec1978.E z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3476 := range v { - yy3477 := &yyv3476 - yy3477.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceContainerPort(v *[]ContainerPort, d *codec1978.Decoder) { @@ -40293,75 +49211,86 @@ func (x codecSelfer1234) decSliceContainerPort(v *[]ContainerPort, d *codec1978. z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3478 := *v - yyh3478, yyl3478 := z.DecSliceHelperStart() - - var yyrr3478, yyrl3478 int - var yyc3478, yyrt3478 bool - _, _, _ = yyc3478, yyrt3478, yyrl3478 - yyrr3478 = yyl3478 - - if yyv3478 == nil { - if yyrl3478, yyrt3478 = z.DecInferLen(yyl3478, z.DecBasicHandle().MaxInitLen, 64); yyrt3478 { - yyrr3478 = yyrl3478 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ContainerPort{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3478 = make([]ContainerPort, yyrl3478) - yyc3478 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3478 == 0 { - if len(yyv3478) != 0 { - yyv3478 = yyv3478[:0] - yyc3478 = true - } - } else if yyl3478 > 0 { - - if yyl3478 > cap(yyv3478) { - yyrl3478, yyrt3478 = z.DecInferLen(yyl3478, z.DecBasicHandle().MaxInitLen, 64) - yyv3478 = make([]ContainerPort, yyrl3478) - yyc3478 = true - - yyrr3478 = len(yyv3478) - } else if yyl3478 != len(yyv3478) { - yyv3478 = yyv3478[:yyl3478] - yyc3478 = true - } - yyj3478 := 0 - for ; yyj3478 < yyrr3478; yyj3478++ { - if r.TryDecodeAsNil() { - yyv3478[yyj3478] = ContainerPort{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 64) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ContainerPort, yyrl1) + } } else { - yyv3479 := &yyv3478[yyj3478] - yyv3479.CodecDecodeSelf(d) + yyv1 = make([]ContainerPort, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerPort{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3478 { - for ; yyj3478 < yyl3478; yyj3478++ { - yyv3478 = append(yyv3478, ContainerPort{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ContainerPort{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3478[yyj3478] = ContainerPort{} + yyv1[yyj1] = ContainerPort{} } else { - yyv3480 := &yyv3478[yyj3478] - yyv3480.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3478 := 0; !r.CheckBreak(); yyj3478++ { - if yyj3478 >= len(yyv3478) { - yyv3478 = append(yyv3478, ContainerPort{}) // var yyz3478 ContainerPort - yyc3478 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3478 < len(yyv3478) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ContainerPort{}) // var yyz1 ContainerPort + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3478[yyj3478] = ContainerPort{} + yyv1[yyj1] = ContainerPort{} } else { - yyv3481 := &yyv3478[yyj3478] - yyv3481.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40369,12 +49298,18 @@ func (x codecSelfer1234) decSliceContainerPort(v *[]ContainerPort, d *codec1978. } } - yyh3478.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ContainerPort{} + yyc1 = true + } } - if yyc3478 { - *v = yyv3478 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEnvVar(v []EnvVar, e *codec1978.Encoder) { @@ -40382,11 +49317,12 @@ func (x codecSelfer1234) encSliceEnvVar(v []EnvVar, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3482 := range v { - yy3483 := &yyv3482 - yy3483.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEnvVar(v *[]EnvVar, d *codec1978.Decoder) { @@ -40394,75 +49330,86 @@ func (x codecSelfer1234) decSliceEnvVar(v *[]EnvVar, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3484 := *v - yyh3484, yyl3484 := z.DecSliceHelperStart() - - var yyrr3484, yyrl3484 int - var yyc3484, yyrt3484 bool - _, _, _ = yyc3484, yyrt3484, yyrl3484 - yyrr3484 = yyl3484 - - if yyv3484 == nil { - if yyrl3484, yyrt3484 = z.DecInferLen(yyl3484, z.DecBasicHandle().MaxInitLen, 40); yyrt3484 { - yyrr3484 = yyrl3484 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []EnvVar{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3484 = make([]EnvVar, yyrl3484) - yyc3484 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3484 == 0 { - if len(yyv3484) != 0 { - yyv3484 = yyv3484[:0] - yyc3484 = true - } - } else if yyl3484 > 0 { - - if yyl3484 > cap(yyv3484) { - yyrl3484, yyrt3484 = z.DecInferLen(yyl3484, z.DecBasicHandle().MaxInitLen, 40) - yyv3484 = make([]EnvVar, yyrl3484) - yyc3484 = true - - yyrr3484 = len(yyv3484) - } else if yyl3484 != len(yyv3484) { - yyv3484 = yyv3484[:yyl3484] - yyc3484 = true - } - yyj3484 := 0 - for ; yyj3484 < yyrr3484; yyj3484++ { - if r.TryDecodeAsNil() { - yyv3484[yyj3484] = EnvVar{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]EnvVar, yyrl1) + } } else { - yyv3485 := &yyv3484[yyj3484] - yyv3485.CodecDecodeSelf(d) + yyv1 = make([]EnvVar, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = EnvVar{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3484 { - for ; yyj3484 < yyl3484; yyj3484++ { - yyv3484 = append(yyv3484, EnvVar{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, EnvVar{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3484[yyj3484] = EnvVar{} + yyv1[yyj1] = EnvVar{} } else { - yyv3486 := &yyv3484[yyj3484] - yyv3486.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3484 := 0; !r.CheckBreak(); yyj3484++ { - if yyj3484 >= len(yyv3484) { - yyv3484 = append(yyv3484, EnvVar{}) // var yyz3484 EnvVar - yyc3484 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3484 < len(yyv3484) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, EnvVar{}) // var yyz1 EnvVar + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3484[yyj3484] = EnvVar{} + yyv1[yyj1] = EnvVar{} } else { - yyv3487 := &yyv3484[yyj3484] - yyv3487.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40470,12 +49417,18 @@ func (x codecSelfer1234) decSliceEnvVar(v *[]EnvVar, d *codec1978.Decoder) { } } - yyh3484.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []EnvVar{} + yyc1 = true + } } - if yyc3484 { - *v = yyv3484 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceVolumeMount(v []VolumeMount, e *codec1978.Encoder) { @@ -40483,11 +49436,12 @@ func (x codecSelfer1234) encSliceVolumeMount(v []VolumeMount, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3488 := range v { - yy3489 := &yyv3488 - yy3489.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceVolumeMount(v *[]VolumeMount, d *codec1978.Decoder) { @@ -40495,75 +49449,86 @@ func (x codecSelfer1234) decSliceVolumeMount(v *[]VolumeMount, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3490 := *v - yyh3490, yyl3490 := z.DecSliceHelperStart() - - var yyrr3490, yyrl3490 int - var yyc3490, yyrt3490 bool - _, _, _ = yyc3490, yyrt3490, yyrl3490 - yyrr3490 = yyl3490 - - if yyv3490 == nil { - if yyrl3490, yyrt3490 = z.DecInferLen(yyl3490, z.DecBasicHandle().MaxInitLen, 40); yyrt3490 { - yyrr3490 = yyrl3490 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []VolumeMount{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3490 = make([]VolumeMount, yyrl3490) - yyc3490 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3490 == 0 { - if len(yyv3490) != 0 { - yyv3490 = yyv3490[:0] - yyc3490 = true - } - } else if yyl3490 > 0 { - - if yyl3490 > cap(yyv3490) { - yyrl3490, yyrt3490 = z.DecInferLen(yyl3490, z.DecBasicHandle().MaxInitLen, 40) - yyv3490 = make([]VolumeMount, yyrl3490) - yyc3490 = true - - yyrr3490 = len(yyv3490) - } else if yyl3490 != len(yyv3490) { - yyv3490 = yyv3490[:yyl3490] - yyc3490 = true - } - yyj3490 := 0 - for ; yyj3490 < yyrr3490; yyj3490++ { - if r.TryDecodeAsNil() { - yyv3490[yyj3490] = VolumeMount{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]VolumeMount, yyrl1) + } } else { - yyv3491 := &yyv3490[yyj3490] - yyv3491.CodecDecodeSelf(d) + yyv1 = make([]VolumeMount, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = VolumeMount{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3490 { - for ; yyj3490 < yyl3490; yyj3490++ { - yyv3490 = append(yyv3490, VolumeMount{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, VolumeMount{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3490[yyj3490] = VolumeMount{} + yyv1[yyj1] = VolumeMount{} } else { - yyv3492 := &yyv3490[yyj3490] - yyv3492.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3490 := 0; !r.CheckBreak(); yyj3490++ { - if yyj3490 >= len(yyv3490) { - yyv3490 = append(yyv3490, VolumeMount{}) // var yyz3490 VolumeMount - yyc3490 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3490 < len(yyv3490) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, VolumeMount{}) // var yyz1 VolumeMount + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3490[yyj3490] = VolumeMount{} + yyv1[yyj1] = VolumeMount{} } else { - yyv3493 := &yyv3490[yyj3490] - yyv3493.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40571,12 +49536,18 @@ func (x codecSelfer1234) decSliceVolumeMount(v *[]VolumeMount, d *codec1978.Deco } } - yyh3490.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []VolumeMount{} + yyc1 = true + } } - if yyc3490 { - *v = yyv3490 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePod(v []Pod, e *codec1978.Encoder) { @@ -40584,11 +49555,12 @@ func (x codecSelfer1234) encSlicePod(v []Pod, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3494 := range v { - yy3495 := &yyv3494 - yy3495.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePod(v *[]Pod, d *codec1978.Decoder) { @@ -40596,75 +49568,86 @@ func (x codecSelfer1234) decSlicePod(v *[]Pod, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3496 := *v - yyh3496, yyl3496 := z.DecSliceHelperStart() - - var yyrr3496, yyrl3496 int - var yyc3496, yyrt3496 bool - _, _, _ = yyc3496, yyrt3496, yyrl3496 - yyrr3496 = yyl3496 - - if yyv3496 == nil { - if yyrl3496, yyrt3496 = z.DecInferLen(yyl3496, z.DecBasicHandle().MaxInitLen, 496); yyrt3496 { - yyrr3496 = yyrl3496 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Pod{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3496 = make([]Pod, yyrl3496) - yyc3496 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3496 == 0 { - if len(yyv3496) != 0 { - yyv3496 = yyv3496[:0] - yyc3496 = true - } - } else if yyl3496 > 0 { - - if yyl3496 > cap(yyv3496) { - yyrl3496, yyrt3496 = z.DecInferLen(yyl3496, z.DecBasicHandle().MaxInitLen, 496) - yyv3496 = make([]Pod, yyrl3496) - yyc3496 = true - - yyrr3496 = len(yyv3496) - } else if yyl3496 != len(yyv3496) { - yyv3496 = yyv3496[:yyl3496] - yyc3496 = true - } - yyj3496 := 0 - for ; yyj3496 < yyrr3496; yyj3496++ { - if r.TryDecodeAsNil() { - yyv3496[yyj3496] = Pod{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 496) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Pod, yyrl1) + } } else { - yyv3497 := &yyv3496[yyj3496] - yyv3497.CodecDecodeSelf(d) + yyv1 = make([]Pod, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Pod{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3496 { - for ; yyj3496 < yyl3496; yyj3496++ { - yyv3496 = append(yyv3496, Pod{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Pod{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3496[yyj3496] = Pod{} + yyv1[yyj1] = Pod{} } else { - yyv3498 := &yyv3496[yyj3496] - yyv3498.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3496 := 0; !r.CheckBreak(); yyj3496++ { - if yyj3496 >= len(yyv3496) { - yyv3496 = append(yyv3496, Pod{}) // var yyz3496 Pod - yyc3496 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3496 < len(yyv3496) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Pod{}) // var yyz1 Pod + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3496[yyj3496] = Pod{} + yyv1[yyj1] = Pod{} } else { - yyv3499 := &yyv3496[yyj3496] - yyv3499.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40672,12 +49655,375 @@ func (x codecSelfer1234) decSlicePod(v *[]Pod, d *codec1978.Decoder) { } } - yyh3496.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Pod{} + yyc1 = true + } } - if yyc3496 { - *v = yyv3496 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceNodeSelectorTerm(v []NodeSelectorTerm, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceNodeSelectorTerm(v *[]NodeSelectorTerm, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeSelectorTerm{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeSelectorTerm, yyrl1) + } + } else { + yyv1 = make([]NodeSelectorTerm, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorTerm{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeSelectorTerm{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorTerm{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeSelectorTerm{}) // var yyz1 NodeSelectorTerm + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorTerm{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeSelectorTerm{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceNodeSelectorRequirement(v []NodeSelectorRequirement, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceNodeSelectorRequirement(v *[]NodeSelectorRequirement, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeSelectorRequirement{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 56) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeSelectorRequirement, yyrl1) + } + } else { + yyv1 = make([]NodeSelectorRequirement, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorRequirement{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeSelectorRequirement{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorRequirement{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeSelectorRequirement{}) // var yyz1 NodeSelectorRequirement + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorRequirement{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeSelectorRequirement{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSlicePreferredSchedulingTerm(v []PreferredSchedulingTerm, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSlicePreferredSchedulingTerm(v *[]PreferredSchedulingTerm, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PreferredSchedulingTerm{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PreferredSchedulingTerm, yyrl1) + } + } else { + yyv1 = make([]PreferredSchedulingTerm, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PreferredSchedulingTerm{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PreferredSchedulingTerm{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PreferredSchedulingTerm{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PreferredSchedulingTerm{}) // var yyz1 PreferredSchedulingTerm + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = PreferredSchedulingTerm{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PreferredSchedulingTerm{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceVolume(v []Volume, e *codec1978.Encoder) { @@ -40685,11 +50031,12 @@ func (x codecSelfer1234) encSliceVolume(v []Volume, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3500 := range v { - yy3501 := &yyv3500 - yy3501.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceVolume(v *[]Volume, d *codec1978.Decoder) { @@ -40697,75 +50044,86 @@ func (x codecSelfer1234) decSliceVolume(v *[]Volume, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3502 := *v - yyh3502, yyl3502 := z.DecSliceHelperStart() - - var yyrr3502, yyrl3502 int - var yyc3502, yyrt3502 bool - _, _, _ = yyc3502, yyrt3502, yyrl3502 - yyrr3502 = yyl3502 - - if yyv3502 == nil { - if yyrl3502, yyrt3502 = z.DecInferLen(yyl3502, z.DecBasicHandle().MaxInitLen, 144); yyrt3502 { - yyrr3502 = yyrl3502 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Volume{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3502 = make([]Volume, yyrl3502) - yyc3502 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3502 == 0 { - if len(yyv3502) != 0 { - yyv3502 = yyv3502[:0] - yyc3502 = true - } - } else if yyl3502 > 0 { - - if yyl3502 > cap(yyv3502) { - yyrl3502, yyrt3502 = z.DecInferLen(yyl3502, z.DecBasicHandle().MaxInitLen, 144) - yyv3502 = make([]Volume, yyrl3502) - yyc3502 = true - - yyrr3502 = len(yyv3502) - } else if yyl3502 != len(yyv3502) { - yyv3502 = yyv3502[:yyl3502] - yyc3502 = true - } - yyj3502 := 0 - for ; yyj3502 < yyrr3502; yyj3502++ { - if r.TryDecodeAsNil() { - yyv3502[yyj3502] = Volume{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 168) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Volume, yyrl1) + } } else { - yyv3503 := &yyv3502[yyj3502] - yyv3503.CodecDecodeSelf(d) + yyv1 = make([]Volume, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Volume{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3502 { - for ; yyj3502 < yyl3502; yyj3502++ { - yyv3502 = append(yyv3502, Volume{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Volume{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3502[yyj3502] = Volume{} + yyv1[yyj1] = Volume{} } else { - yyv3504 := &yyv3502[yyj3502] - yyv3504.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3502 := 0; !r.CheckBreak(); yyj3502++ { - if yyj3502 >= len(yyv3502) { - yyv3502 = append(yyv3502, Volume{}) // var yyz3502 Volume - yyc3502 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3502 < len(yyv3502) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Volume{}) // var yyz1 Volume + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3502[yyj3502] = Volume{} + yyv1[yyj1] = Volume{} } else { - yyv3505 := &yyv3502[yyj3502] - yyv3505.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40773,12 +50131,18 @@ func (x codecSelfer1234) decSliceVolume(v *[]Volume, d *codec1978.Decoder) { } } - yyh3502.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Volume{} + yyc1 = true + } } - if yyc3502 { - *v = yyv3502 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceContainer(v []Container, e *codec1978.Encoder) { @@ -40786,11 +50150,12 @@ func (x codecSelfer1234) encSliceContainer(v []Container, e *codec1978.Encoder) z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3506 := range v { - yy3507 := &yyv3506 - yy3507.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceContainer(v *[]Container, d *codec1978.Decoder) { @@ -40798,75 +50163,86 @@ func (x codecSelfer1234) decSliceContainer(v *[]Container, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3508 := *v - yyh3508, yyl3508 := z.DecSliceHelperStart() - - var yyrr3508, yyrl3508 int - var yyc3508, yyrt3508 bool - _, _, _ = yyc3508, yyrt3508, yyrl3508 - yyrr3508 = yyl3508 - - if yyv3508 == nil { - if yyrl3508, yyrt3508 = z.DecInferLen(yyl3508, z.DecBasicHandle().MaxInitLen, 256); yyrt3508 { - yyrr3508 = yyrl3508 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Container{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3508 = make([]Container, yyrl3508) - yyc3508 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3508 == 0 { - if len(yyv3508) != 0 { - yyv3508 = yyv3508[:0] - yyc3508 = true - } - } else if yyl3508 > 0 { - - if yyl3508 > cap(yyv3508) { - yyrl3508, yyrt3508 = z.DecInferLen(yyl3508, z.DecBasicHandle().MaxInitLen, 256) - yyv3508 = make([]Container, yyrl3508) - yyc3508 = true - - yyrr3508 = len(yyv3508) - } else if yyl3508 != len(yyv3508) { - yyv3508 = yyv3508[:yyl3508] - yyc3508 = true - } - yyj3508 := 0 - for ; yyj3508 < yyrr3508; yyj3508++ { - if r.TryDecodeAsNil() { - yyv3508[yyj3508] = Container{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 256) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Container, yyrl1) + } } else { - yyv3509 := &yyv3508[yyj3508] - yyv3509.CodecDecodeSelf(d) + yyv1 = make([]Container, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Container{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3508 { - for ; yyj3508 < yyl3508; yyj3508++ { - yyv3508 = append(yyv3508, Container{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Container{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3508[yyj3508] = Container{} + yyv1[yyj1] = Container{} } else { - yyv3510 := &yyv3508[yyj3508] - yyv3510.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3508 := 0; !r.CheckBreak(); yyj3508++ { - if yyj3508 >= len(yyv3508) { - yyv3508 = append(yyv3508, Container{}) // var yyz3508 Container - yyc3508 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3508 < len(yyv3508) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Container{}) // var yyz1 Container + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3508[yyj3508] = Container{} + yyv1[yyj1] = Container{} } else { - yyv3511 := &yyv3508[yyj3508] - yyv3511.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40874,12 +50250,18 @@ func (x codecSelfer1234) decSliceContainer(v *[]Container, d *codec1978.Decoder) } } - yyh3508.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Container{} + yyc1 = true + } } - if yyc3508 { - *v = yyv3508 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceLocalObjectReference(v []LocalObjectReference, e *codec1978.Encoder) { @@ -40887,11 +50269,12 @@ func (x codecSelfer1234) encSliceLocalObjectReference(v []LocalObjectReference, z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3512 := range v { - yy3513 := &yyv3512 - yy3513.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceLocalObjectReference(v *[]LocalObjectReference, d *codec1978.Decoder) { @@ -40899,75 +50282,86 @@ func (x codecSelfer1234) decSliceLocalObjectReference(v *[]LocalObjectReference, z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3514 := *v - yyh3514, yyl3514 := z.DecSliceHelperStart() - - var yyrr3514, yyrl3514 int - var yyc3514, yyrt3514 bool - _, _, _ = yyc3514, yyrt3514, yyrl3514 - yyrr3514 = yyl3514 - - if yyv3514 == nil { - if yyrl3514, yyrt3514 = z.DecInferLen(yyl3514, z.DecBasicHandle().MaxInitLen, 16); yyrt3514 { - yyrr3514 = yyrl3514 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []LocalObjectReference{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3514 = make([]LocalObjectReference, yyrl3514) - yyc3514 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3514 == 0 { - if len(yyv3514) != 0 { - yyv3514 = yyv3514[:0] - yyc3514 = true - } - } else if yyl3514 > 0 { - - if yyl3514 > cap(yyv3514) { - yyrl3514, yyrt3514 = z.DecInferLen(yyl3514, z.DecBasicHandle().MaxInitLen, 16) - yyv3514 = make([]LocalObjectReference, yyrl3514) - yyc3514 = true - - yyrr3514 = len(yyv3514) - } else if yyl3514 != len(yyv3514) { - yyv3514 = yyv3514[:yyl3514] - yyc3514 = true - } - yyj3514 := 0 - for ; yyj3514 < yyrr3514; yyj3514++ { - if r.TryDecodeAsNil() { - yyv3514[yyj3514] = LocalObjectReference{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]LocalObjectReference, yyrl1) + } } else { - yyv3515 := &yyv3514[yyj3514] - yyv3515.CodecDecodeSelf(d) + yyv1 = make([]LocalObjectReference, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = LocalObjectReference{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3514 { - for ; yyj3514 < yyl3514; yyj3514++ { - yyv3514 = append(yyv3514, LocalObjectReference{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, LocalObjectReference{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3514[yyj3514] = LocalObjectReference{} + yyv1[yyj1] = LocalObjectReference{} } else { - yyv3516 := &yyv3514[yyj3514] - yyv3516.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3514 := 0; !r.CheckBreak(); yyj3514++ { - if yyj3514 >= len(yyv3514) { - yyv3514 = append(yyv3514, LocalObjectReference{}) // var yyz3514 LocalObjectReference - yyc3514 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3514 < len(yyv3514) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LocalObjectReference{}) // var yyz1 LocalObjectReference + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3514[yyj3514] = LocalObjectReference{} + yyv1[yyj1] = LocalObjectReference{} } else { - yyv3517 := &yyv3514[yyj3514] - yyv3517.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40975,12 +50369,18 @@ func (x codecSelfer1234) decSliceLocalObjectReference(v *[]LocalObjectReference, } } - yyh3514.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []LocalObjectReference{} + yyc1 = true + } } - if yyc3514 { - *v = yyv3514 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePodCondition(v []PodCondition, e *codec1978.Encoder) { @@ -40988,11 +50388,12 @@ func (x codecSelfer1234) encSlicePodCondition(v []PodCondition, e *codec1978.Enc z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3518 := range v { - yy3519 := &yyv3518 - yy3519.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePodCondition(v *[]PodCondition, d *codec1978.Decoder) { @@ -41000,75 +50401,86 @@ func (x codecSelfer1234) decSlicePodCondition(v *[]PodCondition, d *codec1978.De z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3520 := *v - yyh3520, yyl3520 := z.DecSliceHelperStart() - - var yyrr3520, yyrl3520 int - var yyc3520, yyrt3520 bool - _, _, _ = yyc3520, yyrt3520, yyrl3520 - yyrr3520 = yyl3520 - - if yyv3520 == nil { - if yyrl3520, yyrt3520 = z.DecInferLen(yyl3520, z.DecBasicHandle().MaxInitLen, 112); yyrt3520 { - yyrr3520 = yyrl3520 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PodCondition{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3520 = make([]PodCondition, yyrl3520) - yyc3520 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3520 == 0 { - if len(yyv3520) != 0 { - yyv3520 = yyv3520[:0] - yyc3520 = true - } - } else if yyl3520 > 0 { - - if yyl3520 > cap(yyv3520) { - yyrl3520, yyrt3520 = z.DecInferLen(yyl3520, z.DecBasicHandle().MaxInitLen, 112) - yyv3520 = make([]PodCondition, yyrl3520) - yyc3520 = true - - yyrr3520 = len(yyv3520) - } else if yyl3520 != len(yyv3520) { - yyv3520 = yyv3520[:yyl3520] - yyc3520 = true - } - yyj3520 := 0 - for ; yyj3520 < yyrr3520; yyj3520++ { - if r.TryDecodeAsNil() { - yyv3520[yyj3520] = PodCondition{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 112) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PodCondition, yyrl1) + } } else { - yyv3521 := &yyv3520[yyj3520] - yyv3521.CodecDecodeSelf(d) + yyv1 = make([]PodCondition, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodCondition{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3520 { - for ; yyj3520 < yyl3520; yyj3520++ { - yyv3520 = append(yyv3520, PodCondition{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PodCondition{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3520[yyj3520] = PodCondition{} + yyv1[yyj1] = PodCondition{} } else { - yyv3522 := &yyv3520[yyj3520] - yyv3522.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3520 := 0; !r.CheckBreak(); yyj3520++ { - if yyj3520 >= len(yyv3520) { - yyv3520 = append(yyv3520, PodCondition{}) // var yyz3520 PodCondition - yyc3520 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3520 < len(yyv3520) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PodCondition{}) // var yyz1 PodCondition + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3520[yyj3520] = PodCondition{} + yyv1[yyj1] = PodCondition{} } else { - yyv3523 := &yyv3520[yyj3520] - yyv3523.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41076,12 +50488,18 @@ func (x codecSelfer1234) decSlicePodCondition(v *[]PodCondition, d *codec1978.De } } - yyh3520.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PodCondition{} + yyc1 = true + } } - if yyc3520 { - *v = yyv3520 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceContainerStatus(v []ContainerStatus, e *codec1978.Encoder) { @@ -41089,11 +50507,12 @@ func (x codecSelfer1234) encSliceContainerStatus(v []ContainerStatus, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3524 := range v { - yy3525 := &yyv3524 - yy3525.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceContainerStatus(v *[]ContainerStatus, d *codec1978.Decoder) { @@ -41101,75 +50520,86 @@ func (x codecSelfer1234) decSliceContainerStatus(v *[]ContainerStatus, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3526 := *v - yyh3526, yyl3526 := z.DecSliceHelperStart() - - var yyrr3526, yyrl3526 int - var yyc3526, yyrt3526 bool - _, _, _ = yyc3526, yyrt3526, yyrl3526 - yyrr3526 = yyl3526 - - if yyv3526 == nil { - if yyrl3526, yyrt3526 = z.DecInferLen(yyl3526, z.DecBasicHandle().MaxInitLen, 128); yyrt3526 { - yyrr3526 = yyrl3526 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ContainerStatus{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3526 = make([]ContainerStatus, yyrl3526) - yyc3526 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3526 == 0 { - if len(yyv3526) != 0 { - yyv3526 = yyv3526[:0] - yyc3526 = true - } - } else if yyl3526 > 0 { - - if yyl3526 > cap(yyv3526) { - yyrl3526, yyrt3526 = z.DecInferLen(yyl3526, z.DecBasicHandle().MaxInitLen, 128) - yyv3526 = make([]ContainerStatus, yyrl3526) - yyc3526 = true - - yyrr3526 = len(yyv3526) - } else if yyl3526 != len(yyv3526) { - yyv3526 = yyv3526[:yyl3526] - yyc3526 = true - } - yyj3526 := 0 - for ; yyj3526 < yyrr3526; yyj3526++ { - if r.TryDecodeAsNil() { - yyv3526[yyj3526] = ContainerStatus{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 128) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ContainerStatus, yyrl1) + } } else { - yyv3527 := &yyv3526[yyj3526] - yyv3527.CodecDecodeSelf(d) + yyv1 = make([]ContainerStatus, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerStatus{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3526 { - for ; yyj3526 < yyl3526; yyj3526++ { - yyv3526 = append(yyv3526, ContainerStatus{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ContainerStatus{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3526[yyj3526] = ContainerStatus{} + yyv1[yyj1] = ContainerStatus{} } else { - yyv3528 := &yyv3526[yyj3526] - yyv3528.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3526 := 0; !r.CheckBreak(); yyj3526++ { - if yyj3526 >= len(yyv3526) { - yyv3526 = append(yyv3526, ContainerStatus{}) // var yyz3526 ContainerStatus - yyc3526 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3526 < len(yyv3526) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ContainerStatus{}) // var yyz1 ContainerStatus + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3526[yyj3526] = ContainerStatus{} + yyv1[yyj1] = ContainerStatus{} } else { - yyv3529 := &yyv3526[yyj3526] - yyv3529.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41177,12 +50607,18 @@ func (x codecSelfer1234) decSliceContainerStatus(v *[]ContainerStatus, d *codec1 } } - yyh3526.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ContainerStatus{} + yyc1 = true + } } - if yyc3526 { - *v = yyv3526 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePodTemplate(v []PodTemplate, e *codec1978.Encoder) { @@ -41190,11 +50626,12 @@ func (x codecSelfer1234) encSlicePodTemplate(v []PodTemplate, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3530 := range v { - yy3531 := &yyv3530 - yy3531.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePodTemplate(v *[]PodTemplate, d *codec1978.Decoder) { @@ -41202,75 +50639,86 @@ func (x codecSelfer1234) decSlicePodTemplate(v *[]PodTemplate, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3532 := *v - yyh3532, yyl3532 := z.DecSliceHelperStart() - - var yyrr3532, yyrl3532 int - var yyc3532, yyrt3532 bool - _, _, _ = yyc3532, yyrt3532, yyrl3532 - yyrr3532 = yyl3532 - - if yyv3532 == nil { - if yyrl3532, yyrt3532 = z.DecInferLen(yyl3532, z.DecBasicHandle().MaxInitLen, 520); yyrt3532 { - yyrr3532 = yyrl3532 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PodTemplate{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3532 = make([]PodTemplate, yyrl3532) - yyc3532 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3532 == 0 { - if len(yyv3532) != 0 { - yyv3532 = yyv3532[:0] - yyc3532 = true - } - } else if yyl3532 > 0 { - - if yyl3532 > cap(yyv3532) { - yyrl3532, yyrt3532 = z.DecInferLen(yyl3532, z.DecBasicHandle().MaxInitLen, 520) - yyv3532 = make([]PodTemplate, yyrl3532) - yyc3532 = true - - yyrr3532 = len(yyv3532) - } else if yyl3532 != len(yyv3532) { - yyv3532 = yyv3532[:yyl3532] - yyc3532 = true - } - yyj3532 := 0 - for ; yyj3532 < yyrr3532; yyj3532++ { - if r.TryDecodeAsNil() { - yyv3532[yyj3532] = PodTemplate{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 520) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PodTemplate, yyrl1) + } } else { - yyv3533 := &yyv3532[yyj3532] - yyv3533.CodecDecodeSelf(d) + yyv1 = make([]PodTemplate, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodTemplate{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3532 { - for ; yyj3532 < yyl3532; yyj3532++ { - yyv3532 = append(yyv3532, PodTemplate{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PodTemplate{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3532[yyj3532] = PodTemplate{} + yyv1[yyj1] = PodTemplate{} } else { - yyv3534 := &yyv3532[yyj3532] - yyv3534.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3532 := 0; !r.CheckBreak(); yyj3532++ { - if yyj3532 >= len(yyv3532) { - yyv3532 = append(yyv3532, PodTemplate{}) // var yyz3532 PodTemplate - yyc3532 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3532 < len(yyv3532) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PodTemplate{}) // var yyz1 PodTemplate + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3532[yyj3532] = PodTemplate{} + yyv1[yyj1] = PodTemplate{} } else { - yyv3535 := &yyv3532[yyj3532] - yyv3535.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41278,12 +50726,18 @@ func (x codecSelfer1234) decSlicePodTemplate(v *[]PodTemplate, d *codec1978.Deco } } - yyh3532.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PodTemplate{} + yyc1 = true + } } - if yyc3532 { - *v = yyv3532 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceReplicationController(v []ReplicationController, e *codec1978.Encoder) { @@ -41291,11 +50745,12 @@ func (x codecSelfer1234) encSliceReplicationController(v []ReplicationController z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3536 := range v { - yy3537 := &yyv3536 - yy3537.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceReplicationController(v *[]ReplicationController, d *codec1978.Decoder) { @@ -41303,75 +50758,86 @@ func (x codecSelfer1234) decSliceReplicationController(v *[]ReplicationControlle z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3538 := *v - yyh3538, yyl3538 := z.DecSliceHelperStart() - - var yyrr3538, yyrl3538 int - var yyc3538, yyrt3538 bool - _, _, _ = yyc3538, yyrt3538, yyrl3538 - yyrr3538 = yyl3538 - - if yyv3538 == nil { - if yyrl3538, yyrt3538 = z.DecInferLen(yyl3538, z.DecBasicHandle().MaxInitLen, 232); yyrt3538 { - yyrr3538 = yyrl3538 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ReplicationController{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3538 = make([]ReplicationController, yyrl3538) - yyc3538 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3538 == 0 { - if len(yyv3538) != 0 { - yyv3538 = yyv3538[:0] - yyc3538 = true - } - } else if yyl3538 > 0 { - - if yyl3538 > cap(yyv3538) { - yyrl3538, yyrt3538 = z.DecInferLen(yyl3538, z.DecBasicHandle().MaxInitLen, 232) - yyv3538 = make([]ReplicationController, yyrl3538) - yyc3538 = true - - yyrr3538 = len(yyv3538) - } else if yyl3538 != len(yyv3538) { - yyv3538 = yyv3538[:yyl3538] - yyc3538 = true - } - yyj3538 := 0 - for ; yyj3538 < yyrr3538; yyj3538++ { - if r.TryDecodeAsNil() { - yyv3538[yyj3538] = ReplicationController{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 232) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ReplicationController, yyrl1) + } } else { - yyv3539 := &yyv3538[yyj3538] - yyv3539.CodecDecodeSelf(d) + yyv1 = make([]ReplicationController, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ReplicationController{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3538 { - for ; yyj3538 < yyl3538; yyj3538++ { - yyv3538 = append(yyv3538, ReplicationController{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ReplicationController{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3538[yyj3538] = ReplicationController{} + yyv1[yyj1] = ReplicationController{} } else { - yyv3540 := &yyv3538[yyj3538] - yyv3540.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3538 := 0; !r.CheckBreak(); yyj3538++ { - if yyj3538 >= len(yyv3538) { - yyv3538 = append(yyv3538, ReplicationController{}) // var yyz3538 ReplicationController - yyc3538 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3538 < len(yyv3538) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ReplicationController{}) // var yyz1 ReplicationController + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3538[yyj3538] = ReplicationController{} + yyv1[yyj1] = ReplicationController{} } else { - yyv3541 := &yyv3538[yyj3538] - yyv3541.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41379,12 +50845,18 @@ func (x codecSelfer1234) decSliceReplicationController(v *[]ReplicationControlle } } - yyh3538.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ReplicationController{} + yyc1 = true + } } - if yyc3538 { - *v = yyv3538 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceService(v []Service, e *codec1978.Encoder) { @@ -41392,11 +50864,12 @@ func (x codecSelfer1234) encSliceService(v []Service, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3542 := range v { - yy3543 := &yyv3542 - yy3543.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceService(v *[]Service, d *codec1978.Decoder) { @@ -41404,75 +50877,86 @@ func (x codecSelfer1234) decSliceService(v *[]Service, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3544 := *v - yyh3544, yyl3544 := z.DecSliceHelperStart() - - var yyrr3544, yyrl3544 int - var yyc3544, yyrt3544 bool - _, _, _ = yyc3544, yyrt3544, yyrl3544 - yyrr3544 = yyl3544 - - if yyv3544 == nil { - if yyrl3544, yyrt3544 = z.DecInferLen(yyl3544, z.DecBasicHandle().MaxInitLen, 336); yyrt3544 { - yyrr3544 = yyrl3544 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Service{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3544 = make([]Service, yyrl3544) - yyc3544 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3544 == 0 { - if len(yyv3544) != 0 { - yyv3544 = yyv3544[:0] - yyc3544 = true - } - } else if yyl3544 > 0 { - - if yyl3544 > cap(yyv3544) { - yyrl3544, yyrt3544 = z.DecInferLen(yyl3544, z.DecBasicHandle().MaxInitLen, 336) - yyv3544 = make([]Service, yyrl3544) - yyc3544 = true - - yyrr3544 = len(yyv3544) - } else if yyl3544 != len(yyv3544) { - yyv3544 = yyv3544[:yyl3544] - yyc3544 = true - } - yyj3544 := 0 - for ; yyj3544 < yyrr3544; yyj3544++ { - if r.TryDecodeAsNil() { - yyv3544[yyj3544] = Service{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 336) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Service, yyrl1) + } } else { - yyv3545 := &yyv3544[yyj3544] - yyv3545.CodecDecodeSelf(d) + yyv1 = make([]Service, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Service{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3544 { - for ; yyj3544 < yyl3544; yyj3544++ { - yyv3544 = append(yyv3544, Service{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Service{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3544[yyj3544] = Service{} + yyv1[yyj1] = Service{} } else { - yyv3546 := &yyv3544[yyj3544] - yyv3546.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3544 := 0; !r.CheckBreak(); yyj3544++ { - if yyj3544 >= len(yyv3544) { - yyv3544 = append(yyv3544, Service{}) // var yyz3544 Service - yyc3544 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3544 < len(yyv3544) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Service{}) // var yyz1 Service + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3544[yyj3544] = Service{} + yyv1[yyj1] = Service{} } else { - yyv3547 := &yyv3544[yyj3544] - yyv3547.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41480,12 +50964,18 @@ func (x codecSelfer1234) decSliceService(v *[]Service, d *codec1978.Decoder) { } } - yyh3544.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Service{} + yyc1 = true + } } - if yyc3544 { - *v = yyv3544 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceLoadBalancerIngress(v []LoadBalancerIngress, e *codec1978.Encoder) { @@ -41493,11 +50983,12 @@ func (x codecSelfer1234) encSliceLoadBalancerIngress(v []LoadBalancerIngress, e z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3548 := range v { - yy3549 := &yyv3548 - yy3549.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceLoadBalancerIngress(v *[]LoadBalancerIngress, d *codec1978.Decoder) { @@ -41505,75 +50996,86 @@ func (x codecSelfer1234) decSliceLoadBalancerIngress(v *[]LoadBalancerIngress, d z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3550 := *v - yyh3550, yyl3550 := z.DecSliceHelperStart() - - var yyrr3550, yyrl3550 int - var yyc3550, yyrt3550 bool - _, _, _ = yyc3550, yyrt3550, yyrl3550 - yyrr3550 = yyl3550 - - if yyv3550 == nil { - if yyrl3550, yyrt3550 = z.DecInferLen(yyl3550, z.DecBasicHandle().MaxInitLen, 32); yyrt3550 { - yyrr3550 = yyrl3550 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []LoadBalancerIngress{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3550 = make([]LoadBalancerIngress, yyrl3550) - yyc3550 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3550 == 0 { - if len(yyv3550) != 0 { - yyv3550 = yyv3550[:0] - yyc3550 = true - } - } else if yyl3550 > 0 { - - if yyl3550 > cap(yyv3550) { - yyrl3550, yyrt3550 = z.DecInferLen(yyl3550, z.DecBasicHandle().MaxInitLen, 32) - yyv3550 = make([]LoadBalancerIngress, yyrl3550) - yyc3550 = true - - yyrr3550 = len(yyv3550) - } else if yyl3550 != len(yyv3550) { - yyv3550 = yyv3550[:yyl3550] - yyc3550 = true - } - yyj3550 := 0 - for ; yyj3550 < yyrr3550; yyj3550++ { - if r.TryDecodeAsNil() { - yyv3550[yyj3550] = LoadBalancerIngress{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]LoadBalancerIngress, yyrl1) + } } else { - yyv3551 := &yyv3550[yyj3550] - yyv3551.CodecDecodeSelf(d) + yyv1 = make([]LoadBalancerIngress, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = LoadBalancerIngress{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3550 { - for ; yyj3550 < yyl3550; yyj3550++ { - yyv3550 = append(yyv3550, LoadBalancerIngress{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, LoadBalancerIngress{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3550[yyj3550] = LoadBalancerIngress{} + yyv1[yyj1] = LoadBalancerIngress{} } else { - yyv3552 := &yyv3550[yyj3550] - yyv3552.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3550 := 0; !r.CheckBreak(); yyj3550++ { - if yyj3550 >= len(yyv3550) { - yyv3550 = append(yyv3550, LoadBalancerIngress{}) // var yyz3550 LoadBalancerIngress - yyc3550 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3550 < len(yyv3550) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LoadBalancerIngress{}) // var yyz1 LoadBalancerIngress + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3550[yyj3550] = LoadBalancerIngress{} + yyv1[yyj1] = LoadBalancerIngress{} } else { - yyv3553 := &yyv3550[yyj3550] - yyv3553.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41581,12 +51083,18 @@ func (x codecSelfer1234) decSliceLoadBalancerIngress(v *[]LoadBalancerIngress, d } } - yyh3550.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []LoadBalancerIngress{} + yyc1 = true + } } - if yyc3550 { - *v = yyv3550 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceServicePort(v []ServicePort, e *codec1978.Encoder) { @@ -41594,11 +51102,12 @@ func (x codecSelfer1234) encSliceServicePort(v []ServicePort, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3554 := range v { - yy3555 := &yyv3554 - yy3555.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceServicePort(v *[]ServicePort, d *codec1978.Decoder) { @@ -41606,75 +51115,86 @@ func (x codecSelfer1234) decSliceServicePort(v *[]ServicePort, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3556 := *v - yyh3556, yyl3556 := z.DecSliceHelperStart() - - var yyrr3556, yyrl3556 int - var yyc3556, yyrt3556 bool - _, _, _ = yyc3556, yyrt3556, yyrl3556 - yyrr3556 = yyl3556 - - if yyv3556 == nil { - if yyrl3556, yyrt3556 = z.DecInferLen(yyl3556, z.DecBasicHandle().MaxInitLen, 80); yyrt3556 { - yyrr3556 = yyrl3556 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ServicePort{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3556 = make([]ServicePort, yyrl3556) - yyc3556 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3556 == 0 { - if len(yyv3556) != 0 { - yyv3556 = yyv3556[:0] - yyc3556 = true - } - } else if yyl3556 > 0 { - - if yyl3556 > cap(yyv3556) { - yyrl3556, yyrt3556 = z.DecInferLen(yyl3556, z.DecBasicHandle().MaxInitLen, 80) - yyv3556 = make([]ServicePort, yyrl3556) - yyc3556 = true - - yyrr3556 = len(yyv3556) - } else if yyl3556 != len(yyv3556) { - yyv3556 = yyv3556[:yyl3556] - yyc3556 = true - } - yyj3556 := 0 - for ; yyj3556 < yyrr3556; yyj3556++ { - if r.TryDecodeAsNil() { - yyv3556[yyj3556] = ServicePort{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 80) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ServicePort, yyrl1) + } } else { - yyv3557 := &yyv3556[yyj3556] - yyv3557.CodecDecodeSelf(d) + yyv1 = make([]ServicePort, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ServicePort{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3556 { - for ; yyj3556 < yyl3556; yyj3556++ { - yyv3556 = append(yyv3556, ServicePort{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ServicePort{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3556[yyj3556] = ServicePort{} + yyv1[yyj1] = ServicePort{} } else { - yyv3558 := &yyv3556[yyj3556] - yyv3558.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3556 := 0; !r.CheckBreak(); yyj3556++ { - if yyj3556 >= len(yyv3556) { - yyv3556 = append(yyv3556, ServicePort{}) // var yyz3556 ServicePort - yyc3556 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3556 < len(yyv3556) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ServicePort{}) // var yyz1 ServicePort + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3556[yyj3556] = ServicePort{} + yyv1[yyj1] = ServicePort{} } else { - yyv3559 := &yyv3556[yyj3556] - yyv3559.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41682,12 +51202,18 @@ func (x codecSelfer1234) decSliceServicePort(v *[]ServicePort, d *codec1978.Deco } } - yyh3556.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ServicePort{} + yyc1 = true + } } - if yyc3556 { - *v = yyv3556 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceObjectReference(v []ObjectReference, e *codec1978.Encoder) { @@ -41695,11 +51221,12 @@ func (x codecSelfer1234) encSliceObjectReference(v []ObjectReference, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3560 := range v { - yy3561 := &yyv3560 - yy3561.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceObjectReference(v *[]ObjectReference, d *codec1978.Decoder) { @@ -41707,75 +51234,86 @@ func (x codecSelfer1234) decSliceObjectReference(v *[]ObjectReference, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3562 := *v - yyh3562, yyl3562 := z.DecSliceHelperStart() - - var yyrr3562, yyrl3562 int - var yyc3562, yyrt3562 bool - _, _, _ = yyc3562, yyrt3562, yyrl3562 - yyrr3562 = yyl3562 - - if yyv3562 == nil { - if yyrl3562, yyrt3562 = z.DecInferLen(yyl3562, z.DecBasicHandle().MaxInitLen, 112); yyrt3562 { - yyrr3562 = yyrl3562 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ObjectReference{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3562 = make([]ObjectReference, yyrl3562) - yyc3562 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3562 == 0 { - if len(yyv3562) != 0 { - yyv3562 = yyv3562[:0] - yyc3562 = true - } - } else if yyl3562 > 0 { - - if yyl3562 > cap(yyv3562) { - yyrl3562, yyrt3562 = z.DecInferLen(yyl3562, z.DecBasicHandle().MaxInitLen, 112) - yyv3562 = make([]ObjectReference, yyrl3562) - yyc3562 = true - - yyrr3562 = len(yyv3562) - } else if yyl3562 != len(yyv3562) { - yyv3562 = yyv3562[:yyl3562] - yyc3562 = true - } - yyj3562 := 0 - for ; yyj3562 < yyrr3562; yyj3562++ { - if r.TryDecodeAsNil() { - yyv3562[yyj3562] = ObjectReference{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 112) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ObjectReference, yyrl1) + } } else { - yyv3563 := &yyv3562[yyj3562] - yyv3563.CodecDecodeSelf(d) + yyv1 = make([]ObjectReference, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ObjectReference{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3562 { - for ; yyj3562 < yyl3562; yyj3562++ { - yyv3562 = append(yyv3562, ObjectReference{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ObjectReference{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3562[yyj3562] = ObjectReference{} + yyv1[yyj1] = ObjectReference{} } else { - yyv3564 := &yyv3562[yyj3562] - yyv3564.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3562 := 0; !r.CheckBreak(); yyj3562++ { - if yyj3562 >= len(yyv3562) { - yyv3562 = append(yyv3562, ObjectReference{}) // var yyz3562 ObjectReference - yyc3562 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3562 < len(yyv3562) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ObjectReference{}) // var yyz1 ObjectReference + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3562[yyj3562] = ObjectReference{} + yyv1[yyj1] = ObjectReference{} } else { - yyv3565 := &yyv3562[yyj3562] - yyv3565.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41783,12 +51321,18 @@ func (x codecSelfer1234) decSliceObjectReference(v *[]ObjectReference, d *codec1 } } - yyh3562.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ObjectReference{} + yyc1 = true + } } - if yyc3562 { - *v = yyv3562 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceServiceAccount(v []ServiceAccount, e *codec1978.Encoder) { @@ -41796,11 +51340,12 @@ func (x codecSelfer1234) encSliceServiceAccount(v []ServiceAccount, e *codec1978 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3566 := range v { - yy3567 := &yyv3566 - yy3567.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceServiceAccount(v *[]ServiceAccount, d *codec1978.Decoder) { @@ -41808,75 +51353,86 @@ func (x codecSelfer1234) decSliceServiceAccount(v *[]ServiceAccount, d *codec197 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3568 := *v - yyh3568, yyl3568 := z.DecSliceHelperStart() - - var yyrr3568, yyrl3568 int - var yyc3568, yyrt3568 bool - _, _, _ = yyc3568, yyrt3568, yyrl3568 - yyrr3568 = yyl3568 - - if yyv3568 == nil { - if yyrl3568, yyrt3568 = z.DecInferLen(yyl3568, z.DecBasicHandle().MaxInitLen, 240); yyrt3568 { - yyrr3568 = yyrl3568 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ServiceAccount{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3568 = make([]ServiceAccount, yyrl3568) - yyc3568 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3568 == 0 { - if len(yyv3568) != 0 { - yyv3568 = yyv3568[:0] - yyc3568 = true - } - } else if yyl3568 > 0 { - - if yyl3568 > cap(yyv3568) { - yyrl3568, yyrt3568 = z.DecInferLen(yyl3568, z.DecBasicHandle().MaxInitLen, 240) - yyv3568 = make([]ServiceAccount, yyrl3568) - yyc3568 = true - - yyrr3568 = len(yyv3568) - } else if yyl3568 != len(yyv3568) { - yyv3568 = yyv3568[:yyl3568] - yyc3568 = true - } - yyj3568 := 0 - for ; yyj3568 < yyrr3568; yyj3568++ { - if r.TryDecodeAsNil() { - yyv3568[yyj3568] = ServiceAccount{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 240) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ServiceAccount, yyrl1) + } } else { - yyv3569 := &yyv3568[yyj3568] - yyv3569.CodecDecodeSelf(d) + yyv1 = make([]ServiceAccount, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ServiceAccount{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3568 { - for ; yyj3568 < yyl3568; yyj3568++ { - yyv3568 = append(yyv3568, ServiceAccount{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ServiceAccount{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3568[yyj3568] = ServiceAccount{} + yyv1[yyj1] = ServiceAccount{} } else { - yyv3570 := &yyv3568[yyj3568] - yyv3570.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3568 := 0; !r.CheckBreak(); yyj3568++ { - if yyj3568 >= len(yyv3568) { - yyv3568 = append(yyv3568, ServiceAccount{}) // var yyz3568 ServiceAccount - yyc3568 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3568 < len(yyv3568) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ServiceAccount{}) // var yyz1 ServiceAccount + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3568[yyj3568] = ServiceAccount{} + yyv1[yyj1] = ServiceAccount{} } else { - yyv3571 := &yyv3568[yyj3568] - yyv3571.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41884,12 +51440,18 @@ func (x codecSelfer1234) decSliceServiceAccount(v *[]ServiceAccount, d *codec197 } } - yyh3568.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ServiceAccount{} + yyc1 = true + } } - if yyc3568 { - *v = yyv3568 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEndpointSubset(v []EndpointSubset, e *codec1978.Encoder) { @@ -41897,11 +51459,12 @@ func (x codecSelfer1234) encSliceEndpointSubset(v []EndpointSubset, e *codec1978 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3572 := range v { - yy3573 := &yyv3572 - yy3573.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEndpointSubset(v *[]EndpointSubset, d *codec1978.Decoder) { @@ -41909,75 +51472,86 @@ func (x codecSelfer1234) decSliceEndpointSubset(v *[]EndpointSubset, d *codec197 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3574 := *v - yyh3574, yyl3574 := z.DecSliceHelperStart() - - var yyrr3574, yyrl3574 int - var yyc3574, yyrt3574 bool - _, _, _ = yyc3574, yyrt3574, yyrl3574 - yyrr3574 = yyl3574 - - if yyv3574 == nil { - if yyrl3574, yyrt3574 = z.DecInferLen(yyl3574, z.DecBasicHandle().MaxInitLen, 72); yyrt3574 { - yyrr3574 = yyrl3574 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []EndpointSubset{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3574 = make([]EndpointSubset, yyrl3574) - yyc3574 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3574 == 0 { - if len(yyv3574) != 0 { - yyv3574 = yyv3574[:0] - yyc3574 = true - } - } else if yyl3574 > 0 { - - if yyl3574 > cap(yyv3574) { - yyrl3574, yyrt3574 = z.DecInferLen(yyl3574, z.DecBasicHandle().MaxInitLen, 72) - yyv3574 = make([]EndpointSubset, yyrl3574) - yyc3574 = true - - yyrr3574 = len(yyv3574) - } else if yyl3574 != len(yyv3574) { - yyv3574 = yyv3574[:yyl3574] - yyc3574 = true - } - yyj3574 := 0 - for ; yyj3574 < yyrr3574; yyj3574++ { - if r.TryDecodeAsNil() { - yyv3574[yyj3574] = EndpointSubset{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 72) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]EndpointSubset, yyrl1) + } } else { - yyv3575 := &yyv3574[yyj3574] - yyv3575.CodecDecodeSelf(d) + yyv1 = make([]EndpointSubset, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = EndpointSubset{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3574 { - for ; yyj3574 < yyl3574; yyj3574++ { - yyv3574 = append(yyv3574, EndpointSubset{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, EndpointSubset{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3574[yyj3574] = EndpointSubset{} + yyv1[yyj1] = EndpointSubset{} } else { - yyv3576 := &yyv3574[yyj3574] - yyv3576.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3574 := 0; !r.CheckBreak(); yyj3574++ { - if yyj3574 >= len(yyv3574) { - yyv3574 = append(yyv3574, EndpointSubset{}) // var yyz3574 EndpointSubset - yyc3574 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3574 < len(yyv3574) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, EndpointSubset{}) // var yyz1 EndpointSubset + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3574[yyj3574] = EndpointSubset{} + yyv1[yyj1] = EndpointSubset{} } else { - yyv3577 := &yyv3574[yyj3574] - yyv3577.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41985,12 +51559,18 @@ func (x codecSelfer1234) decSliceEndpointSubset(v *[]EndpointSubset, d *codec197 } } - yyh3574.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []EndpointSubset{} + yyc1 = true + } } - if yyc3574 { - *v = yyv3574 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEndpointAddress(v []EndpointAddress, e *codec1978.Encoder) { @@ -41998,11 +51578,12 @@ func (x codecSelfer1234) encSliceEndpointAddress(v []EndpointAddress, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3578 := range v { - yy3579 := &yyv3578 - yy3579.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEndpointAddress(v *[]EndpointAddress, d *codec1978.Decoder) { @@ -42010,75 +51591,86 @@ func (x codecSelfer1234) decSliceEndpointAddress(v *[]EndpointAddress, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3580 := *v - yyh3580, yyl3580 := z.DecSliceHelperStart() - - var yyrr3580, yyrl3580 int - var yyc3580, yyrt3580 bool - _, _, _ = yyc3580, yyrt3580, yyrl3580 - yyrr3580 = yyl3580 - - if yyv3580 == nil { - if yyrl3580, yyrt3580 = z.DecInferLen(yyl3580, z.DecBasicHandle().MaxInitLen, 24); yyrt3580 { - yyrr3580 = yyrl3580 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []EndpointAddress{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3580 = make([]EndpointAddress, yyrl3580) - yyc3580 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3580 == 0 { - if len(yyv3580) != 0 { - yyv3580 = yyv3580[:0] - yyc3580 = true - } - } else if yyl3580 > 0 { - - if yyl3580 > cap(yyv3580) { - yyrl3580, yyrt3580 = z.DecInferLen(yyl3580, z.DecBasicHandle().MaxInitLen, 24) - yyv3580 = make([]EndpointAddress, yyrl3580) - yyc3580 = true - - yyrr3580 = len(yyv3580) - } else if yyl3580 != len(yyv3580) { - yyv3580 = yyv3580[:yyl3580] - yyc3580 = true - } - yyj3580 := 0 - for ; yyj3580 < yyrr3580; yyj3580++ { - if r.TryDecodeAsNil() { - yyv3580[yyj3580] = EndpointAddress{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]EndpointAddress, yyrl1) + } } else { - yyv3581 := &yyv3580[yyj3580] - yyv3581.CodecDecodeSelf(d) + yyv1 = make([]EndpointAddress, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = EndpointAddress{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3580 { - for ; yyj3580 < yyl3580; yyj3580++ { - yyv3580 = append(yyv3580, EndpointAddress{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, EndpointAddress{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3580[yyj3580] = EndpointAddress{} + yyv1[yyj1] = EndpointAddress{} } else { - yyv3582 := &yyv3580[yyj3580] - yyv3582.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3580 := 0; !r.CheckBreak(); yyj3580++ { - if yyj3580 >= len(yyv3580) { - yyv3580 = append(yyv3580, EndpointAddress{}) // var yyz3580 EndpointAddress - yyc3580 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3580 < len(yyv3580) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, EndpointAddress{}) // var yyz1 EndpointAddress + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3580[yyj3580] = EndpointAddress{} + yyv1[yyj1] = EndpointAddress{} } else { - yyv3583 := &yyv3580[yyj3580] - yyv3583.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42086,12 +51678,18 @@ func (x codecSelfer1234) decSliceEndpointAddress(v *[]EndpointAddress, d *codec1 } } - yyh3580.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []EndpointAddress{} + yyc1 = true + } } - if yyc3580 { - *v = yyv3580 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEndpointPort(v []EndpointPort, e *codec1978.Encoder) { @@ -42099,11 +51697,12 @@ func (x codecSelfer1234) encSliceEndpointPort(v []EndpointPort, e *codec1978.Enc z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3584 := range v { - yy3585 := &yyv3584 - yy3585.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEndpointPort(v *[]EndpointPort, d *codec1978.Decoder) { @@ -42111,75 +51710,86 @@ func (x codecSelfer1234) decSliceEndpointPort(v *[]EndpointPort, d *codec1978.De z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3586 := *v - yyh3586, yyl3586 := z.DecSliceHelperStart() - - var yyrr3586, yyrl3586 int - var yyc3586, yyrt3586 bool - _, _, _ = yyc3586, yyrt3586, yyrl3586 - yyrr3586 = yyl3586 - - if yyv3586 == nil { - if yyrl3586, yyrt3586 = z.DecInferLen(yyl3586, z.DecBasicHandle().MaxInitLen, 40); yyrt3586 { - yyrr3586 = yyrl3586 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []EndpointPort{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3586 = make([]EndpointPort, yyrl3586) - yyc3586 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3586 == 0 { - if len(yyv3586) != 0 { - yyv3586 = yyv3586[:0] - yyc3586 = true - } - } else if yyl3586 > 0 { - - if yyl3586 > cap(yyv3586) { - yyrl3586, yyrt3586 = z.DecInferLen(yyl3586, z.DecBasicHandle().MaxInitLen, 40) - yyv3586 = make([]EndpointPort, yyrl3586) - yyc3586 = true - - yyrr3586 = len(yyv3586) - } else if yyl3586 != len(yyv3586) { - yyv3586 = yyv3586[:yyl3586] - yyc3586 = true - } - yyj3586 := 0 - for ; yyj3586 < yyrr3586; yyj3586++ { - if r.TryDecodeAsNil() { - yyv3586[yyj3586] = EndpointPort{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]EndpointPort, yyrl1) + } } else { - yyv3587 := &yyv3586[yyj3586] - yyv3587.CodecDecodeSelf(d) + yyv1 = make([]EndpointPort, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = EndpointPort{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3586 { - for ; yyj3586 < yyl3586; yyj3586++ { - yyv3586 = append(yyv3586, EndpointPort{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, EndpointPort{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3586[yyj3586] = EndpointPort{} + yyv1[yyj1] = EndpointPort{} } else { - yyv3588 := &yyv3586[yyj3586] - yyv3588.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3586 := 0; !r.CheckBreak(); yyj3586++ { - if yyj3586 >= len(yyv3586) { - yyv3586 = append(yyv3586, EndpointPort{}) // var yyz3586 EndpointPort - yyc3586 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3586 < len(yyv3586) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, EndpointPort{}) // var yyz1 EndpointPort + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3586[yyj3586] = EndpointPort{} + yyv1[yyj1] = EndpointPort{} } else { - yyv3589 := &yyv3586[yyj3586] - yyv3589.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42187,12 +51797,18 @@ func (x codecSelfer1234) decSliceEndpointPort(v *[]EndpointPort, d *codec1978.De } } - yyh3586.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []EndpointPort{} + yyc1 = true + } } - if yyc3586 { - *v = yyv3586 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEndpoints(v []Endpoints, e *codec1978.Encoder) { @@ -42200,11 +51816,12 @@ func (x codecSelfer1234) encSliceEndpoints(v []Endpoints, e *codec1978.Encoder) z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3590 := range v { - yy3591 := &yyv3590 - yy3591.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEndpoints(v *[]Endpoints, d *codec1978.Decoder) { @@ -42212,75 +51829,86 @@ func (x codecSelfer1234) decSliceEndpoints(v *[]Endpoints, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3592 := *v - yyh3592, yyl3592 := z.DecSliceHelperStart() - - var yyrr3592, yyrl3592 int - var yyc3592, yyrt3592 bool - _, _, _ = yyc3592, yyrt3592, yyrl3592 - yyrr3592 = yyl3592 - - if yyv3592 == nil { - if yyrl3592, yyrt3592 = z.DecInferLen(yyl3592, z.DecBasicHandle().MaxInitLen, 216); yyrt3592 { - yyrr3592 = yyrl3592 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Endpoints{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3592 = make([]Endpoints, yyrl3592) - yyc3592 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3592 == 0 { - if len(yyv3592) != 0 { - yyv3592 = yyv3592[:0] - yyc3592 = true - } - } else if yyl3592 > 0 { - - if yyl3592 > cap(yyv3592) { - yyrl3592, yyrt3592 = z.DecInferLen(yyl3592, z.DecBasicHandle().MaxInitLen, 216) - yyv3592 = make([]Endpoints, yyrl3592) - yyc3592 = true - - yyrr3592 = len(yyv3592) - } else if yyl3592 != len(yyv3592) { - yyv3592 = yyv3592[:yyl3592] - yyc3592 = true - } - yyj3592 := 0 - for ; yyj3592 < yyrr3592; yyj3592++ { - if r.TryDecodeAsNil() { - yyv3592[yyj3592] = Endpoints{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Endpoints, yyrl1) + } } else { - yyv3593 := &yyv3592[yyj3592] - yyv3593.CodecDecodeSelf(d) + yyv1 = make([]Endpoints, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Endpoints{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3592 { - for ; yyj3592 < yyl3592; yyj3592++ { - yyv3592 = append(yyv3592, Endpoints{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Endpoints{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3592[yyj3592] = Endpoints{} + yyv1[yyj1] = Endpoints{} } else { - yyv3594 := &yyv3592[yyj3592] - yyv3594.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3592 := 0; !r.CheckBreak(); yyj3592++ { - if yyj3592 >= len(yyv3592) { - yyv3592 = append(yyv3592, Endpoints{}) // var yyz3592 Endpoints - yyc3592 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3592 < len(yyv3592) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Endpoints{}) // var yyz1 Endpoints + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3592[yyj3592] = Endpoints{} + yyv1[yyj1] = Endpoints{} } else { - yyv3595 := &yyv3592[yyj3592] - yyv3595.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42288,12 +51916,18 @@ func (x codecSelfer1234) decSliceEndpoints(v *[]Endpoints, d *codec1978.Decoder) } } - yyh3592.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Endpoints{} + yyc1 = true + } } - if yyc3592 { - *v = yyv3592 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceNodeCondition(v []NodeCondition, e *codec1978.Encoder) { @@ -42301,11 +51935,12 @@ func (x codecSelfer1234) encSliceNodeCondition(v []NodeCondition, e *codec1978.E z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3596 := range v { - yy3597 := &yyv3596 - yy3597.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNodeCondition(v *[]NodeCondition, d *codec1978.Decoder) { @@ -42313,75 +51948,86 @@ func (x codecSelfer1234) decSliceNodeCondition(v *[]NodeCondition, d *codec1978. z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3598 := *v - yyh3598, yyl3598 := z.DecSliceHelperStart() - - var yyrr3598, yyrl3598 int - var yyc3598, yyrt3598 bool - _, _, _ = yyc3598, yyrt3598, yyrl3598 - yyrr3598 = yyl3598 - - if yyv3598 == nil { - if yyrl3598, yyrt3598 = z.DecInferLen(yyl3598, z.DecBasicHandle().MaxInitLen, 112); yyrt3598 { - yyrr3598 = yyrl3598 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeCondition{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3598 = make([]NodeCondition, yyrl3598) - yyc3598 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3598 == 0 { - if len(yyv3598) != 0 { - yyv3598 = yyv3598[:0] - yyc3598 = true - } - } else if yyl3598 > 0 { - - if yyl3598 > cap(yyv3598) { - yyrl3598, yyrt3598 = z.DecInferLen(yyl3598, z.DecBasicHandle().MaxInitLen, 112) - yyv3598 = make([]NodeCondition, yyrl3598) - yyc3598 = true - - yyrr3598 = len(yyv3598) - } else if yyl3598 != len(yyv3598) { - yyv3598 = yyv3598[:yyl3598] - yyc3598 = true - } - yyj3598 := 0 - for ; yyj3598 < yyrr3598; yyj3598++ { - if r.TryDecodeAsNil() { - yyv3598[yyj3598] = NodeCondition{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 112) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeCondition, yyrl1) + } } else { - yyv3599 := &yyv3598[yyj3598] - yyv3599.CodecDecodeSelf(d) + yyv1 = make([]NodeCondition, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeCondition{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3598 { - for ; yyj3598 < yyl3598; yyj3598++ { - yyv3598 = append(yyv3598, NodeCondition{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeCondition{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3598[yyj3598] = NodeCondition{} + yyv1[yyj1] = NodeCondition{} } else { - yyv3600 := &yyv3598[yyj3598] - yyv3600.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3598 := 0; !r.CheckBreak(); yyj3598++ { - if yyj3598 >= len(yyv3598) { - yyv3598 = append(yyv3598, NodeCondition{}) // var yyz3598 NodeCondition - yyc3598 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3598 < len(yyv3598) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeCondition{}) // var yyz1 NodeCondition + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3598[yyj3598] = NodeCondition{} + yyv1[yyj1] = NodeCondition{} } else { - yyv3601 := &yyv3598[yyj3598] - yyv3601.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42389,12 +52035,18 @@ func (x codecSelfer1234) decSliceNodeCondition(v *[]NodeCondition, d *codec1978. } } - yyh3598.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeCondition{} + yyc1 = true + } } - if yyc3598 { - *v = yyv3598 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceNodeAddress(v []NodeAddress, e *codec1978.Encoder) { @@ -42402,11 +52054,12 @@ func (x codecSelfer1234) encSliceNodeAddress(v []NodeAddress, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3602 := range v { - yy3603 := &yyv3602 - yy3603.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNodeAddress(v *[]NodeAddress, d *codec1978.Decoder) { @@ -42414,75 +52067,86 @@ func (x codecSelfer1234) decSliceNodeAddress(v *[]NodeAddress, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3604 := *v - yyh3604, yyl3604 := z.DecSliceHelperStart() - - var yyrr3604, yyrl3604 int - var yyc3604, yyrt3604 bool - _, _, _ = yyc3604, yyrt3604, yyrl3604 - yyrr3604 = yyl3604 - - if yyv3604 == nil { - if yyrl3604, yyrt3604 = z.DecInferLen(yyl3604, z.DecBasicHandle().MaxInitLen, 32); yyrt3604 { - yyrr3604 = yyrl3604 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeAddress{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3604 = make([]NodeAddress, yyrl3604) - yyc3604 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3604 == 0 { - if len(yyv3604) != 0 { - yyv3604 = yyv3604[:0] - yyc3604 = true - } - } else if yyl3604 > 0 { - - if yyl3604 > cap(yyv3604) { - yyrl3604, yyrt3604 = z.DecInferLen(yyl3604, z.DecBasicHandle().MaxInitLen, 32) - yyv3604 = make([]NodeAddress, yyrl3604) - yyc3604 = true - - yyrr3604 = len(yyv3604) - } else if yyl3604 != len(yyv3604) { - yyv3604 = yyv3604[:yyl3604] - yyc3604 = true - } - yyj3604 := 0 - for ; yyj3604 < yyrr3604; yyj3604++ { - if r.TryDecodeAsNil() { - yyv3604[yyj3604] = NodeAddress{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeAddress, yyrl1) + } } else { - yyv3605 := &yyv3604[yyj3604] - yyv3605.CodecDecodeSelf(d) + yyv1 = make([]NodeAddress, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeAddress{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3604 { - for ; yyj3604 < yyl3604; yyj3604++ { - yyv3604 = append(yyv3604, NodeAddress{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeAddress{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3604[yyj3604] = NodeAddress{} + yyv1[yyj1] = NodeAddress{} } else { - yyv3606 := &yyv3604[yyj3604] - yyv3606.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3604 := 0; !r.CheckBreak(); yyj3604++ { - if yyj3604 >= len(yyv3604) { - yyv3604 = append(yyv3604, NodeAddress{}) // var yyz3604 NodeAddress - yyc3604 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3604 < len(yyv3604) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeAddress{}) // var yyz1 NodeAddress + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3604[yyj3604] = NodeAddress{} + yyv1[yyj1] = NodeAddress{} } else { - yyv3607 := &yyv3604[yyj3604] - yyv3607.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42490,12 +52154,137 @@ func (x codecSelfer1234) decSliceNodeAddress(v *[]NodeAddress, d *codec1978.Deco } } - yyh3604.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeAddress{} + yyc1 = true + } } - if yyc3604 { - *v = yyv3604 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceContainerImage(v []ContainerImage, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceContainerImage(v *[]ContainerImage, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ContainerImage{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ContainerImage, yyrl1) + } + } else { + yyv1 = make([]ContainerImage, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerImage{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ContainerImage{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerImage{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ContainerImage{}) // var yyz1 ContainerImage + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerImage{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ContainerImage{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encResourceList(v ResourceList, e *codec1978.Encoder) { @@ -42503,20 +52292,22 @@ func (x codecSelfer1234) encResourceList(v ResourceList, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeMapStart(len(v)) - for yyk3608, yyv3608 := range v { - yyk3608.CodecEncodeSelf(e) - yy3609 := &yyv3608 - yym3610 := z.EncBinary() - _ = yym3610 + for yyk1, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + yyk1.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy3 := &yyv1 + yym4 := z.EncBinary() + _ = yym4 if false { - } else if z.HasExtensions() && z.EncExt(yy3609) { - } else if !yym3610 && z.IsJSONHandle() { - z.EncJSONMarshal(yy3609) + } else if z.HasExtensions() && z.EncExt(yy3) { + } else if !yym4 && z.IsJSONHandle() { + z.EncJSONMarshal(yy3) } else { - z.EncFallback(yy3609) + z.EncFallback(yy3) } } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } func (x codecSelfer1234) decResourceList(v *ResourceList, d *codec1978.Decoder) { @@ -42524,86 +52315,90 @@ func (x codecSelfer1234) decResourceList(v *ResourceList, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3611 := *v - yyl3611 := r.ReadMapStart() - yybh3611 := z.DecBasicHandle() - if yyv3611 == nil { - yyrl3611, _ := z.DecInferLen(yyl3611, yybh3611.MaxInitLen, 40) - yyv3611 = make(map[ResourceName]pkg3_resource.Quantity, yyrl3611) - *v = yyv3611 + yyv1 := *v + yyl1 := r.ReadMapStart() + yybh1 := z.DecBasicHandle() + if yyv1 == nil { + yyrl1, _ := z.DecInferLen(yyl1, yybh1.MaxInitLen, 40) + yyv1 = make(map[ResourceName]pkg3_resource.Quantity, yyrl1) + *v = yyv1 } - var yymk3611 ResourceName - var yymv3611 pkg3_resource.Quantity - var yymg3611 bool - if yybh3611.MapValueReset { - yymg3611 = true + var yymk1 ResourceName + var yymv1 pkg3_resource.Quantity + var yymg1 bool + if yybh1.MapValueReset { + yymg1 = true } - if yyl3611 > 0 { - for yyj3611 := 0; yyj3611 < yyl3611; yyj3611++ { + if yyl1 > 0 { + for yyj1 := 0; yyj1 < yyl1; yyj1++ { + z.DecSendContainerState(codecSelfer_containerMapKey1234) if r.TryDecodeAsNil() { - yymk3611 = "" + yymk1 = "" } else { - yymk3611 = ResourceName(r.DecodeString()) + yymk1 = ResourceName(r.DecodeString()) } - if yymg3611 { - yymv3611 = yyv3611[yymk3611] + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yymv3611 = pkg3_resource.Quantity{} + yymv1 = pkg3_resource.Quantity{} } + z.DecSendContainerState(codecSelfer_containerMapValue1234) if r.TryDecodeAsNil() { - yymv3611 = pkg3_resource.Quantity{} + yymv1 = pkg3_resource.Quantity{} } else { - yyv3613 := &yymv3611 - yym3614 := z.DecBinary() - _ = yym3614 + yyv3 := &yymv1 + yym4 := z.DecBinary() + _ = yym4 if false { - } else if z.HasExtensions() && z.DecExt(yyv3613) { - } else if !yym3614 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv3613) + } else if z.HasExtensions() && z.DecExt(yyv3) { + } else if !yym4 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv3) } else { - z.DecFallback(yyv3613, false) + z.DecFallback(yyv3, false) } } - if yyv3611 != nil { - yyv3611[yymk3611] = yymv3611 + if yyv1 != nil { + yyv1[yymk1] = yymv1 } } - } else if yyl3611 < 0 { - for yyj3611 := 0; !r.CheckBreak(); yyj3611++ { + } else if yyl1 < 0 { + for yyj1 := 0; !r.CheckBreak(); yyj1++ { + z.DecSendContainerState(codecSelfer_containerMapKey1234) if r.TryDecodeAsNil() { - yymk3611 = "" + yymk1 = "" } else { - yymk3611 = ResourceName(r.DecodeString()) + yymk1 = ResourceName(r.DecodeString()) } - if yymg3611 { - yymv3611 = yyv3611[yymk3611] + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yymv3611 = pkg3_resource.Quantity{} + yymv1 = pkg3_resource.Quantity{} } + z.DecSendContainerState(codecSelfer_containerMapValue1234) if r.TryDecodeAsNil() { - yymv3611 = pkg3_resource.Quantity{} + yymv1 = pkg3_resource.Quantity{} } else { - yyv3616 := &yymv3611 - yym3617 := z.DecBinary() - _ = yym3617 + yyv6 := &yymv1 + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv3616) { - } else if !yym3617 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv3616) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv3616, false) + z.DecFallback(yyv6, false) } } - if yyv3611 != nil { - yyv3611[yymk3611] = yymv3611 + if yyv1 != nil { + yyv1[yymk1] = yymv1 } } - r.ReadEnd() } // else len==0: TODO: Should we clear map entries? + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x codecSelfer1234) encSliceNode(v []Node, e *codec1978.Encoder) { @@ -42611,11 +52406,12 @@ func (x codecSelfer1234) encSliceNode(v []Node, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3618 := range v { - yy3619 := &yyv3618 - yy3619.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNode(v *[]Node, d *codec1978.Decoder) { @@ -42623,75 +52419,86 @@ func (x codecSelfer1234) decSliceNode(v *[]Node, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3620 := *v - yyh3620, yyl3620 := z.DecSliceHelperStart() - - var yyrr3620, yyrl3620 int - var yyc3620, yyrt3620 bool - _, _, _ = yyc3620, yyrt3620, yyrl3620 - yyrr3620 = yyl3620 - - if yyv3620 == nil { - if yyrl3620, yyrt3620 = z.DecInferLen(yyl3620, z.DecBasicHandle().MaxInitLen, 456); yyrt3620 { - yyrr3620 = yyrl3620 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Node{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3620 = make([]Node, yyrl3620) - yyc3620 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3620 == 0 { - if len(yyv3620) != 0 { - yyv3620 = yyv3620[:0] - yyc3620 = true - } - } else if yyl3620 > 0 { - - if yyl3620 > cap(yyv3620) { - yyrl3620, yyrt3620 = z.DecInferLen(yyl3620, z.DecBasicHandle().MaxInitLen, 456) - yyv3620 = make([]Node, yyrl3620) - yyc3620 = true - - yyrr3620 = len(yyv3620) - } else if yyl3620 != len(yyv3620) { - yyv3620 = yyv3620[:yyl3620] - yyc3620 = true - } - yyj3620 := 0 - for ; yyj3620 < yyrr3620; yyj3620++ { - if r.TryDecodeAsNil() { - yyv3620[yyj3620] = Node{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 488) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Node, yyrl1) + } } else { - yyv3621 := &yyv3620[yyj3620] - yyv3621.CodecDecodeSelf(d) + yyv1 = make([]Node, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Node{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3620 { - for ; yyj3620 < yyl3620; yyj3620++ { - yyv3620 = append(yyv3620, Node{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Node{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3620[yyj3620] = Node{} + yyv1[yyj1] = Node{} } else { - yyv3622 := &yyv3620[yyj3620] - yyv3622.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3620 := 0; !r.CheckBreak(); yyj3620++ { - if yyj3620 >= len(yyv3620) { - yyv3620 = append(yyv3620, Node{}) // var yyz3620 Node - yyc3620 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3620 < len(yyv3620) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Node{}) // var yyz1 Node + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3620[yyj3620] = Node{} + yyv1[yyj1] = Node{} } else { - yyv3623 := &yyv3620[yyj3620] - yyv3623.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42699,12 +52506,18 @@ func (x codecSelfer1234) decSliceNode(v *[]Node, d *codec1978.Decoder) { } } - yyh3620.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Node{} + yyc1 = true + } } - if yyc3620 { - *v = yyv3620 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceFinalizerName(v []FinalizerName, e *codec1978.Encoder) { @@ -42712,10 +52525,11 @@ func (x codecSelfer1234) encSliceFinalizerName(v []FinalizerName, e *codec1978.E z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3624 := range v { - yyv3624.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yyv1.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceFinalizerName(v *[]FinalizerName, d *codec1978.Decoder) { @@ -42723,77 +52537,78 @@ func (x codecSelfer1234) decSliceFinalizerName(v *[]FinalizerName, d *codec1978. z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3625 := *v - yyh3625, yyl3625 := z.DecSliceHelperStart() - - var yyrr3625, yyrl3625 int - var yyc3625, yyrt3625 bool - _, _, _ = yyc3625, yyrt3625, yyrl3625 - yyrr3625 = yyl3625 - - if yyv3625 == nil { - if yyrl3625, yyrt3625 = z.DecInferLen(yyl3625, z.DecBasicHandle().MaxInitLen, 16); yyrt3625 { - yyrr3625 = yyrl3625 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []FinalizerName{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3625 = make([]FinalizerName, yyrl3625) - yyc3625 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3625 == 0 { - if len(yyv3625) != 0 { - yyv3625 = yyv3625[:0] - yyc3625 = true - } - } else if yyl3625 > 0 { - - if yyl3625 > cap(yyv3625) { - yyrl3625, yyrt3625 = z.DecInferLen(yyl3625, z.DecBasicHandle().MaxInitLen, 16) - - yyv23625 := yyv3625 - yyv3625 = make([]FinalizerName, yyrl3625) - if len(yyv3625) > 0 { - copy(yyv3625, yyv23625[:cap(yyv23625)]) - } - yyc3625 = true - - yyrr3625 = len(yyv3625) - } else if yyl3625 != len(yyv3625) { - yyv3625 = yyv3625[:yyl3625] - yyc3625 = true - } - yyj3625 := 0 - for ; yyj3625 < yyrr3625; yyj3625++ { - if r.TryDecodeAsNil() { - yyv3625[yyj3625] = "" - } else { - yyv3625[yyj3625] = FinalizerName(r.DecodeString()) - } - - } - if yyrt3625 { - for ; yyj3625 < yyl3625; yyj3625++ { - yyv3625 = append(yyv3625, "") - if r.TryDecodeAsNil() { - yyv3625[yyj3625] = "" + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] } else { - yyv3625[yyj3625] = FinalizerName(r.DecodeString()) + yyv1 = make([]FinalizerName, yyrl1) + } + } else { + yyv1 = make([]FinalizerName, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FinalizerName(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FinalizerName(r.DecodeString()) } } } } else { - for yyj3625 := 0; !r.CheckBreak(); yyj3625++ { - if yyj3625 >= len(yyv3625) { - yyv3625 = append(yyv3625, "") // var yyz3625 FinalizerName - yyc3625 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3625 < len(yyv3625) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 FinalizerName + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3625[yyj3625] = "" + yyv1[yyj1] = "" } else { - yyv3625[yyj3625] = FinalizerName(r.DecodeString()) + yyv1[yyj1] = FinalizerName(r.DecodeString()) } } else { @@ -42801,12 +52616,18 @@ func (x codecSelfer1234) decSliceFinalizerName(v *[]FinalizerName, d *codec1978. } } - yyh3625.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []FinalizerName{} + yyc1 = true + } } - if yyc3625 { - *v = yyv3625 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceNamespace(v []Namespace, e *codec1978.Encoder) { @@ -42814,11 +52635,12 @@ func (x codecSelfer1234) encSliceNamespace(v []Namespace, e *codec1978.Encoder) z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3629 := range v { - yy3630 := &yyv3629 - yy3630.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNamespace(v *[]Namespace, d *codec1978.Decoder) { @@ -42826,75 +52648,86 @@ func (x codecSelfer1234) decSliceNamespace(v *[]Namespace, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3631 := *v - yyh3631, yyl3631 := z.DecSliceHelperStart() - - var yyrr3631, yyrl3631 int - var yyc3631, yyrt3631 bool - _, _, _ = yyc3631, yyrt3631, yyrl3631 - yyrr3631 = yyl3631 - - if yyv3631 == nil { - if yyrl3631, yyrt3631 = z.DecInferLen(yyl3631, z.DecBasicHandle().MaxInitLen, 232); yyrt3631 { - yyrr3631 = yyrl3631 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Namespace{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3631 = make([]Namespace, yyrl3631) - yyc3631 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3631 == 0 { - if len(yyv3631) != 0 { - yyv3631 = yyv3631[:0] - yyc3631 = true - } - } else if yyl3631 > 0 { - - if yyl3631 > cap(yyv3631) { - yyrl3631, yyrt3631 = z.DecInferLen(yyl3631, z.DecBasicHandle().MaxInitLen, 232) - yyv3631 = make([]Namespace, yyrl3631) - yyc3631 = true - - yyrr3631 = len(yyv3631) - } else if yyl3631 != len(yyv3631) { - yyv3631 = yyv3631[:yyl3631] - yyc3631 = true - } - yyj3631 := 0 - for ; yyj3631 < yyrr3631; yyj3631++ { - if r.TryDecodeAsNil() { - yyv3631[yyj3631] = Namespace{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 232) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Namespace, yyrl1) + } } else { - yyv3632 := &yyv3631[yyj3631] - yyv3632.CodecDecodeSelf(d) + yyv1 = make([]Namespace, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Namespace{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3631 { - for ; yyj3631 < yyl3631; yyj3631++ { - yyv3631 = append(yyv3631, Namespace{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Namespace{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3631[yyj3631] = Namespace{} + yyv1[yyj1] = Namespace{} } else { - yyv3633 := &yyv3631[yyj3631] - yyv3633.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3631 := 0; !r.CheckBreak(); yyj3631++ { - if yyj3631 >= len(yyv3631) { - yyv3631 = append(yyv3631, Namespace{}) // var yyz3631 Namespace - yyc3631 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3631 < len(yyv3631) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Namespace{}) // var yyz1 Namespace + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3631[yyj3631] = Namespace{} + yyv1[yyj1] = Namespace{} } else { - yyv3634 := &yyv3631[yyj3631] - yyv3634.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42902,12 +52735,18 @@ func (x codecSelfer1234) decSliceNamespace(v *[]Namespace, d *codec1978.Decoder) } } - yyh3631.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Namespace{} + yyc1 = true + } } - if yyc3631 { - *v = yyv3631 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEvent(v []Event, e *codec1978.Encoder) { @@ -42915,11 +52754,12 @@ func (x codecSelfer1234) encSliceEvent(v []Event, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3635 := range v { - yy3636 := &yyv3635 - yy3636.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEvent(v *[]Event, d *codec1978.Decoder) { @@ -42927,75 +52767,86 @@ func (x codecSelfer1234) decSliceEvent(v *[]Event, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3637 := *v - yyh3637, yyl3637 := z.DecSliceHelperStart() - - var yyrr3637, yyrl3637 int - var yyc3637, yyrt3637 bool - _, _, _ = yyc3637, yyrt3637, yyrl3637 - yyrr3637 = yyl3637 - - if yyv3637 == nil { - if yyrl3637, yyrt3637 = z.DecInferLen(yyl3637, z.DecBasicHandle().MaxInitLen, 424); yyrt3637 { - yyrr3637 = yyrl3637 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Event{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3637 = make([]Event, yyrl3637) - yyc3637 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3637 == 0 { - if len(yyv3637) != 0 { - yyv3637 = yyv3637[:0] - yyc3637 = true - } - } else if yyl3637 > 0 { - - if yyl3637 > cap(yyv3637) { - yyrl3637, yyrt3637 = z.DecInferLen(yyl3637, z.DecBasicHandle().MaxInitLen, 424) - yyv3637 = make([]Event, yyrl3637) - yyc3637 = true - - yyrr3637 = len(yyv3637) - } else if yyl3637 != len(yyv3637) { - yyv3637 = yyv3637[:yyl3637] - yyc3637 = true - } - yyj3637 := 0 - for ; yyj3637 < yyrr3637; yyj3637++ { - if r.TryDecodeAsNil() { - yyv3637[yyj3637] = Event{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 440) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Event, yyrl1) + } } else { - yyv3638 := &yyv3637[yyj3637] - yyv3638.CodecDecodeSelf(d) + yyv1 = make([]Event, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Event{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3637 { - for ; yyj3637 < yyl3637; yyj3637++ { - yyv3637 = append(yyv3637, Event{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Event{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3637[yyj3637] = Event{} + yyv1[yyj1] = Event{} } else { - yyv3639 := &yyv3637[yyj3637] - yyv3639.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3637 := 0; !r.CheckBreak(); yyj3637++ { - if yyj3637 >= len(yyv3637) { - yyv3637 = append(yyv3637, Event{}) // var yyz3637 Event - yyc3637 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3637 < len(yyv3637) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Event{}) // var yyz1 Event + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3637[yyj3637] = Event{} + yyv1[yyj1] = Event{} } else { - yyv3640 := &yyv3637[yyj3637] - yyv3640.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43003,12 +52854,18 @@ func (x codecSelfer1234) decSliceEvent(v *[]Event, d *codec1978.Decoder) { } } - yyh3637.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Event{} + yyc1 = true + } } - if yyc3637 { - *v = yyv3637 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceruntime_Object(v []pkg8_runtime.Object, e *codec1978.Encoder) { @@ -43016,20 +52873,21 @@ func (x codecSelfer1234) encSliceruntime_Object(v []pkg8_runtime.Object, e *code z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3641 := range v { - if yyv3641 == nil { + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyv1 == nil { r.EncodeNil() } else { - yym3642 := z.EncBinary() - _ = yym3642 + yym2 := z.EncBinary() + _ = yym2 if false { - } else if z.HasExtensions() && z.EncExt(yyv3641) { + } else if z.HasExtensions() && z.EncExt(yyv1) { } else { - z.EncFallback(yyv3641) + z.EncFallback(yyv1) } } } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceruntime_Object(v *[]pkg8_runtime.Object, d *codec1978.Decoder) { @@ -43037,68 +52895,77 @@ func (x codecSelfer1234) decSliceruntime_Object(v *[]pkg8_runtime.Object, d *cod z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3643 := *v - yyh3643, yyl3643 := z.DecSliceHelperStart() - - var yyrr3643, yyrl3643 int - var yyc3643, yyrt3643 bool - _, _, _ = yyc3643, yyrt3643, yyrl3643 - yyrr3643 = yyl3643 - - if yyv3643 == nil { - if yyrl3643, yyrt3643 = z.DecInferLen(yyl3643, z.DecBasicHandle().MaxInitLen, 16); yyrt3643 { - yyrr3643 = yyrl3643 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []pkg8_runtime.Object{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3643 = make([]pkg8_runtime.Object, yyrl3643) - yyc3643 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3643 == 0 { - if len(yyv3643) != 0 { - yyv3643 = yyv3643[:0] - yyc3643 = true - } - } else if yyl3643 > 0 { - - if yyl3643 > cap(yyv3643) { - yyrl3643, yyrt3643 = z.DecInferLen(yyl3643, z.DecBasicHandle().MaxInitLen, 16) - yyv3643 = make([]pkg8_runtime.Object, yyrl3643) - yyc3643 = true - - yyrr3643 = len(yyv3643) - } else if yyl3643 != len(yyv3643) { - yyv3643 = yyv3643[:yyl3643] - yyc3643 = true - } - yyj3643 := 0 - for ; yyj3643 < yyrr3643; yyj3643++ { - if r.TryDecodeAsNil() { - yyv3643[yyj3643] = nil - } else { - yyv3644 := &yyv3643[yyj3643] - yym3645 := z.DecBinary() - _ = yym3645 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3644) { + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] } else { - z.DecFallback(yyv3644, true) + yyv1 = make([]pkg8_runtime.Object, yyrl1) + } + } else { + yyv1 = make([]pkg8_runtime.Object, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = nil + } else { + yyv2 := &yyv1[yyj1] + yym3 := z.DecBinary() + _ = yym3 + if false { + } else if z.HasExtensions() && z.DecExt(yyv2) { + } else { + z.DecFallback(yyv2, true) } } } - if yyrt3643 { - for ; yyj3643 < yyl3643; yyj3643++ { - yyv3643 = append(yyv3643, nil) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, nil) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3643[yyj3643] = nil + yyv1[yyj1] = nil } else { - yyv3646 := &yyv3643[yyj3643] - yym3647 := z.DecBinary() - _ = yym3647 + yyv4 := &yyv1[yyj1] + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv3646) { + } else if z.HasExtensions() && z.DecExt(yyv4) { } else { - z.DecFallback(yyv3646, true) + z.DecFallback(yyv4, true) } } @@ -43106,23 +52973,25 @@ func (x codecSelfer1234) decSliceruntime_Object(v *[]pkg8_runtime.Object, d *cod } } else { - for yyj3643 := 0; !r.CheckBreak(); yyj3643++ { - if yyj3643 >= len(yyv3643) { - yyv3643 = append(yyv3643, nil) // var yyz3643 pkg8_runtime.Object - yyc3643 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3643 < len(yyv3643) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, nil) // var yyz1 pkg8_runtime.Object + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3643[yyj3643] = nil + yyv1[yyj1] = nil } else { - yyv3648 := &yyv3643[yyj3643] - yym3649 := z.DecBinary() - _ = yym3649 + yyv6 := &yyv1[yyj1] + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv3648) { + } else if z.HasExtensions() && z.DecExt(yyv6) { } else { - z.DecFallback(yyv3648, true) + z.DecFallback(yyv6, true) } } @@ -43131,12 +53000,18 @@ func (x codecSelfer1234) decSliceruntime_Object(v *[]pkg8_runtime.Object, d *cod } } - yyh3643.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []pkg8_runtime.Object{} + yyc1 = true + } } - if yyc3643 { - *v = yyv3643 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceLimitRangeItem(v []LimitRangeItem, e *codec1978.Encoder) { @@ -43144,11 +53019,12 @@ func (x codecSelfer1234) encSliceLimitRangeItem(v []LimitRangeItem, e *codec1978 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3650 := range v { - yy3651 := &yyv3650 - yy3651.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceLimitRangeItem(v *[]LimitRangeItem, d *codec1978.Decoder) { @@ -43156,75 +53032,86 @@ func (x codecSelfer1234) decSliceLimitRangeItem(v *[]LimitRangeItem, d *codec197 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3652 := *v - yyh3652, yyl3652 := z.DecSliceHelperStart() - - var yyrr3652, yyrl3652 int - var yyc3652, yyrt3652 bool - _, _, _ = yyc3652, yyrt3652, yyrl3652 - yyrr3652 = yyl3652 - - if yyv3652 == nil { - if yyrl3652, yyrt3652 = z.DecInferLen(yyl3652, z.DecBasicHandle().MaxInitLen, 56); yyrt3652 { - yyrr3652 = yyrl3652 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []LimitRangeItem{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3652 = make([]LimitRangeItem, yyrl3652) - yyc3652 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3652 == 0 { - if len(yyv3652) != 0 { - yyv3652 = yyv3652[:0] - yyc3652 = true - } - } else if yyl3652 > 0 { - - if yyl3652 > cap(yyv3652) { - yyrl3652, yyrt3652 = z.DecInferLen(yyl3652, z.DecBasicHandle().MaxInitLen, 56) - yyv3652 = make([]LimitRangeItem, yyrl3652) - yyc3652 = true - - yyrr3652 = len(yyv3652) - } else if yyl3652 != len(yyv3652) { - yyv3652 = yyv3652[:yyl3652] - yyc3652 = true - } - yyj3652 := 0 - for ; yyj3652 < yyrr3652; yyj3652++ { - if r.TryDecodeAsNil() { - yyv3652[yyj3652] = LimitRangeItem{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 56) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]LimitRangeItem, yyrl1) + } } else { - yyv3653 := &yyv3652[yyj3652] - yyv3653.CodecDecodeSelf(d) + yyv1 = make([]LimitRangeItem, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = LimitRangeItem{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3652 { - for ; yyj3652 < yyl3652; yyj3652++ { - yyv3652 = append(yyv3652, LimitRangeItem{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, LimitRangeItem{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3652[yyj3652] = LimitRangeItem{} + yyv1[yyj1] = LimitRangeItem{} } else { - yyv3654 := &yyv3652[yyj3652] - yyv3654.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3652 := 0; !r.CheckBreak(); yyj3652++ { - if yyj3652 >= len(yyv3652) { - yyv3652 = append(yyv3652, LimitRangeItem{}) // var yyz3652 LimitRangeItem - yyc3652 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3652 < len(yyv3652) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LimitRangeItem{}) // var yyz1 LimitRangeItem + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3652[yyj3652] = LimitRangeItem{} + yyv1[yyj1] = LimitRangeItem{} } else { - yyv3655 := &yyv3652[yyj3652] - yyv3655.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43232,12 +53119,18 @@ func (x codecSelfer1234) decSliceLimitRangeItem(v *[]LimitRangeItem, d *codec197 } } - yyh3652.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []LimitRangeItem{} + yyc1 = true + } } - if yyc3652 { - *v = yyv3652 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceLimitRange(v []LimitRange, e *codec1978.Encoder) { @@ -43245,11 +53138,12 @@ func (x codecSelfer1234) encSliceLimitRange(v []LimitRange, e *codec1978.Encoder z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3656 := range v { - yy3657 := &yyv3656 - yy3657.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceLimitRange(v *[]LimitRange, d *codec1978.Decoder) { @@ -43257,75 +53151,86 @@ func (x codecSelfer1234) decSliceLimitRange(v *[]LimitRange, d *codec1978.Decode z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3658 := *v - yyh3658, yyl3658 := z.DecSliceHelperStart() - - var yyrr3658, yyrl3658 int - var yyc3658, yyrt3658 bool - _, _, _ = yyc3658, yyrt3658, yyrl3658 - yyrr3658 = yyl3658 - - if yyv3658 == nil { - if yyrl3658, yyrt3658 = z.DecInferLen(yyl3658, z.DecBasicHandle().MaxInitLen, 216); yyrt3658 { - yyrr3658 = yyrl3658 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []LimitRange{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3658 = make([]LimitRange, yyrl3658) - yyc3658 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3658 == 0 { - if len(yyv3658) != 0 { - yyv3658 = yyv3658[:0] - yyc3658 = true - } - } else if yyl3658 > 0 { - - if yyl3658 > cap(yyv3658) { - yyrl3658, yyrt3658 = z.DecInferLen(yyl3658, z.DecBasicHandle().MaxInitLen, 216) - yyv3658 = make([]LimitRange, yyrl3658) - yyc3658 = true - - yyrr3658 = len(yyv3658) - } else if yyl3658 != len(yyv3658) { - yyv3658 = yyv3658[:yyl3658] - yyc3658 = true - } - yyj3658 := 0 - for ; yyj3658 < yyrr3658; yyj3658++ { - if r.TryDecodeAsNil() { - yyv3658[yyj3658] = LimitRange{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]LimitRange, yyrl1) + } } else { - yyv3659 := &yyv3658[yyj3658] - yyv3659.CodecDecodeSelf(d) + yyv1 = make([]LimitRange, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = LimitRange{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3658 { - for ; yyj3658 < yyl3658; yyj3658++ { - yyv3658 = append(yyv3658, LimitRange{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, LimitRange{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3658[yyj3658] = LimitRange{} + yyv1[yyj1] = LimitRange{} } else { - yyv3660 := &yyv3658[yyj3658] - yyv3660.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3658 := 0; !r.CheckBreak(); yyj3658++ { - if yyj3658 >= len(yyv3658) { - yyv3658 = append(yyv3658, LimitRange{}) // var yyz3658 LimitRange - yyc3658 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3658 < len(yyv3658) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LimitRange{}) // var yyz1 LimitRange + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3658[yyj3658] = LimitRange{} + yyv1[yyj1] = LimitRange{} } else { - yyv3661 := &yyv3658[yyj3658] - yyv3661.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43333,12 +53238,18 @@ func (x codecSelfer1234) decSliceLimitRange(v *[]LimitRange, d *codec1978.Decode } } - yyh3658.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []LimitRange{} + yyc1 = true + } } - if yyc3658 { - *v = yyv3658 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceResourceQuota(v []ResourceQuota, e *codec1978.Encoder) { @@ -43346,11 +53257,12 @@ func (x codecSelfer1234) encSliceResourceQuota(v []ResourceQuota, e *codec1978.E z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3662 := range v { - yy3663 := &yyv3662 - yy3663.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceResourceQuota(v *[]ResourceQuota, d *codec1978.Decoder) { @@ -43358,75 +53270,86 @@ func (x codecSelfer1234) decSliceResourceQuota(v *[]ResourceQuota, d *codec1978. z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3664 := *v - yyh3664, yyl3664 := z.DecSliceHelperStart() - - var yyrr3664, yyrl3664 int - var yyc3664, yyrt3664 bool - _, _, _ = yyc3664, yyrt3664, yyrl3664 - yyrr3664 = yyl3664 - - if yyv3664 == nil { - if yyrl3664, yyrt3664 = z.DecInferLen(yyl3664, z.DecBasicHandle().MaxInitLen, 216); yyrt3664 { - yyrr3664 = yyrl3664 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ResourceQuota{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3664 = make([]ResourceQuota, yyrl3664) - yyc3664 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3664 == 0 { - if len(yyv3664) != 0 { - yyv3664 = yyv3664[:0] - yyc3664 = true - } - } else if yyl3664 > 0 { - - if yyl3664 > cap(yyv3664) { - yyrl3664, yyrt3664 = z.DecInferLen(yyl3664, z.DecBasicHandle().MaxInitLen, 216) - yyv3664 = make([]ResourceQuota, yyrl3664) - yyc3664 = true - - yyrr3664 = len(yyv3664) - } else if yyl3664 != len(yyv3664) { - yyv3664 = yyv3664[:yyl3664] - yyc3664 = true - } - yyj3664 := 0 - for ; yyj3664 < yyrr3664; yyj3664++ { - if r.TryDecodeAsNil() { - yyv3664[yyj3664] = ResourceQuota{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ResourceQuota, yyrl1) + } } else { - yyv3665 := &yyv3664[yyj3664] - yyv3665.CodecDecodeSelf(d) + yyv1 = make([]ResourceQuota, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ResourceQuota{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3664 { - for ; yyj3664 < yyl3664; yyj3664++ { - yyv3664 = append(yyv3664, ResourceQuota{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ResourceQuota{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3664[yyj3664] = ResourceQuota{} + yyv1[yyj1] = ResourceQuota{} } else { - yyv3666 := &yyv3664[yyj3664] - yyv3666.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3664 := 0; !r.CheckBreak(); yyj3664++ { - if yyj3664 >= len(yyv3664) { - yyv3664 = append(yyv3664, ResourceQuota{}) // var yyz3664 ResourceQuota - yyc3664 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3664 < len(yyv3664) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ResourceQuota{}) // var yyz1 ResourceQuota + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3664[yyj3664] = ResourceQuota{} + yyv1[yyj1] = ResourceQuota{} } else { - yyv3667 := &yyv3664[yyj3664] - yyv3667.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43434,12 +53357,18 @@ func (x codecSelfer1234) decSliceResourceQuota(v *[]ResourceQuota, d *codec1978. } } - yyh3664.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ResourceQuota{} + yyc1 = true + } } - if yyc3664 { - *v = yyv3664 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encMapstringSliceuint8(v map[string][]uint8, e *codec1978.Encoder) { @@ -43447,25 +53376,27 @@ func (x codecSelfer1234) encMapstringSliceuint8(v map[string][]uint8, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeMapStart(len(v)) - for yyk3668, yyv3668 := range v { - yym3669 := z.EncBinary() - _ = yym3669 + for yyk1, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + yym2 := z.EncBinary() + _ = yym2 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(yyk3668)) + r.EncodeString(codecSelferC_UTF81234, string(yyk1)) } - if yyv3668 == nil { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyv1 == nil { r.EncodeNil() } else { - yym3670 := z.EncBinary() - _ = yym3670 + yym3 := z.EncBinary() + _ = yym3 if false { } else { - r.EncodeStringBytes(codecSelferC_RAW1234, []byte(yyv3668)) + r.EncodeStringBytes(codecSelferC_RAW1234, []byte(yyv1)) } } } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } func (x codecSelfer1234) decMapstringSliceuint8(v *map[string][]uint8, d *codec1978.Decoder) { @@ -43473,80 +53404,199 @@ func (x codecSelfer1234) decMapstringSliceuint8(v *map[string][]uint8, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3671 := *v - yyl3671 := r.ReadMapStart() - yybh3671 := z.DecBasicHandle() - if yyv3671 == nil { - yyrl3671, _ := z.DecInferLen(yyl3671, yybh3671.MaxInitLen, 40) - yyv3671 = make(map[string][]uint8, yyrl3671) - *v = yyv3671 + yyv1 := *v + yyl1 := r.ReadMapStart() + yybh1 := z.DecBasicHandle() + if yyv1 == nil { + yyrl1, _ := z.DecInferLen(yyl1, yybh1.MaxInitLen, 40) + yyv1 = make(map[string][]uint8, yyrl1) + *v = yyv1 } - var yymk3671 string - var yymv3671 []uint8 - var yymg3671 bool - if yybh3671.MapValueReset { - yymg3671 = true + var yymk1 string + var yymv1 []uint8 + var yymg1 bool + if yybh1.MapValueReset { + yymg1 = true } - if yyl3671 > 0 { - for yyj3671 := 0; yyj3671 < yyl3671; yyj3671++ { + if yyl1 > 0 { + for yyj1 := 0; yyj1 < yyl1; yyj1++ { + z.DecSendContainerState(codecSelfer_containerMapKey1234) if r.TryDecodeAsNil() { - yymk3671 = "" + yymk1 = "" } else { - yymk3671 = string(r.DecodeString()) + yymk1 = string(r.DecodeString()) } - if yymg3671 { - yymv3671 = yyv3671[yymk3671] + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yymv3671 = nil + yymv1 = nil } + z.DecSendContainerState(codecSelfer_containerMapValue1234) if r.TryDecodeAsNil() { - yymv3671 = nil + yymv1 = nil } else { - yyv3673 := &yymv3671 - yym3674 := z.DecBinary() - _ = yym3674 + yyv3 := &yymv1 + yym4 := z.DecBinary() + _ = yym4 if false { } else { - *yyv3673 = r.DecodeBytes(*(*[]byte)(yyv3673), false, false) + *yyv3 = r.DecodeBytes(*(*[]byte)(yyv3), false, false) } } - if yyv3671 != nil { - yyv3671[yymk3671] = yymv3671 + if yyv1 != nil { + yyv1[yymk1] = yymv1 } } - } else if yyl3671 < 0 { - for yyj3671 := 0; !r.CheckBreak(); yyj3671++ { + } else if yyl1 < 0 { + for yyj1 := 0; !r.CheckBreak(); yyj1++ { + z.DecSendContainerState(codecSelfer_containerMapKey1234) if r.TryDecodeAsNil() { - yymk3671 = "" + yymk1 = "" } else { - yymk3671 = string(r.DecodeString()) + yymk1 = string(r.DecodeString()) } - if yymg3671 { - yymv3671 = yyv3671[yymk3671] + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yymv3671 = nil + yymv1 = nil } + z.DecSendContainerState(codecSelfer_containerMapValue1234) if r.TryDecodeAsNil() { - yymv3671 = nil + yymv1 = nil } else { - yyv3676 := &yymv3671 - yym3677 := z.DecBinary() - _ = yym3677 + yyv6 := &yymv1 + yym7 := z.DecBinary() + _ = yym7 if false { } else { - *yyv3676 = r.DecodeBytes(*(*[]byte)(yyv3676), false, false) + *yyv6 = r.DecodeBytes(*(*[]byte)(yyv6), false, false) } } - if yyv3671 != nil { - yyv3671[yymk3671] = yymv3671 + if yyv1 != nil { + yyv1[yymk1] = yymv1 } } - r.ReadEnd() } // else len==0: TODO: Should we clear map entries? + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x codecSelfer1234) encSliceuint8(v []uint8, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym2 := z.EncBinary() + _ = yym2 + if false { + } else { + r.EncodeUint(uint64(yyv1)) + } + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceuint8(v *[]uint8, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []uint8{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]uint8, yyrl1) + } + } else { + yyv1 = make([]uint8, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = 0 + } else { + yyv1[yyj1] = uint8(r.DecodeUint(8)) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, 0) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = 0 + } else { + yyv1[yyj1] = uint8(r.DecodeUint(8)) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, 0) // var yyz1 uint8 + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = 0 + } else { + yyv1[yyj1] = uint8(r.DecodeUint(8)) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []uint8{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceSecret(v []Secret, e *codec1978.Encoder) { @@ -43554,11 +53604,12 @@ func (x codecSelfer1234) encSliceSecret(v []Secret, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3678 := range v { - yy3679 := &yyv3678 - yy3679.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceSecret(v *[]Secret, d *codec1978.Decoder) { @@ -43566,75 +53617,86 @@ func (x codecSelfer1234) decSliceSecret(v *[]Secret, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3680 := *v - yyh3680, yyl3680 := z.DecSliceHelperStart() - - var yyrr3680, yyrl3680 int - var yyc3680, yyrt3680 bool - _, _, _ = yyc3680, yyrt3680, yyrl3680 - yyrr3680 = yyl3680 - - if yyv3680 == nil { - if yyrl3680, yyrt3680 = z.DecInferLen(yyl3680, z.DecBasicHandle().MaxInitLen, 216); yyrt3680 { - yyrr3680 = yyrl3680 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Secret{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3680 = make([]Secret, yyrl3680) - yyc3680 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3680 == 0 { - if len(yyv3680) != 0 { - yyv3680 = yyv3680[:0] - yyc3680 = true - } - } else if yyl3680 > 0 { - - if yyl3680 > cap(yyv3680) { - yyrl3680, yyrt3680 = z.DecInferLen(yyl3680, z.DecBasicHandle().MaxInitLen, 216) - yyv3680 = make([]Secret, yyrl3680) - yyc3680 = true - - yyrr3680 = len(yyv3680) - } else if yyl3680 != len(yyv3680) { - yyv3680 = yyv3680[:yyl3680] - yyc3680 = true - } - yyj3680 := 0 - for ; yyj3680 < yyrr3680; yyj3680++ { - if r.TryDecodeAsNil() { - yyv3680[yyj3680] = Secret{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Secret, yyrl1) + } } else { - yyv3681 := &yyv3680[yyj3680] - yyv3681.CodecDecodeSelf(d) + yyv1 = make([]Secret, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Secret{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3680 { - for ; yyj3680 < yyl3680; yyj3680++ { - yyv3680 = append(yyv3680, Secret{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Secret{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3680[yyj3680] = Secret{} + yyv1[yyj1] = Secret{} } else { - yyv3682 := &yyv3680[yyj3680] - yyv3682.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3680 := 0; !r.CheckBreak(); yyj3680++ { - if yyj3680 >= len(yyv3680) { - yyv3680 = append(yyv3680, Secret{}) // var yyz3680 Secret - yyc3680 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3680 < len(yyv3680) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Secret{}) // var yyz1 Secret + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3680[yyj3680] = Secret{} + yyv1[yyj1] = Secret{} } else { - yyv3683 := &yyv3680[yyj3680] - yyv3683.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43642,12 +53704,137 @@ func (x codecSelfer1234) decSliceSecret(v *[]Secret, d *codec1978.Decoder) { } } - yyh3680.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Secret{} + yyc1 = true + } } - if yyc3680 { - *v = yyv3680 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceConfigMap(v []ConfigMap, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceConfigMap(v *[]ConfigMap, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ConfigMap{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 200) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ConfigMap, yyrl1) + } + } else { + yyv1 = make([]ConfigMap, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ConfigMap{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ConfigMap{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ConfigMap{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ConfigMap{}) // var yyz1 ConfigMap + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = ConfigMap{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ConfigMap{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceComponentCondition(v []ComponentCondition, e *codec1978.Encoder) { @@ -43655,11 +53842,12 @@ func (x codecSelfer1234) encSliceComponentCondition(v []ComponentCondition, e *c z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3684 := range v { - yy3685 := &yyv3684 - yy3685.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceComponentCondition(v *[]ComponentCondition, d *codec1978.Decoder) { @@ -43667,75 +53855,86 @@ func (x codecSelfer1234) decSliceComponentCondition(v *[]ComponentCondition, d * z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3686 := *v - yyh3686, yyl3686 := z.DecSliceHelperStart() - - var yyrr3686, yyrl3686 int - var yyc3686, yyrt3686 bool - _, _, _ = yyc3686, yyrt3686, yyrl3686 - yyrr3686 = yyl3686 - - if yyv3686 == nil { - if yyrl3686, yyrt3686 = z.DecInferLen(yyl3686, z.DecBasicHandle().MaxInitLen, 64); yyrt3686 { - yyrr3686 = yyrl3686 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ComponentCondition{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3686 = make([]ComponentCondition, yyrl3686) - yyc3686 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3686 == 0 { - if len(yyv3686) != 0 { - yyv3686 = yyv3686[:0] - yyc3686 = true - } - } else if yyl3686 > 0 { - - if yyl3686 > cap(yyv3686) { - yyrl3686, yyrt3686 = z.DecInferLen(yyl3686, z.DecBasicHandle().MaxInitLen, 64) - yyv3686 = make([]ComponentCondition, yyrl3686) - yyc3686 = true - - yyrr3686 = len(yyv3686) - } else if yyl3686 != len(yyv3686) { - yyv3686 = yyv3686[:yyl3686] - yyc3686 = true - } - yyj3686 := 0 - for ; yyj3686 < yyrr3686; yyj3686++ { - if r.TryDecodeAsNil() { - yyv3686[yyj3686] = ComponentCondition{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 64) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ComponentCondition, yyrl1) + } } else { - yyv3687 := &yyv3686[yyj3686] - yyv3687.CodecDecodeSelf(d) + yyv1 = make([]ComponentCondition, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ComponentCondition{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3686 { - for ; yyj3686 < yyl3686; yyj3686++ { - yyv3686 = append(yyv3686, ComponentCondition{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ComponentCondition{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3686[yyj3686] = ComponentCondition{} + yyv1[yyj1] = ComponentCondition{} } else { - yyv3688 := &yyv3686[yyj3686] - yyv3688.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3686 := 0; !r.CheckBreak(); yyj3686++ { - if yyj3686 >= len(yyv3686) { - yyv3686 = append(yyv3686, ComponentCondition{}) // var yyz3686 ComponentCondition - yyc3686 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3686 < len(yyv3686) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ComponentCondition{}) // var yyz1 ComponentCondition + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3686[yyj3686] = ComponentCondition{} + yyv1[yyj1] = ComponentCondition{} } else { - yyv3689 := &yyv3686[yyj3686] - yyv3689.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43743,12 +53942,18 @@ func (x codecSelfer1234) decSliceComponentCondition(v *[]ComponentCondition, d * } } - yyh3686.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ComponentCondition{} + yyc1 = true + } } - if yyc3686 { - *v = yyv3686 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceComponentStatus(v []ComponentStatus, e *codec1978.Encoder) { @@ -43756,11 +53961,12 @@ func (x codecSelfer1234) encSliceComponentStatus(v []ComponentStatus, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3690 := range v { - yy3691 := &yyv3690 - yy3691.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceComponentStatus(v *[]ComponentStatus, d *codec1978.Decoder) { @@ -43768,75 +53974,86 @@ func (x codecSelfer1234) decSliceComponentStatus(v *[]ComponentStatus, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3692 := *v - yyh3692, yyl3692 := z.DecSliceHelperStart() - - var yyrr3692, yyrl3692 int - var yyc3692, yyrt3692 bool - _, _, _ = yyc3692, yyrt3692, yyrl3692 - yyrr3692 = yyl3692 - - if yyv3692 == nil { - if yyrl3692, yyrt3692 = z.DecInferLen(yyl3692, z.DecBasicHandle().MaxInitLen, 216); yyrt3692 { - yyrr3692 = yyrl3692 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ComponentStatus{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3692 = make([]ComponentStatus, yyrl3692) - yyc3692 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3692 == 0 { - if len(yyv3692) != 0 { - yyv3692 = yyv3692[:0] - yyc3692 = true - } - } else if yyl3692 > 0 { - - if yyl3692 > cap(yyv3692) { - yyrl3692, yyrt3692 = z.DecInferLen(yyl3692, z.DecBasicHandle().MaxInitLen, 216) - yyv3692 = make([]ComponentStatus, yyrl3692) - yyc3692 = true - - yyrr3692 = len(yyv3692) - } else if yyl3692 != len(yyv3692) { - yyv3692 = yyv3692[:yyl3692] - yyc3692 = true - } - yyj3692 := 0 - for ; yyj3692 < yyrr3692; yyj3692++ { - if r.TryDecodeAsNil() { - yyv3692[yyj3692] = ComponentStatus{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ComponentStatus, yyrl1) + } } else { - yyv3693 := &yyv3692[yyj3692] - yyv3693.CodecDecodeSelf(d) + yyv1 = make([]ComponentStatus, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ComponentStatus{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3692 { - for ; yyj3692 < yyl3692; yyj3692++ { - yyv3692 = append(yyv3692, ComponentStatus{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ComponentStatus{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3692[yyj3692] = ComponentStatus{} + yyv1[yyj1] = ComponentStatus{} } else { - yyv3694 := &yyv3692[yyj3692] - yyv3694.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3692 := 0; !r.CheckBreak(); yyj3692++ { - if yyj3692 >= len(yyv3692) { - yyv3692 = append(yyv3692, ComponentStatus{}) // var yyz3692 ComponentStatus - yyc3692 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3692 < len(yyv3692) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ComponentStatus{}) // var yyz1 ComponentStatus + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3692[yyj3692] = ComponentStatus{} + yyv1[yyj1] = ComponentStatus{} } else { - yyv3695 := &yyv3692[yyj3692] - yyv3695.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43844,10 +54061,16 @@ func (x codecSelfer1234) decSliceComponentStatus(v *[]ComponentStatus, d *codec1 } } - yyh3692.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ComponentStatus{} + yyc1 = true + } } - if yyc3692 { - *v = yyv3692 + yyh1.End() + if yyc1 { + *v = yyv1 } - } diff --git a/vendor/k8s.io/kubernetes/pkg/api/types.go b/vendor/k8s.io/kubernetes/pkg/api/types.go index 99e31ae02..e945ea6a3 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/types.go +++ b/vendor/k8s.io/kubernetes/pkg/api/types.go @@ -23,7 +23,7 @@ import ( "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/types" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) // Common string formats @@ -198,6 +198,10 @@ type VolumeSource struct { PersistentVolumeClaim *PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"` // RBD represents a Rados Block Device mount on the host that shares a pod's lifetime RBD *RBDVolumeSource `json:"rbd,omitempty"` + // FlexVolume represents a generic volume resource that is + // provisioned/attached using a exec based plugin. This is an alpha feature and may change in future. + FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty"` + // Cinder represents a cinder volume attached and mounted on kubelets host machine Cinder *CinderVolumeSource `json:"cinder,omitempty"` @@ -211,6 +215,10 @@ type VolumeSource struct { DownwardAPI *DownwardAPIVolumeSource `json:"downwardAPI,omitempty"` // FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. FC *FCVolumeSource `json:"fc,omitempty"` + // AzureFile represents an Azure File Service mount on the host and bind mount to the pod. + AzureFile *AzureFileVolumeSource `json:"azureFile,omitempty"` + // ConfigMap represents a configMap that should populate this volume + ConfigMap *ConfigMapVolumeSource `json:"configMap,omitempty"` } // Similar to VolumeSource but meant for the administrator who creates PVs. @@ -236,6 +244,9 @@ type PersistentVolumeSource struct { // ISCSIVolumeSource represents an ISCSI resource that is attached to a // kubelet's host machine and then exposed to the pod. ISCSI *ISCSIVolumeSource `json:"iscsi,omitempty"` + // FlexVolume represents a generic volume resource that is + // provisioned/attached using a exec based plugin. This is an alpha feature and may change in future. + FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty"` // Cinder represents a cinder volume attached and mounted on kubelets host machine Cinder *CinderVolumeSource `json:"cinder,omitempty"` // CephFS represents a Ceph FS mount on the host that shares a pod's lifetime @@ -244,6 +255,8 @@ type PersistentVolumeSource struct { FC *FCVolumeSource `json:"fc,omitempty"` // Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running Flocker *FlockerVolumeSource `json:"flocker,omitempty"` + // AzureFile represents an Azure File Service mount on the host and bind mount to the pod. + AzureFile *AzureFileVolumeSource `json:"azureFile,omitempty"` } type PersistentVolumeClaimVolumeSource struct { @@ -254,6 +267,8 @@ type PersistentVolumeClaimVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } +// +genclient=true,nonNamespaced=true + type PersistentVolume struct { unversioned.TypeMeta `json:",inline"` ObjectMeta `json:"metadata,omitempty"` @@ -310,6 +325,8 @@ type PersistentVolumeList struct { Items []PersistentVolume `json:"items"` } +// +genclient=true + // PersistentVolumeClaim is a user's request for and claim to a persistent volume type PersistentVolumeClaim struct { unversioned.TypeMeta `json:",inline"` @@ -386,12 +403,14 @@ const ( ClaimBound PersistentVolumeClaimPhase = "Bound" ) -// HostPathVolumeSource represents a host directory mapped into a pod. +// Represents a host path mapped into a pod. +// Host path volumes do not support ownership management or SELinux relabeling. type HostPathVolumeSource struct { Path string `json:"path"` } -// EmptyDirVolumeSource represents an empty directory for a pod. +// Represents an empty directory for a pod. +// Empty directory volumes support ownership management and SELinux relabeling. type EmptyDirVolumeSource struct { // TODO: Longer term we want to represent the selection of underlying // media more like a scheduling problem - user says what traits they @@ -399,7 +418,7 @@ type EmptyDirVolumeSource struct { // this will cover the most common needs. // Optional: what type of storage medium should back this directory. // The default is "" which means to use the node's default medium. - Medium StorageMedium `json:"medium"` + Medium StorageMedium `json:"medium,omitempty"` } // StorageMedium defines ways that storage can be allocated to a volume. @@ -420,17 +439,18 @@ const ( ProtocolUDP Protocol = "UDP" ) -// GCEPersistentDiskVolumeSource represents a Persistent Disk resource in Google Compute Engine. +// Represents a Persistent Disk resource in Google Compute Engine. // // A GCE PD must exist and be formatted before mounting to a container. // The disk must also be in the same GCE project and zone as the kubelet. // A GCE PD can only be mounted as read/write once. +// GCE PDs support ownership management and SELinux relabeling. type GCEPersistentDiskVolumeSource struct { // Unique name of the PD resource. Used to identify the disk in GCE PDName string `json:"pdName"` - // Required: Filesystem type to mount. + // Filesystem type to mount. // Must be a filesystem type supported by the host operating system. - // Ex. "ext4", "xfs", "ntfs" + // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // TODO: how do we prevent errors in the filesystem from compromising the machine FSType string `json:"fsType,omitempty"` // Optional: Partition on the disk to mount. @@ -442,7 +462,9 @@ type GCEPersistentDiskVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// A ISCSI Disk can only be mounted as read/write once. +// Represents an ISCSI disk. +// ISCSI volumes can only be mounted as read/write once. +// ISCSI volumes support ownership management and SELinux relabeling. type ISCSIVolumeSource struct { // Required: iSCSI target portal // the portal is either an IP or ip_addr:port if port is other than default (typically TCP ports 860 and 3260) @@ -451,9 +473,11 @@ type ISCSIVolumeSource struct { IQN string `json:"iqn,omitempty"` // Required: iSCSI target lun number Lun int `json:"lun,omitempty"` - // Required: Filesystem type to mount. + // Optional: Defaults to 'default' (tcp). iSCSI interface name that uses an iSCSI transport. + ISCSIInterface string `json:"iscsiInterface,omitempty"` + // Filesystem type to mount. // Must be a filesystem type supported by the host operating system. - // Ex. "ext4", "xfs", "ntfs" + // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // TODO: how do we prevent errors in the filesystem from compromising the machine FSType string `json:"fsType,omitempty"` // Optional: Defaults to false (read/write). ReadOnly here will force @@ -461,33 +485,54 @@ type ISCSIVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// A Fibre Channel Disk can only be mounted as read/write once. +// Represents a Fibre Channel volume. +// Fibre Channel volumes can only be mounted as read/write once. +// Fibre Channel volumes support ownership management and SELinux relabeling. type FCVolumeSource struct { // Required: FC target world wide names (WWNs) TargetWWNs []string `json:"targetWWNs"` // Required: FC target lun number Lun *int `json:"lun"` - // Required: Filesystem type to mount. + // Filesystem type to mount. // Must be a filesystem type supported by the host operating system. - // Ex. "ext4", "xfs", "ntfs" + // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // TODO: how do we prevent errors in the filesystem from compromising the machine - FSType string `json:"fsType"` + FSType string `json:"fsType,omitempty"` // Optional: Defaults to false (read/write). ReadOnly here will force // the ReadOnly setting in VolumeMounts. ReadOnly bool `json:"readOnly,omitempty"` } -// AWSElasticBlockStoreVolumeSource represents a Persistent Disk resource in AWS. +// FlexVolume represents a generic volume resource that is +// provisioned/attached using a exec based plugin. This is an alpha feature and may change in future. +type FlexVolumeSource struct { + // Driver is the name of the driver to use for this volume. + Driver string `json:"driver"` + // Filesystem type to mount. + // Must be a filesystem type supported by the host operating system. + // Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + FSType string `json:"fsType,omitempty"` + // Optional: SecretRef is reference to the authentication secret for User, default is empty. + SecretRef *LocalObjectReference `json:"secretRef,omitempty"` + // Optional: Defaults to false (read/write). ReadOnly here will force + // the ReadOnly setting in VolumeMounts. + ReadOnly bool `json:"readOnly,omitempty"` + // Optional: Extra driver options if any. + Options map[string]string `json:"options,omitempty"` +} + +// Represents a Persistent Disk resource in AWS. // // An AWS EBS disk must exist and be formatted before mounting to a container. // The disk must also be in the same AWS zone as the kubelet. // A AWS EBS disk can only be mounted as read/write once. +// AWS EBS volumes support ownership management and SELinux relabeling. type AWSElasticBlockStoreVolumeSource struct { // Unique id of the persistent disk resource. Used to identify the disk in AWS VolumeID string `json:"volumeID"` - // Required: Filesystem type to mount. + // Filesystem type to mount. // Must be a filesystem type supported by the host operating system. - // Ex. "ext4", "xfs", "ntfs" + // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // TODO: how do we prevent errors in the filesystem from compromising the machine FSType string `json:"fsType,omitempty"` // Optional: Partition on the disk to mount. @@ -499,25 +544,34 @@ type AWSElasticBlockStoreVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// GitRepoVolumeSource represents a volume that is pulled from git when the pod is created. +// Represents a volume that is populated with the contents of a git repository. +// Git repo volumes do not support ownership management. +// Git repo volumes support SELinux relabeling. type GitRepoVolumeSource struct { // Repository URL Repository string `json:"repository"` // Commit hash, this is optional - Revision string `json:"revision"` + Revision string `json:"revision,omitempty"` + // Clone target, this is optional + // Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + // git repository. Otherwise, if specified, the volume will contain the git repository in + // the subdirectory with the given name. + Directory string `json:"directory,omitempty"` // TODO: Consider credentials here. } -// SecretVolumeSource adapts a Secret into a VolumeSource. +// Adapts a Secret into a volume. // // The contents of the target Secret's Data field will be presented in a volume // as files using the keys in the Data field as the file names. +// Secret volumes support ownership management and SELinux relabeling. type SecretVolumeSource struct { - // Name of the secret in the pod's namespace to use - SecretName string `json:"secretName"` + // Name of the secret in the pod's namespace to use. + SecretName string `json:"secretName,omitempty"` } -// NFSVolumeSource represents an NFS Mount that lasts the lifetime of a pod +// Represents an NFS mount that lasts the lifetime of a pod. +// NFS volumes do not support ownership management or SELinux relabeling. type NFSVolumeSource struct { // Server is the hostname or IP address of the NFS server Server string `json:"server"` @@ -530,7 +584,8 @@ type NFSVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod +// Represents a Glusterfs mount that lasts the lifetime of a pod. +// Glusterfs volumes do not support ownership management or SELinux relabeling. type GlusterfsVolumeSource struct { // Required: EndpointsName is the endpoint name that details Glusterfs topology EndpointsName string `json:"endpoints"` @@ -543,15 +598,16 @@ type GlusterfsVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// RBDVolumeSource represents a Rados Block Device Mount that lasts the lifetime of a pod +// Represents a Rados Block Device mount that lasts the lifetime of a pod. +// RBD volumes support ownership management and SELinux relabeling. type RBDVolumeSource struct { // Required: CephMonitors is a collection of Ceph monitors CephMonitors []string `json:"monitors"` // Required: RBDImage is the rados image name RBDImage string `json:"image"` - // Required: Filesystem type to mount. + // Filesystem type to mount. // Must be a filesystem type supported by the host operating system. - // Ex. "ext4", "xfs", "ntfs" + // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // TODO: how do we prevent errors in the filesystem from compromising the machine FSType string `json:"fsType,omitempty"` // Optional: RadosPool is the rados pool name,default is rbd @@ -567,25 +623,29 @@ type RBDVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// CinderVolumeSource represents a cinder volume resource in Openstack. +// Represents a cinder volume resource in Openstack. // A Cinder volume must exist and be formatted before mounting to a container. // The volume must also be in the same region as the kubelet. +// Cinder volumes support ownership management and SELinux relabeling. type CinderVolumeSource struct { // Unique id of the volume used to identify the cinder volume VolumeID string `json:"volumeID"` - // Required: Filesystem type to mount. + // Filesystem type to mount. // Must be a filesystem type supported by the host operating system. - // Only ext3 and ext4 are allowed + // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. FSType string `json:"fsType,omitempty"` // Optional: Defaults to false (read/write). ReadOnly here will force // the ReadOnly setting in VolumeMounts. ReadOnly bool `json:"readOnly,omitempty"` } -// CephFSVolumeSource represents a Ceph Filesystem Mount that lasts the lifetime of a pod +// Represents a Ceph Filesystem mount that lasts the lifetime of a pod +// Cephfs volumes do not support ownership management or SELinux relabeling. type CephFSVolumeSource struct { // Required: Monitors is a collection of Ceph monitors Monitors []string `json:"monitors"` + // Optional: Used as the mounted root, rather than the full Ceph tree, default is / + Path string `json:"path,omitempty"` // Optional: User is the rados user name, default is admin User string `json:"user,omitempty"` // Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret @@ -597,19 +657,21 @@ type CephFSVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// FlockerVolumeSource represents a Flocker volume mounted by the Flocker agent. +// Represents a Flocker volume mounted by the Flocker agent. +// Flocker volumes do not support ownership management or SELinux relabeling. type FlockerVolumeSource struct { // Required: the volume name. This is going to be store on metadata -> name on the payload for Flocker DatasetName string `json:"datasetName"` } -// DownwardAPIVolumeSource represents a volume containing downward API info +// Represents a volume containing downward API info. +// Downward API volumes support ownership management and SELinux relabeling. type DownwardAPIVolumeSource struct { // Items is a list of DownwardAPIVolume file Items []DownwardAPIVolumeFile `json:"items,omitempty"` } -// DownwardAPIVolumeFile represents a single file containing information from the downward API +// Represents a single file containing information from the downward API type DownwardAPIVolumeFile struct { // Required: Path is the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..' Path string `json:"path"` @@ -617,6 +679,47 @@ type DownwardAPIVolumeFile struct { FieldRef ObjectFieldSelector `json:"fieldRef"` } +// AzureFile represents an Azure File Service mount on the host and bind mount to the pod. +type AzureFileVolumeSource struct { + // the name of secret that contains Azure Storage Account Name and Key + SecretName string `json:"secretName"` + // Share Name + ShareName string `json:"shareName"` + // Defaults to false (read/write). ReadOnly here will force + // the ReadOnly setting in VolumeMounts. + ReadOnly bool `json:"readOnly,omitempty"` +} + +// Adapts a ConfigMap into a volume. +// +// The contents of the target ConfigMap's Data field will be presented in a +// volume as files using the keys in the Data field as the file names, unless +// the items element is populated with specific mappings of keys to paths. +// ConfigMap volumes support ownership management and SELinux relabeling. +type ConfigMapVolumeSource struct { + LocalObjectReference `json:",inline"` + // If unspecified, each key-value pair in the Data field of the referenced + // ConfigMap will be projected into the volume as a file whose name is the + // key and content is the value. If specified, the listed keys will be + // projected into the specified paths, and unlisted keys will not be + // present. If a key is specified which is not present in the ConfigMap, + // the volume setup will error. Paths must be relative and may not contain + // the '..' path or start with '..'. + Items []KeyToPath `json:"items,omitempty"` +} + +// Maps a string key to a path within a volume. +type KeyToPath struct { + // The key to project. + Key string `json:"key"` + + // The relative path of the file to map the key to. + // May not be an absolute path. + // May not contain the path element '..'. + // May not start with the string '..'. + Path string `json:"path"` +} + // ContainerPort represents a network port in a single container type ContainerPort struct { // Optional: If specified, this must be an IANA_SVC_NAME Each named port @@ -661,9 +764,14 @@ type EnvVar struct { } // EnvVarSource represents a source for the value of an EnvVar. +// Only one of its fields may be set. type EnvVarSource struct { - // Required: Selects a field of the pod; only name and namespace are supported. - FieldRef *ObjectFieldSelector `json:"fieldRef"` + // Selects a field of the pod; only name and namespace are supported. + FieldRef *ObjectFieldSelector `json:"fieldRef,omitempty"` + // Selects a key of a ConfigMap. + ConfigMapKeyRef *ConfigMapKeySelector `json:"configMapKeyRef,omitempty"` + // Selects a key of a secret in the pod's namespace. + SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty"` } // ObjectFieldSelector selects an APIVersioned field of an object. @@ -676,16 +784,43 @@ type ObjectFieldSelector struct { FieldPath string `json:"fieldPath"` } +// Selects a key from a ConfigMap. +type ConfigMapKeySelector struct { + // The ConfigMap to select from. + LocalObjectReference `json:",inline"` + // The key to select. + Key string `json:"key"` +} + +// SecretKeySelector selects a key of a Secret. +type SecretKeySelector struct { + // The name of the secret in the pod's namespace to select from. + LocalObjectReference `json:",inline"` + // The key of the secret to select from. Must be a valid secret key. + Key string `json:"key"` +} + +// HTTPHeader describes a custom header to be used in HTTP probes +type HTTPHeader struct { + // The header field name + Name string `json:"name"` + // The header field value + Value string `json:"value"` +} + // HTTPGetAction describes an action based on HTTP Get requests. type HTTPGetAction struct { // Optional: Path to access on the HTTP server. Path string `json:"path,omitempty"` // Required: Name or number of the port to access on the container. - Port util.IntOrString `json:"port,omitempty"` - // Optional: Host name to connect to, defaults to the pod IP. + Port intstr.IntOrString `json:"port,omitempty"` + // Optional: Host name to connect to, defaults to the pod IP. You + // probably want to set "Host" in httpHeaders instead. Host string `json:"host,omitempty"` // Optional: Scheme to use for connecting to the host, defaults to HTTP. Scheme URIScheme `json:"scheme,omitempty"` + // Optional: Custom headers to set in the request. HTTP allows repeated headers. + HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"` } // URIScheme identifies the scheme used for connection to a host for Get actions @@ -701,7 +836,7 @@ const ( // TCPSocketAction describes an action based on opening a socket type TCPSocketAction struct { // Required: Port to connect to. - Port util.IntOrString `json:"port,omitempty"` + Port intstr.IntOrString `json:"port,omitempty"` } // ExecAction describes a "run in container" action. @@ -713,14 +848,22 @@ type ExecAction struct { Command []string `json:"command,omitempty"` } -// Probe describes a liveness probe to be examined to the container. +// Probe describes a health check to be performed against a container to determine whether it is +// alive or ready to receive traffic. type Probe struct { // The action taken to determine the health of a container Handler `json:",inline"` // Length of time before health checking is activated. In seconds. - InitialDelaySeconds int64 `json:"initialDelaySeconds,omitempty"` + InitialDelaySeconds int `json:"initialDelaySeconds,omitempty"` // Length of time before health checking times out. In seconds. - TimeoutSeconds int64 `json:"timeoutSeconds,omitempty"` + TimeoutSeconds int `json:"timeoutSeconds,omitempty"` + // How often (in seconds) to perform the probe. + PeriodSeconds int `json:"periodSeconds,omitempty"` + // Minimum consecutive successes for the probe to be considered successful after having failed. + // Must be 1 for liveness. + SuccessThreshold int `json:"successThreshold,omitempty"` + // Minimum consecutive failures for the probe to be considered failed after having succeeded. + FailureThreshold int `json:"failureThreshold,omitempty"` } // PullPolicy describes a policy for if/when to pull a container image @@ -959,6 +1102,93 @@ const ( DNSDefault DNSPolicy = "Default" ) +// A node selector represents the union of the results of one or more label queries +// over a set of nodes; that is, it represents the OR of the selectors represented +// by the node selector terms. +type NodeSelector struct { + //Required. A list of node selector terms. The terms are ORed. + NodeSelectorTerms []NodeSelectorTerm `json:"nodeSelectorTerms"` +} + +// A null or empty node selector term matches no objects. +type NodeSelectorTerm struct { + //Required. A list of node selector requirements. The requirements are ANDed. + MatchExpressions []NodeSelectorRequirement `json:"matchExpressions"` +} + +// A node selector requirement is a selector that contains values, a key, and an operator +// that relates the key and values. +type NodeSelectorRequirement struct { + // The label key that the selector applies to. + Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key"` + // Represents a key's relationship to a set of values. + // Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + Operator NodeSelectorOperator `json:"operator"` + // An array of string values. If the operator is In or NotIn, + // the values array must be non-empty. If the operator is Exists or DoesNotExist, + // the values array must be empty. If the operator is Gt or Lt, the values + // array must have a single element, which will be interpreted as an integer. + // This array is replaced during a strategic merge patch. + Values []string `json:"values,omitempty"` +} + +// A node selector operator is the set of operators that can be used in +// a node selector requirement. +type NodeSelectorOperator string + +const ( + NodeSelectorOpIn NodeSelectorOperator = "In" + NodeSelectorOpNotIn NodeSelectorOperator = "NotIn" + NodeSelectorOpExists NodeSelectorOperator = "Exists" + NodeSelectorOpDoesNotExist NodeSelectorOperator = "DoesNotExist" + NodeSelectorOpGt NodeSelectorOperator = "Gt" + NodeSelectorOpLt NodeSelectorOperator = "Lt" +) + +// Affinity is a group of affinity scheduling rules, currently +// only node affinity, but in the future also inter-pod affinity. +type Affinity struct { + // Describes node affinity scheduling rules for the pod. + NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty"` +} + +// Node affinity is a group of node affinity scheduling rules. +type NodeAffinity struct { + // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. + // If the affinity requirements specified by this field are not met at + // scheduling time, the pod will not be scheduled onto the node. + // If the affinity requirements specified by this field cease to be met + // at some point during pod execution (e.g. due to an update), the system + // will try to eventually evict the pod from its node. + // RequiredDuringSchedulingRequiredDuringExecution *NodeSelector `json:"requiredDuringSchedulingRequiredDuringExecution,omitempty"` + + // If the affinity requirements specified by this field are not met at + // scheduling time, the pod will not be scheduled onto the node. + // If the affinity requirements specified by this field cease to be met + // at some point during pod execution (e.g. due to an update), the system + // may or may not try to eventually evict the pod from its node. + RequiredDuringSchedulingIgnoredDuringExecution *NodeSelector `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` + // The scheduler will prefer to schedule pods to nodes that satisfy + // the affinity expressions specified by this field, but it may choose + // a node that violates one or more of the expressions. The node that is + // most preferred is the one with the greatest sum of weights, i.e. + // for each node that meets all of the scheduling requirements (resource + // request, requiredDuringScheduling affinity expressions, etc.), + // compute a sum by iterating through the elements of this field and adding + // "weight" to the sum if the node matches the corresponding matchExpressions; the + // node(s) with the highest sum are the most preferred. + PreferredDuringSchedulingIgnoredDuringExecution []PreferredSchedulingTerm `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"` +} + +// An empty preferred scheduling term matches all objects with implicit weight 0 +// (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). +type PreferredSchedulingTerm struct { + // Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. + Weight int `json:"weight"` + // A node selector term, associated with the corresponding weight. + Preference NodeSelectorTerm `json:"preference"` +} + // PodSpec is a description of a pod type PodSpec struct { Volumes []Volume `json:"volumes"` @@ -998,8 +1228,8 @@ type PodSpec struct { } // PodSecurityContext holds pod-level security attributes and common container settings. -// Some fields are also present in SecurityContext. Field values of SecurityContext take -// precedence over field values of PodSecurityContext. +// Some fields are also present in container.securityContext. Field values of +// container.securityContext take precedence over field values of PodSecurityContext. type PodSecurityContext struct { // Use the host's network namespace. If this option is set, the ports that will be // used must be specified. @@ -1011,12 +1241,6 @@ type PodSecurityContext struct { // Use the host's ipc namespace. // Optional: Default to false. HostIPC bool `json:"hostIPC,omitempty"` - - // SupplementalGroups can be used to specify a list of - // additional groups which the main container process will run - // as. This will be applied to all containers in the pod in - // addition to the primary group of the container. - SupplementalGroups []int64 `json:"supplementalGroups,omitempty"` // The SELinux context to be applied to all containers. // If unspecified, the container runtime will allocate a random SELinux context for each // container. May also be set in SecurityContext. If set in @@ -1036,6 +1260,20 @@ type PodSecurityContext struct { // May also be set in SecurityContext. If set in both SecurityContext and // PodSecurityContext, the value specified in SecurityContext takes precedence. RunAsNonRoot *bool `json:"runAsNonRoot,omitempty"` + // A list of groups applied to the first process run in each container, in addition + // to the container's primary GID. If unspecified, no groups will be added to + // any container. + SupplementalGroups []int64 `json:"supplementalGroups,omitempty"` + // A special supplemental group that applies to all containers in a pod. + // Some volume types allow the Kubelet to change the ownership of that volume + // to be owned by the pod: + // + // 1. The owning GID will be the FSGroup + // 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) + // 3. The permission bits are OR'd with rw-rw---- + // + // If unset, the Kubelet will not modify the ownership and permissions of any volume. + FSGroup *int64 `json:"fsGroup,omitempty"` } // PodStatus represents information about the status of a pod. Status may trail the actual @@ -1072,6 +1310,8 @@ type PodStatusResult struct { Status PodStatus `json:"status,omitempty"` } +// +genclient=true + // Pod is a collection of containers, used as either input (create, update) or as output (list, get). type Pod struct { unversioned.TypeMeta `json:",inline"` @@ -1094,6 +1334,8 @@ type PodTemplateSpec struct { Spec PodSpec `json:"spec,omitempty"` } +// +genclient=true + // PodTemplate describes a template for creating copies of a predefined pod. type PodTemplate struct { unversioned.TypeMeta `json:",inline"` @@ -1129,7 +1371,6 @@ type ReplicationControllerSpec struct { // Template is the object that describes the pod that will be created if // insufficient replicas are detected. Internally, this takes precedence over a // TemplateRef. - // Must be set before converting to a v1beta1 or v1beta2 API object. Template *PodTemplateSpec `json:"template,omitempty"` } @@ -1143,6 +1384,8 @@ type ReplicationControllerStatus struct { ObservedGeneration int64 `json:"observedGeneration,omitempty"` } +// +genclient=true + // ReplicationController represents the configuration of a replication controller. type ReplicationController struct { unversioned.TypeMeta `json:",inline"` @@ -1285,13 +1528,15 @@ type ServicePort struct { // is a string, it will be looked up as a named port in the target // Pod's container ports. If this is not specified, the default value // is the sames as the Port field (an identity map). - TargetPort util.IntOrString `json:"targetPort"` + TargetPort intstr.IntOrString `json:"targetPort"` // The port on each node on which this service is exposed. // Default is to auto-allocate a port if the ServiceType of this Service requires one. NodePort int `json:"nodePort"` } +// +genclient=true + // Service is a named abstraction of software service (for example, mysql) consisting of local port // (for example 3306) that the proxy listens on, and the selector that determines which pods // will answer requests sent through the proxy. @@ -1306,6 +1551,8 @@ type Service struct { Status ServiceStatus `json:"status,omitempty"` } +// +genclient=true + // ServiceAccount binds together: // * a name, understood by users, and perhaps by peripheral systems, for an identity // * a principal that can be authenticated and authorized @@ -1331,6 +1578,8 @@ type ServiceAccountList struct { Items []ServiceAccount `json:"items"` } +// +genclient=true + // Endpoints is a collection of endpoints that implement the actual service. Example: // Name: "mysvc", // Subsets: [ @@ -1438,7 +1687,7 @@ type NodeSystemInfo struct { // Kernel Version reported by the node. KernelVersion string `json:"kernelVersion"` // OS Image reported by the node. - OsImage string `json:"osImage"` + OSImage string `json:"osImage"` // ContainerRuntime Version reported by the node. ContainerRuntimeVersion string `json:"containerRuntimeVersion"` // Kubelet Version reported by the node. @@ -1449,8 +1698,10 @@ type NodeSystemInfo struct { // NodeStatus is information about the current status of a node. type NodeStatus struct { - // Capacity represents the available resources of a node. + // Capacity represents the total resources of a node. Capacity ResourceList `json:"capacity,omitempty"` + // Allocatable represents the resources of a node that are available for scheduling. + Allocatable ResourceList `json:"allocatable,omitempty"` // NodePhase is the current lifecycle phase of the node. Phase NodePhase `json:"phase,omitempty"` // Conditions is an array of current node conditions. @@ -1461,6 +1712,16 @@ type NodeStatus struct { DaemonEndpoints NodeDaemonEndpoints `json:"daemonEndpoints,omitempty"` // Set of ids/uuids to uniquely identify the node. NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"` + // List of container images on this node + Images []ContainerImage `json:"images",omitempty` +} + +// Describe a container image +type ContainerImage struct { + // Names by which this image is known. + RepoTags []string `json:"repoTags"` + // The size of the image in bytes. + Size int64 `json:"size,omitempty"` } type NodePhase string @@ -1483,6 +1744,9 @@ type NodeConditionType string const ( // NodeReady means kubelet is healthy and ready to accept pods. NodeReady NodeConditionType = "Ready" + // NodeOutOfDisk means the kubelet will not accept new pods due to insufficient free disk + // space on the node. + NodeOutOfDisk NodeConditionType = "OutOfDisk" ) type NodeCondition struct { @@ -1533,6 +1797,8 @@ const ( // ResourceList is a set of (resource name, quantity) pairs. type ResourceList map[ResourceName]resource.Quantity +// +genclient=true,nonNamespaced=true + // Node is a worker node in Kubernetes // The name of the node according to etcd is in ObjectMeta.Name. type Node struct { @@ -1583,6 +1849,8 @@ const ( NamespaceTerminating NamespacePhase = "Terminating" ) +// +genclient=true,nonNamespaced=true + // A namespace provides a scope for Names. // Use of multiple namespaces is optional type Namespace struct { @@ -1624,6 +1892,15 @@ type DeleteOptions struct { GracePeriodSeconds *int64 `json:"gracePeriodSeconds"` } +// ExportOptions is the query options to the standard REST get call. +type ExportOptions struct { + unversioned.TypeMeta `json:",inline"` + // Should this value be exported. Export strips fields that a user can not specify. + Export bool `json:"export"` + // Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace' + Exact bool `json:"exact"` +} + // ListOptions is the query options to a standard REST list call, and has future support for // watch calls. type ListOptions struct { @@ -1637,6 +1914,8 @@ type ListOptions struct { Watch bool // The resource version to watch (no effect on list yet) ResourceVersion string + // Timeout for the list/watch call. + TimeoutSeconds *int64 } // PodLogOptions is the query options for a Pod's logs REST call @@ -1761,6 +2040,16 @@ type EventSource struct { Host string `json:"host,omitempty"` } +// Valid values for event types (new types could be added in future) +const ( + // Information only and will not cause any problems + EventTypeNormal string = "Normal" + // These events are to warn that something might go wrong + EventTypeWarning string = "Warning" +) + +// +genclient=true + // Event is a report of an event somewhere in the cluster. // TODO: Decide whether to store these separately or with the object they apply to. type Event struct { @@ -1791,6 +2080,9 @@ type Event struct { // The number of times this event has occurred. Count int `json:"count,omitempty"` + + // Type of this event (Normal, Warning), new types could be added in the future. + Type string `json:"type,omitempty"` } // EventList is a list of events. @@ -1841,6 +2133,8 @@ type LimitRangeSpec struct { Limits []LimitRangeItem `json:"limits"` } +// +genclient=true + // LimitRange sets resource usage limits for each kind of resource in a Namespace type LimitRange struct { unversioned.TypeMeta `json:",inline"` @@ -1889,6 +2183,8 @@ type ResourceQuotaStatus struct { Used ResourceList `json:"used,omitempty"` } +// +genclient=true + // ResourceQuota sets aggregate quota restrictions enforced per namespace type ResourceQuota struct { unversioned.TypeMeta `json:",inline"` @@ -1910,6 +2206,8 @@ type ResourceQuotaList struct { Items []ResourceQuota `json:"items"` } +// +genclient=true + // Secret holds secret data of a certain type. The total bytes of the values in // the Data field must be less than MaxSecretSize bytes. type Secret struct { @@ -1952,6 +2250,8 @@ const ( ServiceAccountKubeconfigKey = "kubernetes.kubeconfig" // ServiceAccountRootCAKey is the key of the optional root certificate authority for SecretTypeServiceAccountToken secrets ServiceAccountRootCAKey = "ca.crt" + // ServiceAccountNamespaceKey is the key of the optional namespace to use as the default for namespaced API calls + ServiceAccountNamespaceKey = "namespace" // SecretTypeDockercfg contains a dockercfg file that follows the same format rules as ~/.dockercfg // @@ -1970,6 +2270,42 @@ const ( // DockerConfigJsonKey is the key of the required data for SecretTypeDockerConfigJson secrets DockerConfigJsonKey = ".dockerconfigjson" + + // SecretTypeBasicAuth contains data needed for basic authentication. + // + // Required at least one of fields: + // - Secret.Data["username"] - username used for authentication + // - Secret.Data["password"] - password or token needed for authentication + SecretTypeBasicAuth SecretType = "kubernetes.io/basic-auth" + + // BasicAuthUsernameKey is the key of the username for SecretTypeBasicAuth secrets + BasicAuthUsernameKey = "username" + // BasicAuthPasswordKey is the key of the password or token for SecretTypeBasicAuth secrets + BasicAuthPasswordKey = "password" + + // SecretTypeSSHAuth contains data needed for SSH authetication. + // + // Required field: + // - Secret.Data["ssh-privatekey"] - private SSH key needed for authentication + SecretTypeSSHAuth SecretType = "kubernetes.io/ssh-auth" + + // SSHAuthPrivateKey is the key of the required SSH private key for SecretTypeSSHAuth secrets + SSHAuthPrivateKey = "ssh-privatekey" + + // SecretTypeTLS contains information about a TLS client or server secret. It + // is primarily used with TLS termination of the Ingress resource, but may be + // used in other types. + // + // Required fields: + // - Secret.Data["tls.key"] - TLS private key. + // Secret.Data["tls.crt"] - TLS certificate. + // TODO: Consider supporting different formats, specifying CA/destinationCA. + SecretTypeTLS SecretType = "kubernetes.io/tls" + + // TLSCertKey is the key for tls certificates in a TLS secert. + TLSCertKey = "tls.crt" + // TLSPrivateKeyKey is the key for the private key field in a TLS secret. + TLSPrivateKeyKey = "tls.key" ) type SecretList struct { @@ -1979,6 +2315,27 @@ type SecretList struct { Items []Secret `json:"items"` } +// +genclient=true + +// ConfigMap holds configuration data for components or applications to consume. +type ConfigMap struct { + unversioned.TypeMeta `json:",inline"` + ObjectMeta `json:"metadata,omitempty"` + + // Data contains the configuration data. + // Each key must be a valid DNS_SUBDOMAIN with an optional leading dot. + Data map[string]string `json:"data,omitempty"` +} + +// ConfigMapList is a resource containing a list of ConfigMap objects. +type ConfigMapList struct { + unversioned.TypeMeta `json:",inline"` + unversioned.ListMeta `json:"metadata,omitempty"` + + // Items is the list of ConfigMaps. + Items []ConfigMap `json:"items,omitempty"` +} + // These constants are for remote command execution and port forwarding and are // used by both the client side and server side components. // @@ -2044,6 +2401,8 @@ type ComponentCondition struct { Error string `json:"error,omitempty"` } +// +genclient=true,nonNamespaced=true + // ComponentStatus (and ComponentStatusList) holds the cluster validation info. type ComponentStatus struct { unversioned.TypeMeta `json:",inline"` @@ -2087,6 +2446,9 @@ type SecurityContext struct { // May also be set in PodSecurityContext. If set in both SecurityContext and // PodSecurityContext, the value specified in SecurityContext takes precedence. RunAsNonRoot *bool `json:"runAsNonRoot,omitempty"` + // The read-only root filesystem allows you to restrict the locations that an application can write + // files to, ensuring the persistent data can only be written to mounts. + ReadOnlyRootFilesystem *bool `json:"readOnlyRootFilesystem,omitempty"` } // SELinuxOptions are the labels to be applied to the container. @@ -2121,3 +2483,8 @@ type RangeAllocation struct { // a single allocated address (the fifth bit on CIDR 10.0.0.0/8 is 10.0.0.4). Data []byte `json:"data"` } + +const ( + // "default-scheduler" is the name of default scheduler. + DefaultSchedulerName = "default-scheduler" +) diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/duration.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/duration.go index d9209f2c3..6ff634ee5 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/unversioned/duration.go +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/duration.go @@ -43,5 +43,5 @@ func (d *Duration) UnmarshalJSON(b []byte) error { // MarshalJSON implements the json.Marshaler interface. func (d Duration) MarshalJSON() ([]byte, error) { - return json.Marshal(d.String()) + return json.Marshal(d.Duration.String()) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/group_version.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/group_version.go new file mode 100644 index 000000000..dc1dc9672 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/group_version.go @@ -0,0 +1,266 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "encoding/json" + "fmt" + "strings" +) + +// GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying +// concepts during lookup stages without having partially valid types +// +// +protobuf.options.(gogoproto.goproto_stringer)=false +type GroupResource struct { + Group string + Resource string +} + +func (gr GroupResource) WithVersion(version string) GroupVersionResource { + return GroupVersionResource{Group: gr.Group, Version: version, Resource: gr.Resource} +} + +func (gr GroupResource) IsEmpty() bool { + return len(gr.Group) == 0 && len(gr.Resource) == 0 +} + +func (gr *GroupResource) String() string { + if len(gr.Group) == 0 { + return gr.Resource + } + return gr.Resource + "." + gr.Group +} + +// GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion +// to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling +// +// +protobuf.options.(gogoproto.goproto_stringer)=false +type GroupVersionResource struct { + Group string + Version string + Resource string +} + +func (gvr GroupVersionResource) IsEmpty() bool { + return len(gvr.Group) == 0 && len(gvr.Version) == 0 && len(gvr.Resource) == 0 +} + +func (gvr GroupVersionResource) GroupResource() GroupResource { + return GroupResource{Group: gvr.Group, Resource: gvr.Resource} +} + +func (gvr GroupVersionResource) GroupVersion() GroupVersion { + return GroupVersion{Group: gvr.Group, Version: gvr.Version} +} + +func (gvr *GroupVersionResource) String() string { + return strings.Join([]string{gvr.Group, "/", gvr.Version, ", Resource=", gvr.Resource}, "") +} + +// GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying +// concepts during lookup stages without having partially valid types +// +// +protobuf.options.(gogoproto.goproto_stringer)=false +type GroupKind struct { + Group string + Kind string +} + +func (gk GroupKind) IsEmpty() bool { + return len(gk.Group) == 0 && len(gk.Kind) == 0 +} + +func (gk GroupKind) WithVersion(version string) GroupVersionKind { + return GroupVersionKind{Group: gk.Group, Version: version, Kind: gk.Kind} +} + +func (gk *GroupKind) String() string { + if len(gk.Group) == 0 { + return gk.Kind + } + return gk.Kind + "." + gk.Group +} + +// GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion +// to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling +// +// +protobuf.options.(gogoproto.goproto_stringer)=false +type GroupVersionKind struct { + Group string + Version string + Kind string +} + +// IsEmpty returns true if group, version, and kind are empty +func (gvk GroupVersionKind) IsEmpty() bool { + return len(gvk.Group) == 0 && len(gvk.Version) == 0 && len(gvk.Kind) == 0 +} + +func (gvk GroupVersionKind) GroupKind() GroupKind { + return GroupKind{Group: gvk.Group, Kind: gvk.Kind} +} + +func (gvk GroupVersionKind) GroupVersion() GroupVersion { + return GroupVersion{Group: gvk.Group, Version: gvk.Version} +} + +func (gvk GroupVersionKind) String() string { + return gvk.Group + "/" + gvk.Version + ", Kind=" + gvk.Kind +} + +// GroupVersion contains the "group" and the "version", which uniquely identifies the API. +// +// +protobuf.options.(gogoproto.goproto_stringer)=false +type GroupVersion struct { + Group string + Version string +} + +// IsEmpty returns true if group and version are empty +func (gv GroupVersion) IsEmpty() bool { + return len(gv.Group) == 0 && len(gv.Version) == 0 +} + +// String puts "group" and "version" into a single "group/version" string. For the legacy v1 +// it returns "v1". +func (gv GroupVersion) String() string { + // special case the internal apiVersion for the legacy kube types + if gv.IsEmpty() { + return "" + } + + // special case of "v1" for backward compatibility + if len(gv.Group) == 0 && gv.Version == "v1" { + return gv.Version + } + if len(gv.Group) > 0 { + return gv.Group + "/" + gv.Version + } + return gv.Version +} + +// ParseGroupVersion turns "group/version" string into a GroupVersion struct. It reports error +// if it cannot parse the string. +func ParseGroupVersion(gv string) (GroupVersion, error) { + // this can be the internal version for the legacy kube types + // TODO once we've cleared the last uses as strings, this special case should be removed. + if (len(gv) == 0) || (gv == "/") { + return GroupVersion{}, nil + } + + s := strings.Split(gv, "/") + // "v1" is the only special case. Otherwise GroupVersion is expected to contain + // one "/" dividing the string into two parts. + switch { + case len(s) == 1 && gv == "v1": + return GroupVersion{"", "v1"}, nil + case len(s) == 1: + return GroupVersion{"", s[0]}, nil + case len(s) == 2: + return GroupVersion{s[0], s[1]}, nil + default: + return GroupVersion{}, fmt.Errorf("Unexpected GroupVersion string: %v", gv) + } +} + +// WithKind creates a GroupVersionKind based on the method receiver's GroupVersion and the passed Kind. +func (gv GroupVersion) WithKind(kind string) GroupVersionKind { + return GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: kind} +} + +// WithResource creates a GroupVersionResource based on the method receiver's GroupVersion and the passed Resource. +func (gv GroupVersion) WithResource(resource string) GroupVersionResource { + return GroupVersionResource{Group: gv.Group, Version: gv.Version, Resource: resource} +} + +// MarshalJSON implements the json.Marshaller interface. +func (gv GroupVersion) MarshalJSON() ([]byte, error) { + s := gv.String() + if strings.Count(s, "/") > 1 { + return []byte{}, fmt.Errorf("illegal GroupVersion %v: contains more than one /", s) + } + return json.Marshal(s) +} + +func (gv *GroupVersion) unmarshal(value []byte) error { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + parsed, err := ParseGroupVersion(s) + if err != nil { + return err + } + *gv = parsed + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface. +func (gv *GroupVersion) UnmarshalJSON(value []byte) error { + return gv.unmarshal(value) +} + +// UnmarshalTEXT implements the Ugorji's encoding.TextUnmarshaler interface. +func (gv *GroupVersion) UnmarshalText(value []byte) error { + return gv.unmarshal(value) +} + +// ToAPIVersionAndKind is a convenience method for satisfying runtime.Object on types that +// do not use TypeMeta. +func (gvk *GroupVersionKind) ToAPIVersionAndKind() (string, string) { + if gvk == nil { + return "", "" + } + return gvk.GroupVersion().String(), gvk.Kind +} + +// FromAPIVersionAndKind returns a GVK representing the provided fields for types that +// do not use TypeMeta. This method exists to support test types and legacy serializations +// that have a distinct group and kind. +// TODO: further reduce usage of this method. +func FromAPIVersionAndKind(apiVersion, kind string) *GroupVersionKind { + if gv, err := ParseGroupVersion(apiVersion); err == nil { + return &GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: kind} + } + return &GroupVersionKind{Kind: kind} +} + +// All objects that are serialized from a Scheme encode their type information. This interface is used +// by serialization to set type information from the Scheme onto the serialized version of an object. +// For objects that cannot be serialized or have unique requirements, this interface may be a no-op. +// TODO: this belongs in pkg/runtime, move unversioned.GVK into runtime. +type ObjectKind interface { + // SetGroupVersionKind sets or clears the intended serialized kind of an object. Passing kind nil + // should clear the current setting. + SetGroupVersionKind(kind *GroupVersionKind) + // GroupVersionKind returns the stored group, version, and kind of an object, or nil if the object does + // not expose or provide these fields. + GroupVersionKind() *GroupVersionKind +} + +// EmptyObjectKind implements the ObjectKind interface as a noop +// TODO: this belongs in pkg/runtime, move unversioned.GVK into runtime. +var EmptyObjectKind = emptyObjectKind{} + +type emptyObjectKind struct{} + +// SetGroupVersionKind implements the ObjectKind interface +func (emptyObjectKind) SetGroupVersionKind(gvk *GroupVersionKind) {} + +// GroupVersionKind implements the ObjectKind interface +func (emptyObjectKind) GroupVersionKind() *GroupVersionKind { return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/group_version_test.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/group_version_test.go new file mode 100644 index 000000000..4a26fbb10 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/group_version_test.go @@ -0,0 +1,78 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "encoding/json" + "reflect" + "testing" + + "github.com/ugorji/go/codec" +) + +type GroupVersionHolder struct { + GV GroupVersion `json:"val"` +} + +func TestGroupVersionUnmarshalJSON(t *testing.T) { + cases := []struct { + input []byte + expect GroupVersion + }{ + {[]byte(`{"val": "v1"}`), GroupVersion{"", "v1"}}, + {[]byte(`{"val": "extensions/v1beta1"}`), GroupVersion{"extensions", "v1beta1"}}, + } + + for _, c := range cases { + var result GroupVersionHolder + // test golang lib's JSON codec + if err := json.Unmarshal([]byte(c.input), &result); err != nil { + t.Errorf("JSON codec failed to unmarshal input '%v': %v", c.input, err) + } + if !reflect.DeepEqual(result.GV, c.expect) { + t.Errorf("JSON codec failed to unmarshal input '%s': expected %+v, got %+v", c.input, c.expect, result.GV) + } + // test the Ugorji codec + if err := codec.NewDecoderBytes(c.input, new(codec.JsonHandle)).Decode(&result); err != nil { + t.Errorf("Ugorji codec failed to unmarshal input '%v': %v", c.input, err) + } + if !reflect.DeepEqual(result.GV, c.expect) { + t.Errorf("Ugorji codec failed to unmarshal input '%s': expected %+v, got %+v", c.input, c.expect, result.GV) + } + } +} + +func TestGroupVersionMarshalJSON(t *testing.T) { + cases := []struct { + input GroupVersion + expect []byte + }{ + {GroupVersion{"", "v1"}, []byte(`{"val":"v1"}`)}, + {GroupVersion{"extensions", "v1beta1"}, []byte(`{"val":"extensions/v1beta1"}`)}, + } + + for _, c := range cases { + input := GroupVersionHolder{c.input} + result, err := json.Marshal(&input) + if err != nil { + t.Errorf("Failed to marshal input '%v': %v", input, err) + } + if !reflect.DeepEqual(result, c.expect) { + t.Errorf("Failed to marshal input '%+v': expected: %s, got: %s", input, c.expect, result) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/helpers.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/helpers.go new file mode 100644 index 000000000..b26948b4d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/helpers.go @@ -0,0 +1,94 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "fmt" + + "k8s.io/kubernetes/pkg/labels" + "k8s.io/kubernetes/pkg/util/sets" +) + +// LabelSelectorAsSelector converts the LabelSelector api type into a struct that implements +// labels.Selector +func LabelSelectorAsSelector(ps *LabelSelector) (labels.Selector, error) { + if ps == nil { + return labels.Nothing(), nil + } + if len(ps.MatchLabels)+len(ps.MatchExpressions) == 0 { + return labels.Everything(), nil + } + selector := labels.NewSelector() + for k, v := range ps.MatchLabels { + r, err := labels.NewRequirement(k, labels.InOperator, sets.NewString(v)) + if err != nil { + return nil, err + } + selector = selector.Add(*r) + } + for _, expr := range ps.MatchExpressions { + var op labels.Operator + switch expr.Operator { + case LabelSelectorOpIn: + op = labels.InOperator + case LabelSelectorOpNotIn: + op = labels.NotInOperator + case LabelSelectorOpExists: + op = labels.ExistsOperator + case LabelSelectorOpDoesNotExist: + op = labels.DoesNotExistOperator + default: + return nil, fmt.Errorf("%q is not a valid pod selector operator", expr.Operator) + } + r, err := labels.NewRequirement(expr.Key, op, sets.NewString(expr.Values...)) + if err != nil { + return nil, err + } + selector = selector.Add(*r) + } + return selector, nil +} + +// SetAsLabelSelector converts the labels.Set object into a LabelSelector api object. +func SetAsLabelSelector(ls labels.Set) *LabelSelector { + if ls == nil { + return nil + } + + selector := &LabelSelector{ + MatchLabels: make(map[string]string), + } + for label, value := range ls { + selector.MatchLabels[label] = value + } + + return selector +} + +// FormatLabelSelector convert labelSelector into plain string +func FormatLabelSelector(labelSelector *LabelSelector) string { + selector, err := LabelSelectorAsSelector(labelSelector) + if err != nil { + return "" + } + + l := selector.String() + if len(l) == 0 { + l = "" + } + return l +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/helpers_test.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/helpers_test.go similarity index 70% rename from vendor/k8s.io/kubernetes/pkg/apis/extensions/helpers_test.go rename to vendor/k8s.io/kubernetes/pkg/api/unversioned/helpers_test.go index 866230bfc..334c78597 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/helpers_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/helpers_test.go @@ -1,5 +1,5 @@ /* -Copyright 2015 The Kubernetes Authors All rights reserved. +Copyright 2016 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package extensions +package unversioned import ( "reflect" @@ -23,11 +23,11 @@ import ( "k8s.io/kubernetes/pkg/labels" ) -func TestPodSelectorAsSelector(t *testing.T) { +func TestLabelSelectorAsSelector(t *testing.T) { matchLabels := map[string]string{"foo": "bar"} - matchExpressions := []PodSelectorRequirement{{ + matchExpressions := []LabelSelectorRequirement{{ Key: "baz", - Operator: PodSelectorOpIn, + Operator: LabelSelectorOpIn, Values: []string{"qux", "norf"}, }} mustParse := func(s string) labels.Selector { @@ -38,29 +38,29 @@ func TestPodSelectorAsSelector(t *testing.T) { return out } tc := []struct { - in *PodSelector + in *LabelSelector out labels.Selector expectErr bool }{ {in: nil, out: labels.Nothing()}, - {in: &PodSelector{}, out: labels.Everything()}, + {in: &LabelSelector{}, out: labels.Everything()}, { - in: &PodSelector{MatchLabels: matchLabels}, + in: &LabelSelector{MatchLabels: matchLabels}, out: mustParse("foo in (bar)"), }, { - in: &PodSelector{MatchExpressions: matchExpressions}, + in: &LabelSelector{MatchExpressions: matchExpressions}, out: mustParse("baz in (norf,qux)"), }, { - in: &PodSelector{MatchLabels: matchLabels, MatchExpressions: matchExpressions}, + in: &LabelSelector{MatchLabels: matchLabels, MatchExpressions: matchExpressions}, out: mustParse("foo in (bar),baz in (norf,qux)"), }, { - in: &PodSelector{ - MatchExpressions: []PodSelectorRequirement{{ + in: &LabelSelector{ + MatchExpressions: []LabelSelectorRequirement{{ Key: "baz", - Operator: PodSelectorOpExists, + Operator: LabelSelectorOpExists, Values: []string{"qux", "norf"}, }}, }, @@ -69,7 +69,7 @@ func TestPodSelectorAsSelector(t *testing.T) { } for i, tc := range tc { - out, err := PodSelectorAsSelector(tc.in) + out, err := LabelSelectorAsSelector(tc.in) if err == nil && tc.expectErr { t.Errorf("[%v]expected error but got none.", i) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/register.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/register.go new file mode 100644 index 000000000..babc21dfe --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/register.go @@ -0,0 +1,42 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = GroupVersion{Group: "", Version: ""} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// SetGroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta +func (obj *TypeMeta) SetGroupVersionKind(gvk *GroupVersionKind) { + obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() +} + +// GroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta +func (obj *TypeMeta) GroupVersionKind() *GroupVersionKind { + return FromAPIVersionAndKind(obj.APIVersion, obj.Kind) +} + +func (obj *Status) GetObjectKind() ObjectKind { return &obj.TypeMeta } +func (obj *APIVersions) GetObjectKind() ObjectKind { return &obj.TypeMeta } +func (obj *APIGroupList) GetObjectKind() ObjectKind { return &obj.TypeMeta } +func (obj *APIGroup) GetObjectKind() ObjectKind { return &obj.TypeMeta } +func (obj *APIResourceList) GetObjectKind() ObjectKind { return &obj.TypeMeta } +func (obj *ExportOptions) GetObjectKind() ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/time.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/time.go index bc403e55d..4072833d9 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/unversioned/time.go +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/time.go @@ -26,8 +26,10 @@ import ( // Time is a wrapper around time.Time which supports correct // marshaling to YAML and JSON. Wrappers are provided for many // of the factory methods that the time package offers. +// +// +protobuf.options.marshal=false type Time struct { - time.Time + time.Time `protobuf:"Timestamp,1,req,name=time"` } // NewTime returns a wrapped instance of the provided time diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/time_proto.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/time_proto.go new file mode 100644 index 000000000..6d6fe5d4e --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/time_proto.go @@ -0,0 +1,80 @@ +// +build proto + +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "time" +) + +// ProtoTime is a struct that is equivalent to Time, but intended for +// protobuf marshalling/unmarshalling. It is generated into a serialization +// that matches Time. Do not use in Go structs. +type ProtoTime struct { + // Represents the time of an event. + Timestamp Timestamp `json:"timestamp"` +} + +// Timestamp is a protobuf Timestamp compatible representation of time.Time +type Timestamp struct { + // Represents seconds of UTC time since Unix epoch + // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to + // 9999-12-31T23:59:59Z inclusive. + Seconds int64 `json:"seconds"` + // Non-negative fractions of a second at nanosecond resolution. Negative + // second values with fractions must still have non-negative nanos values + // that count forward in time. Must be from 0 to 999,999,999 + // inclusive. + Nanos int32 `json:"nanos"` +} + +// ProtoTime returns the Time as a new ProtoTime value. +func (m *Time) ProtoTime() *ProtoTime { + if m == nil { + return &ProtoTime{} + } + return &ProtoTime{ + Timestamp: Timestamp{ + Seconds: m.Time.Unix(), + Nanos: int32(m.Time.Nanosecond()), + }, + } +} + +// Size implements the protobuf marshalling interface. +func (m *Time) Size() (n int) { return m.ProtoTime().Size() } + +// Reset implements the protobuf marshalling interface. +func (m *Time) Unmarshal(data []byte) error { + p := ProtoTime{} + if err := p.Unmarshal(data); err != nil { + return err + } + m.Time = time.Unix(p.Timestamp.Seconds, int64(p.Timestamp.Nanos)) + return nil +} + +// Marshal implements the protobuf marshalling interface. +func (m *Time) Marshal() (data []byte, err error) { + return m.ProtoTime().Marshal() +} + +// MarshalTo implements the protobuf marshalling interface. +func (m *Time) MarshalTo(data []byte) (int, error) { + return m.ProtoTime().MarshalTo(data) +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/types.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/types.go index 809c58518..715444931 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/unversioned/types.go +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/types.go @@ -15,6 +15,14 @@ limitations under the License. */ // Package unversioned contains API types that are common to all versions. +// +// The package contains two categories of types: +// - external (serialized) types that lack their own version (e.g TypeMeta) +// - internal (never-serialized) types that are needed by several different +// api groups, and so live here, to avoid duplication and/or import loops +// (e.g. LabelSelector). +// In the future, we will probably move these categories of objects into +// separate packages. package unversioned import "strings" @@ -54,6 +62,15 @@ type ListMeta struct { ResourceVersion string `json:"resourceVersion,omitempty"` } +// ExportOptions is the query options to the standard REST get call. +type ExportOptions struct { + TypeMeta `json:",inline"` + // Should this value be exported. Export strips fields that a user can not specify.` + Export bool `json:"export"` + // Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace' + Exact bool `json:"exact"` +} + // Status is a return value for calls that don't return other objects. type Status struct { TypeMeta `json:",inline"` @@ -78,7 +95,7 @@ type Status struct { // the reason type. Details *StatusDetails `json:"details,omitempty"` // Suggested HTTP return code for this status, 0 if not set. - Code int `json:"code,omitempty"` + Code int32 `json:"code,omitempty"` } // StatusDetails is a set of additional properties that MAY be set by the @@ -91,6 +108,8 @@ type StatusDetails struct { // The name attribute of the resource associated with the status StatusReason // (when there is a single name which can be described). Name string `json:"name,omitempty"` + // The group attribute of the resource associated with the status StatusReason. + Group string `json:"group,omitempty"` // The kind attribute of the resource associated with the status StatusReason. // On some operations may differ from the requested resource Kind. // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds @@ -99,7 +118,7 @@ type StatusDetails struct { // failure. Not all StatusReasons may provide detailed causes. Causes []StatusCause `json:"causes,omitempty"` // If specified, the time in seconds before the operation should be retried. - RetryAfterSeconds int `json:"retryAfterSeconds,omitempty"` + RetryAfterSeconds int32 `json:"retryAfterSeconds,omitempty"` } // Values of Status.Status @@ -162,6 +181,11 @@ const ( // Status code 409 StatusReasonConflict StatusReason = "Conflict" + // StatusReasonGone means the item is no longer available at the server and no + // forwarding address is known. + // Status code 410 + StatusReasonGone StatusReason = "Gone" + // StatusReasonInvalid means the requested create or update operation cannot be // completed due to invalid data provided as part of the request. The client may // need to alter the request. When set, the client may use the StatusDetails @@ -183,7 +207,7 @@ const ( // Details (optional): // "kind" string - the kind attribute of the resource being acted on. // "id" string - the operation that is being attempted. - // "retryAfterSeconds" int - the number of seconds before the operation should be retried + // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried // Status code 500 StatusReasonServerTimeout StatusReason = "ServerTimeout" @@ -193,7 +217,7 @@ const ( // The request might succeed with an increased value of timeout param. The client *should* // wait at least the number of seconds specified by the retryAfterSeconds field. // Details (optional): - // "retryAfterSeconds" int - the number of seconds before the operation should be retried + // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried // Status code 504 StatusReasonTimeout StatusReason = "Timeout" @@ -213,7 +237,13 @@ const ( // Details (optional): // "causes" - The original error // Status code 500 - StatusReasonInternalError = "InternalError" + StatusReasonInternalError StatusReason = "InternalError" + + // StatusReasonExpired indicates that the request is invalid because the content you are requesting + // has expired and is no longer available. It is typically associated with watches that can't be + // serviced. + // Status code 410 (gone) + StatusReasonExpired StatusReason = "Expired" // StatusReasonServiceUnavailable means that the request itself was valid, // but the requested service is unavailable at this time. @@ -270,11 +300,12 @@ const ( CauseTypeUnexpectedServerResponse CauseType = "UnexpectedServerResponse" ) -func (*Status) IsAnAPIObject() {} - // APIVersions lists the versions that are available, to allow clients to // discover the API at /api, which is the root path of the legacy v1 API. +// +// +protobuf.options.(gogoproto.goproto_stringer)=false type APIVersions struct { + TypeMeta `json:",inline"` // versions are the api versions that are available. Versions []string `json:"versions"` } @@ -282,6 +313,7 @@ type APIVersions struct { // APIGroupList is a list of APIGroup, to allow clients to discover the API at // /apis. type APIGroupList struct { + TypeMeta `json:",inline"` // groups is a list of APIGroup. Groups []APIGroup `json:"groups"` } @@ -289,18 +321,19 @@ type APIGroupList struct { // APIGroup contains the name, the supported versions, and the preferred version // of a group. type APIGroup struct { + TypeMeta `json:",inline"` // name is the name of the group. Name string `json:"name"` // versions are the versions supported in this group. - Versions []GroupVersion `json:"versions"` + Versions []GroupVersionForDiscovery `json:"versions"` // preferredVersion is the version preferred by the API server, which // probably is the storage version. - PreferredVersion GroupVersion `json:"preferredVersion,omitempty"` + PreferredVersion GroupVersionForDiscovery `json:"preferredVersion,omitempty"` } // GroupVersion contains the "group/version" and "version" string of a version. // It is made a struct to keep extensiblity. -type GroupVersion struct { +type GroupVersionForDiscovery struct { // groupVersion specifies the API group and version in the form "group/version" GroupVersion string `json:"groupVersion"` // version specifies the version in the form of "version". This is to save @@ -314,12 +347,15 @@ type APIResource struct { Name string `json:"name"` // namespaced indicates if a resource is namespaced or not. Namespaced bool `json:"namespaced"` + // kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo') + Kind string `json:"kind"` } // APIResourceList is a list of APIResource, it is used to expose the name of the // resources supported in a specific group and version, and if the resource // is namespaced. type APIResourceList struct { + TypeMeta `json:",inline"` // groupVersion is the group and version this APIResourceList is for. GroupVersion string `json:"groupVersion"` // resources contains the name of the resources and if they are namespaced. @@ -354,3 +390,46 @@ func (apiVersions APIVersions) GoString() string { // Patch is provided to give a concrete name and type to the Kubernetes PATCH request body. type Patch struct{} + +// Note: +// There are two different styles of label selectors used in versioned types: +// an older style which is represented as just a string in versioned types, and a +// newer style that is structured. LabelSelector is an internal representation for the +// latter style. + +// A label selector is a label query over a set of resources. The result of matchLabels and +// matchExpressions are ANDed. An empty label selector matches all objects. A null +// label selector matches no objects. +type LabelSelector struct { + // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + // map is equivalent to an element of matchExpressions, whose key field is "key", the + // operator is "In", and the values array contains only "value". The requirements are ANDed. + MatchLabels map[string]string `json:"matchLabels,omitempty"` + // matchExpressions is a list of label selector requirements. The requirements are ANDed. + MatchExpressions []LabelSelectorRequirement `json:"matchExpressions,omitempty"` +} + +// A label selector requirement is a selector that contains values, a key, and an operator that +// relates the key and values. +type LabelSelectorRequirement struct { + // key is the label key that the selector applies to. + Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key"` + // operator represents a key's relationship to a set of values. + // Valid operators ard In, NotIn, Exists and DoesNotExist. + Operator LabelSelectorOperator `json:"operator"` + // values is an array of string values. If the operator is In or NotIn, + // the values array must be non-empty. If the operator is Exists or DoesNotExist, + // the values array must be empty. This array is replaced during a strategic + // merge patch. + Values []string `json:"values,omitempty"` +} + +// A label selector operator is the set of operators that can be used in a selector requirement. +type LabelSelectorOperator string + +const ( + LabelSelectorOpIn LabelSelectorOperator = "In" + LabelSelectorOpNotIn LabelSelectorOperator = "NotIn" + LabelSelectorOpExists LabelSelectorOperator = "Exists" + LabelSelectorOpDoesNotExist LabelSelectorOperator = "DoesNotExist" +) diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/types_swagger_doc_generated.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/types_swagger_doc_generated.go index cf9ad3f41..a65e88931 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/unversioned/types_swagger_doc_generated.go +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/types_swagger_doc_generated.go @@ -51,6 +51,7 @@ var map_APIResource = map[string]string{ "": "APIResource specifies the name of a resource and whether it is namespaced.", "name": "name is the name of the resource.", "namespaced": "namespaced indicates if a resource is namespaced or not.", + "kind": "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')", } func (APIResource) SwaggerDoc() map[string]string { @@ -76,14 +77,45 @@ func (APIVersions) SwaggerDoc() map[string]string { return map_APIVersions } -var map_GroupVersion = map[string]string{ +var map_ExportOptions = map[string]string{ + "": "ExportOptions is the query options to the standard REST get call.", + "export": "Should this value be exported. Export strips fields that a user can not specify.`", + "exact": "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'", +} + +func (ExportOptions) SwaggerDoc() map[string]string { + return map_ExportOptions +} + +var map_GroupVersionForDiscovery = map[string]string{ "": "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensiblity.", "groupVersion": "groupVersion specifies the API group and version in the form \"group/version\"", "version": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.", } -func (GroupVersion) SwaggerDoc() map[string]string { - return map_GroupVersion +func (GroupVersionForDiscovery) SwaggerDoc() map[string]string { + return map_GroupVersionForDiscovery +} + +var map_LabelSelector = map[string]string{ + "": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + "matchLabels": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", + "matchExpressions": "matchExpressions is a list of label selector requirements. The requirements are ANDed.", +} + +func (LabelSelector) SwaggerDoc() map[string]string { + return map_LabelSelector +} + +var map_LabelSelectorRequirement = map[string]string{ + "": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "key": "key is the label key that the selector applies to.", + "operator": "operator represents a key's relationship to a set of values. Valid operators ard In, NotIn, Exists and DoesNotExist.", + "values": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", +} + +func (LabelSelectorRequirement) SwaggerDoc() map[string]string { + return map_LabelSelectorRequirement } var map_ListMeta = map[string]string{ @@ -141,6 +173,7 @@ func (StatusCause) SwaggerDoc() map[string]string { var map_StatusDetails = map[string]string{ "": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.", "name": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).", + "group": "The group attribute of the resource associated with the status StatusReason.", "kind": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds", "causes": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.", "retryAfterSeconds": "If specified, the time in seconds before the operation should be retried.", diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/validation/validation.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/validation/validation.go new file mode 100644 index 000000000..f42f37b04 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/validation/validation.go @@ -0,0 +1,53 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + apivalidation "k8s.io/kubernetes/pkg/api/validation" + "k8s.io/kubernetes/pkg/util/validation/field" +) + +func ValidateLabelSelector(ps *unversioned.LabelSelector, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if ps == nil { + return allErrs + } + allErrs = append(allErrs, apivalidation.ValidateLabels(ps.MatchLabels, fldPath.Child("matchLabels"))...) + for i, expr := range ps.MatchExpressions { + allErrs = append(allErrs, ValidateLabelSelectorRequirement(expr, fldPath.Child("matchExpressions").Index(i))...) + } + return allErrs +} + +func ValidateLabelSelectorRequirement(sr unversioned.LabelSelectorRequirement, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + switch sr.Operator { + case unversioned.LabelSelectorOpIn, unversioned.LabelSelectorOpNotIn: + if len(sr.Values) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified when `operator` is 'In' or 'NotIn'")) + } + case unversioned.LabelSelectorOpExists, unversioned.LabelSelectorOpDoesNotExist: + if len(sr.Values) > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("values"), "may not be specified when `operator` is 'Exists' or 'DoesNotExist'")) + } + default: + allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), sr.Operator, "not a valid selector operator")) + } + allErrs = append(allErrs, apivalidation.ValidateLabelName(sr.Key, fldPath.Child("key"))...) + return allErrs +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/unversioned/well_known_labels.go b/vendor/k8s.io/kubernetes/pkg/api/unversioned/well_known_labels.go new file mode 100644 index 000000000..0815e8083 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/unversioned/well_known_labels.go @@ -0,0 +1,21 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +const LabelZoneFailureDomain = "failure-domain.alpha.kubernetes.io/zone" +const LabelZoneRegion = "failure-domain.alpha.kubernetes.io/region" +const LabelInstanceType = "beta.kubernetes.io/instance-type" diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/backward_compatibility_test.go b/vendor/k8s.io/kubernetes/pkg/api/v1/backward_compatibility_test.go index 0bcfa3e31..2ef3d926f 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/backward_compatibility_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/backward_compatibility_test.go @@ -21,9 +21,10 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testing/compat" + "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/api/validation" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/validation/field" ) func TestCompatibility_v1_PodSecurityContext(t *testing.T) { @@ -153,14 +154,76 @@ func TestCompatibility_v1_PodSecurityContext(t *testing.T) { "spec.hostPID", }, }, + { + name: "reseting defaults for pre-v1.1 mirror pods", + input: ` +{ + "kind":"Pod", + "apiVersion":"v1", + "metadata":{ + "name":"my-pod-name", + "namespace":"my-pod-namespace", + "annotations": { + "kubernetes.io/config.mirror": "mirror" + } + }, + "spec": { + "containers":[{ + "name":"a", + "image":"my-container-image", + "resources": { + "limits": { + "cpu": "100m" + } + } + }] + } +} +`, + absentKeys: []string{ + "spec.terminationGracePeriodSeconds", + "spec.containers[0].resources.requests", + }, + }, + { + name: "preserving defaults for v1.1+ mirror pods", + input: ` + { + "kind":"Pod", + "apiVersion":"v1", + "metadata":{ + "name":"my-pod-name", + "namespace":"my-pod-namespace", + "annotations": { + "kubernetes.io/config.mirror": "cbe924f710c7e26f7693d6a341bcfad0" + } + }, + "spec": { + "containers":[{ + "name":"a", + "image":"my-container-image", + "resources": { + "limits": { + "cpu": "100m" + } + } + }] + } + } + `, + expectedKeys: map[string]string{ + "spec.terminationGracePeriodSeconds": "30", + "spec.containers[0].resources.requests": "map[cpu:100m]", + }, + }, } - validator := func(obj runtime.Object) fielderrors.ValidationErrorList { - return validation.ValidatePodSpec(&(obj.(*api.Pod).Spec)) + validator := func(obj runtime.Object) field.ErrorList { + return validation.ValidatePodSpec(&(obj.(*api.Pod).Spec), field.NewPath("spec")) } for _, tc := range cases { t.Logf("Testing 1.0.0 backward compatibility for %v", tc.name) - compat.TestCompatibility(t, "v1", []byte(tc.input), validator, tc.expectedKeys, tc.absentKeys) + compat.TestCompatibility(t, v1.SchemeGroupVersion, []byte(tc.input), validator, tc.expectedKeys, tc.absentKeys) } } diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/conversion.go b/vendor/k8s.io/kubernetes/pkg/api/v1/conversion.go index c19117f78..1a4d36d43 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/conversion.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/conversion.go @@ -22,23 +22,61 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/conversion" + "k8s.io/kubernetes/pkg/runtime" + "speter.net/go/exp/math/dec/inf" ) -func addConversionFuncs() { +const ( + // Annotation key used to identify mirror pods. + mirrorAnnotationKey = "kubernetes.io/config.mirror" + + // Value used to identify mirror pods from pre-v1.1 kubelet. + mirrorAnnotationValue_1_0 = "mirror" +) + +func addConversionFuncs(scheme *runtime.Scheme) { // Add non-generated conversion functions - err := api.Scheme.AddConversionFuncs( - convert_api_PodSpec_To_v1_PodSpec, - convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec, - convert_api_ServiceSpec_To_v1_ServiceSpec, - convert_v1_PodSpec_To_api_PodSpec, - convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec, - convert_v1_ServiceSpec_To_api_ServiceSpec, + err := scheme.AddConversionFuncs( + Convert_api_Pod_To_v1_Pod, + Convert_api_PodSpec_To_v1_PodSpec, + Convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec, + Convert_api_ServiceSpec_To_v1_ServiceSpec, + Convert_v1_Pod_To_api_Pod, + Convert_v1_PodSpec_To_api_PodSpec, + Convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec, + Convert_v1_ServiceSpec_To_api_ServiceSpec, + Convert_v1_ResourceList_To_api_ResourceList, ) if err != nil { // If one of the conversion functions is malformed, detect it immediately. panic(err) } + // Add field label conversions for kinds having selectable nothing but ObjectMeta fields. + for _, kind := range []string{ + "Endpoints", + "ResourceQuota", + "PersistentVolumeClaim", + "Service", + "ServiceAccount", + "ConfigMap", + } { + err = api.Scheme.AddFieldLabelConversionFunc("v1", kind, + func(label, value string) (string, string, error) { + switch label { + case "metadata.namespace", + "metadata.name": + return label, value, nil + default: + return "", "", fmt.Errorf("field label %q not supported for %q", label, kind) + } + }) + if err != nil { + // If one of the conversion functions is malformed, detect it immediately. + panic(err) + } + } + // Add field conversion funcs. err = api.Scheme.AddFieldLabelConversionFunc("v1", "Pod", func(label, value string) (string, string, error) { @@ -81,6 +119,7 @@ func addConversionFuncs() { func(label, value string) (string, string, error) { switch label { case "metadata.name", + "metadata.namespace", "status.replicas": return label, value, nil default: @@ -102,7 +141,10 @@ func addConversionFuncs() { "involvedObject.resourceVersion", "involvedObject.fieldPath", "reason", - "source": + "source", + "type", + "metadata.namespace", + "metadata.name": return label, value, nil default: return "", "", fmt.Errorf("field label not supported: %s", label) @@ -115,7 +157,21 @@ func addConversionFuncs() { err = api.Scheme.AddFieldLabelConversionFunc("v1", "Namespace", func(label, value string) (string, string, error) { switch label { - case "status.phase": + case "status.phase", + "metadata.name": + return label, value, nil + default: + return "", "", fmt.Errorf("field label not supported: %s", label) + } + }) + if err != nil { + // If one of the conversion functions is malformed, detect it immediately. + panic(err) + } + err = api.Scheme.AddFieldLabelConversionFunc("v1", "PersistentVolume", + func(label, value string) (string, string, error) { + switch label { + case "metadata.name": return label, value, nil default: return "", "", fmt.Errorf("field label not supported: %s", label) @@ -128,33 +184,9 @@ func addConversionFuncs() { err = api.Scheme.AddFieldLabelConversionFunc("v1", "Secret", func(label, value string) (string, string, error) { switch label { - case "type": - return label, value, nil - default: - return "", "", fmt.Errorf("field label not supported: %s", label) - } - }) - if err != nil { - // If one of the conversion functions is malformed, detect it immediately. - panic(err) - } - err = api.Scheme.AddFieldLabelConversionFunc("v1", "ServiceAccount", - func(label, value string) (string, string, error) { - switch label { - case "metadata.name": - return label, value, nil - default: - return "", "", fmt.Errorf("field label not supported: %s", label) - } - }) - if err != nil { - // If one of the conversion functions is malformed, detect it immediately. - panic(err) - } - err = api.Scheme.AddFieldLabelConversionFunc("v1", "Endpoints", - func(label, value string) (string, string, error) { - switch label { - case "metadata.name": + case "type", + "metadata.namespace", + "metadata.name": return label, value, nil default: return "", "", fmt.Errorf("field label not supported: %s", label) @@ -166,12 +198,12 @@ func addConversionFuncs() { } } -func convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *api.ReplicationControllerSpec, out *ReplicationControllerSpec, s conversion.Scope) error { +func Convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *api.ReplicationControllerSpec, out *ReplicationControllerSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ReplicationControllerSpec))(in) } - out.Replicas = new(int) - *out.Replicas = in.Replicas + out.Replicas = new(int32) + *out.Replicas = int32(in.Replicas) if in.Selector != nil { out.Selector = make(map[string]string) for key, val := range in.Selector { @@ -182,7 +214,7 @@ func convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *a } //if in.TemplateRef != nil { // out.TemplateRef = new(ObjectReference) - // if err := convert_api_ObjectReference_To_v1_ObjectReference(in.TemplateRef, out.TemplateRef, s); err != nil { + // if err := Convert_api_ObjectReference_To_v1_ObjectReference(in.TemplateRef, out.TemplateRef, s); err != nil { // return err // } //} else { @@ -190,7 +222,7 @@ func convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *a //} if in.Template != nil { out.Template = new(PodTemplateSpec) - if err := convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil { + if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil { return err } } else { @@ -199,11 +231,11 @@ func convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *a return nil } -func convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *ReplicationControllerSpec, out *api.ReplicationControllerSpec, s conversion.Scope) error { +func Convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *ReplicationControllerSpec, out *api.ReplicationControllerSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ReplicationControllerSpec))(in) } - out.Replicas = *in.Replicas + out.Replicas = int(*in.Replicas) if in.Selector != nil { out.Selector = make(map[string]string) for key, val := range in.Selector { @@ -214,7 +246,7 @@ func convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *R } //if in.TemplateRef != nil { // out.TemplateRef = new(api.ObjectReference) - // if err := convert_v1_ObjectReference_To_api_ObjectReference(in.TemplateRef, out.TemplateRef, s); err != nil { + // if err := Convert_v1_ObjectReference_To_api_ObjectReference(in.TemplateRef, out.TemplateRef, s); err != nil { // return err // } //} else { @@ -222,7 +254,7 @@ func convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *R //} if in.Template != nil { out.Template = new(api.PodTemplateSpec) - if err := convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil { + if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil { return err } } else { @@ -233,14 +265,14 @@ func convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *R // The following two PodSpec conversions are done here to support ServiceAccount // as an alias for ServiceAccountName. -func convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversion.Scope) error { +func Convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodSpec))(in) } if in.Volumes != nil { out.Volumes = make([]Volume, len(in.Volumes)) for i := range in.Volumes { - if err := convert_api_Volume_To_v1_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { + if err := Convert_api_Volume_To_v1_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { return err } } @@ -250,7 +282,7 @@ func convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversi if in.Containers != nil { out.Containers = make([]Container, len(in.Containers)) for i := range in.Containers { - if err := convert_api_Container_To_v1_Container(&in.Containers[i], &out.Containers[i], s); err != nil { + if err := Convert_api_Container_To_v1_Container(&in.Containers[i], &out.Containers[i], s); err != nil { return err } } @@ -285,7 +317,7 @@ func convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversi out.NodeName = in.NodeName if in.SecurityContext != nil { out.SecurityContext = new(PodSecurityContext) - if err := convert_api_PodSecurityContext_To_v1_PodSecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { + if err := Convert_api_PodSecurityContext_To_v1_PodSecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { return err } @@ -298,7 +330,7 @@ func convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversi if in.ImagePullSecrets != nil { out.ImagePullSecrets = make([]LocalObjectReference, len(in.ImagePullSecrets)) for i := range in.ImagePullSecrets { - if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { return err } } @@ -308,14 +340,14 @@ func convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversi return nil } -func convert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conversion.Scope) error { +func Convert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodSpec))(in) } if in.Volumes != nil { out.Volumes = make([]api.Volume, len(in.Volumes)) for i := range in.Volumes { - if err := convert_v1_Volume_To_api_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { + if err := Convert_v1_Volume_To_api_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { return err } } @@ -325,7 +357,7 @@ func convert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conversi if in.Containers != nil { out.Containers = make([]api.Container, len(in.Containers)) for i := range in.Containers { - if err := convert_v1_Container_To_api_Container(&in.Containers[i], &out.Containers[i], s); err != nil { + if err := Convert_v1_Container_To_api_Container(&in.Containers[i], &out.Containers[i], s); err != nil { return err } } @@ -363,7 +395,7 @@ func convert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conversi out.NodeName = in.NodeName if in.SecurityContext != nil { out.SecurityContext = new(api.PodSecurityContext) - if err := convert_v1_PodSecurityContext_To_api_PodSecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { + if err := Convert_v1_PodSecurityContext_To_api_PodSecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { return err } } @@ -379,18 +411,41 @@ func convert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conversi if in.ImagePullSecrets != nil { out.ImagePullSecrets = make([]api.LocalObjectReference, len(in.ImagePullSecrets)) for i := range in.ImagePullSecrets { - if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { return err } } } else { out.ImagePullSecrets = nil } + return nil } -func convert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *ServiceSpec, s conversion.Scope) error { - if err := autoconvert_api_ServiceSpec_To_v1_ServiceSpec(in, out, s); err != nil { +func Convert_api_Pod_To_v1_Pod(in *api.Pod, out *Pod, s conversion.Scope) error { + if err := autoConvert_api_Pod_To_v1_Pod(in, out, s); err != nil { + return err + } + // We need to reset certain fields for mirror pods from pre-v1.1 kubelet + // (#15960). + // TODO: Remove this code after we drop support for v1.0 kubelets. + if value, ok := in.Annotations[mirrorAnnotationKey]; ok && value == mirrorAnnotationValue_1_0 { + // Reset the TerminationGracePeriodSeconds. + out.Spec.TerminationGracePeriodSeconds = nil + // Reset the resource requests. + for i := range out.Spec.Containers { + out.Spec.Containers[i].Resources.Requests = nil + } + } + return nil +} + +func Convert_v1_Pod_To_api_Pod(in *Pod, out *api.Pod, s conversion.Scope) error { + return autoConvert_v1_Pod_To_api_Pod(in, out, s) +} + +func Convert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *ServiceSpec, s conversion.Scope) error { + if err := autoConvert_api_ServiceSpec_To_v1_ServiceSpec(in, out, s); err != nil { return err } // Publish both externalIPs and deprecatedPublicIPs fields in v1. @@ -400,8 +455,8 @@ func convert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *Service return nil } -func convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.ServiceSpec, s conversion.Scope) error { - if err := autoconvert_v1_ServiceSpec_To_api_ServiceSpec(in, out, s); err != nil { +func Convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.ServiceSpec, s conversion.Scope) error { + if err := autoConvert_v1_ServiceSpec_To_api_ServiceSpec(in, out, s); err != nil { return err } // Prefer the legacy deprecatedPublicIPs field, if provided. @@ -414,7 +469,7 @@ func convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.Service return nil } -func convert_api_PodSecurityContext_To_v1_PodSecurityContext(in *api.PodSecurityContext, out *PodSecurityContext, s conversion.Scope) error { +func Convert_api_PodSecurityContext_To_v1_PodSecurityContext(in *api.PodSecurityContext, out *PodSecurityContext, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodSecurityContext))(in) } @@ -422,7 +477,7 @@ func convert_api_PodSecurityContext_To_v1_PodSecurityContext(in *api.PodSecurity out.SupplementalGroups = in.SupplementalGroups if in.SELinuxOptions != nil { out.SELinuxOptions = new(SELinuxOptions) - if err := convert_api_SELinuxOptions_To_v1_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + if err := Convert_api_SELinuxOptions_To_v1_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { return err } } else { @@ -440,10 +495,16 @@ func convert_api_PodSecurityContext_To_v1_PodSecurityContext(in *api.PodSecurity } else { out.RunAsNonRoot = nil } + if in.FSGroup != nil { + out.FSGroup = new(int64) + *out.FSGroup = *in.FSGroup + } else { + out.FSGroup = nil + } return nil } -func convert_v1_PodSecurityContext_To_api_PodSecurityContext(in *PodSecurityContext, out *api.PodSecurityContext, s conversion.Scope) error { +func Convert_v1_PodSecurityContext_To_api_PodSecurityContext(in *PodSecurityContext, out *api.PodSecurityContext, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodSecurityContext))(in) } @@ -451,7 +512,7 @@ func convert_v1_PodSecurityContext_To_api_PodSecurityContext(in *PodSecurityCont out.SupplementalGroups = in.SupplementalGroups if in.SELinuxOptions != nil { out.SELinuxOptions = new(api.SELinuxOptions) - if err := convert_v1_SELinuxOptions_To_api_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + if err := Convert_v1_SELinuxOptions_To_api_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { return err } } else { @@ -469,5 +530,35 @@ func convert_v1_PodSecurityContext_To_api_PodSecurityContext(in *PodSecurityCont } else { out.RunAsNonRoot = nil } + if in.FSGroup != nil { + out.FSGroup = new(int64) + *out.FSGroup = *in.FSGroup + } else { + out.FSGroup = nil + } + return nil +} + +func Convert_v1_ResourceList_To_api_ResourceList(in *ResourceList, out *api.ResourceList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ResourceList))(in) + } + if *in == nil { + return nil + } + + converted := make(api.ResourceList) + for key, val := range *in { + value := val.Copy() + + // TODO(#18538): We round up resource values to milli scale to maintain API compatibility. + // In the future, we should instead reject values that need rounding. + const milliScale = 3 + value.Amount.Round(value.Amount, milliScale, inf.RoundUp) + + converted[api.ResourceName(key)] = *value + } + + *out = converted return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/conversion_generated.go b/vendor/k8s.io/kubernetes/pkg/api/v1/conversion_generated.go index 606d64073..35b857bf9 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/conversion_generated.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/conversion_generated.go @@ -23,45 +23,58 @@ import ( api "k8s.io/kubernetes/pkg/api" resource "k8s.io/kubernetes/pkg/api/resource" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" conversion "k8s.io/kubernetes/pkg/conversion" + runtime "k8s.io/kubernetes/pkg/runtime" ) -func autoconvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *api.AWSElasticBlockStoreVolumeSource, out *AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { +func autoConvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *api.AWSElasticBlockStoreVolumeSource, out *AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.AWSElasticBlockStoreVolumeSource))(in) } out.VolumeID = in.VolumeID out.FSType = in.FSType - out.Partition = in.Partition + out.Partition = int32(in.Partition) out.ReadOnly = in.ReadOnly return nil } -func convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *api.AWSElasticBlockStoreVolumeSource, out *AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { - return autoconvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in, out, s) +func Convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *api.AWSElasticBlockStoreVolumeSource, out *AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { + return autoConvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in, out, s) } -func autoconvert_api_Binding_To_v1_Binding(in *api.Binding, out *Binding, s conversion.Scope) error { +func autoConvert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource(in *api.AzureFileVolumeSource, out *AzureFileVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.AzureFileVolumeSource))(in) + } + out.SecretName = in.SecretName + out.ShareName = in.ShareName + out.ReadOnly = in.ReadOnly + return nil +} + +func Convert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource(in *api.AzureFileVolumeSource, out *AzureFileVolumeSource, s conversion.Scope) error { + return autoConvert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource(in, out, s) +} + +func autoConvert_api_Binding_To_v1_Binding(in *api.Binding, out *Binding, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Binding))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_api_ObjectReference_To_v1_ObjectReference(&in.Target, &out.Target, s); err != nil { + if err := Convert_api_ObjectReference_To_v1_ObjectReference(&in.Target, &out.Target, s); err != nil { return err } return nil } -func convert_api_Binding_To_v1_Binding(in *api.Binding, out *Binding, s conversion.Scope) error { - return autoconvert_api_Binding_To_v1_Binding(in, out, s) +func Convert_api_Binding_To_v1_Binding(in *api.Binding, out *Binding, s conversion.Scope) error { + return autoConvert_api_Binding_To_v1_Binding(in, out, s) } -func autoconvert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out *Capabilities, s conversion.Scope) error { +func autoConvert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out *Capabilities, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Capabilities))(in) } @@ -84,11 +97,11 @@ func autoconvert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out * return nil } -func convert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out *Capabilities, s conversion.Scope) error { - return autoconvert_api_Capabilities_To_v1_Capabilities(in, out, s) +func Convert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out *Capabilities, s conversion.Scope) error { + return autoConvert_api_Capabilities_To_v1_Capabilities(in, out, s) } -func autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSVolumeSource, out *CephFSVolumeSource, s conversion.Scope) error { +func autoConvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSVolumeSource, out *CephFSVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.CephFSVolumeSource))(in) } @@ -100,11 +113,13 @@ func autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSV } else { out.Monitors = nil } + out.Path = in.Path out.User = in.User out.SecretFile = in.SecretFile + // unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference if in.SecretRef != nil { out.SecretRef = new(LocalObjectReference) - if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { return err } } else { @@ -114,11 +129,11 @@ func autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSV return nil } -func convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSVolumeSource, out *CephFSVolumeSource, s conversion.Scope) error { - return autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in, out, s) +func Convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSVolumeSource, out *CephFSVolumeSource, s conversion.Scope) error { + return autoConvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in, out, s) } -func autoconvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderVolumeSource, out *CinderVolumeSource, s conversion.Scope) error { +func autoConvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderVolumeSource, out *CinderVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.CinderVolumeSource))(in) } @@ -128,11 +143,11 @@ func autoconvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderV return nil } -func convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderVolumeSource, out *CinderVolumeSource, s conversion.Scope) error { - return autoconvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in, out, s) +func Convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderVolumeSource, out *CinderVolumeSource, s conversion.Scope) error { + return autoConvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in, out, s) } -func autoconvert_api_ComponentCondition_To_v1_ComponentCondition(in *api.ComponentCondition, out *ComponentCondition, s conversion.Scope) error { +func autoConvert_api_ComponentCondition_To_v1_ComponentCondition(in *api.ComponentCondition, out *ComponentCondition, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ComponentCondition))(in) } @@ -143,24 +158,21 @@ func autoconvert_api_ComponentCondition_To_v1_ComponentCondition(in *api.Compone return nil } -func convert_api_ComponentCondition_To_v1_ComponentCondition(in *api.ComponentCondition, out *ComponentCondition, s conversion.Scope) error { - return autoconvert_api_ComponentCondition_To_v1_ComponentCondition(in, out, s) +func Convert_api_ComponentCondition_To_v1_ComponentCondition(in *api.ComponentCondition, out *ComponentCondition, s conversion.Scope) error { + return autoConvert_api_ComponentCondition_To_v1_ComponentCondition(in, out, s) } -func autoconvert_api_ComponentStatus_To_v1_ComponentStatus(in *api.ComponentStatus, out *ComponentStatus, s conversion.Scope) error { +func autoConvert_api_ComponentStatus_To_v1_ComponentStatus(in *api.ComponentStatus, out *ComponentStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ComponentStatus))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } if in.Conditions != nil { out.Conditions = make([]ComponentCondition, len(in.Conditions)) for i := range in.Conditions { - if err := convert_api_ComponentCondition_To_v1_ComponentCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { + if err := Convert_api_ComponentCondition_To_v1_ComponentCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { return err } } @@ -170,24 +182,21 @@ func autoconvert_api_ComponentStatus_To_v1_ComponentStatus(in *api.ComponentStat return nil } -func convert_api_ComponentStatus_To_v1_ComponentStatus(in *api.ComponentStatus, out *ComponentStatus, s conversion.Scope) error { - return autoconvert_api_ComponentStatus_To_v1_ComponentStatus(in, out, s) +func Convert_api_ComponentStatus_To_v1_ComponentStatus(in *api.ComponentStatus, out *ComponentStatus, s conversion.Scope) error { + return autoConvert_api_ComponentStatus_To_v1_ComponentStatus(in, out, s) } -func autoconvert_api_ComponentStatusList_To_v1_ComponentStatusList(in *api.ComponentStatusList, out *ComponentStatusList, s conversion.Scope) error { +func autoConvert_api_ComponentStatusList_To_v1_ComponentStatusList(in *api.ComponentStatusList, out *ComponentStatusList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ComponentStatusList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]ComponentStatus, len(in.Items)) for i := range in.Items { - if err := convert_api_ComponentStatus_To_v1_ComponentStatus(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_ComponentStatus_To_v1_ComponentStatus(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -197,11 +206,96 @@ func autoconvert_api_ComponentStatusList_To_v1_ComponentStatusList(in *api.Compo return nil } -func convert_api_ComponentStatusList_To_v1_ComponentStatusList(in *api.ComponentStatusList, out *ComponentStatusList, s conversion.Scope) error { - return autoconvert_api_ComponentStatusList_To_v1_ComponentStatusList(in, out, s) +func Convert_api_ComponentStatusList_To_v1_ComponentStatusList(in *api.ComponentStatusList, out *ComponentStatusList, s conversion.Scope) error { + return autoConvert_api_ComponentStatusList_To_v1_ComponentStatusList(in, out, s) } -func autoconvert_api_Container_To_v1_Container(in *api.Container, out *Container, s conversion.Scope) error { +func autoConvert_api_ConfigMap_To_v1_ConfigMap(in *api.ConfigMap, out *ConfigMap, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.ConfigMap))(in) + } + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if in.Data != nil { + out.Data = make(map[string]string) + for key, val := range in.Data { + out.Data[key] = val + } + } else { + out.Data = nil + } + return nil +} + +func Convert_api_ConfigMap_To_v1_ConfigMap(in *api.ConfigMap, out *ConfigMap, s conversion.Scope) error { + return autoConvert_api_ConfigMap_To_v1_ConfigMap(in, out, s) +} + +func autoConvert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector(in *api.ConfigMapKeySelector, out *ConfigMapKeySelector, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.ConfigMapKeySelector))(in) + } + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func Convert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector(in *api.ConfigMapKeySelector, out *ConfigMapKeySelector, s conversion.Scope) error { + return autoConvert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector(in, out, s) +} + +func autoConvert_api_ConfigMapList_To_v1_ConfigMapList(in *api.ConfigMapList, out *ConfigMapList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.ConfigMapList))(in) + } + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]ConfigMap, len(in.Items)) + for i := range in.Items { + if err := Convert_api_ConfigMap_To_v1_ConfigMap(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_api_ConfigMapList_To_v1_ConfigMapList(in *api.ConfigMapList, out *ConfigMapList, s conversion.Scope) error { + return autoConvert_api_ConfigMapList_To_v1_ConfigMapList(in, out, s) +} + +func autoConvert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in *api.ConfigMapVolumeSource, out *ConfigMapVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.ConfigMapVolumeSource))(in) + } + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]KeyToPath, len(in.Items)) + for i := range in.Items { + if err := Convert_api_KeyToPath_To_v1_KeyToPath(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in *api.ConfigMapVolumeSource, out *ConfigMapVolumeSource, s conversion.Scope) error { + return autoConvert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in, out, s) +} + +func autoConvert_api_Container_To_v1_Container(in *api.Container, out *Container, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Container))(in) } @@ -227,7 +321,7 @@ func autoconvert_api_Container_To_v1_Container(in *api.Container, out *Container if in.Ports != nil { out.Ports = make([]ContainerPort, len(in.Ports)) for i := range in.Ports { - if err := convert_api_ContainerPort_To_v1_ContainerPort(&in.Ports[i], &out.Ports[i], s); err != nil { + if err := Convert_api_ContainerPort_To_v1_ContainerPort(&in.Ports[i], &out.Ports[i], s); err != nil { return err } } @@ -237,45 +331,48 @@ func autoconvert_api_Container_To_v1_Container(in *api.Container, out *Container if in.Env != nil { out.Env = make([]EnvVar, len(in.Env)) for i := range in.Env { - if err := convert_api_EnvVar_To_v1_EnvVar(&in.Env[i], &out.Env[i], s); err != nil { + if err := Convert_api_EnvVar_To_v1_EnvVar(&in.Env[i], &out.Env[i], s); err != nil { return err } } } else { out.Env = nil } - if err := convert_api_ResourceRequirements_To_v1_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { + if err := Convert_api_ResourceRequirements_To_v1_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { return err } if in.VolumeMounts != nil { out.VolumeMounts = make([]VolumeMount, len(in.VolumeMounts)) for i := range in.VolumeMounts { - if err := convert_api_VolumeMount_To_v1_VolumeMount(&in.VolumeMounts[i], &out.VolumeMounts[i], s); err != nil { + if err := Convert_api_VolumeMount_To_v1_VolumeMount(&in.VolumeMounts[i], &out.VolumeMounts[i], s); err != nil { return err } } } else { out.VolumeMounts = nil } + // unable to generate simple pointer conversion for api.Probe -> v1.Probe if in.LivenessProbe != nil { out.LivenessProbe = new(Probe) - if err := convert_api_Probe_To_v1_Probe(in.LivenessProbe, out.LivenessProbe, s); err != nil { + if err := Convert_api_Probe_To_v1_Probe(in.LivenessProbe, out.LivenessProbe, s); err != nil { return err } } else { out.LivenessProbe = nil } + // unable to generate simple pointer conversion for api.Probe -> v1.Probe if in.ReadinessProbe != nil { out.ReadinessProbe = new(Probe) - if err := convert_api_Probe_To_v1_Probe(in.ReadinessProbe, out.ReadinessProbe, s); err != nil { + if err := Convert_api_Probe_To_v1_Probe(in.ReadinessProbe, out.ReadinessProbe, s); err != nil { return err } } else { out.ReadinessProbe = nil } + // unable to generate simple pointer conversion for api.Lifecycle -> v1.Lifecycle if in.Lifecycle != nil { out.Lifecycle = new(Lifecycle) - if err := convert_api_Lifecycle_To_v1_Lifecycle(in.Lifecycle, out.Lifecycle, s); err != nil { + if err := Convert_api_Lifecycle_To_v1_Lifecycle(in.Lifecycle, out.Lifecycle, s); err != nil { return err } } else { @@ -283,9 +380,10 @@ func autoconvert_api_Container_To_v1_Container(in *api.Container, out *Container } out.TerminationMessagePath = in.TerminationMessagePath out.ImagePullPolicy = PullPolicy(in.ImagePullPolicy) + // unable to generate simple pointer conversion for api.SecurityContext -> v1.SecurityContext if in.SecurityContext != nil { out.SecurityContext = new(SecurityContext) - if err := convert_api_SecurityContext_To_v1_SecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { + if err := Convert_api_SecurityContext_To_v1_SecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { return err } } else { @@ -297,49 +395,72 @@ func autoconvert_api_Container_To_v1_Container(in *api.Container, out *Container return nil } -func convert_api_Container_To_v1_Container(in *api.Container, out *Container, s conversion.Scope) error { - return autoconvert_api_Container_To_v1_Container(in, out, s) +func Convert_api_Container_To_v1_Container(in *api.Container, out *Container, s conversion.Scope) error { + return autoConvert_api_Container_To_v1_Container(in, out, s) } -func autoconvert_api_ContainerPort_To_v1_ContainerPort(in *api.ContainerPort, out *ContainerPort, s conversion.Scope) error { +func autoConvert_api_ContainerImage_To_v1_ContainerImage(in *api.ContainerImage, out *ContainerImage, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.ContainerImage))(in) + } + if in.RepoTags != nil { + out.RepoTags = make([]string, len(in.RepoTags)) + for i := range in.RepoTags { + out.RepoTags[i] = in.RepoTags[i] + } + } else { + out.RepoTags = nil + } + out.Size = in.Size + return nil +} + +func Convert_api_ContainerImage_To_v1_ContainerImage(in *api.ContainerImage, out *ContainerImage, s conversion.Scope) error { + return autoConvert_api_ContainerImage_To_v1_ContainerImage(in, out, s) +} + +func autoConvert_api_ContainerPort_To_v1_ContainerPort(in *api.ContainerPort, out *ContainerPort, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ContainerPort))(in) } out.Name = in.Name - out.HostPort = in.HostPort - out.ContainerPort = in.ContainerPort + out.HostPort = int32(in.HostPort) + out.ContainerPort = int32(in.ContainerPort) out.Protocol = Protocol(in.Protocol) out.HostIP = in.HostIP return nil } -func convert_api_ContainerPort_To_v1_ContainerPort(in *api.ContainerPort, out *ContainerPort, s conversion.Scope) error { - return autoconvert_api_ContainerPort_To_v1_ContainerPort(in, out, s) +func Convert_api_ContainerPort_To_v1_ContainerPort(in *api.ContainerPort, out *ContainerPort, s conversion.Scope) error { + return autoConvert_api_ContainerPort_To_v1_ContainerPort(in, out, s) } -func autoconvert_api_ContainerState_To_v1_ContainerState(in *api.ContainerState, out *ContainerState, s conversion.Scope) error { +func autoConvert_api_ContainerState_To_v1_ContainerState(in *api.ContainerState, out *ContainerState, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ContainerState))(in) } + // unable to generate simple pointer conversion for api.ContainerStateWaiting -> v1.ContainerStateWaiting if in.Waiting != nil { out.Waiting = new(ContainerStateWaiting) - if err := convert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting(in.Waiting, out.Waiting, s); err != nil { + if err := Convert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting(in.Waiting, out.Waiting, s); err != nil { return err } } else { out.Waiting = nil } + // unable to generate simple pointer conversion for api.ContainerStateRunning -> v1.ContainerStateRunning if in.Running != nil { out.Running = new(ContainerStateRunning) - if err := convert_api_ContainerStateRunning_To_v1_ContainerStateRunning(in.Running, out.Running, s); err != nil { + if err := Convert_api_ContainerStateRunning_To_v1_ContainerStateRunning(in.Running, out.Running, s); err != nil { return err } } else { out.Running = nil } + // unable to generate simple pointer conversion for api.ContainerStateTerminated -> v1.ContainerStateTerminated if in.Terminated != nil { out.Terminated = new(ContainerStateTerminated) - if err := convert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated(in.Terminated, out.Terminated, s); err != nil { + if err := Convert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated(in.Terminated, out.Terminated, s); err != nil { return err } } else { @@ -348,47 +469,47 @@ func autoconvert_api_ContainerState_To_v1_ContainerState(in *api.ContainerState, return nil } -func convert_api_ContainerState_To_v1_ContainerState(in *api.ContainerState, out *ContainerState, s conversion.Scope) error { - return autoconvert_api_ContainerState_To_v1_ContainerState(in, out, s) +func Convert_api_ContainerState_To_v1_ContainerState(in *api.ContainerState, out *ContainerState, s conversion.Scope) error { + return autoConvert_api_ContainerState_To_v1_ContainerState(in, out, s) } -func autoconvert_api_ContainerStateRunning_To_v1_ContainerStateRunning(in *api.ContainerStateRunning, out *ContainerStateRunning, s conversion.Scope) error { +func autoConvert_api_ContainerStateRunning_To_v1_ContainerStateRunning(in *api.ContainerStateRunning, out *ContainerStateRunning, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ContainerStateRunning))(in) } - if err := s.Convert(&in.StartedAt, &out.StartedAt, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.StartedAt, &out.StartedAt, s); err != nil { return err } return nil } -func convert_api_ContainerStateRunning_To_v1_ContainerStateRunning(in *api.ContainerStateRunning, out *ContainerStateRunning, s conversion.Scope) error { - return autoconvert_api_ContainerStateRunning_To_v1_ContainerStateRunning(in, out, s) +func Convert_api_ContainerStateRunning_To_v1_ContainerStateRunning(in *api.ContainerStateRunning, out *ContainerStateRunning, s conversion.Scope) error { + return autoConvert_api_ContainerStateRunning_To_v1_ContainerStateRunning(in, out, s) } -func autoconvert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated(in *api.ContainerStateTerminated, out *ContainerStateTerminated, s conversion.Scope) error { +func autoConvert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated(in *api.ContainerStateTerminated, out *ContainerStateTerminated, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ContainerStateTerminated))(in) } - out.ExitCode = in.ExitCode - out.Signal = in.Signal + out.ExitCode = int32(in.ExitCode) + out.Signal = int32(in.Signal) out.Reason = in.Reason out.Message = in.Message - if err := s.Convert(&in.StartedAt, &out.StartedAt, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.StartedAt, &out.StartedAt, s); err != nil { return err } - if err := s.Convert(&in.FinishedAt, &out.FinishedAt, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.FinishedAt, &out.FinishedAt, s); err != nil { return err } out.ContainerID = in.ContainerID return nil } -func convert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated(in *api.ContainerStateTerminated, out *ContainerStateTerminated, s conversion.Scope) error { - return autoconvert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated(in, out, s) +func Convert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated(in *api.ContainerStateTerminated, out *ContainerStateTerminated, s conversion.Scope) error { + return autoConvert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated(in, out, s) } -func autoconvert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting(in *api.ContainerStateWaiting, out *ContainerStateWaiting, s conversion.Scope) error { +func autoConvert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting(in *api.ContainerStateWaiting, out *ContainerStateWaiting, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ContainerStateWaiting))(in) } @@ -397,52 +518,49 @@ func autoconvert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting(in *api.C return nil } -func convert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting(in *api.ContainerStateWaiting, out *ContainerStateWaiting, s conversion.Scope) error { - return autoconvert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting(in, out, s) +func Convert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting(in *api.ContainerStateWaiting, out *ContainerStateWaiting, s conversion.Scope) error { + return autoConvert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting(in, out, s) } -func autoconvert_api_ContainerStatus_To_v1_ContainerStatus(in *api.ContainerStatus, out *ContainerStatus, s conversion.Scope) error { +func autoConvert_api_ContainerStatus_To_v1_ContainerStatus(in *api.ContainerStatus, out *ContainerStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ContainerStatus))(in) } out.Name = in.Name - if err := convert_api_ContainerState_To_v1_ContainerState(&in.State, &out.State, s); err != nil { + if err := Convert_api_ContainerState_To_v1_ContainerState(&in.State, &out.State, s); err != nil { return err } - if err := convert_api_ContainerState_To_v1_ContainerState(&in.LastTerminationState, &out.LastTerminationState, s); err != nil { + if err := Convert_api_ContainerState_To_v1_ContainerState(&in.LastTerminationState, &out.LastTerminationState, s); err != nil { return err } out.Ready = in.Ready - out.RestartCount = in.RestartCount + out.RestartCount = int32(in.RestartCount) out.Image = in.Image out.ImageID = in.ImageID out.ContainerID = in.ContainerID return nil } -func convert_api_ContainerStatus_To_v1_ContainerStatus(in *api.ContainerStatus, out *ContainerStatus, s conversion.Scope) error { - return autoconvert_api_ContainerStatus_To_v1_ContainerStatus(in, out, s) +func Convert_api_ContainerStatus_To_v1_ContainerStatus(in *api.ContainerStatus, out *ContainerStatus, s conversion.Scope) error { + return autoConvert_api_ContainerStatus_To_v1_ContainerStatus(in, out, s) } -func autoconvert_api_DaemonEndpoint_To_v1_DaemonEndpoint(in *api.DaemonEndpoint, out *DaemonEndpoint, s conversion.Scope) error { +func autoConvert_api_DaemonEndpoint_To_v1_DaemonEndpoint(in *api.DaemonEndpoint, out *DaemonEndpoint, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.DaemonEndpoint))(in) } - out.Port = in.Port + out.Port = int32(in.Port) return nil } -func convert_api_DaemonEndpoint_To_v1_DaemonEndpoint(in *api.DaemonEndpoint, out *DaemonEndpoint, s conversion.Scope) error { - return autoconvert_api_DaemonEndpoint_To_v1_DaemonEndpoint(in, out, s) +func Convert_api_DaemonEndpoint_To_v1_DaemonEndpoint(in *api.DaemonEndpoint, out *DaemonEndpoint, s conversion.Scope) error { + return autoConvert_api_DaemonEndpoint_To_v1_DaemonEndpoint(in, out, s) } -func autoconvert_api_DeleteOptions_To_v1_DeleteOptions(in *api.DeleteOptions, out *DeleteOptions, s conversion.Scope) error { +func autoConvert_api_DeleteOptions_To_v1_DeleteOptions(in *api.DeleteOptions, out *DeleteOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.DeleteOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } if in.GracePeriodSeconds != nil { out.GracePeriodSeconds = new(int64) *out.GracePeriodSeconds = *in.GracePeriodSeconds @@ -452,33 +570,33 @@ func autoconvert_api_DeleteOptions_To_v1_DeleteOptions(in *api.DeleteOptions, ou return nil } -func convert_api_DeleteOptions_To_v1_DeleteOptions(in *api.DeleteOptions, out *DeleteOptions, s conversion.Scope) error { - return autoconvert_api_DeleteOptions_To_v1_DeleteOptions(in, out, s) +func Convert_api_DeleteOptions_To_v1_DeleteOptions(in *api.DeleteOptions, out *DeleteOptions, s conversion.Scope) error { + return autoConvert_api_DeleteOptions_To_v1_DeleteOptions(in, out, s) } -func autoconvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in *api.DownwardAPIVolumeFile, out *DownwardAPIVolumeFile, s conversion.Scope) error { +func autoConvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in *api.DownwardAPIVolumeFile, out *DownwardAPIVolumeFile, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.DownwardAPIVolumeFile))(in) } out.Path = in.Path - if err := convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(&in.FieldRef, &out.FieldRef, s); err != nil { + if err := Convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(&in.FieldRef, &out.FieldRef, s); err != nil { return err } return nil } -func convert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in *api.DownwardAPIVolumeFile, out *DownwardAPIVolumeFile, s conversion.Scope) error { - return autoconvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in, out, s) +func Convert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in *api.DownwardAPIVolumeFile, out *DownwardAPIVolumeFile, s conversion.Scope) error { + return autoConvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in, out, s) } -func autoconvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *api.DownwardAPIVolumeSource, out *DownwardAPIVolumeSource, s conversion.Scope) error { +func autoConvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *api.DownwardAPIVolumeSource, out *DownwardAPIVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.DownwardAPIVolumeSource))(in) } if in.Items != nil { out.Items = make([]DownwardAPIVolumeFile, len(in.Items)) for i := range in.Items { - if err := convert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -488,11 +606,11 @@ func autoconvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *a return nil } -func convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *api.DownwardAPIVolumeSource, out *DownwardAPIVolumeSource, s conversion.Scope) error { - return autoconvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in, out, s) +func Convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *api.DownwardAPIVolumeSource, out *DownwardAPIVolumeSource, s conversion.Scope) error { + return autoConvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in, out, s) } -func autoconvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.EmptyDirVolumeSource, out *EmptyDirVolumeSource, s conversion.Scope) error { +func autoConvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.EmptyDirVolumeSource, out *EmptyDirVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EmptyDirVolumeSource))(in) } @@ -500,18 +618,19 @@ func autoconvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.Emp return nil } -func convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.EmptyDirVolumeSource, out *EmptyDirVolumeSource, s conversion.Scope) error { - return autoconvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in, out, s) +func Convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.EmptyDirVolumeSource, out *EmptyDirVolumeSource, s conversion.Scope) error { + return autoConvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in, out, s) } -func autoconvert_api_EndpointAddress_To_v1_EndpointAddress(in *api.EndpointAddress, out *EndpointAddress, s conversion.Scope) error { +func autoConvert_api_EndpointAddress_To_v1_EndpointAddress(in *api.EndpointAddress, out *EndpointAddress, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EndpointAddress))(in) } out.IP = in.IP + // unable to generate simple pointer conversion for api.ObjectReference -> v1.ObjectReference if in.TargetRef != nil { out.TargetRef = new(ObjectReference) - if err := convert_api_ObjectReference_To_v1_ObjectReference(in.TargetRef, out.TargetRef, s); err != nil { + if err := Convert_api_ObjectReference_To_v1_ObjectReference(in.TargetRef, out.TargetRef, s); err != nil { return err } } else { @@ -520,32 +639,32 @@ func autoconvert_api_EndpointAddress_To_v1_EndpointAddress(in *api.EndpointAddre return nil } -func convert_api_EndpointAddress_To_v1_EndpointAddress(in *api.EndpointAddress, out *EndpointAddress, s conversion.Scope) error { - return autoconvert_api_EndpointAddress_To_v1_EndpointAddress(in, out, s) +func Convert_api_EndpointAddress_To_v1_EndpointAddress(in *api.EndpointAddress, out *EndpointAddress, s conversion.Scope) error { + return autoConvert_api_EndpointAddress_To_v1_EndpointAddress(in, out, s) } -func autoconvert_api_EndpointPort_To_v1_EndpointPort(in *api.EndpointPort, out *EndpointPort, s conversion.Scope) error { +func autoConvert_api_EndpointPort_To_v1_EndpointPort(in *api.EndpointPort, out *EndpointPort, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EndpointPort))(in) } out.Name = in.Name - out.Port = in.Port + out.Port = int32(in.Port) out.Protocol = Protocol(in.Protocol) return nil } -func convert_api_EndpointPort_To_v1_EndpointPort(in *api.EndpointPort, out *EndpointPort, s conversion.Scope) error { - return autoconvert_api_EndpointPort_To_v1_EndpointPort(in, out, s) +func Convert_api_EndpointPort_To_v1_EndpointPort(in *api.EndpointPort, out *EndpointPort, s conversion.Scope) error { + return autoConvert_api_EndpointPort_To_v1_EndpointPort(in, out, s) } -func autoconvert_api_EndpointSubset_To_v1_EndpointSubset(in *api.EndpointSubset, out *EndpointSubset, s conversion.Scope) error { +func autoConvert_api_EndpointSubset_To_v1_EndpointSubset(in *api.EndpointSubset, out *EndpointSubset, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EndpointSubset))(in) } if in.Addresses != nil { out.Addresses = make([]EndpointAddress, len(in.Addresses)) for i := range in.Addresses { - if err := convert_api_EndpointAddress_To_v1_EndpointAddress(&in.Addresses[i], &out.Addresses[i], s); err != nil { + if err := Convert_api_EndpointAddress_To_v1_EndpointAddress(&in.Addresses[i], &out.Addresses[i], s); err != nil { return err } } @@ -555,7 +674,7 @@ func autoconvert_api_EndpointSubset_To_v1_EndpointSubset(in *api.EndpointSubset, if in.NotReadyAddresses != nil { out.NotReadyAddresses = make([]EndpointAddress, len(in.NotReadyAddresses)) for i := range in.NotReadyAddresses { - if err := convert_api_EndpointAddress_To_v1_EndpointAddress(&in.NotReadyAddresses[i], &out.NotReadyAddresses[i], s); err != nil { + if err := Convert_api_EndpointAddress_To_v1_EndpointAddress(&in.NotReadyAddresses[i], &out.NotReadyAddresses[i], s); err != nil { return err } } @@ -565,7 +684,7 @@ func autoconvert_api_EndpointSubset_To_v1_EndpointSubset(in *api.EndpointSubset, if in.Ports != nil { out.Ports = make([]EndpointPort, len(in.Ports)) for i := range in.Ports { - if err := convert_api_EndpointPort_To_v1_EndpointPort(&in.Ports[i], &out.Ports[i], s); err != nil { + if err := Convert_api_EndpointPort_To_v1_EndpointPort(&in.Ports[i], &out.Ports[i], s); err != nil { return err } } @@ -575,24 +694,21 @@ func autoconvert_api_EndpointSubset_To_v1_EndpointSubset(in *api.EndpointSubset, return nil } -func convert_api_EndpointSubset_To_v1_EndpointSubset(in *api.EndpointSubset, out *EndpointSubset, s conversion.Scope) error { - return autoconvert_api_EndpointSubset_To_v1_EndpointSubset(in, out, s) +func Convert_api_EndpointSubset_To_v1_EndpointSubset(in *api.EndpointSubset, out *EndpointSubset, s conversion.Scope) error { + return autoConvert_api_EndpointSubset_To_v1_EndpointSubset(in, out, s) } -func autoconvert_api_Endpoints_To_v1_Endpoints(in *api.Endpoints, out *Endpoints, s conversion.Scope) error { +func autoConvert_api_Endpoints_To_v1_Endpoints(in *api.Endpoints, out *Endpoints, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Endpoints))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } if in.Subsets != nil { out.Subsets = make([]EndpointSubset, len(in.Subsets)) for i := range in.Subsets { - if err := convert_api_EndpointSubset_To_v1_EndpointSubset(&in.Subsets[i], &out.Subsets[i], s); err != nil { + if err := Convert_api_EndpointSubset_To_v1_EndpointSubset(&in.Subsets[i], &out.Subsets[i], s); err != nil { return err } } @@ -602,24 +718,21 @@ func autoconvert_api_Endpoints_To_v1_Endpoints(in *api.Endpoints, out *Endpoints return nil } -func convert_api_Endpoints_To_v1_Endpoints(in *api.Endpoints, out *Endpoints, s conversion.Scope) error { - return autoconvert_api_Endpoints_To_v1_Endpoints(in, out, s) +func Convert_api_Endpoints_To_v1_Endpoints(in *api.Endpoints, out *Endpoints, s conversion.Scope) error { + return autoConvert_api_Endpoints_To_v1_Endpoints(in, out, s) } -func autoconvert_api_EndpointsList_To_v1_EndpointsList(in *api.EndpointsList, out *EndpointsList, s conversion.Scope) error { +func autoConvert_api_EndpointsList_To_v1_EndpointsList(in *api.EndpointsList, out *EndpointsList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EndpointsList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]Endpoints, len(in.Items)) for i := range in.Items { - if err := convert_api_Endpoints_To_v1_Endpoints(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_Endpoints_To_v1_Endpoints(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -629,19 +742,20 @@ func autoconvert_api_EndpointsList_To_v1_EndpointsList(in *api.EndpointsList, ou return nil } -func convert_api_EndpointsList_To_v1_EndpointsList(in *api.EndpointsList, out *EndpointsList, s conversion.Scope) error { - return autoconvert_api_EndpointsList_To_v1_EndpointsList(in, out, s) +func Convert_api_EndpointsList_To_v1_EndpointsList(in *api.EndpointsList, out *EndpointsList, s conversion.Scope) error { + return autoConvert_api_EndpointsList_To_v1_EndpointsList(in, out, s) } -func autoconvert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *EnvVar, s conversion.Scope) error { +func autoConvert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *EnvVar, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EnvVar))(in) } out.Name = in.Name out.Value = in.Value + // unable to generate simple pointer conversion for api.EnvVarSource -> v1.EnvVarSource if in.ValueFrom != nil { out.ValueFrom = new(EnvVarSource) - if err := convert_api_EnvVarSource_To_v1_EnvVarSource(in.ValueFrom, out.ValueFrom, s); err != nil { + if err := Convert_api_EnvVarSource_To_v1_EnvVarSource(in.ValueFrom, out.ValueFrom, s); err != nil { return err } } else { @@ -650,75 +764,89 @@ func autoconvert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *EnvVar, s conversi return nil } -func convert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *EnvVar, s conversion.Scope) error { - return autoconvert_api_EnvVar_To_v1_EnvVar(in, out, s) +func Convert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *EnvVar, s conversion.Scope) error { + return autoConvert_api_EnvVar_To_v1_EnvVar(in, out, s) } -func autoconvert_api_EnvVarSource_To_v1_EnvVarSource(in *api.EnvVarSource, out *EnvVarSource, s conversion.Scope) error { +func autoConvert_api_EnvVarSource_To_v1_EnvVarSource(in *api.EnvVarSource, out *EnvVarSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EnvVarSource))(in) } + // unable to generate simple pointer conversion for api.ObjectFieldSelector -> v1.ObjectFieldSelector if in.FieldRef != nil { out.FieldRef = new(ObjectFieldSelector) - if err := convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in.FieldRef, out.FieldRef, s); err != nil { + if err := Convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in.FieldRef, out.FieldRef, s); err != nil { return err } } else { out.FieldRef = nil } + // unable to generate simple pointer conversion for api.ConfigMapKeySelector -> v1.ConfigMapKeySelector + if in.ConfigMapKeyRef != nil { + out.ConfigMapKeyRef = new(ConfigMapKeySelector) + if err := Convert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector(in.ConfigMapKeyRef, out.ConfigMapKeyRef, s); err != nil { + return err + } + } else { + out.ConfigMapKeyRef = nil + } + // unable to generate simple pointer conversion for api.SecretKeySelector -> v1.SecretKeySelector + if in.SecretKeyRef != nil { + out.SecretKeyRef = new(SecretKeySelector) + if err := Convert_api_SecretKeySelector_To_v1_SecretKeySelector(in.SecretKeyRef, out.SecretKeyRef, s); err != nil { + return err + } + } else { + out.SecretKeyRef = nil + } return nil } -func convert_api_EnvVarSource_To_v1_EnvVarSource(in *api.EnvVarSource, out *EnvVarSource, s conversion.Scope) error { - return autoconvert_api_EnvVarSource_To_v1_EnvVarSource(in, out, s) +func Convert_api_EnvVarSource_To_v1_EnvVarSource(in *api.EnvVarSource, out *EnvVarSource, s conversion.Scope) error { + return autoConvert_api_EnvVarSource_To_v1_EnvVarSource(in, out, s) } -func autoconvert_api_Event_To_v1_Event(in *api.Event, out *Event, s conversion.Scope) error { +func autoConvert_api_Event_To_v1_Event(in *api.Event, out *Event, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Event))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_api_ObjectReference_To_v1_ObjectReference(&in.InvolvedObject, &out.InvolvedObject, s); err != nil { + if err := Convert_api_ObjectReference_To_v1_ObjectReference(&in.InvolvedObject, &out.InvolvedObject, s); err != nil { return err } out.Reason = in.Reason out.Message = in.Message - if err := convert_api_EventSource_To_v1_EventSource(&in.Source, &out.Source, s); err != nil { + if err := Convert_api_EventSource_To_v1_EventSource(&in.Source, &out.Source, s); err != nil { return err } - if err := s.Convert(&in.FirstTimestamp, &out.FirstTimestamp, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.FirstTimestamp, &out.FirstTimestamp, s); err != nil { return err } - if err := s.Convert(&in.LastTimestamp, &out.LastTimestamp, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastTimestamp, &out.LastTimestamp, s); err != nil { return err } - out.Count = in.Count + out.Count = int32(in.Count) + out.Type = in.Type return nil } -func convert_api_Event_To_v1_Event(in *api.Event, out *Event, s conversion.Scope) error { - return autoconvert_api_Event_To_v1_Event(in, out, s) +func Convert_api_Event_To_v1_Event(in *api.Event, out *Event, s conversion.Scope) error { + return autoConvert_api_Event_To_v1_Event(in, out, s) } -func autoconvert_api_EventList_To_v1_EventList(in *api.EventList, out *EventList, s conversion.Scope) error { +func autoConvert_api_EventList_To_v1_EventList(in *api.EventList, out *EventList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EventList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]Event, len(in.Items)) for i := range in.Items { - if err := convert_api_Event_To_v1_Event(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_Event_To_v1_Event(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -728,11 +856,11 @@ func autoconvert_api_EventList_To_v1_EventList(in *api.EventList, out *EventList return nil } -func convert_api_EventList_To_v1_EventList(in *api.EventList, out *EventList, s conversion.Scope) error { - return autoconvert_api_EventList_To_v1_EventList(in, out, s) +func Convert_api_EventList_To_v1_EventList(in *api.EventList, out *EventList, s conversion.Scope) error { + return autoConvert_api_EventList_To_v1_EventList(in, out, s) } -func autoconvert_api_EventSource_To_v1_EventSource(in *api.EventSource, out *EventSource, s conversion.Scope) error { +func autoConvert_api_EventSource_To_v1_EventSource(in *api.EventSource, out *EventSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EventSource))(in) } @@ -741,11 +869,11 @@ func autoconvert_api_EventSource_To_v1_EventSource(in *api.EventSource, out *Eve return nil } -func convert_api_EventSource_To_v1_EventSource(in *api.EventSource, out *EventSource, s conversion.Scope) error { - return autoconvert_api_EventSource_To_v1_EventSource(in, out, s) +func Convert_api_EventSource_To_v1_EventSource(in *api.EventSource, out *EventSource, s conversion.Scope) error { + return autoConvert_api_EventSource_To_v1_EventSource(in, out, s) } -func autoconvert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *ExecAction, s conversion.Scope) error { +func autoConvert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *ExecAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ExecAction))(in) } @@ -760,11 +888,11 @@ func autoconvert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *ExecAc return nil } -func convert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *ExecAction, s conversion.Scope) error { - return autoconvert_api_ExecAction_To_v1_ExecAction(in, out, s) +func Convert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *ExecAction, s conversion.Scope) error { + return autoConvert_api_ExecAction_To_v1_ExecAction(in, out, s) } -func autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out *FCVolumeSource, s conversion.Scope) error { +func autoConvert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out *FCVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.FCVolumeSource))(in) } @@ -777,8 +905,8 @@ func autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out.TargetWWNs = nil } if in.Lun != nil { - out.Lun = new(int) - *out.Lun = *in.Lun + out.Lun = new(int32) + *out.Lun = int32(*in.Lun) } else { out.Lun = nil } @@ -787,11 +915,42 @@ func autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, return nil } -func convert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out *FCVolumeSource, s conversion.Scope) error { - return autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource(in, out, s) +func Convert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out *FCVolumeSource, s conversion.Scope) error { + return autoConvert_api_FCVolumeSource_To_v1_FCVolumeSource(in, out, s) } -func autoconvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.FlockerVolumeSource, out *FlockerVolumeSource, s conversion.Scope) error { +func autoConvert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in *api.FlexVolumeSource, out *FlexVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.FlexVolumeSource))(in) + } + out.Driver = in.Driver + out.FSType = in.FSType + // unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference + if in.SecretRef != nil { + out.SecretRef = new(LocalObjectReference) + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + return err + } + } else { + out.SecretRef = nil + } + out.ReadOnly = in.ReadOnly + if in.Options != nil { + out.Options = make(map[string]string) + for key, val := range in.Options { + out.Options[key] = val + } + } else { + out.Options = nil + } + return nil +} + +func Convert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in *api.FlexVolumeSource, out *FlexVolumeSource, s conversion.Scope) error { + return autoConvert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in, out, s) +} + +func autoConvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.FlockerVolumeSource, out *FlockerVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.FlockerVolumeSource))(in) } @@ -799,39 +958,40 @@ func autoconvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.Flock return nil } -func convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.FlockerVolumeSource, out *FlockerVolumeSource, s conversion.Scope) error { - return autoconvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in, out, s) +func Convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.FlockerVolumeSource, out *FlockerVolumeSource, s conversion.Scope) error { + return autoConvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in, out, s) } -func autoconvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in *api.GCEPersistentDiskVolumeSource, out *GCEPersistentDiskVolumeSource, s conversion.Scope) error { +func autoConvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in *api.GCEPersistentDiskVolumeSource, out *GCEPersistentDiskVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.GCEPersistentDiskVolumeSource))(in) } out.PDName = in.PDName out.FSType = in.FSType - out.Partition = in.Partition + out.Partition = int32(in.Partition) out.ReadOnly = in.ReadOnly return nil } -func convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in *api.GCEPersistentDiskVolumeSource, out *GCEPersistentDiskVolumeSource, s conversion.Scope) error { - return autoconvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in, out, s) +func Convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in *api.GCEPersistentDiskVolumeSource, out *GCEPersistentDiskVolumeSource, s conversion.Scope) error { + return autoConvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in, out, s) } -func autoconvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in *api.GitRepoVolumeSource, out *GitRepoVolumeSource, s conversion.Scope) error { +func autoConvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in *api.GitRepoVolumeSource, out *GitRepoVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.GitRepoVolumeSource))(in) } out.Repository = in.Repository out.Revision = in.Revision + out.Directory = in.Directory return nil } -func convert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in *api.GitRepoVolumeSource, out *GitRepoVolumeSource, s conversion.Scope) error { - return autoconvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in, out, s) +func Convert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in *api.GitRepoVolumeSource, out *GitRepoVolumeSource, s conversion.Scope) error { + return autoConvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in, out, s) } -func autoconvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.GlusterfsVolumeSource, out *GlusterfsVolumeSource, s conversion.Scope) error { +func autoConvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.GlusterfsVolumeSource, out *GlusterfsVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.GlusterfsVolumeSource))(in) } @@ -841,50 +1001,76 @@ func autoconvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.G return nil } -func convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.GlusterfsVolumeSource, out *GlusterfsVolumeSource, s conversion.Scope) error { - return autoconvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in, out, s) +func Convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.GlusterfsVolumeSource, out *GlusterfsVolumeSource, s conversion.Scope) error { + return autoConvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in, out, s) } -func autoconvert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, out *HTTPGetAction, s conversion.Scope) error { +func autoConvert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, out *HTTPGetAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.HTTPGetAction))(in) } out.Path = in.Path - if err := s.Convert(&in.Port, &out.Port, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.Port, &out.Port, s); err != nil { return err } out.Host = in.Host out.Scheme = URIScheme(in.Scheme) + if in.HTTPHeaders != nil { + out.HTTPHeaders = make([]HTTPHeader, len(in.HTTPHeaders)) + for i := range in.HTTPHeaders { + if err := Convert_api_HTTPHeader_To_v1_HTTPHeader(&in.HTTPHeaders[i], &out.HTTPHeaders[i], s); err != nil { + return err + } + } + } else { + out.HTTPHeaders = nil + } return nil } -func convert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, out *HTTPGetAction, s conversion.Scope) error { - return autoconvert_api_HTTPGetAction_To_v1_HTTPGetAction(in, out, s) +func Convert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, out *HTTPGetAction, s conversion.Scope) error { + return autoConvert_api_HTTPGetAction_To_v1_HTTPGetAction(in, out, s) } -func autoconvert_api_Handler_To_v1_Handler(in *api.Handler, out *Handler, s conversion.Scope) error { +func autoConvert_api_HTTPHeader_To_v1_HTTPHeader(in *api.HTTPHeader, out *HTTPHeader, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.HTTPHeader))(in) + } + out.Name = in.Name + out.Value = in.Value + return nil +} + +func Convert_api_HTTPHeader_To_v1_HTTPHeader(in *api.HTTPHeader, out *HTTPHeader, s conversion.Scope) error { + return autoConvert_api_HTTPHeader_To_v1_HTTPHeader(in, out, s) +} + +func autoConvert_api_Handler_To_v1_Handler(in *api.Handler, out *Handler, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Handler))(in) } + // unable to generate simple pointer conversion for api.ExecAction -> v1.ExecAction if in.Exec != nil { out.Exec = new(ExecAction) - if err := convert_api_ExecAction_To_v1_ExecAction(in.Exec, out.Exec, s); err != nil { + if err := Convert_api_ExecAction_To_v1_ExecAction(in.Exec, out.Exec, s); err != nil { return err } } else { out.Exec = nil } + // unable to generate simple pointer conversion for api.HTTPGetAction -> v1.HTTPGetAction if in.HTTPGet != nil { out.HTTPGet = new(HTTPGetAction) - if err := convert_api_HTTPGetAction_To_v1_HTTPGetAction(in.HTTPGet, out.HTTPGet, s); err != nil { + if err := Convert_api_HTTPGetAction_To_v1_HTTPGetAction(in.HTTPGet, out.HTTPGet, s); err != nil { return err } } else { out.HTTPGet = nil } + // unable to generate simple pointer conversion for api.TCPSocketAction -> v1.TCPSocketAction if in.TCPSocket != nil { out.TCPSocket = new(TCPSocketAction) - if err := convert_api_TCPSocketAction_To_v1_TCPSocketAction(in.TCPSocket, out.TCPSocket, s); err != nil { + if err := Convert_api_TCPSocketAction_To_v1_TCPSocketAction(in.TCPSocket, out.TCPSocket, s); err != nil { return err } } else { @@ -893,11 +1079,11 @@ func autoconvert_api_Handler_To_v1_Handler(in *api.Handler, out *Handler, s conv return nil } -func convert_api_Handler_To_v1_Handler(in *api.Handler, out *Handler, s conversion.Scope) error { - return autoconvert_api_Handler_To_v1_Handler(in, out, s) +func Convert_api_Handler_To_v1_Handler(in *api.Handler, out *Handler, s conversion.Scope) error { + return autoConvert_api_Handler_To_v1_Handler(in, out, s) } -func autoconvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.HostPathVolumeSource, out *HostPathVolumeSource, s conversion.Scope) error { +func autoConvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.HostPathVolumeSource, out *HostPathVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.HostPathVolumeSource))(in) } @@ -905,41 +1091,57 @@ func autoconvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.Hos return nil } -func convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.HostPathVolumeSource, out *HostPathVolumeSource, s conversion.Scope) error { - return autoconvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in, out, s) +func Convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.HostPathVolumeSource, out *HostPathVolumeSource, s conversion.Scope) error { + return autoConvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in, out, s) } -func autoconvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolumeSource, out *ISCSIVolumeSource, s conversion.Scope) error { +func autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolumeSource, out *ISCSIVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ISCSIVolumeSource))(in) } out.TargetPortal = in.TargetPortal out.IQN = in.IQN - out.Lun = in.Lun + out.Lun = int32(in.Lun) + out.ISCSIInterface = in.ISCSIInterface out.FSType = in.FSType out.ReadOnly = in.ReadOnly return nil } -func convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolumeSource, out *ISCSIVolumeSource, s conversion.Scope) error { - return autoconvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in, out, s) +func Convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolumeSource, out *ISCSIVolumeSource, s conversion.Scope) error { + return autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in, out, s) } -func autoconvert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *Lifecycle, s conversion.Scope) error { +func autoConvert_api_KeyToPath_To_v1_KeyToPath(in *api.KeyToPath, out *KeyToPath, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.KeyToPath))(in) + } + out.Key = in.Key + out.Path = in.Path + return nil +} + +func Convert_api_KeyToPath_To_v1_KeyToPath(in *api.KeyToPath, out *KeyToPath, s conversion.Scope) error { + return autoConvert_api_KeyToPath_To_v1_KeyToPath(in, out, s) +} + +func autoConvert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *Lifecycle, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Lifecycle))(in) } + // unable to generate simple pointer conversion for api.Handler -> v1.Handler if in.PostStart != nil { out.PostStart = new(Handler) - if err := convert_api_Handler_To_v1_Handler(in.PostStart, out.PostStart, s); err != nil { + if err := Convert_api_Handler_To_v1_Handler(in.PostStart, out.PostStart, s); err != nil { return err } } else { out.PostStart = nil } + // unable to generate simple pointer conversion for api.Handler -> v1.Handler if in.PreStop != nil { out.PreStop = new(Handler) - if err := convert_api_Handler_To_v1_Handler(in.PreStop, out.PreStop, s); err != nil { + if err := Convert_api_Handler_To_v1_Handler(in.PreStop, out.PreStop, s); err != nil { return err } } else { @@ -948,31 +1150,28 @@ func autoconvert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *Lifecycle return nil } -func convert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *Lifecycle, s conversion.Scope) error { - return autoconvert_api_Lifecycle_To_v1_Lifecycle(in, out, s) +func Convert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *Lifecycle, s conversion.Scope) error { + return autoConvert_api_Lifecycle_To_v1_Lifecycle(in, out, s) } -func autoconvert_api_LimitRange_To_v1_LimitRange(in *api.LimitRange, out *LimitRange, s conversion.Scope) error { +func autoConvert_api_LimitRange_To_v1_LimitRange(in *api.LimitRange, out *LimitRange, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.LimitRange))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_api_LimitRangeSpec_To_v1_LimitRangeSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_api_LimitRangeSpec_To_v1_LimitRangeSpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_api_LimitRange_To_v1_LimitRange(in *api.LimitRange, out *LimitRange, s conversion.Scope) error { - return autoconvert_api_LimitRange_To_v1_LimitRange(in, out, s) +func Convert_api_LimitRange_To_v1_LimitRange(in *api.LimitRange, out *LimitRange, s conversion.Scope) error { + return autoConvert_api_LimitRange_To_v1_LimitRange(in, out, s) } -func autoconvert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, out *LimitRangeItem, s conversion.Scope) error { +func autoConvert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, out *LimitRangeItem, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.LimitRangeItem))(in) } @@ -981,7 +1180,7 @@ func autoconvert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, out.Max = make(ResourceList) for key, val := range in.Max { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Max[ResourceName(key)] = newVal @@ -993,7 +1192,7 @@ func autoconvert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, out.Min = make(ResourceList) for key, val := range in.Min { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Min[ResourceName(key)] = newVal @@ -1005,7 +1204,7 @@ func autoconvert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, out.Default = make(ResourceList) for key, val := range in.Default { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Default[ResourceName(key)] = newVal @@ -1017,7 +1216,7 @@ func autoconvert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, out.DefaultRequest = make(ResourceList) for key, val := range in.DefaultRequest { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.DefaultRequest[ResourceName(key)] = newVal @@ -1029,7 +1228,7 @@ func autoconvert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, out.MaxLimitRequestRatio = make(ResourceList) for key, val := range in.MaxLimitRequestRatio { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.MaxLimitRequestRatio[ResourceName(key)] = newVal @@ -1040,24 +1239,21 @@ func autoconvert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, return nil } -func convert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, out *LimitRangeItem, s conversion.Scope) error { - return autoconvert_api_LimitRangeItem_To_v1_LimitRangeItem(in, out, s) +func Convert_api_LimitRangeItem_To_v1_LimitRangeItem(in *api.LimitRangeItem, out *LimitRangeItem, s conversion.Scope) error { + return autoConvert_api_LimitRangeItem_To_v1_LimitRangeItem(in, out, s) } -func autoconvert_api_LimitRangeList_To_v1_LimitRangeList(in *api.LimitRangeList, out *LimitRangeList, s conversion.Scope) error { +func autoConvert_api_LimitRangeList_To_v1_LimitRangeList(in *api.LimitRangeList, out *LimitRangeList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.LimitRangeList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]LimitRange, len(in.Items)) for i := range in.Items { - if err := convert_api_LimitRange_To_v1_LimitRange(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_LimitRange_To_v1_LimitRange(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -1067,18 +1263,18 @@ func autoconvert_api_LimitRangeList_To_v1_LimitRangeList(in *api.LimitRangeList, return nil } -func convert_api_LimitRangeList_To_v1_LimitRangeList(in *api.LimitRangeList, out *LimitRangeList, s conversion.Scope) error { - return autoconvert_api_LimitRangeList_To_v1_LimitRangeList(in, out, s) +func Convert_api_LimitRangeList_To_v1_LimitRangeList(in *api.LimitRangeList, out *LimitRangeList, s conversion.Scope) error { + return autoConvert_api_LimitRangeList_To_v1_LimitRangeList(in, out, s) } -func autoconvert_api_LimitRangeSpec_To_v1_LimitRangeSpec(in *api.LimitRangeSpec, out *LimitRangeSpec, s conversion.Scope) error { +func autoConvert_api_LimitRangeSpec_To_v1_LimitRangeSpec(in *api.LimitRangeSpec, out *LimitRangeSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.LimitRangeSpec))(in) } if in.Limits != nil { out.Limits = make([]LimitRangeItem, len(in.Limits)) for i := range in.Limits { - if err := convert_api_LimitRangeItem_To_v1_LimitRangeItem(&in.Limits[i], &out.Limits[i], s); err != nil { + if err := Convert_api_LimitRangeItem_To_v1_LimitRangeItem(&in.Limits[i], &out.Limits[i], s); err != nil { return err } } @@ -1088,149 +1284,21 @@ func autoconvert_api_LimitRangeSpec_To_v1_LimitRangeSpec(in *api.LimitRangeSpec, return nil } -func convert_api_LimitRangeSpec_To_v1_LimitRangeSpec(in *api.LimitRangeSpec, out *LimitRangeSpec, s conversion.Scope) error { - return autoconvert_api_LimitRangeSpec_To_v1_LimitRangeSpec(in, out, s) +func Convert_api_LimitRangeSpec_To_v1_LimitRangeSpec(in *api.LimitRangeSpec, out *LimitRangeSpec, s conversion.Scope) error { + return autoConvert_api_LimitRangeSpec_To_v1_LimitRangeSpec(in, out, s) } -func autoconvert_api_List_To_v1_List(in *api.List, out *List, s conversion.Scope) error { +func autoConvert_api_List_To_v1_List(in *api.List, out *List, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.List))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.Items, &out.Items, 0); err != nil { - return err - } - return nil -} - -func convert_api_List_To_v1_List(in *api.List, out *List, s conversion.Scope) error { - return autoconvert_api_List_To_v1_List(in, out, s) -} - -func autoconvert_api_ListOptions_To_v1_ListOptions(in *api.ListOptions, out *ListOptions, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*api.ListOptions))(in) - } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.LabelSelector, &out.LabelSelector, 0); err != nil { - return err - } - if err := s.Convert(&in.FieldSelector, &out.FieldSelector, 0); err != nil { - return err - } - out.Watch = in.Watch - out.ResourceVersion = in.ResourceVersion - return nil -} - -func convert_api_ListOptions_To_v1_ListOptions(in *api.ListOptions, out *ListOptions, s conversion.Scope) error { - return autoconvert_api_ListOptions_To_v1_ListOptions(in, out, s) -} - -func autoconvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadBalancerIngress, out *LoadBalancerIngress, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*api.LoadBalancerIngress))(in) - } - out.IP = in.IP - out.Hostname = in.Hostname - return nil -} - -func convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadBalancerIngress, out *LoadBalancerIngress, s conversion.Scope) error { - return autoconvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in, out, s) -} - -func autoconvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBalancerStatus, out *LoadBalancerStatus, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*api.LoadBalancerStatus))(in) - } - if in.Ingress != nil { - out.Ingress = make([]LoadBalancerIngress, len(in.Ingress)) - for i := range in.Ingress { - if err := convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { - return err - } - } - } else { - out.Ingress = nil - } - return nil -} - -func convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBalancerStatus, out *LoadBalancerStatus, s conversion.Scope) error { - return autoconvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in, out, s) -} - -func autoconvert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalObjectReference, out *LocalObjectReference, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*api.LocalObjectReference))(in) - } - out.Name = in.Name - return nil -} - -func convert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalObjectReference, out *LocalObjectReference, s conversion.Scope) error { - return autoconvert_api_LocalObjectReference_To_v1_LocalObjectReference(in, out, s) -} - -func autoconvert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in *api.NFSVolumeSource, out *NFSVolumeSource, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*api.NFSVolumeSource))(in) - } - out.Server = in.Server - out.Path = in.Path - out.ReadOnly = in.ReadOnly - return nil -} - -func convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in *api.NFSVolumeSource, out *NFSVolumeSource, s conversion.Scope) error { - return autoconvert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in, out, s) -} - -func autoconvert_api_Namespace_To_v1_Namespace(in *api.Namespace, out *Namespace, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*api.Namespace))(in) - } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_api_NamespaceSpec_To_v1_NamespaceSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_api_NamespaceStatus_To_v1_NamespaceStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -func convert_api_Namespace_To_v1_Namespace(in *api.Namespace, out *Namespace, s conversion.Scope) error { - return autoconvert_api_Namespace_To_v1_Namespace(in, out, s) -} - -func autoconvert_api_NamespaceList_To_v1_NamespaceList(in *api.NamespaceList, out *NamespaceList, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*api.NamespaceList))(in) - } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { - out.Items = make([]Namespace, len(in.Items)) + out.Items = make([]runtime.RawExtension, len(in.Items)) for i := range in.Items { - if err := convert_api_Namespace_To_v1_Namespace(&in.Items[i], &out.Items[i], s); err != nil { + if err := s.Convert(&in.Items[i], &out.Items[i], 0); err != nil { return err } } @@ -1240,11 +1308,140 @@ func autoconvert_api_NamespaceList_To_v1_NamespaceList(in *api.NamespaceList, ou return nil } -func convert_api_NamespaceList_To_v1_NamespaceList(in *api.NamespaceList, out *NamespaceList, s conversion.Scope) error { - return autoconvert_api_NamespaceList_To_v1_NamespaceList(in, out, s) +func Convert_api_List_To_v1_List(in *api.List, out *List, s conversion.Scope) error { + return autoConvert_api_List_To_v1_List(in, out, s) } -func autoconvert_api_NamespaceSpec_To_v1_NamespaceSpec(in *api.NamespaceSpec, out *NamespaceSpec, s conversion.Scope) error { +func autoConvert_api_ListOptions_To_v1_ListOptions(in *api.ListOptions, out *ListOptions, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.ListOptions))(in) + } + if err := api.Convert_labels_Selector_To_string(&in.LabelSelector, &out.LabelSelector, s); err != nil { + return err + } + if err := api.Convert_fields_Selector_To_string(&in.FieldSelector, &out.FieldSelector, s); err != nil { + return err + } + out.Watch = in.Watch + out.ResourceVersion = in.ResourceVersion + if in.TimeoutSeconds != nil { + out.TimeoutSeconds = new(int64) + *out.TimeoutSeconds = *in.TimeoutSeconds + } else { + out.TimeoutSeconds = nil + } + return nil +} + +func Convert_api_ListOptions_To_v1_ListOptions(in *api.ListOptions, out *ListOptions, s conversion.Scope) error { + return autoConvert_api_ListOptions_To_v1_ListOptions(in, out, s) +} + +func autoConvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadBalancerIngress, out *LoadBalancerIngress, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.LoadBalancerIngress))(in) + } + out.IP = in.IP + out.Hostname = in.Hostname + return nil +} + +func Convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadBalancerIngress, out *LoadBalancerIngress, s conversion.Scope) error { + return autoConvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in, out, s) +} + +func autoConvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBalancerStatus, out *LoadBalancerStatus, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.LoadBalancerStatus))(in) + } + if in.Ingress != nil { + out.Ingress = make([]LoadBalancerIngress, len(in.Ingress)) + for i := range in.Ingress { + if err := Convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { + return err + } + } + } else { + out.Ingress = nil + } + return nil +} + +func Convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBalancerStatus, out *LoadBalancerStatus, s conversion.Scope) error { + return autoConvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in, out, s) +} + +func autoConvert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalObjectReference, out *LocalObjectReference, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.LocalObjectReference))(in) + } + out.Name = in.Name + return nil +} + +func Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalObjectReference, out *LocalObjectReference, s conversion.Scope) error { + return autoConvert_api_LocalObjectReference_To_v1_LocalObjectReference(in, out, s) +} + +func autoConvert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in *api.NFSVolumeSource, out *NFSVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.NFSVolumeSource))(in) + } + out.Server = in.Server + out.Path = in.Path + out.ReadOnly = in.ReadOnly + return nil +} + +func Convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in *api.NFSVolumeSource, out *NFSVolumeSource, s conversion.Scope) error { + return autoConvert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in, out, s) +} + +func autoConvert_api_Namespace_To_v1_Namespace(in *api.Namespace, out *Namespace, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.Namespace))(in) + } + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_api_NamespaceSpec_To_v1_NamespaceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_api_NamespaceStatus_To_v1_NamespaceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func Convert_api_Namespace_To_v1_Namespace(in *api.Namespace, out *Namespace, s conversion.Scope) error { + return autoConvert_api_Namespace_To_v1_Namespace(in, out, s) +} + +func autoConvert_api_NamespaceList_To_v1_NamespaceList(in *api.NamespaceList, out *NamespaceList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.NamespaceList))(in) + } + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]Namespace, len(in.Items)) + for i := range in.Items { + if err := Convert_api_Namespace_To_v1_Namespace(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_api_NamespaceList_To_v1_NamespaceList(in *api.NamespaceList, out *NamespaceList, s conversion.Scope) error { + return autoConvert_api_NamespaceList_To_v1_NamespaceList(in, out, s) +} + +func autoConvert_api_NamespaceSpec_To_v1_NamespaceSpec(in *api.NamespaceSpec, out *NamespaceSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NamespaceSpec))(in) } @@ -1259,11 +1456,11 @@ func autoconvert_api_NamespaceSpec_To_v1_NamespaceSpec(in *api.NamespaceSpec, ou return nil } -func convert_api_NamespaceSpec_To_v1_NamespaceSpec(in *api.NamespaceSpec, out *NamespaceSpec, s conversion.Scope) error { - return autoconvert_api_NamespaceSpec_To_v1_NamespaceSpec(in, out, s) +func Convert_api_NamespaceSpec_To_v1_NamespaceSpec(in *api.NamespaceSpec, out *NamespaceSpec, s conversion.Scope) error { + return autoConvert_api_NamespaceSpec_To_v1_NamespaceSpec(in, out, s) } -func autoconvert_api_NamespaceStatus_To_v1_NamespaceStatus(in *api.NamespaceStatus, out *NamespaceStatus, s conversion.Scope) error { +func autoConvert_api_NamespaceStatus_To_v1_NamespaceStatus(in *api.NamespaceStatus, out *NamespaceStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NamespaceStatus))(in) } @@ -1271,34 +1468,31 @@ func autoconvert_api_NamespaceStatus_To_v1_NamespaceStatus(in *api.NamespaceStat return nil } -func convert_api_NamespaceStatus_To_v1_NamespaceStatus(in *api.NamespaceStatus, out *NamespaceStatus, s conversion.Scope) error { - return autoconvert_api_NamespaceStatus_To_v1_NamespaceStatus(in, out, s) +func Convert_api_NamespaceStatus_To_v1_NamespaceStatus(in *api.NamespaceStatus, out *NamespaceStatus, s conversion.Scope) error { + return autoConvert_api_NamespaceStatus_To_v1_NamespaceStatus(in, out, s) } -func autoconvert_api_Node_To_v1_Node(in *api.Node, out *Node, s conversion.Scope) error { +func autoConvert_api_Node_To_v1_Node(in *api.Node, out *Node, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Node))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_NodeSpec_To_v1_NodeSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_api_NodeSpec_To_v1_NodeSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_api_NodeStatus_To_v1_NodeStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_api_NodeStatus_To_v1_NodeStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_api_Node_To_v1_Node(in *api.Node, out *Node, s conversion.Scope) error { - return autoconvert_api_Node_To_v1_Node(in, out, s) +func Convert_api_Node_To_v1_Node(in *api.Node, out *Node, s conversion.Scope) error { + return autoConvert_api_Node_To_v1_Node(in, out, s) } -func autoconvert_api_NodeAddress_To_v1_NodeAddress(in *api.NodeAddress, out *NodeAddress, s conversion.Scope) error { +func autoConvert_api_NodeAddress_To_v1_NodeAddress(in *api.NodeAddress, out *NodeAddress, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NodeAddress))(in) } @@ -1307,20 +1501,20 @@ func autoconvert_api_NodeAddress_To_v1_NodeAddress(in *api.NodeAddress, out *Nod return nil } -func convert_api_NodeAddress_To_v1_NodeAddress(in *api.NodeAddress, out *NodeAddress, s conversion.Scope) error { - return autoconvert_api_NodeAddress_To_v1_NodeAddress(in, out, s) +func Convert_api_NodeAddress_To_v1_NodeAddress(in *api.NodeAddress, out *NodeAddress, s conversion.Scope) error { + return autoConvert_api_NodeAddress_To_v1_NodeAddress(in, out, s) } -func autoconvert_api_NodeCondition_To_v1_NodeCondition(in *api.NodeCondition, out *NodeCondition, s conversion.Scope) error { +func autoConvert_api_NodeCondition_To_v1_NodeCondition(in *api.NodeCondition, out *NodeCondition, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NodeCondition))(in) } out.Type = NodeConditionType(in.Type) out.Status = ConditionStatus(in.Status) - if err := s.Convert(&in.LastHeartbeatTime, &out.LastHeartbeatTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastHeartbeatTime, &out.LastHeartbeatTime, s); err != nil { return err } - if err := s.Convert(&in.LastTransitionTime, &out.LastTransitionTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastTransitionTime, &out.LastTransitionTime, s); err != nil { return err } out.Reason = in.Reason @@ -1328,38 +1522,35 @@ func autoconvert_api_NodeCondition_To_v1_NodeCondition(in *api.NodeCondition, ou return nil } -func convert_api_NodeCondition_To_v1_NodeCondition(in *api.NodeCondition, out *NodeCondition, s conversion.Scope) error { - return autoconvert_api_NodeCondition_To_v1_NodeCondition(in, out, s) +func Convert_api_NodeCondition_To_v1_NodeCondition(in *api.NodeCondition, out *NodeCondition, s conversion.Scope) error { + return autoConvert_api_NodeCondition_To_v1_NodeCondition(in, out, s) } -func autoconvert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints(in *api.NodeDaemonEndpoints, out *NodeDaemonEndpoints, s conversion.Scope) error { +func autoConvert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints(in *api.NodeDaemonEndpoints, out *NodeDaemonEndpoints, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NodeDaemonEndpoints))(in) } - if err := convert_api_DaemonEndpoint_To_v1_DaemonEndpoint(&in.KubeletEndpoint, &out.KubeletEndpoint, s); err != nil { + if err := Convert_api_DaemonEndpoint_To_v1_DaemonEndpoint(&in.KubeletEndpoint, &out.KubeletEndpoint, s); err != nil { return err } return nil } -func convert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints(in *api.NodeDaemonEndpoints, out *NodeDaemonEndpoints, s conversion.Scope) error { - return autoconvert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints(in, out, s) +func Convert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints(in *api.NodeDaemonEndpoints, out *NodeDaemonEndpoints, s conversion.Scope) error { + return autoConvert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints(in, out, s) } -func autoconvert_api_NodeList_To_v1_NodeList(in *api.NodeList, out *NodeList, s conversion.Scope) error { +func autoConvert_api_NodeList_To_v1_NodeList(in *api.NodeList, out *NodeList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NodeList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]Node, len(in.Items)) for i := range in.Items { - if err := convert_api_Node_To_v1_Node(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_Node_To_v1_Node(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -1369,11 +1560,11 @@ func autoconvert_api_NodeList_To_v1_NodeList(in *api.NodeList, out *NodeList, s return nil } -func convert_api_NodeList_To_v1_NodeList(in *api.NodeList, out *NodeList, s conversion.Scope) error { - return autoconvert_api_NodeList_To_v1_NodeList(in, out, s) +func Convert_api_NodeList_To_v1_NodeList(in *api.NodeList, out *NodeList, s conversion.Scope) error { + return autoConvert_api_NodeList_To_v1_NodeList(in, out, s) } -func autoconvert_api_NodeSpec_To_v1_NodeSpec(in *api.NodeSpec, out *NodeSpec, s conversion.Scope) error { +func autoConvert_api_NodeSpec_To_v1_NodeSpec(in *api.NodeSpec, out *NodeSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NodeSpec))(in) } @@ -1384,11 +1575,11 @@ func autoconvert_api_NodeSpec_To_v1_NodeSpec(in *api.NodeSpec, out *NodeSpec, s return nil } -func convert_api_NodeSpec_To_v1_NodeSpec(in *api.NodeSpec, out *NodeSpec, s conversion.Scope) error { - return autoconvert_api_NodeSpec_To_v1_NodeSpec(in, out, s) +func Convert_api_NodeSpec_To_v1_NodeSpec(in *api.NodeSpec, out *NodeSpec, s conversion.Scope) error { + return autoConvert_api_NodeSpec_To_v1_NodeSpec(in, out, s) } -func autoconvert_api_NodeStatus_To_v1_NodeStatus(in *api.NodeStatus, out *NodeStatus, s conversion.Scope) error { +func autoConvert_api_NodeStatus_To_v1_NodeStatus(in *api.NodeStatus, out *NodeStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NodeStatus))(in) } @@ -1396,7 +1587,7 @@ func autoconvert_api_NodeStatus_To_v1_NodeStatus(in *api.NodeStatus, out *NodeSt out.Capacity = make(ResourceList) for key, val := range in.Capacity { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Capacity[ResourceName(key)] = newVal @@ -1404,11 +1595,23 @@ func autoconvert_api_NodeStatus_To_v1_NodeStatus(in *api.NodeStatus, out *NodeSt } else { out.Capacity = nil } + if in.Allocatable != nil { + out.Allocatable = make(ResourceList) + for key, val := range in.Allocatable { + newVal := resource.Quantity{} + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { + return err + } + out.Allocatable[ResourceName(key)] = newVal + } + } else { + out.Allocatable = nil + } out.Phase = NodePhase(in.Phase) if in.Conditions != nil { out.Conditions = make([]NodeCondition, len(in.Conditions)) for i := range in.Conditions { - if err := convert_api_NodeCondition_To_v1_NodeCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { + if err := Convert_api_NodeCondition_To_v1_NodeCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { return err } } @@ -1418,27 +1621,37 @@ func autoconvert_api_NodeStatus_To_v1_NodeStatus(in *api.NodeStatus, out *NodeSt if in.Addresses != nil { out.Addresses = make([]NodeAddress, len(in.Addresses)) for i := range in.Addresses { - if err := convert_api_NodeAddress_To_v1_NodeAddress(&in.Addresses[i], &out.Addresses[i], s); err != nil { + if err := Convert_api_NodeAddress_To_v1_NodeAddress(&in.Addresses[i], &out.Addresses[i], s); err != nil { return err } } } else { out.Addresses = nil } - if err := convert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints(&in.DaemonEndpoints, &out.DaemonEndpoints, s); err != nil { + if err := Convert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints(&in.DaemonEndpoints, &out.DaemonEndpoints, s); err != nil { return err } - if err := convert_api_NodeSystemInfo_To_v1_NodeSystemInfo(&in.NodeInfo, &out.NodeInfo, s); err != nil { + if err := Convert_api_NodeSystemInfo_To_v1_NodeSystemInfo(&in.NodeInfo, &out.NodeInfo, s); err != nil { return err } + if in.Images != nil { + out.Images = make([]ContainerImage, len(in.Images)) + for i := range in.Images { + if err := Convert_api_ContainerImage_To_v1_ContainerImage(&in.Images[i], &out.Images[i], s); err != nil { + return err + } + } + } else { + out.Images = nil + } return nil } -func convert_api_NodeStatus_To_v1_NodeStatus(in *api.NodeStatus, out *NodeStatus, s conversion.Scope) error { - return autoconvert_api_NodeStatus_To_v1_NodeStatus(in, out, s) +func Convert_api_NodeStatus_To_v1_NodeStatus(in *api.NodeStatus, out *NodeStatus, s conversion.Scope) error { + return autoConvert_api_NodeStatus_To_v1_NodeStatus(in, out, s) } -func autoconvert_api_NodeSystemInfo_To_v1_NodeSystemInfo(in *api.NodeSystemInfo, out *NodeSystemInfo, s conversion.Scope) error { +func autoConvert_api_NodeSystemInfo_To_v1_NodeSystemInfo(in *api.NodeSystemInfo, out *NodeSystemInfo, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NodeSystemInfo))(in) } @@ -1446,18 +1659,18 @@ func autoconvert_api_NodeSystemInfo_To_v1_NodeSystemInfo(in *api.NodeSystemInfo, out.SystemUUID = in.SystemUUID out.BootID = in.BootID out.KernelVersion = in.KernelVersion - out.OsImage = in.OsImage + out.OSImage = in.OSImage out.ContainerRuntimeVersion = in.ContainerRuntimeVersion out.KubeletVersion = in.KubeletVersion out.KubeProxyVersion = in.KubeProxyVersion return nil } -func convert_api_NodeSystemInfo_To_v1_NodeSystemInfo(in *api.NodeSystemInfo, out *NodeSystemInfo, s conversion.Scope) error { - return autoconvert_api_NodeSystemInfo_To_v1_NodeSystemInfo(in, out, s) +func Convert_api_NodeSystemInfo_To_v1_NodeSystemInfo(in *api.NodeSystemInfo, out *NodeSystemInfo, s conversion.Scope) error { + return autoConvert_api_NodeSystemInfo_To_v1_NodeSystemInfo(in, out, s) } -func autoconvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.ObjectFieldSelector, out *ObjectFieldSelector, s conversion.Scope) error { +func autoConvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.ObjectFieldSelector, out *ObjectFieldSelector, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ObjectFieldSelector))(in) } @@ -1466,11 +1679,11 @@ func autoconvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.Objec return nil } -func convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.ObjectFieldSelector, out *ObjectFieldSelector, s conversion.Scope) error { - return autoconvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in, out, s) +func Convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.ObjectFieldSelector, out *ObjectFieldSelector, s conversion.Scope) error { + return autoConvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in, out, s) } -func autoconvert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { +func autoConvert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ObjectMeta))(in) } @@ -1481,11 +1694,13 @@ func autoconvert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *Object out.UID = in.UID out.ResourceVersion = in.ResourceVersion out.Generation = in.Generation - if err := s.Convert(&in.CreationTimestamp, &out.CreationTimestamp, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.CreationTimestamp, &out.CreationTimestamp, s); err != nil { return err } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.DeletionTimestamp != nil { - if err := s.Convert(&in.DeletionTimestamp, &out.DeletionTimestamp, 0); err != nil { + out.DeletionTimestamp = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.DeletionTimestamp, out.DeletionTimestamp, s); err != nil { return err } } else { @@ -1516,11 +1731,11 @@ func autoconvert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *Object return nil } -func convert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { - return autoconvert_api_ObjectMeta_To_v1_ObjectMeta(in, out, s) +func Convert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { + return autoConvert_api_ObjectMeta_To_v1_ObjectMeta(in, out, s) } -func autoconvert_api_ObjectReference_To_v1_ObjectReference(in *api.ObjectReference, out *ObjectReference, s conversion.Scope) error { +func autoConvert_api_ObjectReference_To_v1_ObjectReference(in *api.ObjectReference, out *ObjectReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ObjectReference))(in) } @@ -1534,70 +1749,61 @@ func autoconvert_api_ObjectReference_To_v1_ObjectReference(in *api.ObjectReferen return nil } -func convert_api_ObjectReference_To_v1_ObjectReference(in *api.ObjectReference, out *ObjectReference, s conversion.Scope) error { - return autoconvert_api_ObjectReference_To_v1_ObjectReference(in, out, s) +func Convert_api_ObjectReference_To_v1_ObjectReference(in *api.ObjectReference, out *ObjectReference, s conversion.Scope) error { + return autoConvert_api_ObjectReference_To_v1_ObjectReference(in, out, s) } -func autoconvert_api_PersistentVolume_To_v1_PersistentVolume(in *api.PersistentVolume, out *PersistentVolume, s conversion.Scope) error { +func autoConvert_api_PersistentVolume_To_v1_PersistentVolume(in *api.PersistentVolume, out *PersistentVolume, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolume))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_api_PersistentVolume_To_v1_PersistentVolume(in *api.PersistentVolume, out *PersistentVolume, s conversion.Scope) error { - return autoconvert_api_PersistentVolume_To_v1_PersistentVolume(in, out, s) +func Convert_api_PersistentVolume_To_v1_PersistentVolume(in *api.PersistentVolume, out *PersistentVolume, s conversion.Scope) error { + return autoConvert_api_PersistentVolume_To_v1_PersistentVolume(in, out, s) } -func autoconvert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim(in *api.PersistentVolumeClaim, out *PersistentVolumeClaim, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim(in *api.PersistentVolumeClaim, out *PersistentVolumeClaim, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeClaim))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim(in *api.PersistentVolumeClaim, out *PersistentVolumeClaim, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim(in, out, s) +func Convert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim(in *api.PersistentVolumeClaim, out *PersistentVolumeClaim, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim(in, out, s) } -func autoconvert_api_PersistentVolumeClaimList_To_v1_PersistentVolumeClaimList(in *api.PersistentVolumeClaimList, out *PersistentVolumeClaimList, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeClaimList_To_v1_PersistentVolumeClaimList(in *api.PersistentVolumeClaimList, out *PersistentVolumeClaimList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeClaimList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]PersistentVolumeClaim, len(in.Items)) for i := range in.Items { - if err := convert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -1607,11 +1813,11 @@ func autoconvert_api_PersistentVolumeClaimList_To_v1_PersistentVolumeClaimList(i return nil } -func convert_api_PersistentVolumeClaimList_To_v1_PersistentVolumeClaimList(in *api.PersistentVolumeClaimList, out *PersistentVolumeClaimList, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeClaimList_To_v1_PersistentVolumeClaimList(in, out, s) +func Convert_api_PersistentVolumeClaimList_To_v1_PersistentVolumeClaimList(in *api.PersistentVolumeClaimList, out *PersistentVolumeClaimList, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeClaimList_To_v1_PersistentVolumeClaimList(in, out, s) } -func autoconvert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(in *api.PersistentVolumeClaimSpec, out *PersistentVolumeClaimSpec, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(in *api.PersistentVolumeClaimSpec, out *PersistentVolumeClaimSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeClaimSpec))(in) } @@ -1623,18 +1829,18 @@ func autoconvert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(i } else { out.AccessModes = nil } - if err := convert_api_ResourceRequirements_To_v1_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { + if err := Convert_api_ResourceRequirements_To_v1_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { return err } out.VolumeName = in.VolumeName return nil } -func convert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(in *api.PersistentVolumeClaimSpec, out *PersistentVolumeClaimSpec, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(in, out, s) +func Convert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(in *api.PersistentVolumeClaimSpec, out *PersistentVolumeClaimSpec, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(in, out, s) } -func autoconvert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(in *api.PersistentVolumeClaimStatus, out *PersistentVolumeClaimStatus, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(in *api.PersistentVolumeClaimStatus, out *PersistentVolumeClaimStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeClaimStatus))(in) } @@ -1651,7 +1857,7 @@ func autoconvert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStat out.Capacity = make(ResourceList) for key, val := range in.Capacity { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Capacity[ResourceName(key)] = newVal @@ -1662,11 +1868,11 @@ func autoconvert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStat return nil } -func convert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(in *api.PersistentVolumeClaimStatus, out *PersistentVolumeClaimStatus, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(in, out, s) +func Convert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(in *api.PersistentVolumeClaimStatus, out *PersistentVolumeClaimStatus, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(in, out, s) } -func autoconvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in *api.PersistentVolumeClaimVolumeSource, out *PersistentVolumeClaimVolumeSource, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in *api.PersistentVolumeClaimVolumeSource, out *PersistentVolumeClaimVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeClaimVolumeSource))(in) } @@ -1675,24 +1881,21 @@ func autoconvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeCla return nil } -func convert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in *api.PersistentVolumeClaimVolumeSource, out *PersistentVolumeClaimVolumeSource, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in, out, s) +func Convert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in *api.PersistentVolumeClaimVolumeSource, out *PersistentVolumeClaimVolumeSource, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in, out, s) } -func autoconvert_api_PersistentVolumeList_To_v1_PersistentVolumeList(in *api.PersistentVolumeList, out *PersistentVolumeList, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeList_To_v1_PersistentVolumeList(in *api.PersistentVolumeList, out *PersistentVolumeList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]PersistentVolume, len(in.Items)) for i := range in.Items { - if err := convert_api_PersistentVolume_To_v1_PersistentVolume(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_PersistentVolume_To_v1_PersistentVolume(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -1702,110 +1905,139 @@ func autoconvert_api_PersistentVolumeList_To_v1_PersistentVolumeList(in *api.Per return nil } -func convert_api_PersistentVolumeList_To_v1_PersistentVolumeList(in *api.PersistentVolumeList, out *PersistentVolumeList, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeList_To_v1_PersistentVolumeList(in, out, s) +func Convert_api_PersistentVolumeList_To_v1_PersistentVolumeList(in *api.PersistentVolumeList, out *PersistentVolumeList, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeList_To_v1_PersistentVolumeList(in, out, s) } -func autoconvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in *api.PersistentVolumeSource, out *PersistentVolumeSource, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in *api.PersistentVolumeSource, out *PersistentVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeSource))(in) } + // unable to generate simple pointer conversion for api.GCEPersistentDiskVolumeSource -> v1.GCEPersistentDiskVolumeSource if in.GCEPersistentDisk != nil { out.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) - if err := convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { + if err := Convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { return err } } else { out.GCEPersistentDisk = nil } + // unable to generate simple pointer conversion for api.AWSElasticBlockStoreVolumeSource -> v1.AWSElasticBlockStoreVolumeSource if in.AWSElasticBlockStore != nil { out.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) - if err := convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { + if err := Convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { return err } } else { out.AWSElasticBlockStore = nil } + // unable to generate simple pointer conversion for api.HostPathVolumeSource -> v1.HostPathVolumeSource if in.HostPath != nil { out.HostPath = new(HostPathVolumeSource) - if err := convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { + if err := Convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { return err } } else { out.HostPath = nil } + // unable to generate simple pointer conversion for api.GlusterfsVolumeSource -> v1.GlusterfsVolumeSource if in.Glusterfs != nil { out.Glusterfs = new(GlusterfsVolumeSource) - if err := convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { + if err := Convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { return err } } else { out.Glusterfs = nil } + // unable to generate simple pointer conversion for api.NFSVolumeSource -> v1.NFSVolumeSource if in.NFS != nil { out.NFS = new(NFSVolumeSource) - if err := convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { + if err := Convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { return err } } else { out.NFS = nil } + // unable to generate simple pointer conversion for api.RBDVolumeSource -> v1.RBDVolumeSource if in.RBD != nil { out.RBD = new(RBDVolumeSource) - if err := convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { + if err := Convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { return err } } else { out.RBD = nil } + // unable to generate simple pointer conversion for api.ISCSIVolumeSource -> v1.ISCSIVolumeSource if in.ISCSI != nil { out.ISCSI = new(ISCSIVolumeSource) - if err := convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { + if err := Convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { return err } } else { out.ISCSI = nil } + // unable to generate simple pointer conversion for api.FlexVolumeSource -> v1.FlexVolumeSource + if in.FlexVolume != nil { + out.FlexVolume = new(FlexVolumeSource) + if err := Convert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in.FlexVolume, out.FlexVolume, s); err != nil { + return err + } + } else { + out.FlexVolume = nil + } + // unable to generate simple pointer conversion for api.CinderVolumeSource -> v1.CinderVolumeSource if in.Cinder != nil { out.Cinder = new(CinderVolumeSource) - if err := convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { + if err := Convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { return err } } else { out.Cinder = nil } + // unable to generate simple pointer conversion for api.CephFSVolumeSource -> v1.CephFSVolumeSource if in.CephFS != nil { out.CephFS = new(CephFSVolumeSource) - if err := convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { + if err := Convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { return err } } else { out.CephFS = nil } + // unable to generate simple pointer conversion for api.FCVolumeSource -> v1.FCVolumeSource if in.FC != nil { out.FC = new(FCVolumeSource) - if err := convert_api_FCVolumeSource_To_v1_FCVolumeSource(in.FC, out.FC, s); err != nil { + if err := Convert_api_FCVolumeSource_To_v1_FCVolumeSource(in.FC, out.FC, s); err != nil { return err } } else { out.FC = nil } + // unable to generate simple pointer conversion for api.FlockerVolumeSource -> v1.FlockerVolumeSource if in.Flocker != nil { out.Flocker = new(FlockerVolumeSource) - if err := convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { + if err := Convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { return err } } else { out.Flocker = nil } + // unable to generate simple pointer conversion for api.AzureFileVolumeSource -> v1.AzureFileVolumeSource + if in.AzureFile != nil { + out.AzureFile = new(AzureFileVolumeSource) + if err := Convert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource(in.AzureFile, out.AzureFile, s); err != nil { + return err + } + } else { + out.AzureFile = nil + } return nil } -func convert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in *api.PersistentVolumeSource, out *PersistentVolumeSource, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in, out, s) +func Convert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in *api.PersistentVolumeSource, out *PersistentVolumeSource, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in, out, s) } -func autoconvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *api.PersistentVolumeSpec, out *PersistentVolumeSpec, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *api.PersistentVolumeSpec, out *PersistentVolumeSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeSpec))(in) } @@ -1813,7 +2045,7 @@ func autoconvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *api.Per out.Capacity = make(ResourceList) for key, val := range in.Capacity { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Capacity[ResourceName(key)] = newVal @@ -1821,7 +2053,7 @@ func autoconvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *api.Per } else { out.Capacity = nil } - if err := convert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(&in.PersistentVolumeSource, &out.PersistentVolumeSource, s); err != nil { + if err := Convert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(&in.PersistentVolumeSource, &out.PersistentVolumeSource, s); err != nil { return err } if in.AccessModes != nil { @@ -1832,9 +2064,10 @@ func autoconvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *api.Per } else { out.AccessModes = nil } + // unable to generate simple pointer conversion for api.ObjectReference -> v1.ObjectReference if in.ClaimRef != nil { out.ClaimRef = new(ObjectReference) - if err := convert_api_ObjectReference_To_v1_ObjectReference(in.ClaimRef, out.ClaimRef, s); err != nil { + if err := Convert_api_ObjectReference_To_v1_ObjectReference(in.ClaimRef, out.ClaimRef, s); err != nil { return err } } else { @@ -1844,11 +2077,11 @@ func autoconvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *api.Per return nil } -func convert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *api.PersistentVolumeSpec, out *PersistentVolumeSpec, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in, out, s) +func Convert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *api.PersistentVolumeSpec, out *PersistentVolumeSpec, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in, out, s) } -func autoconvert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus(in *api.PersistentVolumeStatus, out *PersistentVolumeStatus, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus(in *api.PersistentVolumeStatus, out *PersistentVolumeStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeStatus))(in) } @@ -1858,40 +2091,30 @@ func autoconvert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus(in *api return nil } -func convert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus(in *api.PersistentVolumeStatus, out *PersistentVolumeStatus, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus(in, out, s) +func Convert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus(in *api.PersistentVolumeStatus, out *PersistentVolumeStatus, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus(in, out, s) } -func autoconvert_api_Pod_To_v1_Pod(in *api.Pod, out *Pod, s conversion.Scope) error { +func autoConvert_api_Pod_To_v1_Pod(in *api.Pod, out *Pod, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Pod))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_PodSpec_To_v1_PodSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_api_PodSpec_To_v1_PodSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_api_PodStatus_To_v1_PodStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_api_PodStatus_To_v1_PodStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_api_Pod_To_v1_Pod(in *api.Pod, out *Pod, s conversion.Scope) error { - return autoconvert_api_Pod_To_v1_Pod(in, out, s) -} - -func autoconvert_api_PodAttachOptions_To_v1_PodAttachOptions(in *api.PodAttachOptions, out *PodAttachOptions, s conversion.Scope) error { +func autoConvert_api_PodAttachOptions_To_v1_PodAttachOptions(in *api.PodAttachOptions, out *PodAttachOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodAttachOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } out.Stdin = in.Stdin out.Stdout = in.Stdout out.Stderr = in.Stderr @@ -1900,20 +2123,20 @@ func autoconvert_api_PodAttachOptions_To_v1_PodAttachOptions(in *api.PodAttachOp return nil } -func convert_api_PodAttachOptions_To_v1_PodAttachOptions(in *api.PodAttachOptions, out *PodAttachOptions, s conversion.Scope) error { - return autoconvert_api_PodAttachOptions_To_v1_PodAttachOptions(in, out, s) +func Convert_api_PodAttachOptions_To_v1_PodAttachOptions(in *api.PodAttachOptions, out *PodAttachOptions, s conversion.Scope) error { + return autoConvert_api_PodAttachOptions_To_v1_PodAttachOptions(in, out, s) } -func autoconvert_api_PodCondition_To_v1_PodCondition(in *api.PodCondition, out *PodCondition, s conversion.Scope) error { +func autoConvert_api_PodCondition_To_v1_PodCondition(in *api.PodCondition, out *PodCondition, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodCondition))(in) } out.Type = PodConditionType(in.Type) out.Status = ConditionStatus(in.Status) - if err := s.Convert(&in.LastProbeTime, &out.LastProbeTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastProbeTime, &out.LastProbeTime, s); err != nil { return err } - if err := s.Convert(&in.LastTransitionTime, &out.LastTransitionTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastTransitionTime, &out.LastTransitionTime, s); err != nil { return err } out.Reason = in.Reason @@ -1921,17 +2144,14 @@ func autoconvert_api_PodCondition_To_v1_PodCondition(in *api.PodCondition, out * return nil } -func convert_api_PodCondition_To_v1_PodCondition(in *api.PodCondition, out *PodCondition, s conversion.Scope) error { - return autoconvert_api_PodCondition_To_v1_PodCondition(in, out, s) +func Convert_api_PodCondition_To_v1_PodCondition(in *api.PodCondition, out *PodCondition, s conversion.Scope) error { + return autoConvert_api_PodCondition_To_v1_PodCondition(in, out, s) } -func autoconvert_api_PodExecOptions_To_v1_PodExecOptions(in *api.PodExecOptions, out *PodExecOptions, s conversion.Scope) error { +func autoConvert_api_PodExecOptions_To_v1_PodExecOptions(in *api.PodExecOptions, out *PodExecOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodExecOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } out.Stdin = in.Stdin out.Stdout = in.Stdout out.Stderr = in.Stderr @@ -1948,24 +2168,21 @@ func autoconvert_api_PodExecOptions_To_v1_PodExecOptions(in *api.PodExecOptions, return nil } -func convert_api_PodExecOptions_To_v1_PodExecOptions(in *api.PodExecOptions, out *PodExecOptions, s conversion.Scope) error { - return autoconvert_api_PodExecOptions_To_v1_PodExecOptions(in, out, s) +func Convert_api_PodExecOptions_To_v1_PodExecOptions(in *api.PodExecOptions, out *PodExecOptions, s conversion.Scope) error { + return autoConvert_api_PodExecOptions_To_v1_PodExecOptions(in, out, s) } -func autoconvert_api_PodList_To_v1_PodList(in *api.PodList, out *PodList, s conversion.Scope) error { +func autoConvert_api_PodList_To_v1_PodList(in *api.PodList, out *PodList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]Pod, len(in.Items)) for i := range in.Items { - if err := convert_api_Pod_To_v1_Pod(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_Pod_To_v1_Pod(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -1975,17 +2192,14 @@ func autoconvert_api_PodList_To_v1_PodList(in *api.PodList, out *PodList, s conv return nil } -func convert_api_PodList_To_v1_PodList(in *api.PodList, out *PodList, s conversion.Scope) error { - return autoconvert_api_PodList_To_v1_PodList(in, out, s) +func Convert_api_PodList_To_v1_PodList(in *api.PodList, out *PodList, s conversion.Scope) error { + return autoConvert_api_PodList_To_v1_PodList(in, out, s) } -func autoconvert_api_PodLogOptions_To_v1_PodLogOptions(in *api.PodLogOptions, out *PodLogOptions, s conversion.Scope) error { +func autoConvert_api_PodLogOptions_To_v1_PodLogOptions(in *api.PodLogOptions, out *PodLogOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodLogOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } out.Container = in.Container out.Follow = in.Follow out.Previous = in.Previous @@ -1995,8 +2209,10 @@ func autoconvert_api_PodLogOptions_To_v1_PodLogOptions(in *api.PodLogOptions, ou } else { out.SinceSeconds = nil } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.SinceTime != nil { - if err := s.Convert(&in.SinceTime, &out.SinceTime, 0); err != nil { + out.SinceTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.SinceTime, out.SinceTime, s); err != nil { return err } } else { @@ -2018,33 +2234,30 @@ func autoconvert_api_PodLogOptions_To_v1_PodLogOptions(in *api.PodLogOptions, ou return nil } -func convert_api_PodLogOptions_To_v1_PodLogOptions(in *api.PodLogOptions, out *PodLogOptions, s conversion.Scope) error { - return autoconvert_api_PodLogOptions_To_v1_PodLogOptions(in, out, s) +func Convert_api_PodLogOptions_To_v1_PodLogOptions(in *api.PodLogOptions, out *PodLogOptions, s conversion.Scope) error { + return autoConvert_api_PodLogOptions_To_v1_PodLogOptions(in, out, s) } -func autoconvert_api_PodProxyOptions_To_v1_PodProxyOptions(in *api.PodProxyOptions, out *PodProxyOptions, s conversion.Scope) error { +func autoConvert_api_PodProxyOptions_To_v1_PodProxyOptions(in *api.PodProxyOptions, out *PodProxyOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodProxyOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } out.Path = in.Path return nil } -func convert_api_PodProxyOptions_To_v1_PodProxyOptions(in *api.PodProxyOptions, out *PodProxyOptions, s conversion.Scope) error { - return autoconvert_api_PodProxyOptions_To_v1_PodProxyOptions(in, out, s) +func Convert_api_PodProxyOptions_To_v1_PodProxyOptions(in *api.PodProxyOptions, out *PodProxyOptions, s conversion.Scope) error { + return autoConvert_api_PodProxyOptions_To_v1_PodProxyOptions(in, out, s) } -func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversion.Scope) error { +func autoConvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodSpec))(in) } if in.Volumes != nil { out.Volumes = make([]Volume, len(in.Volumes)) for i := range in.Volumes { - if err := convert_api_Volume_To_v1_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { + if err := Convert_api_Volume_To_v1_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { return err } } @@ -2054,7 +2267,7 @@ func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conv if in.Containers != nil { out.Containers = make([]Container, len(in.Containers)) for i := range in.Containers { - if err := convert_api_Container_To_v1_Container(&in.Containers[i], &out.Containers[i], s); err != nil { + if err := Convert_api_Container_To_v1_Container(&in.Containers[i], &out.Containers[i], s); err != nil { return err } } @@ -2085,6 +2298,7 @@ func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conv } out.ServiceAccountName = in.ServiceAccountName out.NodeName = in.NodeName + // unable to generate simple pointer conversion for api.PodSecurityContext -> v1.PodSecurityContext if in.SecurityContext != nil { if err := s.Convert(&in.SecurityContext, &out.SecurityContext, 0); err != nil { return err @@ -2095,7 +2309,7 @@ func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conv if in.ImagePullSecrets != nil { out.ImagePullSecrets = make([]LocalObjectReference, len(in.ImagePullSecrets)) for i := range in.ImagePullSecrets { - if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { return err } } @@ -2105,7 +2319,7 @@ func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conv return nil } -func autoconvert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus, s conversion.Scope) error { +func autoConvert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodStatus))(in) } @@ -2113,7 +2327,7 @@ func autoconvert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus if in.Conditions != nil { out.Conditions = make([]PodCondition, len(in.Conditions)) for i := range in.Conditions { - if err := convert_api_PodCondition_To_v1_PodCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { + if err := Convert_api_PodCondition_To_v1_PodCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { return err } } @@ -2124,8 +2338,10 @@ func autoconvert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus out.Reason = in.Reason out.HostIP = in.HostIP out.PodIP = in.PodIP + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.StartTime != nil { - if err := s.Convert(&in.StartTime, &out.StartTime, 0); err != nil { + out.StartTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.StartTime, out.StartTime, s); err != nil { return err } } else { @@ -2134,7 +2350,7 @@ func autoconvert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus if in.ContainerStatuses != nil { out.ContainerStatuses = make([]ContainerStatus, len(in.ContainerStatuses)) for i := range in.ContainerStatuses { - if err := convert_api_ContainerStatus_To_v1_ContainerStatus(&in.ContainerStatuses[i], &out.ContainerStatuses[i], s); err != nil { + if err := Convert_api_ContainerStatus_To_v1_ContainerStatus(&in.ContainerStatuses[i], &out.ContainerStatuses[i], s); err != nil { return err } } @@ -2144,64 +2360,55 @@ func autoconvert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus return nil } -func convert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus, s conversion.Scope) error { - return autoconvert_api_PodStatus_To_v1_PodStatus(in, out, s) +func Convert_api_PodStatus_To_v1_PodStatus(in *api.PodStatus, out *PodStatus, s conversion.Scope) error { + return autoConvert_api_PodStatus_To_v1_PodStatus(in, out, s) } -func autoconvert_api_PodStatusResult_To_v1_PodStatusResult(in *api.PodStatusResult, out *PodStatusResult, s conversion.Scope) error { +func autoConvert_api_PodStatusResult_To_v1_PodStatusResult(in *api.PodStatusResult, out *PodStatusResult, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodStatusResult))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_api_PodStatus_To_v1_PodStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_api_PodStatus_To_v1_PodStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_api_PodStatusResult_To_v1_PodStatusResult(in *api.PodStatusResult, out *PodStatusResult, s conversion.Scope) error { - return autoconvert_api_PodStatusResult_To_v1_PodStatusResult(in, out, s) +func Convert_api_PodStatusResult_To_v1_PodStatusResult(in *api.PodStatusResult, out *PodStatusResult, s conversion.Scope) error { + return autoConvert_api_PodStatusResult_To_v1_PodStatusResult(in, out, s) } -func autoconvert_api_PodTemplate_To_v1_PodTemplate(in *api.PodTemplate, out *PodTemplate, s conversion.Scope) error { +func autoConvert_api_PodTemplate_To_v1_PodTemplate(in *api.PodTemplate, out *PodTemplate, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodTemplate))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { + if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { return err } return nil } -func convert_api_PodTemplate_To_v1_PodTemplate(in *api.PodTemplate, out *PodTemplate, s conversion.Scope) error { - return autoconvert_api_PodTemplate_To_v1_PodTemplate(in, out, s) +func Convert_api_PodTemplate_To_v1_PodTemplate(in *api.PodTemplate, out *PodTemplate, s conversion.Scope) error { + return autoConvert_api_PodTemplate_To_v1_PodTemplate(in, out, s) } -func autoconvert_api_PodTemplateList_To_v1_PodTemplateList(in *api.PodTemplateList, out *PodTemplateList, s conversion.Scope) error { +func autoConvert_api_PodTemplateList_To_v1_PodTemplateList(in *api.PodTemplateList, out *PodTemplateList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodTemplateList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]PodTemplate, len(in.Items)) for i := range in.Items { - if err := convert_api_PodTemplate_To_v1_PodTemplate(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_PodTemplate_To_v1_PodTemplate(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2211,44 +2418,47 @@ func autoconvert_api_PodTemplateList_To_v1_PodTemplateList(in *api.PodTemplateLi return nil } -func convert_api_PodTemplateList_To_v1_PodTemplateList(in *api.PodTemplateList, out *PodTemplateList, s conversion.Scope) error { - return autoconvert_api_PodTemplateList_To_v1_PodTemplateList(in, out, s) +func Convert_api_PodTemplateList_To_v1_PodTemplateList(in *api.PodTemplateList, out *PodTemplateList, s conversion.Scope) error { + return autoConvert_api_PodTemplateList_To_v1_PodTemplateList(in, out, s) } -func autoconvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSpec, out *PodTemplateSpec, s conversion.Scope) error { +func autoConvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSpec, out *PodTemplateSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodTemplateSpec))(in) } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_PodSpec_To_v1_PodSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_api_PodSpec_To_v1_PodSpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSpec, out *PodTemplateSpec, s conversion.Scope) error { - return autoconvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in, out, s) +func Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSpec, out *PodTemplateSpec, s conversion.Scope) error { + return autoConvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in, out, s) } -func autoconvert_api_Probe_To_v1_Probe(in *api.Probe, out *Probe, s conversion.Scope) error { +func autoConvert_api_Probe_To_v1_Probe(in *api.Probe, out *Probe, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Probe))(in) } - if err := convert_api_Handler_To_v1_Handler(&in.Handler, &out.Handler, s); err != nil { + if err := Convert_api_Handler_To_v1_Handler(&in.Handler, &out.Handler, s); err != nil { return err } - out.InitialDelaySeconds = in.InitialDelaySeconds - out.TimeoutSeconds = in.TimeoutSeconds + out.InitialDelaySeconds = int32(in.InitialDelaySeconds) + out.TimeoutSeconds = int32(in.TimeoutSeconds) + out.PeriodSeconds = int32(in.PeriodSeconds) + out.SuccessThreshold = int32(in.SuccessThreshold) + out.FailureThreshold = int32(in.FailureThreshold) return nil } -func convert_api_Probe_To_v1_Probe(in *api.Probe, out *Probe, s conversion.Scope) error { - return autoconvert_api_Probe_To_v1_Probe(in, out, s) +func Convert_api_Probe_To_v1_Probe(in *api.Probe, out *Probe, s conversion.Scope) error { + return autoConvert_api_Probe_To_v1_Probe(in, out, s) } -func autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSource, out *RBDVolumeSource, s conversion.Scope) error { +func autoConvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSource, out *RBDVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.RBDVolumeSource))(in) } @@ -2265,9 +2475,10 @@ func autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSour out.RBDPool = in.RBDPool out.RadosUser = in.RadosUser out.Keyring = in.Keyring + // unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference if in.SecretRef != nil { out.SecretRef = new(LocalObjectReference) - if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { return err } } else { @@ -2277,68 +2488,59 @@ func autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSour return nil } -func convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSource, out *RBDVolumeSource, s conversion.Scope) error { - return autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in, out, s) +func Convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSource, out *RBDVolumeSource, s conversion.Scope) error { + return autoConvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in, out, s) } -func autoconvert_api_RangeAllocation_To_v1_RangeAllocation(in *api.RangeAllocation, out *RangeAllocation, s conversion.Scope) error { +func autoConvert_api_RangeAllocation_To_v1_RangeAllocation(in *api.RangeAllocation, out *RangeAllocation, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.RangeAllocation))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } out.Range = in.Range - if err := s.Convert(&in.Data, &out.Data, 0); err != nil { + if err := conversion.ByteSliceCopy(&in.Data, &out.Data, s); err != nil { return err } return nil } -func convert_api_RangeAllocation_To_v1_RangeAllocation(in *api.RangeAllocation, out *RangeAllocation, s conversion.Scope) error { - return autoconvert_api_RangeAllocation_To_v1_RangeAllocation(in, out, s) +func Convert_api_RangeAllocation_To_v1_RangeAllocation(in *api.RangeAllocation, out *RangeAllocation, s conversion.Scope) error { + return autoConvert_api_RangeAllocation_To_v1_RangeAllocation(in, out, s) } -func autoconvert_api_ReplicationController_To_v1_ReplicationController(in *api.ReplicationController, out *ReplicationController, s conversion.Scope) error { +func autoConvert_api_ReplicationController_To_v1_ReplicationController(in *api.ReplicationController, out *ReplicationController, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ReplicationController))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_api_ReplicationController_To_v1_ReplicationController(in *api.ReplicationController, out *ReplicationController, s conversion.Scope) error { - return autoconvert_api_ReplicationController_To_v1_ReplicationController(in, out, s) +func Convert_api_ReplicationController_To_v1_ReplicationController(in *api.ReplicationController, out *ReplicationController, s conversion.Scope) error { + return autoConvert_api_ReplicationController_To_v1_ReplicationController(in, out, s) } -func autoconvert_api_ReplicationControllerList_To_v1_ReplicationControllerList(in *api.ReplicationControllerList, out *ReplicationControllerList, s conversion.Scope) error { +func autoConvert_api_ReplicationControllerList_To_v1_ReplicationControllerList(in *api.ReplicationControllerList, out *ReplicationControllerList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ReplicationControllerList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]ReplicationController, len(in.Items)) for i := range in.Items { - if err := convert_api_ReplicationController_To_v1_ReplicationController(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_ReplicationController_To_v1_ReplicationController(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2348,11 +2550,11 @@ func autoconvert_api_ReplicationControllerList_To_v1_ReplicationControllerList(i return nil } -func convert_api_ReplicationControllerList_To_v1_ReplicationControllerList(in *api.ReplicationControllerList, out *ReplicationControllerList, s conversion.Scope) error { - return autoconvert_api_ReplicationControllerList_To_v1_ReplicationControllerList(in, out, s) +func Convert_api_ReplicationControllerList_To_v1_ReplicationControllerList(in *api.ReplicationControllerList, out *ReplicationControllerList, s conversion.Scope) error { + return autoConvert_api_ReplicationControllerList_To_v1_ReplicationControllerList(in, out, s) } -func autoconvert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *api.ReplicationControllerSpec, out *ReplicationControllerSpec, s conversion.Scope) error { +func autoConvert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *api.ReplicationControllerSpec, out *ReplicationControllerSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ReplicationControllerSpec))(in) } @@ -2367,9 +2569,10 @@ func autoconvert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(i } else { out.Selector = nil } + // unable to generate simple pointer conversion for api.PodTemplateSpec -> v1.PodTemplateSpec if in.Template != nil { out.Template = new(PodTemplateSpec) - if err := convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil { + if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil { return err } } else { @@ -2378,56 +2581,50 @@ func autoconvert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(i return nil } -func autoconvert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus(in *api.ReplicationControllerStatus, out *ReplicationControllerStatus, s conversion.Scope) error { +func autoConvert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus(in *api.ReplicationControllerStatus, out *ReplicationControllerStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ReplicationControllerStatus))(in) } - out.Replicas = in.Replicas + out.Replicas = int32(in.Replicas) out.ObservedGeneration = in.ObservedGeneration return nil } -func convert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus(in *api.ReplicationControllerStatus, out *ReplicationControllerStatus, s conversion.Scope) error { - return autoconvert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus(in, out, s) +func Convert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus(in *api.ReplicationControllerStatus, out *ReplicationControllerStatus, s conversion.Scope) error { + return autoConvert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus(in, out, s) } -func autoconvert_api_ResourceQuota_To_v1_ResourceQuota(in *api.ResourceQuota, out *ResourceQuota, s conversion.Scope) error { +func autoConvert_api_ResourceQuota_To_v1_ResourceQuota(in *api.ResourceQuota, out *ResourceQuota, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ResourceQuota))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_api_ResourceQuota_To_v1_ResourceQuota(in *api.ResourceQuota, out *ResourceQuota, s conversion.Scope) error { - return autoconvert_api_ResourceQuota_To_v1_ResourceQuota(in, out, s) +func Convert_api_ResourceQuota_To_v1_ResourceQuota(in *api.ResourceQuota, out *ResourceQuota, s conversion.Scope) error { + return autoConvert_api_ResourceQuota_To_v1_ResourceQuota(in, out, s) } -func autoconvert_api_ResourceQuotaList_To_v1_ResourceQuotaList(in *api.ResourceQuotaList, out *ResourceQuotaList, s conversion.Scope) error { +func autoConvert_api_ResourceQuotaList_To_v1_ResourceQuotaList(in *api.ResourceQuotaList, out *ResourceQuotaList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ResourceQuotaList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]ResourceQuota, len(in.Items)) for i := range in.Items { - if err := convert_api_ResourceQuota_To_v1_ResourceQuota(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_ResourceQuota_To_v1_ResourceQuota(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2437,11 +2634,11 @@ func autoconvert_api_ResourceQuotaList_To_v1_ResourceQuotaList(in *api.ResourceQ return nil } -func convert_api_ResourceQuotaList_To_v1_ResourceQuotaList(in *api.ResourceQuotaList, out *ResourceQuotaList, s conversion.Scope) error { - return autoconvert_api_ResourceQuotaList_To_v1_ResourceQuotaList(in, out, s) +func Convert_api_ResourceQuotaList_To_v1_ResourceQuotaList(in *api.ResourceQuotaList, out *ResourceQuotaList, s conversion.Scope) error { + return autoConvert_api_ResourceQuotaList_To_v1_ResourceQuotaList(in, out, s) } -func autoconvert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(in *api.ResourceQuotaSpec, out *ResourceQuotaSpec, s conversion.Scope) error { +func autoConvert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(in *api.ResourceQuotaSpec, out *ResourceQuotaSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ResourceQuotaSpec))(in) } @@ -2449,7 +2646,7 @@ func autoconvert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(in *api.ResourceQ out.Hard = make(ResourceList) for key, val := range in.Hard { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Hard[ResourceName(key)] = newVal @@ -2460,11 +2657,11 @@ func autoconvert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(in *api.ResourceQ return nil } -func convert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(in *api.ResourceQuotaSpec, out *ResourceQuotaSpec, s conversion.Scope) error { - return autoconvert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(in, out, s) +func Convert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(in *api.ResourceQuotaSpec, out *ResourceQuotaSpec, s conversion.Scope) error { + return autoConvert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec(in, out, s) } -func autoconvert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(in *api.ResourceQuotaStatus, out *ResourceQuotaStatus, s conversion.Scope) error { +func autoConvert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(in *api.ResourceQuotaStatus, out *ResourceQuotaStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ResourceQuotaStatus))(in) } @@ -2472,7 +2669,7 @@ func autoconvert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(in *api.Resou out.Hard = make(ResourceList) for key, val := range in.Hard { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Hard[ResourceName(key)] = newVal @@ -2484,7 +2681,7 @@ func autoconvert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(in *api.Resou out.Used = make(ResourceList) for key, val := range in.Used { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Used[ResourceName(key)] = newVal @@ -2495,11 +2692,11 @@ func autoconvert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(in *api.Resou return nil } -func convert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(in *api.ResourceQuotaStatus, out *ResourceQuotaStatus, s conversion.Scope) error { - return autoconvert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(in, out, s) +func Convert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(in *api.ResourceQuotaStatus, out *ResourceQuotaStatus, s conversion.Scope) error { + return autoConvert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus(in, out, s) } -func autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.ResourceRequirements, out *ResourceRequirements, s conversion.Scope) error { +func autoConvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.ResourceRequirements, out *ResourceRequirements, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ResourceRequirements))(in) } @@ -2507,7 +2704,7 @@ func autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.Res out.Limits = make(ResourceList) for key, val := range in.Limits { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Limits[ResourceName(key)] = newVal @@ -2519,7 +2716,7 @@ func autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.Res out.Requests = make(ResourceList) for key, val := range in.Requests { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Requests[ResourceName(key)] = newVal @@ -2530,11 +2727,11 @@ func autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.Res return nil } -func convert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.ResourceRequirements, out *ResourceRequirements, s conversion.Scope) error { - return autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in, out, s) +func Convert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.ResourceRequirements, out *ResourceRequirements, s conversion.Scope) error { + return autoConvert_api_ResourceRequirements_To_v1_ResourceRequirements(in, out, s) } -func autoconvert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out *SELinuxOptions, s conversion.Scope) error { +func autoConvert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out *SELinuxOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.SELinuxOptions))(in) } @@ -2545,25 +2742,22 @@ func autoconvert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, return nil } -func convert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out *SELinuxOptions, s conversion.Scope) error { - return autoconvert_api_SELinuxOptions_To_v1_SELinuxOptions(in, out, s) +func Convert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out *SELinuxOptions, s conversion.Scope) error { + return autoConvert_api_SELinuxOptions_To_v1_SELinuxOptions(in, out, s) } -func autoconvert_api_Secret_To_v1_Secret(in *api.Secret, out *Secret, s conversion.Scope) error { +func autoConvert_api_Secret_To_v1_Secret(in *api.Secret, out *Secret, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Secret))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } if in.Data != nil { out.Data = make(map[string][]uint8) for key, val := range in.Data { newVal := []uint8{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := conversion.ByteSliceCopy(&val, &newVal, s); err != nil { return err } out.Data[key] = newVal @@ -2575,24 +2769,36 @@ func autoconvert_api_Secret_To_v1_Secret(in *api.Secret, out *Secret, s conversi return nil } -func convert_api_Secret_To_v1_Secret(in *api.Secret, out *Secret, s conversion.Scope) error { - return autoconvert_api_Secret_To_v1_Secret(in, out, s) +func Convert_api_Secret_To_v1_Secret(in *api.Secret, out *Secret, s conversion.Scope) error { + return autoConvert_api_Secret_To_v1_Secret(in, out, s) } -func autoconvert_api_SecretList_To_v1_SecretList(in *api.SecretList, out *SecretList, s conversion.Scope) error { +func autoConvert_api_SecretKeySelector_To_v1_SecretKeySelector(in *api.SecretKeySelector, out *SecretKeySelector, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.SecretKeySelector))(in) + } + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func Convert_api_SecretKeySelector_To_v1_SecretKeySelector(in *api.SecretKeySelector, out *SecretKeySelector, s conversion.Scope) error { + return autoConvert_api_SecretKeySelector_To_v1_SecretKeySelector(in, out, s) +} + +func autoConvert_api_SecretList_To_v1_SecretList(in *api.SecretList, out *SecretList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.SecretList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]Secret, len(in.Items)) for i := range in.Items { - if err := convert_api_Secret_To_v1_Secret(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_Secret_To_v1_Secret(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2602,11 +2808,11 @@ func autoconvert_api_SecretList_To_v1_SecretList(in *api.SecretList, out *Secret return nil } -func convert_api_SecretList_To_v1_SecretList(in *api.SecretList, out *SecretList, s conversion.Scope) error { - return autoconvert_api_SecretList_To_v1_SecretList(in, out, s) +func Convert_api_SecretList_To_v1_SecretList(in *api.SecretList, out *SecretList, s conversion.Scope) error { + return autoConvert_api_SecretList_To_v1_SecretList(in, out, s) } -func autoconvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretVolumeSource, out *SecretVolumeSource, s conversion.Scope) error { +func autoConvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretVolumeSource, out *SecretVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.SecretVolumeSource))(in) } @@ -2614,17 +2820,18 @@ func autoconvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretV return nil } -func convert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretVolumeSource, out *SecretVolumeSource, s conversion.Scope) error { - return autoconvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in, out, s) +func Convert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretVolumeSource, out *SecretVolumeSource, s conversion.Scope) error { + return autoConvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in, out, s) } -func autoconvert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityContext, out *SecurityContext, s conversion.Scope) error { +func autoConvert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityContext, out *SecurityContext, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.SecurityContext))(in) } + // unable to generate simple pointer conversion for api.Capabilities -> v1.Capabilities if in.Capabilities != nil { out.Capabilities = new(Capabilities) - if err := convert_api_Capabilities_To_v1_Capabilities(in.Capabilities, out.Capabilities, s); err != nil { + if err := Convert_api_Capabilities_To_v1_Capabilities(in.Capabilities, out.Capabilities, s); err != nil { return err } } else { @@ -2636,9 +2843,10 @@ func autoconvert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityConte } else { out.Privileged = nil } + // unable to generate simple pointer conversion for api.SELinuxOptions -> v1.SELinuxOptions if in.SELinuxOptions != nil { out.SELinuxOptions = new(SELinuxOptions) - if err := convert_api_SELinuxOptions_To_v1_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + if err := Convert_api_SELinuxOptions_To_v1_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { return err } } else { @@ -2656,67 +2864,64 @@ func autoconvert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityConte } else { out.RunAsNonRoot = nil } + if in.ReadOnlyRootFilesystem != nil { + out.ReadOnlyRootFilesystem = new(bool) + *out.ReadOnlyRootFilesystem = *in.ReadOnlyRootFilesystem + } else { + out.ReadOnlyRootFilesystem = nil + } return nil } -func convert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityContext, out *SecurityContext, s conversion.Scope) error { - return autoconvert_api_SecurityContext_To_v1_SecurityContext(in, out, s) +func Convert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityContext, out *SecurityContext, s conversion.Scope) error { + return autoConvert_api_SecurityContext_To_v1_SecurityContext(in, out, s) } -func autoconvert_api_SerializedReference_To_v1_SerializedReference(in *api.SerializedReference, out *SerializedReference, s conversion.Scope) error { +func autoConvert_api_SerializedReference_To_v1_SerializedReference(in *api.SerializedReference, out *SerializedReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.SerializedReference))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_api_ObjectReference_To_v1_ObjectReference(&in.Reference, &out.Reference, s); err != nil { + if err := Convert_api_ObjectReference_To_v1_ObjectReference(&in.Reference, &out.Reference, s); err != nil { return err } return nil } -func convert_api_SerializedReference_To_v1_SerializedReference(in *api.SerializedReference, out *SerializedReference, s conversion.Scope) error { - return autoconvert_api_SerializedReference_To_v1_SerializedReference(in, out, s) +func Convert_api_SerializedReference_To_v1_SerializedReference(in *api.SerializedReference, out *SerializedReference, s conversion.Scope) error { + return autoConvert_api_SerializedReference_To_v1_SerializedReference(in, out, s) } -func autoconvert_api_Service_To_v1_Service(in *api.Service, out *Service, s conversion.Scope) error { +func autoConvert_api_Service_To_v1_Service(in *api.Service, out *Service, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Service))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ServiceSpec_To_v1_ServiceSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_api_ServiceSpec_To_v1_ServiceSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_api_ServiceStatus_To_v1_ServiceStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_api_ServiceStatus_To_v1_ServiceStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_api_Service_To_v1_Service(in *api.Service, out *Service, s conversion.Scope) error { - return autoconvert_api_Service_To_v1_Service(in, out, s) +func Convert_api_Service_To_v1_Service(in *api.Service, out *Service, s conversion.Scope) error { + return autoConvert_api_Service_To_v1_Service(in, out, s) } -func autoconvert_api_ServiceAccount_To_v1_ServiceAccount(in *api.ServiceAccount, out *ServiceAccount, s conversion.Scope) error { +func autoConvert_api_ServiceAccount_To_v1_ServiceAccount(in *api.ServiceAccount, out *ServiceAccount, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ServiceAccount))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } if in.Secrets != nil { out.Secrets = make([]ObjectReference, len(in.Secrets)) for i := range in.Secrets { - if err := convert_api_ObjectReference_To_v1_ObjectReference(&in.Secrets[i], &out.Secrets[i], s); err != nil { + if err := Convert_api_ObjectReference_To_v1_ObjectReference(&in.Secrets[i], &out.Secrets[i], s); err != nil { return err } } @@ -2726,7 +2931,7 @@ func autoconvert_api_ServiceAccount_To_v1_ServiceAccount(in *api.ServiceAccount, if in.ImagePullSecrets != nil { out.ImagePullSecrets = make([]LocalObjectReference, len(in.ImagePullSecrets)) for i := range in.ImagePullSecrets { - if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { return err } } @@ -2736,24 +2941,21 @@ func autoconvert_api_ServiceAccount_To_v1_ServiceAccount(in *api.ServiceAccount, return nil } -func convert_api_ServiceAccount_To_v1_ServiceAccount(in *api.ServiceAccount, out *ServiceAccount, s conversion.Scope) error { - return autoconvert_api_ServiceAccount_To_v1_ServiceAccount(in, out, s) +func Convert_api_ServiceAccount_To_v1_ServiceAccount(in *api.ServiceAccount, out *ServiceAccount, s conversion.Scope) error { + return autoConvert_api_ServiceAccount_To_v1_ServiceAccount(in, out, s) } -func autoconvert_api_ServiceAccountList_To_v1_ServiceAccountList(in *api.ServiceAccountList, out *ServiceAccountList, s conversion.Scope) error { +func autoConvert_api_ServiceAccountList_To_v1_ServiceAccountList(in *api.ServiceAccountList, out *ServiceAccountList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ServiceAccountList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]ServiceAccount, len(in.Items)) for i := range in.Items { - if err := convert_api_ServiceAccount_To_v1_ServiceAccount(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_ServiceAccount_To_v1_ServiceAccount(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2763,24 +2965,21 @@ func autoconvert_api_ServiceAccountList_To_v1_ServiceAccountList(in *api.Service return nil } -func convert_api_ServiceAccountList_To_v1_ServiceAccountList(in *api.ServiceAccountList, out *ServiceAccountList, s conversion.Scope) error { - return autoconvert_api_ServiceAccountList_To_v1_ServiceAccountList(in, out, s) +func Convert_api_ServiceAccountList_To_v1_ServiceAccountList(in *api.ServiceAccountList, out *ServiceAccountList, s conversion.Scope) error { + return autoConvert_api_ServiceAccountList_To_v1_ServiceAccountList(in, out, s) } -func autoconvert_api_ServiceList_To_v1_ServiceList(in *api.ServiceList, out *ServiceList, s conversion.Scope) error { +func autoConvert_api_ServiceList_To_v1_ServiceList(in *api.ServiceList, out *ServiceList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ServiceList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]Service, len(in.Items)) for i := range in.Items { - if err := convert_api_Service_To_v1_Service(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_Service_To_v1_Service(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2790,29 +2989,29 @@ func autoconvert_api_ServiceList_To_v1_ServiceList(in *api.ServiceList, out *Ser return nil } -func convert_api_ServiceList_To_v1_ServiceList(in *api.ServiceList, out *ServiceList, s conversion.Scope) error { - return autoconvert_api_ServiceList_To_v1_ServiceList(in, out, s) +func Convert_api_ServiceList_To_v1_ServiceList(in *api.ServiceList, out *ServiceList, s conversion.Scope) error { + return autoConvert_api_ServiceList_To_v1_ServiceList(in, out, s) } -func autoconvert_api_ServicePort_To_v1_ServicePort(in *api.ServicePort, out *ServicePort, s conversion.Scope) error { +func autoConvert_api_ServicePort_To_v1_ServicePort(in *api.ServicePort, out *ServicePort, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ServicePort))(in) } out.Name = in.Name out.Protocol = Protocol(in.Protocol) - out.Port = in.Port - if err := s.Convert(&in.TargetPort, &out.TargetPort, 0); err != nil { + out.Port = int32(in.Port) + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.TargetPort, &out.TargetPort, s); err != nil { return err } - out.NodePort = in.NodePort + out.NodePort = int32(in.NodePort) return nil } -func convert_api_ServicePort_To_v1_ServicePort(in *api.ServicePort, out *ServicePort, s conversion.Scope) error { - return autoconvert_api_ServicePort_To_v1_ServicePort(in, out, s) +func Convert_api_ServicePort_To_v1_ServicePort(in *api.ServicePort, out *ServicePort, s conversion.Scope) error { + return autoConvert_api_ServicePort_To_v1_ServicePort(in, out, s) } -func autoconvert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *ServiceSpec, s conversion.Scope) error { +func autoConvert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *ServiceSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ServiceSpec))(in) } @@ -2820,7 +3019,7 @@ func autoconvert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *Ser if in.Ports != nil { out.Ports = make([]ServicePort, len(in.Ports)) for i := range in.Ports { - if err := convert_api_ServicePort_To_v1_ServicePort(&in.Ports[i], &out.Ports[i], s); err != nil { + if err := Convert_api_ServicePort_To_v1_ServicePort(&in.Ports[i], &out.Ports[i], s); err != nil { return err } } @@ -2849,50 +3048,50 @@ func autoconvert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *Ser return nil } -func autoconvert_api_ServiceStatus_To_v1_ServiceStatus(in *api.ServiceStatus, out *ServiceStatus, s conversion.Scope) error { +func autoConvert_api_ServiceStatus_To_v1_ServiceStatus(in *api.ServiceStatus, out *ServiceStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ServiceStatus))(in) } - if err := convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { + if err := Convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { return err } return nil } -func convert_api_ServiceStatus_To_v1_ServiceStatus(in *api.ServiceStatus, out *ServiceStatus, s conversion.Scope) error { - return autoconvert_api_ServiceStatus_To_v1_ServiceStatus(in, out, s) +func Convert_api_ServiceStatus_To_v1_ServiceStatus(in *api.ServiceStatus, out *ServiceStatus, s conversion.Scope) error { + return autoConvert_api_ServiceStatus_To_v1_ServiceStatus(in, out, s) } -func autoconvert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction, out *TCPSocketAction, s conversion.Scope) error { +func autoConvert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction, out *TCPSocketAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.TCPSocketAction))(in) } - if err := s.Convert(&in.Port, &out.Port, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.Port, &out.Port, s); err != nil { return err } return nil } -func convert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction, out *TCPSocketAction, s conversion.Scope) error { - return autoconvert_api_TCPSocketAction_To_v1_TCPSocketAction(in, out, s) +func Convert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction, out *TCPSocketAction, s conversion.Scope) error { + return autoConvert_api_TCPSocketAction_To_v1_TCPSocketAction(in, out, s) } -func autoconvert_api_Volume_To_v1_Volume(in *api.Volume, out *Volume, s conversion.Scope) error { +func autoConvert_api_Volume_To_v1_Volume(in *api.Volume, out *Volume, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Volume))(in) } out.Name = in.Name - if err := convert_api_VolumeSource_To_v1_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { + if err := Convert_api_VolumeSource_To_v1_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { return err } return nil } -func convert_api_Volume_To_v1_Volume(in *api.Volume, out *Volume, s conversion.Scope) error { - return autoconvert_api_Volume_To_v1_Volume(in, out, s) +func Convert_api_Volume_To_v1_Volume(in *api.Volume, out *Volume, s conversion.Scope) error { + return autoConvert_api_Volume_To_v1_Volume(in, out, s) } -func autoconvert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *VolumeMount, s conversion.Scope) error { +func autoConvert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *VolumeMount, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.VolumeMount))(in) } @@ -2902,185 +3101,252 @@ func autoconvert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *Vol return nil } -func convert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *VolumeMount, s conversion.Scope) error { - return autoconvert_api_VolumeMount_To_v1_VolumeMount(in, out, s) +func Convert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *VolumeMount, s conversion.Scope) error { + return autoConvert_api_VolumeMount_To_v1_VolumeMount(in, out, s) } -func autoconvert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *VolumeSource, s conversion.Scope) error { +func autoConvert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *VolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.VolumeSource))(in) } + // unable to generate simple pointer conversion for api.HostPathVolumeSource -> v1.HostPathVolumeSource if in.HostPath != nil { out.HostPath = new(HostPathVolumeSource) - if err := convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { + if err := Convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { return err } } else { out.HostPath = nil } + // unable to generate simple pointer conversion for api.EmptyDirVolumeSource -> v1.EmptyDirVolumeSource if in.EmptyDir != nil { out.EmptyDir = new(EmptyDirVolumeSource) - if err := convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in.EmptyDir, out.EmptyDir, s); err != nil { + if err := Convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in.EmptyDir, out.EmptyDir, s); err != nil { return err } } else { out.EmptyDir = nil } + // unable to generate simple pointer conversion for api.GCEPersistentDiskVolumeSource -> v1.GCEPersistentDiskVolumeSource if in.GCEPersistentDisk != nil { out.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) - if err := convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { + if err := Convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { return err } } else { out.GCEPersistentDisk = nil } + // unable to generate simple pointer conversion for api.AWSElasticBlockStoreVolumeSource -> v1.AWSElasticBlockStoreVolumeSource if in.AWSElasticBlockStore != nil { out.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) - if err := convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { + if err := Convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { return err } } else { out.AWSElasticBlockStore = nil } + // unable to generate simple pointer conversion for api.GitRepoVolumeSource -> v1.GitRepoVolumeSource if in.GitRepo != nil { out.GitRepo = new(GitRepoVolumeSource) - if err := convert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in.GitRepo, out.GitRepo, s); err != nil { + if err := Convert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in.GitRepo, out.GitRepo, s); err != nil { return err } } else { out.GitRepo = nil } + // unable to generate simple pointer conversion for api.SecretVolumeSource -> v1.SecretVolumeSource if in.Secret != nil { out.Secret = new(SecretVolumeSource) - if err := convert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in.Secret, out.Secret, s); err != nil { + if err := Convert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in.Secret, out.Secret, s); err != nil { return err } } else { out.Secret = nil } + // unable to generate simple pointer conversion for api.NFSVolumeSource -> v1.NFSVolumeSource if in.NFS != nil { out.NFS = new(NFSVolumeSource) - if err := convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { + if err := Convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { return err } } else { out.NFS = nil } + // unable to generate simple pointer conversion for api.ISCSIVolumeSource -> v1.ISCSIVolumeSource if in.ISCSI != nil { out.ISCSI = new(ISCSIVolumeSource) - if err := convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { + if err := Convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { return err } } else { out.ISCSI = nil } + // unable to generate simple pointer conversion for api.GlusterfsVolumeSource -> v1.GlusterfsVolumeSource if in.Glusterfs != nil { out.Glusterfs = new(GlusterfsVolumeSource) - if err := convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { + if err := Convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { return err } } else { out.Glusterfs = nil } + // unable to generate simple pointer conversion for api.PersistentVolumeClaimVolumeSource -> v1.PersistentVolumeClaimVolumeSource if in.PersistentVolumeClaim != nil { out.PersistentVolumeClaim = new(PersistentVolumeClaimVolumeSource) - if err := convert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in.PersistentVolumeClaim, out.PersistentVolumeClaim, s); err != nil { + if err := Convert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in.PersistentVolumeClaim, out.PersistentVolumeClaim, s); err != nil { return err } } else { out.PersistentVolumeClaim = nil } + // unable to generate simple pointer conversion for api.RBDVolumeSource -> v1.RBDVolumeSource if in.RBD != nil { out.RBD = new(RBDVolumeSource) - if err := convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { + if err := Convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { return err } } else { out.RBD = nil } + // unable to generate simple pointer conversion for api.FlexVolumeSource -> v1.FlexVolumeSource + if in.FlexVolume != nil { + out.FlexVolume = new(FlexVolumeSource) + if err := Convert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in.FlexVolume, out.FlexVolume, s); err != nil { + return err + } + } else { + out.FlexVolume = nil + } + // unable to generate simple pointer conversion for api.CinderVolumeSource -> v1.CinderVolumeSource if in.Cinder != nil { out.Cinder = new(CinderVolumeSource) - if err := convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { + if err := Convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { return err } } else { out.Cinder = nil } + // unable to generate simple pointer conversion for api.CephFSVolumeSource -> v1.CephFSVolumeSource if in.CephFS != nil { out.CephFS = new(CephFSVolumeSource) - if err := convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { + if err := Convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { return err } } else { out.CephFS = nil } + // unable to generate simple pointer conversion for api.FlockerVolumeSource -> v1.FlockerVolumeSource if in.Flocker != nil { out.Flocker = new(FlockerVolumeSource) - if err := convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { + if err := Convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { return err } } else { out.Flocker = nil } + // unable to generate simple pointer conversion for api.DownwardAPIVolumeSource -> v1.DownwardAPIVolumeSource if in.DownwardAPI != nil { out.DownwardAPI = new(DownwardAPIVolumeSource) - if err := convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { + if err := Convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { return err } } else { out.DownwardAPI = nil } + // unable to generate simple pointer conversion for api.FCVolumeSource -> v1.FCVolumeSource if in.FC != nil { out.FC = new(FCVolumeSource) - if err := convert_api_FCVolumeSource_To_v1_FCVolumeSource(in.FC, out.FC, s); err != nil { + if err := Convert_api_FCVolumeSource_To_v1_FCVolumeSource(in.FC, out.FC, s); err != nil { return err } } else { out.FC = nil } + // unable to generate simple pointer conversion for api.AzureFileVolumeSource -> v1.AzureFileVolumeSource + if in.AzureFile != nil { + out.AzureFile = new(AzureFileVolumeSource) + if err := Convert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource(in.AzureFile, out.AzureFile, s); err != nil { + return err + } + } else { + out.AzureFile = nil + } + // unable to generate simple pointer conversion for api.ConfigMapVolumeSource -> v1.ConfigMapVolumeSource + if in.ConfigMap != nil { + out.ConfigMap = new(ConfigMapVolumeSource) + if err := Convert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in.ConfigMap, out.ConfigMap, s); err != nil { + return err + } + } else { + out.ConfigMap = nil + } return nil } -func convert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *VolumeSource, s conversion.Scope) error { - return autoconvert_api_VolumeSource_To_v1_VolumeSource(in, out, s) +func Convert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *VolumeSource, s conversion.Scope) error { + return autoConvert_api_VolumeSource_To_v1_VolumeSource(in, out, s) } -func autoconvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in *AWSElasticBlockStoreVolumeSource, out *api.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { +func autoConvert_unversioned_ExportOptions_To_v1_ExportOptions(in *unversioned.ExportOptions, out *ExportOptions, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*unversioned.ExportOptions))(in) + } + out.Export = in.Export + out.Exact = in.Exact + return nil +} + +func Convert_unversioned_ExportOptions_To_v1_ExportOptions(in *unversioned.ExportOptions, out *ExportOptions, s conversion.Scope) error { + return autoConvert_unversioned_ExportOptions_To_v1_ExportOptions(in, out, s) +} + +func autoConvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in *AWSElasticBlockStoreVolumeSource, out *api.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*AWSElasticBlockStoreVolumeSource))(in) } out.VolumeID = in.VolumeID out.FSType = in.FSType - out.Partition = in.Partition + out.Partition = int(in.Partition) out.ReadOnly = in.ReadOnly return nil } -func convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in *AWSElasticBlockStoreVolumeSource, out *api.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { - return autoconvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in, out, s) +func Convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in *AWSElasticBlockStoreVolumeSource, out *api.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { + return autoConvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in, out, s) } -func autoconvert_v1_Binding_To_api_Binding(in *Binding, out *api.Binding, s conversion.Scope) error { +func autoConvert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource(in *AzureFileVolumeSource, out *api.AzureFileVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*AzureFileVolumeSource))(in) + } + out.SecretName = in.SecretName + out.ShareName = in.ShareName + out.ReadOnly = in.ReadOnly + return nil +} + +func Convert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource(in *AzureFileVolumeSource, out *api.AzureFileVolumeSource, s conversion.Scope) error { + return autoConvert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource(in, out, s) +} + +func autoConvert_v1_Binding_To_api_Binding(in *Binding, out *api.Binding, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Binding))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_v1_ObjectReference_To_api_ObjectReference(&in.Target, &out.Target, s); err != nil { + if err := Convert_v1_ObjectReference_To_api_ObjectReference(&in.Target, &out.Target, s); err != nil { return err } return nil } -func convert_v1_Binding_To_api_Binding(in *Binding, out *api.Binding, s conversion.Scope) error { - return autoconvert_v1_Binding_To_api_Binding(in, out, s) +func Convert_v1_Binding_To_api_Binding(in *Binding, out *api.Binding, s conversion.Scope) error { + return autoConvert_v1_Binding_To_api_Binding(in, out, s) } -func autoconvert_v1_Capabilities_To_api_Capabilities(in *Capabilities, out *api.Capabilities, s conversion.Scope) error { +func autoConvert_v1_Capabilities_To_api_Capabilities(in *Capabilities, out *api.Capabilities, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Capabilities))(in) } @@ -3103,11 +3369,11 @@ func autoconvert_v1_Capabilities_To_api_Capabilities(in *Capabilities, out *api. return nil } -func convert_v1_Capabilities_To_api_Capabilities(in *Capabilities, out *api.Capabilities, s conversion.Scope) error { - return autoconvert_v1_Capabilities_To_api_Capabilities(in, out, s) +func Convert_v1_Capabilities_To_api_Capabilities(in *Capabilities, out *api.Capabilities, s conversion.Scope) error { + return autoConvert_v1_Capabilities_To_api_Capabilities(in, out, s) } -func autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *CephFSVolumeSource, out *api.CephFSVolumeSource, s conversion.Scope) error { +func autoConvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *CephFSVolumeSource, out *api.CephFSVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*CephFSVolumeSource))(in) } @@ -3119,11 +3385,13 @@ func autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *CephFSVolum } else { out.Monitors = nil } + out.Path = in.Path out.User = in.User out.SecretFile = in.SecretFile + // unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference if in.SecretRef != nil { out.SecretRef = new(api.LocalObjectReference) - if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { return err } } else { @@ -3133,11 +3401,11 @@ func autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *CephFSVolum return nil } -func convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *CephFSVolumeSource, out *api.CephFSVolumeSource, s conversion.Scope) error { - return autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in, out, s) +func Convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *CephFSVolumeSource, out *api.CephFSVolumeSource, s conversion.Scope) error { + return autoConvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in, out, s) } -func autoconvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *CinderVolumeSource, out *api.CinderVolumeSource, s conversion.Scope) error { +func autoConvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *CinderVolumeSource, out *api.CinderVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*CinderVolumeSource))(in) } @@ -3147,11 +3415,11 @@ func autoconvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *CinderVolum return nil } -func convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *CinderVolumeSource, out *api.CinderVolumeSource, s conversion.Scope) error { - return autoconvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in, out, s) +func Convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *CinderVolumeSource, out *api.CinderVolumeSource, s conversion.Scope) error { + return autoConvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in, out, s) } -func autoconvert_v1_ComponentCondition_To_api_ComponentCondition(in *ComponentCondition, out *api.ComponentCondition, s conversion.Scope) error { +func autoConvert_v1_ComponentCondition_To_api_ComponentCondition(in *ComponentCondition, out *api.ComponentCondition, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ComponentCondition))(in) } @@ -3162,24 +3430,21 @@ func autoconvert_v1_ComponentCondition_To_api_ComponentCondition(in *ComponentCo return nil } -func convert_v1_ComponentCondition_To_api_ComponentCondition(in *ComponentCondition, out *api.ComponentCondition, s conversion.Scope) error { - return autoconvert_v1_ComponentCondition_To_api_ComponentCondition(in, out, s) +func Convert_v1_ComponentCondition_To_api_ComponentCondition(in *ComponentCondition, out *api.ComponentCondition, s conversion.Scope) error { + return autoConvert_v1_ComponentCondition_To_api_ComponentCondition(in, out, s) } -func autoconvert_v1_ComponentStatus_To_api_ComponentStatus(in *ComponentStatus, out *api.ComponentStatus, s conversion.Scope) error { +func autoConvert_v1_ComponentStatus_To_api_ComponentStatus(in *ComponentStatus, out *api.ComponentStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ComponentStatus))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } if in.Conditions != nil { out.Conditions = make([]api.ComponentCondition, len(in.Conditions)) for i := range in.Conditions { - if err := convert_v1_ComponentCondition_To_api_ComponentCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { + if err := Convert_v1_ComponentCondition_To_api_ComponentCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { return err } } @@ -3189,24 +3454,21 @@ func autoconvert_v1_ComponentStatus_To_api_ComponentStatus(in *ComponentStatus, return nil } -func convert_v1_ComponentStatus_To_api_ComponentStatus(in *ComponentStatus, out *api.ComponentStatus, s conversion.Scope) error { - return autoconvert_v1_ComponentStatus_To_api_ComponentStatus(in, out, s) +func Convert_v1_ComponentStatus_To_api_ComponentStatus(in *ComponentStatus, out *api.ComponentStatus, s conversion.Scope) error { + return autoConvert_v1_ComponentStatus_To_api_ComponentStatus(in, out, s) } -func autoconvert_v1_ComponentStatusList_To_api_ComponentStatusList(in *ComponentStatusList, out *api.ComponentStatusList, s conversion.Scope) error { +func autoConvert_v1_ComponentStatusList_To_api_ComponentStatusList(in *ComponentStatusList, out *api.ComponentStatusList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ComponentStatusList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.ComponentStatus, len(in.Items)) for i := range in.Items { - if err := convert_v1_ComponentStatus_To_api_ComponentStatus(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_ComponentStatus_To_api_ComponentStatus(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3216,11 +3478,96 @@ func autoconvert_v1_ComponentStatusList_To_api_ComponentStatusList(in *Component return nil } -func convert_v1_ComponentStatusList_To_api_ComponentStatusList(in *ComponentStatusList, out *api.ComponentStatusList, s conversion.Scope) error { - return autoconvert_v1_ComponentStatusList_To_api_ComponentStatusList(in, out, s) +func Convert_v1_ComponentStatusList_To_api_ComponentStatusList(in *ComponentStatusList, out *api.ComponentStatusList, s conversion.Scope) error { + return autoConvert_v1_ComponentStatusList_To_api_ComponentStatusList(in, out, s) } -func autoconvert_v1_Container_To_api_Container(in *Container, out *api.Container, s conversion.Scope) error { +func autoConvert_v1_ConfigMap_To_api_ConfigMap(in *ConfigMap, out *api.ConfigMap, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ConfigMap))(in) + } + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if in.Data != nil { + out.Data = make(map[string]string) + for key, val := range in.Data { + out.Data[key] = val + } + } else { + out.Data = nil + } + return nil +} + +func Convert_v1_ConfigMap_To_api_ConfigMap(in *ConfigMap, out *api.ConfigMap, s conversion.Scope) error { + return autoConvert_v1_ConfigMap_To_api_ConfigMap(in, out, s) +} + +func autoConvert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector(in *ConfigMapKeySelector, out *api.ConfigMapKeySelector, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ConfigMapKeySelector))(in) + } + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func Convert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector(in *ConfigMapKeySelector, out *api.ConfigMapKeySelector, s conversion.Scope) error { + return autoConvert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector(in, out, s) +} + +func autoConvert_v1_ConfigMapList_To_api_ConfigMapList(in *ConfigMapList, out *api.ConfigMapList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ConfigMapList))(in) + } + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]api.ConfigMap, len(in.Items)) + for i := range in.Items { + if err := Convert_v1_ConfigMap_To_api_ConfigMap(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_v1_ConfigMapList_To_api_ConfigMapList(in *ConfigMapList, out *api.ConfigMapList, s conversion.Scope) error { + return autoConvert_v1_ConfigMapList_To_api_ConfigMapList(in, out, s) +} + +func autoConvert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource(in *ConfigMapVolumeSource, out *api.ConfigMapVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ConfigMapVolumeSource))(in) + } + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]api.KeyToPath, len(in.Items)) + for i := range in.Items { + if err := Convert_v1_KeyToPath_To_api_KeyToPath(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource(in *ConfigMapVolumeSource, out *api.ConfigMapVolumeSource, s conversion.Scope) error { + return autoConvert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource(in, out, s) +} + +func autoConvert_v1_Container_To_api_Container(in *Container, out *api.Container, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Container))(in) } @@ -3246,7 +3593,7 @@ func autoconvert_v1_Container_To_api_Container(in *Container, out *api.Container if in.Ports != nil { out.Ports = make([]api.ContainerPort, len(in.Ports)) for i := range in.Ports { - if err := convert_v1_ContainerPort_To_api_ContainerPort(&in.Ports[i], &out.Ports[i], s); err != nil { + if err := Convert_v1_ContainerPort_To_api_ContainerPort(&in.Ports[i], &out.Ports[i], s); err != nil { return err } } @@ -3256,45 +3603,48 @@ func autoconvert_v1_Container_To_api_Container(in *Container, out *api.Container if in.Env != nil { out.Env = make([]api.EnvVar, len(in.Env)) for i := range in.Env { - if err := convert_v1_EnvVar_To_api_EnvVar(&in.Env[i], &out.Env[i], s); err != nil { + if err := Convert_v1_EnvVar_To_api_EnvVar(&in.Env[i], &out.Env[i], s); err != nil { return err } } } else { out.Env = nil } - if err := convert_v1_ResourceRequirements_To_api_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { + if err := Convert_v1_ResourceRequirements_To_api_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { return err } if in.VolumeMounts != nil { out.VolumeMounts = make([]api.VolumeMount, len(in.VolumeMounts)) for i := range in.VolumeMounts { - if err := convert_v1_VolumeMount_To_api_VolumeMount(&in.VolumeMounts[i], &out.VolumeMounts[i], s); err != nil { + if err := Convert_v1_VolumeMount_To_api_VolumeMount(&in.VolumeMounts[i], &out.VolumeMounts[i], s); err != nil { return err } } } else { out.VolumeMounts = nil } + // unable to generate simple pointer conversion for v1.Probe -> api.Probe if in.LivenessProbe != nil { out.LivenessProbe = new(api.Probe) - if err := convert_v1_Probe_To_api_Probe(in.LivenessProbe, out.LivenessProbe, s); err != nil { + if err := Convert_v1_Probe_To_api_Probe(in.LivenessProbe, out.LivenessProbe, s); err != nil { return err } } else { out.LivenessProbe = nil } + // unable to generate simple pointer conversion for v1.Probe -> api.Probe if in.ReadinessProbe != nil { out.ReadinessProbe = new(api.Probe) - if err := convert_v1_Probe_To_api_Probe(in.ReadinessProbe, out.ReadinessProbe, s); err != nil { + if err := Convert_v1_Probe_To_api_Probe(in.ReadinessProbe, out.ReadinessProbe, s); err != nil { return err } } else { out.ReadinessProbe = nil } + // unable to generate simple pointer conversion for v1.Lifecycle -> api.Lifecycle if in.Lifecycle != nil { out.Lifecycle = new(api.Lifecycle) - if err := convert_v1_Lifecycle_To_api_Lifecycle(in.Lifecycle, out.Lifecycle, s); err != nil { + if err := Convert_v1_Lifecycle_To_api_Lifecycle(in.Lifecycle, out.Lifecycle, s); err != nil { return err } } else { @@ -3302,9 +3652,10 @@ func autoconvert_v1_Container_To_api_Container(in *Container, out *api.Container } out.TerminationMessagePath = in.TerminationMessagePath out.ImagePullPolicy = api.PullPolicy(in.ImagePullPolicy) + // unable to generate simple pointer conversion for v1.SecurityContext -> api.SecurityContext if in.SecurityContext != nil { out.SecurityContext = new(api.SecurityContext) - if err := convert_v1_SecurityContext_To_api_SecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { + if err := Convert_v1_SecurityContext_To_api_SecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { return err } } else { @@ -3316,49 +3667,72 @@ func autoconvert_v1_Container_To_api_Container(in *Container, out *api.Container return nil } -func convert_v1_Container_To_api_Container(in *Container, out *api.Container, s conversion.Scope) error { - return autoconvert_v1_Container_To_api_Container(in, out, s) +func Convert_v1_Container_To_api_Container(in *Container, out *api.Container, s conversion.Scope) error { + return autoConvert_v1_Container_To_api_Container(in, out, s) } -func autoconvert_v1_ContainerPort_To_api_ContainerPort(in *ContainerPort, out *api.ContainerPort, s conversion.Scope) error { +func autoConvert_v1_ContainerImage_To_api_ContainerImage(in *ContainerImage, out *api.ContainerImage, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ContainerImage))(in) + } + if in.RepoTags != nil { + out.RepoTags = make([]string, len(in.RepoTags)) + for i := range in.RepoTags { + out.RepoTags[i] = in.RepoTags[i] + } + } else { + out.RepoTags = nil + } + out.Size = in.Size + return nil +} + +func Convert_v1_ContainerImage_To_api_ContainerImage(in *ContainerImage, out *api.ContainerImage, s conversion.Scope) error { + return autoConvert_v1_ContainerImage_To_api_ContainerImage(in, out, s) +} + +func autoConvert_v1_ContainerPort_To_api_ContainerPort(in *ContainerPort, out *api.ContainerPort, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ContainerPort))(in) } out.Name = in.Name - out.HostPort = in.HostPort - out.ContainerPort = in.ContainerPort + out.HostPort = int(in.HostPort) + out.ContainerPort = int(in.ContainerPort) out.Protocol = api.Protocol(in.Protocol) out.HostIP = in.HostIP return nil } -func convert_v1_ContainerPort_To_api_ContainerPort(in *ContainerPort, out *api.ContainerPort, s conversion.Scope) error { - return autoconvert_v1_ContainerPort_To_api_ContainerPort(in, out, s) +func Convert_v1_ContainerPort_To_api_ContainerPort(in *ContainerPort, out *api.ContainerPort, s conversion.Scope) error { + return autoConvert_v1_ContainerPort_To_api_ContainerPort(in, out, s) } -func autoconvert_v1_ContainerState_To_api_ContainerState(in *ContainerState, out *api.ContainerState, s conversion.Scope) error { +func autoConvert_v1_ContainerState_To_api_ContainerState(in *ContainerState, out *api.ContainerState, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ContainerState))(in) } + // unable to generate simple pointer conversion for v1.ContainerStateWaiting -> api.ContainerStateWaiting if in.Waiting != nil { out.Waiting = new(api.ContainerStateWaiting) - if err := convert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting(in.Waiting, out.Waiting, s); err != nil { + if err := Convert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting(in.Waiting, out.Waiting, s); err != nil { return err } } else { out.Waiting = nil } + // unable to generate simple pointer conversion for v1.ContainerStateRunning -> api.ContainerStateRunning if in.Running != nil { out.Running = new(api.ContainerStateRunning) - if err := convert_v1_ContainerStateRunning_To_api_ContainerStateRunning(in.Running, out.Running, s); err != nil { + if err := Convert_v1_ContainerStateRunning_To_api_ContainerStateRunning(in.Running, out.Running, s); err != nil { return err } } else { out.Running = nil } + // unable to generate simple pointer conversion for v1.ContainerStateTerminated -> api.ContainerStateTerminated if in.Terminated != nil { out.Terminated = new(api.ContainerStateTerminated) - if err := convert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated(in.Terminated, out.Terminated, s); err != nil { + if err := Convert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated(in.Terminated, out.Terminated, s); err != nil { return err } } else { @@ -3367,47 +3741,47 @@ func autoconvert_v1_ContainerState_To_api_ContainerState(in *ContainerState, out return nil } -func convert_v1_ContainerState_To_api_ContainerState(in *ContainerState, out *api.ContainerState, s conversion.Scope) error { - return autoconvert_v1_ContainerState_To_api_ContainerState(in, out, s) +func Convert_v1_ContainerState_To_api_ContainerState(in *ContainerState, out *api.ContainerState, s conversion.Scope) error { + return autoConvert_v1_ContainerState_To_api_ContainerState(in, out, s) } -func autoconvert_v1_ContainerStateRunning_To_api_ContainerStateRunning(in *ContainerStateRunning, out *api.ContainerStateRunning, s conversion.Scope) error { +func autoConvert_v1_ContainerStateRunning_To_api_ContainerStateRunning(in *ContainerStateRunning, out *api.ContainerStateRunning, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ContainerStateRunning))(in) } - if err := s.Convert(&in.StartedAt, &out.StartedAt, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.StartedAt, &out.StartedAt, s); err != nil { return err } return nil } -func convert_v1_ContainerStateRunning_To_api_ContainerStateRunning(in *ContainerStateRunning, out *api.ContainerStateRunning, s conversion.Scope) error { - return autoconvert_v1_ContainerStateRunning_To_api_ContainerStateRunning(in, out, s) +func Convert_v1_ContainerStateRunning_To_api_ContainerStateRunning(in *ContainerStateRunning, out *api.ContainerStateRunning, s conversion.Scope) error { + return autoConvert_v1_ContainerStateRunning_To_api_ContainerStateRunning(in, out, s) } -func autoconvert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated(in *ContainerStateTerminated, out *api.ContainerStateTerminated, s conversion.Scope) error { +func autoConvert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated(in *ContainerStateTerminated, out *api.ContainerStateTerminated, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ContainerStateTerminated))(in) } - out.ExitCode = in.ExitCode - out.Signal = in.Signal + out.ExitCode = int(in.ExitCode) + out.Signal = int(in.Signal) out.Reason = in.Reason out.Message = in.Message - if err := s.Convert(&in.StartedAt, &out.StartedAt, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.StartedAt, &out.StartedAt, s); err != nil { return err } - if err := s.Convert(&in.FinishedAt, &out.FinishedAt, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.FinishedAt, &out.FinishedAt, s); err != nil { return err } out.ContainerID = in.ContainerID return nil } -func convert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated(in *ContainerStateTerminated, out *api.ContainerStateTerminated, s conversion.Scope) error { - return autoconvert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated(in, out, s) +func Convert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated(in *ContainerStateTerminated, out *api.ContainerStateTerminated, s conversion.Scope) error { + return autoConvert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated(in, out, s) } -func autoconvert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting(in *ContainerStateWaiting, out *api.ContainerStateWaiting, s conversion.Scope) error { +func autoConvert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting(in *ContainerStateWaiting, out *api.ContainerStateWaiting, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ContainerStateWaiting))(in) } @@ -3416,52 +3790,49 @@ func autoconvert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting(in *Conta return nil } -func convert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting(in *ContainerStateWaiting, out *api.ContainerStateWaiting, s conversion.Scope) error { - return autoconvert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting(in, out, s) +func Convert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting(in *ContainerStateWaiting, out *api.ContainerStateWaiting, s conversion.Scope) error { + return autoConvert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting(in, out, s) } -func autoconvert_v1_ContainerStatus_To_api_ContainerStatus(in *ContainerStatus, out *api.ContainerStatus, s conversion.Scope) error { +func autoConvert_v1_ContainerStatus_To_api_ContainerStatus(in *ContainerStatus, out *api.ContainerStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ContainerStatus))(in) } out.Name = in.Name - if err := convert_v1_ContainerState_To_api_ContainerState(&in.State, &out.State, s); err != nil { + if err := Convert_v1_ContainerState_To_api_ContainerState(&in.State, &out.State, s); err != nil { return err } - if err := convert_v1_ContainerState_To_api_ContainerState(&in.LastTerminationState, &out.LastTerminationState, s); err != nil { + if err := Convert_v1_ContainerState_To_api_ContainerState(&in.LastTerminationState, &out.LastTerminationState, s); err != nil { return err } out.Ready = in.Ready - out.RestartCount = in.RestartCount + out.RestartCount = int(in.RestartCount) out.Image = in.Image out.ImageID = in.ImageID out.ContainerID = in.ContainerID return nil } -func convert_v1_ContainerStatus_To_api_ContainerStatus(in *ContainerStatus, out *api.ContainerStatus, s conversion.Scope) error { - return autoconvert_v1_ContainerStatus_To_api_ContainerStatus(in, out, s) +func Convert_v1_ContainerStatus_To_api_ContainerStatus(in *ContainerStatus, out *api.ContainerStatus, s conversion.Scope) error { + return autoConvert_v1_ContainerStatus_To_api_ContainerStatus(in, out, s) } -func autoconvert_v1_DaemonEndpoint_To_api_DaemonEndpoint(in *DaemonEndpoint, out *api.DaemonEndpoint, s conversion.Scope) error { +func autoConvert_v1_DaemonEndpoint_To_api_DaemonEndpoint(in *DaemonEndpoint, out *api.DaemonEndpoint, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DaemonEndpoint))(in) } - out.Port = in.Port + out.Port = int(in.Port) return nil } -func convert_v1_DaemonEndpoint_To_api_DaemonEndpoint(in *DaemonEndpoint, out *api.DaemonEndpoint, s conversion.Scope) error { - return autoconvert_v1_DaemonEndpoint_To_api_DaemonEndpoint(in, out, s) +func Convert_v1_DaemonEndpoint_To_api_DaemonEndpoint(in *DaemonEndpoint, out *api.DaemonEndpoint, s conversion.Scope) error { + return autoConvert_v1_DaemonEndpoint_To_api_DaemonEndpoint(in, out, s) } -func autoconvert_v1_DeleteOptions_To_api_DeleteOptions(in *DeleteOptions, out *api.DeleteOptions, s conversion.Scope) error { +func autoConvert_v1_DeleteOptions_To_api_DeleteOptions(in *DeleteOptions, out *api.DeleteOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DeleteOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } if in.GracePeriodSeconds != nil { out.GracePeriodSeconds = new(int64) *out.GracePeriodSeconds = *in.GracePeriodSeconds @@ -3471,33 +3842,33 @@ func autoconvert_v1_DeleteOptions_To_api_DeleteOptions(in *DeleteOptions, out *a return nil } -func convert_v1_DeleteOptions_To_api_DeleteOptions(in *DeleteOptions, out *api.DeleteOptions, s conversion.Scope) error { - return autoconvert_v1_DeleteOptions_To_api_DeleteOptions(in, out, s) +func Convert_v1_DeleteOptions_To_api_DeleteOptions(in *DeleteOptions, out *api.DeleteOptions, s conversion.Scope) error { + return autoConvert_v1_DeleteOptions_To_api_DeleteOptions(in, out, s) } -func autoconvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in *DownwardAPIVolumeFile, out *api.DownwardAPIVolumeFile, s conversion.Scope) error { +func autoConvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in *DownwardAPIVolumeFile, out *api.DownwardAPIVolumeFile, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DownwardAPIVolumeFile))(in) } out.Path = in.Path - if err := convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(&in.FieldRef, &out.FieldRef, s); err != nil { + if err := Convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(&in.FieldRef, &out.FieldRef, s); err != nil { return err } return nil } -func convert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in *DownwardAPIVolumeFile, out *api.DownwardAPIVolumeFile, s conversion.Scope) error { - return autoconvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in, out, s) +func Convert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in *DownwardAPIVolumeFile, out *api.DownwardAPIVolumeFile, s conversion.Scope) error { + return autoConvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in, out, s) } -func autoconvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *DownwardAPIVolumeSource, out *api.DownwardAPIVolumeSource, s conversion.Scope) error { +func autoConvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *DownwardAPIVolumeSource, out *api.DownwardAPIVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DownwardAPIVolumeSource))(in) } if in.Items != nil { out.Items = make([]api.DownwardAPIVolumeFile, len(in.Items)) for i := range in.Items { - if err := convert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3507,11 +3878,11 @@ func autoconvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *D return nil } -func convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *DownwardAPIVolumeSource, out *api.DownwardAPIVolumeSource, s conversion.Scope) error { - return autoconvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in, out, s) +func Convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *DownwardAPIVolumeSource, out *api.DownwardAPIVolumeSource, s conversion.Scope) error { + return autoConvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in, out, s) } -func autoconvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVolumeSource, out *api.EmptyDirVolumeSource, s conversion.Scope) error { +func autoConvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVolumeSource, out *api.EmptyDirVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EmptyDirVolumeSource))(in) } @@ -3519,18 +3890,19 @@ func autoconvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDi return nil } -func convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVolumeSource, out *api.EmptyDirVolumeSource, s conversion.Scope) error { - return autoconvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in, out, s) +func Convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVolumeSource, out *api.EmptyDirVolumeSource, s conversion.Scope) error { + return autoConvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in, out, s) } -func autoconvert_v1_EndpointAddress_To_api_EndpointAddress(in *EndpointAddress, out *api.EndpointAddress, s conversion.Scope) error { +func autoConvert_v1_EndpointAddress_To_api_EndpointAddress(in *EndpointAddress, out *api.EndpointAddress, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EndpointAddress))(in) } out.IP = in.IP + // unable to generate simple pointer conversion for v1.ObjectReference -> api.ObjectReference if in.TargetRef != nil { out.TargetRef = new(api.ObjectReference) - if err := convert_v1_ObjectReference_To_api_ObjectReference(in.TargetRef, out.TargetRef, s); err != nil { + if err := Convert_v1_ObjectReference_To_api_ObjectReference(in.TargetRef, out.TargetRef, s); err != nil { return err } } else { @@ -3539,32 +3911,32 @@ func autoconvert_v1_EndpointAddress_To_api_EndpointAddress(in *EndpointAddress, return nil } -func convert_v1_EndpointAddress_To_api_EndpointAddress(in *EndpointAddress, out *api.EndpointAddress, s conversion.Scope) error { - return autoconvert_v1_EndpointAddress_To_api_EndpointAddress(in, out, s) +func Convert_v1_EndpointAddress_To_api_EndpointAddress(in *EndpointAddress, out *api.EndpointAddress, s conversion.Scope) error { + return autoConvert_v1_EndpointAddress_To_api_EndpointAddress(in, out, s) } -func autoconvert_v1_EndpointPort_To_api_EndpointPort(in *EndpointPort, out *api.EndpointPort, s conversion.Scope) error { +func autoConvert_v1_EndpointPort_To_api_EndpointPort(in *EndpointPort, out *api.EndpointPort, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EndpointPort))(in) } out.Name = in.Name - out.Port = in.Port + out.Port = int(in.Port) out.Protocol = api.Protocol(in.Protocol) return nil } -func convert_v1_EndpointPort_To_api_EndpointPort(in *EndpointPort, out *api.EndpointPort, s conversion.Scope) error { - return autoconvert_v1_EndpointPort_To_api_EndpointPort(in, out, s) +func Convert_v1_EndpointPort_To_api_EndpointPort(in *EndpointPort, out *api.EndpointPort, s conversion.Scope) error { + return autoConvert_v1_EndpointPort_To_api_EndpointPort(in, out, s) } -func autoconvert_v1_EndpointSubset_To_api_EndpointSubset(in *EndpointSubset, out *api.EndpointSubset, s conversion.Scope) error { +func autoConvert_v1_EndpointSubset_To_api_EndpointSubset(in *EndpointSubset, out *api.EndpointSubset, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EndpointSubset))(in) } if in.Addresses != nil { out.Addresses = make([]api.EndpointAddress, len(in.Addresses)) for i := range in.Addresses { - if err := convert_v1_EndpointAddress_To_api_EndpointAddress(&in.Addresses[i], &out.Addresses[i], s); err != nil { + if err := Convert_v1_EndpointAddress_To_api_EndpointAddress(&in.Addresses[i], &out.Addresses[i], s); err != nil { return err } } @@ -3574,7 +3946,7 @@ func autoconvert_v1_EndpointSubset_To_api_EndpointSubset(in *EndpointSubset, out if in.NotReadyAddresses != nil { out.NotReadyAddresses = make([]api.EndpointAddress, len(in.NotReadyAddresses)) for i := range in.NotReadyAddresses { - if err := convert_v1_EndpointAddress_To_api_EndpointAddress(&in.NotReadyAddresses[i], &out.NotReadyAddresses[i], s); err != nil { + if err := Convert_v1_EndpointAddress_To_api_EndpointAddress(&in.NotReadyAddresses[i], &out.NotReadyAddresses[i], s); err != nil { return err } } @@ -3584,7 +3956,7 @@ func autoconvert_v1_EndpointSubset_To_api_EndpointSubset(in *EndpointSubset, out if in.Ports != nil { out.Ports = make([]api.EndpointPort, len(in.Ports)) for i := range in.Ports { - if err := convert_v1_EndpointPort_To_api_EndpointPort(&in.Ports[i], &out.Ports[i], s); err != nil { + if err := Convert_v1_EndpointPort_To_api_EndpointPort(&in.Ports[i], &out.Ports[i], s); err != nil { return err } } @@ -3594,24 +3966,21 @@ func autoconvert_v1_EndpointSubset_To_api_EndpointSubset(in *EndpointSubset, out return nil } -func convert_v1_EndpointSubset_To_api_EndpointSubset(in *EndpointSubset, out *api.EndpointSubset, s conversion.Scope) error { - return autoconvert_v1_EndpointSubset_To_api_EndpointSubset(in, out, s) +func Convert_v1_EndpointSubset_To_api_EndpointSubset(in *EndpointSubset, out *api.EndpointSubset, s conversion.Scope) error { + return autoConvert_v1_EndpointSubset_To_api_EndpointSubset(in, out, s) } -func autoconvert_v1_Endpoints_To_api_Endpoints(in *Endpoints, out *api.Endpoints, s conversion.Scope) error { +func autoConvert_v1_Endpoints_To_api_Endpoints(in *Endpoints, out *api.Endpoints, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Endpoints))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } if in.Subsets != nil { out.Subsets = make([]api.EndpointSubset, len(in.Subsets)) for i := range in.Subsets { - if err := convert_v1_EndpointSubset_To_api_EndpointSubset(&in.Subsets[i], &out.Subsets[i], s); err != nil { + if err := Convert_v1_EndpointSubset_To_api_EndpointSubset(&in.Subsets[i], &out.Subsets[i], s); err != nil { return err } } @@ -3621,24 +3990,21 @@ func autoconvert_v1_Endpoints_To_api_Endpoints(in *Endpoints, out *api.Endpoints return nil } -func convert_v1_Endpoints_To_api_Endpoints(in *Endpoints, out *api.Endpoints, s conversion.Scope) error { - return autoconvert_v1_Endpoints_To_api_Endpoints(in, out, s) +func Convert_v1_Endpoints_To_api_Endpoints(in *Endpoints, out *api.Endpoints, s conversion.Scope) error { + return autoConvert_v1_Endpoints_To_api_Endpoints(in, out, s) } -func autoconvert_v1_EndpointsList_To_api_EndpointsList(in *EndpointsList, out *api.EndpointsList, s conversion.Scope) error { +func autoConvert_v1_EndpointsList_To_api_EndpointsList(in *EndpointsList, out *api.EndpointsList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EndpointsList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.Endpoints, len(in.Items)) for i := range in.Items { - if err := convert_v1_Endpoints_To_api_Endpoints(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_Endpoints_To_api_Endpoints(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3648,19 +4014,20 @@ func autoconvert_v1_EndpointsList_To_api_EndpointsList(in *EndpointsList, out *a return nil } -func convert_v1_EndpointsList_To_api_EndpointsList(in *EndpointsList, out *api.EndpointsList, s conversion.Scope) error { - return autoconvert_v1_EndpointsList_To_api_EndpointsList(in, out, s) +func Convert_v1_EndpointsList_To_api_EndpointsList(in *EndpointsList, out *api.EndpointsList, s conversion.Scope) error { + return autoConvert_v1_EndpointsList_To_api_EndpointsList(in, out, s) } -func autoconvert_v1_EnvVar_To_api_EnvVar(in *EnvVar, out *api.EnvVar, s conversion.Scope) error { +func autoConvert_v1_EnvVar_To_api_EnvVar(in *EnvVar, out *api.EnvVar, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EnvVar))(in) } out.Name = in.Name out.Value = in.Value + // unable to generate simple pointer conversion for v1.EnvVarSource -> api.EnvVarSource if in.ValueFrom != nil { out.ValueFrom = new(api.EnvVarSource) - if err := convert_v1_EnvVarSource_To_api_EnvVarSource(in.ValueFrom, out.ValueFrom, s); err != nil { + if err := Convert_v1_EnvVarSource_To_api_EnvVarSource(in.ValueFrom, out.ValueFrom, s); err != nil { return err } } else { @@ -3669,75 +4036,89 @@ func autoconvert_v1_EnvVar_To_api_EnvVar(in *EnvVar, out *api.EnvVar, s conversi return nil } -func convert_v1_EnvVar_To_api_EnvVar(in *EnvVar, out *api.EnvVar, s conversion.Scope) error { - return autoconvert_v1_EnvVar_To_api_EnvVar(in, out, s) +func Convert_v1_EnvVar_To_api_EnvVar(in *EnvVar, out *api.EnvVar, s conversion.Scope) error { + return autoConvert_v1_EnvVar_To_api_EnvVar(in, out, s) } -func autoconvert_v1_EnvVarSource_To_api_EnvVarSource(in *EnvVarSource, out *api.EnvVarSource, s conversion.Scope) error { +func autoConvert_v1_EnvVarSource_To_api_EnvVarSource(in *EnvVarSource, out *api.EnvVarSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EnvVarSource))(in) } + // unable to generate simple pointer conversion for v1.ObjectFieldSelector -> api.ObjectFieldSelector if in.FieldRef != nil { out.FieldRef = new(api.ObjectFieldSelector) - if err := convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in.FieldRef, out.FieldRef, s); err != nil { + if err := Convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in.FieldRef, out.FieldRef, s); err != nil { return err } } else { out.FieldRef = nil } + // unable to generate simple pointer conversion for v1.ConfigMapKeySelector -> api.ConfigMapKeySelector + if in.ConfigMapKeyRef != nil { + out.ConfigMapKeyRef = new(api.ConfigMapKeySelector) + if err := Convert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector(in.ConfigMapKeyRef, out.ConfigMapKeyRef, s); err != nil { + return err + } + } else { + out.ConfigMapKeyRef = nil + } + // unable to generate simple pointer conversion for v1.SecretKeySelector -> api.SecretKeySelector + if in.SecretKeyRef != nil { + out.SecretKeyRef = new(api.SecretKeySelector) + if err := Convert_v1_SecretKeySelector_To_api_SecretKeySelector(in.SecretKeyRef, out.SecretKeyRef, s); err != nil { + return err + } + } else { + out.SecretKeyRef = nil + } return nil } -func convert_v1_EnvVarSource_To_api_EnvVarSource(in *EnvVarSource, out *api.EnvVarSource, s conversion.Scope) error { - return autoconvert_v1_EnvVarSource_To_api_EnvVarSource(in, out, s) +func Convert_v1_EnvVarSource_To_api_EnvVarSource(in *EnvVarSource, out *api.EnvVarSource, s conversion.Scope) error { + return autoConvert_v1_EnvVarSource_To_api_EnvVarSource(in, out, s) } -func autoconvert_v1_Event_To_api_Event(in *Event, out *api.Event, s conversion.Scope) error { +func autoConvert_v1_Event_To_api_Event(in *Event, out *api.Event, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Event))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_v1_ObjectReference_To_api_ObjectReference(&in.InvolvedObject, &out.InvolvedObject, s); err != nil { + if err := Convert_v1_ObjectReference_To_api_ObjectReference(&in.InvolvedObject, &out.InvolvedObject, s); err != nil { return err } out.Reason = in.Reason out.Message = in.Message - if err := convert_v1_EventSource_To_api_EventSource(&in.Source, &out.Source, s); err != nil { + if err := Convert_v1_EventSource_To_api_EventSource(&in.Source, &out.Source, s); err != nil { return err } - if err := s.Convert(&in.FirstTimestamp, &out.FirstTimestamp, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.FirstTimestamp, &out.FirstTimestamp, s); err != nil { return err } - if err := s.Convert(&in.LastTimestamp, &out.LastTimestamp, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastTimestamp, &out.LastTimestamp, s); err != nil { return err } - out.Count = in.Count + out.Count = int(in.Count) + out.Type = in.Type return nil } -func convert_v1_Event_To_api_Event(in *Event, out *api.Event, s conversion.Scope) error { - return autoconvert_v1_Event_To_api_Event(in, out, s) +func Convert_v1_Event_To_api_Event(in *Event, out *api.Event, s conversion.Scope) error { + return autoConvert_v1_Event_To_api_Event(in, out, s) } -func autoconvert_v1_EventList_To_api_EventList(in *EventList, out *api.EventList, s conversion.Scope) error { +func autoConvert_v1_EventList_To_api_EventList(in *EventList, out *api.EventList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EventList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.Event, len(in.Items)) for i := range in.Items { - if err := convert_v1_Event_To_api_Event(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_Event_To_api_Event(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3747,11 +4128,11 @@ func autoconvert_v1_EventList_To_api_EventList(in *EventList, out *api.EventList return nil } -func convert_v1_EventList_To_api_EventList(in *EventList, out *api.EventList, s conversion.Scope) error { - return autoconvert_v1_EventList_To_api_EventList(in, out, s) +func Convert_v1_EventList_To_api_EventList(in *EventList, out *api.EventList, s conversion.Scope) error { + return autoConvert_v1_EventList_To_api_EventList(in, out, s) } -func autoconvert_v1_EventSource_To_api_EventSource(in *EventSource, out *api.EventSource, s conversion.Scope) error { +func autoConvert_v1_EventSource_To_api_EventSource(in *EventSource, out *api.EventSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EventSource))(in) } @@ -3760,11 +4141,11 @@ func autoconvert_v1_EventSource_To_api_EventSource(in *EventSource, out *api.Eve return nil } -func convert_v1_EventSource_To_api_EventSource(in *EventSource, out *api.EventSource, s conversion.Scope) error { - return autoconvert_v1_EventSource_To_api_EventSource(in, out, s) +func Convert_v1_EventSource_To_api_EventSource(in *EventSource, out *api.EventSource, s conversion.Scope) error { + return autoConvert_v1_EventSource_To_api_EventSource(in, out, s) } -func autoconvert_v1_ExecAction_To_api_ExecAction(in *ExecAction, out *api.ExecAction, s conversion.Scope) error { +func autoConvert_v1_ExecAction_To_api_ExecAction(in *ExecAction, out *api.ExecAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ExecAction))(in) } @@ -3779,11 +4160,24 @@ func autoconvert_v1_ExecAction_To_api_ExecAction(in *ExecAction, out *api.ExecAc return nil } -func convert_v1_ExecAction_To_api_ExecAction(in *ExecAction, out *api.ExecAction, s conversion.Scope) error { - return autoconvert_v1_ExecAction_To_api_ExecAction(in, out, s) +func Convert_v1_ExecAction_To_api_ExecAction(in *ExecAction, out *api.ExecAction, s conversion.Scope) error { + return autoConvert_v1_ExecAction_To_api_ExecAction(in, out, s) } -func autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource(in *FCVolumeSource, out *api.FCVolumeSource, s conversion.Scope) error { +func autoConvert_v1_ExportOptions_To_unversioned_ExportOptions(in *ExportOptions, out *unversioned.ExportOptions, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ExportOptions))(in) + } + out.Export = in.Export + out.Exact = in.Exact + return nil +} + +func Convert_v1_ExportOptions_To_unversioned_ExportOptions(in *ExportOptions, out *unversioned.ExportOptions, s conversion.Scope) error { + return autoConvert_v1_ExportOptions_To_unversioned_ExportOptions(in, out, s) +} + +func autoConvert_v1_FCVolumeSource_To_api_FCVolumeSource(in *FCVolumeSource, out *api.FCVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*FCVolumeSource))(in) } @@ -3797,7 +4191,7 @@ func autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource(in *FCVolumeSource, out } if in.Lun != nil { out.Lun = new(int) - *out.Lun = *in.Lun + *out.Lun = int(*in.Lun) } else { out.Lun = nil } @@ -3806,11 +4200,42 @@ func autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource(in *FCVolumeSource, out return nil } -func convert_v1_FCVolumeSource_To_api_FCVolumeSource(in *FCVolumeSource, out *api.FCVolumeSource, s conversion.Scope) error { - return autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource(in, out, s) +func Convert_v1_FCVolumeSource_To_api_FCVolumeSource(in *FCVolumeSource, out *api.FCVolumeSource, s conversion.Scope) error { + return autoConvert_v1_FCVolumeSource_To_api_FCVolumeSource(in, out, s) } -func autoconvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *FlockerVolumeSource, out *api.FlockerVolumeSource, s conversion.Scope) error { +func autoConvert_v1_FlexVolumeSource_To_api_FlexVolumeSource(in *FlexVolumeSource, out *api.FlexVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*FlexVolumeSource))(in) + } + out.Driver = in.Driver + out.FSType = in.FSType + // unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference + if in.SecretRef != nil { + out.SecretRef = new(api.LocalObjectReference) + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + return err + } + } else { + out.SecretRef = nil + } + out.ReadOnly = in.ReadOnly + if in.Options != nil { + out.Options = make(map[string]string) + for key, val := range in.Options { + out.Options[key] = val + } + } else { + out.Options = nil + } + return nil +} + +func Convert_v1_FlexVolumeSource_To_api_FlexVolumeSource(in *FlexVolumeSource, out *api.FlexVolumeSource, s conversion.Scope) error { + return autoConvert_v1_FlexVolumeSource_To_api_FlexVolumeSource(in, out, s) +} + +func autoConvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *FlockerVolumeSource, out *api.FlockerVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*FlockerVolumeSource))(in) } @@ -3818,39 +4243,40 @@ func autoconvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *FlockerVo return nil } -func convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *FlockerVolumeSource, out *api.FlockerVolumeSource, s conversion.Scope) error { - return autoconvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in, out, s) +func Convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *FlockerVolumeSource, out *api.FlockerVolumeSource, s conversion.Scope) error { + return autoConvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in, out, s) } -func autoconvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in *GCEPersistentDiskVolumeSource, out *api.GCEPersistentDiskVolumeSource, s conversion.Scope) error { +func autoConvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in *GCEPersistentDiskVolumeSource, out *api.GCEPersistentDiskVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*GCEPersistentDiskVolumeSource))(in) } out.PDName = in.PDName out.FSType = in.FSType - out.Partition = in.Partition + out.Partition = int(in.Partition) out.ReadOnly = in.ReadOnly return nil } -func convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in *GCEPersistentDiskVolumeSource, out *api.GCEPersistentDiskVolumeSource, s conversion.Scope) error { - return autoconvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in, out, s) +func Convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in *GCEPersistentDiskVolumeSource, out *api.GCEPersistentDiskVolumeSource, s conversion.Scope) error { + return autoConvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in, out, s) } -func autoconvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in *GitRepoVolumeSource, out *api.GitRepoVolumeSource, s conversion.Scope) error { +func autoConvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in *GitRepoVolumeSource, out *api.GitRepoVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*GitRepoVolumeSource))(in) } out.Repository = in.Repository out.Revision = in.Revision + out.Directory = in.Directory return nil } -func convert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in *GitRepoVolumeSource, out *api.GitRepoVolumeSource, s conversion.Scope) error { - return autoconvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in, out, s) +func Convert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in *GitRepoVolumeSource, out *api.GitRepoVolumeSource, s conversion.Scope) error { + return autoConvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in, out, s) } -func autoconvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *GlusterfsVolumeSource, out *api.GlusterfsVolumeSource, s conversion.Scope) error { +func autoConvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *GlusterfsVolumeSource, out *api.GlusterfsVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*GlusterfsVolumeSource))(in) } @@ -3860,50 +4286,76 @@ func autoconvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *Glust return nil } -func convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *GlusterfsVolumeSource, out *api.GlusterfsVolumeSource, s conversion.Scope) error { - return autoconvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in, out, s) +func Convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *GlusterfsVolumeSource, out *api.GlusterfsVolumeSource, s conversion.Scope) error { + return autoConvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in, out, s) } -func autoconvert_v1_HTTPGetAction_To_api_HTTPGetAction(in *HTTPGetAction, out *api.HTTPGetAction, s conversion.Scope) error { +func autoConvert_v1_HTTPGetAction_To_api_HTTPGetAction(in *HTTPGetAction, out *api.HTTPGetAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*HTTPGetAction))(in) } out.Path = in.Path - if err := s.Convert(&in.Port, &out.Port, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.Port, &out.Port, s); err != nil { return err } out.Host = in.Host out.Scheme = api.URIScheme(in.Scheme) + if in.HTTPHeaders != nil { + out.HTTPHeaders = make([]api.HTTPHeader, len(in.HTTPHeaders)) + for i := range in.HTTPHeaders { + if err := Convert_v1_HTTPHeader_To_api_HTTPHeader(&in.HTTPHeaders[i], &out.HTTPHeaders[i], s); err != nil { + return err + } + } + } else { + out.HTTPHeaders = nil + } return nil } -func convert_v1_HTTPGetAction_To_api_HTTPGetAction(in *HTTPGetAction, out *api.HTTPGetAction, s conversion.Scope) error { - return autoconvert_v1_HTTPGetAction_To_api_HTTPGetAction(in, out, s) +func Convert_v1_HTTPGetAction_To_api_HTTPGetAction(in *HTTPGetAction, out *api.HTTPGetAction, s conversion.Scope) error { + return autoConvert_v1_HTTPGetAction_To_api_HTTPGetAction(in, out, s) } -func autoconvert_v1_Handler_To_api_Handler(in *Handler, out *api.Handler, s conversion.Scope) error { +func autoConvert_v1_HTTPHeader_To_api_HTTPHeader(in *HTTPHeader, out *api.HTTPHeader, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*HTTPHeader))(in) + } + out.Name = in.Name + out.Value = in.Value + return nil +} + +func Convert_v1_HTTPHeader_To_api_HTTPHeader(in *HTTPHeader, out *api.HTTPHeader, s conversion.Scope) error { + return autoConvert_v1_HTTPHeader_To_api_HTTPHeader(in, out, s) +} + +func autoConvert_v1_Handler_To_api_Handler(in *Handler, out *api.Handler, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Handler))(in) } + // unable to generate simple pointer conversion for v1.ExecAction -> api.ExecAction if in.Exec != nil { out.Exec = new(api.ExecAction) - if err := convert_v1_ExecAction_To_api_ExecAction(in.Exec, out.Exec, s); err != nil { + if err := Convert_v1_ExecAction_To_api_ExecAction(in.Exec, out.Exec, s); err != nil { return err } } else { out.Exec = nil } + // unable to generate simple pointer conversion for v1.HTTPGetAction -> api.HTTPGetAction if in.HTTPGet != nil { out.HTTPGet = new(api.HTTPGetAction) - if err := convert_v1_HTTPGetAction_To_api_HTTPGetAction(in.HTTPGet, out.HTTPGet, s); err != nil { + if err := Convert_v1_HTTPGetAction_To_api_HTTPGetAction(in.HTTPGet, out.HTTPGet, s); err != nil { return err } } else { out.HTTPGet = nil } + // unable to generate simple pointer conversion for v1.TCPSocketAction -> api.TCPSocketAction if in.TCPSocket != nil { out.TCPSocket = new(api.TCPSocketAction) - if err := convert_v1_TCPSocketAction_To_api_TCPSocketAction(in.TCPSocket, out.TCPSocket, s); err != nil { + if err := Convert_v1_TCPSocketAction_To_api_TCPSocketAction(in.TCPSocket, out.TCPSocket, s); err != nil { return err } } else { @@ -3912,11 +4364,11 @@ func autoconvert_v1_Handler_To_api_Handler(in *Handler, out *api.Handler, s conv return nil } -func convert_v1_Handler_To_api_Handler(in *Handler, out *api.Handler, s conversion.Scope) error { - return autoconvert_v1_Handler_To_api_Handler(in, out, s) +func Convert_v1_Handler_To_api_Handler(in *Handler, out *api.Handler, s conversion.Scope) error { + return autoConvert_v1_Handler_To_api_Handler(in, out, s) } -func autoconvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *HostPathVolumeSource, out *api.HostPathVolumeSource, s conversion.Scope) error { +func autoConvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *HostPathVolumeSource, out *api.HostPathVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*HostPathVolumeSource))(in) } @@ -3924,41 +4376,57 @@ func autoconvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *HostPat return nil } -func convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *HostPathVolumeSource, out *api.HostPathVolumeSource, s conversion.Scope) error { - return autoconvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in, out, s) +func Convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *HostPathVolumeSource, out *api.HostPathVolumeSource, s conversion.Scope) error { + return autoConvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in, out, s) } -func autoconvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *ISCSIVolumeSource, out *api.ISCSIVolumeSource, s conversion.Scope) error { +func autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *ISCSIVolumeSource, out *api.ISCSIVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ISCSIVolumeSource))(in) } out.TargetPortal = in.TargetPortal out.IQN = in.IQN - out.Lun = in.Lun + out.Lun = int(in.Lun) + out.ISCSIInterface = in.ISCSIInterface out.FSType = in.FSType out.ReadOnly = in.ReadOnly return nil } -func convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *ISCSIVolumeSource, out *api.ISCSIVolumeSource, s conversion.Scope) error { - return autoconvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in, out, s) +func Convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *ISCSIVolumeSource, out *api.ISCSIVolumeSource, s conversion.Scope) error { + return autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in, out, s) } -func autoconvert_v1_Lifecycle_To_api_Lifecycle(in *Lifecycle, out *api.Lifecycle, s conversion.Scope) error { +func autoConvert_v1_KeyToPath_To_api_KeyToPath(in *KeyToPath, out *api.KeyToPath, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*KeyToPath))(in) + } + out.Key = in.Key + out.Path = in.Path + return nil +} + +func Convert_v1_KeyToPath_To_api_KeyToPath(in *KeyToPath, out *api.KeyToPath, s conversion.Scope) error { + return autoConvert_v1_KeyToPath_To_api_KeyToPath(in, out, s) +} + +func autoConvert_v1_Lifecycle_To_api_Lifecycle(in *Lifecycle, out *api.Lifecycle, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Lifecycle))(in) } + // unable to generate simple pointer conversion for v1.Handler -> api.Handler if in.PostStart != nil { out.PostStart = new(api.Handler) - if err := convert_v1_Handler_To_api_Handler(in.PostStart, out.PostStart, s); err != nil { + if err := Convert_v1_Handler_To_api_Handler(in.PostStart, out.PostStart, s); err != nil { return err } } else { out.PostStart = nil } + // unable to generate simple pointer conversion for v1.Handler -> api.Handler if in.PreStop != nil { out.PreStop = new(api.Handler) - if err := convert_v1_Handler_To_api_Handler(in.PreStop, out.PreStop, s); err != nil { + if err := Convert_v1_Handler_To_api_Handler(in.PreStop, out.PreStop, s); err != nil { return err } } else { @@ -3967,116 +4435,65 @@ func autoconvert_v1_Lifecycle_To_api_Lifecycle(in *Lifecycle, out *api.Lifecycle return nil } -func convert_v1_Lifecycle_To_api_Lifecycle(in *Lifecycle, out *api.Lifecycle, s conversion.Scope) error { - return autoconvert_v1_Lifecycle_To_api_Lifecycle(in, out, s) +func Convert_v1_Lifecycle_To_api_Lifecycle(in *Lifecycle, out *api.Lifecycle, s conversion.Scope) error { + return autoConvert_v1_Lifecycle_To_api_Lifecycle(in, out, s) } -func autoconvert_v1_LimitRange_To_api_LimitRange(in *LimitRange, out *api.LimitRange, s conversion.Scope) error { +func autoConvert_v1_LimitRange_To_api_LimitRange(in *LimitRange, out *api.LimitRange, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*LimitRange))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_v1_LimitRangeSpec_To_api_LimitRangeSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1_LimitRangeSpec_To_api_LimitRangeSpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_v1_LimitRange_To_api_LimitRange(in *LimitRange, out *api.LimitRange, s conversion.Scope) error { - return autoconvert_v1_LimitRange_To_api_LimitRange(in, out, s) +func Convert_v1_LimitRange_To_api_LimitRange(in *LimitRange, out *api.LimitRange, s conversion.Scope) error { + return autoConvert_v1_LimitRange_To_api_LimitRange(in, out, s) } -func autoconvert_v1_LimitRangeItem_To_api_LimitRangeItem(in *LimitRangeItem, out *api.LimitRangeItem, s conversion.Scope) error { +func autoConvert_v1_LimitRangeItem_To_api_LimitRangeItem(in *LimitRangeItem, out *api.LimitRangeItem, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*LimitRangeItem))(in) } out.Type = api.LimitType(in.Type) - if in.Max != nil { - out.Max = make(api.ResourceList) - for key, val := range in.Max { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Max[api.ResourceName(key)] = newVal - } - } else { - out.Max = nil + if err := s.Convert(&in.Max, &out.Max, 0); err != nil { + return err } - if in.Min != nil { - out.Min = make(api.ResourceList) - for key, val := range in.Min { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Min[api.ResourceName(key)] = newVal - } - } else { - out.Min = nil + if err := s.Convert(&in.Min, &out.Min, 0); err != nil { + return err } - if in.Default != nil { - out.Default = make(api.ResourceList) - for key, val := range in.Default { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Default[api.ResourceName(key)] = newVal - } - } else { - out.Default = nil + if err := s.Convert(&in.Default, &out.Default, 0); err != nil { + return err } - if in.DefaultRequest != nil { - out.DefaultRequest = make(api.ResourceList) - for key, val := range in.DefaultRequest { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.DefaultRequest[api.ResourceName(key)] = newVal - } - } else { - out.DefaultRequest = nil + if err := s.Convert(&in.DefaultRequest, &out.DefaultRequest, 0); err != nil { + return err } - if in.MaxLimitRequestRatio != nil { - out.MaxLimitRequestRatio = make(api.ResourceList) - for key, val := range in.MaxLimitRequestRatio { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.MaxLimitRequestRatio[api.ResourceName(key)] = newVal - } - } else { - out.MaxLimitRequestRatio = nil + if err := s.Convert(&in.MaxLimitRequestRatio, &out.MaxLimitRequestRatio, 0); err != nil { + return err } return nil } -func convert_v1_LimitRangeItem_To_api_LimitRangeItem(in *LimitRangeItem, out *api.LimitRangeItem, s conversion.Scope) error { - return autoconvert_v1_LimitRangeItem_To_api_LimitRangeItem(in, out, s) +func Convert_v1_LimitRangeItem_To_api_LimitRangeItem(in *LimitRangeItem, out *api.LimitRangeItem, s conversion.Scope) error { + return autoConvert_v1_LimitRangeItem_To_api_LimitRangeItem(in, out, s) } -func autoconvert_v1_LimitRangeList_To_api_LimitRangeList(in *LimitRangeList, out *api.LimitRangeList, s conversion.Scope) error { +func autoConvert_v1_LimitRangeList_To_api_LimitRangeList(in *LimitRangeList, out *api.LimitRangeList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*LimitRangeList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.LimitRange, len(in.Items)) for i := range in.Items { - if err := convert_v1_LimitRange_To_api_LimitRange(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_LimitRange_To_api_LimitRange(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -4086,18 +4503,18 @@ func autoconvert_v1_LimitRangeList_To_api_LimitRangeList(in *LimitRangeList, out return nil } -func convert_v1_LimitRangeList_To_api_LimitRangeList(in *LimitRangeList, out *api.LimitRangeList, s conversion.Scope) error { - return autoconvert_v1_LimitRangeList_To_api_LimitRangeList(in, out, s) +func Convert_v1_LimitRangeList_To_api_LimitRangeList(in *LimitRangeList, out *api.LimitRangeList, s conversion.Scope) error { + return autoConvert_v1_LimitRangeList_To_api_LimitRangeList(in, out, s) } -func autoconvert_v1_LimitRangeSpec_To_api_LimitRangeSpec(in *LimitRangeSpec, out *api.LimitRangeSpec, s conversion.Scope) error { +func autoConvert_v1_LimitRangeSpec_To_api_LimitRangeSpec(in *LimitRangeSpec, out *api.LimitRangeSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*LimitRangeSpec))(in) } if in.Limits != nil { out.Limits = make([]api.LimitRangeItem, len(in.Limits)) for i := range in.Limits { - if err := convert_v1_LimitRangeItem_To_api_LimitRangeItem(&in.Limits[i], &out.Limits[i], s); err != nil { + if err := Convert_v1_LimitRangeItem_To_api_LimitRangeItem(&in.Limits[i], &out.Limits[i], s); err != nil { return err } } @@ -4107,149 +4524,21 @@ func autoconvert_v1_LimitRangeSpec_To_api_LimitRangeSpec(in *LimitRangeSpec, out return nil } -func convert_v1_LimitRangeSpec_To_api_LimitRangeSpec(in *LimitRangeSpec, out *api.LimitRangeSpec, s conversion.Scope) error { - return autoconvert_v1_LimitRangeSpec_To_api_LimitRangeSpec(in, out, s) +func Convert_v1_LimitRangeSpec_To_api_LimitRangeSpec(in *LimitRangeSpec, out *api.LimitRangeSpec, s conversion.Scope) error { + return autoConvert_v1_LimitRangeSpec_To_api_LimitRangeSpec(in, out, s) } -func autoconvert_v1_List_To_api_List(in *List, out *api.List, s conversion.Scope) error { +func autoConvert_v1_List_To_api_List(in *List, out *api.List, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*List))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.Items, &out.Items, 0); err != nil { - return err - } - return nil -} - -func convert_v1_List_To_api_List(in *List, out *api.List, s conversion.Scope) error { - return autoconvert_v1_List_To_api_List(in, out, s) -} - -func autoconvert_v1_ListOptions_To_api_ListOptions(in *ListOptions, out *api.ListOptions, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*ListOptions))(in) - } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.LabelSelector, &out.LabelSelector, 0); err != nil { - return err - } - if err := s.Convert(&in.FieldSelector, &out.FieldSelector, 0); err != nil { - return err - } - out.Watch = in.Watch - out.ResourceVersion = in.ResourceVersion - return nil -} - -func convert_v1_ListOptions_To_api_ListOptions(in *ListOptions, out *api.ListOptions, s conversion.Scope) error { - return autoconvert_v1_ListOptions_To_api_ListOptions(in, out, s) -} - -func autoconvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *LoadBalancerIngress, out *api.LoadBalancerIngress, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*LoadBalancerIngress))(in) - } - out.IP = in.IP - out.Hostname = in.Hostname - return nil -} - -func convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *LoadBalancerIngress, out *api.LoadBalancerIngress, s conversion.Scope) error { - return autoconvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in, out, s) -} - -func autoconvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *LoadBalancerStatus, out *api.LoadBalancerStatus, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*LoadBalancerStatus))(in) - } - if in.Ingress != nil { - out.Ingress = make([]api.LoadBalancerIngress, len(in.Ingress)) - for i := range in.Ingress { - if err := convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { - return err - } - } - } else { - out.Ingress = nil - } - return nil -} - -func convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *LoadBalancerStatus, out *api.LoadBalancerStatus, s conversion.Scope) error { - return autoconvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in, out, s) -} - -func autoconvert_v1_LocalObjectReference_To_api_LocalObjectReference(in *LocalObjectReference, out *api.LocalObjectReference, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*LocalObjectReference))(in) - } - out.Name = in.Name - return nil -} - -func convert_v1_LocalObjectReference_To_api_LocalObjectReference(in *LocalObjectReference, out *api.LocalObjectReference, s conversion.Scope) error { - return autoconvert_v1_LocalObjectReference_To_api_LocalObjectReference(in, out, s) -} - -func autoconvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*NFSVolumeSource))(in) - } - out.Server = in.Server - out.Path = in.Path - out.ReadOnly = in.ReadOnly - return nil -} - -func convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error { - return autoconvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in, out, s) -} - -func autoconvert_v1_Namespace_To_api_Namespace(in *Namespace, out *api.Namespace, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*Namespace))(in) - } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_v1_NamespaceSpec_To_api_NamespaceSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_v1_NamespaceStatus_To_api_NamespaceStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -func convert_v1_Namespace_To_api_Namespace(in *Namespace, out *api.Namespace, s conversion.Scope) error { - return autoconvert_v1_Namespace_To_api_Namespace(in, out, s) -} - -func autoconvert_v1_NamespaceList_To_api_NamespaceList(in *NamespaceList, out *api.NamespaceList, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*NamespaceList))(in) - } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { - out.Items = make([]api.Namespace, len(in.Items)) + out.Items = make([]runtime.Object, len(in.Items)) for i := range in.Items { - if err := convert_v1_Namespace_To_api_Namespace(&in.Items[i], &out.Items[i], s); err != nil { + if err := s.Convert(&in.Items[i], &out.Items[i], 0); err != nil { return err } } @@ -4259,11 +4548,140 @@ func autoconvert_v1_NamespaceList_To_api_NamespaceList(in *NamespaceList, out *a return nil } -func convert_v1_NamespaceList_To_api_NamespaceList(in *NamespaceList, out *api.NamespaceList, s conversion.Scope) error { - return autoconvert_v1_NamespaceList_To_api_NamespaceList(in, out, s) +func Convert_v1_List_To_api_List(in *List, out *api.List, s conversion.Scope) error { + return autoConvert_v1_List_To_api_List(in, out, s) } -func autoconvert_v1_NamespaceSpec_To_api_NamespaceSpec(in *NamespaceSpec, out *api.NamespaceSpec, s conversion.Scope) error { +func autoConvert_v1_ListOptions_To_api_ListOptions(in *ListOptions, out *api.ListOptions, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ListOptions))(in) + } + if err := api.Convert_string_To_labels_Selector(&in.LabelSelector, &out.LabelSelector, s); err != nil { + return err + } + if err := api.Convert_string_To_fields_Selector(&in.FieldSelector, &out.FieldSelector, s); err != nil { + return err + } + out.Watch = in.Watch + out.ResourceVersion = in.ResourceVersion + if in.TimeoutSeconds != nil { + out.TimeoutSeconds = new(int64) + *out.TimeoutSeconds = *in.TimeoutSeconds + } else { + out.TimeoutSeconds = nil + } + return nil +} + +func Convert_v1_ListOptions_To_api_ListOptions(in *ListOptions, out *api.ListOptions, s conversion.Scope) error { + return autoConvert_v1_ListOptions_To_api_ListOptions(in, out, s) +} + +func autoConvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *LoadBalancerIngress, out *api.LoadBalancerIngress, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*LoadBalancerIngress))(in) + } + out.IP = in.IP + out.Hostname = in.Hostname + return nil +} + +func Convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *LoadBalancerIngress, out *api.LoadBalancerIngress, s conversion.Scope) error { + return autoConvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in, out, s) +} + +func autoConvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *LoadBalancerStatus, out *api.LoadBalancerStatus, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*LoadBalancerStatus))(in) + } + if in.Ingress != nil { + out.Ingress = make([]api.LoadBalancerIngress, len(in.Ingress)) + for i := range in.Ingress { + if err := Convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { + return err + } + } + } else { + out.Ingress = nil + } + return nil +} + +func Convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *LoadBalancerStatus, out *api.LoadBalancerStatus, s conversion.Scope) error { + return autoConvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in, out, s) +} + +func autoConvert_v1_LocalObjectReference_To_api_LocalObjectReference(in *LocalObjectReference, out *api.LocalObjectReference, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*LocalObjectReference))(in) + } + out.Name = in.Name + return nil +} + +func Convert_v1_LocalObjectReference_To_api_LocalObjectReference(in *LocalObjectReference, out *api.LocalObjectReference, s conversion.Scope) error { + return autoConvert_v1_LocalObjectReference_To_api_LocalObjectReference(in, out, s) +} + +func autoConvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*NFSVolumeSource))(in) + } + out.Server = in.Server + out.Path = in.Path + out.ReadOnly = in.ReadOnly + return nil +} + +func Convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error { + return autoConvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in, out, s) +} + +func autoConvert_v1_Namespace_To_api_Namespace(in *Namespace, out *api.Namespace, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*Namespace))(in) + } + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_v1_NamespaceSpec_To_api_NamespaceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1_NamespaceStatus_To_api_NamespaceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func Convert_v1_Namespace_To_api_Namespace(in *Namespace, out *api.Namespace, s conversion.Scope) error { + return autoConvert_v1_Namespace_To_api_Namespace(in, out, s) +} + +func autoConvert_v1_NamespaceList_To_api_NamespaceList(in *NamespaceList, out *api.NamespaceList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*NamespaceList))(in) + } + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]api.Namespace, len(in.Items)) + for i := range in.Items { + if err := Convert_v1_Namespace_To_api_Namespace(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_v1_NamespaceList_To_api_NamespaceList(in *NamespaceList, out *api.NamespaceList, s conversion.Scope) error { + return autoConvert_v1_NamespaceList_To_api_NamespaceList(in, out, s) +} + +func autoConvert_v1_NamespaceSpec_To_api_NamespaceSpec(in *NamespaceSpec, out *api.NamespaceSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*NamespaceSpec))(in) } @@ -4278,11 +4696,11 @@ func autoconvert_v1_NamespaceSpec_To_api_NamespaceSpec(in *NamespaceSpec, out *a return nil } -func convert_v1_NamespaceSpec_To_api_NamespaceSpec(in *NamespaceSpec, out *api.NamespaceSpec, s conversion.Scope) error { - return autoconvert_v1_NamespaceSpec_To_api_NamespaceSpec(in, out, s) +func Convert_v1_NamespaceSpec_To_api_NamespaceSpec(in *NamespaceSpec, out *api.NamespaceSpec, s conversion.Scope) error { + return autoConvert_v1_NamespaceSpec_To_api_NamespaceSpec(in, out, s) } -func autoconvert_v1_NamespaceStatus_To_api_NamespaceStatus(in *NamespaceStatus, out *api.NamespaceStatus, s conversion.Scope) error { +func autoConvert_v1_NamespaceStatus_To_api_NamespaceStatus(in *NamespaceStatus, out *api.NamespaceStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*NamespaceStatus))(in) } @@ -4290,34 +4708,31 @@ func autoconvert_v1_NamespaceStatus_To_api_NamespaceStatus(in *NamespaceStatus, return nil } -func convert_v1_NamespaceStatus_To_api_NamespaceStatus(in *NamespaceStatus, out *api.NamespaceStatus, s conversion.Scope) error { - return autoconvert_v1_NamespaceStatus_To_api_NamespaceStatus(in, out, s) +func Convert_v1_NamespaceStatus_To_api_NamespaceStatus(in *NamespaceStatus, out *api.NamespaceStatus, s conversion.Scope) error { + return autoConvert_v1_NamespaceStatus_To_api_NamespaceStatus(in, out, s) } -func autoconvert_v1_Node_To_api_Node(in *Node, out *api.Node, s conversion.Scope) error { +func autoConvert_v1_Node_To_api_Node(in *Node, out *api.Node, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Node))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_NodeSpec_To_api_NodeSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1_NodeSpec_To_api_NodeSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_v1_NodeStatus_To_api_NodeStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1_NodeStatus_To_api_NodeStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1_Node_To_api_Node(in *Node, out *api.Node, s conversion.Scope) error { - return autoconvert_v1_Node_To_api_Node(in, out, s) +func Convert_v1_Node_To_api_Node(in *Node, out *api.Node, s conversion.Scope) error { + return autoConvert_v1_Node_To_api_Node(in, out, s) } -func autoconvert_v1_NodeAddress_To_api_NodeAddress(in *NodeAddress, out *api.NodeAddress, s conversion.Scope) error { +func autoConvert_v1_NodeAddress_To_api_NodeAddress(in *NodeAddress, out *api.NodeAddress, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*NodeAddress))(in) } @@ -4326,20 +4741,20 @@ func autoconvert_v1_NodeAddress_To_api_NodeAddress(in *NodeAddress, out *api.Nod return nil } -func convert_v1_NodeAddress_To_api_NodeAddress(in *NodeAddress, out *api.NodeAddress, s conversion.Scope) error { - return autoconvert_v1_NodeAddress_To_api_NodeAddress(in, out, s) +func Convert_v1_NodeAddress_To_api_NodeAddress(in *NodeAddress, out *api.NodeAddress, s conversion.Scope) error { + return autoConvert_v1_NodeAddress_To_api_NodeAddress(in, out, s) } -func autoconvert_v1_NodeCondition_To_api_NodeCondition(in *NodeCondition, out *api.NodeCondition, s conversion.Scope) error { +func autoConvert_v1_NodeCondition_To_api_NodeCondition(in *NodeCondition, out *api.NodeCondition, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*NodeCondition))(in) } out.Type = api.NodeConditionType(in.Type) out.Status = api.ConditionStatus(in.Status) - if err := s.Convert(&in.LastHeartbeatTime, &out.LastHeartbeatTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastHeartbeatTime, &out.LastHeartbeatTime, s); err != nil { return err } - if err := s.Convert(&in.LastTransitionTime, &out.LastTransitionTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastTransitionTime, &out.LastTransitionTime, s); err != nil { return err } out.Reason = in.Reason @@ -4347,38 +4762,35 @@ func autoconvert_v1_NodeCondition_To_api_NodeCondition(in *NodeCondition, out *a return nil } -func convert_v1_NodeCondition_To_api_NodeCondition(in *NodeCondition, out *api.NodeCondition, s conversion.Scope) error { - return autoconvert_v1_NodeCondition_To_api_NodeCondition(in, out, s) +func Convert_v1_NodeCondition_To_api_NodeCondition(in *NodeCondition, out *api.NodeCondition, s conversion.Scope) error { + return autoConvert_v1_NodeCondition_To_api_NodeCondition(in, out, s) } -func autoconvert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints(in *NodeDaemonEndpoints, out *api.NodeDaemonEndpoints, s conversion.Scope) error { +func autoConvert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints(in *NodeDaemonEndpoints, out *api.NodeDaemonEndpoints, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*NodeDaemonEndpoints))(in) } - if err := convert_v1_DaemonEndpoint_To_api_DaemonEndpoint(&in.KubeletEndpoint, &out.KubeletEndpoint, s); err != nil { + if err := Convert_v1_DaemonEndpoint_To_api_DaemonEndpoint(&in.KubeletEndpoint, &out.KubeletEndpoint, s); err != nil { return err } return nil } -func convert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints(in *NodeDaemonEndpoints, out *api.NodeDaemonEndpoints, s conversion.Scope) error { - return autoconvert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints(in, out, s) +func Convert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints(in *NodeDaemonEndpoints, out *api.NodeDaemonEndpoints, s conversion.Scope) error { + return autoConvert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints(in, out, s) } -func autoconvert_v1_NodeList_To_api_NodeList(in *NodeList, out *api.NodeList, s conversion.Scope) error { +func autoConvert_v1_NodeList_To_api_NodeList(in *NodeList, out *api.NodeList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*NodeList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.Node, len(in.Items)) for i := range in.Items { - if err := convert_v1_Node_To_api_Node(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_Node_To_api_Node(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -4388,11 +4800,11 @@ func autoconvert_v1_NodeList_To_api_NodeList(in *NodeList, out *api.NodeList, s return nil } -func convert_v1_NodeList_To_api_NodeList(in *NodeList, out *api.NodeList, s conversion.Scope) error { - return autoconvert_v1_NodeList_To_api_NodeList(in, out, s) +func Convert_v1_NodeList_To_api_NodeList(in *NodeList, out *api.NodeList, s conversion.Scope) error { + return autoConvert_v1_NodeList_To_api_NodeList(in, out, s) } -func autoconvert_v1_NodeSpec_To_api_NodeSpec(in *NodeSpec, out *api.NodeSpec, s conversion.Scope) error { +func autoConvert_v1_NodeSpec_To_api_NodeSpec(in *NodeSpec, out *api.NodeSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*NodeSpec))(in) } @@ -4403,31 +4815,25 @@ func autoconvert_v1_NodeSpec_To_api_NodeSpec(in *NodeSpec, out *api.NodeSpec, s return nil } -func convert_v1_NodeSpec_To_api_NodeSpec(in *NodeSpec, out *api.NodeSpec, s conversion.Scope) error { - return autoconvert_v1_NodeSpec_To_api_NodeSpec(in, out, s) +func Convert_v1_NodeSpec_To_api_NodeSpec(in *NodeSpec, out *api.NodeSpec, s conversion.Scope) error { + return autoConvert_v1_NodeSpec_To_api_NodeSpec(in, out, s) } -func autoconvert_v1_NodeStatus_To_api_NodeStatus(in *NodeStatus, out *api.NodeStatus, s conversion.Scope) error { +func autoConvert_v1_NodeStatus_To_api_NodeStatus(in *NodeStatus, out *api.NodeStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*NodeStatus))(in) } - if in.Capacity != nil { - out.Capacity = make(api.ResourceList) - for key, val := range in.Capacity { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Capacity[api.ResourceName(key)] = newVal - } - } else { - out.Capacity = nil + if err := s.Convert(&in.Capacity, &out.Capacity, 0); err != nil { + return err + } + if err := s.Convert(&in.Allocatable, &out.Allocatable, 0); err != nil { + return err } out.Phase = api.NodePhase(in.Phase) if in.Conditions != nil { out.Conditions = make([]api.NodeCondition, len(in.Conditions)) for i := range in.Conditions { - if err := convert_v1_NodeCondition_To_api_NodeCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { + if err := Convert_v1_NodeCondition_To_api_NodeCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { return err } } @@ -4437,27 +4843,37 @@ func autoconvert_v1_NodeStatus_To_api_NodeStatus(in *NodeStatus, out *api.NodeSt if in.Addresses != nil { out.Addresses = make([]api.NodeAddress, len(in.Addresses)) for i := range in.Addresses { - if err := convert_v1_NodeAddress_To_api_NodeAddress(&in.Addresses[i], &out.Addresses[i], s); err != nil { + if err := Convert_v1_NodeAddress_To_api_NodeAddress(&in.Addresses[i], &out.Addresses[i], s); err != nil { return err } } } else { out.Addresses = nil } - if err := convert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints(&in.DaemonEndpoints, &out.DaemonEndpoints, s); err != nil { + if err := Convert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints(&in.DaemonEndpoints, &out.DaemonEndpoints, s); err != nil { return err } - if err := convert_v1_NodeSystemInfo_To_api_NodeSystemInfo(&in.NodeInfo, &out.NodeInfo, s); err != nil { + if err := Convert_v1_NodeSystemInfo_To_api_NodeSystemInfo(&in.NodeInfo, &out.NodeInfo, s); err != nil { return err } + if in.Images != nil { + out.Images = make([]api.ContainerImage, len(in.Images)) + for i := range in.Images { + if err := Convert_v1_ContainerImage_To_api_ContainerImage(&in.Images[i], &out.Images[i], s); err != nil { + return err + } + } + } else { + out.Images = nil + } return nil } -func convert_v1_NodeStatus_To_api_NodeStatus(in *NodeStatus, out *api.NodeStatus, s conversion.Scope) error { - return autoconvert_v1_NodeStatus_To_api_NodeStatus(in, out, s) +func Convert_v1_NodeStatus_To_api_NodeStatus(in *NodeStatus, out *api.NodeStatus, s conversion.Scope) error { + return autoConvert_v1_NodeStatus_To_api_NodeStatus(in, out, s) } -func autoconvert_v1_NodeSystemInfo_To_api_NodeSystemInfo(in *NodeSystemInfo, out *api.NodeSystemInfo, s conversion.Scope) error { +func autoConvert_v1_NodeSystemInfo_To_api_NodeSystemInfo(in *NodeSystemInfo, out *api.NodeSystemInfo, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*NodeSystemInfo))(in) } @@ -4465,18 +4881,18 @@ func autoconvert_v1_NodeSystemInfo_To_api_NodeSystemInfo(in *NodeSystemInfo, out out.SystemUUID = in.SystemUUID out.BootID = in.BootID out.KernelVersion = in.KernelVersion - out.OsImage = in.OsImage + out.OSImage = in.OSImage out.ContainerRuntimeVersion = in.ContainerRuntimeVersion out.KubeletVersion = in.KubeletVersion out.KubeProxyVersion = in.KubeProxyVersion return nil } -func convert_v1_NodeSystemInfo_To_api_NodeSystemInfo(in *NodeSystemInfo, out *api.NodeSystemInfo, s conversion.Scope) error { - return autoconvert_v1_NodeSystemInfo_To_api_NodeSystemInfo(in, out, s) +func Convert_v1_NodeSystemInfo_To_api_NodeSystemInfo(in *NodeSystemInfo, out *api.NodeSystemInfo, s conversion.Scope) error { + return autoConvert_v1_NodeSystemInfo_To_api_NodeSystemInfo(in, out, s) } -func autoconvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *ObjectFieldSelector, out *api.ObjectFieldSelector, s conversion.Scope) error { +func autoConvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *ObjectFieldSelector, out *api.ObjectFieldSelector, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ObjectFieldSelector))(in) } @@ -4485,11 +4901,11 @@ func autoconvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *ObjectFie return nil } -func convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *ObjectFieldSelector, out *api.ObjectFieldSelector, s conversion.Scope) error { - return autoconvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in, out, s) +func Convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *ObjectFieldSelector, out *api.ObjectFieldSelector, s conversion.Scope) error { + return autoConvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in, out, s) } -func autoconvert_v1_ObjectMeta_To_api_ObjectMeta(in *ObjectMeta, out *api.ObjectMeta, s conversion.Scope) error { +func autoConvert_v1_ObjectMeta_To_api_ObjectMeta(in *ObjectMeta, out *api.ObjectMeta, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ObjectMeta))(in) } @@ -4500,11 +4916,13 @@ func autoconvert_v1_ObjectMeta_To_api_ObjectMeta(in *ObjectMeta, out *api.Object out.UID = in.UID out.ResourceVersion = in.ResourceVersion out.Generation = in.Generation - if err := s.Convert(&in.CreationTimestamp, &out.CreationTimestamp, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.CreationTimestamp, &out.CreationTimestamp, s); err != nil { return err } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.DeletionTimestamp != nil { - if err := s.Convert(&in.DeletionTimestamp, &out.DeletionTimestamp, 0); err != nil { + out.DeletionTimestamp = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.DeletionTimestamp, out.DeletionTimestamp, s); err != nil { return err } } else { @@ -4535,11 +4953,11 @@ func autoconvert_v1_ObjectMeta_To_api_ObjectMeta(in *ObjectMeta, out *api.Object return nil } -func convert_v1_ObjectMeta_To_api_ObjectMeta(in *ObjectMeta, out *api.ObjectMeta, s conversion.Scope) error { - return autoconvert_v1_ObjectMeta_To_api_ObjectMeta(in, out, s) +func Convert_v1_ObjectMeta_To_api_ObjectMeta(in *ObjectMeta, out *api.ObjectMeta, s conversion.Scope) error { + return autoConvert_v1_ObjectMeta_To_api_ObjectMeta(in, out, s) } -func autoconvert_v1_ObjectReference_To_api_ObjectReference(in *ObjectReference, out *api.ObjectReference, s conversion.Scope) error { +func autoConvert_v1_ObjectReference_To_api_ObjectReference(in *ObjectReference, out *api.ObjectReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ObjectReference))(in) } @@ -4553,70 +4971,61 @@ func autoconvert_v1_ObjectReference_To_api_ObjectReference(in *ObjectReference, return nil } -func convert_v1_ObjectReference_To_api_ObjectReference(in *ObjectReference, out *api.ObjectReference, s conversion.Scope) error { - return autoconvert_v1_ObjectReference_To_api_ObjectReference(in, out, s) +func Convert_v1_ObjectReference_To_api_ObjectReference(in *ObjectReference, out *api.ObjectReference, s conversion.Scope) error { + return autoConvert_v1_ObjectReference_To_api_ObjectReference(in, out, s) } -func autoconvert_v1_PersistentVolume_To_api_PersistentVolume(in *PersistentVolume, out *api.PersistentVolume, s conversion.Scope) error { +func autoConvert_v1_PersistentVolume_To_api_PersistentVolume(in *PersistentVolume, out *api.PersistentVolume, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolume))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1_PersistentVolume_To_api_PersistentVolume(in *PersistentVolume, out *api.PersistentVolume, s conversion.Scope) error { - return autoconvert_v1_PersistentVolume_To_api_PersistentVolume(in, out, s) +func Convert_v1_PersistentVolume_To_api_PersistentVolume(in *PersistentVolume, out *api.PersistentVolume, s conversion.Scope) error { + return autoConvert_v1_PersistentVolume_To_api_PersistentVolume(in, out, s) } -func autoconvert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim(in *PersistentVolumeClaim, out *api.PersistentVolumeClaim, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim(in *PersistentVolumeClaim, out *api.PersistentVolumeClaim, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolumeClaim))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim(in *PersistentVolumeClaim, out *api.PersistentVolumeClaim, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim(in, out, s) +func Convert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim(in *PersistentVolumeClaim, out *api.PersistentVolumeClaim, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim(in, out, s) } -func autoconvert_v1_PersistentVolumeClaimList_To_api_PersistentVolumeClaimList(in *PersistentVolumeClaimList, out *api.PersistentVolumeClaimList, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeClaimList_To_api_PersistentVolumeClaimList(in *PersistentVolumeClaimList, out *api.PersistentVolumeClaimList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolumeClaimList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.PersistentVolumeClaim, len(in.Items)) for i := range in.Items { - if err := convert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -4626,11 +5035,11 @@ func autoconvert_v1_PersistentVolumeClaimList_To_api_PersistentVolumeClaimList(i return nil } -func convert_v1_PersistentVolumeClaimList_To_api_PersistentVolumeClaimList(in *PersistentVolumeClaimList, out *api.PersistentVolumeClaimList, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeClaimList_To_api_PersistentVolumeClaimList(in, out, s) +func Convert_v1_PersistentVolumeClaimList_To_api_PersistentVolumeClaimList(in *PersistentVolumeClaimList, out *api.PersistentVolumeClaimList, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeClaimList_To_api_PersistentVolumeClaimList(in, out, s) } -func autoconvert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(in *PersistentVolumeClaimSpec, out *api.PersistentVolumeClaimSpec, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(in *PersistentVolumeClaimSpec, out *api.PersistentVolumeClaimSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolumeClaimSpec))(in) } @@ -4642,18 +5051,18 @@ func autoconvert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(i } else { out.AccessModes = nil } - if err := convert_v1_ResourceRequirements_To_api_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { + if err := Convert_v1_ResourceRequirements_To_api_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { return err } out.VolumeName = in.VolumeName return nil } -func convert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(in *PersistentVolumeClaimSpec, out *api.PersistentVolumeClaimSpec, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(in, out, s) +func Convert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(in *PersistentVolumeClaimSpec, out *api.PersistentVolumeClaimSpec, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(in, out, s) } -func autoconvert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(in *PersistentVolumeClaimStatus, out *api.PersistentVolumeClaimStatus, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(in *PersistentVolumeClaimStatus, out *api.PersistentVolumeClaimStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolumeClaimStatus))(in) } @@ -4666,26 +5075,17 @@ func autoconvert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStat } else { out.AccessModes = nil } - if in.Capacity != nil { - out.Capacity = make(api.ResourceList) - for key, val := range in.Capacity { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Capacity[api.ResourceName(key)] = newVal - } - } else { - out.Capacity = nil + if err := s.Convert(&in.Capacity, &out.Capacity, 0); err != nil { + return err } return nil } -func convert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(in *PersistentVolumeClaimStatus, out *api.PersistentVolumeClaimStatus, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(in, out, s) +func Convert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(in *PersistentVolumeClaimStatus, out *api.PersistentVolumeClaimStatus, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(in, out, s) } -func autoconvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in *PersistentVolumeClaimVolumeSource, out *api.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in *PersistentVolumeClaimVolumeSource, out *api.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolumeClaimVolumeSource))(in) } @@ -4694,24 +5094,21 @@ func autoconvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeCla return nil } -func convert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in *PersistentVolumeClaimVolumeSource, out *api.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in, out, s) +func Convert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in *PersistentVolumeClaimVolumeSource, out *api.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in, out, s) } -func autoconvert_v1_PersistentVolumeList_To_api_PersistentVolumeList(in *PersistentVolumeList, out *api.PersistentVolumeList, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeList_To_api_PersistentVolumeList(in *PersistentVolumeList, out *api.PersistentVolumeList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolumeList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.PersistentVolume, len(in.Items)) for i := range in.Items { - if err := convert_v1_PersistentVolume_To_api_PersistentVolume(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_PersistentVolume_To_api_PersistentVolume(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -4721,126 +5118,146 @@ func autoconvert_v1_PersistentVolumeList_To_api_PersistentVolumeList(in *Persist return nil } -func convert_v1_PersistentVolumeList_To_api_PersistentVolumeList(in *PersistentVolumeList, out *api.PersistentVolumeList, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeList_To_api_PersistentVolumeList(in, out, s) +func Convert_v1_PersistentVolumeList_To_api_PersistentVolumeList(in *PersistentVolumeList, out *api.PersistentVolumeList, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeList_To_api_PersistentVolumeList(in, out, s) } -func autoconvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in *PersistentVolumeSource, out *api.PersistentVolumeSource, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in *PersistentVolumeSource, out *api.PersistentVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolumeSource))(in) } + // unable to generate simple pointer conversion for v1.GCEPersistentDiskVolumeSource -> api.GCEPersistentDiskVolumeSource if in.GCEPersistentDisk != nil { out.GCEPersistentDisk = new(api.GCEPersistentDiskVolumeSource) - if err := convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { + if err := Convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { return err } } else { out.GCEPersistentDisk = nil } + // unable to generate simple pointer conversion for v1.AWSElasticBlockStoreVolumeSource -> api.AWSElasticBlockStoreVolumeSource if in.AWSElasticBlockStore != nil { out.AWSElasticBlockStore = new(api.AWSElasticBlockStoreVolumeSource) - if err := convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { + if err := Convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { return err } } else { out.AWSElasticBlockStore = nil } + // unable to generate simple pointer conversion for v1.HostPathVolumeSource -> api.HostPathVolumeSource if in.HostPath != nil { out.HostPath = new(api.HostPathVolumeSource) - if err := convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { + if err := Convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { return err } } else { out.HostPath = nil } + // unable to generate simple pointer conversion for v1.GlusterfsVolumeSource -> api.GlusterfsVolumeSource if in.Glusterfs != nil { out.Glusterfs = new(api.GlusterfsVolumeSource) - if err := convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { + if err := Convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { return err } } else { out.Glusterfs = nil } + // unable to generate simple pointer conversion for v1.NFSVolumeSource -> api.NFSVolumeSource if in.NFS != nil { out.NFS = new(api.NFSVolumeSource) - if err := convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { + if err := Convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { return err } } else { out.NFS = nil } + // unable to generate simple pointer conversion for v1.RBDVolumeSource -> api.RBDVolumeSource if in.RBD != nil { out.RBD = new(api.RBDVolumeSource) - if err := convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { + if err := Convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { return err } } else { out.RBD = nil } + // unable to generate simple pointer conversion for v1.ISCSIVolumeSource -> api.ISCSIVolumeSource if in.ISCSI != nil { out.ISCSI = new(api.ISCSIVolumeSource) - if err := convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { + if err := Convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { return err } } else { out.ISCSI = nil } + // unable to generate simple pointer conversion for v1.CinderVolumeSource -> api.CinderVolumeSource if in.Cinder != nil { out.Cinder = new(api.CinderVolumeSource) - if err := convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { + if err := Convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { return err } } else { out.Cinder = nil } + // unable to generate simple pointer conversion for v1.CephFSVolumeSource -> api.CephFSVolumeSource if in.CephFS != nil { out.CephFS = new(api.CephFSVolumeSource) - if err := convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { + if err := Convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { return err } } else { out.CephFS = nil } + // unable to generate simple pointer conversion for v1.FCVolumeSource -> api.FCVolumeSource if in.FC != nil { out.FC = new(api.FCVolumeSource) - if err := convert_v1_FCVolumeSource_To_api_FCVolumeSource(in.FC, out.FC, s); err != nil { + if err := Convert_v1_FCVolumeSource_To_api_FCVolumeSource(in.FC, out.FC, s); err != nil { return err } } else { out.FC = nil } + // unable to generate simple pointer conversion for v1.FlockerVolumeSource -> api.FlockerVolumeSource if in.Flocker != nil { out.Flocker = new(api.FlockerVolumeSource) - if err := convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { + if err := Convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { return err } } else { out.Flocker = nil } + // unable to generate simple pointer conversion for v1.FlexVolumeSource -> api.FlexVolumeSource + if in.FlexVolume != nil { + out.FlexVolume = new(api.FlexVolumeSource) + if err := Convert_v1_FlexVolumeSource_To_api_FlexVolumeSource(in.FlexVolume, out.FlexVolume, s); err != nil { + return err + } + } else { + out.FlexVolume = nil + } + // unable to generate simple pointer conversion for v1.AzureFileVolumeSource -> api.AzureFileVolumeSource + if in.AzureFile != nil { + out.AzureFile = new(api.AzureFileVolumeSource) + if err := Convert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource(in.AzureFile, out.AzureFile, s); err != nil { + return err + } + } else { + out.AzureFile = nil + } return nil } -func convert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in *PersistentVolumeSource, out *api.PersistentVolumeSource, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in, out, s) +func Convert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in *PersistentVolumeSource, out *api.PersistentVolumeSource, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in, out, s) } -func autoconvert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *PersistentVolumeSpec, out *api.PersistentVolumeSpec, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *PersistentVolumeSpec, out *api.PersistentVolumeSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolumeSpec))(in) } - if in.Capacity != nil { - out.Capacity = make(api.ResourceList) - for key, val := range in.Capacity { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Capacity[api.ResourceName(key)] = newVal - } - } else { - out.Capacity = nil + if err := s.Convert(&in.Capacity, &out.Capacity, 0); err != nil { + return err } - if err := convert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(&in.PersistentVolumeSource, &out.PersistentVolumeSource, s); err != nil { + if err := Convert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(&in.PersistentVolumeSource, &out.PersistentVolumeSource, s); err != nil { return err } if in.AccessModes != nil { @@ -4851,9 +5268,10 @@ func autoconvert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *Persist } else { out.AccessModes = nil } + // unable to generate simple pointer conversion for v1.ObjectReference -> api.ObjectReference if in.ClaimRef != nil { out.ClaimRef = new(api.ObjectReference) - if err := convert_v1_ObjectReference_To_api_ObjectReference(in.ClaimRef, out.ClaimRef, s); err != nil { + if err := Convert_v1_ObjectReference_To_api_ObjectReference(in.ClaimRef, out.ClaimRef, s); err != nil { return err } } else { @@ -4863,11 +5281,11 @@ func autoconvert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *Persist return nil } -func convert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *PersistentVolumeSpec, out *api.PersistentVolumeSpec, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in, out, s) +func Convert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *PersistentVolumeSpec, out *api.PersistentVolumeSpec, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in, out, s) } -func autoconvert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus(in *PersistentVolumeStatus, out *api.PersistentVolumeStatus, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus(in *PersistentVolumeStatus, out *api.PersistentVolumeStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PersistentVolumeStatus))(in) } @@ -4877,40 +5295,30 @@ func autoconvert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus(in *Per return nil } -func convert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus(in *PersistentVolumeStatus, out *api.PersistentVolumeStatus, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus(in, out, s) +func Convert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus(in *PersistentVolumeStatus, out *api.PersistentVolumeStatus, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus(in, out, s) } -func autoconvert_v1_Pod_To_api_Pod(in *Pod, out *api.Pod, s conversion.Scope) error { +func autoConvert_v1_Pod_To_api_Pod(in *Pod, out *api.Pod, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Pod))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_PodSpec_To_api_PodSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1_PodSpec_To_api_PodSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_v1_PodStatus_To_api_PodStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1_PodStatus_To_api_PodStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1_Pod_To_api_Pod(in *Pod, out *api.Pod, s conversion.Scope) error { - return autoconvert_v1_Pod_To_api_Pod(in, out, s) -} - -func autoconvert_v1_PodAttachOptions_To_api_PodAttachOptions(in *PodAttachOptions, out *api.PodAttachOptions, s conversion.Scope) error { +func autoConvert_v1_PodAttachOptions_To_api_PodAttachOptions(in *PodAttachOptions, out *api.PodAttachOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodAttachOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } out.Stdin = in.Stdin out.Stdout = in.Stdout out.Stderr = in.Stderr @@ -4919,20 +5327,20 @@ func autoconvert_v1_PodAttachOptions_To_api_PodAttachOptions(in *PodAttachOption return nil } -func convert_v1_PodAttachOptions_To_api_PodAttachOptions(in *PodAttachOptions, out *api.PodAttachOptions, s conversion.Scope) error { - return autoconvert_v1_PodAttachOptions_To_api_PodAttachOptions(in, out, s) +func Convert_v1_PodAttachOptions_To_api_PodAttachOptions(in *PodAttachOptions, out *api.PodAttachOptions, s conversion.Scope) error { + return autoConvert_v1_PodAttachOptions_To_api_PodAttachOptions(in, out, s) } -func autoconvert_v1_PodCondition_To_api_PodCondition(in *PodCondition, out *api.PodCondition, s conversion.Scope) error { +func autoConvert_v1_PodCondition_To_api_PodCondition(in *PodCondition, out *api.PodCondition, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodCondition))(in) } out.Type = api.PodConditionType(in.Type) out.Status = api.ConditionStatus(in.Status) - if err := s.Convert(&in.LastProbeTime, &out.LastProbeTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastProbeTime, &out.LastProbeTime, s); err != nil { return err } - if err := s.Convert(&in.LastTransitionTime, &out.LastTransitionTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastTransitionTime, &out.LastTransitionTime, s); err != nil { return err } out.Reason = in.Reason @@ -4940,17 +5348,14 @@ func autoconvert_v1_PodCondition_To_api_PodCondition(in *PodCondition, out *api. return nil } -func convert_v1_PodCondition_To_api_PodCondition(in *PodCondition, out *api.PodCondition, s conversion.Scope) error { - return autoconvert_v1_PodCondition_To_api_PodCondition(in, out, s) +func Convert_v1_PodCondition_To_api_PodCondition(in *PodCondition, out *api.PodCondition, s conversion.Scope) error { + return autoConvert_v1_PodCondition_To_api_PodCondition(in, out, s) } -func autoconvert_v1_PodExecOptions_To_api_PodExecOptions(in *PodExecOptions, out *api.PodExecOptions, s conversion.Scope) error { +func autoConvert_v1_PodExecOptions_To_api_PodExecOptions(in *PodExecOptions, out *api.PodExecOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodExecOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } out.Stdin = in.Stdin out.Stdout = in.Stdout out.Stderr = in.Stderr @@ -4967,24 +5372,21 @@ func autoconvert_v1_PodExecOptions_To_api_PodExecOptions(in *PodExecOptions, out return nil } -func convert_v1_PodExecOptions_To_api_PodExecOptions(in *PodExecOptions, out *api.PodExecOptions, s conversion.Scope) error { - return autoconvert_v1_PodExecOptions_To_api_PodExecOptions(in, out, s) +func Convert_v1_PodExecOptions_To_api_PodExecOptions(in *PodExecOptions, out *api.PodExecOptions, s conversion.Scope) error { + return autoConvert_v1_PodExecOptions_To_api_PodExecOptions(in, out, s) } -func autoconvert_v1_PodList_To_api_PodList(in *PodList, out *api.PodList, s conversion.Scope) error { +func autoConvert_v1_PodList_To_api_PodList(in *PodList, out *api.PodList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.Pod, len(in.Items)) for i := range in.Items { - if err := convert_v1_Pod_To_api_Pod(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_Pod_To_api_Pod(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -4994,17 +5396,14 @@ func autoconvert_v1_PodList_To_api_PodList(in *PodList, out *api.PodList, s conv return nil } -func convert_v1_PodList_To_api_PodList(in *PodList, out *api.PodList, s conversion.Scope) error { - return autoconvert_v1_PodList_To_api_PodList(in, out, s) +func Convert_v1_PodList_To_api_PodList(in *PodList, out *api.PodList, s conversion.Scope) error { + return autoConvert_v1_PodList_To_api_PodList(in, out, s) } -func autoconvert_v1_PodLogOptions_To_api_PodLogOptions(in *PodLogOptions, out *api.PodLogOptions, s conversion.Scope) error { +func autoConvert_v1_PodLogOptions_To_api_PodLogOptions(in *PodLogOptions, out *api.PodLogOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodLogOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } out.Container = in.Container out.Follow = in.Follow out.Previous = in.Previous @@ -5014,8 +5413,10 @@ func autoconvert_v1_PodLogOptions_To_api_PodLogOptions(in *PodLogOptions, out *a } else { out.SinceSeconds = nil } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.SinceTime != nil { - if err := s.Convert(&in.SinceTime, &out.SinceTime, 0); err != nil { + out.SinceTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.SinceTime, out.SinceTime, s); err != nil { return err } } else { @@ -5037,33 +5438,30 @@ func autoconvert_v1_PodLogOptions_To_api_PodLogOptions(in *PodLogOptions, out *a return nil } -func convert_v1_PodLogOptions_To_api_PodLogOptions(in *PodLogOptions, out *api.PodLogOptions, s conversion.Scope) error { - return autoconvert_v1_PodLogOptions_To_api_PodLogOptions(in, out, s) +func Convert_v1_PodLogOptions_To_api_PodLogOptions(in *PodLogOptions, out *api.PodLogOptions, s conversion.Scope) error { + return autoConvert_v1_PodLogOptions_To_api_PodLogOptions(in, out, s) } -func autoconvert_v1_PodProxyOptions_To_api_PodProxyOptions(in *PodProxyOptions, out *api.PodProxyOptions, s conversion.Scope) error { +func autoConvert_v1_PodProxyOptions_To_api_PodProxyOptions(in *PodProxyOptions, out *api.PodProxyOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodProxyOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } out.Path = in.Path return nil } -func convert_v1_PodProxyOptions_To_api_PodProxyOptions(in *PodProxyOptions, out *api.PodProxyOptions, s conversion.Scope) error { - return autoconvert_v1_PodProxyOptions_To_api_PodProxyOptions(in, out, s) +func Convert_v1_PodProxyOptions_To_api_PodProxyOptions(in *PodProxyOptions, out *api.PodProxyOptions, s conversion.Scope) error { + return autoConvert_v1_PodProxyOptions_To_api_PodProxyOptions(in, out, s) } -func autoconvert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conversion.Scope) error { +func autoConvert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodSpec))(in) } if in.Volumes != nil { out.Volumes = make([]api.Volume, len(in.Volumes)) for i := range in.Volumes { - if err := convert_v1_Volume_To_api_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { + if err := Convert_v1_Volume_To_api_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { return err } } @@ -5073,7 +5471,7 @@ func autoconvert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conv if in.Containers != nil { out.Containers = make([]api.Container, len(in.Containers)) for i := range in.Containers { - if err := convert_v1_Container_To_api_Container(&in.Containers[i], &out.Containers[i], s); err != nil { + if err := Convert_v1_Container_To_api_Container(&in.Containers[i], &out.Containers[i], s); err != nil { return err } } @@ -5108,6 +5506,7 @@ func autoconvert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conv // in.HostNetwork has no peer in out // in.HostPID has no peer in out // in.HostIPC has no peer in out + // unable to generate simple pointer conversion for v1.PodSecurityContext -> api.PodSecurityContext if in.SecurityContext != nil { if err := s.Convert(&in.SecurityContext, &out.SecurityContext, 0); err != nil { return err @@ -5118,7 +5517,7 @@ func autoconvert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conv if in.ImagePullSecrets != nil { out.ImagePullSecrets = make([]api.LocalObjectReference, len(in.ImagePullSecrets)) for i := range in.ImagePullSecrets { - if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { return err } } @@ -5128,7 +5527,7 @@ func autoconvert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conv return nil } -func autoconvert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus, s conversion.Scope) error { +func autoConvert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodStatus))(in) } @@ -5136,7 +5535,7 @@ func autoconvert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus if in.Conditions != nil { out.Conditions = make([]api.PodCondition, len(in.Conditions)) for i := range in.Conditions { - if err := convert_v1_PodCondition_To_api_PodCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { + if err := Convert_v1_PodCondition_To_api_PodCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { return err } } @@ -5147,8 +5546,10 @@ func autoconvert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus out.Reason = in.Reason out.HostIP = in.HostIP out.PodIP = in.PodIP + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.StartTime != nil { - if err := s.Convert(&in.StartTime, &out.StartTime, 0); err != nil { + out.StartTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.StartTime, out.StartTime, s); err != nil { return err } } else { @@ -5157,7 +5558,7 @@ func autoconvert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus if in.ContainerStatuses != nil { out.ContainerStatuses = make([]api.ContainerStatus, len(in.ContainerStatuses)) for i := range in.ContainerStatuses { - if err := convert_v1_ContainerStatus_To_api_ContainerStatus(&in.ContainerStatuses[i], &out.ContainerStatuses[i], s); err != nil { + if err := Convert_v1_ContainerStatus_To_api_ContainerStatus(&in.ContainerStatuses[i], &out.ContainerStatuses[i], s); err != nil { return err } } @@ -5167,64 +5568,55 @@ func autoconvert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus return nil } -func convert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus, s conversion.Scope) error { - return autoconvert_v1_PodStatus_To_api_PodStatus(in, out, s) +func Convert_v1_PodStatus_To_api_PodStatus(in *PodStatus, out *api.PodStatus, s conversion.Scope) error { + return autoConvert_v1_PodStatus_To_api_PodStatus(in, out, s) } -func autoconvert_v1_PodStatusResult_To_api_PodStatusResult(in *PodStatusResult, out *api.PodStatusResult, s conversion.Scope) error { +func autoConvert_v1_PodStatusResult_To_api_PodStatusResult(in *PodStatusResult, out *api.PodStatusResult, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodStatusResult))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_v1_PodStatus_To_api_PodStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1_PodStatus_To_api_PodStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1_PodStatusResult_To_api_PodStatusResult(in *PodStatusResult, out *api.PodStatusResult, s conversion.Scope) error { - return autoconvert_v1_PodStatusResult_To_api_PodStatusResult(in, out, s) +func Convert_v1_PodStatusResult_To_api_PodStatusResult(in *PodStatusResult, out *api.PodStatusResult, s conversion.Scope) error { + return autoConvert_v1_PodStatusResult_To_api_PodStatusResult(in, out, s) } -func autoconvert_v1_PodTemplate_To_api_PodTemplate(in *PodTemplate, out *api.PodTemplate, s conversion.Scope) error { +func autoConvert_v1_PodTemplate_To_api_PodTemplate(in *PodTemplate, out *api.PodTemplate, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodTemplate))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { + if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { return err } return nil } -func convert_v1_PodTemplate_To_api_PodTemplate(in *PodTemplate, out *api.PodTemplate, s conversion.Scope) error { - return autoconvert_v1_PodTemplate_To_api_PodTemplate(in, out, s) +func Convert_v1_PodTemplate_To_api_PodTemplate(in *PodTemplate, out *api.PodTemplate, s conversion.Scope) error { + return autoConvert_v1_PodTemplate_To_api_PodTemplate(in, out, s) } -func autoconvert_v1_PodTemplateList_To_api_PodTemplateList(in *PodTemplateList, out *api.PodTemplateList, s conversion.Scope) error { +func autoConvert_v1_PodTemplateList_To_api_PodTemplateList(in *PodTemplateList, out *api.PodTemplateList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodTemplateList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.PodTemplate, len(in.Items)) for i := range in.Items { - if err := convert_v1_PodTemplate_To_api_PodTemplate(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_PodTemplate_To_api_PodTemplate(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -5234,44 +5626,47 @@ func autoconvert_v1_PodTemplateList_To_api_PodTemplateList(in *PodTemplateList, return nil } -func convert_v1_PodTemplateList_To_api_PodTemplateList(in *PodTemplateList, out *api.PodTemplateList, s conversion.Scope) error { - return autoconvert_v1_PodTemplateList_To_api_PodTemplateList(in, out, s) +func Convert_v1_PodTemplateList_To_api_PodTemplateList(in *PodTemplateList, out *api.PodTemplateList, s conversion.Scope) error { + return autoConvert_v1_PodTemplateList_To_api_PodTemplateList(in, out, s) } -func autoconvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *PodTemplateSpec, out *api.PodTemplateSpec, s conversion.Scope) error { +func autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *PodTemplateSpec, out *api.PodTemplateSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*PodTemplateSpec))(in) } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_PodSpec_To_api_PodSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1_PodSpec_To_api_PodSpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *PodTemplateSpec, out *api.PodTemplateSpec, s conversion.Scope) error { - return autoconvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in, out, s) +func Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *PodTemplateSpec, out *api.PodTemplateSpec, s conversion.Scope) error { + return autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in, out, s) } -func autoconvert_v1_Probe_To_api_Probe(in *Probe, out *api.Probe, s conversion.Scope) error { +func autoConvert_v1_Probe_To_api_Probe(in *Probe, out *api.Probe, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Probe))(in) } - if err := convert_v1_Handler_To_api_Handler(&in.Handler, &out.Handler, s); err != nil { + if err := Convert_v1_Handler_To_api_Handler(&in.Handler, &out.Handler, s); err != nil { return err } - out.InitialDelaySeconds = in.InitialDelaySeconds - out.TimeoutSeconds = in.TimeoutSeconds + out.InitialDelaySeconds = int(in.InitialDelaySeconds) + out.TimeoutSeconds = int(in.TimeoutSeconds) + out.PeriodSeconds = int(in.PeriodSeconds) + out.SuccessThreshold = int(in.SuccessThreshold) + out.FailureThreshold = int(in.FailureThreshold) return nil } -func convert_v1_Probe_To_api_Probe(in *Probe, out *api.Probe, s conversion.Scope) error { - return autoconvert_v1_Probe_To_api_Probe(in, out, s) +func Convert_v1_Probe_To_api_Probe(in *Probe, out *api.Probe, s conversion.Scope) error { + return autoConvert_v1_Probe_To_api_Probe(in, out, s) } -func autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error { +func autoConvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*RBDVolumeSource))(in) } @@ -5288,9 +5683,10 @@ func autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *RBDVolumeSource, out.RBDPool = in.RBDPool out.RadosUser = in.RadosUser out.Keyring = in.Keyring + // unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference if in.SecretRef != nil { out.SecretRef = new(api.LocalObjectReference) - if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { return err } } else { @@ -5300,68 +5696,59 @@ func autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *RBDVolumeSource, return nil } -func convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error { - return autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in, out, s) +func Convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error { + return autoConvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in, out, s) } -func autoconvert_v1_RangeAllocation_To_api_RangeAllocation(in *RangeAllocation, out *api.RangeAllocation, s conversion.Scope) error { +func autoConvert_v1_RangeAllocation_To_api_RangeAllocation(in *RangeAllocation, out *api.RangeAllocation, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*RangeAllocation))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } out.Range = in.Range - if err := s.Convert(&in.Data, &out.Data, 0); err != nil { + if err := conversion.ByteSliceCopy(&in.Data, &out.Data, s); err != nil { return err } return nil } -func convert_v1_RangeAllocation_To_api_RangeAllocation(in *RangeAllocation, out *api.RangeAllocation, s conversion.Scope) error { - return autoconvert_v1_RangeAllocation_To_api_RangeAllocation(in, out, s) +func Convert_v1_RangeAllocation_To_api_RangeAllocation(in *RangeAllocation, out *api.RangeAllocation, s conversion.Scope) error { + return autoConvert_v1_RangeAllocation_To_api_RangeAllocation(in, out, s) } -func autoconvert_v1_ReplicationController_To_api_ReplicationController(in *ReplicationController, out *api.ReplicationController, s conversion.Scope) error { +func autoConvert_v1_ReplicationController_To_api_ReplicationController(in *ReplicationController, out *api.ReplicationController, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ReplicationController))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1_ReplicationController_To_api_ReplicationController(in *ReplicationController, out *api.ReplicationController, s conversion.Scope) error { - return autoconvert_v1_ReplicationController_To_api_ReplicationController(in, out, s) +func Convert_v1_ReplicationController_To_api_ReplicationController(in *ReplicationController, out *api.ReplicationController, s conversion.Scope) error { + return autoConvert_v1_ReplicationController_To_api_ReplicationController(in, out, s) } -func autoconvert_v1_ReplicationControllerList_To_api_ReplicationControllerList(in *ReplicationControllerList, out *api.ReplicationControllerList, s conversion.Scope) error { +func autoConvert_v1_ReplicationControllerList_To_api_ReplicationControllerList(in *ReplicationControllerList, out *api.ReplicationControllerList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ReplicationControllerList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.ReplicationController, len(in.Items)) for i := range in.Items { - if err := convert_v1_ReplicationController_To_api_ReplicationController(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_ReplicationController_To_api_ReplicationController(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -5371,11 +5758,11 @@ func autoconvert_v1_ReplicationControllerList_To_api_ReplicationControllerList(i return nil } -func convert_v1_ReplicationControllerList_To_api_ReplicationControllerList(in *ReplicationControllerList, out *api.ReplicationControllerList, s conversion.Scope) error { - return autoconvert_v1_ReplicationControllerList_To_api_ReplicationControllerList(in, out, s) +func Convert_v1_ReplicationControllerList_To_api_ReplicationControllerList(in *ReplicationControllerList, out *api.ReplicationControllerList, s conversion.Scope) error { + return autoConvert_v1_ReplicationControllerList_To_api_ReplicationControllerList(in, out, s) } -func autoconvert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *ReplicationControllerSpec, out *api.ReplicationControllerSpec, s conversion.Scope) error { +func autoConvert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *ReplicationControllerSpec, out *api.ReplicationControllerSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ReplicationControllerSpec))(in) } @@ -5388,9 +5775,10 @@ func autoconvert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(i } else { out.Selector = nil } + // unable to generate simple pointer conversion for v1.PodTemplateSpec -> api.PodTemplateSpec if in.Template != nil { out.Template = new(api.PodTemplateSpec) - if err := convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil { + if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil { return err } } else { @@ -5399,56 +5787,50 @@ func autoconvert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(i return nil } -func autoconvert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus(in *ReplicationControllerStatus, out *api.ReplicationControllerStatus, s conversion.Scope) error { +func autoConvert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus(in *ReplicationControllerStatus, out *api.ReplicationControllerStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ReplicationControllerStatus))(in) } - out.Replicas = in.Replicas + out.Replicas = int(in.Replicas) out.ObservedGeneration = in.ObservedGeneration return nil } -func convert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus(in *ReplicationControllerStatus, out *api.ReplicationControllerStatus, s conversion.Scope) error { - return autoconvert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus(in, out, s) +func Convert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus(in *ReplicationControllerStatus, out *api.ReplicationControllerStatus, s conversion.Scope) error { + return autoConvert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus(in, out, s) } -func autoconvert_v1_ResourceQuota_To_api_ResourceQuota(in *ResourceQuota, out *api.ResourceQuota, s conversion.Scope) error { +func autoConvert_v1_ResourceQuota_To_api_ResourceQuota(in *ResourceQuota, out *api.ResourceQuota, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ResourceQuota))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1_ResourceQuota_To_api_ResourceQuota(in *ResourceQuota, out *api.ResourceQuota, s conversion.Scope) error { - return autoconvert_v1_ResourceQuota_To_api_ResourceQuota(in, out, s) +func Convert_v1_ResourceQuota_To_api_ResourceQuota(in *ResourceQuota, out *api.ResourceQuota, s conversion.Scope) error { + return autoConvert_v1_ResourceQuota_To_api_ResourceQuota(in, out, s) } -func autoconvert_v1_ResourceQuotaList_To_api_ResourceQuotaList(in *ResourceQuotaList, out *api.ResourceQuotaList, s conversion.Scope) error { +func autoConvert_v1_ResourceQuotaList_To_api_ResourceQuotaList(in *ResourceQuotaList, out *api.ResourceQuotaList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ResourceQuotaList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.ResourceQuota, len(in.Items)) for i := range in.Items { - if err := convert_v1_ResourceQuota_To_api_ResourceQuota(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_ResourceQuota_To_api_ResourceQuota(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -5458,104 +5840,59 @@ func autoconvert_v1_ResourceQuotaList_To_api_ResourceQuotaList(in *ResourceQuota return nil } -func convert_v1_ResourceQuotaList_To_api_ResourceQuotaList(in *ResourceQuotaList, out *api.ResourceQuotaList, s conversion.Scope) error { - return autoconvert_v1_ResourceQuotaList_To_api_ResourceQuotaList(in, out, s) +func Convert_v1_ResourceQuotaList_To_api_ResourceQuotaList(in *ResourceQuotaList, out *api.ResourceQuotaList, s conversion.Scope) error { + return autoConvert_v1_ResourceQuotaList_To_api_ResourceQuotaList(in, out, s) } -func autoconvert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec(in *ResourceQuotaSpec, out *api.ResourceQuotaSpec, s conversion.Scope) error { +func autoConvert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec(in *ResourceQuotaSpec, out *api.ResourceQuotaSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ResourceQuotaSpec))(in) } - if in.Hard != nil { - out.Hard = make(api.ResourceList) - for key, val := range in.Hard { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Hard[api.ResourceName(key)] = newVal - } - } else { - out.Hard = nil + if err := s.Convert(&in.Hard, &out.Hard, 0); err != nil { + return err } return nil } -func convert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec(in *ResourceQuotaSpec, out *api.ResourceQuotaSpec, s conversion.Scope) error { - return autoconvert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec(in, out, s) +func Convert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec(in *ResourceQuotaSpec, out *api.ResourceQuotaSpec, s conversion.Scope) error { + return autoConvert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec(in, out, s) } -func autoconvert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus(in *ResourceQuotaStatus, out *api.ResourceQuotaStatus, s conversion.Scope) error { +func autoConvert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus(in *ResourceQuotaStatus, out *api.ResourceQuotaStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ResourceQuotaStatus))(in) } - if in.Hard != nil { - out.Hard = make(api.ResourceList) - for key, val := range in.Hard { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Hard[api.ResourceName(key)] = newVal - } - } else { - out.Hard = nil + if err := s.Convert(&in.Hard, &out.Hard, 0); err != nil { + return err } - if in.Used != nil { - out.Used = make(api.ResourceList) - for key, val := range in.Used { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Used[api.ResourceName(key)] = newVal - } - } else { - out.Used = nil + if err := s.Convert(&in.Used, &out.Used, 0); err != nil { + return err } return nil } -func convert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus(in *ResourceQuotaStatus, out *api.ResourceQuotaStatus, s conversion.Scope) error { - return autoconvert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus(in, out, s) +func Convert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus(in *ResourceQuotaStatus, out *api.ResourceQuotaStatus, s conversion.Scope) error { + return autoConvert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus(in, out, s) } -func autoconvert_v1_ResourceRequirements_To_api_ResourceRequirements(in *ResourceRequirements, out *api.ResourceRequirements, s conversion.Scope) error { +func autoConvert_v1_ResourceRequirements_To_api_ResourceRequirements(in *ResourceRequirements, out *api.ResourceRequirements, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ResourceRequirements))(in) } - if in.Limits != nil { - out.Limits = make(api.ResourceList) - for key, val := range in.Limits { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Limits[api.ResourceName(key)] = newVal - } - } else { - out.Limits = nil + if err := s.Convert(&in.Limits, &out.Limits, 0); err != nil { + return err } - if in.Requests != nil { - out.Requests = make(api.ResourceList) - for key, val := range in.Requests { - newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { - return err - } - out.Requests[api.ResourceName(key)] = newVal - } - } else { - out.Requests = nil + if err := s.Convert(&in.Requests, &out.Requests, 0); err != nil { + return err } return nil } -func convert_v1_ResourceRequirements_To_api_ResourceRequirements(in *ResourceRequirements, out *api.ResourceRequirements, s conversion.Scope) error { - return autoconvert_v1_ResourceRequirements_To_api_ResourceRequirements(in, out, s) +func Convert_v1_ResourceRequirements_To_api_ResourceRequirements(in *ResourceRequirements, out *api.ResourceRequirements, s conversion.Scope) error { + return autoConvert_v1_ResourceRequirements_To_api_ResourceRequirements(in, out, s) } -func autoconvert_v1_SELinuxOptions_To_api_SELinuxOptions(in *SELinuxOptions, out *api.SELinuxOptions, s conversion.Scope) error { +func autoConvert_v1_SELinuxOptions_To_api_SELinuxOptions(in *SELinuxOptions, out *api.SELinuxOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*SELinuxOptions))(in) } @@ -5566,25 +5903,22 @@ func autoconvert_v1_SELinuxOptions_To_api_SELinuxOptions(in *SELinuxOptions, out return nil } -func convert_v1_SELinuxOptions_To_api_SELinuxOptions(in *SELinuxOptions, out *api.SELinuxOptions, s conversion.Scope) error { - return autoconvert_v1_SELinuxOptions_To_api_SELinuxOptions(in, out, s) +func Convert_v1_SELinuxOptions_To_api_SELinuxOptions(in *SELinuxOptions, out *api.SELinuxOptions, s conversion.Scope) error { + return autoConvert_v1_SELinuxOptions_To_api_SELinuxOptions(in, out, s) } -func autoconvert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversion.Scope) error { +func autoConvert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Secret))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } if in.Data != nil { out.Data = make(map[string][]uint8) for key, val := range in.Data { newVal := []uint8{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := conversion.ByteSliceCopy(&val, &newVal, s); err != nil { return err } out.Data[key] = newVal @@ -5596,24 +5930,36 @@ func autoconvert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversi return nil } -func convert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversion.Scope) error { - return autoconvert_v1_Secret_To_api_Secret(in, out, s) +func Convert_v1_Secret_To_api_Secret(in *Secret, out *api.Secret, s conversion.Scope) error { + return autoConvert_v1_Secret_To_api_Secret(in, out, s) } -func autoconvert_v1_SecretList_To_api_SecretList(in *SecretList, out *api.SecretList, s conversion.Scope) error { +func autoConvert_v1_SecretKeySelector_To_api_SecretKeySelector(in *SecretKeySelector, out *api.SecretKeySelector, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*SecretKeySelector))(in) + } + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func Convert_v1_SecretKeySelector_To_api_SecretKeySelector(in *SecretKeySelector, out *api.SecretKeySelector, s conversion.Scope) error { + return autoConvert_v1_SecretKeySelector_To_api_SecretKeySelector(in, out, s) +} + +func autoConvert_v1_SecretList_To_api_SecretList(in *SecretList, out *api.SecretList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*SecretList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.Secret, len(in.Items)) for i := range in.Items { - if err := convert_v1_Secret_To_api_Secret(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_Secret_To_api_Secret(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -5623,11 +5969,11 @@ func autoconvert_v1_SecretList_To_api_SecretList(in *SecretList, out *api.Secret return nil } -func convert_v1_SecretList_To_api_SecretList(in *SecretList, out *api.SecretList, s conversion.Scope) error { - return autoconvert_v1_SecretList_To_api_SecretList(in, out, s) +func Convert_v1_SecretList_To_api_SecretList(in *SecretList, out *api.SecretList, s conversion.Scope) error { + return autoConvert_v1_SecretList_To_api_SecretList(in, out, s) } -func autoconvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *SecretVolumeSource, out *api.SecretVolumeSource, s conversion.Scope) error { +func autoConvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *SecretVolumeSource, out *api.SecretVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*SecretVolumeSource))(in) } @@ -5635,17 +5981,18 @@ func autoconvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *SecretVolum return nil } -func convert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *SecretVolumeSource, out *api.SecretVolumeSource, s conversion.Scope) error { - return autoconvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in, out, s) +func Convert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *SecretVolumeSource, out *api.SecretVolumeSource, s conversion.Scope) error { + return autoConvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in, out, s) } -func autoconvert_v1_SecurityContext_To_api_SecurityContext(in *SecurityContext, out *api.SecurityContext, s conversion.Scope) error { +func autoConvert_v1_SecurityContext_To_api_SecurityContext(in *SecurityContext, out *api.SecurityContext, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*SecurityContext))(in) } + // unable to generate simple pointer conversion for v1.Capabilities -> api.Capabilities if in.Capabilities != nil { out.Capabilities = new(api.Capabilities) - if err := convert_v1_Capabilities_To_api_Capabilities(in.Capabilities, out.Capabilities, s); err != nil { + if err := Convert_v1_Capabilities_To_api_Capabilities(in.Capabilities, out.Capabilities, s); err != nil { return err } } else { @@ -5657,9 +6004,10 @@ func autoconvert_v1_SecurityContext_To_api_SecurityContext(in *SecurityContext, } else { out.Privileged = nil } + // unable to generate simple pointer conversion for v1.SELinuxOptions -> api.SELinuxOptions if in.SELinuxOptions != nil { out.SELinuxOptions = new(api.SELinuxOptions) - if err := convert_v1_SELinuxOptions_To_api_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + if err := Convert_v1_SELinuxOptions_To_api_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { return err } } else { @@ -5677,67 +6025,64 @@ func autoconvert_v1_SecurityContext_To_api_SecurityContext(in *SecurityContext, } else { out.RunAsNonRoot = nil } + if in.ReadOnlyRootFilesystem != nil { + out.ReadOnlyRootFilesystem = new(bool) + *out.ReadOnlyRootFilesystem = *in.ReadOnlyRootFilesystem + } else { + out.ReadOnlyRootFilesystem = nil + } return nil } -func convert_v1_SecurityContext_To_api_SecurityContext(in *SecurityContext, out *api.SecurityContext, s conversion.Scope) error { - return autoconvert_v1_SecurityContext_To_api_SecurityContext(in, out, s) +func Convert_v1_SecurityContext_To_api_SecurityContext(in *SecurityContext, out *api.SecurityContext, s conversion.Scope) error { + return autoConvert_v1_SecurityContext_To_api_SecurityContext(in, out, s) } -func autoconvert_v1_SerializedReference_To_api_SerializedReference(in *SerializedReference, out *api.SerializedReference, s conversion.Scope) error { +func autoConvert_v1_SerializedReference_To_api_SerializedReference(in *SerializedReference, out *api.SerializedReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*SerializedReference))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_v1_ObjectReference_To_api_ObjectReference(&in.Reference, &out.Reference, s); err != nil { + if err := Convert_v1_ObjectReference_To_api_ObjectReference(&in.Reference, &out.Reference, s); err != nil { return err } return nil } -func convert_v1_SerializedReference_To_api_SerializedReference(in *SerializedReference, out *api.SerializedReference, s conversion.Scope) error { - return autoconvert_v1_SerializedReference_To_api_SerializedReference(in, out, s) +func Convert_v1_SerializedReference_To_api_SerializedReference(in *SerializedReference, out *api.SerializedReference, s conversion.Scope) error { + return autoConvert_v1_SerializedReference_To_api_SerializedReference(in, out, s) } -func autoconvert_v1_Service_To_api_Service(in *Service, out *api.Service, s conversion.Scope) error { +func autoConvert_v1_Service_To_api_Service(in *Service, out *api.Service, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Service))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ServiceSpec_To_api_ServiceSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1_ServiceSpec_To_api_ServiceSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := convert_v1_ServiceStatus_To_api_ServiceStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1_ServiceStatus_To_api_ServiceStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1_Service_To_api_Service(in *Service, out *api.Service, s conversion.Scope) error { - return autoconvert_v1_Service_To_api_Service(in, out, s) +func Convert_v1_Service_To_api_Service(in *Service, out *api.Service, s conversion.Scope) error { + return autoConvert_v1_Service_To_api_Service(in, out, s) } -func autoconvert_v1_ServiceAccount_To_api_ServiceAccount(in *ServiceAccount, out *api.ServiceAccount, s conversion.Scope) error { +func autoConvert_v1_ServiceAccount_To_api_ServiceAccount(in *ServiceAccount, out *api.ServiceAccount, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ServiceAccount))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } if in.Secrets != nil { out.Secrets = make([]api.ObjectReference, len(in.Secrets)) for i := range in.Secrets { - if err := convert_v1_ObjectReference_To_api_ObjectReference(&in.Secrets[i], &out.Secrets[i], s); err != nil { + if err := Convert_v1_ObjectReference_To_api_ObjectReference(&in.Secrets[i], &out.Secrets[i], s); err != nil { return err } } @@ -5747,7 +6092,7 @@ func autoconvert_v1_ServiceAccount_To_api_ServiceAccount(in *ServiceAccount, out if in.ImagePullSecrets != nil { out.ImagePullSecrets = make([]api.LocalObjectReference, len(in.ImagePullSecrets)) for i := range in.ImagePullSecrets { - if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { return err } } @@ -5757,24 +6102,21 @@ func autoconvert_v1_ServiceAccount_To_api_ServiceAccount(in *ServiceAccount, out return nil } -func convert_v1_ServiceAccount_To_api_ServiceAccount(in *ServiceAccount, out *api.ServiceAccount, s conversion.Scope) error { - return autoconvert_v1_ServiceAccount_To_api_ServiceAccount(in, out, s) +func Convert_v1_ServiceAccount_To_api_ServiceAccount(in *ServiceAccount, out *api.ServiceAccount, s conversion.Scope) error { + return autoConvert_v1_ServiceAccount_To_api_ServiceAccount(in, out, s) } -func autoconvert_v1_ServiceAccountList_To_api_ServiceAccountList(in *ServiceAccountList, out *api.ServiceAccountList, s conversion.Scope) error { +func autoConvert_v1_ServiceAccountList_To_api_ServiceAccountList(in *ServiceAccountList, out *api.ServiceAccountList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ServiceAccountList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.ServiceAccount, len(in.Items)) for i := range in.Items { - if err := convert_v1_ServiceAccount_To_api_ServiceAccount(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_ServiceAccount_To_api_ServiceAccount(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -5784,24 +6126,21 @@ func autoconvert_v1_ServiceAccountList_To_api_ServiceAccountList(in *ServiceAcco return nil } -func convert_v1_ServiceAccountList_To_api_ServiceAccountList(in *ServiceAccountList, out *api.ServiceAccountList, s conversion.Scope) error { - return autoconvert_v1_ServiceAccountList_To_api_ServiceAccountList(in, out, s) +func Convert_v1_ServiceAccountList_To_api_ServiceAccountList(in *ServiceAccountList, out *api.ServiceAccountList, s conversion.Scope) error { + return autoConvert_v1_ServiceAccountList_To_api_ServiceAccountList(in, out, s) } -func autoconvert_v1_ServiceList_To_api_ServiceList(in *ServiceList, out *api.ServiceList, s conversion.Scope) error { +func autoConvert_v1_ServiceList_To_api_ServiceList(in *ServiceList, out *api.ServiceList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ServiceList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { - return err - } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]api.Service, len(in.Items)) for i := range in.Items { - if err := convert_v1_Service_To_api_Service(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_Service_To_api_Service(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -5811,36 +6150,36 @@ func autoconvert_v1_ServiceList_To_api_ServiceList(in *ServiceList, out *api.Ser return nil } -func convert_v1_ServiceList_To_api_ServiceList(in *ServiceList, out *api.ServiceList, s conversion.Scope) error { - return autoconvert_v1_ServiceList_To_api_ServiceList(in, out, s) +func Convert_v1_ServiceList_To_api_ServiceList(in *ServiceList, out *api.ServiceList, s conversion.Scope) error { + return autoConvert_v1_ServiceList_To_api_ServiceList(in, out, s) } -func autoconvert_v1_ServicePort_To_api_ServicePort(in *ServicePort, out *api.ServicePort, s conversion.Scope) error { +func autoConvert_v1_ServicePort_To_api_ServicePort(in *ServicePort, out *api.ServicePort, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ServicePort))(in) } out.Name = in.Name out.Protocol = api.Protocol(in.Protocol) - out.Port = in.Port - if err := s.Convert(&in.TargetPort, &out.TargetPort, 0); err != nil { + out.Port = int(in.Port) + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.TargetPort, &out.TargetPort, s); err != nil { return err } - out.NodePort = in.NodePort + out.NodePort = int(in.NodePort) return nil } -func convert_v1_ServicePort_To_api_ServicePort(in *ServicePort, out *api.ServicePort, s conversion.Scope) error { - return autoconvert_v1_ServicePort_To_api_ServicePort(in, out, s) +func Convert_v1_ServicePort_To_api_ServicePort(in *ServicePort, out *api.ServicePort, s conversion.Scope) error { + return autoConvert_v1_ServicePort_To_api_ServicePort(in, out, s) } -func autoconvert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.ServiceSpec, s conversion.Scope) error { +func autoConvert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.ServiceSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ServiceSpec))(in) } if in.Ports != nil { out.Ports = make([]api.ServicePort, len(in.Ports)) for i := range in.Ports { - if err := convert_v1_ServicePort_To_api_ServicePort(&in.Ports[i], &out.Ports[i], s); err != nil { + if err := Convert_v1_ServicePort_To_api_ServicePort(&in.Ports[i], &out.Ports[i], s); err != nil { return err } } @@ -5871,50 +6210,50 @@ func autoconvert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.Ser return nil } -func autoconvert_v1_ServiceStatus_To_api_ServiceStatus(in *ServiceStatus, out *api.ServiceStatus, s conversion.Scope) error { +func autoConvert_v1_ServiceStatus_To_api_ServiceStatus(in *ServiceStatus, out *api.ServiceStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ServiceStatus))(in) } - if err := convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { + if err := Convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { return err } return nil } -func convert_v1_ServiceStatus_To_api_ServiceStatus(in *ServiceStatus, out *api.ServiceStatus, s conversion.Scope) error { - return autoconvert_v1_ServiceStatus_To_api_ServiceStatus(in, out, s) +func Convert_v1_ServiceStatus_To_api_ServiceStatus(in *ServiceStatus, out *api.ServiceStatus, s conversion.Scope) error { + return autoConvert_v1_ServiceStatus_To_api_ServiceStatus(in, out, s) } -func autoconvert_v1_TCPSocketAction_To_api_TCPSocketAction(in *TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error { +func autoConvert_v1_TCPSocketAction_To_api_TCPSocketAction(in *TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*TCPSocketAction))(in) } - if err := s.Convert(&in.Port, &out.Port, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.Port, &out.Port, s); err != nil { return err } return nil } -func convert_v1_TCPSocketAction_To_api_TCPSocketAction(in *TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error { - return autoconvert_v1_TCPSocketAction_To_api_TCPSocketAction(in, out, s) +func Convert_v1_TCPSocketAction_To_api_TCPSocketAction(in *TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error { + return autoConvert_v1_TCPSocketAction_To_api_TCPSocketAction(in, out, s) } -func autoconvert_v1_Volume_To_api_Volume(in *Volume, out *api.Volume, s conversion.Scope) error { +func autoConvert_v1_Volume_To_api_Volume(in *Volume, out *api.Volume, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Volume))(in) } out.Name = in.Name - if err := convert_v1_VolumeSource_To_api_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { + if err := Convert_v1_VolumeSource_To_api_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { return err } return nil } -func convert_v1_Volume_To_api_Volume(in *Volume, out *api.Volume, s conversion.Scope) error { - return autoconvert_v1_Volume_To_api_Volume(in, out, s) +func Convert_v1_Volume_To_api_Volume(in *Volume, out *api.Volume, s conversion.Scope) error { + return autoConvert_v1_Volume_To_api_Volume(in, out, s) } -func autoconvert_v1_VolumeMount_To_api_VolumeMount(in *VolumeMount, out *api.VolumeMount, s conversion.Scope) error { +func autoConvert_v1_VolumeMount_To_api_VolumeMount(in *VolumeMount, out *api.VolumeMount, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*VolumeMount))(in) } @@ -5924,387 +6263,452 @@ func autoconvert_v1_VolumeMount_To_api_VolumeMount(in *VolumeMount, out *api.Vol return nil } -func convert_v1_VolumeMount_To_api_VolumeMount(in *VolumeMount, out *api.VolumeMount, s conversion.Scope) error { - return autoconvert_v1_VolumeMount_To_api_VolumeMount(in, out, s) +func Convert_v1_VolumeMount_To_api_VolumeMount(in *VolumeMount, out *api.VolumeMount, s conversion.Scope) error { + return autoConvert_v1_VolumeMount_To_api_VolumeMount(in, out, s) } -func autoconvert_v1_VolumeSource_To_api_VolumeSource(in *VolumeSource, out *api.VolumeSource, s conversion.Scope) error { +func autoConvert_v1_VolumeSource_To_api_VolumeSource(in *VolumeSource, out *api.VolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*VolumeSource))(in) } + // unable to generate simple pointer conversion for v1.HostPathVolumeSource -> api.HostPathVolumeSource if in.HostPath != nil { out.HostPath = new(api.HostPathVolumeSource) - if err := convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { + if err := Convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { return err } } else { out.HostPath = nil } + // unable to generate simple pointer conversion for v1.EmptyDirVolumeSource -> api.EmptyDirVolumeSource if in.EmptyDir != nil { out.EmptyDir = new(api.EmptyDirVolumeSource) - if err := convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in.EmptyDir, out.EmptyDir, s); err != nil { + if err := Convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in.EmptyDir, out.EmptyDir, s); err != nil { return err } } else { out.EmptyDir = nil } + // unable to generate simple pointer conversion for v1.GCEPersistentDiskVolumeSource -> api.GCEPersistentDiskVolumeSource if in.GCEPersistentDisk != nil { out.GCEPersistentDisk = new(api.GCEPersistentDiskVolumeSource) - if err := convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { + if err := Convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { return err } } else { out.GCEPersistentDisk = nil } + // unable to generate simple pointer conversion for v1.AWSElasticBlockStoreVolumeSource -> api.AWSElasticBlockStoreVolumeSource if in.AWSElasticBlockStore != nil { out.AWSElasticBlockStore = new(api.AWSElasticBlockStoreVolumeSource) - if err := convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { + if err := Convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { return err } } else { out.AWSElasticBlockStore = nil } + // unable to generate simple pointer conversion for v1.GitRepoVolumeSource -> api.GitRepoVolumeSource if in.GitRepo != nil { out.GitRepo = new(api.GitRepoVolumeSource) - if err := convert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in.GitRepo, out.GitRepo, s); err != nil { + if err := Convert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in.GitRepo, out.GitRepo, s); err != nil { return err } } else { out.GitRepo = nil } + // unable to generate simple pointer conversion for v1.SecretVolumeSource -> api.SecretVolumeSource if in.Secret != nil { out.Secret = new(api.SecretVolumeSource) - if err := convert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in.Secret, out.Secret, s); err != nil { + if err := Convert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in.Secret, out.Secret, s); err != nil { return err } } else { out.Secret = nil } + // unable to generate simple pointer conversion for v1.NFSVolumeSource -> api.NFSVolumeSource if in.NFS != nil { out.NFS = new(api.NFSVolumeSource) - if err := convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { + if err := Convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { return err } } else { out.NFS = nil } + // unable to generate simple pointer conversion for v1.ISCSIVolumeSource -> api.ISCSIVolumeSource if in.ISCSI != nil { out.ISCSI = new(api.ISCSIVolumeSource) - if err := convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { + if err := Convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { return err } } else { out.ISCSI = nil } + // unable to generate simple pointer conversion for v1.GlusterfsVolumeSource -> api.GlusterfsVolumeSource if in.Glusterfs != nil { out.Glusterfs = new(api.GlusterfsVolumeSource) - if err := convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { + if err := Convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { return err } } else { out.Glusterfs = nil } + // unable to generate simple pointer conversion for v1.PersistentVolumeClaimVolumeSource -> api.PersistentVolumeClaimVolumeSource if in.PersistentVolumeClaim != nil { out.PersistentVolumeClaim = new(api.PersistentVolumeClaimVolumeSource) - if err := convert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in.PersistentVolumeClaim, out.PersistentVolumeClaim, s); err != nil { + if err := Convert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in.PersistentVolumeClaim, out.PersistentVolumeClaim, s); err != nil { return err } } else { out.PersistentVolumeClaim = nil } + // unable to generate simple pointer conversion for v1.RBDVolumeSource -> api.RBDVolumeSource if in.RBD != nil { out.RBD = new(api.RBDVolumeSource) - if err := convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { + if err := Convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { return err } } else { out.RBD = nil } + // unable to generate simple pointer conversion for v1.FlexVolumeSource -> api.FlexVolumeSource + if in.FlexVolume != nil { + out.FlexVolume = new(api.FlexVolumeSource) + if err := Convert_v1_FlexVolumeSource_To_api_FlexVolumeSource(in.FlexVolume, out.FlexVolume, s); err != nil { + return err + } + } else { + out.FlexVolume = nil + } + // unable to generate simple pointer conversion for v1.CinderVolumeSource -> api.CinderVolumeSource if in.Cinder != nil { out.Cinder = new(api.CinderVolumeSource) - if err := convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { + if err := Convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { return err } } else { out.Cinder = nil } + // unable to generate simple pointer conversion for v1.CephFSVolumeSource -> api.CephFSVolumeSource if in.CephFS != nil { out.CephFS = new(api.CephFSVolumeSource) - if err := convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { + if err := Convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { return err } } else { out.CephFS = nil } + // unable to generate simple pointer conversion for v1.FlockerVolumeSource -> api.FlockerVolumeSource if in.Flocker != nil { out.Flocker = new(api.FlockerVolumeSource) - if err := convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { + if err := Convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { return err } } else { out.Flocker = nil } + // unable to generate simple pointer conversion for v1.DownwardAPIVolumeSource -> api.DownwardAPIVolumeSource if in.DownwardAPI != nil { out.DownwardAPI = new(api.DownwardAPIVolumeSource) - if err := convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { + if err := Convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { return err } } else { out.DownwardAPI = nil } + // unable to generate simple pointer conversion for v1.FCVolumeSource -> api.FCVolumeSource if in.FC != nil { out.FC = new(api.FCVolumeSource) - if err := convert_v1_FCVolumeSource_To_api_FCVolumeSource(in.FC, out.FC, s); err != nil { + if err := Convert_v1_FCVolumeSource_To_api_FCVolumeSource(in.FC, out.FC, s); err != nil { return err } } else { out.FC = nil } + // unable to generate simple pointer conversion for v1.AzureFileVolumeSource -> api.AzureFileVolumeSource + if in.AzureFile != nil { + out.AzureFile = new(api.AzureFileVolumeSource) + if err := Convert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource(in.AzureFile, out.AzureFile, s); err != nil { + return err + } + } else { + out.AzureFile = nil + } + // unable to generate simple pointer conversion for v1.ConfigMapVolumeSource -> api.ConfigMapVolumeSource + if in.ConfigMap != nil { + out.ConfigMap = new(api.ConfigMapVolumeSource) + if err := Convert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource(in.ConfigMap, out.ConfigMap, s); err != nil { + return err + } + } else { + out.ConfigMap = nil + } return nil } -func convert_v1_VolumeSource_To_api_VolumeSource(in *VolumeSource, out *api.VolumeSource, s conversion.Scope) error { - return autoconvert_v1_VolumeSource_To_api_VolumeSource(in, out, s) +func Convert_v1_VolumeSource_To_api_VolumeSource(in *VolumeSource, out *api.VolumeSource, s conversion.Scope) error { + return autoConvert_v1_VolumeSource_To_api_VolumeSource(in, out, s) } func init() { err := api.Scheme.AddGeneratedConversionFuncs( - autoconvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource, - autoconvert_api_Binding_To_v1_Binding, - autoconvert_api_Capabilities_To_v1_Capabilities, - autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource, - autoconvert_api_CinderVolumeSource_To_v1_CinderVolumeSource, - autoconvert_api_ComponentCondition_To_v1_ComponentCondition, - autoconvert_api_ComponentStatusList_To_v1_ComponentStatusList, - autoconvert_api_ComponentStatus_To_v1_ComponentStatus, - autoconvert_api_ContainerPort_To_v1_ContainerPort, - autoconvert_api_ContainerStateRunning_To_v1_ContainerStateRunning, - autoconvert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated, - autoconvert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting, - autoconvert_api_ContainerState_To_v1_ContainerState, - autoconvert_api_ContainerStatus_To_v1_ContainerStatus, - autoconvert_api_Container_To_v1_Container, - autoconvert_api_DaemonEndpoint_To_v1_DaemonEndpoint, - autoconvert_api_DeleteOptions_To_v1_DeleteOptions, - autoconvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile, - autoconvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource, - autoconvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource, - autoconvert_api_EndpointAddress_To_v1_EndpointAddress, - autoconvert_api_EndpointPort_To_v1_EndpointPort, - autoconvert_api_EndpointSubset_To_v1_EndpointSubset, - autoconvert_api_EndpointsList_To_v1_EndpointsList, - autoconvert_api_Endpoints_To_v1_Endpoints, - autoconvert_api_EnvVarSource_To_v1_EnvVarSource, - autoconvert_api_EnvVar_To_v1_EnvVar, - autoconvert_api_EventList_To_v1_EventList, - autoconvert_api_EventSource_To_v1_EventSource, - autoconvert_api_Event_To_v1_Event, - autoconvert_api_ExecAction_To_v1_ExecAction, - autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource, - autoconvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource, - autoconvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource, - autoconvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource, - autoconvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource, - autoconvert_api_HTTPGetAction_To_v1_HTTPGetAction, - autoconvert_api_Handler_To_v1_Handler, - autoconvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource, - autoconvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource, - autoconvert_api_Lifecycle_To_v1_Lifecycle, - autoconvert_api_LimitRangeItem_To_v1_LimitRangeItem, - autoconvert_api_LimitRangeList_To_v1_LimitRangeList, - autoconvert_api_LimitRangeSpec_To_v1_LimitRangeSpec, - autoconvert_api_LimitRange_To_v1_LimitRange, - autoconvert_api_ListOptions_To_v1_ListOptions, - autoconvert_api_List_To_v1_List, - autoconvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress, - autoconvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus, - autoconvert_api_LocalObjectReference_To_v1_LocalObjectReference, - autoconvert_api_NFSVolumeSource_To_v1_NFSVolumeSource, - autoconvert_api_NamespaceList_To_v1_NamespaceList, - autoconvert_api_NamespaceSpec_To_v1_NamespaceSpec, - autoconvert_api_NamespaceStatus_To_v1_NamespaceStatus, - autoconvert_api_Namespace_To_v1_Namespace, - autoconvert_api_NodeAddress_To_v1_NodeAddress, - autoconvert_api_NodeCondition_To_v1_NodeCondition, - autoconvert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints, - autoconvert_api_NodeList_To_v1_NodeList, - autoconvert_api_NodeSpec_To_v1_NodeSpec, - autoconvert_api_NodeStatus_To_v1_NodeStatus, - autoconvert_api_NodeSystemInfo_To_v1_NodeSystemInfo, - autoconvert_api_Node_To_v1_Node, - autoconvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector, - autoconvert_api_ObjectMeta_To_v1_ObjectMeta, - autoconvert_api_ObjectReference_To_v1_ObjectReference, - autoconvert_api_PersistentVolumeClaimList_To_v1_PersistentVolumeClaimList, - autoconvert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec, - autoconvert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus, - autoconvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource, - autoconvert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim, - autoconvert_api_PersistentVolumeList_To_v1_PersistentVolumeList, - autoconvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource, - autoconvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec, - autoconvert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus, - autoconvert_api_PersistentVolume_To_v1_PersistentVolume, - autoconvert_api_PodAttachOptions_To_v1_PodAttachOptions, - autoconvert_api_PodCondition_To_v1_PodCondition, - autoconvert_api_PodExecOptions_To_v1_PodExecOptions, - autoconvert_api_PodList_To_v1_PodList, - autoconvert_api_PodLogOptions_To_v1_PodLogOptions, - autoconvert_api_PodProxyOptions_To_v1_PodProxyOptions, - autoconvert_api_PodSpec_To_v1_PodSpec, - autoconvert_api_PodStatusResult_To_v1_PodStatusResult, - autoconvert_api_PodStatus_To_v1_PodStatus, - autoconvert_api_PodTemplateList_To_v1_PodTemplateList, - autoconvert_api_PodTemplateSpec_To_v1_PodTemplateSpec, - autoconvert_api_PodTemplate_To_v1_PodTemplate, - autoconvert_api_Pod_To_v1_Pod, - autoconvert_api_Probe_To_v1_Probe, - autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource, - autoconvert_api_RangeAllocation_To_v1_RangeAllocation, - autoconvert_api_ReplicationControllerList_To_v1_ReplicationControllerList, - autoconvert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec, - autoconvert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus, - autoconvert_api_ReplicationController_To_v1_ReplicationController, - autoconvert_api_ResourceQuotaList_To_v1_ResourceQuotaList, - autoconvert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec, - autoconvert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus, - autoconvert_api_ResourceQuota_To_v1_ResourceQuota, - autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements, - autoconvert_api_SELinuxOptions_To_v1_SELinuxOptions, - autoconvert_api_SecretList_To_v1_SecretList, - autoconvert_api_SecretVolumeSource_To_v1_SecretVolumeSource, - autoconvert_api_Secret_To_v1_Secret, - autoconvert_api_SecurityContext_To_v1_SecurityContext, - autoconvert_api_SerializedReference_To_v1_SerializedReference, - autoconvert_api_ServiceAccountList_To_v1_ServiceAccountList, - autoconvert_api_ServiceAccount_To_v1_ServiceAccount, - autoconvert_api_ServiceList_To_v1_ServiceList, - autoconvert_api_ServicePort_To_v1_ServicePort, - autoconvert_api_ServiceSpec_To_v1_ServiceSpec, - autoconvert_api_ServiceStatus_To_v1_ServiceStatus, - autoconvert_api_Service_To_v1_Service, - autoconvert_api_TCPSocketAction_To_v1_TCPSocketAction, - autoconvert_api_VolumeMount_To_v1_VolumeMount, - autoconvert_api_VolumeSource_To_v1_VolumeSource, - autoconvert_api_Volume_To_v1_Volume, - autoconvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource, - autoconvert_v1_Binding_To_api_Binding, - autoconvert_v1_Capabilities_To_api_Capabilities, - autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource, - autoconvert_v1_CinderVolumeSource_To_api_CinderVolumeSource, - autoconvert_v1_ComponentCondition_To_api_ComponentCondition, - autoconvert_v1_ComponentStatusList_To_api_ComponentStatusList, - autoconvert_v1_ComponentStatus_To_api_ComponentStatus, - autoconvert_v1_ContainerPort_To_api_ContainerPort, - autoconvert_v1_ContainerStateRunning_To_api_ContainerStateRunning, - autoconvert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated, - autoconvert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting, - autoconvert_v1_ContainerState_To_api_ContainerState, - autoconvert_v1_ContainerStatus_To_api_ContainerStatus, - autoconvert_v1_Container_To_api_Container, - autoconvert_v1_DaemonEndpoint_To_api_DaemonEndpoint, - autoconvert_v1_DeleteOptions_To_api_DeleteOptions, - autoconvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile, - autoconvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource, - autoconvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource, - autoconvert_v1_EndpointAddress_To_api_EndpointAddress, - autoconvert_v1_EndpointPort_To_api_EndpointPort, - autoconvert_v1_EndpointSubset_To_api_EndpointSubset, - autoconvert_v1_EndpointsList_To_api_EndpointsList, - autoconvert_v1_Endpoints_To_api_Endpoints, - autoconvert_v1_EnvVarSource_To_api_EnvVarSource, - autoconvert_v1_EnvVar_To_api_EnvVar, - autoconvert_v1_EventList_To_api_EventList, - autoconvert_v1_EventSource_To_api_EventSource, - autoconvert_v1_Event_To_api_Event, - autoconvert_v1_ExecAction_To_api_ExecAction, - autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource, - autoconvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource, - autoconvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource, - autoconvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource, - autoconvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource, - autoconvert_v1_HTTPGetAction_To_api_HTTPGetAction, - autoconvert_v1_Handler_To_api_Handler, - autoconvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource, - autoconvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource, - autoconvert_v1_Lifecycle_To_api_Lifecycle, - autoconvert_v1_LimitRangeItem_To_api_LimitRangeItem, - autoconvert_v1_LimitRangeList_To_api_LimitRangeList, - autoconvert_v1_LimitRangeSpec_To_api_LimitRangeSpec, - autoconvert_v1_LimitRange_To_api_LimitRange, - autoconvert_v1_ListOptions_To_api_ListOptions, - autoconvert_v1_List_To_api_List, - autoconvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress, - autoconvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus, - autoconvert_v1_LocalObjectReference_To_api_LocalObjectReference, - autoconvert_v1_NFSVolumeSource_To_api_NFSVolumeSource, - autoconvert_v1_NamespaceList_To_api_NamespaceList, - autoconvert_v1_NamespaceSpec_To_api_NamespaceSpec, - autoconvert_v1_NamespaceStatus_To_api_NamespaceStatus, - autoconvert_v1_Namespace_To_api_Namespace, - autoconvert_v1_NodeAddress_To_api_NodeAddress, - autoconvert_v1_NodeCondition_To_api_NodeCondition, - autoconvert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints, - autoconvert_v1_NodeList_To_api_NodeList, - autoconvert_v1_NodeSpec_To_api_NodeSpec, - autoconvert_v1_NodeStatus_To_api_NodeStatus, - autoconvert_v1_NodeSystemInfo_To_api_NodeSystemInfo, - autoconvert_v1_Node_To_api_Node, - autoconvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector, - autoconvert_v1_ObjectMeta_To_api_ObjectMeta, - autoconvert_v1_ObjectReference_To_api_ObjectReference, - autoconvert_v1_PersistentVolumeClaimList_To_api_PersistentVolumeClaimList, - autoconvert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec, - autoconvert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus, - autoconvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource, - autoconvert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim, - autoconvert_v1_PersistentVolumeList_To_api_PersistentVolumeList, - autoconvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource, - autoconvert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec, - autoconvert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus, - autoconvert_v1_PersistentVolume_To_api_PersistentVolume, - autoconvert_v1_PodAttachOptions_To_api_PodAttachOptions, - autoconvert_v1_PodCondition_To_api_PodCondition, - autoconvert_v1_PodExecOptions_To_api_PodExecOptions, - autoconvert_v1_PodList_To_api_PodList, - autoconvert_v1_PodLogOptions_To_api_PodLogOptions, - autoconvert_v1_PodProxyOptions_To_api_PodProxyOptions, - autoconvert_v1_PodSpec_To_api_PodSpec, - autoconvert_v1_PodStatusResult_To_api_PodStatusResult, - autoconvert_v1_PodStatus_To_api_PodStatus, - autoconvert_v1_PodTemplateList_To_api_PodTemplateList, - autoconvert_v1_PodTemplateSpec_To_api_PodTemplateSpec, - autoconvert_v1_PodTemplate_To_api_PodTemplate, - autoconvert_v1_Pod_To_api_Pod, - autoconvert_v1_Probe_To_api_Probe, - autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource, - autoconvert_v1_RangeAllocation_To_api_RangeAllocation, - autoconvert_v1_ReplicationControllerList_To_api_ReplicationControllerList, - autoconvert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec, - autoconvert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus, - autoconvert_v1_ReplicationController_To_api_ReplicationController, - autoconvert_v1_ResourceQuotaList_To_api_ResourceQuotaList, - autoconvert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec, - autoconvert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus, - autoconvert_v1_ResourceQuota_To_api_ResourceQuota, - autoconvert_v1_ResourceRequirements_To_api_ResourceRequirements, - autoconvert_v1_SELinuxOptions_To_api_SELinuxOptions, - autoconvert_v1_SecretList_To_api_SecretList, - autoconvert_v1_SecretVolumeSource_To_api_SecretVolumeSource, - autoconvert_v1_Secret_To_api_Secret, - autoconvert_v1_SecurityContext_To_api_SecurityContext, - autoconvert_v1_SerializedReference_To_api_SerializedReference, - autoconvert_v1_ServiceAccountList_To_api_ServiceAccountList, - autoconvert_v1_ServiceAccount_To_api_ServiceAccount, - autoconvert_v1_ServiceList_To_api_ServiceList, - autoconvert_v1_ServicePort_To_api_ServicePort, - autoconvert_v1_ServiceSpec_To_api_ServiceSpec, - autoconvert_v1_ServiceStatus_To_api_ServiceStatus, - autoconvert_v1_Service_To_api_Service, - autoconvert_v1_TCPSocketAction_To_api_TCPSocketAction, - autoconvert_v1_VolumeMount_To_api_VolumeMount, - autoconvert_v1_VolumeSource_To_api_VolumeSource, - autoconvert_v1_Volume_To_api_Volume, + autoConvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource, + autoConvert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource, + autoConvert_api_Binding_To_v1_Binding, + autoConvert_api_Capabilities_To_v1_Capabilities, + autoConvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource, + autoConvert_api_CinderVolumeSource_To_v1_CinderVolumeSource, + autoConvert_api_ComponentCondition_To_v1_ComponentCondition, + autoConvert_api_ComponentStatusList_To_v1_ComponentStatusList, + autoConvert_api_ComponentStatus_To_v1_ComponentStatus, + autoConvert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector, + autoConvert_api_ConfigMapList_To_v1_ConfigMapList, + autoConvert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource, + autoConvert_api_ConfigMap_To_v1_ConfigMap, + autoConvert_api_ContainerImage_To_v1_ContainerImage, + autoConvert_api_ContainerPort_To_v1_ContainerPort, + autoConvert_api_ContainerStateRunning_To_v1_ContainerStateRunning, + autoConvert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated, + autoConvert_api_ContainerStateWaiting_To_v1_ContainerStateWaiting, + autoConvert_api_ContainerState_To_v1_ContainerState, + autoConvert_api_ContainerStatus_To_v1_ContainerStatus, + autoConvert_api_Container_To_v1_Container, + autoConvert_api_DaemonEndpoint_To_v1_DaemonEndpoint, + autoConvert_api_DeleteOptions_To_v1_DeleteOptions, + autoConvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile, + autoConvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource, + autoConvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource, + autoConvert_api_EndpointAddress_To_v1_EndpointAddress, + autoConvert_api_EndpointPort_To_v1_EndpointPort, + autoConvert_api_EndpointSubset_To_v1_EndpointSubset, + autoConvert_api_EndpointsList_To_v1_EndpointsList, + autoConvert_api_Endpoints_To_v1_Endpoints, + autoConvert_api_EnvVarSource_To_v1_EnvVarSource, + autoConvert_api_EnvVar_To_v1_EnvVar, + autoConvert_api_EventList_To_v1_EventList, + autoConvert_api_EventSource_To_v1_EventSource, + autoConvert_api_Event_To_v1_Event, + autoConvert_api_ExecAction_To_v1_ExecAction, + autoConvert_api_FCVolumeSource_To_v1_FCVolumeSource, + autoConvert_api_FlexVolumeSource_To_v1_FlexVolumeSource, + autoConvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource, + autoConvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource, + autoConvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource, + autoConvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource, + autoConvert_api_HTTPGetAction_To_v1_HTTPGetAction, + autoConvert_api_HTTPHeader_To_v1_HTTPHeader, + autoConvert_api_Handler_To_v1_Handler, + autoConvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource, + autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource, + autoConvert_api_KeyToPath_To_v1_KeyToPath, + autoConvert_api_Lifecycle_To_v1_Lifecycle, + autoConvert_api_LimitRangeItem_To_v1_LimitRangeItem, + autoConvert_api_LimitRangeList_To_v1_LimitRangeList, + autoConvert_api_LimitRangeSpec_To_v1_LimitRangeSpec, + autoConvert_api_LimitRange_To_v1_LimitRange, + autoConvert_api_ListOptions_To_v1_ListOptions, + autoConvert_api_List_To_v1_List, + autoConvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress, + autoConvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus, + autoConvert_api_LocalObjectReference_To_v1_LocalObjectReference, + autoConvert_api_NFSVolumeSource_To_v1_NFSVolumeSource, + autoConvert_api_NamespaceList_To_v1_NamespaceList, + autoConvert_api_NamespaceSpec_To_v1_NamespaceSpec, + autoConvert_api_NamespaceStatus_To_v1_NamespaceStatus, + autoConvert_api_Namespace_To_v1_Namespace, + autoConvert_api_NodeAddress_To_v1_NodeAddress, + autoConvert_api_NodeCondition_To_v1_NodeCondition, + autoConvert_api_NodeDaemonEndpoints_To_v1_NodeDaemonEndpoints, + autoConvert_api_NodeList_To_v1_NodeList, + autoConvert_api_NodeSpec_To_v1_NodeSpec, + autoConvert_api_NodeStatus_To_v1_NodeStatus, + autoConvert_api_NodeSystemInfo_To_v1_NodeSystemInfo, + autoConvert_api_Node_To_v1_Node, + autoConvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector, + autoConvert_api_ObjectMeta_To_v1_ObjectMeta, + autoConvert_api_ObjectReference_To_v1_ObjectReference, + autoConvert_api_PersistentVolumeClaimList_To_v1_PersistentVolumeClaimList, + autoConvert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec, + autoConvert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus, + autoConvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource, + autoConvert_api_PersistentVolumeClaim_To_v1_PersistentVolumeClaim, + autoConvert_api_PersistentVolumeList_To_v1_PersistentVolumeList, + autoConvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource, + autoConvert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec, + autoConvert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus, + autoConvert_api_PersistentVolume_To_v1_PersistentVolume, + autoConvert_api_PodAttachOptions_To_v1_PodAttachOptions, + autoConvert_api_PodCondition_To_v1_PodCondition, + autoConvert_api_PodExecOptions_To_v1_PodExecOptions, + autoConvert_api_PodList_To_v1_PodList, + autoConvert_api_PodLogOptions_To_v1_PodLogOptions, + autoConvert_api_PodProxyOptions_To_v1_PodProxyOptions, + autoConvert_api_PodSpec_To_v1_PodSpec, + autoConvert_api_PodStatusResult_To_v1_PodStatusResult, + autoConvert_api_PodStatus_To_v1_PodStatus, + autoConvert_api_PodTemplateList_To_v1_PodTemplateList, + autoConvert_api_PodTemplateSpec_To_v1_PodTemplateSpec, + autoConvert_api_PodTemplate_To_v1_PodTemplate, + autoConvert_api_Pod_To_v1_Pod, + autoConvert_api_Probe_To_v1_Probe, + autoConvert_api_RBDVolumeSource_To_v1_RBDVolumeSource, + autoConvert_api_RangeAllocation_To_v1_RangeAllocation, + autoConvert_api_ReplicationControllerList_To_v1_ReplicationControllerList, + autoConvert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec, + autoConvert_api_ReplicationControllerStatus_To_v1_ReplicationControllerStatus, + autoConvert_api_ReplicationController_To_v1_ReplicationController, + autoConvert_api_ResourceQuotaList_To_v1_ResourceQuotaList, + autoConvert_api_ResourceQuotaSpec_To_v1_ResourceQuotaSpec, + autoConvert_api_ResourceQuotaStatus_To_v1_ResourceQuotaStatus, + autoConvert_api_ResourceQuota_To_v1_ResourceQuota, + autoConvert_api_ResourceRequirements_To_v1_ResourceRequirements, + autoConvert_api_SELinuxOptions_To_v1_SELinuxOptions, + autoConvert_api_SecretKeySelector_To_v1_SecretKeySelector, + autoConvert_api_SecretList_To_v1_SecretList, + autoConvert_api_SecretVolumeSource_To_v1_SecretVolumeSource, + autoConvert_api_Secret_To_v1_Secret, + autoConvert_api_SecurityContext_To_v1_SecurityContext, + autoConvert_api_SerializedReference_To_v1_SerializedReference, + autoConvert_api_ServiceAccountList_To_v1_ServiceAccountList, + autoConvert_api_ServiceAccount_To_v1_ServiceAccount, + autoConvert_api_ServiceList_To_v1_ServiceList, + autoConvert_api_ServicePort_To_v1_ServicePort, + autoConvert_api_ServiceSpec_To_v1_ServiceSpec, + autoConvert_api_ServiceStatus_To_v1_ServiceStatus, + autoConvert_api_Service_To_v1_Service, + autoConvert_api_TCPSocketAction_To_v1_TCPSocketAction, + autoConvert_api_VolumeMount_To_v1_VolumeMount, + autoConvert_api_VolumeSource_To_v1_VolumeSource, + autoConvert_api_Volume_To_v1_Volume, + autoConvert_unversioned_ExportOptions_To_v1_ExportOptions, + autoConvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource, + autoConvert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource, + autoConvert_v1_Binding_To_api_Binding, + autoConvert_v1_Capabilities_To_api_Capabilities, + autoConvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource, + autoConvert_v1_CinderVolumeSource_To_api_CinderVolumeSource, + autoConvert_v1_ComponentCondition_To_api_ComponentCondition, + autoConvert_v1_ComponentStatusList_To_api_ComponentStatusList, + autoConvert_v1_ComponentStatus_To_api_ComponentStatus, + autoConvert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector, + autoConvert_v1_ConfigMapList_To_api_ConfigMapList, + autoConvert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource, + autoConvert_v1_ConfigMap_To_api_ConfigMap, + autoConvert_v1_ContainerImage_To_api_ContainerImage, + autoConvert_v1_ContainerPort_To_api_ContainerPort, + autoConvert_v1_ContainerStateRunning_To_api_ContainerStateRunning, + autoConvert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated, + autoConvert_v1_ContainerStateWaiting_To_api_ContainerStateWaiting, + autoConvert_v1_ContainerState_To_api_ContainerState, + autoConvert_v1_ContainerStatus_To_api_ContainerStatus, + autoConvert_v1_Container_To_api_Container, + autoConvert_v1_DaemonEndpoint_To_api_DaemonEndpoint, + autoConvert_v1_DeleteOptions_To_api_DeleteOptions, + autoConvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile, + autoConvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource, + autoConvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource, + autoConvert_v1_EndpointAddress_To_api_EndpointAddress, + autoConvert_v1_EndpointPort_To_api_EndpointPort, + autoConvert_v1_EndpointSubset_To_api_EndpointSubset, + autoConvert_v1_EndpointsList_To_api_EndpointsList, + autoConvert_v1_Endpoints_To_api_Endpoints, + autoConvert_v1_EnvVarSource_To_api_EnvVarSource, + autoConvert_v1_EnvVar_To_api_EnvVar, + autoConvert_v1_EventList_To_api_EventList, + autoConvert_v1_EventSource_To_api_EventSource, + autoConvert_v1_Event_To_api_Event, + autoConvert_v1_ExecAction_To_api_ExecAction, + autoConvert_v1_ExportOptions_To_unversioned_ExportOptions, + autoConvert_v1_FCVolumeSource_To_api_FCVolumeSource, + autoConvert_v1_FlexVolumeSource_To_api_FlexVolumeSource, + autoConvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource, + autoConvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource, + autoConvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource, + autoConvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource, + autoConvert_v1_HTTPGetAction_To_api_HTTPGetAction, + autoConvert_v1_HTTPHeader_To_api_HTTPHeader, + autoConvert_v1_Handler_To_api_Handler, + autoConvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource, + autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource, + autoConvert_v1_KeyToPath_To_api_KeyToPath, + autoConvert_v1_Lifecycle_To_api_Lifecycle, + autoConvert_v1_LimitRangeItem_To_api_LimitRangeItem, + autoConvert_v1_LimitRangeList_To_api_LimitRangeList, + autoConvert_v1_LimitRangeSpec_To_api_LimitRangeSpec, + autoConvert_v1_LimitRange_To_api_LimitRange, + autoConvert_v1_ListOptions_To_api_ListOptions, + autoConvert_v1_List_To_api_List, + autoConvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress, + autoConvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus, + autoConvert_v1_LocalObjectReference_To_api_LocalObjectReference, + autoConvert_v1_NFSVolumeSource_To_api_NFSVolumeSource, + autoConvert_v1_NamespaceList_To_api_NamespaceList, + autoConvert_v1_NamespaceSpec_To_api_NamespaceSpec, + autoConvert_v1_NamespaceStatus_To_api_NamespaceStatus, + autoConvert_v1_Namespace_To_api_Namespace, + autoConvert_v1_NodeAddress_To_api_NodeAddress, + autoConvert_v1_NodeCondition_To_api_NodeCondition, + autoConvert_v1_NodeDaemonEndpoints_To_api_NodeDaemonEndpoints, + autoConvert_v1_NodeList_To_api_NodeList, + autoConvert_v1_NodeSpec_To_api_NodeSpec, + autoConvert_v1_NodeStatus_To_api_NodeStatus, + autoConvert_v1_NodeSystemInfo_To_api_NodeSystemInfo, + autoConvert_v1_Node_To_api_Node, + autoConvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector, + autoConvert_v1_ObjectMeta_To_api_ObjectMeta, + autoConvert_v1_ObjectReference_To_api_ObjectReference, + autoConvert_v1_PersistentVolumeClaimList_To_api_PersistentVolumeClaimList, + autoConvert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec, + autoConvert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus, + autoConvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource, + autoConvert_v1_PersistentVolumeClaim_To_api_PersistentVolumeClaim, + autoConvert_v1_PersistentVolumeList_To_api_PersistentVolumeList, + autoConvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource, + autoConvert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec, + autoConvert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus, + autoConvert_v1_PersistentVolume_To_api_PersistentVolume, + autoConvert_v1_PodAttachOptions_To_api_PodAttachOptions, + autoConvert_v1_PodCondition_To_api_PodCondition, + autoConvert_v1_PodExecOptions_To_api_PodExecOptions, + autoConvert_v1_PodList_To_api_PodList, + autoConvert_v1_PodLogOptions_To_api_PodLogOptions, + autoConvert_v1_PodProxyOptions_To_api_PodProxyOptions, + autoConvert_v1_PodSpec_To_api_PodSpec, + autoConvert_v1_PodStatusResult_To_api_PodStatusResult, + autoConvert_v1_PodStatus_To_api_PodStatus, + autoConvert_v1_PodTemplateList_To_api_PodTemplateList, + autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec, + autoConvert_v1_PodTemplate_To_api_PodTemplate, + autoConvert_v1_Pod_To_api_Pod, + autoConvert_v1_Probe_To_api_Probe, + autoConvert_v1_RBDVolumeSource_To_api_RBDVolumeSource, + autoConvert_v1_RangeAllocation_To_api_RangeAllocation, + autoConvert_v1_ReplicationControllerList_To_api_ReplicationControllerList, + autoConvert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec, + autoConvert_v1_ReplicationControllerStatus_To_api_ReplicationControllerStatus, + autoConvert_v1_ReplicationController_To_api_ReplicationController, + autoConvert_v1_ResourceQuotaList_To_api_ResourceQuotaList, + autoConvert_v1_ResourceQuotaSpec_To_api_ResourceQuotaSpec, + autoConvert_v1_ResourceQuotaStatus_To_api_ResourceQuotaStatus, + autoConvert_v1_ResourceQuota_To_api_ResourceQuota, + autoConvert_v1_ResourceRequirements_To_api_ResourceRequirements, + autoConvert_v1_SELinuxOptions_To_api_SELinuxOptions, + autoConvert_v1_SecretKeySelector_To_api_SecretKeySelector, + autoConvert_v1_SecretList_To_api_SecretList, + autoConvert_v1_SecretVolumeSource_To_api_SecretVolumeSource, + autoConvert_v1_Secret_To_api_Secret, + autoConvert_v1_SecurityContext_To_api_SecurityContext, + autoConvert_v1_SerializedReference_To_api_SerializedReference, + autoConvert_v1_ServiceAccountList_To_api_ServiceAccountList, + autoConvert_v1_ServiceAccount_To_api_ServiceAccount, + autoConvert_v1_ServiceList_To_api_ServiceList, + autoConvert_v1_ServicePort_To_api_ServicePort, + autoConvert_v1_ServiceSpec_To_api_ServiceSpec, + autoConvert_v1_ServiceStatus_To_api_ServiceStatus, + autoConvert_v1_Service_To_api_Service, + autoConvert_v1_TCPSocketAction_To_api_TCPSocketAction, + autoConvert_v1_VolumeMount_To_api_VolumeMount, + autoConvert_v1_VolumeSource_To_api_VolumeSource, + autoConvert_v1_Volume_To_api_Volume, ) if err != nil { // If one of the conversion functions is malformed, detect it immediately. diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/conversion_test.go b/vendor/k8s.io/kubernetes/pkg/api/v1/conversion_test.go index ad9115994..8cc2f0474 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/conversion_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/conversion_test.go @@ -20,6 +20,7 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/resource" versioned "k8s.io/kubernetes/pkg/api/v1" ) @@ -68,3 +69,57 @@ func TestPodSpecConversion(t *testing.T) { } } } + +func TestResourceListConversion(t *testing.T) { + bigMilliQuantity := resource.NewQuantity(resource.MaxMilliValue, resource.DecimalSI) + bigMilliQuantity.Add(resource.MustParse("12345m")) + + tests := []struct { + input versioned.ResourceList + expected api.ResourceList + }{ + { // No changes necessary. + input: versioned.ResourceList{ + versioned.ResourceMemory: resource.MustParse("30M"), + versioned.ResourceCPU: resource.MustParse("100m"), + versioned.ResourceStorage: resource.MustParse("1G"), + }, + expected: api.ResourceList{ + api.ResourceMemory: resource.MustParse("30M"), + api.ResourceCPU: resource.MustParse("100m"), + api.ResourceStorage: resource.MustParse("1G"), + }, + }, + { // Nano-scale values should be rounded up to milli-scale. + input: versioned.ResourceList{ + versioned.ResourceCPU: resource.MustParse("3.000023m"), + versioned.ResourceMemory: resource.MustParse("500.000050m"), + }, + expected: api.ResourceList{ + api.ResourceCPU: resource.MustParse("4m"), + api.ResourceMemory: resource.MustParse("501m"), + }, + }, + { // Large values should still be accurate. + input: versioned.ResourceList{ + versioned.ResourceCPU: *bigMilliQuantity.Copy(), + versioned.ResourceStorage: *bigMilliQuantity.Copy(), + }, + expected: api.ResourceList{ + api.ResourceCPU: *bigMilliQuantity.Copy(), + api.ResourceStorage: *bigMilliQuantity.Copy(), + }, + }, + } + + output := api.ResourceList{} + for i, test := range tests { + err := api.Scheme.Convert(&test.input, &output) + if err != nil { + t.Fatalf("unexpected error for case %d: %v", i, err) + } + if !api.Semantic.DeepEqual(test.expected, output) { + t.Errorf("unexpected conversion for case %d: Expected %+v; Got %+v", i, test.expected, output) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/api/v1/deep_copy_generated.go index 9ee3b1c32..c74acad29 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/deep_copy_generated.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/deep_copy_generated.go @@ -26,7 +26,7 @@ import ( unversioned "k8s.io/kubernetes/pkg/api/unversioned" conversion "k8s.io/kubernetes/pkg/conversion" runtime "k8s.io/kubernetes/pkg/runtime" - util "k8s.io/kubernetes/pkg/util" + intstr "k8s.io/kubernetes/pkg/util/intstr" inf "speter.net/go/exp/math/dec/inf" ) @@ -73,6 +73,13 @@ func deepCopy_v1_AWSElasticBlockStoreVolumeSource(in AWSElasticBlockStoreVolumeS return nil } +func deepCopy_v1_AzureFileVolumeSource(in AzureFileVolumeSource, out *AzureFileVolumeSource, c *conversion.Cloner) error { + out.SecretName = in.SecretName + out.ShareName = in.ShareName + out.ReadOnly = in.ReadOnly + return nil +} + func deepCopy_v1_Binding(in Binding, out *Binding, c *conversion.Cloner) error { if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err @@ -115,6 +122,7 @@ func deepCopy_v1_CephFSVolumeSource(in CephFSVolumeSource, out *CephFSVolumeSour } else { out.Monitors = nil } + out.Path = in.Path out.User = in.User out.SecretFile = in.SecretFile if in.SecretRef != nil { @@ -184,6 +192,69 @@ func deepCopy_v1_ComponentStatusList(in ComponentStatusList, out *ComponentStatu return nil } +func deepCopy_v1_ConfigMap(in ConfigMap, out *ConfigMap, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if in.Data != nil { + out.Data = make(map[string]string) + for key, val := range in.Data { + out.Data[key] = val + } + } else { + out.Data = nil + } + return nil +} + +func deepCopy_v1_ConfigMapKeySelector(in ConfigMapKeySelector, out *ConfigMapKeySelector, c *conversion.Cloner) error { + if err := deepCopy_v1_LocalObjectReference(in.LocalObjectReference, &out.LocalObjectReference, c); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func deepCopy_v1_ConfigMapList(in ConfigMapList, out *ConfigMapList, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]ConfigMap, len(in.Items)) + for i := range in.Items { + if err := deepCopy_v1_ConfigMap(in.Items[i], &out.Items[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func deepCopy_v1_ConfigMapVolumeSource(in ConfigMapVolumeSource, out *ConfigMapVolumeSource, c *conversion.Cloner) error { + if err := deepCopy_v1_LocalObjectReference(in.LocalObjectReference, &out.LocalObjectReference, c); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]KeyToPath, len(in.Items)) + for i := range in.Items { + if err := deepCopy_v1_KeyToPath(in.Items[i], &out.Items[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + func deepCopy_v1_Container(in Container, out *Container, c *conversion.Cloner) error { out.Name = in.Name out.Image = in.Image @@ -277,6 +348,19 @@ func deepCopy_v1_Container(in Container, out *Container, c *conversion.Cloner) e return nil } +func deepCopy_v1_ContainerImage(in ContainerImage, out *ContainerImage, c *conversion.Cloner) error { + if in.RepoTags != nil { + out.RepoTags = make([]string, len(in.RepoTags)) + for i := range in.RepoTags { + out.RepoTags[i] = in.RepoTags[i] + } + } else { + out.RepoTags = nil + } + out.Size = in.Size + return nil +} + func deepCopy_v1_ContainerPort(in ContainerPort, out *ContainerPort, c *conversion.Cloner) error { out.Name = in.Name out.HostPort = in.HostPort @@ -520,6 +604,22 @@ func deepCopy_v1_EnvVarSource(in EnvVarSource, out *EnvVarSource, c *conversion. } else { out.FieldRef = nil } + if in.ConfigMapKeyRef != nil { + out.ConfigMapKeyRef = new(ConfigMapKeySelector) + if err := deepCopy_v1_ConfigMapKeySelector(*in.ConfigMapKeyRef, out.ConfigMapKeyRef, c); err != nil { + return err + } + } else { + out.ConfigMapKeyRef = nil + } + if in.SecretKeyRef != nil { + out.SecretKeyRef = new(SecretKeySelector) + if err := deepCopy_v1_SecretKeySelector(*in.SecretKeyRef, out.SecretKeyRef, c); err != nil { + return err + } + } else { + out.SecretKeyRef = nil + } return nil } @@ -545,6 +645,7 @@ func deepCopy_v1_Event(in Event, out *Event, c *conversion.Cloner) error { return err } out.Count = in.Count + out.Type = in.Type return nil } @@ -586,6 +687,15 @@ func deepCopy_v1_ExecAction(in ExecAction, out *ExecAction, c *conversion.Cloner return nil } +func deepCopy_v1_ExportOptions(in ExportOptions, out *ExportOptions, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + out.Export = in.Export + out.Exact = in.Exact + return nil +} + func deepCopy_v1_FCVolumeSource(in FCVolumeSource, out *FCVolumeSource, c *conversion.Cloner) error { if in.TargetWWNs != nil { out.TargetWWNs = make([]string, len(in.TargetWWNs)) @@ -596,7 +706,7 @@ func deepCopy_v1_FCVolumeSource(in FCVolumeSource, out *FCVolumeSource, c *conve out.TargetWWNs = nil } if in.Lun != nil { - out.Lun = new(int) + out.Lun = new(int32) *out.Lun = *in.Lun } else { out.Lun = nil @@ -606,6 +716,29 @@ func deepCopy_v1_FCVolumeSource(in FCVolumeSource, out *FCVolumeSource, c *conve return nil } +func deepCopy_v1_FlexVolumeSource(in FlexVolumeSource, out *FlexVolumeSource, c *conversion.Cloner) error { + out.Driver = in.Driver + out.FSType = in.FSType + if in.SecretRef != nil { + out.SecretRef = new(LocalObjectReference) + if err := deepCopy_v1_LocalObjectReference(*in.SecretRef, out.SecretRef, c); err != nil { + return err + } + } else { + out.SecretRef = nil + } + out.ReadOnly = in.ReadOnly + if in.Options != nil { + out.Options = make(map[string]string) + for key, val := range in.Options { + out.Options[key] = val + } + } else { + out.Options = nil + } + return nil +} + func deepCopy_v1_FlockerVolumeSource(in FlockerVolumeSource, out *FlockerVolumeSource, c *conversion.Cloner) error { out.DatasetName = in.DatasetName return nil @@ -622,6 +755,7 @@ func deepCopy_v1_GCEPersistentDiskVolumeSource(in GCEPersistentDiskVolumeSource, func deepCopy_v1_GitRepoVolumeSource(in GitRepoVolumeSource, out *GitRepoVolumeSource, c *conversion.Cloner) error { out.Repository = in.Repository out.Revision = in.Revision + out.Directory = in.Directory return nil } @@ -634,11 +768,27 @@ func deepCopy_v1_GlusterfsVolumeSource(in GlusterfsVolumeSource, out *GlusterfsV func deepCopy_v1_HTTPGetAction(in HTTPGetAction, out *HTTPGetAction, c *conversion.Cloner) error { out.Path = in.Path - if err := deepCopy_util_IntOrString(in.Port, &out.Port, c); err != nil { + if err := deepCopy_intstr_IntOrString(in.Port, &out.Port, c); err != nil { return err } out.Host = in.Host out.Scheme = in.Scheme + if in.HTTPHeaders != nil { + out.HTTPHeaders = make([]HTTPHeader, len(in.HTTPHeaders)) + for i := range in.HTTPHeaders { + if err := deepCopy_v1_HTTPHeader(in.HTTPHeaders[i], &out.HTTPHeaders[i], c); err != nil { + return err + } + } + } else { + out.HTTPHeaders = nil + } + return nil +} + +func deepCopy_v1_HTTPHeader(in HTTPHeader, out *HTTPHeader, c *conversion.Cloner) error { + out.Name = in.Name + out.Value = in.Value return nil } @@ -679,11 +829,18 @@ func deepCopy_v1_ISCSIVolumeSource(in ISCSIVolumeSource, out *ISCSIVolumeSource, out.TargetPortal = in.TargetPortal out.IQN = in.IQN out.Lun = in.Lun + out.ISCSIInterface = in.ISCSIInterface out.FSType = in.FSType out.ReadOnly = in.ReadOnly return nil } +func deepCopy_v1_KeyToPath(in KeyToPath, out *KeyToPath, c *conversion.Cloner) error { + out.Key = in.Key + out.Path = in.Path + return nil +} + func deepCopy_v1_Lifecycle(in Lifecycle, out *Lifecycle, c *conversion.Cloner) error { if in.PostStart != nil { out.PostStart = new(Handler) @@ -844,6 +1001,12 @@ func deepCopy_v1_ListOptions(in ListOptions, out *ListOptions, c *conversion.Clo out.FieldSelector = in.FieldSelector out.Watch = in.Watch out.ResourceVersion = in.ResourceVersion + if in.TimeoutSeconds != nil { + out.TimeoutSeconds = new(int64) + *out.TimeoutSeconds = *in.TimeoutSeconds + } else { + out.TimeoutSeconds = nil + } return nil } @@ -1016,6 +1179,18 @@ func deepCopy_v1_NodeStatus(in NodeStatus, out *NodeStatus, c *conversion.Cloner } else { out.Capacity = nil } + if in.Allocatable != nil { + out.Allocatable = make(ResourceList) + for key, val := range in.Allocatable { + newVal := new(resource.Quantity) + if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { + return err + } + out.Allocatable[key] = *newVal + } + } else { + out.Allocatable = nil + } out.Phase = in.Phase if in.Conditions != nil { out.Conditions = make([]NodeCondition, len(in.Conditions)) @@ -1043,6 +1218,16 @@ func deepCopy_v1_NodeStatus(in NodeStatus, out *NodeStatus, c *conversion.Cloner if err := deepCopy_v1_NodeSystemInfo(in.NodeInfo, &out.NodeInfo, c); err != nil { return err } + if in.Images != nil { + out.Images = make([]ContainerImage, len(in.Images)) + for i := range in.Images { + if err := deepCopy_v1_ContainerImage(in.Images[i], &out.Images[i], c); err != nil { + return err + } + } + } else { + out.Images = nil + } return nil } @@ -1051,7 +1236,7 @@ func deepCopy_v1_NodeSystemInfo(in NodeSystemInfo, out *NodeSystemInfo, c *conve out.SystemUUID = in.SystemUUID out.BootID = in.BootID out.KernelVersion = in.KernelVersion - out.OsImage = in.OsImage + out.OSImage = in.OSImage out.ContainerRuntimeVersion = in.ContainerRuntimeVersion out.KubeletVersion = in.KubeletVersion out.KubeProxyVersion = in.KubeProxyVersion @@ -1327,6 +1512,22 @@ func deepCopy_v1_PersistentVolumeSource(in PersistentVolumeSource, out *Persiste } else { out.Flocker = nil } + if in.FlexVolume != nil { + out.FlexVolume = new(FlexVolumeSource) + if err := deepCopy_v1_FlexVolumeSource(*in.FlexVolume, out.FlexVolume, c); err != nil { + return err + } + } else { + out.FlexVolume = nil + } + if in.AzureFile != nil { + out.AzureFile = new(AzureFileVolumeSource) + if err := deepCopy_v1_AzureFileVolumeSource(*in.AzureFile, out.AzureFile, c); err != nil { + return err + } + } else { + out.AzureFile = nil + } return nil } @@ -1501,14 +1702,6 @@ func deepCopy_v1_PodProxyOptions(in PodProxyOptions, out *PodProxyOptions, c *co } func deepCopy_v1_PodSecurityContext(in PodSecurityContext, out *PodSecurityContext, c *conversion.Cloner) error { - if in.SupplementalGroups != nil { - out.SupplementalGroups = make([]int64, len(in.SupplementalGroups)) - for i := range in.SupplementalGroups { - out.SupplementalGroups[i] = in.SupplementalGroups[i] - } - } else { - out.SupplementalGroups = nil - } if in.SELinuxOptions != nil { out.SELinuxOptions = new(SELinuxOptions) if err := deepCopy_v1_SELinuxOptions(*in.SELinuxOptions, out.SELinuxOptions, c); err != nil { @@ -1529,6 +1722,20 @@ func deepCopy_v1_PodSecurityContext(in PodSecurityContext, out *PodSecurityConte } else { out.RunAsNonRoot = nil } + if in.SupplementalGroups != nil { + out.SupplementalGroups = make([]int64, len(in.SupplementalGroups)) + for i := range in.SupplementalGroups { + out.SupplementalGroups[i] = in.SupplementalGroups[i] + } + } else { + out.SupplementalGroups = nil + } + if in.FSGroup != nil { + out.FSGroup = new(int64) + *out.FSGroup = *in.FSGroup + } else { + out.FSGroup = nil + } return nil } @@ -1701,6 +1908,9 @@ func deepCopy_v1_Probe(in Probe, out *Probe, c *conversion.Cloner) error { } out.InitialDelaySeconds = in.InitialDelaySeconds out.TimeoutSeconds = in.TimeoutSeconds + out.PeriodSeconds = in.PeriodSeconds + out.SuccessThreshold = in.SuccessThreshold + out.FailureThreshold = in.FailureThreshold return nil } @@ -1787,7 +1997,7 @@ func deepCopy_v1_ReplicationControllerList(in ReplicationControllerList, out *Re func deepCopy_v1_ReplicationControllerSpec(in ReplicationControllerSpec, out *ReplicationControllerSpec, c *conversion.Cloner) error { if in.Replicas != nil { - out.Replicas = new(int) + out.Replicas = new(int32) *out.Replicas = *in.Replicas } else { out.Replicas = nil @@ -1956,6 +2166,14 @@ func deepCopy_v1_Secret(in Secret, out *Secret, c *conversion.Cloner) error { return nil } +func deepCopy_v1_SecretKeySelector(in SecretKeySelector, out *SecretKeySelector, c *conversion.Cloner) error { + if err := deepCopy_v1_LocalObjectReference(in.LocalObjectReference, &out.LocalObjectReference, c); err != nil { + return err + } + out.Key = in.Key + return nil +} + func deepCopy_v1_SecretList(in SecretList, out *SecretList, c *conversion.Cloner) error { if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err @@ -2016,6 +2234,12 @@ func deepCopy_v1_SecurityContext(in SecurityContext, out *SecurityContext, c *co } else { out.RunAsNonRoot = nil } + if in.ReadOnlyRootFilesystem != nil { + out.ReadOnlyRootFilesystem = new(bool) + *out.ReadOnlyRootFilesystem = *in.ReadOnlyRootFilesystem + } else { + out.ReadOnlyRootFilesystem = nil + } return nil } @@ -2119,7 +2343,7 @@ func deepCopy_v1_ServicePort(in ServicePort, out *ServicePort, c *conversion.Clo out.Name = in.Name out.Protocol = in.Protocol out.Port = in.Port - if err := deepCopy_util_IntOrString(in.TargetPort, &out.TargetPort, c); err != nil { + if err := deepCopy_intstr_IntOrString(in.TargetPort, &out.TargetPort, c); err != nil { return err } out.NodePort = in.NodePort @@ -2176,7 +2400,7 @@ func deepCopy_v1_ServiceStatus(in ServiceStatus, out *ServiceStatus, c *conversi } func deepCopy_v1_TCPSocketAction(in TCPSocketAction, out *TCPSocketAction, c *conversion.Cloner) error { - if err := deepCopy_util_IntOrString(in.Port, &out.Port, c); err != nil { + if err := deepCopy_intstr_IntOrString(in.Port, &out.Port, c); err != nil { return err } return nil @@ -2286,6 +2510,14 @@ func deepCopy_v1_VolumeSource(in VolumeSource, out *VolumeSource, c *conversion. } else { out.RBD = nil } + if in.FlexVolume != nil { + out.FlexVolume = new(FlexVolumeSource) + if err := deepCopy_v1_FlexVolumeSource(*in.FlexVolume, out.FlexVolume, c); err != nil { + return err + } + } else { + out.FlexVolume = nil + } if in.Cinder != nil { out.Cinder = new(CinderVolumeSource) if err := deepCopy_v1_CinderVolumeSource(*in.Cinder, out.Cinder, c); err != nil { @@ -2326,6 +2558,22 @@ func deepCopy_v1_VolumeSource(in VolumeSource, out *VolumeSource, c *conversion. } else { out.FC = nil } + if in.AzureFile != nil { + out.AzureFile = new(AzureFileVolumeSource) + if err := deepCopy_v1_AzureFileVolumeSource(*in.AzureFile, out.AzureFile, c); err != nil { + return err + } + } else { + out.AzureFile = nil + } + if in.ConfigMap != nil { + out.ConfigMap = new(ConfigMapVolumeSource) + if err := deepCopy_v1_ConfigMapVolumeSource(*in.ConfigMap, out.ConfigMap, c); err != nil { + return err + } + } else { + out.ConfigMap = nil + } return nil } @@ -2338,11 +2586,18 @@ func deepCopy_runtime_RawExtension(in runtime.RawExtension, out *runtime.RawExte } else { out.RawJSON = nil } + if newVal, err := c.DeepCopy(in.Object); err != nil { + return err + } else if newVal == nil { + out.Object = nil + } else { + out.Object = newVal.(runtime.Object) + } return nil } -func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *conversion.Cloner) error { - out.Kind = in.Kind +func deepCopy_intstr_IntOrString(in intstr.IntOrString, out *intstr.IntOrString, c *conversion.Cloner) error { + out.Type = in.Type out.IntVal = in.IntVal out.StrVal = in.StrVal return nil @@ -2355,6 +2610,7 @@ func init() { deepCopy_unversioned_Time, deepCopy_unversioned_TypeMeta, deepCopy_v1_AWSElasticBlockStoreVolumeSource, + deepCopy_v1_AzureFileVolumeSource, deepCopy_v1_Binding, deepCopy_v1_Capabilities, deepCopy_v1_CephFSVolumeSource, @@ -2362,7 +2618,12 @@ func init() { deepCopy_v1_ComponentCondition, deepCopy_v1_ComponentStatus, deepCopy_v1_ComponentStatusList, + deepCopy_v1_ConfigMap, + deepCopy_v1_ConfigMapKeySelector, + deepCopy_v1_ConfigMapList, + deepCopy_v1_ConfigMapVolumeSource, deepCopy_v1_Container, + deepCopy_v1_ContainerImage, deepCopy_v1_ContainerPort, deepCopy_v1_ContainerState, deepCopy_v1_ContainerStateRunning, @@ -2385,15 +2646,19 @@ func init() { deepCopy_v1_EventList, deepCopy_v1_EventSource, deepCopy_v1_ExecAction, + deepCopy_v1_ExportOptions, deepCopy_v1_FCVolumeSource, + deepCopy_v1_FlexVolumeSource, deepCopy_v1_FlockerVolumeSource, deepCopy_v1_GCEPersistentDiskVolumeSource, deepCopy_v1_GitRepoVolumeSource, deepCopy_v1_GlusterfsVolumeSource, deepCopy_v1_HTTPGetAction, + deepCopy_v1_HTTPHeader, deepCopy_v1_Handler, deepCopy_v1_HostPathVolumeSource, deepCopy_v1_ISCSIVolumeSource, + deepCopy_v1_KeyToPath, deepCopy_v1_Lifecycle, deepCopy_v1_LimitRange, deepCopy_v1_LimitRangeItem, @@ -2458,6 +2723,7 @@ func init() { deepCopy_v1_ResourceRequirements, deepCopy_v1_SELinuxOptions, deepCopy_v1_Secret, + deepCopy_v1_SecretKeySelector, deepCopy_v1_SecretList, deepCopy_v1_SecretVolumeSource, deepCopy_v1_SecurityContext, @@ -2474,7 +2740,7 @@ func init() { deepCopy_v1_VolumeMount, deepCopy_v1_VolumeSource, deepCopy_runtime_RawExtension, - deepCopy_util_IntOrString, + deepCopy_intstr_IntOrString, ) if err != nil { // if one of the deep copy functions is malformed, detect it immediately. diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/defaults.go b/vendor/k8s.io/kubernetes/pkg/api/v1/defaults.go index c4a67e329..2dac9940d 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/defaults.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/defaults.go @@ -17,14 +17,22 @@ limitations under the License. package v1 import ( - "strings" - - "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" + "k8s.io/kubernetes/pkg/util/parsers" ) -func addDefaultingFuncs() { - api.Scheme.AddDefaultingFuncs( +func addDefaultingFuncs(scheme *runtime.Scheme) { + scheme.AddDefaultingFuncs( + func(obj *PodExecOptions) { + obj.Stdout = true + obj.Stderr = true + }, + func(obj *PodAttachOptions) { + obj.Stdout = true + obj.Stderr = true + }, func(obj *ReplicationController) { var labels map[string]string if obj.Spec.Template != nil { @@ -40,7 +48,7 @@ func addDefaultingFuncs() { } } if obj.Spec.Replicas == nil { - obj.Spec.Replicas = new(int) + obj.Spec.Replicas = new(int32) *obj.Spec.Replicas = 1 } }, @@ -58,10 +66,10 @@ func addDefaultingFuncs() { }, func(obj *Container) { if obj.ImagePullPolicy == "" { - // TODO(dchen1107): Move ParseImageName code to pkg/util - parts := strings.Split(obj.Image, ":") + _, tag := parsers.ParseImageName(obj.Image) // Check image tag - if parts[len(parts)-1] == "latest" { + + if tag == "latest" { obj.ImagePullPolicy = PullAlways } else { obj.ImagePullPolicy = PullIfNotPresent @@ -83,8 +91,8 @@ func addDefaultingFuncs() { if sp.Protocol == "" { sp.Protocol = ProtocolTCP } - if sp.TargetPort == util.NewIntOrStringFromInt(0) || sp.TargetPort == util.NewIntOrStringFromString("") { - sp.TargetPort = util.NewIntOrStringFromInt(sp.Port) + if sp.TargetPort == intstr.FromInt(0) || sp.TargetPort == intstr.FromString("") { + sp.TargetPort = intstr.FromInt(int(sp.Port)) } } }, @@ -128,6 +136,15 @@ func addDefaultingFuncs() { if obj.TimeoutSeconds == 0 { obj.TimeoutSeconds = 1 } + if obj.PeriodSeconds == 0 { + obj.PeriodSeconds = 10 + } + if obj.SuccessThreshold == 0 { + obj.SuccessThreshold = 1 + } + if obj.FailureThreshold == 0 { + obj.FailureThreshold = 3 + } }, func(obj *Secret) { if obj.Type == "" { @@ -147,6 +164,11 @@ func addDefaultingFuncs() { obj.Status.Phase = ClaimPending } }, + func(obj *ISCSIVolumeSource) { + if obj.ISCSIInterface == "" { + obj.ISCSIInterface = "default" + } + }, func(obj *Endpoints) { for i := range obj.Subsets { ss := &obj.Subsets[i] @@ -176,6 +198,15 @@ func addDefaultingFuncs() { obj.Spec.ExternalID = obj.Name } }, + func(obj *NodeStatus) { + if obj.Allocatable == nil && obj.Capacity != nil { + obj.Allocatable = make(ResourceList, len(obj.Capacity)) + for key, value := range obj.Capacity { + obj.Allocatable[key] = *(value.Copy()) + } + obj.Allocatable = obj.Capacity + } + }, func(obj *ObjectFieldSelector) { if obj.APIVersion == "" { obj.APIVersion = "v1" @@ -212,6 +243,11 @@ func addDefaultingFuncs() { } } }, + func(obj *ConfigMap) { + if obj.Data == nil { + obj.Data = make(map[string]string) + } + }, ) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/defaults_test.go b/vendor/k8s.io/kubernetes/pkg/api/v1/defaults_test.go index 7ce9c8efa..b1a78e758 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/defaults_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/defaults_test.go @@ -24,16 +24,17 @@ import ( "k8s.io/kubernetes/pkg/api/resource" versioned "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) func roundTrip(t *testing.T, obj runtime.Object) runtime.Object { - data, err := versioned.Codec.Encode(obj) + codec := api.Codecs.LegacyCodec(versioned.SchemeGroupVersion) + data, err := runtime.Encode(codec, obj) if err != nil { t.Errorf("%v\n %#v", err, obj) return nil } - obj2, err := api.Codec.Decode(data) + obj2, err := runtime.Decode(codec, data) if err != nil { t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj) return nil @@ -156,8 +157,8 @@ func TestSetDefaultReplicationController(t *testing.T) { } } -func newInt(val int) *int { - p := new(int) +func newInt(val int32) *int32 { + p := new(int32) *p = val return p } @@ -165,7 +166,7 @@ func newInt(val int) *int { func TestSetDefaultReplicationControllerReplicas(t *testing.T) { tests := []struct { rc versioned.ReplicationController - expectReplicas int + expectReplicas int32 }{ { rc: versioned.ReplicationController{ @@ -300,14 +301,14 @@ func TestSetDefaulServiceTargetPort(t *testing.T) { in := &versioned.Service{Spec: versioned.ServiceSpec{Ports: []versioned.ServicePort{{Port: 1234}}}} obj := roundTrip(t, runtime.Object(in)) out := obj.(*versioned.Service) - if out.Spec.Ports[0].TargetPort != util.NewIntOrStringFromInt(1234) { + if out.Spec.Ports[0].TargetPort != intstr.FromInt(1234) { t.Errorf("Expected TargetPort to be defaulted, got %v", out.Spec.Ports[0].TargetPort) } - in = &versioned.Service{Spec: versioned.ServiceSpec{Ports: []versioned.ServicePort{{Port: 1234, TargetPort: util.NewIntOrStringFromInt(5678)}}}} + in = &versioned.Service{Spec: versioned.ServiceSpec{Ports: []versioned.ServicePort{{Port: 1234, TargetPort: intstr.FromInt(5678)}}}} obj = roundTrip(t, runtime.Object(in)) out = obj.(*versioned.Service) - if out.Spec.Ports[0].TargetPort != util.NewIntOrStringFromInt(5678) { + if out.Spec.Ports[0].TargetPort != intstr.FromInt(5678) { t.Errorf("Expected TargetPort to be unchanged, got %v", out.Spec.Ports[0].TargetPort) } } @@ -316,42 +317,42 @@ func TestSetDefaultServicePort(t *testing.T) { // Unchanged if set. in := &versioned.Service{Spec: versioned.ServiceSpec{ Ports: []versioned.ServicePort{ - {Protocol: "UDP", Port: 9376, TargetPort: util.NewIntOrStringFromString("p")}, - {Protocol: "UDP", Port: 8675, TargetPort: util.NewIntOrStringFromInt(309)}, + {Protocol: "UDP", Port: 9376, TargetPort: intstr.FromString("p")}, + {Protocol: "UDP", Port: 8675, TargetPort: intstr.FromInt(309)}, }, }} out := roundTrip(t, runtime.Object(in)).(*versioned.Service) if out.Spec.Ports[0].Protocol != versioned.ProtocolUDP { t.Errorf("Expected protocol %s, got %s", versioned.ProtocolUDP, out.Spec.Ports[0].Protocol) } - if out.Spec.Ports[0].TargetPort != util.NewIntOrStringFromString("p") { + if out.Spec.Ports[0].TargetPort != intstr.FromString("p") { t.Errorf("Expected port %v, got %v", in.Spec.Ports[0].Port, out.Spec.Ports[0].TargetPort) } if out.Spec.Ports[1].Protocol != versioned.ProtocolUDP { t.Errorf("Expected protocol %s, got %s", versioned.ProtocolUDP, out.Spec.Ports[1].Protocol) } - if out.Spec.Ports[1].TargetPort != util.NewIntOrStringFromInt(309) { + if out.Spec.Ports[1].TargetPort != intstr.FromInt(309) { t.Errorf("Expected port %v, got %v", in.Spec.Ports[1].Port, out.Spec.Ports[1].TargetPort) } // Defaulted. in = &versioned.Service{Spec: versioned.ServiceSpec{ Ports: []versioned.ServicePort{ - {Protocol: "", Port: 9376, TargetPort: util.NewIntOrStringFromString("")}, - {Protocol: "", Port: 8675, TargetPort: util.NewIntOrStringFromInt(0)}, + {Protocol: "", Port: 9376, TargetPort: intstr.FromString("")}, + {Protocol: "", Port: 8675, TargetPort: intstr.FromInt(0)}, }, }} out = roundTrip(t, runtime.Object(in)).(*versioned.Service) if out.Spec.Ports[0].Protocol != versioned.ProtocolTCP { t.Errorf("Expected protocol %s, got %s", versioned.ProtocolTCP, out.Spec.Ports[0].Protocol) } - if out.Spec.Ports[0].TargetPort != util.NewIntOrStringFromInt(in.Spec.Ports[0].Port) { + if out.Spec.Ports[0].TargetPort != intstr.FromInt(int(in.Spec.Ports[0].Port)) { t.Errorf("Expected port %v, got %v", in.Spec.Ports[0].Port, out.Spec.Ports[0].TargetPort) } if out.Spec.Ports[1].Protocol != versioned.ProtocolTCP { t.Errorf("Expected protocol %s, got %s", versioned.ProtocolTCP, out.Spec.Ports[1].Protocol) } - if out.Spec.Ports[1].TargetPort != util.NewIntOrStringFromInt(in.Spec.Ports[1].Port) { + if out.Spec.Ports[1].TargetPort != intstr.FromInt(int(in.Spec.Ports[1].Port)) { t.Errorf("Expected port %v, got %v", in.Spec.Ports[1].Port, out.Spec.Ports[1].TargetPort) } } @@ -367,7 +368,7 @@ func TestSetDefaultNamespace(t *testing.T) { } func TestSetDefaultPodSpecHostNetwork(t *testing.T) { - portNum := 8080 + portNum := int32(8080) s := versioned.PodSpec{} s.HostNetwork = true s.Containers = []versioned.Container{ @@ -406,6 +407,80 @@ func TestSetDefaultNodeExternalID(t *testing.T) { } } +func TestSetDefaultNodeStatusAllocatable(t *testing.T) { + capacity := versioned.ResourceList{ + versioned.ResourceCPU: resource.MustParse("1000m"), + versioned.ResourceMemory: resource.MustParse("10G"), + } + allocatable := versioned.ResourceList{ + versioned.ResourceCPU: resource.MustParse("500m"), + versioned.ResourceMemory: resource.MustParse("5G"), + } + tests := []struct { + capacity versioned.ResourceList + allocatable versioned.ResourceList + expectedAllocatable versioned.ResourceList + }{{ // Everything set, no defaulting. + capacity: capacity, + allocatable: allocatable, + expectedAllocatable: allocatable, + }, { // Allocatable set, no defaulting. + capacity: nil, + allocatable: allocatable, + expectedAllocatable: allocatable, + }, { // Capacity set, allocatable defaults to capacity. + capacity: capacity, + allocatable: nil, + expectedAllocatable: capacity, + }, { // Nothing set, allocatable "defaults" to capacity. + capacity: nil, + allocatable: nil, + expectedAllocatable: nil, + }} + + copyResourceList := func(rl versioned.ResourceList) versioned.ResourceList { + if rl == nil { + return nil + } + copy := make(versioned.ResourceList, len(rl)) + for k, v := range rl { + copy[k] = *v.Copy() + } + return copy + } + + resourceListsEqual := func(a versioned.ResourceList, b versioned.ResourceList) bool { + if len(a) != len(b) { + return false + } + for k, v := range a { + vb, found := b[k] + if !found { + return false + } + if v.Cmp(vb) != 0 { + return false + } + } + return true + } + + for i, testcase := range tests { + node := versioned.Node{ + Status: versioned.NodeStatus{ + Capacity: copyResourceList(testcase.capacity), + Allocatable: copyResourceList(testcase.allocatable), + }, + } + node2 := roundTrip(t, runtime.Object(&node)).(*versioned.Node) + actual := node2.Status.Allocatable + expected := testcase.expectedAllocatable + if !resourceListsEqual(expected, actual) { + t.Errorf("[%d] Expected NodeStatus.Allocatable: %+v; Got: %+v", i, expected, actual) + } + } +} + func TestSetDefaultObjectFieldSelectorAPIVersion(t *testing.T) { s := versioned.PodSpec{ Containers: []versioned.Container{ @@ -545,3 +620,26 @@ func TestSetDefaultLimitRangeItem(t *testing.T) { t.Errorf("Expected request memory: %s, got: %s", "100Mi", requestMinValue.String()) } } + +func TestSetDefaultProbe(t *testing.T) { + originalProbe := versioned.Probe{} + expectedProbe := versioned.Probe{ + InitialDelaySeconds: 0, + TimeoutSeconds: 1, + PeriodSeconds: 10, + SuccessThreshold: 1, + FailureThreshold: 3, + } + + pod := &versioned.Pod{ + Spec: versioned.PodSpec{ + Containers: []versioned.Container{{LivenessProbe: &originalProbe}}, + }, + } + + output := roundTrip(t, runtime.Object(pod)).(*versioned.Pod) + actualProbe := *output.Spec.Containers[0].LivenessProbe + if actualProbe != expectedProbe { + t.Errorf("Expected probe: %+v\ngot: %+v\n", expectedProbe, actualProbe) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/register.go b/vendor/k8s.io/kubernetes/pkg/api/v1/register.go index 9957c98bf..96f407c40 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/register.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/register.go @@ -17,30 +17,26 @@ limitations under the License. package v1 import ( - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/registered" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" ) -// Codec encodes internal objects to the v1 scheme -var Codec = runtime.CodecFor(api.Scheme, "v1") +// GroupName is the group name use in this package +const GroupName = "" -func init() { - // Check if v1 is in the list of supported API versions. - if !registered.IsRegisteredAPIVersion("v1") { - return - } +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: "v1"} - // Register the API. - addKnownTypes() - addConversionFuncs() - addDefaultingFuncs() +func AddToScheme(scheme *runtime.Scheme) { + // Add the API to Scheme. + addKnownTypes(scheme) + addConversionFuncs(scheme) + addDefaultingFuncs(scheme) } // Adds the list of known types to api.Scheme. -func addKnownTypes() { - api.Scheme.AddKnownTypes("v1", +func addKnownTypes(scheme *runtime.Scheme) { + scheme.AddKnownTypes(SchemeGroupVersion, &Pod{}, &PodList{}, &PodStatusResult{}, @@ -73,6 +69,7 @@ func addKnownTypes() { &PersistentVolumeClaim{}, &PersistentVolumeClaimList{}, &DeleteOptions{}, + &ExportOptions{}, &ListOptions{}, &PodAttachOptions{}, &PodLogOptions{}, @@ -82,50 +79,55 @@ func addKnownTypes() { &ComponentStatusList{}, &SerializedReference{}, &RangeAllocation{}, + &ConfigMap{}, + &ConfigMapList{}, ) // Add common types - api.Scheme.AddKnownTypes("v1", &unversioned.Status{}) + scheme.AddKnownTypes(SchemeGroupVersion, &unversioned.Status{}) } -func (*Pod) IsAnAPIObject() {} -func (*PodList) IsAnAPIObject() {} -func (*PodStatusResult) IsAnAPIObject() {} -func (*PodTemplate) IsAnAPIObject() {} -func (*PodTemplateList) IsAnAPIObject() {} -func (*ReplicationController) IsAnAPIObject() {} -func (*ReplicationControllerList) IsAnAPIObject() {} -func (*Service) IsAnAPIObject() {} -func (*ServiceList) IsAnAPIObject() {} -func (*Endpoints) IsAnAPIObject() {} -func (*EndpointsList) IsAnAPIObject() {} -func (*Node) IsAnAPIObject() {} -func (*NodeList) IsAnAPIObject() {} -func (*Binding) IsAnAPIObject() {} -func (*Event) IsAnAPIObject() {} -func (*EventList) IsAnAPIObject() {} -func (*List) IsAnAPIObject() {} -func (*LimitRange) IsAnAPIObject() {} -func (*LimitRangeList) IsAnAPIObject() {} -func (*ResourceQuota) IsAnAPIObject() {} -func (*ResourceQuotaList) IsAnAPIObject() {} -func (*Namespace) IsAnAPIObject() {} -func (*NamespaceList) IsAnAPIObject() {} -func (*Secret) IsAnAPIObject() {} -func (*SecretList) IsAnAPIObject() {} -func (*ServiceAccount) IsAnAPIObject() {} -func (*ServiceAccountList) IsAnAPIObject() {} -func (*PersistentVolume) IsAnAPIObject() {} -func (*PersistentVolumeList) IsAnAPIObject() {} -func (*PersistentVolumeClaim) IsAnAPIObject() {} -func (*PersistentVolumeClaimList) IsAnAPIObject() {} -func (*DeleteOptions) IsAnAPIObject() {} -func (*ListOptions) IsAnAPIObject() {} -func (*PodAttachOptions) IsAnAPIObject() {} -func (*PodLogOptions) IsAnAPIObject() {} -func (*PodExecOptions) IsAnAPIObject() {} -func (*PodProxyOptions) IsAnAPIObject() {} -func (*ComponentStatus) IsAnAPIObject() {} -func (*ComponentStatusList) IsAnAPIObject() {} -func (*SerializedReference) IsAnAPIObject() {} -func (*RangeAllocation) IsAnAPIObject() {} +func (obj *Pod) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodStatusResult) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodTemplate) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodTemplateList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicationController) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicationControllerList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Service) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ServiceList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Endpoints) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *EndpointsList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Node) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *NodeList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Binding) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Event) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *EventList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *List) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *LimitRange) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *LimitRangeList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ResourceQuota) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ResourceQuotaList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Namespace) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *NamespaceList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Secret) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *SecretList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ServiceAccount) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ServiceAccountList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PersistentVolume) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PersistentVolumeList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PersistentVolumeClaim) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PersistentVolumeClaimList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DeleteOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ListOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodAttachOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodLogOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodExecOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodProxyOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ComponentStatus) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ComponentStatusList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *SerializedReference) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *RangeAllocation) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ExportOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ConfigMap) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ConfigMapList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/types.generated.go b/vendor/k8s.io/kubernetes/pkg/api/v1/types.generated.go index 514ea7ece..64344ff42 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/types.generated.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/types.generated.go @@ -29,7 +29,7 @@ import ( pkg2_unversioned "k8s.io/kubernetes/pkg/api/unversioned" pkg6_runtime "k8s.io/kubernetes/pkg/runtime" pkg1_types "k8s.io/kubernetes/pkg/types" - pkg5_util "k8s.io/kubernetes/pkg/util" + pkg5_intstr "k8s.io/kubernetes/pkg/util/intstr" "reflect" "runtime" pkg4_inf "speter.net/go/exp/math/dec/inf" @@ -37,10 +37,18 @@ import ( ) const ( - codecSelferC_UTF81234 = 1 - codecSelferC_RAW1234 = 0 + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- codecSelferValueTypeArray1234 = 10 codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 ) var ( @@ -51,10 +59,10 @@ var ( type codecSelfer1234 struct{} func init() { - if codec1978.GenVersion != 4 { + if codec1978.GenVersion != 5 { _, file, _, _ := runtime.Caller(0) err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", - 4, codec1978.GenVersion, file) + 5, codec1978.GenVersion, file) panic(err) } if false { // reference the types, but skip this branch at build/run time @@ -62,7 +70,7 @@ func init() { var v1 pkg2_unversioned.Time var v2 pkg6_runtime.RawExtension var v3 pkg1_types.UID - var v4 pkg5_util.IntOrString + var v4 pkg5_intstr.IntOrString var v5 pkg4_inf.Dec var v6 time.Time _, _, _, _, _, _, _ = v0, v1, v2, v3, v4, v5, v6 @@ -98,18 +106,21 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { yyq2[9] = x.DeletionGracePeriodSeconds != nil yyq2[10] = len(x.Labels) != 0 yyq2[11] = len(x.Annotations) != 0 + var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(12) } else { - var yynn2 int = 0 + yynn2 = 0 for _, b := range yyq2 { if b { yynn2++ } } r.EncodeMapStart(yynn2) + yynn2 = 0 } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[0] { yym4 := z.EncBinary() _ = yym4 @@ -122,7 +133,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym5 := z.EncBinary() _ = yym5 if false { @@ -132,6 +145,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[1] { yym7 := z.EncBinary() _ = yym7 @@ -144,7 +158,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("generateName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym8 := z.EncBinary() _ = yym8 if false { @@ -154,6 +170,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[2] { yym10 := z.EncBinary() _ = yym10 @@ -166,7 +183,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("namespace")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym11 := z.EncBinary() _ = yym11 if false { @@ -176,6 +195,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[3] { yym13 := z.EncBinary() _ = yym13 @@ -188,7 +208,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selfLink")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym14 := z.EncBinary() _ = yym14 if false { @@ -198,6 +220,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[4] { yym16 := z.EncBinary() _ = yym16 @@ -211,7 +234,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("uid")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym17 := z.EncBinary() _ = yym17 if false { @@ -222,6 +247,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[5] { yym19 := z.EncBinary() _ = yym19 @@ -234,7 +260,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resourceVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym20 := z.EncBinary() _ = yym20 if false { @@ -244,6 +272,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[6] { yym22 := z.EncBinary() _ = yym22 @@ -256,7 +285,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("generation")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym23 := z.EncBinary() _ = yym23 if false { @@ -266,6 +297,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[7] { yy25 := &x.CreationTimestamp yym26 := z.EncBinary() @@ -284,7 +316,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("creationTimestamp")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yy27 := &x.CreationTimestamp yym28 := z.EncBinary() _ = yym28 @@ -300,6 +334,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[8] { if x.DeletionTimestamp == nil { r.EncodeNil() @@ -321,7 +356,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("deletionTimestamp")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.DeletionTimestamp == nil { r.EncodeNil() } else { @@ -340,6 +377,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[9] { if x.DeletionGracePeriodSeconds == nil { r.EncodeNil() @@ -357,7 +395,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("deletionGracePeriodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.DeletionGracePeriodSeconds == nil { r.EncodeNil() } else { @@ -372,6 +412,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[10] { if x.Labels == nil { r.EncodeNil() @@ -388,7 +429,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("labels")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Labels == nil { r.EncodeNil() } else { @@ -402,6 +445,7 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[11] { if x.Annotations == nil { r.EncodeNil() @@ -418,7 +462,9 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("annotations")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Annotations == nil { r.EncodeNil() } else { @@ -431,8 +477,10 @@ func (x *ObjectMeta) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep2 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -442,24 +490,25 @@ func (x *ObjectMeta) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym43 := z.DecBinary() - _ = yym43 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl44 := r.ReadMapStart() - if yyl44 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl44, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl44 := r.ReadArrayStart() - if yyl44 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl44, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -471,12 +520,12 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys45Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys45Slc - var yyhl45 bool = l >= 0 - for yyj45 := 0; ; yyj45++ { - if yyhl45 { - if yyj45 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -484,9 +533,11 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys45Slc = r.DecodeBytes(yys45Slc, true, true) - yys45 := string(yys45Slc) - switch yys45 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -533,17 +584,17 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.CreationTimestamp = pkg2_unversioned.Time{} } else { - yyv53 := &x.CreationTimestamp - yym54 := z.DecBinary() - _ = yym54 + yyv11 := &x.CreationTimestamp + yym12 := z.DecBinary() + _ = yym12 if false { - } else if z.HasExtensions() && z.DecExt(yyv53) { - } else if yym54 { - z.DecBinaryUnmarshal(yyv53) - } else if !yym54 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv53) + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else if yym12 { + z.DecBinaryUnmarshal(yyv11) + } else if !yym12 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv11) } else { - z.DecFallback(yyv53, false) + z.DecFallback(yyv11, false) } } case "deletionTimestamp": @@ -555,13 +606,13 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.DeletionTimestamp == nil { x.DeletionTimestamp = new(pkg2_unversioned.Time) } - yym56 := z.DecBinary() - _ = yym56 + yym14 := z.DecBinary() + _ = yym14 if false { } else if z.HasExtensions() && z.DecExt(x.DeletionTimestamp) { - } else if yym56 { + } else if yym14 { z.DecBinaryUnmarshal(x.DeletionTimestamp) - } else if !yym56 && z.IsJSONHandle() { + } else if !yym14 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.DeletionTimestamp) } else { z.DecFallback(x.DeletionTimestamp, false) @@ -576,8 +627,8 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.DeletionGracePeriodSeconds == nil { x.DeletionGracePeriodSeconds = new(int64) } - yym58 := z.DecBinary() - _ = yym58 + yym16 := z.DecBinary() + _ = yym16 if false { } else { *((*int64)(x.DeletionGracePeriodSeconds)) = int64(r.DecodeInt(64)) @@ -587,183 +638,190 @@ func (x *ObjectMeta) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Labels = nil } else { - yyv59 := &x.Labels - yym60 := z.DecBinary() - _ = yym60 + yyv17 := &x.Labels + yym18 := z.DecBinary() + _ = yym18 if false { } else { - z.F.DecMapStringStringX(yyv59, false, d) + z.F.DecMapStringStringX(yyv17, false, d) } } case "annotations": if r.TryDecodeAsNil() { x.Annotations = nil } else { - yyv61 := &x.Annotations - yym62 := z.DecBinary() - _ = yym62 + yyv19 := &x.Annotations + yym20 := z.DecBinary() + _ = yym20 if false { } else { - z.F.DecMapStringStringX(yyv61, false, d) + z.F.DecMapStringStringX(yyv19, false, d) } } default: - z.DecStructFieldNotFound(-1, yys45) - } // end switch yys45 - } // end for yyj45 - if !yyhl45 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ObjectMeta) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj63 int - var yyb63 bool - var yyhl63 bool = l >= 0 - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + var yyj21 int + var yyb21 bool + var yyhl21 bool = l >= 0 + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.GenerateName = "" } else { x.GenerateName = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Namespace = "" } else { x.Namespace = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SelfLink = "" } else { x.SelfLink = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.UID = "" } else { x.UID = pkg1_types.UID(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ResourceVersion = "" } else { x.ResourceVersion = string(r.DecodeString()) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Generation = 0 } else { x.Generation = int64(r.DecodeInt(64)) } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.CreationTimestamp = pkg2_unversioned.Time{} } else { - yyv71 := &x.CreationTimestamp - yym72 := z.DecBinary() - _ = yym72 + yyv29 := &x.CreationTimestamp + yym30 := z.DecBinary() + _ = yym30 if false { - } else if z.HasExtensions() && z.DecExt(yyv71) { - } else if yym72 { - z.DecBinaryUnmarshal(yyv71) - } else if !yym72 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv71) + } else if z.HasExtensions() && z.DecExt(yyv29) { + } else if yym30 { + z.DecBinaryUnmarshal(yyv29) + } else if !yym30 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv29) } else { - z.DecFallback(yyv71, false) + z.DecFallback(yyv29, false) } } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.DeletionTimestamp != nil { x.DeletionTimestamp = nil @@ -772,28 +830,29 @@ func (x *ObjectMeta) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.DeletionTimestamp == nil { x.DeletionTimestamp = new(pkg2_unversioned.Time) } - yym74 := z.DecBinary() - _ = yym74 + yym32 := z.DecBinary() + _ = yym32 if false { } else if z.HasExtensions() && z.DecExt(x.DeletionTimestamp) { - } else if yym74 { + } else if yym32 { z.DecBinaryUnmarshal(x.DeletionTimestamp) - } else if !yym74 && z.IsJSONHandle() { + } else if !yym32 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.DeletionTimestamp) } else { z.DecFallback(x.DeletionTimestamp, false) } } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.DeletionGracePeriodSeconds != nil { x.DeletionGracePeriodSeconds = nil @@ -802,68 +861,71 @@ func (x *ObjectMeta) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.DeletionGracePeriodSeconds == nil { x.DeletionGracePeriodSeconds = new(int64) } - yym76 := z.DecBinary() - _ = yym76 + yym34 := z.DecBinary() + _ = yym34 if false { } else { *((*int64)(x.DeletionGracePeriodSeconds)) = int64(r.DecodeInt(64)) } } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Labels = nil } else { - yyv77 := &x.Labels - yym78 := z.DecBinary() - _ = yym78 + yyv35 := &x.Labels + yym36 := z.DecBinary() + _ = yym36 if false { } else { - z.F.DecMapStringStringX(yyv77, false, d) + z.F.DecMapStringStringX(yyv35, false, d) } } - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { - r.ReadEnd() + if yyb21 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Annotations = nil } else { - yyv79 := &x.Annotations - yym80 := z.DecBinary() - _ = yym80 + yyv37 := &x.Annotations + yym38 := z.DecBinary() + _ = yym38 if false { } else { - z.F.DecMapStringStringX(yyv79, false, d) + z.F.DecMapStringStringX(yyv37, false, d) } } for { - yyj63++ - if yyhl63 { - yyb63 = yyj63 > l + yyj21++ + if yyhl21 { + yyb21 = yyj21 > l } else { - yyb63 = r.CheckBreak() + yyb21 = r.CheckBreak() } - if yyb63 { + if yyb21 { break } - z.DecStructFieldNotFound(yyj63-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj21-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { @@ -873,70 +935,79 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym81 := z.EncBinary() - _ = yym81 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep82 := !z.EncBinary() - yy2arr82 := z.EncBasicHandle().StructToArray - var yyq82 [17]bool - _, _, _ = yysep82, yyq82, yy2arr82 - const yyr82 bool = false - yyq82[1] = x.VolumeSource.HostPath != nil && x.HostPath != nil - yyq82[2] = x.VolumeSource.EmptyDir != nil && x.EmptyDir != nil - yyq82[3] = x.VolumeSource.GCEPersistentDisk != nil && x.GCEPersistentDisk != nil - yyq82[4] = x.VolumeSource.AWSElasticBlockStore != nil && x.AWSElasticBlockStore != nil - yyq82[5] = x.VolumeSource.GitRepo != nil && x.GitRepo != nil - yyq82[6] = x.VolumeSource.Secret != nil && x.Secret != nil - yyq82[7] = x.VolumeSource.NFS != nil && x.NFS != nil - yyq82[8] = x.VolumeSource.ISCSI != nil && x.ISCSI != nil - yyq82[9] = x.VolumeSource.Glusterfs != nil && x.Glusterfs != nil - yyq82[10] = x.VolumeSource.PersistentVolumeClaim != nil && x.PersistentVolumeClaim != nil - yyq82[11] = x.VolumeSource.RBD != nil && x.RBD != nil - yyq82[12] = x.VolumeSource.Cinder != nil && x.Cinder != nil - yyq82[13] = x.VolumeSource.CephFS != nil && x.CephFS != nil - yyq82[14] = x.VolumeSource.Flocker != nil && x.Flocker != nil - yyq82[15] = x.VolumeSource.DownwardAPI != nil && x.DownwardAPI != nil - yyq82[16] = x.VolumeSource.FC != nil && x.FC != nil - if yyr82 || yy2arr82 { - r.EncodeArrayStart(17) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [20]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.VolumeSource.HostPath != nil && x.HostPath != nil + yyq2[2] = x.VolumeSource.EmptyDir != nil && x.EmptyDir != nil + yyq2[3] = x.VolumeSource.GCEPersistentDisk != nil && x.GCEPersistentDisk != nil + yyq2[4] = x.VolumeSource.AWSElasticBlockStore != nil && x.AWSElasticBlockStore != nil + yyq2[5] = x.VolumeSource.GitRepo != nil && x.GitRepo != nil + yyq2[6] = x.VolumeSource.Secret != nil && x.Secret != nil + yyq2[7] = x.VolumeSource.NFS != nil && x.NFS != nil + yyq2[8] = x.VolumeSource.ISCSI != nil && x.ISCSI != nil + yyq2[9] = x.VolumeSource.Glusterfs != nil && x.Glusterfs != nil + yyq2[10] = x.VolumeSource.PersistentVolumeClaim != nil && x.PersistentVolumeClaim != nil + yyq2[11] = x.VolumeSource.RBD != nil && x.RBD != nil + yyq2[12] = x.VolumeSource.FlexVolume != nil && x.FlexVolume != nil + yyq2[13] = x.VolumeSource.Cinder != nil && x.Cinder != nil + yyq2[14] = x.VolumeSource.CephFS != nil && x.CephFS != nil + yyq2[15] = x.VolumeSource.Flocker != nil && x.Flocker != nil + yyq2[16] = x.VolumeSource.DownwardAPI != nil && x.DownwardAPI != nil + yyq2[17] = x.VolumeSource.FC != nil && x.FC != nil + yyq2[18] = x.VolumeSource.AzureFile != nil && x.AzureFile != nil + yyq2[19] = x.VolumeSource.ConfigMap != nil && x.ConfigMap != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(20) } else { - var yynn82 int = 1 - for _, b := range yyq82 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn82++ + yynn2++ } } - r.EncodeMapStart(yynn82) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr82 || yy2arr82 { - yym84 := z.EncBinary() - _ = yym84 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym85 := z.EncBinary() - _ = yym85 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - var yyn86 bool + var yyn6 bool if x.VolumeSource.HostPath == nil { - yyn86 = true - goto LABEL86 + yyn6 = true + goto LABEL6 } - LABEL86: - if yyr82 || yy2arr82 { - if yyn86 { + LABEL6: + if yyr2 || yy2arr2 { + if yyn6 { r.EncodeNil() } else { - if yyq82[1] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.HostPath == nil { r.EncodeNil() } else { @@ -947,9 +1018,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPath")) - if yyn86 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn6 { r.EncodeNil() } else { if x.HostPath == nil { @@ -960,17 +1033,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn87 bool + var yyn9 bool if x.VolumeSource.EmptyDir == nil { - yyn87 = true - goto LABEL87 + yyn9 = true + goto LABEL9 } - LABEL87: - if yyr82 || yy2arr82 { - if yyn87 { + LABEL9: + if yyr2 || yy2arr2 { + if yyn9 { r.EncodeNil() } else { - if yyq82[2] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.EmptyDir == nil { r.EncodeNil() } else { @@ -981,9 +1055,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("emptyDir")) - if yyn87 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn9 { r.EncodeNil() } else { if x.EmptyDir == nil { @@ -994,17 +1070,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn88 bool + var yyn12 bool if x.VolumeSource.GCEPersistentDisk == nil { - yyn88 = true - goto LABEL88 + yyn12 = true + goto LABEL12 } - LABEL88: - if yyr82 || yy2arr82 { - if yyn88 { + LABEL12: + if yyr2 || yy2arr2 { + if yyn12 { r.EncodeNil() } else { - if yyq82[3] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -1015,9 +1092,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) - if yyn88 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn12 { r.EncodeNil() } else { if x.GCEPersistentDisk == nil { @@ -1028,17 +1107,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn89 bool + var yyn15 bool if x.VolumeSource.AWSElasticBlockStore == nil { - yyn89 = true - goto LABEL89 + yyn15 = true + goto LABEL15 } - LABEL89: - if yyr82 || yy2arr82 { - if yyn89 { + LABEL15: + if yyr2 || yy2arr2 { + if yyn15 { r.EncodeNil() } else { - if yyq82[4] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -1049,9 +1129,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) - if yyn89 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn15 { r.EncodeNil() } else { if x.AWSElasticBlockStore == nil { @@ -1062,17 +1144,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn90 bool + var yyn18 bool if x.VolumeSource.GitRepo == nil { - yyn90 = true - goto LABEL90 + yyn18 = true + goto LABEL18 } - LABEL90: - if yyr82 || yy2arr82 { - if yyn90 { + LABEL18: + if yyr2 || yy2arr2 { + if yyn18 { r.EncodeNil() } else { - if yyq82[5] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.GitRepo == nil { r.EncodeNil() } else { @@ -1083,9 +1166,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gitRepo")) - if yyn90 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn18 { r.EncodeNil() } else { if x.GitRepo == nil { @@ -1096,17 +1181,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn91 bool + var yyn21 bool if x.VolumeSource.Secret == nil { - yyn91 = true - goto LABEL91 + yyn21 = true + goto LABEL21 } - LABEL91: - if yyr82 || yy2arr82 { - if yyn91 { + LABEL21: + if yyr2 || yy2arr2 { + if yyn21 { r.EncodeNil() } else { - if yyq82[6] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.Secret == nil { r.EncodeNil() } else { @@ -1117,9 +1203,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secret")) - if yyn91 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn21 { r.EncodeNil() } else { if x.Secret == nil { @@ -1130,17 +1218,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn92 bool + var yyn24 bool if x.VolumeSource.NFS == nil { - yyn92 = true - goto LABEL92 + yyn24 = true + goto LABEL24 } - LABEL92: - if yyr82 || yy2arr82 { - if yyn92 { + LABEL24: + if yyr2 || yy2arr2 { + if yyn24 { r.EncodeNil() } else { - if yyq82[7] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { if x.NFS == nil { r.EncodeNil() } else { @@ -1151,9 +1240,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nfs")) - if yyn92 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn24 { r.EncodeNil() } else { if x.NFS == nil { @@ -1164,17 +1255,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn93 bool + var yyn27 bool if x.VolumeSource.ISCSI == nil { - yyn93 = true - goto LABEL93 + yyn27 = true + goto LABEL27 } - LABEL93: - if yyr82 || yy2arr82 { - if yyn93 { + LABEL27: + if yyr2 || yy2arr2 { + if yyn27 { r.EncodeNil() } else { - if yyq82[8] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { if x.ISCSI == nil { r.EncodeNil() } else { @@ -1185,9 +1277,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[8] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("iscsi")) - if yyn93 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn27 { r.EncodeNil() } else { if x.ISCSI == nil { @@ -1198,17 +1292,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn94 bool + var yyn30 bool if x.VolumeSource.Glusterfs == nil { - yyn94 = true - goto LABEL94 + yyn30 = true + goto LABEL30 } - LABEL94: - if yyr82 || yy2arr82 { - if yyn94 { + LABEL30: + if yyr2 || yy2arr2 { + if yyn30 { r.EncodeNil() } else { - if yyq82[9] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { if x.Glusterfs == nil { r.EncodeNil() } else { @@ -1219,9 +1314,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[9] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) - if yyn94 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn30 { r.EncodeNil() } else { if x.Glusterfs == nil { @@ -1232,17 +1329,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn95 bool + var yyn33 bool if x.VolumeSource.PersistentVolumeClaim == nil { - yyn95 = true - goto LABEL95 + yyn33 = true + goto LABEL33 } - LABEL95: - if yyr82 || yy2arr82 { - if yyn95 { + LABEL33: + if yyr2 || yy2arr2 { + if yyn33 { r.EncodeNil() } else { - if yyq82[10] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { if x.PersistentVolumeClaim == nil { r.EncodeNil() } else { @@ -1253,9 +1351,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[10] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("persistentVolumeClaim")) - if yyn95 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn33 { r.EncodeNil() } else { if x.PersistentVolumeClaim == nil { @@ -1266,17 +1366,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn96 bool + var yyn36 bool if x.VolumeSource.RBD == nil { - yyn96 = true - goto LABEL96 + yyn36 = true + goto LABEL36 } - LABEL96: - if yyr82 || yy2arr82 { - if yyn96 { + LABEL36: + if yyr2 || yy2arr2 { + if yyn36 { r.EncodeNil() } else { - if yyq82[11] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { if x.RBD == nil { r.EncodeNil() } else { @@ -1287,9 +1388,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[11] { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rbd")) - if yyn96 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn36 { r.EncodeNil() } else { if x.RBD == nil { @@ -1300,17 +1403,55 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn97 bool + var yyn39 bool + if x.VolumeSource.FlexVolume == nil { + yyn39 = true + goto LABEL39 + } + LABEL39: + if yyr2 || yy2arr2 { + if yyn39 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flexVolume")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn39 { + r.EncodeNil() + } else { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } + } + } + var yyn42 bool if x.VolumeSource.Cinder == nil { - yyn97 = true - goto LABEL97 + yyn42 = true + goto LABEL42 } - LABEL97: - if yyr82 || yy2arr82 { - if yyn97 { + LABEL42: + if yyr2 || yy2arr2 { + if yyn42 { r.EncodeNil() } else { - if yyq82[12] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[13] { if x.Cinder == nil { r.EncodeNil() } else { @@ -1321,9 +1462,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[12] { + if yyq2[13] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cinder")) - if yyn97 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn42 { r.EncodeNil() } else { if x.Cinder == nil { @@ -1334,17 +1477,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn98 bool + var yyn45 bool if x.VolumeSource.CephFS == nil { - yyn98 = true - goto LABEL98 + yyn45 = true + goto LABEL45 } - LABEL98: - if yyr82 || yy2arr82 { - if yyn98 { + LABEL45: + if yyr2 || yy2arr2 { + if yyn45 { r.EncodeNil() } else { - if yyq82[13] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { if x.CephFS == nil { r.EncodeNil() } else { @@ -1355,9 +1499,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[13] { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cephfs")) - if yyn98 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn45 { r.EncodeNil() } else { if x.CephFS == nil { @@ -1368,17 +1514,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn99 bool + var yyn48 bool if x.VolumeSource.Flocker == nil { - yyn99 = true - goto LABEL99 + yyn48 = true + goto LABEL48 } - LABEL99: - if yyr82 || yy2arr82 { - if yyn99 { + LABEL48: + if yyr2 || yy2arr2 { + if yyn48 { r.EncodeNil() } else { - if yyq82[14] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[15] { if x.Flocker == nil { r.EncodeNil() } else { @@ -1389,9 +1536,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[14] { + if yyq2[15] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("flocker")) - if yyn99 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn48 { r.EncodeNil() } else { if x.Flocker == nil { @@ -1402,17 +1551,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn100 bool + var yyn51 bool if x.VolumeSource.DownwardAPI == nil { - yyn100 = true - goto LABEL100 + yyn51 = true + goto LABEL51 } - LABEL100: - if yyr82 || yy2arr82 { - if yyn100 { + LABEL51: + if yyr2 || yy2arr2 { + if yyn51 { r.EncodeNil() } else { - if yyq82[15] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[16] { if x.DownwardAPI == nil { r.EncodeNil() } else { @@ -1423,9 +1573,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[15] { + if yyq2[16] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("downwardAPI")) - if yyn100 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn51 { r.EncodeNil() } else { if x.DownwardAPI == nil { @@ -1436,17 +1588,18 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn101 bool + var yyn54 bool if x.VolumeSource.FC == nil { - yyn101 = true - goto LABEL101 + yyn54 = true + goto LABEL54 } - LABEL101: - if yyr82 || yy2arr82 { - if yyn101 { + LABEL54: + if yyr2 || yy2arr2 { + if yyn54 { r.EncodeNil() } else { - if yyq82[16] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[17] { if x.FC == nil { r.EncodeNil() } else { @@ -1457,9 +1610,11 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq82[16] { + if yyq2[17] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fc")) - if yyn101 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn54 { r.EncodeNil() } else { if x.FC == nil { @@ -1470,8 +1625,84 @@ func (x *Volume) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep82 { - r.EncodeEnd() + var yyn57 bool + if x.VolumeSource.AzureFile == nil { + yyn57 = true + goto LABEL57 + } + LABEL57: + if yyr2 || yy2arr2 { + if yyn57 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[18] { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[18] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("azureFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn57 { + r.EncodeNil() + } else { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } + } + } + var yyn60 bool + if x.VolumeSource.ConfigMap == nil { + yyn60 = true + goto LABEL60 + } + LABEL60: + if yyr2 || yy2arr2 { + if yyn60 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[19] { + if x.ConfigMap == nil { + r.EncodeNil() + } else { + x.ConfigMap.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[19] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("configMap")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn60 { + r.EncodeNil() + } else { + if x.ConfigMap == nil { + r.EncodeNil() + } else { + x.ConfigMap.CodecEncodeSelf(e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1481,24 +1712,25 @@ func (x *Volume) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym102 := z.DecBinary() - _ = yym102 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl103 := r.ReadMapStart() - if yyl103 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl103, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl103 := r.ReadArrayStart() - if yyl103 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl103, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1510,12 +1742,12 @@ func (x *Volume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys104Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys104Slc - var yyhl104 bool = l >= 0 - for yyj104 := 0; ; yyj104++ { - if yyhl104 { - if yyj104 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1523,9 +1755,11 @@ func (x *Volume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys104Slc = r.DecodeBytes(yys104Slc, true, true) - yys104 := string(yys104Slc) - switch yys104 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -1686,6 +1920,20 @@ func (x *Volume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.RBD.CodecDecodeSelf(d) } + case "flexVolume": + if x.VolumeSource.FlexVolume == nil { + x.VolumeSource.FlexVolume = new(FlexVolumeSource) + } + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } case "cinder": if x.VolumeSource.Cinder == nil { x.VolumeSource.Cinder = new(CinderVolumeSource) @@ -1756,47 +2004,78 @@ func (x *Volume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.FC.CodecDecodeSelf(d) } + case "azureFile": + if x.VolumeSource.AzureFile == nil { + x.VolumeSource.AzureFile = new(AzureFileVolumeSource) + } + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil + } + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + case "configMap": + if x.VolumeSource.ConfigMap == nil { + x.VolumeSource.ConfigMap = new(ConfigMapVolumeSource) + } + if r.TryDecodeAsNil() { + if x.ConfigMap != nil { + x.ConfigMap = nil + } + } else { + if x.ConfigMap == nil { + x.ConfigMap = new(ConfigMapVolumeSource) + } + x.ConfigMap.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys104) - } // end switch yys104 - } // end for yyj104 - if !yyhl104 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj122 int - var yyb122 bool - var yyhl122 bool = l >= 0 - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l + var yyj24 int + var yyb24 bool + var yyhl24 bool = l >= 0 + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l } else { - yyb122 = r.CheckBreak() + yyb24 = r.CheckBreak() } - if yyb122 { - r.ReadEnd() + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.HostPath == nil { + x.VolumeSource.HostPath = new(HostPathVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HostPath != nil { x.HostPath = nil @@ -1807,16 +2086,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.HostPath.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.EmptyDir == nil { + x.VolumeSource.EmptyDir = new(EmptyDirVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.EmptyDir != nil { x.EmptyDir = nil @@ -1827,16 +2110,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.EmptyDir.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.GCEPersistentDisk == nil { + x.VolumeSource.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GCEPersistentDisk != nil { x.GCEPersistentDisk = nil @@ -1847,16 +2134,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.GCEPersistentDisk.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.AWSElasticBlockStore == nil { + x.VolumeSource.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.AWSElasticBlockStore != nil { x.AWSElasticBlockStore = nil @@ -1867,16 +2158,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.AWSElasticBlockStore.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.GitRepo == nil { + x.VolumeSource.GitRepo = new(GitRepoVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GitRepo != nil { x.GitRepo = nil @@ -1887,16 +2182,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.GitRepo.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.Secret == nil { + x.VolumeSource.Secret = new(SecretVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Secret != nil { x.Secret = nil @@ -1907,16 +2206,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Secret.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.NFS == nil { + x.VolumeSource.NFS = new(NFSVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.NFS != nil { x.NFS = nil @@ -1927,16 +2230,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.NFS.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.ISCSI == nil { + x.VolumeSource.ISCSI = new(ISCSIVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ISCSI != nil { x.ISCSI = nil @@ -1947,16 +2254,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.ISCSI.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.Glusterfs == nil { + x.VolumeSource.Glusterfs = new(GlusterfsVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Glusterfs != nil { x.Glusterfs = nil @@ -1967,16 +2278,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Glusterfs.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.PersistentVolumeClaim == nil { + x.VolumeSource.PersistentVolumeClaim = new(PersistentVolumeClaimVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.PersistentVolumeClaim != nil { x.PersistentVolumeClaim = nil @@ -1987,16 +2302,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.PersistentVolumeClaim.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.RBD == nil { + x.VolumeSource.RBD = new(RBDVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RBD != nil { x.RBD = nil @@ -2007,16 +2326,44 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.RBD.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.FlexVolume == nil { + x.VolumeSource.FlexVolume = new(FlexVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } + if x.VolumeSource.Cinder == nil { + x.VolumeSource.Cinder = new(CinderVolumeSource) + } + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Cinder != nil { x.Cinder = nil @@ -2027,16 +2374,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Cinder.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.CephFS == nil { + x.VolumeSource.CephFS = new(CephFSVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CephFS != nil { x.CephFS = nil @@ -2047,16 +2398,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.CephFS.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.Flocker == nil { + x.VolumeSource.Flocker = new(FlockerVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Flocker != nil { x.Flocker = nil @@ -2067,16 +2422,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Flocker.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.DownwardAPI == nil { + x.VolumeSource.DownwardAPI = new(DownwardAPIVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.DownwardAPI != nil { x.DownwardAPI = nil @@ -2087,16 +2446,20 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.DownwardAPI.CodecDecodeSelf(d) } - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.FC == nil { + x.VolumeSource.FC = new(FCVolumeSource) } - if yyb122 { - r.ReadEnd() + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.FC != nil { x.FC = nil @@ -2107,19 +2470,68 @@ func (x *Volume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.FC.CodecDecodeSelf(d) } - for { - yyj122++ - if yyhl122 { - yyb122 = yyj122 > l - } else { - yyb122 = r.CheckBreak() + if x.VolumeSource.AzureFile == nil { + x.VolumeSource.AzureFile = new(AzureFileVolumeSource) + } + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil } - if yyb122 { + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + if x.VolumeSource.ConfigMap == nil { + x.VolumeSource.ConfigMap = new(ConfigMapVolumeSource) + } + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ConfigMap != nil { + x.ConfigMap = nil + } + } else { + if x.ConfigMap == nil { + x.ConfigMap = new(ConfigMapVolumeSource) + } + x.ConfigMap.CodecDecodeSelf(d) + } + for { + yyj24++ + if yyhl24 { + yyb24 = yyj24 > l + } else { + yyb24 = r.CheckBreak() + } + if yyb24 { break } - z.DecStructFieldNotFound(yyj122-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj24-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -2129,45 +2541,51 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym140 := z.EncBinary() - _ = yym140 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep141 := !z.EncBinary() - yy2arr141 := z.EncBasicHandle().StructToArray - var yyq141 [16]bool - _, _, _ = yysep141, yyq141, yy2arr141 - const yyr141 bool = false - yyq141[0] = x.HostPath != nil - yyq141[1] = x.EmptyDir != nil - yyq141[2] = x.GCEPersistentDisk != nil - yyq141[3] = x.AWSElasticBlockStore != nil - yyq141[4] = x.GitRepo != nil - yyq141[5] = x.Secret != nil - yyq141[6] = x.NFS != nil - yyq141[7] = x.ISCSI != nil - yyq141[8] = x.Glusterfs != nil - yyq141[9] = x.PersistentVolumeClaim != nil - yyq141[10] = x.RBD != nil - yyq141[11] = x.Cinder != nil - yyq141[12] = x.CephFS != nil - yyq141[13] = x.Flocker != nil - yyq141[14] = x.DownwardAPI != nil - yyq141[15] = x.FC != nil - if yyr141 || yy2arr141 { - r.EncodeArrayStart(16) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [19]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.HostPath != nil + yyq2[1] = x.EmptyDir != nil + yyq2[2] = x.GCEPersistentDisk != nil + yyq2[3] = x.AWSElasticBlockStore != nil + yyq2[4] = x.GitRepo != nil + yyq2[5] = x.Secret != nil + yyq2[6] = x.NFS != nil + yyq2[7] = x.ISCSI != nil + yyq2[8] = x.Glusterfs != nil + yyq2[9] = x.PersistentVolumeClaim != nil + yyq2[10] = x.RBD != nil + yyq2[11] = x.FlexVolume != nil + yyq2[12] = x.Cinder != nil + yyq2[13] = x.CephFS != nil + yyq2[14] = x.Flocker != nil + yyq2[15] = x.DownwardAPI != nil + yyq2[16] = x.FC != nil + yyq2[17] = x.AzureFile != nil + yyq2[18] = x.ConfigMap != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(19) } else { - var yynn141 int = 0 - for _, b := range yyq141 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn141++ + yynn2++ } } - r.EncodeMapStart(yynn141) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr141 || yy2arr141 { - if yyq141[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.HostPath == nil { r.EncodeNil() } else { @@ -2177,8 +2595,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.HostPath == nil { r.EncodeNil() } else { @@ -2186,8 +2606,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.EmptyDir == nil { r.EncodeNil() } else { @@ -2197,8 +2618,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("emptyDir")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.EmptyDir == nil { r.EncodeNil() } else { @@ -2206,8 +2629,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -2217,8 +2641,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -2226,8 +2652,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -2237,8 +2664,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -2246,8 +2675,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.GitRepo == nil { r.EncodeNil() } else { @@ -2257,8 +2687,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gitRepo")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.GitRepo == nil { r.EncodeNil() } else { @@ -2266,8 +2698,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.Secret == nil { r.EncodeNil() } else { @@ -2277,8 +2710,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secret")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Secret == nil { r.EncodeNil() } else { @@ -2286,8 +2721,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.NFS == nil { r.EncodeNil() } else { @@ -2297,8 +2733,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.NFS == nil { r.EncodeNil() } else { @@ -2306,8 +2744,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[7] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { if x.ISCSI == nil { r.EncodeNil() } else { @@ -2317,8 +2756,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("iscsi")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ISCSI == nil { r.EncodeNil() } else { @@ -2326,8 +2767,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[8] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { if x.Glusterfs == nil { r.EncodeNil() } else { @@ -2337,8 +2779,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[8] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Glusterfs == nil { r.EncodeNil() } else { @@ -2346,8 +2790,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[9] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { if x.PersistentVolumeClaim == nil { r.EncodeNil() } else { @@ -2357,8 +2802,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[9] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("persistentVolumeClaim")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.PersistentVolumeClaim == nil { r.EncodeNil() } else { @@ -2366,8 +2813,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[10] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { if x.RBD == nil { r.EncodeNil() } else { @@ -2377,8 +2825,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[10] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rbd")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RBD == nil { r.EncodeNil() } else { @@ -2386,8 +2836,32 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[11] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flexVolume")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { if x.Cinder == nil { r.EncodeNil() } else { @@ -2397,8 +2871,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[11] { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cinder")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Cinder == nil { r.EncodeNil() } else { @@ -2406,8 +2882,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[12] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[13] { if x.CephFS == nil { r.EncodeNil() } else { @@ -2417,8 +2894,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[12] { + if yyq2[13] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cephfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CephFS == nil { r.EncodeNil() } else { @@ -2426,8 +2905,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[13] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { if x.Flocker == nil { r.EncodeNil() } else { @@ -2437,8 +2917,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[13] { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("flocker")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Flocker == nil { r.EncodeNil() } else { @@ -2446,8 +2928,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[14] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[15] { if x.DownwardAPI == nil { r.EncodeNil() } else { @@ -2457,8 +2940,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[14] { + if yyq2[15] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("downwardAPI")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.DownwardAPI == nil { r.EncodeNil() } else { @@ -2466,8 +2951,9 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr141 || yy2arr141 { - if yyq141[15] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[16] { if x.FC == nil { r.EncodeNil() } else { @@ -2477,8 +2963,10 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq141[15] { + if yyq2[16] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fc")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.FC == nil { r.EncodeNil() } else { @@ -2486,8 +2974,56 @@ func (x *VolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep141 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[17] { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[17] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("azureFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[18] { + if x.ConfigMap == nil { + r.EncodeNil() + } else { + x.ConfigMap.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[18] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("configMap")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ConfigMap == nil { + r.EncodeNil() + } else { + x.ConfigMap.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -2497,24 +3033,25 @@ func (x *VolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym158 := z.DecBinary() - _ = yym158 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl159 := r.ReadMapStart() - if yyl159 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl159, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl159 := r.ReadArrayStart() - if yyl159 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl159, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -2526,12 +3063,12 @@ func (x *VolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys160Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys160Slc - var yyhl160 bool = l >= 0 - for yyj160 := 0; ; yyj160++ { - if yyhl160 { - if yyj160 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -2539,9 +3076,11 @@ func (x *VolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys160Slc = r.DecodeBytes(yys160Slc, true, true) - yys160 := string(yys160Slc) - switch yys160 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "hostPath": if r.TryDecodeAsNil() { if x.HostPath != nil { @@ -2663,6 +3202,17 @@ func (x *VolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.RBD.CodecDecodeSelf(d) } + case "flexVolume": + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } case "cinder": if r.TryDecodeAsNil() { if x.Cinder != nil { @@ -2718,32 +3268,53 @@ func (x *VolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.FC.CodecDecodeSelf(d) } + case "azureFile": + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil + } + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + case "configMap": + if r.TryDecodeAsNil() { + if x.ConfigMap != nil { + x.ConfigMap = nil + } + } else { + if x.ConfigMap == nil { + x.ConfigMap = new(ConfigMapVolumeSource) + } + x.ConfigMap.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys160) - } // end switch yys160 - } // end for yyj160 - if !yyhl160 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj177 int - var yyb177 bool - var yyhl177 bool = l >= 0 - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + var yyj23 int + var yyb23 bool + var yyhl23 bool = l >= 0 + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HostPath != nil { x.HostPath = nil @@ -2754,16 +3325,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.HostPath.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.EmptyDir != nil { x.EmptyDir = nil @@ -2774,16 +3346,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.EmptyDir.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GCEPersistentDisk != nil { x.GCEPersistentDisk = nil @@ -2794,16 +3367,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.GCEPersistentDisk.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.AWSElasticBlockStore != nil { x.AWSElasticBlockStore = nil @@ -2814,16 +3388,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.AWSElasticBlockStore.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GitRepo != nil { x.GitRepo = nil @@ -2834,16 +3409,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.GitRepo.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Secret != nil { x.Secret = nil @@ -2854,16 +3430,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Secret.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.NFS != nil { x.NFS = nil @@ -2874,16 +3451,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.NFS.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ISCSI != nil { x.ISCSI = nil @@ -2894,16 +3472,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.ISCSI.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Glusterfs != nil { x.Glusterfs = nil @@ -2914,16 +3493,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Glusterfs.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.PersistentVolumeClaim != nil { x.PersistentVolumeClaim = nil @@ -2934,16 +3514,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.PersistentVolumeClaim.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RBD != nil { x.RBD = nil @@ -2954,16 +3535,38 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.RBD.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Cinder != nil { x.Cinder = nil @@ -2974,16 +3577,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Cinder.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CephFS != nil { x.CephFS = nil @@ -2994,16 +3598,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.CephFS.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Flocker != nil { x.Flocker = nil @@ -3014,16 +3619,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Flocker.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.DownwardAPI != nil { x.DownwardAPI = nil @@ -3034,16 +3640,17 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.DownwardAPI.CodecDecodeSelf(d) } - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l } else { - yyb177 = r.CheckBreak() + yyb23 = r.CheckBreak() } - if yyb177 { - r.ReadEnd() + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.FC != nil { x.FC = nil @@ -3054,19 +3661,62 @@ func (x *VolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.FC.CodecDecodeSelf(d) } - for { - yyj177++ - if yyhl177 { - yyb177 = yyj177 > l - } else { - yyb177 = r.CheckBreak() + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil } - if yyb177 { + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ConfigMap != nil { + x.ConfigMap = nil + } + } else { + if x.ConfigMap == nil { + x.ConfigMap = new(ConfigMapVolumeSource) + } + x.ConfigMap.CodecDecodeSelf(d) + } + for { + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { break } - z.DecStructFieldNotFound(yyj177-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj23-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaimVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3076,48 +3726,54 @@ func (x *PersistentVolumeClaimVolumeSource) CodecEncodeSelf(e *codec1978.Encoder if x == nil { r.EncodeNil() } else { - yym194 := z.EncBinary() - _ = yym194 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep195 := !z.EncBinary() - yy2arr195 := z.EncBasicHandle().StructToArray - var yyq195 [2]bool - _, _, _ = yysep195, yyq195, yy2arr195 - const yyr195 bool = false - yyq195[1] = x.ReadOnly != false - if yyr195 || yy2arr195 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn195 int = 1 - for _, b := range yyq195 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn195++ + yynn2++ } } - r.EncodeMapStart(yynn195) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr195 || yy2arr195 { - yym197 := z.EncBinary() - _ = yym197 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ClaimName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("claimName")) - yym198 := z.EncBinary() - _ = yym198 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ClaimName)) } } - if yyr195 || yy2arr195 { - if yyq195[1] { - yym200 := z.EncBinary() - _ = yym200 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -3126,18 +3782,22 @@ func (x *PersistentVolumeClaimVolumeSource) CodecEncodeSelf(e *codec1978.Encoder r.EncodeBool(false) } } else { - if yyq195[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym201 := z.EncBinary() - _ = yym201 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep195 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -3147,24 +3807,25 @@ func (x *PersistentVolumeClaimVolumeSource) CodecDecodeSelf(d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym202 := z.DecBinary() - _ = yym202 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl203 := r.ReadMapStart() - if yyl203 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl203, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl203 := r.ReadArrayStart() - if yyl203 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl203, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3176,12 +3837,12 @@ func (x *PersistentVolumeClaimVolumeSource) codecDecodeSelfFromMap(l int, d *cod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys204Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys204Slc - var yyhl204 bool = l >= 0 - for yyj204 := 0; ; yyj204++ { - if yyhl204 { - if yyj204 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3189,9 +3850,11 @@ func (x *PersistentVolumeClaimVolumeSource) codecDecodeSelfFromMap(l int, d *cod break } } - yys204Slc = r.DecodeBytes(yys204Slc, true, true) - yys204 := string(yys204Slc) - switch yys204 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "claimName": if r.TryDecodeAsNil() { x.ClaimName = "" @@ -3205,64 +3868,65 @@ func (x *PersistentVolumeClaimVolumeSource) codecDecodeSelfFromMap(l int, d *cod x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys204) - } // end switch yys204 - } // end for yyj204 - if !yyhl204 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaimVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj207 int - var yyb207 bool - var yyhl207 bool = l >= 0 - yyj207++ - if yyhl207 { - yyb207 = yyj207 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb207 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb207 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ClaimName = "" } else { x.ClaimName = string(r.DecodeString()) } - yyj207++ - if yyhl207 { - yyb207 = yyj207 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb207 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb207 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj207++ - if yyhl207 { - yyb207 = yyj207 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb207 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb207 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj207-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3272,40 +3936,45 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym210 := z.EncBinary() - _ = yym210 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep211 := !z.EncBinary() - yy2arr211 := z.EncBasicHandle().StructToArray - var yyq211 [11]bool - _, _, _ = yysep211, yyq211, yy2arr211 - const yyr211 bool = false - yyq211[0] = x.GCEPersistentDisk != nil - yyq211[1] = x.AWSElasticBlockStore != nil - yyq211[2] = x.HostPath != nil - yyq211[3] = x.Glusterfs != nil - yyq211[4] = x.NFS != nil - yyq211[5] = x.RBD != nil - yyq211[6] = x.ISCSI != nil - yyq211[7] = x.Cinder != nil - yyq211[8] = x.CephFS != nil - yyq211[9] = x.FC != nil - yyq211[10] = x.Flocker != nil - if yyr211 || yy2arr211 { - r.EncodeArrayStart(11) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [13]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.GCEPersistentDisk != nil + yyq2[1] = x.AWSElasticBlockStore != nil + yyq2[2] = x.HostPath != nil + yyq2[3] = x.Glusterfs != nil + yyq2[4] = x.NFS != nil + yyq2[5] = x.RBD != nil + yyq2[6] = x.ISCSI != nil + yyq2[7] = x.Cinder != nil + yyq2[8] = x.CephFS != nil + yyq2[9] = x.FC != nil + yyq2[10] = x.Flocker != nil + yyq2[11] = x.FlexVolume != nil + yyq2[12] = x.AzureFile != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(13) } else { - var yynn211 int = 0 - for _, b := range yyq211 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn211++ + yynn2++ } } - r.EncodeMapStart(yynn211) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr211 || yy2arr211 { - if yyq211[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -3315,8 +3984,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.GCEPersistentDisk == nil { r.EncodeNil() } else { @@ -3324,8 +3995,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -3335,8 +4007,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AWSElasticBlockStore == nil { r.EncodeNil() } else { @@ -3344,8 +4018,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.HostPath == nil { r.EncodeNil() } else { @@ -3355,8 +4030,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.HostPath == nil { r.EncodeNil() } else { @@ -3364,8 +4041,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.Glusterfs == nil { r.EncodeNil() } else { @@ -3375,8 +4053,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Glusterfs == nil { r.EncodeNil() } else { @@ -3384,8 +4064,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.NFS == nil { r.EncodeNil() } else { @@ -3395,8 +4076,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.NFS == nil { r.EncodeNil() } else { @@ -3404,8 +4087,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.RBD == nil { r.EncodeNil() } else { @@ -3415,8 +4099,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rbd")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RBD == nil { r.EncodeNil() } else { @@ -3424,8 +4110,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.ISCSI == nil { r.EncodeNil() } else { @@ -3435,8 +4122,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("iscsi")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ISCSI == nil { r.EncodeNil() } else { @@ -3444,8 +4133,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[7] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { if x.Cinder == nil { r.EncodeNil() } else { @@ -3455,8 +4145,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cinder")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Cinder == nil { r.EncodeNil() } else { @@ -3464,8 +4156,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[8] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { if x.CephFS == nil { r.EncodeNil() } else { @@ -3475,8 +4168,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[8] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cephfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CephFS == nil { r.EncodeNil() } else { @@ -3484,8 +4179,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[9] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { if x.FC == nil { r.EncodeNil() } else { @@ -3495,8 +4191,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[9] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fc")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.FC == nil { r.EncodeNil() } else { @@ -3504,8 +4202,9 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr211 || yy2arr211 { - if yyq211[10] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { if x.Flocker == nil { r.EncodeNil() } else { @@ -3515,8 +4214,10 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq211[10] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("flocker")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Flocker == nil { r.EncodeNil() } else { @@ -3524,8 +4225,56 @@ func (x *PersistentVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep211 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flexVolume")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("azureFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -3535,24 +4284,25 @@ func (x *PersistentVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym223 := z.DecBinary() - _ = yym223 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl224 := r.ReadMapStart() - if yyl224 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl224, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl224 := r.ReadArrayStart() - if yyl224 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl224, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3564,12 +4314,12 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Deco var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys225Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys225Slc - var yyhl225 bool = l >= 0 - for yyj225 := 0; ; yyj225++ { - if yyhl225 { - if yyj225 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3577,9 +4327,11 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Deco break } } - yys225Slc = r.DecodeBytes(yys225Slc, true, true) - yys225 := string(yys225Slc) - switch yys225 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "gcePersistentDisk": if r.TryDecodeAsNil() { if x.GCEPersistentDisk != nil { @@ -3701,32 +4453,53 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Deco } x.Flocker.CodecDecodeSelf(d) } + case "flexVolume": + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } + case "azureFile": + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil + } + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys225) - } // end switch yys225 - } // end for yyj225 - if !yyhl225 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj237 int - var yyb237 bool - var yyhl237 bool = l >= 0 - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + var yyj17 int + var yyb17 bool + var yyhl17 bool = l >= 0 + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GCEPersistentDisk != nil { x.GCEPersistentDisk = nil @@ -3737,16 +4510,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.GCEPersistentDisk.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.AWSElasticBlockStore != nil { x.AWSElasticBlockStore = nil @@ -3757,16 +4531,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.AWSElasticBlockStore.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HostPath != nil { x.HostPath = nil @@ -3777,16 +4552,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.HostPath.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Glusterfs != nil { x.Glusterfs = nil @@ -3797,16 +4573,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.Glusterfs.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.NFS != nil { x.NFS = nil @@ -3817,16 +4594,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.NFS.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RBD != nil { x.RBD = nil @@ -3837,16 +4615,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.RBD.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ISCSI != nil { x.ISCSI = nil @@ -3857,16 +4636,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.ISCSI.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Cinder != nil { x.Cinder = nil @@ -3877,16 +4657,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.Cinder.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CephFS != nil { x.CephFS = nil @@ -3897,16 +4678,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.CephFS.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.FC != nil { x.FC = nil @@ -3917,16 +4699,17 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.FC.CodecDecodeSelf(d) } - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb237 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb237 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Flocker != nil { x.Flocker = nil @@ -3937,19 +4720,62 @@ func (x *PersistentVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.De } x.Flocker.CodecDecodeSelf(d) } - for { - yyj237++ - if yyhl237 { - yyb237 = yyj237 > l - } else { - yyb237 = r.CheckBreak() + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil } - if yyb237 { + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil + } + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + for { + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { break } - z.DecStructFieldNotFound(yyj237-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj17-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolume) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3959,120 +4785,139 @@ func (x *PersistentVolume) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym249 := z.EncBinary() - _ = yym249 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep250 := !z.EncBinary() - yy2arr250 := z.EncBasicHandle().StructToArray - var yyq250 [5]bool - _, _, _ = yysep250, yyq250, yy2arr250 - const yyr250 bool = false - yyq250[0] = x.Kind != "" - yyq250[1] = x.APIVersion != "" - yyq250[2] = true - yyq250[3] = true - yyq250[4] = true - if yyr250 || yy2arr250 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn250 int = 0 - for _, b := range yyq250 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn250++ + yynn2++ } } - r.EncodeMapStart(yynn250) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr250 || yy2arr250 { - if yyq250[0] { - yym252 := z.EncBinary() - _ = yym252 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq250[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym253 := z.EncBinary() - _ = yym253 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr250 || yy2arr250 { - if yyq250[1] { - yym255 := z.EncBinary() - _ = yym255 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq250[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym256 := z.EncBinary() - _ = yym256 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr250 || yy2arr250 { - if yyq250[2] { - yy258 := &x.ObjectMeta - yy258.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq250[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy259 := &x.ObjectMeta - yy259.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr250 || yy2arr250 { - if yyq250[3] { - yy261 := &x.Spec - yy261.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq250[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy262 := &x.Spec - yy262.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr250 || yy2arr250 { - if yyq250[4] { - yy264 := &x.Status - yy264.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq250[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy265 := &x.Status - yy265.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep250 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4082,24 +4927,25 @@ func (x *PersistentVolume) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym266 := z.DecBinary() - _ = yym266 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl267 := r.ReadMapStart() - if yyl267 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl267, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl267 := r.ReadArrayStart() - if yyl267 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl267, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4111,12 +4957,12 @@ func (x *PersistentVolume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys268Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys268Slc - var yyhl268 bool = l >= 0 - for yyj268 := 0; ; yyj268++ { - if yyhl268 { - if yyj268 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4124,9 +4970,32 @@ func (x *PersistentVolume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys268Slc = r.DecodeBytes(yys268Slc, true, true) - yys268 := string(yys268Slc) - switch yys268 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = PersistentVolumeSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = PersistentVolumeStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -4139,134 +5008,117 @@ func (x *PersistentVolume) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv271 := &x.ObjectMeta - yyv271.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = PersistentVolumeSpec{} - } else { - yyv272 := &x.Spec - yyv272.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = PersistentVolumeStatus{} - } else { - yyv273 := &x.Status - yyv273.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys268) - } // end switch yys268 - } // end for yyj268 - if !yyhl268 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolume) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj274 int - var yyb274 bool - var yyhl274 bool = l >= 0 - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb274 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb274 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = PersistentVolumeSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = PersistentVolumeStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb274 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb274 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l - } else { - yyb274 = r.CheckBreak() - } - if yyb274 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv277 := &x.ObjectMeta - yyv277.CodecDecodeSelf(d) - } - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l - } else { - yyb274 = r.CheckBreak() - } - if yyb274 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = PersistentVolumeSpec{} - } else { - yyv278 := &x.Spec - yyv278.CodecDecodeSelf(d) - } - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l - } else { - yyb274 = r.CheckBreak() - } - if yyb274 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = PersistentVolumeStatus{} - } else { - yyv279 := &x.Status - yyv279.CodecDecodeSelf(d) - } for { - yyj274++ - if yyhl274 { - yyb274 = yyj274 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb274 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb274 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj274-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -4276,44 +5128,49 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym280 := z.EncBinary() - _ = yym280 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep281 := !z.EncBinary() - yy2arr281 := z.EncBasicHandle().StructToArray - var yyq281 [15]bool - _, _, _ = yysep281, yyq281, yy2arr281 - const yyr281 bool = false - yyq281[0] = len(x.Capacity) != 0 - yyq281[1] = x.PersistentVolumeSource.GCEPersistentDisk != nil && x.GCEPersistentDisk != nil - yyq281[2] = x.PersistentVolumeSource.AWSElasticBlockStore != nil && x.AWSElasticBlockStore != nil - yyq281[3] = x.PersistentVolumeSource.HostPath != nil && x.HostPath != nil - yyq281[4] = x.PersistentVolumeSource.Glusterfs != nil && x.Glusterfs != nil - yyq281[5] = x.PersistentVolumeSource.NFS != nil && x.NFS != nil - yyq281[6] = x.PersistentVolumeSource.RBD != nil && x.RBD != nil - yyq281[7] = x.PersistentVolumeSource.ISCSI != nil && x.ISCSI != nil - yyq281[8] = x.PersistentVolumeSource.Cinder != nil && x.Cinder != nil - yyq281[9] = x.PersistentVolumeSource.CephFS != nil && x.CephFS != nil - yyq281[10] = x.PersistentVolumeSource.FC != nil && x.FC != nil - yyq281[11] = x.PersistentVolumeSource.Flocker != nil && x.Flocker != nil - yyq281[12] = len(x.AccessModes) != 0 - yyq281[13] = x.ClaimRef != nil - yyq281[14] = x.PersistentVolumeReclaimPolicy != "" - if yyr281 || yy2arr281 { - r.EncodeArrayStart(15) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [17]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Capacity) != 0 + yyq2[1] = len(x.AccessModes) != 0 + yyq2[2] = x.ClaimRef != nil + yyq2[3] = x.PersistentVolumeReclaimPolicy != "" + yyq2[4] = x.PersistentVolumeSource.GCEPersistentDisk != nil && x.GCEPersistentDisk != nil + yyq2[5] = x.PersistentVolumeSource.AWSElasticBlockStore != nil && x.AWSElasticBlockStore != nil + yyq2[6] = x.PersistentVolumeSource.HostPath != nil && x.HostPath != nil + yyq2[7] = x.PersistentVolumeSource.Glusterfs != nil && x.Glusterfs != nil + yyq2[8] = x.PersistentVolumeSource.NFS != nil && x.NFS != nil + yyq2[9] = x.PersistentVolumeSource.RBD != nil && x.RBD != nil + yyq2[10] = x.PersistentVolumeSource.ISCSI != nil && x.ISCSI != nil + yyq2[11] = x.PersistentVolumeSource.Cinder != nil && x.Cinder != nil + yyq2[12] = x.PersistentVolumeSource.CephFS != nil && x.CephFS != nil + yyq2[13] = x.PersistentVolumeSource.FC != nil && x.FC != nil + yyq2[14] = x.PersistentVolumeSource.Flocker != nil && x.Flocker != nil + yyq2[15] = x.PersistentVolumeSource.FlexVolume != nil && x.FlexVolume != nil + yyq2[16] = x.PersistentVolumeSource.AzureFile != nil && x.AzureFile != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(17) } else { - var yynn281 int = 0 - for _, b := range yyq281 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn281++ + yynn2++ } } - r.EncodeMapStart(yynn281) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr281 || yy2arr281 { - if yyq281[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Capacity == nil { r.EncodeNil() } else { @@ -4323,8 +5180,10 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq281[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("capacity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Capacity == nil { r.EncodeNil() } else { @@ -4332,387 +5191,14 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - var yyn283 bool - if x.PersistentVolumeSource.GCEPersistentDisk == nil { - yyn283 = true - goto LABEL283 - } - LABEL283: - if yyr281 || yy2arr281 { - if yyn283 { - r.EncodeNil() - } else { - if yyq281[1] { - if x.GCEPersistentDisk == nil { - r.EncodeNil() - } else { - x.GCEPersistentDisk.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[1] { - r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) - if yyn283 { - r.EncodeNil() - } else { - if x.GCEPersistentDisk == nil { - r.EncodeNil() - } else { - x.GCEPersistentDisk.CodecEncodeSelf(e) - } - } - } - } - var yyn284 bool - if x.PersistentVolumeSource.AWSElasticBlockStore == nil { - yyn284 = true - goto LABEL284 - } - LABEL284: - if yyr281 || yy2arr281 { - if yyn284 { - r.EncodeNil() - } else { - if yyq281[2] { - if x.AWSElasticBlockStore == nil { - r.EncodeNil() - } else { - x.AWSElasticBlockStore.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[2] { - r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) - if yyn284 { - r.EncodeNil() - } else { - if x.AWSElasticBlockStore == nil { - r.EncodeNil() - } else { - x.AWSElasticBlockStore.CodecEncodeSelf(e) - } - } - } - } - var yyn285 bool - if x.PersistentVolumeSource.HostPath == nil { - yyn285 = true - goto LABEL285 - } - LABEL285: - if yyr281 || yy2arr281 { - if yyn285 { - r.EncodeNil() - } else { - if yyq281[3] { - if x.HostPath == nil { - r.EncodeNil() - } else { - x.HostPath.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[3] { - r.EncodeString(codecSelferC_UTF81234, string("hostPath")) - if yyn285 { - r.EncodeNil() - } else { - if x.HostPath == nil { - r.EncodeNil() - } else { - x.HostPath.CodecEncodeSelf(e) - } - } - } - } - var yyn286 bool - if x.PersistentVolumeSource.Glusterfs == nil { - yyn286 = true - goto LABEL286 - } - LABEL286: - if yyr281 || yy2arr281 { - if yyn286 { - r.EncodeNil() - } else { - if yyq281[4] { - if x.Glusterfs == nil { - r.EncodeNil() - } else { - x.Glusterfs.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[4] { - r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) - if yyn286 { - r.EncodeNil() - } else { - if x.Glusterfs == nil { - r.EncodeNil() - } else { - x.Glusterfs.CodecEncodeSelf(e) - } - } - } - } - var yyn287 bool - if x.PersistentVolumeSource.NFS == nil { - yyn287 = true - goto LABEL287 - } - LABEL287: - if yyr281 || yy2arr281 { - if yyn287 { - r.EncodeNil() - } else { - if yyq281[5] { - if x.NFS == nil { - r.EncodeNil() - } else { - x.NFS.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[5] { - r.EncodeString(codecSelferC_UTF81234, string("nfs")) - if yyn287 { - r.EncodeNil() - } else { - if x.NFS == nil { - r.EncodeNil() - } else { - x.NFS.CodecEncodeSelf(e) - } - } - } - } - var yyn288 bool - if x.PersistentVolumeSource.RBD == nil { - yyn288 = true - goto LABEL288 - } - LABEL288: - if yyr281 || yy2arr281 { - if yyn288 { - r.EncodeNil() - } else { - if yyq281[6] { - if x.RBD == nil { - r.EncodeNil() - } else { - x.RBD.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[6] { - r.EncodeString(codecSelferC_UTF81234, string("rbd")) - if yyn288 { - r.EncodeNil() - } else { - if x.RBD == nil { - r.EncodeNil() - } else { - x.RBD.CodecEncodeSelf(e) - } - } - } - } - var yyn289 bool - if x.PersistentVolumeSource.ISCSI == nil { - yyn289 = true - goto LABEL289 - } - LABEL289: - if yyr281 || yy2arr281 { - if yyn289 { - r.EncodeNil() - } else { - if yyq281[7] { - if x.ISCSI == nil { - r.EncodeNil() - } else { - x.ISCSI.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[7] { - r.EncodeString(codecSelferC_UTF81234, string("iscsi")) - if yyn289 { - r.EncodeNil() - } else { - if x.ISCSI == nil { - r.EncodeNil() - } else { - x.ISCSI.CodecEncodeSelf(e) - } - } - } - } - var yyn290 bool - if x.PersistentVolumeSource.Cinder == nil { - yyn290 = true - goto LABEL290 - } - LABEL290: - if yyr281 || yy2arr281 { - if yyn290 { - r.EncodeNil() - } else { - if yyq281[8] { - if x.Cinder == nil { - r.EncodeNil() - } else { - x.Cinder.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[8] { - r.EncodeString(codecSelferC_UTF81234, string("cinder")) - if yyn290 { - r.EncodeNil() - } else { - if x.Cinder == nil { - r.EncodeNil() - } else { - x.Cinder.CodecEncodeSelf(e) - } - } - } - } - var yyn291 bool - if x.PersistentVolumeSource.CephFS == nil { - yyn291 = true - goto LABEL291 - } - LABEL291: - if yyr281 || yy2arr281 { - if yyn291 { - r.EncodeNil() - } else { - if yyq281[9] { - if x.CephFS == nil { - r.EncodeNil() - } else { - x.CephFS.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[9] { - r.EncodeString(codecSelferC_UTF81234, string("cephfs")) - if yyn291 { - r.EncodeNil() - } else { - if x.CephFS == nil { - r.EncodeNil() - } else { - x.CephFS.CodecEncodeSelf(e) - } - } - } - } - var yyn292 bool - if x.PersistentVolumeSource.FC == nil { - yyn292 = true - goto LABEL292 - } - LABEL292: - if yyr281 || yy2arr281 { - if yyn292 { - r.EncodeNil() - } else { - if yyq281[10] { - if x.FC == nil { - r.EncodeNil() - } else { - x.FC.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[10] { - r.EncodeString(codecSelferC_UTF81234, string("fc")) - if yyn292 { - r.EncodeNil() - } else { - if x.FC == nil { - r.EncodeNil() - } else { - x.FC.CodecEncodeSelf(e) - } - } - } - } - var yyn293 bool - if x.PersistentVolumeSource.Flocker == nil { - yyn293 = true - goto LABEL293 - } - LABEL293: - if yyr281 || yy2arr281 { - if yyn293 { - r.EncodeNil() - } else { - if yyq281[11] { - if x.Flocker == nil { - r.EncodeNil() - } else { - x.Flocker.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq281[11] { - r.EncodeString(codecSelferC_UTF81234, string("flocker")) - if yyn293 { - r.EncodeNil() - } else { - if x.Flocker == nil { - r.EncodeNil() - } else { - x.Flocker.CodecEncodeSelf(e) - } - } - } - } - if yyr281 || yy2arr281 { - if yyq281[12] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.AccessModes == nil { r.EncodeNil() } else { - yym295 := z.EncBinary() - _ = yym295 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -4722,13 +5208,15 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq281[12] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("accessModes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AccessModes == nil { r.EncodeNil() } else { - yym296 := z.EncBinary() - _ = yym296 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -4736,8 +5224,9 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr281 || yy2arr281 { - if yyq281[13] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.ClaimRef == nil { r.EncodeNil() } else { @@ -4747,8 +5236,10 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq281[13] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("claimRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ClaimRef == nil { r.EncodeNil() } else { @@ -4756,20 +5247,506 @@ func (x *PersistentVolumeSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr281 || yy2arr281 { - if yyq281[14] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { x.PersistentVolumeReclaimPolicy.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq281[14] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("persistentVolumeReclaimPolicy")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.PersistentVolumeReclaimPolicy.CodecEncodeSelf(e) } } - if yysep281 { - r.EncodeEnd() + var yyn15 bool + if x.PersistentVolumeSource.GCEPersistentDisk == nil { + yyn15 = true + goto LABEL15 + } + LABEL15: + if yyr2 || yy2arr2 { + if yyn15 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.GCEPersistentDisk == nil { + r.EncodeNil() + } else { + x.GCEPersistentDisk.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("gcePersistentDisk")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn15 { + r.EncodeNil() + } else { + if x.GCEPersistentDisk == nil { + r.EncodeNil() + } else { + x.GCEPersistentDisk.CodecEncodeSelf(e) + } + } + } + } + var yyn18 bool + if x.PersistentVolumeSource.AWSElasticBlockStore == nil { + yyn18 = true + goto LABEL18 + } + LABEL18: + if yyr2 || yy2arr2 { + if yyn18 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + if x.AWSElasticBlockStore == nil { + r.EncodeNil() + } else { + x.AWSElasticBlockStore.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("awsElasticBlockStore")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn18 { + r.EncodeNil() + } else { + if x.AWSElasticBlockStore == nil { + r.EncodeNil() + } else { + x.AWSElasticBlockStore.CodecEncodeSelf(e) + } + } + } + } + var yyn21 bool + if x.PersistentVolumeSource.HostPath == nil { + yyn21 = true + goto LABEL21 + } + LABEL21: + if yyr2 || yy2arr2 { + if yyn21 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + if x.HostPath == nil { + r.EncodeNil() + } else { + x.HostPath.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn21 { + r.EncodeNil() + } else { + if x.HostPath == nil { + r.EncodeNil() + } else { + x.HostPath.CodecEncodeSelf(e) + } + } + } + } + var yyn24 bool + if x.PersistentVolumeSource.Glusterfs == nil { + yyn24 = true + goto LABEL24 + } + LABEL24: + if yyr2 || yy2arr2 { + if yyn24 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + if x.Glusterfs == nil { + r.EncodeNil() + } else { + x.Glusterfs.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("glusterfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn24 { + r.EncodeNil() + } else { + if x.Glusterfs == nil { + r.EncodeNil() + } else { + x.Glusterfs.CodecEncodeSelf(e) + } + } + } + } + var yyn27 bool + if x.PersistentVolumeSource.NFS == nil { + yyn27 = true + goto LABEL27 + } + LABEL27: + if yyr2 || yy2arr2 { + if yyn27 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + if x.NFS == nil { + r.EncodeNil() + } else { + x.NFS.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn27 { + r.EncodeNil() + } else { + if x.NFS == nil { + r.EncodeNil() + } else { + x.NFS.CodecEncodeSelf(e) + } + } + } + } + var yyn30 bool + if x.PersistentVolumeSource.RBD == nil { + yyn30 = true + goto LABEL30 + } + LABEL30: + if yyr2 || yy2arr2 { + if yyn30 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { + if x.RBD == nil { + r.EncodeNil() + } else { + x.RBD.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rbd")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn30 { + r.EncodeNil() + } else { + if x.RBD == nil { + r.EncodeNil() + } else { + x.RBD.CodecEncodeSelf(e) + } + } + } + } + var yyn33 bool + if x.PersistentVolumeSource.ISCSI == nil { + yyn33 = true + goto LABEL33 + } + LABEL33: + if yyr2 || yy2arr2 { + if yyn33 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { + if x.ISCSI == nil { + r.EncodeNil() + } else { + x.ISCSI.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("iscsi")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn33 { + r.EncodeNil() + } else { + if x.ISCSI == nil { + r.EncodeNil() + } else { + x.ISCSI.CodecEncodeSelf(e) + } + } + } + } + var yyn36 bool + if x.PersistentVolumeSource.Cinder == nil { + yyn36 = true + goto LABEL36 + } + LABEL36: + if yyr2 || yy2arr2 { + if yyn36 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { + if x.Cinder == nil { + r.EncodeNil() + } else { + x.Cinder.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cinder")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn36 { + r.EncodeNil() + } else { + if x.Cinder == nil { + r.EncodeNil() + } else { + x.Cinder.CodecEncodeSelf(e) + } + } + } + } + var yyn39 bool + if x.PersistentVolumeSource.CephFS == nil { + yyn39 = true + goto LABEL39 + } + LABEL39: + if yyr2 || yy2arr2 { + if yyn39 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + if x.CephFS == nil { + r.EncodeNil() + } else { + x.CephFS.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cephfs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn39 { + r.EncodeNil() + } else { + if x.CephFS == nil { + r.EncodeNil() + } else { + x.CephFS.CodecEncodeSelf(e) + } + } + } + } + var yyn42 bool + if x.PersistentVolumeSource.FC == nil { + yyn42 = true + goto LABEL42 + } + LABEL42: + if yyr2 || yy2arr2 { + if yyn42 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[13] { + if x.FC == nil { + r.EncodeNil() + } else { + x.FC.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[13] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fc")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn42 { + r.EncodeNil() + } else { + if x.FC == nil { + r.EncodeNil() + } else { + x.FC.CodecEncodeSelf(e) + } + } + } + } + var yyn45 bool + if x.PersistentVolumeSource.Flocker == nil { + yyn45 = true + goto LABEL45 + } + LABEL45: + if yyr2 || yy2arr2 { + if yyn45 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { + if x.Flocker == nil { + r.EncodeNil() + } else { + x.Flocker.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flocker")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn45 { + r.EncodeNil() + } else { + if x.Flocker == nil { + r.EncodeNil() + } else { + x.Flocker.CodecEncodeSelf(e) + } + } + } + } + var yyn48 bool + if x.PersistentVolumeSource.FlexVolume == nil { + yyn48 = true + goto LABEL48 + } + LABEL48: + if yyr2 || yy2arr2 { + if yyn48 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[15] { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[15] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("flexVolume")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn48 { + r.EncodeNil() + } else { + if x.FlexVolume == nil { + r.EncodeNil() + } else { + x.FlexVolume.CodecEncodeSelf(e) + } + } + } + } + var yyn51 bool + if x.PersistentVolumeSource.AzureFile == nil { + yyn51 = true + goto LABEL51 + } + LABEL51: + if yyr2 || yy2arr2 { + if yyn51 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[16] { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[16] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("azureFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn51 { + r.EncodeNil() + } else { + if x.AzureFile == nil { + r.EncodeNil() + } else { + x.AzureFile.CodecEncodeSelf(e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4779,24 +5756,25 @@ func (x *PersistentVolumeSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym299 := z.DecBinary() - _ = yym299 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl300 := r.ReadMapStart() - if yyl300 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl300, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl300 := r.ReadArrayStart() - if yyl300 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl300, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4808,12 +5786,12 @@ func (x *PersistentVolumeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys301Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys301Slc - var yyhl301 bool = l >= 0 - for yyj301 := 0; ; yyj301++ { - if yyhl301 { - if yyj301 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4821,15 +5799,46 @@ func (x *PersistentVolumeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys301Slc = r.DecodeBytes(yys301Slc, true, true) - yys301 := string(yys301Slc) - switch yys301 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "capacity": if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv302 := &x.Capacity - yyv302.CodecDecodeSelf(d) + yyv4 := &x.Capacity + yyv4.CodecDecodeSelf(d) + } + case "accessModes": + if r.TryDecodeAsNil() { + x.AccessModes = nil + } else { + yyv5 := &x.AccessModes + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv5), d) + } + } + case "claimRef": + if r.TryDecodeAsNil() { + if x.ClaimRef != nil { + x.ClaimRef = nil + } + } else { + if x.ClaimRef == nil { + x.ClaimRef = new(ObjectReference) + } + x.ClaimRef.CodecDecodeSelf(d) + } + case "persistentVolumeReclaimPolicy": + if r.TryDecodeAsNil() { + x.PersistentVolumeReclaimPolicy = "" + } else { + x.PersistentVolumeReclaimPolicy = PersistentVolumeReclaimPolicy(r.DecodeString()) } case "gcePersistentDisk": if x.PersistentVolumeSource.GCEPersistentDisk == nil { @@ -4985,318 +5994,98 @@ func (x *PersistentVolumeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decode } x.Flocker.CodecDecodeSelf(d) } - case "accessModes": - if r.TryDecodeAsNil() { - x.AccessModes = nil - } else { - yyv314 := &x.AccessModes - yym315 := z.DecBinary() - _ = yym315 - if false { - } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv314), d) - } + case "flexVolume": + if x.PersistentVolumeSource.FlexVolume == nil { + x.PersistentVolumeSource.FlexVolume = new(FlexVolumeSource) } - case "claimRef": if r.TryDecodeAsNil() { - if x.ClaimRef != nil { - x.ClaimRef = nil + if x.FlexVolume != nil { + x.FlexVolume = nil } } else { - if x.ClaimRef == nil { - x.ClaimRef = new(ObjectReference) + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) } - x.ClaimRef.CodecDecodeSelf(d) + x.FlexVolume.CodecDecodeSelf(d) + } + case "azureFile": + if x.PersistentVolumeSource.AzureFile == nil { + x.PersistentVolumeSource.AzureFile = new(AzureFileVolumeSource) } - case "persistentVolumeReclaimPolicy": if r.TryDecodeAsNil() { - x.PersistentVolumeReclaimPolicy = "" + if x.AzureFile != nil { + x.AzureFile = nil + } } else { - x.PersistentVolumeReclaimPolicy = PersistentVolumeReclaimPolicy(r.DecodeString()) + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys301) - } // end switch yys301 - } // end for yyj301 - if !yyhl301 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj318 int - var yyb318 bool - var yyhl318 bool = l >= 0 - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l + var yyj22 int + var yyb22 bool + var yyhl22 bool = l >= 0 + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l } else { - yyb318 = r.CheckBreak() + yyb22 = r.CheckBreak() } - if yyb318 { - r.ReadEnd() + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv319 := &x.Capacity - yyv319.CodecDecodeSelf(d) + yyv23 := &x.Capacity + yyv23.CodecDecodeSelf(d) } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l } else { - yyb318 = r.CheckBreak() + yyb22 = r.CheckBreak() } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.GCEPersistentDisk != nil { - x.GCEPersistentDisk = nil - } - } else { - if x.GCEPersistentDisk == nil { - x.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) - } - x.GCEPersistentDisk.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.AWSElasticBlockStore != nil { - x.AWSElasticBlockStore = nil - } - } else { - if x.AWSElasticBlockStore == nil { - x.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) - } - x.AWSElasticBlockStore.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.HostPath != nil { - x.HostPath = nil - } - } else { - if x.HostPath == nil { - x.HostPath = new(HostPathVolumeSource) - } - x.HostPath.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.Glusterfs != nil { - x.Glusterfs = nil - } - } else { - if x.Glusterfs == nil { - x.Glusterfs = new(GlusterfsVolumeSource) - } - x.Glusterfs.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.NFS != nil { - x.NFS = nil - } - } else { - if x.NFS == nil { - x.NFS = new(NFSVolumeSource) - } - x.NFS.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.RBD != nil { - x.RBD = nil - } - } else { - if x.RBD == nil { - x.RBD = new(RBDVolumeSource) - } - x.RBD.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.ISCSI != nil { - x.ISCSI = nil - } - } else { - if x.ISCSI == nil { - x.ISCSI = new(ISCSIVolumeSource) - } - x.ISCSI.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.Cinder != nil { - x.Cinder = nil - } - } else { - if x.Cinder == nil { - x.Cinder = new(CinderVolumeSource) - } - x.Cinder.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.CephFS != nil { - x.CephFS = nil - } - } else { - if x.CephFS == nil { - x.CephFS = new(CephFSVolumeSource) - } - x.CephFS.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.FC != nil { - x.FC = nil - } - } else { - if x.FC == nil { - x.FC = new(FCVolumeSource) - } - x.FC.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.Flocker != nil { - x.Flocker = nil - } - } else { - if x.Flocker == nil { - x.Flocker = new(FlockerVolumeSource) - } - x.Flocker.CodecDecodeSelf(d) - } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() - } - if yyb318 { - r.ReadEnd() + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv331 := &x.AccessModes - yym332 := z.DecBinary() - _ = yym332 + yyv24 := &x.AccessModes + yym25 := z.DecBinary() + _ = yym25 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv331), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv24), d) } } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l } else { - yyb318 = r.CheckBreak() + yyb22 = r.CheckBreak() } - if yyb318 { - r.ReadEnd() + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ClaimRef != nil { x.ClaimRef = nil @@ -5307,42 +6096,356 @@ func (x *PersistentVolumeSpec) codecDecodeSelfFromArray(l int, d *codec1978.Deco } x.ClaimRef.CodecDecodeSelf(d) } - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l } else { - yyb318 = r.CheckBreak() + yyb22 = r.CheckBreak() } - if yyb318 { - r.ReadEnd() + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.PersistentVolumeReclaimPolicy = "" } else { x.PersistentVolumeReclaimPolicy = PersistentVolumeReclaimPolicy(r.DecodeString()) } - for { - yyj318++ - if yyhl318 { - yyb318 = yyj318 > l - } else { - yyb318 = r.CheckBreak() + if x.PersistentVolumeSource.GCEPersistentDisk == nil { + x.PersistentVolumeSource.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.GCEPersistentDisk != nil { + x.GCEPersistentDisk = nil } - if yyb318 { + } else { + if x.GCEPersistentDisk == nil { + x.GCEPersistentDisk = new(GCEPersistentDiskVolumeSource) + } + x.GCEPersistentDisk.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.AWSElasticBlockStore == nil { + x.PersistentVolumeSource.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AWSElasticBlockStore != nil { + x.AWSElasticBlockStore = nil + } + } else { + if x.AWSElasticBlockStore == nil { + x.AWSElasticBlockStore = new(AWSElasticBlockStoreVolumeSource) + } + x.AWSElasticBlockStore.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.HostPath == nil { + x.PersistentVolumeSource.HostPath = new(HostPathVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.HostPath != nil { + x.HostPath = nil + } + } else { + if x.HostPath == nil { + x.HostPath = new(HostPathVolumeSource) + } + x.HostPath.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.Glusterfs == nil { + x.PersistentVolumeSource.Glusterfs = new(GlusterfsVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Glusterfs != nil { + x.Glusterfs = nil + } + } else { + if x.Glusterfs == nil { + x.Glusterfs = new(GlusterfsVolumeSource) + } + x.Glusterfs.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.NFS == nil { + x.PersistentVolumeSource.NFS = new(NFSVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.NFS != nil { + x.NFS = nil + } + } else { + if x.NFS == nil { + x.NFS = new(NFSVolumeSource) + } + x.NFS.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.RBD == nil { + x.PersistentVolumeSource.RBD = new(RBDVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.RBD != nil { + x.RBD = nil + } + } else { + if x.RBD == nil { + x.RBD = new(RBDVolumeSource) + } + x.RBD.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.ISCSI == nil { + x.PersistentVolumeSource.ISCSI = new(ISCSIVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ISCSI != nil { + x.ISCSI = nil + } + } else { + if x.ISCSI == nil { + x.ISCSI = new(ISCSIVolumeSource) + } + x.ISCSI.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.Cinder == nil { + x.PersistentVolumeSource.Cinder = new(CinderVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Cinder != nil { + x.Cinder = nil + } + } else { + if x.Cinder == nil { + x.Cinder = new(CinderVolumeSource) + } + x.Cinder.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.CephFS == nil { + x.PersistentVolumeSource.CephFS = new(CephFSVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.CephFS != nil { + x.CephFS = nil + } + } else { + if x.CephFS == nil { + x.CephFS = new(CephFSVolumeSource) + } + x.CephFS.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.FC == nil { + x.PersistentVolumeSource.FC = new(FCVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FC != nil { + x.FC = nil + } + } else { + if x.FC == nil { + x.FC = new(FCVolumeSource) + } + x.FC.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.Flocker == nil { + x.PersistentVolumeSource.Flocker = new(FlockerVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Flocker != nil { + x.Flocker = nil + } + } else { + if x.Flocker == nil { + x.Flocker = new(FlockerVolumeSource) + } + x.Flocker.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.FlexVolume == nil { + x.PersistentVolumeSource.FlexVolume = new(FlexVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FlexVolume != nil { + x.FlexVolume = nil + } + } else { + if x.FlexVolume == nil { + x.FlexVolume = new(FlexVolumeSource) + } + x.FlexVolume.CodecDecodeSelf(d) + } + if x.PersistentVolumeSource.AzureFile == nil { + x.PersistentVolumeSource.AzureFile = new(AzureFileVolumeSource) + } + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.AzureFile != nil { + x.AzureFile = nil + } + } else { + if x.AzureFile == nil { + x.AzureFile = new(AzureFileVolumeSource) + } + x.AzureFile.CodecDecodeSelf(d) + } + for { + yyj22++ + if yyhl22 { + yyb22 = yyj22 > l + } else { + yyb22 = r.CheckBreak() + } + if yyb22 { break } - z.DecStructFieldNotFound(yyj318-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj22-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x PersistentVolumeReclaimPolicy) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym335 := z.EncBinary() - _ = yym335 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -5354,8 +6457,8 @@ func (x *PersistentVolumeReclaimPolicy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym336 := z.DecBinary() - _ = yym336 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -5370,46 +6473,52 @@ func (x *PersistentVolumeStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym337 := z.EncBinary() - _ = yym337 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep338 := !z.EncBinary() - yy2arr338 := z.EncBasicHandle().StructToArray - var yyq338 [3]bool - _, _, _ = yysep338, yyq338, yy2arr338 - const yyr338 bool = false - yyq338[0] = x.Phase != "" - yyq338[1] = x.Message != "" - yyq338[2] = x.Reason != "" - if yyr338 || yy2arr338 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Phase != "" + yyq2[1] = x.Message != "" + yyq2[2] = x.Reason != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn338 int = 0 - for _, b := range yyq338 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn338++ + yynn2++ } } - r.EncodeMapStart(yynn338) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr338 || yy2arr338 { - if yyq338[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq338[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yyr338 || yy2arr338 { - if yyq338[1] { - yym341 := z.EncBinary() - _ = yym341 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -5418,20 +6527,23 @@ func (x *PersistentVolumeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq338[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym342 := z.EncBinary() - _ = yym342 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr338 || yy2arr338 { - if yyq338[2] { - yym344 := z.EncBinary() - _ = yym344 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -5440,18 +6552,22 @@ func (x *PersistentVolumeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq338[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym345 := z.EncBinary() - _ = yym345 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yysep338 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5461,24 +6577,25 @@ func (x *PersistentVolumeStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym346 := z.DecBinary() - _ = yym346 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl347 := r.ReadMapStart() - if yyl347 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl347, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl347 := r.ReadArrayStart() - if yyl347 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl347, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5490,12 +6607,12 @@ func (x *PersistentVolumeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Deco var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys348Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys348Slc - var yyhl348 bool = l >= 0 - for yyj348 := 0; ; yyj348++ { - if yyhl348 { - if yyj348 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5503,9 +6620,11 @@ func (x *PersistentVolumeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Deco break } } - yys348Slc = r.DecodeBytes(yys348Slc, true, true) - yys348 := string(yys348Slc) - switch yys348 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "phase": if r.TryDecodeAsNil() { x.Phase = "" @@ -5525,79 +6644,81 @@ func (x *PersistentVolumeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Deco x.Reason = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys348) - } // end switch yys348 - } // end for yyj348 - if !yyhl348 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj352 int - var yyb352 bool - var yyhl352 bool = l >= 0 - yyj352++ - if yyhl352 { - yyb352 = yyj352 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb352 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb352 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = PersistentVolumePhase(r.DecodeString()) } - yyj352++ - if yyhl352 { - yyb352 = yyj352 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb352 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb352 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj352++ - if yyhl352 { - yyb352 = yyj352 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb352 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb352 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } for { - yyj352++ - if yyhl352 { - yyb352 = yyj352 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb352 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb352 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj352-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5607,126 +6728,142 @@ func (x *PersistentVolumeList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym356 := z.EncBinary() - _ = yym356 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep357 := !z.EncBinary() - yy2arr357 := z.EncBasicHandle().StructToArray - var yyq357 [4]bool - _, _, _ = yysep357, yyq357, yy2arr357 - const yyr357 bool = false - yyq357[0] = x.Kind != "" - yyq357[1] = x.APIVersion != "" - yyq357[2] = true - if yyr357 || yy2arr357 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn357 int = 1 - for _, b := range yyq357 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn357++ + yynn2++ } } - r.EncodeMapStart(yynn357) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr357 || yy2arr357 { - if yyq357[0] { - yym359 := z.EncBinary() - _ = yym359 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq357[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym360 := z.EncBinary() - _ = yym360 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr357 || yy2arr357 { - if yyq357[1] { - yym362 := z.EncBinary() - _ = yym362 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq357[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym363 := z.EncBinary() - _ = yym363 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr357 || yy2arr357 { - if yyq357[2] { - yy365 := &x.ListMeta - yym366 := z.EncBinary() - _ = yym366 - if false { - } else if z.HasExtensions() && z.EncExt(yy365) { - } else { - z.EncFallback(yy365) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq357[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy367 := &x.ListMeta - yym368 := z.EncBinary() - _ = yym368 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy367) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy367) + z.EncFallback(yy6) } } } - if yyr357 || yy2arr357 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym370 := z.EncBinary() - _ = yym370 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSlicePersistentVolume(([]PersistentVolume)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym371 := z.EncBinary() - _ = yym371 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSlicePersistentVolume(([]PersistentVolume)(x.Items), e) } } } - if yysep357 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5736,24 +6873,25 @@ func (x *PersistentVolumeList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym372 := z.DecBinary() - _ = yym372 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl373 := r.ReadMapStart() - if yyl373 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl373, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl373 := r.ReadArrayStart() - if yyl373 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl373, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5765,12 +6903,12 @@ func (x *PersistentVolumeList) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys374Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys374Slc - var yyhl374 bool = l >= 0 - for yyj374 := 0; ; yyj374++ { - if yyhl374 { - if yyj374 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5778,9 +6916,36 @@ func (x *PersistentVolumeList) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys374Slc = r.DecodeBytes(yys374Slc, true, true) - yys374 := string(yys374Slc) - switch yys374 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePersistentVolume((*[]PersistentVolume)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -5793,133 +6958,111 @@ func (x *PersistentVolumeList) codecDecodeSelfFromMap(l int, d *codec1978.Decode } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv377 := &x.ListMeta - yym378 := z.DecBinary() - _ = yym378 - if false { - } else if z.HasExtensions() && z.DecExt(yyv377) { - } else { - z.DecFallback(yyv377, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv379 := &x.Items - yym380 := z.DecBinary() - _ = yym380 - if false { - } else { - h.decSlicePersistentVolume((*[]PersistentVolume)(yyv379), d) - } - } default: - z.DecStructFieldNotFound(-1, yys374) - } // end switch yys374 - } // end for yyj374 - if !yyhl374 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj381 int - var yyb381 bool - var yyhl381 bool = l >= 0 - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb381 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb381 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePersistentVolume((*[]PersistentVolume)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb381 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb381 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l - } else { - yyb381 = r.CheckBreak() - } - if yyb381 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv384 := &x.ListMeta - yym385 := z.DecBinary() - _ = yym385 - if false { - } else if z.HasExtensions() && z.DecExt(yyv384) { - } else { - z.DecFallback(yyv384, false) - } - } - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l - } else { - yyb381 = r.CheckBreak() - } - if yyb381 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv386 := &x.Items - yym387 := z.DecBinary() - _ = yym387 - if false { - } else { - h.decSlicePersistentVolume((*[]PersistentVolume)(yyv386), d) - } - } for { - yyj381++ - if yyhl381 { - yyb381 = yyj381 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb381 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb381 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj381-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaim) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5929,120 +7072,139 @@ func (x *PersistentVolumeClaim) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym388 := z.EncBinary() - _ = yym388 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep389 := !z.EncBinary() - yy2arr389 := z.EncBasicHandle().StructToArray - var yyq389 [5]bool - _, _, _ = yysep389, yyq389, yy2arr389 - const yyr389 bool = false - yyq389[0] = x.Kind != "" - yyq389[1] = x.APIVersion != "" - yyq389[2] = true - yyq389[3] = true - yyq389[4] = true - if yyr389 || yy2arr389 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn389 int = 0 - for _, b := range yyq389 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn389++ + yynn2++ } } - r.EncodeMapStart(yynn389) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr389 || yy2arr389 { - if yyq389[0] { - yym391 := z.EncBinary() - _ = yym391 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq389[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym392 := z.EncBinary() - _ = yym392 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr389 || yy2arr389 { - if yyq389[1] { - yym394 := z.EncBinary() - _ = yym394 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq389[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym395 := z.EncBinary() - _ = yym395 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr389 || yy2arr389 { - if yyq389[2] { - yy397 := &x.ObjectMeta - yy397.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq389[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy398 := &x.ObjectMeta - yy398.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr389 || yy2arr389 { - if yyq389[3] { - yy400 := &x.Spec - yy400.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq389[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy401 := &x.Spec - yy401.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr389 || yy2arr389 { - if yyq389[4] { - yy403 := &x.Status - yy403.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq389[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy404 := &x.Status - yy404.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep389 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6052,24 +7214,25 @@ func (x *PersistentVolumeClaim) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym405 := z.DecBinary() - _ = yym405 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl406 := r.ReadMapStart() - if yyl406 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl406, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl406 := r.ReadArrayStart() - if yyl406 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl406, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6081,12 +7244,12 @@ func (x *PersistentVolumeClaim) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys407Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys407Slc - var yyhl407 bool = l >= 0 - for yyj407 := 0; ; yyj407++ { - if yyhl407 { - if yyj407 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6094,9 +7257,32 @@ func (x *PersistentVolumeClaim) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys407Slc = r.DecodeBytes(yys407Slc, true, true) - yys407 := string(yys407Slc) - switch yys407 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = PersistentVolumeClaimSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = PersistentVolumeClaimStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -6109,134 +7295,117 @@ func (x *PersistentVolumeClaim) codecDecodeSelfFromMap(l int, d *codec1978.Decod } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv410 := &x.ObjectMeta - yyv410.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = PersistentVolumeClaimSpec{} - } else { - yyv411 := &x.Spec - yyv411.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = PersistentVolumeClaimStatus{} - } else { - yyv412 := &x.Status - yyv412.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys407) - } // end switch yys407 - } // end for yyj407 - if !yyhl407 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaim) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj413 int - var yyb413 bool - var yyhl413 bool = l >= 0 - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb413 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb413 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = PersistentVolumeClaimSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = PersistentVolumeClaimStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb413 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb413 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l - } else { - yyb413 = r.CheckBreak() - } - if yyb413 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv416 := &x.ObjectMeta - yyv416.CodecDecodeSelf(d) - } - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l - } else { - yyb413 = r.CheckBreak() - } - if yyb413 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = PersistentVolumeClaimSpec{} - } else { - yyv417 := &x.Spec - yyv417.CodecDecodeSelf(d) - } - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l - } else { - yyb413 = r.CheckBreak() - } - if yyb413 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = PersistentVolumeClaimStatus{} - } else { - yyv418 := &x.Status - yyv418.CodecDecodeSelf(d) - } for { - yyj413++ - if yyhl413 { - yyb413 = yyj413 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb413 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb413 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj413-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaimList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6246,126 +7415,142 @@ func (x *PersistentVolumeClaimList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym419 := z.EncBinary() - _ = yym419 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep420 := !z.EncBinary() - yy2arr420 := z.EncBasicHandle().StructToArray - var yyq420 [4]bool - _, _, _ = yysep420, yyq420, yy2arr420 - const yyr420 bool = false - yyq420[0] = x.Kind != "" - yyq420[1] = x.APIVersion != "" - yyq420[2] = true - if yyr420 || yy2arr420 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn420 int = 1 - for _, b := range yyq420 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn420++ + yynn2++ } } - r.EncodeMapStart(yynn420) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr420 || yy2arr420 { - if yyq420[0] { - yym422 := z.EncBinary() - _ = yym422 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq420[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym423 := z.EncBinary() - _ = yym423 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr420 || yy2arr420 { - if yyq420[1] { - yym425 := z.EncBinary() - _ = yym425 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq420[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym426 := z.EncBinary() - _ = yym426 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr420 || yy2arr420 { - if yyq420[2] { - yy428 := &x.ListMeta - yym429 := z.EncBinary() - _ = yym429 - if false { - } else if z.HasExtensions() && z.EncExt(yy428) { - } else { - z.EncFallback(yy428) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq420[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy430 := &x.ListMeta - yym431 := z.EncBinary() - _ = yym431 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy430) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy430) + z.EncFallback(yy6) } } } - if yyr420 || yy2arr420 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym433 := z.EncBinary() - _ = yym433 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSlicePersistentVolumeClaim(([]PersistentVolumeClaim)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym434 := z.EncBinary() - _ = yym434 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSlicePersistentVolumeClaim(([]PersistentVolumeClaim)(x.Items), e) } } } - if yysep420 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6375,24 +7560,25 @@ func (x *PersistentVolumeClaimList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym435 := z.DecBinary() - _ = yym435 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl436 := r.ReadMapStart() - if yyl436 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl436, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl436 := r.ReadArrayStart() - if yyl436 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl436, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6404,12 +7590,12 @@ func (x *PersistentVolumeClaimList) codecDecodeSelfFromMap(l int, d *codec1978.D var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys437Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys437Slc - var yyhl437 bool = l >= 0 - for yyj437 := 0; ; yyj437++ { - if yyhl437 { - if yyj437 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6417,9 +7603,36 @@ func (x *PersistentVolumeClaimList) codecDecodeSelfFromMap(l int, d *codec1978.D break } } - yys437Slc = r.DecodeBytes(yys437Slc, true, true) - yys437 := string(yys437Slc) - switch yys437 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePersistentVolumeClaim((*[]PersistentVolumeClaim)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -6432,133 +7645,111 @@ func (x *PersistentVolumeClaimList) codecDecodeSelfFromMap(l int, d *codec1978.D } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv440 := &x.ListMeta - yym441 := z.DecBinary() - _ = yym441 - if false { - } else if z.HasExtensions() && z.DecExt(yyv440) { - } else { - z.DecFallback(yyv440, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv442 := &x.Items - yym443 := z.DecBinary() - _ = yym443 - if false { - } else { - h.decSlicePersistentVolumeClaim((*[]PersistentVolumeClaim)(yyv442), d) - } - } default: - z.DecStructFieldNotFound(-1, yys437) - } // end switch yys437 - } // end for yyj437 - if !yyhl437 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaimList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj444 int - var yyb444 bool - var yyhl444 bool = l >= 0 - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb444 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb444 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePersistentVolumeClaim((*[]PersistentVolumeClaim)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb444 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb444 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l - } else { - yyb444 = r.CheckBreak() - } - if yyb444 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv447 := &x.ListMeta - yym448 := z.DecBinary() - _ = yym448 - if false { - } else if z.HasExtensions() && z.DecExt(yyv447) { - } else { - z.DecFallback(yyv447, false) - } - } - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l - } else { - yyb444 = r.CheckBreak() - } - if yyb444 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv449 := &x.Items - yym450 := z.DecBinary() - _ = yym450 - if false { - } else { - h.decSlicePersistentVolumeClaim((*[]PersistentVolumeClaim)(yyv449), d) - } - } for { - yyj444++ - if yyhl444 { - yyb444 = yyj444 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb444 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb444 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj444-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6568,37 +7759,40 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym451 := z.EncBinary() - _ = yym451 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep452 := !z.EncBinary() - yy2arr452 := z.EncBasicHandle().StructToArray - var yyq452 [3]bool - _, _, _ = yysep452, yyq452, yy2arr452 - const yyr452 bool = false - yyq452[0] = len(x.AccessModes) != 0 - yyq452[1] = true - yyq452[2] = x.VolumeName != "" - if yyr452 || yy2arr452 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.AccessModes) != 0 + yyq2[1] = true + yyq2[2] = x.VolumeName != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn452 int = 0 - for _, b := range yyq452 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn452++ + yynn2++ } } - r.EncodeMapStart(yynn452) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr452 || yy2arr452 { - if yyq452[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.AccessModes == nil { r.EncodeNil() } else { - yym454 := z.EncBinary() - _ = yym454 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -6608,13 +7802,15 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq452[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("accessModes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AccessModes == nil { r.EncodeNil() } else { - yym455 := z.EncBinary() - _ = yym455 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -6622,24 +7818,28 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr452 || yy2arr452 { - if yyq452[1] { - yy457 := &x.Resources - yy457.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy7 := &x.Resources + yy7.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq452[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resources")) - yy458 := &x.Resources - yy458.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Resources + yy9.CodecEncodeSelf(e) } } - if yyr452 || yy2arr452 { - if yyq452[2] { - yym460 := z.EncBinary() - _ = yym460 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeName)) @@ -6648,18 +7848,22 @@ func (x *PersistentVolumeClaimSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq452[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeName")) - yym461 := z.EncBinary() - _ = yym461 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeName)) } } } - if yysep452 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6669,24 +7873,25 @@ func (x *PersistentVolumeClaimSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym462 := z.DecBinary() - _ = yym462 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl463 := r.ReadMapStart() - if yyl463 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl463, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl463 := r.ReadArrayStart() - if yyl463 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl463, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6698,12 +7903,12 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromMap(l int, d *codec1978.D var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys464Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys464Slc - var yyhl464 bool = l >= 0 - for yyj464 := 0; ; yyj464++ { - if yyhl464 { - if yyj464 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6711,27 +7916,29 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromMap(l int, d *codec1978.D break } } - yys464Slc = r.DecodeBytes(yys464Slc, true, true) - yys464 := string(yys464Slc) - switch yys464 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "accessModes": if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv465 := &x.AccessModes - yym466 := z.DecBinary() - _ = yym466 + yyv4 := &x.AccessModes + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv465), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv4), d) } } case "resources": if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv467 := &x.Resources - yyv467.CodecDecodeSelf(d) + yyv6 := &x.Resources + yyv6.CodecDecodeSelf(d) } case "volumeName": if r.TryDecodeAsNil() { @@ -6740,86 +7947,88 @@ func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromMap(l int, d *codec1978.D x.VolumeName = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys464) - } // end switch yys464 - } // end for yyj464 - if !yyhl464 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaimSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj469 int - var yyb469 bool - var yyhl469 bool = l >= 0 - yyj469++ - if yyhl469 { - yyb469 = yyj469 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb469 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb469 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv470 := &x.AccessModes - yym471 := z.DecBinary() - _ = yym471 + yyv9 := &x.AccessModes + yym10 := z.DecBinary() + _ = yym10 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv470), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv9), d) } } - yyj469++ - if yyhl469 { - yyb469 = yyj469 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb469 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb469 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv472 := &x.Resources - yyv472.CodecDecodeSelf(d) + yyv11 := &x.Resources + yyv11.CodecDecodeSelf(d) } - yyj469++ - if yyhl469 { - yyb469 = yyj469 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb469 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb469 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.VolumeName = "" } else { x.VolumeName = string(r.DecodeString()) } for { - yyj469++ - if yyhl469 { - yyb469 = yyj469 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb469 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb469 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj469-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6829,49 +8038,55 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym474 := z.EncBinary() - _ = yym474 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep475 := !z.EncBinary() - yy2arr475 := z.EncBasicHandle().StructToArray - var yyq475 [3]bool - _, _, _ = yysep475, yyq475, yy2arr475 - const yyr475 bool = false - yyq475[0] = x.Phase != "" - yyq475[1] = len(x.AccessModes) != 0 - yyq475[2] = len(x.Capacity) != 0 - if yyr475 || yy2arr475 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Phase != "" + yyq2[1] = len(x.AccessModes) != 0 + yyq2[2] = len(x.Capacity) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn475 int = 0 - for _, b := range yyq475 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn475++ + yynn2++ } } - r.EncodeMapStart(yynn475) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr475 || yy2arr475 { - if yyq475[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq475[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yyr475 || yy2arr475 { - if yyq475[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.AccessModes == nil { r.EncodeNil() } else { - yym478 := z.EncBinary() - _ = yym478 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -6881,13 +8096,15 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq475[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("accessModes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.AccessModes == nil { r.EncodeNil() } else { - yym479 := z.EncBinary() - _ = yym479 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSlicePersistentVolumeAccessMode(([]PersistentVolumeAccessMode)(x.AccessModes), e) @@ -6895,8 +8112,9 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr475 || yy2arr475 { - if yyq475[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Capacity == nil { r.EncodeNil() } else { @@ -6906,8 +8124,10 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq475[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("capacity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Capacity == nil { r.EncodeNil() } else { @@ -6915,8 +8135,10 @@ func (x *PersistentVolumeClaimStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep475 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6926,24 +8148,25 @@ func (x *PersistentVolumeClaimStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym481 := z.DecBinary() - _ = yym481 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl482 := r.ReadMapStart() - if yyl482 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl482, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl482 := r.ReadArrayStart() - if yyl482 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl482, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6955,12 +8178,12 @@ func (x *PersistentVolumeClaimStatus) codecDecodeSelfFromMap(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys483Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys483Slc - var yyhl483 bool = l >= 0 - for yyj483 := 0; ; yyj483++ { - if yyhl483 { - if yyj483 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6968,9 +8191,11 @@ func (x *PersistentVolumeClaimStatus) codecDecodeSelfFromMap(l int, d *codec1978 break } } - yys483Slc = r.DecodeBytes(yys483Slc, true, true) - yys483 := string(yys483Slc) - switch yys483 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "phase": if r.TryDecodeAsNil() { x.Phase = "" @@ -6981,110 +8206,112 @@ func (x *PersistentVolumeClaimStatus) codecDecodeSelfFromMap(l int, d *codec1978 if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv485 := &x.AccessModes - yym486 := z.DecBinary() - _ = yym486 + yyv5 := &x.AccessModes + yym6 := z.DecBinary() + _ = yym6 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv485), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv5), d) } } case "capacity": if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv487 := &x.Capacity - yyv487.CodecDecodeSelf(d) + yyv7 := &x.Capacity + yyv7.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys483) - } // end switch yys483 - } // end for yyj483 - if !yyhl483 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PersistentVolumeClaimStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj488 int - var yyb488 bool - var yyhl488 bool = l >= 0 - yyj488++ - if yyhl488 { - yyb488 = yyj488 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb488 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb488 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = PersistentVolumeClaimPhase(r.DecodeString()) } - yyj488++ - if yyhl488 { - yyb488 = yyj488 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb488 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb488 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.AccessModes = nil } else { - yyv490 := &x.AccessModes - yym491 := z.DecBinary() - _ = yym491 + yyv10 := &x.AccessModes + yym11 := z.DecBinary() + _ = yym11 if false { } else { - h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv490), d) + h.decSlicePersistentVolumeAccessMode((*[]PersistentVolumeAccessMode)(yyv10), d) } } - yyj488++ - if yyhl488 { - yyb488 = yyj488 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb488 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb488 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv492 := &x.Capacity - yyv492.CodecDecodeSelf(d) + yyv12 := &x.Capacity + yyv12.CodecDecodeSelf(d) } for { - yyj488++ - if yyhl488 { - yyb488 = yyj488 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb488 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb488 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj488-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x PersistentVolumeAccessMode) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym493 := z.EncBinary() - _ = yym493 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -7096,8 +8323,8 @@ func (x *PersistentVolumeAccessMode) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym494 := z.DecBinary() - _ = yym494 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -7109,8 +8336,8 @@ func (x PersistentVolumePhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym495 := z.EncBinary() - _ = yym495 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -7122,8 +8349,8 @@ func (x *PersistentVolumePhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym496 := z.DecBinary() - _ = yym496 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -7135,8 +8362,8 @@ func (x PersistentVolumeClaimPhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym497 := z.EncBinary() - _ = yym497 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -7148,8 +8375,8 @@ func (x *PersistentVolumeClaimPhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym498 := z.DecBinary() - _ = yym498 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -7164,45 +8391,52 @@ func (x *HostPathVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym499 := z.EncBinary() - _ = yym499 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep500 := !z.EncBinary() - yy2arr500 := z.EncBasicHandle().StructToArray - var yyq500 [1]bool - _, _, _ = yysep500, yyq500, yy2arr500 - const yyr500 bool = false - if yyr500 || yy2arr500 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn500 int = 1 - for _, b := range yyq500 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn500++ + yynn2++ } } - r.EncodeMapStart(yynn500) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr500 || yy2arr500 { - yym502 := z.EncBinary() - _ = yym502 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym503 := z.EncBinary() - _ = yym503 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } - if yysep500 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7212,24 +8446,25 @@ func (x *HostPathVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym504 := z.DecBinary() - _ = yym504 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl505 := r.ReadMapStart() - if yyl505 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl505, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl505 := r.ReadArrayStart() - if yyl505 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl505, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7241,12 +8476,12 @@ func (x *HostPathVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys506Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys506Slc - var yyhl506 bool = l >= 0 - for yyj506 := 0; ; yyj506++ { - if yyhl506 { - if yyj506 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7254,9 +8489,11 @@ func (x *HostPathVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys506Slc = r.DecodeBytes(yys506Slc, true, true) - yys506 := string(yys506Slc) - switch yys506 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "path": if r.TryDecodeAsNil() { x.Path = "" @@ -7264,49 +8501,49 @@ func (x *HostPathVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode x.Path = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys506) - } // end switch yys506 - } // end for yyj506 - if !yyhl506 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HostPathVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj508 int - var yyb508 bool - var yyhl508 bool = l >= 0 - yyj508++ - if yyhl508 { - yyb508 = yyj508 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb508 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb508 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } for { - yyj508++ - if yyhl508 { - yyb508 = yyj508 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb508 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb508 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj508-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EmptyDirVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7316,42 +8553,49 @@ func (x *EmptyDirVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym510 := z.EncBinary() - _ = yym510 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep511 := !z.EncBinary() - yy2arr511 := z.EncBasicHandle().StructToArray - var yyq511 [1]bool - _, _, _ = yysep511, yyq511, yy2arr511 - const yyr511 bool = false - yyq511[0] = x.Medium != "" - if yyr511 || yy2arr511 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Medium != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn511 int = 0 - for _, b := range yyq511 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn511++ + yynn2++ } } - r.EncodeMapStart(yynn511) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr511 || yy2arr511 { - if yyq511[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Medium.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq511[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("medium")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Medium.CodecEncodeSelf(e) } } - if yysep511 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7361,24 +8605,25 @@ func (x *EmptyDirVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym513 := z.DecBinary() - _ = yym513 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl514 := r.ReadMapStart() - if yyl514 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl514, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl514 := r.ReadArrayStart() - if yyl514 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl514, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7390,12 +8635,12 @@ func (x *EmptyDirVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys515Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys515Slc - var yyhl515 bool = l >= 0 - for yyj515 := 0; ; yyj515++ { - if yyhl515 { - if yyj515 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7403,9 +8648,11 @@ func (x *EmptyDirVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys515Slc = r.DecodeBytes(yys515Slc, true, true) - yys515 := string(yys515Slc) - switch yys515 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "medium": if r.TryDecodeAsNil() { x.Medium = "" @@ -7413,49 +8660,49 @@ func (x *EmptyDirVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decode x.Medium = StorageMedium(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys515) - } // end switch yys515 - } // end for yyj515 - if !yyhl515 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EmptyDirVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj517 int - var yyb517 bool - var yyhl517 bool = l >= 0 - yyj517++ - if yyhl517 { - yyb517 = yyj517 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb517 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb517 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Medium = "" } else { x.Medium = StorageMedium(r.DecodeString()) } for { - yyj517++ - if yyhl517 { - yyb517 = yyj517 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb517 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb517 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj517-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *GlusterfsVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7465,64 +8712,73 @@ func (x *GlusterfsVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym519 := z.EncBinary() - _ = yym519 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep520 := !z.EncBinary() - yy2arr520 := z.EncBasicHandle().StructToArray - var yyq520 [3]bool - _, _, _ = yysep520, yyq520, yy2arr520 - const yyr520 bool = false - yyq520[2] = x.ReadOnly != false - if yyr520 || yy2arr520 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn520 int = 2 - for _, b := range yyq520 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn520++ + yynn2++ } } - r.EncodeMapStart(yynn520) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr520 || yy2arr520 { - yym522 := z.EncBinary() - _ = yym522 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.EndpointsName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("endpoints")) - yym523 := z.EncBinary() - _ = yym523 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.EndpointsName)) } } - if yyr520 || yy2arr520 { - yym525 := z.EncBinary() - _ = yym525 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym526 := z.EncBinary() - _ = yym526 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } - if yyr520 || yy2arr520 { - if yyq520[2] { - yym528 := z.EncBinary() - _ = yym528 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -7531,18 +8787,22 @@ func (x *GlusterfsVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq520[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym529 := z.EncBinary() - _ = yym529 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep520 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7552,24 +8812,25 @@ func (x *GlusterfsVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym530 := z.DecBinary() - _ = yym530 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl531 := r.ReadMapStart() - if yyl531 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl531, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl531 := r.ReadArrayStart() - if yyl531 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl531, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7581,12 +8842,12 @@ func (x *GlusterfsVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys532Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys532Slc - var yyhl532 bool = l >= 0 - for yyj532 := 0; ; yyj532++ { - if yyhl532 { - if yyj532 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7594,9 +8855,11 @@ func (x *GlusterfsVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys532Slc = r.DecodeBytes(yys532Slc, true, true) - yys532 := string(yys532Slc) - switch yys532 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "endpoints": if r.TryDecodeAsNil() { x.EndpointsName = "" @@ -7616,105 +8879,81 @@ func (x *GlusterfsVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decod x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys532) - } // end switch yys532 - } // end for yyj532 - if !yyhl532 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *GlusterfsVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj536 int - var yyb536 bool - var yyhl536 bool = l >= 0 - yyj536++ - if yyhl536 { - yyb536 = yyj536 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb536 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb536 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.EndpointsName = "" } else { x.EndpointsName = string(r.DecodeString()) } - yyj536++ - if yyhl536 { - yyb536 = yyj536 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb536 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb536 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj536++ - if yyhl536 { - yyb536 = yyj536 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb536 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb536 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj536++ - if yyhl536 { - yyb536 = yyj536 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb536 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb536 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj536-1, "") - } - r.ReadEnd() -} - -func (x StorageMedium) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - yym540 := z.EncBinary() - _ = yym540 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x)) - } -} - -func (x *StorageMedium) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym541 := z.DecBinary() - _ = yym541 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - *((*string)(x)) = r.DecodeString() + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7724,73 +8963,82 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym542 := z.EncBinary() - _ = yym542 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep543 := !z.EncBinary() - yy2arr543 := z.EncBasicHandle().StructToArray - var yyq543 [8]bool - _, _, _ = yysep543, yyq543, yy2arr543 - const yyr543 bool = false - yyq543[2] = x.FSType != "" - yyq543[7] = x.ReadOnly != false - if yyr543 || yy2arr543 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.FSType != "" + yyq2[7] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - var yynn543 int = 6 - for _, b := range yyq543 { + yynn2 = 6 + for _, b := range yyq2 { if b { - yynn543++ + yynn2++ } } - r.EncodeMapStart(yynn543) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr543 || yy2arr543 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.CephMonitors == nil { r.EncodeNil() } else { - yym545 := z.EncBinary() - _ = yym545 + yym4 := z.EncBinary() + _ = yym4 if false { } else { z.F.EncSliceStringV(x.CephMonitors, false, e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("monitors")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CephMonitors == nil { r.EncodeNil() } else { - yym546 := z.EncBinary() - _ = yym546 + yym5 := z.EncBinary() + _ = yym5 if false { } else { z.F.EncSliceStringV(x.CephMonitors, false, e) } } } - if yyr543 || yy2arr543 { - yym548 := z.EncBinary() - _ = yym548 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RBDImage)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("image")) - yym549 := z.EncBinary() - _ = yym549 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RBDImage)) } } - if yyr543 || yy2arr543 { - if yyq543[2] { - yym551 := z.EncBinary() - _ = yym551 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) @@ -7799,82 +9047,97 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq543[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym552 := z.EncBinary() - _ = yym552 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) } } } - if yyr543 || yy2arr543 { - yym554 := z.EncBinary() - _ = yym554 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("pool")) - yym555 := z.EncBinary() - _ = yym555 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) } } - if yyr543 || yy2arr543 { - yym557 := z.EncBinary() - _ = yym557 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("user")) - yym558 := z.EncBinary() - _ = yym558 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) } } - if yyr543 || yy2arr543 { - yym560 := z.EncBinary() - _ = yym560 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("keyring")) - yym561 := z.EncBinary() - _ = yym561 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) } } - if yyr543 || yy2arr543 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.SecretRef == nil { r.EncodeNil() } else { x.SecretRef.CodecEncodeSelf(e) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secretRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SecretRef == nil { r.EncodeNil() } else { x.SecretRef.CodecEncodeSelf(e) } } - if yyr543 || yy2arr543 { - if yyq543[7] { - yym564 := z.EncBinary() - _ = yym564 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym25 := z.EncBinary() + _ = yym25 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -7883,18 +9146,22 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq543[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym565 := z.EncBinary() - _ = yym565 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep543 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7904,24 +9171,25 @@ func (x *RBDVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym566 := z.DecBinary() - _ = yym566 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl567 := r.ReadMapStart() - if yyl567 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl567, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl567 := r.ReadArrayStart() - if yyl567 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl567, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7933,12 +9201,12 @@ func (x *RBDVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys568Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys568Slc - var yyhl568 bool = l >= 0 - for yyj568 := 0; ; yyj568++ { - if yyhl568 { - if yyj568 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7946,19 +9214,21 @@ func (x *RBDVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys568Slc = r.DecodeBytes(yys568Slc, true, true) - yys568 := string(yys568Slc) - switch yys568 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "monitors": if r.TryDecodeAsNil() { x.CephMonitors = nil } else { - yyv569 := &x.CephMonitors - yym570 := z.DecBinary() - _ = yym570 + yyv4 := &x.CephMonitors + yym5 := z.DecBinary() + _ = yym5 if false { } else { - z.F.DecSliceStringX(yyv569, false, d) + z.F.DecSliceStringX(yyv4, false, d) } } case "image": @@ -8009,127 +9279,132 @@ func (x *RBDVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys568) - } // end switch yys568 - } // end for yyj568 - if !yyhl568 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *RBDVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj578 int - var yyb578 bool - var yyhl578 bool = l >= 0 - yyj578++ - if yyhl578 { - yyb578 = yyj578 > l + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb578 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb578 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.CephMonitors = nil } else { - yyv579 := &x.CephMonitors - yym580 := z.DecBinary() - _ = yym580 + yyv14 := &x.CephMonitors + yym15 := z.DecBinary() + _ = yym15 if false { } else { - z.F.DecSliceStringX(yyv579, false, d) + z.F.DecSliceStringX(yyv14, false, d) } } - yyj578++ - if yyhl578 { - yyb578 = yyj578 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb578 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb578 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RBDImage = "" } else { x.RBDImage = string(r.DecodeString()) } - yyj578++ - if yyhl578 { - yyb578 = yyj578 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb578 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb578 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj578++ - if yyhl578 { - yyb578 = yyj578 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb578 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb578 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RBDPool = "" } else { x.RBDPool = string(r.DecodeString()) } - yyj578++ - if yyhl578 { - yyb578 = yyj578 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb578 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb578 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RadosUser = "" } else { x.RadosUser = string(r.DecodeString()) } - yyj578++ - if yyhl578 { - yyb578 = yyj578 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb578 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb578 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Keyring = "" } else { x.Keyring = string(r.DecodeString()) } - yyj578++ - if yyhl578 { - yyb578 = yyj578 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb578 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb578 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SecretRef != nil { x.SecretRef = nil @@ -8140,34 +9415,36 @@ func (x *RBDVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) } x.SecretRef.CodecDecodeSelf(d) } - yyj578++ - if yyhl578 { - yyb578 = yyj578 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb578 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb578 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj578++ - if yyhl578 { - yyb578 = yyj578 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb578 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb578 { + if yyb13 { break } - z.DecStructFieldNotFound(yyj578-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *CinderVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -8177,49 +9454,55 @@ func (x *CinderVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym588 := z.EncBinary() - _ = yym588 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep589 := !z.EncBinary() - yy2arr589 := z.EncBasicHandle().StructToArray - var yyq589 [3]bool - _, _, _ = yysep589, yyq589, yy2arr589 - const yyr589 bool = false - yyq589[1] = x.FSType != "" - yyq589[2] = x.ReadOnly != false - if yyr589 || yy2arr589 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.FSType != "" + yyq2[2] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn589 int = 1 - for _, b := range yyq589 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn589++ + yynn2++ } } - r.EncodeMapStart(yynn589) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr589 || yy2arr589 { - yym591 := z.EncBinary() - _ = yym591 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeID")) - yym592 := z.EncBinary() - _ = yym592 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeID)) } } - if yyr589 || yy2arr589 { - if yyq589[1] { - yym594 := z.EncBinary() - _ = yym594 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) @@ -8228,20 +9511,23 @@ func (x *CinderVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq589[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym595 := z.EncBinary() - _ = yym595 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) } } } - if yyr589 || yy2arr589 { - if yyq589[2] { - yym597 := z.EncBinary() - _ = yym597 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -8250,18 +9536,22 @@ func (x *CinderVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq589[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym598 := z.EncBinary() - _ = yym598 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep589 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8271,24 +9561,25 @@ func (x *CinderVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym599 := z.DecBinary() - _ = yym599 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl600 := r.ReadMapStart() - if yyl600 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl600, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl600 := r.ReadArrayStart() - if yyl600 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl600, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8300,12 +9591,12 @@ func (x *CinderVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys601Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys601Slc - var yyhl601 bool = l >= 0 - for yyj601 := 0; ; yyj601++ { - if yyhl601 { - if yyj601 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8313,9 +9604,11 @@ func (x *CinderVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys601Slc = r.DecodeBytes(yys601Slc, true, true) - yys601 := string(yys601Slc) - switch yys601 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "volumeID": if r.TryDecodeAsNil() { x.VolumeID = "" @@ -8335,79 +9628,81 @@ func (x *CinderVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys601) - } // end switch yys601 - } // end for yyj601 - if !yyhl601 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *CinderVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj605 int - var yyb605 bool - var yyhl605 bool = l >= 0 - yyj605++ - if yyhl605 { - yyb605 = yyj605 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb605 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb605 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.VolumeID = "" } else { x.VolumeID = string(r.DecodeString()) } - yyj605++ - if yyhl605 { - yyb605 = yyj605 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb605 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb605 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj605++ - if yyhl605 { - yyb605 = yyj605 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb605 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb605 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj605++ - if yyhl605 { - yyb605 = yyj605 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb605 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb605 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj605-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -8417,59 +9712,91 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym609 := z.EncBinary() - _ = yym609 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep610 := !z.EncBinary() - yy2arr610 := z.EncBasicHandle().StructToArray - var yyq610 [5]bool - _, _, _ = yysep610, yyq610, yy2arr610 - const yyr610 bool = false - yyq610[1] = x.User != "" - yyq610[2] = x.SecretFile != "" - yyq610[3] = x.SecretRef != nil - yyq610[4] = x.ReadOnly != false - if yyr610 || yy2arr610 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Path != "" + yyq2[2] = x.User != "" + yyq2[3] = x.SecretFile != "" + yyq2[4] = x.SecretRef != nil + yyq2[5] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(6) } else { - var yynn610 int = 1 - for _, b := range yyq610 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn610++ + yynn2++ } } - r.EncodeMapStart(yynn610) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr610 || yy2arr610 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Monitors == nil { r.EncodeNil() } else { - yym612 := z.EncBinary() - _ = yym612 + yym4 := z.EncBinary() + _ = yym4 if false { } else { z.F.EncSliceStringV(x.Monitors, false, e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("monitors")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Monitors == nil { r.EncodeNil() } else { - yym613 := z.EncBinary() - _ = yym613 + yym5 := z.EncBinary() + _ = yym5 if false { } else { z.F.EncSliceStringV(x.Monitors, false, e) } } } - if yyr610 || yy2arr610 { - if yyq610[1] { - yym615 := z.EncBinary() - _ = yym615 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("path")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.User)) @@ -8478,20 +9805,23 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq610[1] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("user")) - yym616 := z.EncBinary() - _ = yym616 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.User)) } } } - if yyr610 || yy2arr610 { - if yyq610[2] { - yym618 := z.EncBinary() - _ = yym618 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SecretFile)) @@ -8500,18 +9830,21 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq610[2] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secretFile")) - yym619 := z.EncBinary() - _ = yym619 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SecretFile)) } } } - if yyr610 || yy2arr610 { - if yyq610[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.SecretRef == nil { r.EncodeNil() } else { @@ -8521,8 +9854,10 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq610[3] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secretRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SecretRef == nil { r.EncodeNil() } else { @@ -8530,10 +9865,11 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr610 || yy2arr610 { - if yyq610[4] { - yym622 := z.EncBinary() - _ = yym622 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -8542,18 +9878,22 @@ func (x *CephFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq610[4] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym623 := z.EncBinary() - _ = yym623 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep610 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8563,24 +9903,25 @@ func (x *CephFSVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym624 := z.DecBinary() - _ = yym624 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl625 := r.ReadMapStart() - if yyl625 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl625, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl625 := r.ReadArrayStart() - if yyl625 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl625, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8592,12 +9933,12 @@ func (x *CephFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys626Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys626Slc - var yyhl626 bool = l >= 0 - for yyj626 := 0; ; yyj626++ { - if yyhl626 { - if yyj626 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8605,21 +9946,29 @@ func (x *CephFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys626Slc = r.DecodeBytes(yys626Slc, true, true) - yys626 := string(yys626Slc) - switch yys626 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "monitors": if r.TryDecodeAsNil() { x.Monitors = nil } else { - yyv627 := &x.Monitors - yym628 := z.DecBinary() - _ = yym628 + yyv4 := &x.Monitors + yym5 := z.DecBinary() + _ = yym5 if false { } else { - z.F.DecSliceStringX(yyv627, false, d) + z.F.DecSliceStringX(yyv4, false, d) } } + case "path": + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } case "user": if r.TryDecodeAsNil() { x.User = "" @@ -8650,82 +9999,100 @@ func (x *CephFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys626) - } // end switch yys626 - } // end for yyj626 - if !yyhl626 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *CephFSVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj633 int - var yyb633 bool - var yyhl633 bool = l >= 0 - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb633 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb633 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Monitors = nil } else { - yyv634 := &x.Monitors - yym635 := z.DecBinary() - _ = yym635 + yyv12 := &x.Monitors + yym13 := z.DecBinary() + _ = yym13 if false { } else { - z.F.DecSliceStringX(yyv634, false, d) + z.F.DecSliceStringX(yyv12, false, d) } } - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb633 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb633 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.User = "" } else { x.User = string(r.DecodeString()) } - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb633 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb633 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SecretFile = "" } else { x.SecretFile = string(r.DecodeString()) } - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb633 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb633 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SecretRef != nil { x.SecretRef = nil @@ -8736,34 +10103,36 @@ func (x *CephFSVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decode } x.SecretRef.CodecDecodeSelf(d) } - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb633 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb633 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj633++ - if yyhl633 { - yyb633 = yyj633 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb633 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb633 { + if yyb11 { break } - z.DecStructFieldNotFound(yyj633-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *FlockerVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -8773,45 +10142,52 @@ func (x *FlockerVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym640 := z.EncBinary() - _ = yym640 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep641 := !z.EncBinary() - yy2arr641 := z.EncBasicHandle().StructToArray - var yyq641 [1]bool - _, _, _ = yysep641, yyq641, yy2arr641 - const yyr641 bool = false - if yyr641 || yy2arr641 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn641 int = 1 - for _, b := range yyq641 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn641++ + yynn2++ } } - r.EncodeMapStart(yynn641) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr641 || yy2arr641 { - yym643 := z.EncBinary() - _ = yym643 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.DatasetName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("datasetName")) - yym644 := z.EncBinary() - _ = yym644 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.DatasetName)) } } - if yysep641 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8821,24 +10197,25 @@ func (x *FlockerVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym645 := z.DecBinary() - _ = yym645 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl646 := r.ReadMapStart() - if yyl646 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl646, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl646 := r.ReadArrayStart() - if yyl646 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl646, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8850,12 +10227,12 @@ func (x *FlockerVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys647Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys647Slc - var yyhl647 bool = l >= 0 - for yyj647 := 0; ; yyj647++ { - if yyhl647 { - if yyj647 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8863,9 +10240,11 @@ func (x *FlockerVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys647Slc = r.DecodeBytes(yys647Slc, true, true) - yys647 := string(yys647Slc) - switch yys647 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "datasetName": if r.TryDecodeAsNil() { x.DatasetName = "" @@ -8873,57 +10252,83 @@ func (x *FlockerVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder x.DatasetName = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys647) - } // end switch yys647 - } // end for yyj647 - if !yyhl647 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *FlockerVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj649 int - var yyb649 bool - var yyhl649 bool = l >= 0 - yyj649++ - if yyhl649 { - yyb649 = yyj649 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb649 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb649 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DatasetName = "" } else { x.DatasetName = string(r.DecodeString()) } for { - yyj649++ - if yyhl649 { - yyb649 = yyj649 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb649 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb649 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj649-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x StorageMedium) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x)) + } +} + +func (x *StorageMedium) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() } - r.ReadEnd() } func (x Protocol) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym651 := z.EncBinary() - _ = yym651 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -8935,8 +10340,8 @@ func (x *Protocol) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym652 := z.DecBinary() - _ = yym652 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -8951,65 +10356,81 @@ func (x *GCEPersistentDiskVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym653 := z.EncBinary() - _ = yym653 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep654 := !z.EncBinary() - yy2arr654 := z.EncBasicHandle().StructToArray - var yyq654 [4]bool - _, _, _ = yysep654, yyq654, yy2arr654 - const yyr654 bool = false - yyq654[2] = x.Partition != 0 - yyq654[3] = x.ReadOnly != false - if yyr654 || yy2arr654 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.FSType != "" + yyq2[2] = x.Partition != 0 + yyq2[3] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn654 int = 2 - for _, b := range yyq654 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn654++ + yynn2++ } } - r.EncodeMapStart(yynn654) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr654 || yy2arr654 { - yym656 := z.EncBinary() - _ = yym656 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PDName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("pdName")) - yym657 := z.EncBinary() - _ = yym657 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PDName)) } } - if yyr654 || yy2arr654 { - yym659 := z.EncBinary() - _ = yym659 - if false { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym660 := z.EncBinary() - _ = yym660 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fsType")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } } } - if yyr654 || yy2arr654 { - if yyq654[2] { - yym662 := z.EncBinary() - _ = yym662 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.Partition)) @@ -9018,20 +10439,23 @@ func (x *GCEPersistentDiskVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq654[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("partition")) - yym663 := z.EncBinary() - _ = yym663 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.Partition)) } } } - if yyr654 || yy2arr654 { - if yyq654[3] { - yym665 := z.EncBinary() - _ = yym665 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -9040,18 +10464,22 @@ func (x *GCEPersistentDiskVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq654[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym666 := z.EncBinary() - _ = yym666 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep654 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9061,24 +10489,25 @@ func (x *GCEPersistentDiskVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym667 := z.DecBinary() - _ = yym667 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl668 := r.ReadMapStart() - if yyl668 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl668, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl668 := r.ReadArrayStart() - if yyl668 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl668, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9090,12 +10519,12 @@ func (x *GCEPersistentDiskVolumeSource) codecDecodeSelfFromMap(l int, d *codec19 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys669Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys669Slc - var yyhl669 bool = l >= 0 - for yyj669 := 0; ; yyj669++ { - if yyhl669 { - if yyj669 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9103,9 +10532,11 @@ func (x *GCEPersistentDiskVolumeSource) codecDecodeSelfFromMap(l int, d *codec19 break } } - yys669Slc = r.DecodeBytes(yys669Slc, true, true) - yys669 := string(yys669Slc) - switch yys669 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "pdName": if r.TryDecodeAsNil() { x.PDName = "" @@ -9122,7 +10553,7 @@ func (x *GCEPersistentDiskVolumeSource) codecDecodeSelfFromMap(l int, d *codec19 if r.TryDecodeAsNil() { x.Partition = 0 } else { - x.Partition = int(r.DecodeInt(codecSelferBitsize1234)) + x.Partition = int32(r.DecodeInt(32)) } case "readOnly": if r.TryDecodeAsNil() { @@ -9131,94 +10562,479 @@ func (x *GCEPersistentDiskVolumeSource) codecDecodeSelfFromMap(l int, d *codec19 x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys669) - } // end switch yys669 - } // end for yyj669 - if !yyhl669 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *GCEPersistentDiskVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj674 int - var yyb674 bool - var yyhl674 bool = l >= 0 - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb674 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb674 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.PDName = "" } else { x.PDName = string(r.DecodeString()) } - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb674 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb674 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb674 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb674 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Partition = 0 } else { - x.Partition = int(r.DecodeInt(codecSelferBitsize1234)) + x.Partition = int32(r.DecodeInt(32)) } - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb674 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb674 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb674 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb674 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj674-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *FlexVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.FSType != "" + yyq2[2] = x.SecretRef != nil + yyq2[3] = x.ReadOnly != false + yyq2[4] = len(x.Options) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Driver)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("driver")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Driver)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fsType")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.SecretRef == nil { + r.EncodeNil() + } else { + x.SecretRef.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SecretRef == nil { + r.EncodeNil() + } else { + x.SecretRef.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.ReadOnly)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("readOnly")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.ReadOnly)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.Options == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + z.F.EncMapStringStringV(x.Options, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("options")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Options == nil { + r.EncodeNil() + } else { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + z.F.EncMapStringStringV(x.Options, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *FlexVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *FlexVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "driver": + if r.TryDecodeAsNil() { + x.Driver = "" + } else { + x.Driver = string(r.DecodeString()) + } + case "fsType": + if r.TryDecodeAsNil() { + x.FSType = "" + } else { + x.FSType = string(r.DecodeString()) + } + case "secretRef": + if r.TryDecodeAsNil() { + if x.SecretRef != nil { + x.SecretRef = nil + } + } else { + if x.SecretRef == nil { + x.SecretRef = new(LocalObjectReference) + } + x.SecretRef.CodecDecodeSelf(d) + } + case "readOnly": + if r.TryDecodeAsNil() { + x.ReadOnly = false + } else { + x.ReadOnly = bool(r.DecodeBool()) + } + case "options": + if r.TryDecodeAsNil() { + x.Options = nil + } else { + yyv8 := &x.Options + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + z.F.DecMapStringStringX(yyv8, false, d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *FlexVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Driver = "" + } else { + x.Driver = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.FSType = "" + } else { + x.FSType = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SecretRef != nil { + x.SecretRef = nil + } + } else { + if x.SecretRef == nil { + x.SecretRef = new(LocalObjectReference) + } + x.SecretRef.CodecDecodeSelf(d) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ReadOnly = false + } else { + x.ReadOnly = bool(r.DecodeBool()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Options = nil + } else { + yyv15 := &x.Options + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + z.F.DecMapStringStringX(yyv15, false, d) + } + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *AWSElasticBlockStoreVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9228,65 +11044,81 @@ func (x *AWSElasticBlockStoreVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) if x == nil { r.EncodeNil() } else { - yym679 := z.EncBinary() - _ = yym679 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep680 := !z.EncBinary() - yy2arr680 := z.EncBasicHandle().StructToArray - var yyq680 [4]bool - _, _, _ = yysep680, yyq680, yy2arr680 - const yyr680 bool = false - yyq680[2] = x.Partition != 0 - yyq680[3] = x.ReadOnly != false - if yyr680 || yy2arr680 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.FSType != "" + yyq2[2] = x.Partition != 0 + yyq2[3] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn680 int = 2 - for _, b := range yyq680 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn680++ + yynn2++ } } - r.EncodeMapStart(yynn680) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr680 || yy2arr680 { - yym682 := z.EncBinary() - _ = yym682 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeID")) - yym683 := z.EncBinary() - _ = yym683 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.VolumeID)) } } - if yyr680 || yy2arr680 { - yym685 := z.EncBinary() - _ = yym685 - if false { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym686 := z.EncBinary() - _ = yym686 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fsType")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } } } - if yyr680 || yy2arr680 { - if yyq680[2] { - yym688 := z.EncBinary() - _ = yym688 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.Partition)) @@ -9295,20 +11127,23 @@ func (x *AWSElasticBlockStoreVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) r.EncodeInt(0) } } else { - if yyq680[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("partition")) - yym689 := z.EncBinary() - _ = yym689 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.Partition)) } } } - if yyr680 || yy2arr680 { - if yyq680[3] { - yym691 := z.EncBinary() - _ = yym691 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -9317,18 +11152,22 @@ func (x *AWSElasticBlockStoreVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) r.EncodeBool(false) } } else { - if yyq680[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym692 := z.EncBinary() - _ = yym692 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep680 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9338,24 +11177,25 @@ func (x *AWSElasticBlockStoreVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym693 := z.DecBinary() - _ = yym693 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl694 := r.ReadMapStart() - if yyl694 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl694, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl694 := r.ReadArrayStart() - if yyl694 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl694, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9367,12 +11207,12 @@ func (x *AWSElasticBlockStoreVolumeSource) codecDecodeSelfFromMap(l int, d *code var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys695Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys695Slc - var yyhl695 bool = l >= 0 - for yyj695 := 0; ; yyj695++ { - if yyhl695 { - if yyj695 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9380,9 +11220,11 @@ func (x *AWSElasticBlockStoreVolumeSource) codecDecodeSelfFromMap(l int, d *code break } } - yys695Slc = r.DecodeBytes(yys695Slc, true, true) - yys695 := string(yys695Slc) - switch yys695 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "volumeID": if r.TryDecodeAsNil() { x.VolumeID = "" @@ -9399,7 +11241,7 @@ func (x *AWSElasticBlockStoreVolumeSource) codecDecodeSelfFromMap(l int, d *code if r.TryDecodeAsNil() { x.Partition = 0 } else { - x.Partition = int(r.DecodeInt(codecSelferBitsize1234)) + x.Partition = int32(r.DecodeInt(32)) } case "readOnly": if r.TryDecodeAsNil() { @@ -9408,94 +11250,97 @@ func (x *AWSElasticBlockStoreVolumeSource) codecDecodeSelfFromMap(l int, d *code x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys695) - } // end switch yys695 - } // end for yyj695 - if !yyhl695 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *AWSElasticBlockStoreVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj700 int - var yyb700 bool - var yyhl700 bool = l >= 0 - yyj700++ - if yyhl700 { - yyb700 = yyj700 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb700 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb700 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.VolumeID = "" } else { x.VolumeID = string(r.DecodeString()) } - yyj700++ - if yyhl700 { - yyb700 = yyj700 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb700 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb700 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj700++ - if yyhl700 { - yyb700 = yyj700 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb700 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb700 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Partition = 0 } else { - x.Partition = int(r.DecodeInt(codecSelferBitsize1234)) + x.Partition = int32(r.DecodeInt(32)) } - yyj700++ - if yyhl700 { - yyb700 = yyj700 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb700 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb700 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj700++ - if yyhl700 { - yyb700 = yyj700 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb700 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb700 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj700-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *GitRepoVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9505,61 +11350,104 @@ func (x *GitRepoVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym705 := z.EncBinary() - _ = yym705 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep706 := !z.EncBinary() - yy2arr706 := z.EncBasicHandle().StructToArray - var yyq706 [2]bool - _, _, _ = yysep706, yyq706, yy2arr706 - const yyr706 bool = false - if yyr706 || yy2arr706 { - r.EncodeArrayStart(2) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Revision != "" + yyq2[2] = x.Directory != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) } else { - var yynn706 int = 2 - for _, b := range yyq706 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn706++ + yynn2++ } } - r.EncodeMapStart(yynn706) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr706 || yy2arr706 { - yym708 := z.EncBinary() - _ = yym708 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Repository)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("repository")) - yym709 := z.EncBinary() - _ = yym709 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Repository)) } } - if yyr706 || yy2arr706 { - yym711 := z.EncBinary() - _ = yym711 - if false { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Revision)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Revision)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - r.EncodeString(codecSelferC_UTF81234, string("revision")) - yym712 := z.EncBinary() - _ = yym712 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Revision)) + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("revision")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Revision)) + } } } - if yysep706 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Directory)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("directory")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Directory)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9569,24 +11457,25 @@ func (x *GitRepoVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym713 := z.DecBinary() - _ = yym713 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl714 := r.ReadMapStart() - if yyl714 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl714, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl714 := r.ReadArrayStart() - if yyl714 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl714, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9598,12 +11487,12 @@ func (x *GitRepoVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys715Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys715Slc - var yyhl715 bool = l >= 0 - for yyj715 := 0; ; yyj715++ { - if yyhl715 { - if yyj715 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9611,9 +11500,11 @@ func (x *GitRepoVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys715Slc = r.DecodeBytes(yys715Slc, true, true) - yys715 := string(yys715Slc) - switch yys715 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "repository": if r.TryDecodeAsNil() { x.Repository = "" @@ -9626,65 +11517,88 @@ func (x *GitRepoVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder } else { x.Revision = string(r.DecodeString()) } + case "directory": + if r.TryDecodeAsNil() { + x.Directory = "" + } else { + x.Directory = string(r.DecodeString()) + } default: - z.DecStructFieldNotFound(-1, yys715) - } // end switch yys715 - } // end for yyj715 - if !yyhl715 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *GitRepoVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj718 int - var yyb718 bool - var yyhl718 bool = l >= 0 - yyj718++ - if yyhl718 { - yyb718 = yyj718 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb718 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb718 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Repository = "" } else { x.Repository = string(r.DecodeString()) } - yyj718++ - if yyhl718 { - yyb718 = yyj718 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb718 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb718 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Revision = "" } else { x.Revision = string(r.DecodeString()) } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Directory = "" + } else { + x.Directory = string(r.DecodeString()) + } for { - yyj718++ - if yyhl718 { - yyb718 = yyj718 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb718 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb718 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj718-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SecretVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9694,45 +11608,59 @@ func (x *SecretVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym721 := z.EncBinary() - _ = yym721 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep722 := !z.EncBinary() - yy2arr722 := z.EncBasicHandle().StructToArray - var yyq722 [1]bool - _, _, _ = yysep722, yyq722, yy2arr722 - const yyr722 bool = false - if yyr722 || yy2arr722 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.SecretName != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn722 int = 1 - for _, b := range yyq722 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn722++ + yynn2++ } } - r.EncodeMapStart(yynn722) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr722 || yy2arr722 { - yym724 := z.EncBinary() - _ = yym724 - if false { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - r.EncodeString(codecSelferC_UTF81234, string("secretName")) - yym725 := z.EncBinary() - _ = yym725 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } } } - if yysep722 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9742,24 +11670,25 @@ func (x *SecretVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym726 := z.DecBinary() - _ = yym726 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl727 := r.ReadMapStart() - if yyl727 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl727, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl727 := r.ReadArrayStart() - if yyl727 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl727, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9771,12 +11700,12 @@ func (x *SecretVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys728Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys728Slc - var yyhl728 bool = l >= 0 - for yyj728 := 0; ; yyj728++ { - if yyhl728 { - if yyj728 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9784,9 +11713,11 @@ func (x *SecretVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys728Slc = r.DecodeBytes(yys728Slc, true, true) - yys728 := string(yys728Slc) - switch yys728 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "secretName": if r.TryDecodeAsNil() { x.SecretName = "" @@ -9794,49 +11725,49 @@ func (x *SecretVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.SecretName = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys728) - } // end switch yys728 - } // end for yyj728 - if !yyhl728 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SecretVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj730 int - var yyb730 bool - var yyhl730 bool = l >= 0 - yyj730++ - if yyhl730 { - yyb730 = yyj730 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb730 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb730 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SecretName = "" } else { x.SecretName = string(r.DecodeString()) } for { - yyj730++ - if yyhl730 { - yyb730 = yyj730 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb730 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb730 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj730-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9846,64 +11777,73 @@ func (x *NFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym732 := z.EncBinary() - _ = yym732 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep733 := !z.EncBinary() - yy2arr733 := z.EncBasicHandle().StructToArray - var yyq733 [3]bool - _, _, _ = yysep733, yyq733, yy2arr733 - const yyr733 bool = false - yyq733[2] = x.ReadOnly != false - if yyr733 || yy2arr733 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn733 int = 2 - for _, b := range yyq733 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn733++ + yynn2++ } } - r.EncodeMapStart(yynn733) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr733 || yy2arr733 { - yym735 := z.EncBinary() - _ = yym735 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Server)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("server")) - yym736 := z.EncBinary() - _ = yym736 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Server)) } } - if yyr733 || yy2arr733 { - yym738 := z.EncBinary() - _ = yym738 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym739 := z.EncBinary() - _ = yym739 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } - if yyr733 || yy2arr733 { - if yyq733[2] { - yym741 := z.EncBinary() - _ = yym741 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -9912,18 +11852,22 @@ func (x *NFSVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq733[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym742 := z.EncBinary() - _ = yym742 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep733 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9933,24 +11877,25 @@ func (x *NFSVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym743 := z.DecBinary() - _ = yym743 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl744 := r.ReadMapStart() - if yyl744 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl744, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl744 := r.ReadArrayStart() - if yyl744 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl744, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9962,12 +11907,12 @@ func (x *NFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys745Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys745Slc - var yyhl745 bool = l >= 0 - for yyj745 := 0; ; yyj745++ { - if yyhl745 { - if yyj745 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9975,9 +11920,11 @@ func (x *NFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys745Slc = r.DecodeBytes(yys745Slc, true, true) - yys745 := string(yys745Slc) - switch yys745 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "server": if r.TryDecodeAsNil() { x.Server = "" @@ -9997,79 +11944,81 @@ func (x *NFSVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys745) - } // end switch yys745 - } // end for yyj745 - if !yyhl745 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NFSVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj749 int - var yyb749 bool - var yyhl749 bool = l >= 0 - yyj749++ - if yyhl749 { - yyb749 = yyj749 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb749 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb749 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Server = "" } else { x.Server = string(r.DecodeString()) } - yyj749++ - if yyhl749 { - yyb749 = yyj749 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb749 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb749 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj749++ - if yyhl749 { - yyb749 = yyj749 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb749 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb749 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj749++ - if yyhl749 { - yyb749 = yyj749 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb749 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb749 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj749-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10079,96 +12028,144 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym753 := z.EncBinary() - _ = yym753 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep754 := !z.EncBinary() - yy2arr754 := z.EncBasicHandle().StructToArray - var yyq754 [5]bool - _, _, _ = yysep754, yyq754, yy2arr754 - const yyr754 bool = false - yyq754[4] = x.ReadOnly != false - if yyr754 || yy2arr754 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[3] = x.ISCSIInterface != "" + yyq2[4] = x.FSType != "" + yyq2[5] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(6) } else { - var yynn754 int = 4 - for _, b := range yyq754 { + yynn2 = 3 + for _, b := range yyq2 { if b { - yynn754++ + yynn2++ } } - r.EncodeMapStart(yynn754) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr754 || yy2arr754 { - yym756 := z.EncBinary() - _ = yym756 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.TargetPortal)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("targetPortal")) - yym757 := z.EncBinary() - _ = yym757 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.TargetPortal)) } } - if yyr754 || yy2arr754 { - yym759 := z.EncBinary() - _ = yym759 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IQN)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("iqn")) - yym760 := z.EncBinary() - _ = yym760 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IQN)) } } - if yyr754 || yy2arr754 { - yym762 := z.EncBinary() - _ = yym762 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.Lun)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lun")) - yym763 := z.EncBinary() - _ = yym763 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.Lun)) } } - if yyr754 || yy2arr754 { - yym765 := z.EncBinary() - _ = yym765 - if false { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ISCSIInterface)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym766 := z.EncBinary() - _ = yym766 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("iscsiInterface")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ISCSIInterface)) + } } } - if yyr754 || yy2arr754 { - if yyq754[4] { - yym768 := z.EncBinary() - _ = yym768 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fsType")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -10177,18 +12174,22 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq754[4] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym769 := z.EncBinary() - _ = yym769 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep754 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10198,24 +12199,25 @@ func (x *ISCSIVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym770 := z.DecBinary() - _ = yym770 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl771 := r.ReadMapStart() - if yyl771 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl771, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl771 := r.ReadArrayStart() - if yyl771 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl771, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10227,12 +12229,12 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys772Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys772Slc - var yyhl772 bool = l >= 0 - for yyj772 := 0; ; yyj772++ { - if yyhl772 { - if yyj772 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10240,9 +12242,11 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys772Slc = r.DecodeBytes(yys772Slc, true, true) - yys772 := string(yys772Slc) - switch yys772 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "targetPortal": if r.TryDecodeAsNil() { x.TargetPortal = "" @@ -10259,7 +12263,13 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) if r.TryDecodeAsNil() { x.Lun = 0 } else { - x.Lun = int(r.DecodeInt(codecSelferBitsize1234)) + x.Lun = int32(r.DecodeInt(32)) + } + case "iscsiInterface": + if r.TryDecodeAsNil() { + x.ISCSIInterface = "" + } else { + x.ISCSIInterface = string(r.DecodeString()) } case "fsType": if r.TryDecodeAsNil() { @@ -10274,109 +12284,129 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys772) - } // end switch yys772 - } // end for yyj772 - if !yyhl772 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj778 int - var yyb778 bool - var yyhl778 bool = l >= 0 - yyj778++ - if yyhl778 { - yyb778 = yyj778 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb778 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb778 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TargetPortal = "" } else { x.TargetPortal = string(r.DecodeString()) } - yyj778++ - if yyhl778 { - yyb778 = yyj778 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb778 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb778 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.IQN = "" } else { x.IQN = string(r.DecodeString()) } - yyj778++ - if yyhl778 { - yyb778 = yyj778 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb778 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb778 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Lun = 0 } else { - x.Lun = int(r.DecodeInt(codecSelferBitsize1234)) + x.Lun = int32(r.DecodeInt(32)) } - yyj778++ - if yyhl778 { - yyb778 = yyj778 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb778 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb778 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ISCSIInterface = "" + } else { + x.ISCSIInterface = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj778++ - if yyhl778 { - yyb778 = yyj778 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb778 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb778 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj778++ - if yyhl778 { - yyb778 = yyj778 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb778 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb778 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj778-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *FCVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10386,98 +12416,117 @@ func (x *FCVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym784 := z.EncBinary() - _ = yym784 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep785 := !z.EncBinary() - yy2arr785 := z.EncBasicHandle().StructToArray - var yyq785 [4]bool - _, _, _ = yysep785, yyq785, yy2arr785 - const yyr785 bool = false - yyq785[3] = x.ReadOnly != false - if yyr785 || yy2arr785 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.FSType != "" + yyq2[3] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn785 int = 3 - for _, b := range yyq785 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn785++ + yynn2++ } } - r.EncodeMapStart(yynn785) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr785 || yy2arr785 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.TargetWWNs == nil { r.EncodeNil() } else { - yym787 := z.EncBinary() - _ = yym787 + yym4 := z.EncBinary() + _ = yym4 if false { } else { z.F.EncSliceStringV(x.TargetWWNs, false, e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("targetWWNs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TargetWWNs == nil { r.EncodeNil() } else { - yym788 := z.EncBinary() - _ = yym788 + yym5 := z.EncBinary() + _ = yym5 if false { } else { z.F.EncSliceStringV(x.TargetWWNs, false, e) } } } - if yyr785 || yy2arr785 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Lun == nil { r.EncodeNil() } else { - yy790 := *x.Lun - yym791 := z.EncBinary() - _ = yym791 + yy7 := *x.Lun + yym8 := z.EncBinary() + _ = yym8 if false { } else { - r.EncodeInt(int64(yy790)) + r.EncodeInt(int64(yy7)) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lun")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Lun == nil { r.EncodeNil() } else { - yy792 := *x.Lun - yym793 := z.EncBinary() - _ = yym793 + yy9 := *x.Lun + yym10 := z.EncBinary() + _ = yym10 if false { } else { - r.EncodeInt(int64(yy792)) + r.EncodeInt(int64(yy9)) } } } - if yyr785 || yy2arr785 { - yym795 := z.EncBinary() - _ = yym795 - if false { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - r.EncodeString(codecSelferC_UTF81234, string("fsType")) - yym796 := z.EncBinary() - _ = yym796 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fsType")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FSType)) + } } } - if yyr785 || yy2arr785 { - if yyq785[3] { - yym798 := z.EncBinary() - _ = yym798 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -10486,18 +12535,22 @@ func (x *FCVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq785[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym799 := z.EncBinary() - _ = yym799 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yysep785 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10507,24 +12560,25 @@ func (x *FCVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym800 := z.DecBinary() - _ = yym800 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl801 := r.ReadMapStart() - if yyl801 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl801, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl801 := r.ReadArrayStart() - if yyl801 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl801, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10536,12 +12590,12 @@ func (x *FCVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys802Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys802Slc - var yyhl802 bool = l >= 0 - for yyj802 := 0; ; yyj802++ { - if yyhl802 { - if yyj802 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10549,19 +12603,21 @@ func (x *FCVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys802Slc = r.DecodeBytes(yys802Slc, true, true) - yys802 := string(yys802Slc) - switch yys802 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "targetWWNs": if r.TryDecodeAsNil() { x.TargetWWNs = nil } else { - yyv803 := &x.TargetWWNs - yym804 := z.DecBinary() - _ = yym804 + yyv4 := &x.TargetWWNs + yym5 := z.DecBinary() + _ = yym5 if false { } else { - z.F.DecSliceStringX(yyv803, false, d) + z.F.DecSliceStringX(yyv4, false, d) } } case "lun": @@ -10571,13 +12627,13 @@ func (x *FCVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } } else { if x.Lun == nil { - x.Lun = new(int) + x.Lun = new(int32) } - yym806 := z.DecBinary() - _ = yym806 + yym7 := z.DecBinary() + _ = yym7 if false { } else { - *((*int)(x.Lun)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Lun)) = int32(r.DecodeInt(32)) } } case "fsType": @@ -10593,110 +12649,804 @@ func (x *FCVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ReadOnly = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys802) - } // end switch yys802 - } // end for yyj802 - if !yyhl802 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *FCVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj809 int - var yyb809 bool - var yyhl809 bool = l >= 0 - yyj809++ - if yyhl809 { - yyb809 = yyj809 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb809 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb809 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TargetWWNs = nil } else { - yyv810 := &x.TargetWWNs - yym811 := z.DecBinary() - _ = yym811 + yyv11 := &x.TargetWWNs + yym12 := z.DecBinary() + _ = yym12 if false { } else { - z.F.DecSliceStringX(yyv810, false, d) + z.F.DecSliceStringX(yyv11, false, d) } } - yyj809++ - if yyhl809 { - yyb809 = yyj809 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb809 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb809 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Lun != nil { x.Lun = nil } } else { if x.Lun == nil { - x.Lun = new(int) + x.Lun = new(int32) } - yym813 := z.DecBinary() - _ = yym813 + yym14 := z.DecBinary() + _ = yym14 if false { } else { - *((*int)(x.Lun)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Lun)) = int32(r.DecodeInt(32)) } } - yyj809++ - if yyhl809 { - yyb809 = yyj809 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb809 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb809 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FSType = "" } else { x.FSType = string(r.DecodeString()) } - yyj809++ - if yyhl809 { - yyb809 = yyj809 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb809 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb809 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } for { - yyj809++ - if yyhl809 { - yyb809 = yyj809 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb809 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb809 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj809-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *AzureFileVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ShareName)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("shareName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ShareName)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.ReadOnly)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("readOnly")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.ReadOnly)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *AzureFileVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *AzureFileVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "secretName": + if r.TryDecodeAsNil() { + x.SecretName = "" + } else { + x.SecretName = string(r.DecodeString()) + } + case "shareName": + if r.TryDecodeAsNil() { + x.ShareName = "" + } else { + x.ShareName = string(r.DecodeString()) + } + case "readOnly": + if r.TryDecodeAsNil() { + x.ReadOnly = false + } else { + x.ReadOnly = bool(r.DecodeBool()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *AzureFileVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SecretName = "" + } else { + x.SecretName = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ShareName = "" + } else { + x.ShareName = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ReadOnly = false + } else { + x.ReadOnly = bool(r.DecodeBool()) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ConfigMapVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Items) != 0 + yyq2[1] = x.Name != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.Items == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceKeyToPath(([]KeyToPath)(x.Items), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceKeyToPath(([]KeyToPath)(x.Items), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ConfigMapVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ConfigMapVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv4 := &x.Items + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceKeyToPath((*[]KeyToPath)(yyv4), d) + } + } + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ConfigMapVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv8 := &x.Items + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + h.decSliceKeyToPath((*[]KeyToPath)(yyv8), d) + } + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *KeyToPath) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("key")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("path")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *KeyToPath) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *KeyToPath) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + case "path": + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *KeyToPath) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10706,35 +13456,38 @@ func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym816 := z.EncBinary() - _ = yym816 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep817 := !z.EncBinary() - yy2arr817 := z.EncBasicHandle().StructToArray - var yyq817 [5]bool - _, _, _ = yysep817, yyq817, yy2arr817 - const yyr817 bool = false - yyq817[0] = x.Name != "" - yyq817[1] = x.HostPort != 0 - yyq817[3] = x.Protocol != "" - yyq817[4] = x.HostIP != "" - if yyr817 || yy2arr817 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Name != "" + yyq2[1] = x.HostPort != 0 + yyq2[3] = x.Protocol != "" + yyq2[4] = x.HostIP != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn817 int = 1 - for _, b := range yyq817 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn817++ + yynn2++ } } - r.EncodeMapStart(yynn817) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr817 || yy2arr817 { - if yyq817[0] { - yym819 := z.EncBinary() - _ = yym819 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -10743,20 +13496,23 @@ func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq817[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym820 := z.EncBinary() - _ = yym820 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr817 || yy2arr817 { - if yyq817[1] { - yym822 := z.EncBinary() - _ = yym822 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.HostPort)) @@ -10765,48 +13521,57 @@ func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq817[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPort")) - yym823 := z.EncBinary() - _ = yym823 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.HostPort)) } } } - if yyr817 || yy2arr817 { - yym825 := z.EncBinary() - _ = yym825 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.ContainerPort)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerPort")) - yym826 := z.EncBinary() - _ = yym826 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.ContainerPort)) } } - if yyr817 || yy2arr817 { - if yyq817[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { x.Protocol.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq817[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("protocol")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Protocol.CodecEncodeSelf(e) } } - if yyr817 || yy2arr817 { - if yyq817[4] { - yym829 := z.EncBinary() - _ = yym829 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.HostIP)) @@ -10815,18 +13580,22 @@ func (x *ContainerPort) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq817[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostIP")) - yym830 := z.EncBinary() - _ = yym830 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.HostIP)) } } } - if yysep817 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10836,24 +13605,25 @@ func (x *ContainerPort) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym831 := z.DecBinary() - _ = yym831 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl832 := r.ReadMapStart() - if yyl832 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl832, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl832 := r.ReadArrayStart() - if yyl832 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl832, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10865,12 +13635,12 @@ func (x *ContainerPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys833Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys833Slc - var yyhl833 bool = l >= 0 - for yyj833 := 0; ; yyj833++ { - if yyhl833 { - if yyj833 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10878,9 +13648,11 @@ func (x *ContainerPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys833Slc = r.DecodeBytes(yys833Slc, true, true) - yys833 := string(yys833Slc) - switch yys833 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -10891,13 +13663,13 @@ func (x *ContainerPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.HostPort = 0 } else { - x.HostPort = int(r.DecodeInt(codecSelferBitsize1234)) + x.HostPort = int32(r.DecodeInt(32)) } case "containerPort": if r.TryDecodeAsNil() { x.ContainerPort = 0 } else { - x.ContainerPort = int(r.DecodeInt(codecSelferBitsize1234)) + x.ContainerPort = int32(r.DecodeInt(32)) } case "protocol": if r.TryDecodeAsNil() { @@ -10912,109 +13684,113 @@ func (x *ContainerPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.HostIP = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys833) - } // end switch yys833 - } // end for yyj833 - if !yyhl833 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerPort) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj839 int - var yyb839 bool - var yyhl839 bool = l >= 0 - yyj839++ - if yyhl839 { - yyb839 = yyj839 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb839 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb839 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj839++ - if yyhl839 { - yyb839 = yyj839 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb839 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb839 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostPort = 0 } else { - x.HostPort = int(r.DecodeInt(codecSelferBitsize1234)) + x.HostPort = int32(r.DecodeInt(32)) } - yyj839++ - if yyhl839 { - yyb839 = yyj839 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb839 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb839 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerPort = 0 } else { - x.ContainerPort = int(r.DecodeInt(codecSelferBitsize1234)) + x.ContainerPort = int32(r.DecodeInt(32)) } - yyj839++ - if yyhl839 { - yyb839 = yyj839 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb839 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb839 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Protocol = "" } else { x.Protocol = Protocol(r.DecodeString()) } - yyj839++ - if yyhl839 { - yyb839 = yyj839 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb839 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb839 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostIP = "" } else { x.HostIP = string(r.DecodeString()) } for { - yyj839++ - if yyhl839 { - yyb839 = yyj839 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb839 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb839 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj839-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *VolumeMount) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11024,48 +13800,54 @@ func (x *VolumeMount) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym845 := z.EncBinary() - _ = yym845 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep846 := !z.EncBinary() - yy2arr846 := z.EncBasicHandle().StructToArray - var yyq846 [3]bool - _, _, _ = yysep846, yyq846, yy2arr846 - const yyr846 bool = false - yyq846[1] = x.ReadOnly != false - if yyr846 || yy2arr846 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.ReadOnly != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn846 int = 2 - for _, b := range yyq846 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn846++ + yynn2++ } } - r.EncodeMapStart(yynn846) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr846 || yy2arr846 { - yym848 := z.EncBinary() - _ = yym848 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym849 := z.EncBinary() - _ = yym849 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr846 || yy2arr846 { - if yyq846[1] { - yym851 := z.EncBinary() - _ = yym851 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeBool(bool(x.ReadOnly)) @@ -11074,34 +13856,41 @@ func (x *VolumeMount) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq846[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readOnly")) - yym852 := z.EncBinary() - _ = yym852 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeBool(bool(x.ReadOnly)) } } } - if yyr846 || yy2arr846 { - yym854 := z.EncBinary() - _ = yym854 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.MountPath)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("mountPath")) - yym855 := z.EncBinary() - _ = yym855 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.MountPath)) } } - if yysep846 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11111,24 +13900,25 @@ func (x *VolumeMount) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym856 := z.DecBinary() - _ = yym856 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl857 := r.ReadMapStart() - if yyl857 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl857, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl857 := r.ReadArrayStart() - if yyl857 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl857, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11140,12 +13930,12 @@ func (x *VolumeMount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys858Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys858Slc - var yyhl858 bool = l >= 0 - for yyj858 := 0; ; yyj858++ { - if yyhl858 { - if yyj858 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11153,9 +13943,11 @@ func (x *VolumeMount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys858Slc = r.DecodeBytes(yys858Slc, true, true) - yys858 := string(yys858Slc) - switch yys858 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -11175,79 +13967,81 @@ func (x *VolumeMount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.MountPath = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys858) - } // end switch yys858 - } // end for yyj858 - if !yyhl858 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *VolumeMount) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj862 int - var yyb862 bool - var yyhl862 bool = l >= 0 - yyj862++ - if yyhl862 { - yyb862 = yyj862 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb862 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb862 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj862++ - if yyhl862 { - yyb862 = yyj862 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb862 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb862 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ReadOnly = false } else { x.ReadOnly = bool(r.DecodeBool()) } - yyj862++ - if yyhl862 { - yyb862 = yyj862 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb862 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb862 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MountPath = "" } else { x.MountPath = string(r.DecodeString()) } for { - yyj862++ - if yyhl862 { - yyb862 = yyj862 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb862 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb862 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj862-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11257,49 +14051,55 @@ func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym866 := z.EncBinary() - _ = yym866 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep867 := !z.EncBinary() - yy2arr867 := z.EncBasicHandle().StructToArray - var yyq867 [3]bool - _, _, _ = yysep867, yyq867, yy2arr867 - const yyr867 bool = false - yyq867[1] = x.Value != "" - yyq867[2] = x.ValueFrom != nil - if yyr867 || yy2arr867 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Value != "" + yyq2[2] = x.ValueFrom != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn867 int = 1 - for _, b := range yyq867 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn867++ + yynn2++ } } - r.EncodeMapStart(yynn867) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr867 || yy2arr867 { - yym869 := z.EncBinary() - _ = yym869 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym870 := z.EncBinary() - _ = yym870 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr867 || yy2arr867 { - if yyq867[1] { - yym872 := z.EncBinary() - _ = yym872 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Value)) @@ -11308,18 +14108,21 @@ func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq867[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("value")) - yym873 := z.EncBinary() - _ = yym873 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Value)) } } } - if yyr867 || yy2arr867 { - if yyq867[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.ValueFrom == nil { r.EncodeNil() } else { @@ -11329,8 +14132,10 @@ func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq867[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("valueFrom")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ValueFrom == nil { r.EncodeNil() } else { @@ -11338,8 +14143,10 @@ func (x *EnvVar) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep867 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11349,24 +14156,25 @@ func (x *EnvVar) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym875 := z.DecBinary() - _ = yym875 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl876 := r.ReadMapStart() - if yyl876 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl876, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl876 := r.ReadArrayStart() - if yyl876 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl876, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11378,12 +14186,12 @@ func (x *EnvVar) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys877Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys877Slc - var yyhl877 bool = l >= 0 - for yyj877 := 0; ; yyj877++ { - if yyhl877 { - if yyj877 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11391,9 +14199,11 @@ func (x *EnvVar) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys877Slc = r.DecodeBytes(yys877Slc, true, true) - yys877 := string(yys877Slc) - switch yys877 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -11418,61 +14228,62 @@ func (x *EnvVar) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ValueFrom.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys877) - } // end switch yys877 - } // end for yyj877 - if !yyhl877 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EnvVar) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj881 int - var yyb881 bool - var yyhl881 bool = l >= 0 - yyj881++ - if yyhl881 { - yyb881 = yyj881 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb881 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb881 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj881++ - if yyhl881 { - yyb881 = yyj881 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb881 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb881 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Value = "" } else { x.Value = string(r.DecodeString()) } - yyj881++ - if yyhl881 { - yyb881 = yyj881 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb881 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb881 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ValueFrom != nil { x.ValueFrom = nil @@ -11484,18 +14295,19 @@ func (x *EnvVar) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.ValueFrom.CodecDecodeSelf(d) } for { - yyj881++ - if yyhl881 { - yyb881 = yyj881 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb881 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb881 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj881-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EnvVarSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11505,43 +14317,105 @@ func (x *EnvVarSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym885 := z.EncBinary() - _ = yym885 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep886 := !z.EncBinary() - yy2arr886 := z.EncBasicHandle().StructToArray - var yyq886 [1]bool - _, _, _ = yysep886, yyq886, yy2arr886 - const yyr886 bool = false - if yyr886 || yy2arr886 { - r.EncodeArrayStart(1) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.FieldRef != nil + yyq2[1] = x.ConfigMapKeyRef != nil + yyq2[2] = x.SecretKeyRef != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) } else { - var yynn886 int = 1 - for _, b := range yyq886 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn886++ + yynn2++ } } - r.EncodeMapStart(yynn886) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr886 || yy2arr886 { - if x.FieldRef == nil { - r.EncodeNil() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.FieldRef == nil { + r.EncodeNil() + } else { + x.FieldRef.CodecEncodeSelf(e) + } } else { - x.FieldRef.CodecEncodeSelf(e) + r.EncodeNil() } } else { - r.EncodeString(codecSelferC_UTF81234, string("fieldRef")) - if x.FieldRef == nil { - r.EncodeNil() - } else { - x.FieldRef.CodecEncodeSelf(e) + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fieldRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.FieldRef == nil { + r.EncodeNil() + } else { + x.FieldRef.CodecEncodeSelf(e) + } } } - if yysep886 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.ConfigMapKeyRef == nil { + r.EncodeNil() + } else { + x.ConfigMapKeyRef.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("configMapKeyRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ConfigMapKeyRef == nil { + r.EncodeNil() + } else { + x.ConfigMapKeyRef.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.SecretKeyRef == nil { + r.EncodeNil() + } else { + x.SecretKeyRef.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretKeyRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SecretKeyRef == nil { + r.EncodeNil() + } else { + x.SecretKeyRef.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11551,24 +14425,25 @@ func (x *EnvVarSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym888 := z.DecBinary() - _ = yym888 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl889 := r.ReadMapStart() - if yyl889 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl889, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl889 := r.ReadArrayStart() - if yyl889 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl889, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11580,12 +14455,12 @@ func (x *EnvVarSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys890Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys890Slc - var yyhl890 bool = l >= 0 - for yyj890 := 0; ; yyj890++ { - if yyhl890 { - if yyj890 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11593,9 +14468,11 @@ func (x *EnvVarSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys890Slc = r.DecodeBytes(yys890Slc, true, true) - yys890 := string(yys890Slc) - switch yys890 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "fieldRef": if r.TryDecodeAsNil() { if x.FieldRef != nil { @@ -11607,32 +14484,53 @@ func (x *EnvVarSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.FieldRef.CodecDecodeSelf(d) } + case "configMapKeyRef": + if r.TryDecodeAsNil() { + if x.ConfigMapKeyRef != nil { + x.ConfigMapKeyRef = nil + } + } else { + if x.ConfigMapKeyRef == nil { + x.ConfigMapKeyRef = new(ConfigMapKeySelector) + } + x.ConfigMapKeyRef.CodecDecodeSelf(d) + } + case "secretKeyRef": + if r.TryDecodeAsNil() { + if x.SecretKeyRef != nil { + x.SecretKeyRef = nil + } + } else { + if x.SecretKeyRef == nil { + x.SecretKeyRef = new(SecretKeySelector) + } + x.SecretKeyRef.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys890) - } // end switch yys890 - } // end for yyj890 - if !yyhl890 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EnvVarSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj892 int - var yyb892 bool - var yyhl892 bool = l >= 0 - yyj892++ - if yyhl892 { - yyb892 = yyj892 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb892 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb892 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.FieldRef != nil { x.FieldRef = nil @@ -11643,19 +14541,62 @@ func (x *EnvVarSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.FieldRef.CodecDecodeSelf(d) } - for { - yyj892++ - if yyhl892 { - yyb892 = yyj892 > l - } else { - yyb892 = r.CheckBreak() + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ConfigMapKeyRef != nil { + x.ConfigMapKeyRef = nil } - if yyb892 { + } else { + if x.ConfigMapKeyRef == nil { + x.ConfigMapKeyRef = new(ConfigMapKeySelector) + } + x.ConfigMapKeyRef.CodecDecodeSelf(d) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SecretKeyRef != nil { + x.SecretKeyRef = nil + } + } else { + if x.SecretKeyRef == nil { + x.SecretKeyRef = new(SecretKeySelector) + } + x.SecretKeyRef.CodecDecodeSelf(d) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { break } - z.DecStructFieldNotFound(yyj892-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ObjectFieldSelector) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11665,32 +14606,35 @@ func (x *ObjectFieldSelector) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym894 := z.EncBinary() - _ = yym894 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep895 := !z.EncBinary() - yy2arr895 := z.EncBasicHandle().StructToArray - var yyq895 [2]bool - _, _, _ = yysep895, yyq895, yy2arr895 - const yyr895 bool = false - yyq895[0] = x.APIVersion != "" - if yyr895 || yy2arr895 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn895 int = 1 - for _, b := range yyq895 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn895++ + yynn2++ } } - r.EncodeMapStart(yynn895) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr895 || yy2arr895 { - if yyq895[0] { - yym897 := z.EncBinary() - _ = yym897 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) @@ -11699,34 +14643,41 @@ func (x *ObjectFieldSelector) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq895[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym898 := z.EncBinary() - _ = yym898 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) } } } - if yyr895 || yy2arr895 { - yym900 := z.EncBinary() - _ = yym900 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldPath)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fieldPath")) - yym901 := z.EncBinary() - _ = yym901 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldPath)) } } - if yysep895 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11736,24 +14687,25 @@ func (x *ObjectFieldSelector) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym902 := z.DecBinary() - _ = yym902 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl903 := r.ReadMapStart() - if yyl903 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl903, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl903 := r.ReadArrayStart() - if yyl903 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl903, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11765,12 +14717,12 @@ func (x *ObjectFieldSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys904Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys904Slc - var yyhl904 bool = l >= 0 - for yyj904 := 0; ; yyj904++ { - if yyhl904 { - if yyj904 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11778,9 +14730,11 @@ func (x *ObjectFieldSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys904Slc = r.DecodeBytes(yys904Slc, true, true) - yys904 := string(yys904Slc) - switch yys904 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "apiVersion": if r.TryDecodeAsNil() { x.APIVersion = "" @@ -11794,64 +14748,688 @@ func (x *ObjectFieldSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder x.FieldPath = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys904) - } // end switch yys904 - } // end for yyj904 - if !yyhl904 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ObjectFieldSelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj907 int - var yyb907 bool - var yyhl907 bool = l >= 0 - yyj907++ - if yyhl907 { - yyb907 = yyj907 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb907 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb907 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj907++ - if yyhl907 { - yyb907 = yyj907 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb907 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb907 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FieldPath = "" } else { x.FieldPath = string(r.DecodeString()) } for { - yyj907++ - if yyhl907 { - yyb907 = yyj907 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb907 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb907 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj907-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ConfigMapKeySelector) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Name != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("key")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ConfigMapKeySelector) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ConfigMapKeySelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ConfigMapKeySelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SecretKeySelector) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Name != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("key")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SecretKeySelector) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SecretKeySelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SecretKeySelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *HTTPHeader) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Value)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("value")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Value)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *HTTPHeader) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *HTTPHeader) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + case "value": + if r.TryDecodeAsNil() { + x.Value = "" + } else { + x.Value = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *HTTPHeader) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Value = "" + } else { + x.Value = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HTTPGetAction) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11861,34 +15439,38 @@ func (x *HTTPGetAction) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym910 := z.EncBinary() - _ = yym910 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep911 := !z.EncBinary() - yy2arr911 := z.EncBasicHandle().StructToArray - var yyq911 [4]bool - _, _, _ = yysep911, yyq911, yy2arr911 - const yyr911 bool = false - yyq911[0] = x.Path != "" - yyq911[2] = x.Host != "" - yyq911[3] = x.Scheme != "" - if yyr911 || yy2arr911 { - r.EncodeArrayStart(4) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Path != "" + yyq2[2] = x.Host != "" + yyq2[3] = x.Scheme != "" + yyq2[4] = len(x.HTTPHeaders) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) } else { - var yynn911 int = 1 - for _, b := range yyq911 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn911++ + yynn2++ } } - r.EncodeMapStart(yynn911) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr911 || yy2arr911 { - if yyq911[0] { - yym913 := z.EncBinary() - _ = yym913 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) @@ -11897,44 +15479,50 @@ func (x *HTTPGetAction) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq911[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym914 := z.EncBinary() - _ = yym914 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } } - if yyr911 || yy2arr911 { - yy916 := &x.Port - yym917 := z.EncBinary() - _ = yym917 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.Port + yym8 := z.EncBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.EncExt(yy916) { - } else if !yym917 && z.IsJSONHandle() { - z.EncJSONMarshal(yy916) + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) } else { - z.EncFallback(yy916) + z.EncFallback(yy7) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("port")) - yy918 := &x.Port - yym919 := z.EncBinary() - _ = yym919 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Port + yym10 := z.EncBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.EncExt(yy918) { - } else if !yym919 && z.IsJSONHandle() { - z.EncJSONMarshal(yy918) + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) } else { - z.EncFallback(yy918) + z.EncFallback(yy9) } } - if yyr911 || yy2arr911 { - if yyq911[2] { - yym921 := z.EncBinary() - _ = yym921 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) @@ -11943,30 +15531,70 @@ func (x *HTTPGetAction) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq911[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("host")) - yym922 := z.EncBinary() - _ = yym922 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) } } } - if yyr911 || yy2arr911 { - if yyq911[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { x.Scheme.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq911[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("scheme")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Scheme.CodecEncodeSelf(e) } } - if yysep911 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.HTTPHeaders == nil { + r.EncodeNil() + } else { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + h.encSliceHTTPHeader(([]HTTPHeader)(x.HTTPHeaders), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("httpHeaders")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.HTTPHeaders == nil { + r.EncodeNil() + } else { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + h.encSliceHTTPHeader(([]HTTPHeader)(x.HTTPHeaders), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11976,24 +15604,25 @@ func (x *HTTPGetAction) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym924 := z.DecBinary() - _ = yym924 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl925 := r.ReadMapStart() - if yyl925 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl925, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl925 := r.ReadArrayStart() - if yyl925 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl925, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12005,12 +15634,12 @@ func (x *HTTPGetAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys926Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys926Slc - var yyhl926 bool = l >= 0 - for yyj926 := 0; ; yyj926++ { - if yyhl926 { - if yyj926 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12018,9 +15647,11 @@ func (x *HTTPGetAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys926Slc = r.DecodeBytes(yys926Slc, true, true) - yys926 := string(yys926Slc) - switch yys926 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "path": if r.TryDecodeAsNil() { x.Path = "" @@ -12029,17 +15660,17 @@ func (x *HTTPGetAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "port": if r.TryDecodeAsNil() { - x.Port = pkg5_util.IntOrString{} + x.Port = pkg5_intstr.IntOrString{} } else { - yyv928 := &x.Port - yym929 := z.DecBinary() - _ = yym929 + yyv5 := &x.Port + yym6 := z.DecBinary() + _ = yym6 if false { - } else if z.HasExtensions() && z.DecExt(yyv928) { - } else if !yym929 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv928) + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) } else { - z.DecFallback(yyv928, false) + z.DecFallback(yyv5, false) } } case "host": @@ -12054,112 +15685,149 @@ func (x *HTTPGetAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.Scheme = URIScheme(r.DecodeString()) } + case "httpHeaders": + if r.TryDecodeAsNil() { + x.HTTPHeaders = nil + } else { + yyv9 := &x.HTTPHeaders + yym10 := z.DecBinary() + _ = yym10 + if false { + } else { + h.decSliceHTTPHeader((*[]HTTPHeader)(yyv9), d) + } + } default: - z.DecStructFieldNotFound(-1, yys926) - } // end switch yys926 - } // end for yyj926 - if !yyhl926 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HTTPGetAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj932 int - var yyb932 bool - var yyhl932 bool = l >= 0 - yyj932++ - if yyhl932 { - yyb932 = yyj932 > l + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb932 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb932 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj932++ - if yyhl932 { - yyb932 = yyj932 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb932 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb932 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Port = pkg5_util.IntOrString{} + x.Port = pkg5_intstr.IntOrString{} } else { - yyv934 := &x.Port - yym935 := z.DecBinary() - _ = yym935 + yyv13 := &x.Port + yym14 := z.DecBinary() + _ = yym14 if false { - } else if z.HasExtensions() && z.DecExt(yyv934) { - } else if !yym935 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv934) + } else if z.HasExtensions() && z.DecExt(yyv13) { + } else if !yym14 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv13) } else { - z.DecFallback(yyv934, false) + z.DecFallback(yyv13, false) } } - yyj932++ - if yyhl932 { - yyb932 = yyj932 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb932 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb932 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Host = "" } else { x.Host = string(r.DecodeString()) } - yyj932++ - if yyhl932 { - yyb932 = yyj932 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb932 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb932 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Scheme = "" } else { x.Scheme = URIScheme(r.DecodeString()) } - for { - yyj932++ - if yyhl932 { - yyb932 = yyj932 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HTTPHeaders = nil + } else { + yyv17 := &x.HTTPHeaders + yym18 := z.DecBinary() + _ = yym18 + if false { } else { - yyb932 = r.CheckBreak() + h.decSliceHTTPHeader((*[]HTTPHeader)(yyv17), d) } - if yyb932 { + } + for { + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { break } - z.DecStructFieldNotFound(yyj932-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x URIScheme) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym938 := z.EncBinary() - _ = yym938 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -12171,8 +15839,8 @@ func (x *URIScheme) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym939 := z.DecBinary() - _ = yym939 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -12187,53 +15855,60 @@ func (x *TCPSocketAction) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym940 := z.EncBinary() - _ = yym940 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep941 := !z.EncBinary() - yy2arr941 := z.EncBasicHandle().StructToArray - var yyq941 [1]bool - _, _, _ = yysep941, yyq941, yy2arr941 - const yyr941 bool = false - if yyr941 || yy2arr941 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn941 int = 1 - for _, b := range yyq941 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn941++ + yynn2++ } } - r.EncodeMapStart(yynn941) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr941 || yy2arr941 { - yy943 := &x.Port - yym944 := z.EncBinary() - _ = yym944 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.Port + yym5 := z.EncBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.EncExt(yy943) { - } else if !yym944 && z.IsJSONHandle() { - z.EncJSONMarshal(yy943) + } else if z.HasExtensions() && z.EncExt(yy4) { + } else if !yym5 && z.IsJSONHandle() { + z.EncJSONMarshal(yy4) } else { - z.EncFallback(yy943) + z.EncFallback(yy4) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("port")) - yy945 := &x.Port - yym946 := z.EncBinary() - _ = yym946 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Port + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy945) { - } else if !yym946 && z.IsJSONHandle() { - z.EncJSONMarshal(yy945) + } else if z.HasExtensions() && z.EncExt(yy6) { + } else if !yym7 && z.IsJSONHandle() { + z.EncJSONMarshal(yy6) } else { - z.EncFallback(yy945) + z.EncFallback(yy6) } } - if yysep941 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -12243,24 +15918,25 @@ func (x *TCPSocketAction) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym947 := z.DecBinary() - _ = yym947 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl948 := r.ReadMapStart() - if yyl948 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl948, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl948 := r.ReadArrayStart() - if yyl948 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl948, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12272,12 +15948,12 @@ func (x *TCPSocketAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys949Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys949Slc - var yyhl949 bool = l >= 0 - for yyj949 := 0; ; yyj949++ { - if yyhl949 { - if yyj949 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12285,77 +15961,79 @@ func (x *TCPSocketAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys949Slc = r.DecodeBytes(yys949Slc, true, true) - yys949 := string(yys949Slc) - switch yys949 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "port": if r.TryDecodeAsNil() { - x.Port = pkg5_util.IntOrString{} + x.Port = pkg5_intstr.IntOrString{} } else { - yyv950 := &x.Port - yym951 := z.DecBinary() - _ = yym951 + yyv4 := &x.Port + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv950) { - } else if !yym951 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv950) + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else if !yym5 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv4) } else { - z.DecFallback(yyv950, false) + z.DecFallback(yyv4, false) } } default: - z.DecStructFieldNotFound(-1, yys949) - } // end switch yys949 - } // end for yyj949 - if !yyhl949 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *TCPSocketAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj952 int - var yyb952 bool - var yyhl952 bool = l >= 0 - yyj952++ - if yyhl952 { - yyb952 = yyj952 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb952 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb952 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Port = pkg5_util.IntOrString{} + x.Port = pkg5_intstr.IntOrString{} } else { - yyv953 := &x.Port - yym954 := z.DecBinary() - _ = yym954 + yyv7 := &x.Port + yym8 := z.DecBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.DecExt(yyv953) { - } else if !yym954 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv953) + } else if z.HasExtensions() && z.DecExt(yyv7) { + } else if !yym8 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv7) } else { - z.DecFallback(yyv953, false) + z.DecFallback(yyv7, false) } } for { - yyj952++ - if yyhl952 { - yyb952 = yyj952 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb952 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb952 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj952-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ExecAction) CodecEncodeSelf(e *codec1978.Encoder) { @@ -12365,35 +16043,38 @@ func (x *ExecAction) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym955 := z.EncBinary() - _ = yym955 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep956 := !z.EncBinary() - yy2arr956 := z.EncBasicHandle().StructToArray - var yyq956 [1]bool - _, _, _ = yysep956, yyq956, yy2arr956 - const yyr956 bool = false - yyq956[0] = len(x.Command) != 0 - if yyr956 || yy2arr956 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Command) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn956 int = 0 - for _, b := range yyq956 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn956++ + yynn2++ } } - r.EncodeMapStart(yynn956) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr956 || yy2arr956 { - if yyq956[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Command == nil { r.EncodeNil() } else { - yym958 := z.EncBinary() - _ = yym958 + yym4 := z.EncBinary() + _ = yym4 if false { } else { z.F.EncSliceStringV(x.Command, false, e) @@ -12403,13 +16084,15 @@ func (x *ExecAction) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq956[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("command")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Command == nil { r.EncodeNil() } else { - yym959 := z.EncBinary() - _ = yym959 + yym5 := z.EncBinary() + _ = yym5 if false { } else { z.F.EncSliceStringV(x.Command, false, e) @@ -12417,8 +16100,10 @@ func (x *ExecAction) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep956 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -12428,24 +16113,25 @@ func (x *ExecAction) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym960 := z.DecBinary() - _ = yym960 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl961 := r.ReadMapStart() - if yyl961 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl961, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl961 := r.ReadArrayStart() - if yyl961 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl961, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12457,12 +16143,12 @@ func (x *ExecAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys962Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys962Slc - var yyhl962 bool = l >= 0 - for yyj962 := 0; ; yyj962++ { - if yyhl962 { - if yyj962 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12470,71 +16156,73 @@ func (x *ExecAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys962Slc = r.DecodeBytes(yys962Slc, true, true) - yys962 := string(yys962Slc) - switch yys962 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "command": if r.TryDecodeAsNil() { x.Command = nil } else { - yyv963 := &x.Command - yym964 := z.DecBinary() - _ = yym964 + yyv4 := &x.Command + yym5 := z.DecBinary() + _ = yym5 if false { } else { - z.F.DecSliceStringX(yyv963, false, d) + z.F.DecSliceStringX(yyv4, false, d) } } default: - z.DecStructFieldNotFound(-1, yys962) - } // end switch yys962 - } // end for yyj962 - if !yyhl962 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ExecAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj965 int - var yyb965 bool - var yyhl965 bool = l >= 0 - yyj965++ - if yyhl965 { - yyb965 = yyj965 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb965 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb965 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Command = nil } else { - yyv966 := &x.Command - yym967 := z.DecBinary() - _ = yym967 + yyv7 := &x.Command + yym8 := z.DecBinary() + _ = yym8 if false { } else { - z.F.DecSliceStringX(yyv966, false, d) + z.F.DecSliceStringX(yyv7, false, d) } } for { - yyj965++ - if yyhl965 { - yyb965 = yyj965 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb965 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb965 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj965-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Probe) CodecEncodeSelf(e *codec1978.Encoder) { @@ -12544,138 +16232,42 @@ func (x *Probe) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym968 := z.EncBinary() - _ = yym968 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep969 := !z.EncBinary() - yy2arr969 := z.EncBasicHandle().StructToArray - var yyq969 [5]bool - _, _, _ = yysep969, yyq969, yy2arr969 - const yyr969 bool = false - yyq969[0] = x.Handler.Exec != nil && x.Exec != nil - yyq969[1] = x.Handler.HTTPGet != nil && x.HTTPGet != nil - yyq969[2] = x.Handler.TCPSocket != nil && x.TCPSocket != nil - yyq969[3] = x.InitialDelaySeconds != 0 - yyq969[4] = x.TimeoutSeconds != 0 - if yyr969 || yy2arr969 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.InitialDelaySeconds != 0 + yyq2[1] = x.TimeoutSeconds != 0 + yyq2[2] = x.PeriodSeconds != 0 + yyq2[3] = x.SuccessThreshold != 0 + yyq2[4] = x.FailureThreshold != 0 + yyq2[5] = x.Handler.Exec != nil && x.Exec != nil + yyq2[6] = x.Handler.HTTPGet != nil && x.HTTPGet != nil + yyq2[7] = x.Handler.TCPSocket != nil && x.TCPSocket != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(8) } else { - var yynn969 int = 0 - for _, b := range yyq969 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn969++ + yynn2++ } } - r.EncodeMapStart(yynn969) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - var yyn970 bool - if x.Handler.Exec == nil { - yyn970 = true - goto LABEL970 - } - LABEL970: - if yyr969 || yy2arr969 { - if yyn970 { - r.EncodeNil() - } else { - if yyq969[0] { - if x.Exec == nil { - r.EncodeNil() - } else { - x.Exec.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq969[0] { - r.EncodeString(codecSelferC_UTF81234, string("exec")) - if yyn970 { - r.EncodeNil() - } else { - if x.Exec == nil { - r.EncodeNil() - } else { - x.Exec.CodecEncodeSelf(e) - } - } - } - } - var yyn971 bool - if x.Handler.HTTPGet == nil { - yyn971 = true - goto LABEL971 - } - LABEL971: - if yyr969 || yy2arr969 { - if yyn971 { - r.EncodeNil() - } else { - if yyq969[1] { - if x.HTTPGet == nil { - r.EncodeNil() - } else { - x.HTTPGet.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq969[1] { - r.EncodeString(codecSelferC_UTF81234, string("httpGet")) - if yyn971 { - r.EncodeNil() - } else { - if x.HTTPGet == nil { - r.EncodeNil() - } else { - x.HTTPGet.CodecEncodeSelf(e) - } - } - } - } - var yyn972 bool - if x.Handler.TCPSocket == nil { - yyn972 = true - goto LABEL972 - } - LABEL972: - if yyr969 || yy2arr969 { - if yyn972 { - r.EncodeNil() - } else { - if yyq969[2] { - if x.TCPSocket == nil { - r.EncodeNil() - } else { - x.TCPSocket.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } - } - } else { - if yyq969[2] { - r.EncodeString(codecSelferC_UTF81234, string("tcpSocket")) - if yyn972 { - r.EncodeNil() - } else { - if x.TCPSocket == nil { - r.EncodeNil() - } else { - x.TCPSocket.CodecEncodeSelf(e) - } - } - } - } - if yyr969 || yy2arr969 { - if yyq969[3] { - yym974 := z.EncBinary() - _ = yym974 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.InitialDelaySeconds)) @@ -12684,20 +16276,23 @@ func (x *Probe) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq969[3] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("initialDelaySeconds")) - yym975 := z.EncBinary() - _ = yym975 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.InitialDelaySeconds)) } } } - if yyr969 || yy2arr969 { - if yyq969[4] { - yym977 := z.EncBinary() - _ = yym977 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.TimeoutSeconds)) @@ -12706,18 +16301,208 @@ func (x *Probe) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq969[4] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("timeoutSeconds")) - yym978 := z.EncBinary() - _ = yym978 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.TimeoutSeconds)) } } } - if yysep969 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeInt(int64(x.PeriodSeconds)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("periodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeInt(int64(x.PeriodSeconds)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeInt(int64(x.SuccessThreshold)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("successThreshold")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeInt(int64(x.SuccessThreshold)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeInt(int64(x.FailureThreshold)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("failureThreshold")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeInt(int64(x.FailureThreshold)) + } + } + } + var yyn18 bool + if x.Handler.Exec == nil { + yyn18 = true + goto LABEL18 + } + LABEL18: + if yyr2 || yy2arr2 { + if yyn18 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + if x.Exec == nil { + r.EncodeNil() + } else { + x.Exec.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("exec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn18 { + r.EncodeNil() + } else { + if x.Exec == nil { + r.EncodeNil() + } else { + x.Exec.CodecEncodeSelf(e) + } + } + } + } + var yyn21 bool + if x.Handler.HTTPGet == nil { + yyn21 = true + goto LABEL21 + } + LABEL21: + if yyr2 || yy2arr2 { + if yyn21 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + if x.HTTPGet == nil { + r.EncodeNil() + } else { + x.HTTPGet.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("httpGet")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn21 { + r.EncodeNil() + } else { + if x.HTTPGet == nil { + r.EncodeNil() + } else { + x.HTTPGet.CodecEncodeSelf(e) + } + } + } + } + var yyn24 bool + if x.Handler.TCPSocket == nil { + yyn24 = true + goto LABEL24 + } + LABEL24: + if yyr2 || yy2arr2 { + if yyn24 { + r.EncodeNil() + } else { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + if x.TCPSocket == nil { + r.EncodeNil() + } else { + x.TCPSocket.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tcpSocket")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn24 { + r.EncodeNil() + } else { + if x.TCPSocket == nil { + r.EncodeNil() + } else { + x.TCPSocket.CodecEncodeSelf(e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -12727,24 +16512,25 @@ func (x *Probe) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym979 := z.DecBinary() - _ = yym979 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl980 := r.ReadMapStart() - if yyl980 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl980, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl980 := r.ReadArrayStart() - if yyl980 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl980, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12756,12 +16542,12 @@ func (x *Probe) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys981Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys981Slc - var yyhl981 bool = l >= 0 - for yyj981 := 0; ; yyj981++ { - if yyhl981 { - if yyj981 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12769,9 +16555,41 @@ func (x *Probe) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys981Slc = r.DecodeBytes(yys981Slc, true, true) - yys981 := string(yys981Slc) - switch yys981 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "initialDelaySeconds": + if r.TryDecodeAsNil() { + x.InitialDelaySeconds = 0 + } else { + x.InitialDelaySeconds = int32(r.DecodeInt(32)) + } + case "timeoutSeconds": + if r.TryDecodeAsNil() { + x.TimeoutSeconds = 0 + } else { + x.TimeoutSeconds = int32(r.DecodeInt(32)) + } + case "periodSeconds": + if r.TryDecodeAsNil() { + x.PeriodSeconds = 0 + } else { + x.PeriodSeconds = int32(r.DecodeInt(32)) + } + case "successThreshold": + if r.TryDecodeAsNil() { + x.SuccessThreshold = 0 + } else { + x.SuccessThreshold = int32(r.DecodeInt(32)) + } + case "failureThreshold": + if r.TryDecodeAsNil() { + x.FailureThreshold = 0 + } else { + x.FailureThreshold = int32(r.DecodeInt(32)) + } case "exec": if x.Handler.Exec == nil { x.Handler.Exec = new(ExecAction) @@ -12814,44 +16632,114 @@ func (x *Probe) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.TCPSocket.CodecDecodeSelf(d) } - case "initialDelaySeconds": - if r.TryDecodeAsNil() { - x.InitialDelaySeconds = 0 - } else { - x.InitialDelaySeconds = int64(r.DecodeInt(64)) - } - case "timeoutSeconds": - if r.TryDecodeAsNil() { - x.TimeoutSeconds = 0 - } else { - x.TimeoutSeconds = int64(r.DecodeInt(64)) - } default: - z.DecStructFieldNotFound(-1, yys981) - } // end switch yys981 - } // end for yyj981 - if !yyhl981 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Probe) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj987 int - var yyb987 bool - var yyhl987 bool = l >= 0 - yyj987++ - if yyhl987 { - yyb987 = yyj987 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb987 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb987 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.InitialDelaySeconds = 0 + } else { + x.InitialDelaySeconds = int32(r.DecodeInt(32)) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TimeoutSeconds = 0 + } else { + x.TimeoutSeconds = int32(r.DecodeInt(32)) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PeriodSeconds = 0 + } else { + x.PeriodSeconds = int32(r.DecodeInt(32)) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SuccessThreshold = 0 + } else { + x.SuccessThreshold = int32(r.DecodeInt(32)) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.FailureThreshold = 0 + } else { + x.FailureThreshold = int32(r.DecodeInt(32)) + } + if x.Handler.Exec == nil { + x.Handler.Exec = new(ExecAction) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Exec != nil { x.Exec = nil @@ -12862,16 +16750,20 @@ func (x *Probe) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Exec.CodecDecodeSelf(d) } - yyj987++ - if yyhl987 { - yyb987 = yyj987 > l - } else { - yyb987 = r.CheckBreak() + if x.Handler.HTTPGet == nil { + x.Handler.HTTPGet = new(HTTPGetAction) } - if yyb987 { - r.ReadEnd() + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HTTPGet != nil { x.HTTPGet = nil @@ -12882,16 +16774,20 @@ func (x *Probe) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.HTTPGet.CodecDecodeSelf(d) } - yyj987++ - if yyhl987 { - yyb987 = yyj987 > l - } else { - yyb987 = r.CheckBreak() + if x.Handler.TCPSocket == nil { + x.Handler.TCPSocket = new(TCPSocketAction) } - if yyb987 { - r.ReadEnd() + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.TCPSocket != nil { x.TCPSocket = nil @@ -12902,57 +16798,28 @@ func (x *Probe) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.TCPSocket.CodecDecodeSelf(d) } - yyj987++ - if yyhl987 { - yyb987 = yyj987 > l - } else { - yyb987 = r.CheckBreak() - } - if yyb987 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.InitialDelaySeconds = 0 - } else { - x.InitialDelaySeconds = int64(r.DecodeInt(64)) - } - yyj987++ - if yyhl987 { - yyb987 = yyj987 > l - } else { - yyb987 = r.CheckBreak() - } - if yyb987 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.TimeoutSeconds = 0 - } else { - x.TimeoutSeconds = int64(r.DecodeInt(64)) - } for { - yyj987++ - if yyhl987 { - yyb987 = yyj987 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb987 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb987 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj987-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x PullPolicy) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym993 := z.EncBinary() - _ = yym993 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -12964,8 +16831,8 @@ func (x *PullPolicy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym994 := z.DecBinary() - _ = yym994 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -12977,8 +16844,8 @@ func (x Capability) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym995 := z.EncBinary() - _ = yym995 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -12990,8 +16857,8 @@ func (x *Capability) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym996 := z.DecBinary() - _ = yym996 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -13006,36 +16873,39 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym997 := z.EncBinary() - _ = yym997 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep998 := !z.EncBinary() - yy2arr998 := z.EncBasicHandle().StructToArray - var yyq998 [2]bool - _, _, _ = yysep998, yyq998, yy2arr998 - const yyr998 bool = false - yyq998[0] = len(x.Add) != 0 - yyq998[1] = len(x.Drop) != 0 - if yyr998 || yy2arr998 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Add) != 0 + yyq2[1] = len(x.Drop) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn998 int = 0 - for _, b := range yyq998 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn998++ + yynn2++ } } - r.EncodeMapStart(yynn998) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr998 || yy2arr998 { - if yyq998[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Add == nil { r.EncodeNil() } else { - yym1000 := z.EncBinary() - _ = yym1000 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceCapability(([]Capability)(x.Add), e) @@ -13045,13 +16915,15 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq998[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("add")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Add == nil { r.EncodeNil() } else { - yym1001 := z.EncBinary() - _ = yym1001 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceCapability(([]Capability)(x.Add), e) @@ -13059,13 +16931,14 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr998 || yy2arr998 { - if yyq998[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Drop == nil { r.EncodeNil() } else { - yym1003 := z.EncBinary() - _ = yym1003 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSliceCapability(([]Capability)(x.Drop), e) @@ -13075,13 +16948,15 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq998[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("drop")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Drop == nil { r.EncodeNil() } else { - yym1004 := z.EncBinary() - _ = yym1004 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSliceCapability(([]Capability)(x.Drop), e) @@ -13089,8 +16964,10 @@ func (x *Capabilities) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep998 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -13100,24 +16977,25 @@ func (x *Capabilities) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1005 := z.DecBinary() - _ = yym1005 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1006 := r.ReadMapStart() - if yyl1006 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1006, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1006 := r.ReadArrayStart() - if yyl1006 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1006, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -13129,12 +17007,12 @@ func (x *Capabilities) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1007Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1007Slc - var yyhl1007 bool = l >= 0 - for yyj1007 := 0; ; yyj1007++ { - if yyhl1007 { - if yyj1007 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -13142,104 +17020,107 @@ func (x *Capabilities) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1007Slc = r.DecodeBytes(yys1007Slc, true, true) - yys1007 := string(yys1007Slc) - switch yys1007 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "add": if r.TryDecodeAsNil() { x.Add = nil } else { - yyv1008 := &x.Add - yym1009 := z.DecBinary() - _ = yym1009 + yyv4 := &x.Add + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceCapability((*[]Capability)(yyv1008), d) + h.decSliceCapability((*[]Capability)(yyv4), d) } } case "drop": if r.TryDecodeAsNil() { x.Drop = nil } else { - yyv1010 := &x.Drop - yym1011 := z.DecBinary() - _ = yym1011 + yyv6 := &x.Drop + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceCapability((*[]Capability)(yyv1010), d) + h.decSliceCapability((*[]Capability)(yyv6), d) } } default: - z.DecStructFieldNotFound(-1, yys1007) - } // end switch yys1007 - } // end for yyj1007 - if !yyhl1007 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Capabilities) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1012 int - var yyb1012 bool - var yyhl1012 bool = l >= 0 - yyj1012++ - if yyhl1012 { - yyb1012 = yyj1012 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1012 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1012 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Add = nil } else { - yyv1013 := &x.Add - yym1014 := z.DecBinary() - _ = yym1014 + yyv9 := &x.Add + yym10 := z.DecBinary() + _ = yym10 if false { } else { - h.decSliceCapability((*[]Capability)(yyv1013), d) + h.decSliceCapability((*[]Capability)(yyv9), d) } } - yyj1012++ - if yyhl1012 { - yyb1012 = yyj1012 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1012 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1012 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Drop = nil } else { - yyv1015 := &x.Drop - yym1016 := z.DecBinary() - _ = yym1016 + yyv11 := &x.Drop + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSliceCapability((*[]Capability)(yyv1015), d) + h.decSliceCapability((*[]Capability)(yyv11), d) } } for { - yyj1012++ - if yyhl1012 { - yyb1012 = yyj1012 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1012 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1012 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1012-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { @@ -13249,31 +17130,34 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1017 := z.EncBinary() - _ = yym1017 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1018 := !z.EncBinary() - yy2arr1018 := z.EncBasicHandle().StructToArray - var yyq1018 [2]bool - _, _, _ = yysep1018, yyq1018, yy2arr1018 - const yyr1018 bool = false - yyq1018[0] = len(x.Limits) != 0 - yyq1018[1] = len(x.Requests) != 0 - if yyr1018 || yy2arr1018 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Limits) != 0 + yyq2[1] = len(x.Requests) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1018 int = 0 - for _, b := range yyq1018 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1018++ + yynn2++ } } - r.EncodeMapStart(yynn1018) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1018 || yy2arr1018 { - if yyq1018[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Limits == nil { r.EncodeNil() } else { @@ -13283,8 +17167,10 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1018[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("limits")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Limits == nil { r.EncodeNil() } else { @@ -13292,8 +17178,9 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1018 || yy2arr1018 { - if yyq1018[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Requests == nil { r.EncodeNil() } else { @@ -13303,8 +17190,10 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1018[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("requests")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Requests == nil { r.EncodeNil() } else { @@ -13312,8 +17201,10 @@ func (x *ResourceRequirements) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1018 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -13323,24 +17214,25 @@ func (x *ResourceRequirements) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1021 := z.DecBinary() - _ = yym1021 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1022 := r.ReadMapStart() - if yyl1022 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1022, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1022 := r.ReadArrayStart() - if yyl1022 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1022, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -13352,12 +17244,12 @@ func (x *ResourceRequirements) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1023Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1023Slc - var yyhl1023 bool = l >= 0 - for yyj1023 := 0; ; yyj1023++ { - if yyhl1023 { - if yyj1023 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -13365,84 +17257,87 @@ func (x *ResourceRequirements) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys1023Slc = r.DecodeBytes(yys1023Slc, true, true) - yys1023 := string(yys1023Slc) - switch yys1023 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "limits": if r.TryDecodeAsNil() { x.Limits = nil } else { - yyv1024 := &x.Limits - yyv1024.CodecDecodeSelf(d) + yyv4 := &x.Limits + yyv4.CodecDecodeSelf(d) } case "requests": if r.TryDecodeAsNil() { x.Requests = nil } else { - yyv1025 := &x.Requests - yyv1025.CodecDecodeSelf(d) + yyv5 := &x.Requests + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1023) - } // end switch yys1023 - } // end for yyj1023 - if !yyhl1023 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceRequirements) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1026 int - var yyb1026 bool - var yyhl1026 bool = l >= 0 - yyj1026++ - if yyhl1026 { - yyb1026 = yyj1026 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1026 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1026 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Limits = nil } else { - yyv1027 := &x.Limits - yyv1027.CodecDecodeSelf(d) + yyv7 := &x.Limits + yyv7.CodecDecodeSelf(d) } - yyj1026++ - if yyhl1026 { - yyb1026 = yyj1026 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1026 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1026 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Requests = nil } else { - yyv1028 := &x.Requests - yyv1028.CodecDecodeSelf(d) + yyv8 := &x.Requests + yyv8.CodecDecodeSelf(d) } for { - yyj1026++ - if yyhl1026 { - yyb1026 = yyj1026 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1026 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1026 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1026-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { @@ -13452,64 +17347,70 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1029 := z.EncBinary() - _ = yym1029 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1030 := !z.EncBinary() - yy2arr1030 := z.EncBasicHandle().StructToArray - var yyq1030 [18]bool - _, _, _ = yysep1030, yyq1030, yy2arr1030 - const yyr1030 bool = false - yyq1030[1] = x.Image != "" - yyq1030[2] = len(x.Command) != 0 - yyq1030[3] = len(x.Args) != 0 - yyq1030[4] = x.WorkingDir != "" - yyq1030[5] = len(x.Ports) != 0 - yyq1030[6] = len(x.Env) != 0 - yyq1030[7] = true - yyq1030[8] = len(x.VolumeMounts) != 0 - yyq1030[9] = x.LivenessProbe != nil - yyq1030[10] = x.ReadinessProbe != nil - yyq1030[11] = x.Lifecycle != nil - yyq1030[12] = x.TerminationMessagePath != "" - yyq1030[13] = x.ImagePullPolicy != "" - yyq1030[14] = x.SecurityContext != nil - yyq1030[15] = x.Stdin != false - yyq1030[16] = x.StdinOnce != false - yyq1030[17] = x.TTY != false - if yyr1030 || yy2arr1030 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [18]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Image != "" + yyq2[2] = len(x.Command) != 0 + yyq2[3] = len(x.Args) != 0 + yyq2[4] = x.WorkingDir != "" + yyq2[5] = len(x.Ports) != 0 + yyq2[6] = len(x.Env) != 0 + yyq2[7] = true + yyq2[8] = len(x.VolumeMounts) != 0 + yyq2[9] = x.LivenessProbe != nil + yyq2[10] = x.ReadinessProbe != nil + yyq2[11] = x.Lifecycle != nil + yyq2[12] = x.TerminationMessagePath != "" + yyq2[13] = x.ImagePullPolicy != "" + yyq2[14] = x.SecurityContext != nil + yyq2[15] = x.Stdin != false + yyq2[16] = x.StdinOnce != false + yyq2[17] = x.TTY != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(18) } else { - var yynn1030 int = 1 - for _, b := range yyq1030 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1030++ + yynn2++ } } - r.EncodeMapStart(yynn1030) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1030 || yy2arr1030 { - yym1032 := z.EncBinary() - _ = yym1032 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym1033 := z.EncBinary() - _ = yym1033 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr1030 || yy2arr1030 { - if yyq1030[1] { - yym1035 := z.EncBinary() - _ = yym1035 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Image)) @@ -13518,23 +17419,26 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1030[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("image")) - yym1036 := z.EncBinary() - _ = yym1036 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Image)) } } } - if yyr1030 || yy2arr1030 { - if yyq1030[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Command == nil { r.EncodeNil() } else { - yym1038 := z.EncBinary() - _ = yym1038 + yym10 := z.EncBinary() + _ = yym10 if false { } else { z.F.EncSliceStringV(x.Command, false, e) @@ -13544,13 +17448,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1030[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("command")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Command == nil { r.EncodeNil() } else { - yym1039 := z.EncBinary() - _ = yym1039 + yym11 := z.EncBinary() + _ = yym11 if false { } else { z.F.EncSliceStringV(x.Command, false, e) @@ -13558,13 +17464,14 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1030 || yy2arr1030 { - if yyq1030[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.Args == nil { r.EncodeNil() } else { - yym1041 := z.EncBinary() - _ = yym1041 + yym13 := z.EncBinary() + _ = yym13 if false { } else { z.F.EncSliceStringV(x.Args, false, e) @@ -13574,13 +17481,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1030[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("args")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Args == nil { r.EncodeNil() } else { - yym1042 := z.EncBinary() - _ = yym1042 + yym14 := z.EncBinary() + _ = yym14 if false { } else { z.F.EncSliceStringV(x.Args, false, e) @@ -13588,10 +17497,11 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1030 || yy2arr1030 { - if yyq1030[4] { - yym1044 := z.EncBinary() - _ = yym1044 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.WorkingDir)) @@ -13600,23 +17510,26 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1030[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("workingDir")) - yym1045 := z.EncBinary() - _ = yym1045 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.WorkingDir)) } } } - if yyr1030 || yy2arr1030 { - if yyq1030[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.Ports == nil { r.EncodeNil() } else { - yym1047 := z.EncBinary() - _ = yym1047 + yym19 := z.EncBinary() + _ = yym19 if false { } else { h.encSliceContainerPort(([]ContainerPort)(x.Ports), e) @@ -13626,13 +17539,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1030[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ports")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Ports == nil { r.EncodeNil() } else { - yym1048 := z.EncBinary() - _ = yym1048 + yym20 := z.EncBinary() + _ = yym20 if false { } else { h.encSliceContainerPort(([]ContainerPort)(x.Ports), e) @@ -13640,13 +17555,14 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1030 || yy2arr1030 { - if yyq1030[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.Env == nil { r.EncodeNil() } else { - yym1050 := z.EncBinary() - _ = yym1050 + yym22 := z.EncBinary() + _ = yym22 if false { } else { h.encSliceEnvVar(([]EnvVar)(x.Env), e) @@ -13656,13 +17572,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1030[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("env")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Env == nil { r.EncodeNil() } else { - yym1051 := z.EncBinary() - _ = yym1051 + yym23 := z.EncBinary() + _ = yym23 if false { } else { h.encSliceEnvVar(([]EnvVar)(x.Env), e) @@ -13670,27 +17588,31 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1030 || yy2arr1030 { - if yyq1030[7] { - yy1053 := &x.Resources - yy1053.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yy25 := &x.Resources + yy25.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1030[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resources")) - yy1054 := &x.Resources - yy1054.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy27 := &x.Resources + yy27.CodecEncodeSelf(e) } } - if yyr1030 || yy2arr1030 { - if yyq1030[8] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { if x.VolumeMounts == nil { r.EncodeNil() } else { - yym1056 := z.EncBinary() - _ = yym1056 + yym30 := z.EncBinary() + _ = yym30 if false { } else { h.encSliceVolumeMount(([]VolumeMount)(x.VolumeMounts), e) @@ -13700,13 +17622,15 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1030[8] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumeMounts")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.VolumeMounts == nil { r.EncodeNil() } else { - yym1057 := z.EncBinary() - _ = yym1057 + yym31 := z.EncBinary() + _ = yym31 if false { } else { h.encSliceVolumeMount(([]VolumeMount)(x.VolumeMounts), e) @@ -13714,8 +17638,9 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1030 || yy2arr1030 { - if yyq1030[9] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { if x.LivenessProbe == nil { r.EncodeNil() } else { @@ -13725,8 +17650,10 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1030[9] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("livenessProbe")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.LivenessProbe == nil { r.EncodeNil() } else { @@ -13734,8 +17661,9 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1030 || yy2arr1030 { - if yyq1030[10] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { if x.ReadinessProbe == nil { r.EncodeNil() } else { @@ -13745,8 +17673,10 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1030[10] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("readinessProbe")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ReadinessProbe == nil { r.EncodeNil() } else { @@ -13754,8 +17684,9 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1030 || yy2arr1030 { - if yyq1030[11] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { if x.Lifecycle == nil { r.EncodeNil() } else { @@ -13765,8 +17696,10 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1030[11] { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lifecycle")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Lifecycle == nil { r.EncodeNil() } else { @@ -13774,10 +17707,11 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1030 || yy2arr1030 { - if yyq1030[12] { - yym1062 := z.EncBinary() - _ = yym1062 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + yym42 := z.EncBinary() + _ = yym42 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.TerminationMessagePath)) @@ -13786,30 +17720,36 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1030[12] { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("terminationMessagePath")) - yym1063 := z.EncBinary() - _ = yym1063 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym43 := z.EncBinary() + _ = yym43 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.TerminationMessagePath)) } } } - if yyr1030 || yy2arr1030 { - if yyq1030[13] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[13] { x.ImagePullPolicy.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1030[13] { + if yyq2[13] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("imagePullPolicy")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.ImagePullPolicy.CodecEncodeSelf(e) } } - if yyr1030 || yy2arr1030 { - if yyq1030[14] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { if x.SecurityContext == nil { r.EncodeNil() } else { @@ -13819,8 +17759,10 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1030[14] { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("securityContext")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SecurityContext == nil { r.EncodeNil() } else { @@ -13828,10 +17770,11 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1030 || yy2arr1030 { - if yyq1030[15] { - yym1067 := z.EncBinary() - _ = yym1067 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[15] { + yym51 := z.EncBinary() + _ = yym51 if false { } else { r.EncodeBool(bool(x.Stdin)) @@ -13840,20 +17783,23 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1030[15] { + if yyq2[15] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("stdin")) - yym1068 := z.EncBinary() - _ = yym1068 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym52 := z.EncBinary() + _ = yym52 if false { } else { r.EncodeBool(bool(x.Stdin)) } } } - if yyr1030 || yy2arr1030 { - if yyq1030[16] { - yym1070 := z.EncBinary() - _ = yym1070 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[16] { + yym54 := z.EncBinary() + _ = yym54 if false { } else { r.EncodeBool(bool(x.StdinOnce)) @@ -13862,20 +17808,23 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1030[16] { + if yyq2[16] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("stdinOnce")) - yym1071 := z.EncBinary() - _ = yym1071 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym55 := z.EncBinary() + _ = yym55 if false { } else { r.EncodeBool(bool(x.StdinOnce)) } } } - if yyr1030 || yy2arr1030 { - if yyq1030[17] { - yym1073 := z.EncBinary() - _ = yym1073 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[17] { + yym57 := z.EncBinary() + _ = yym57 if false { } else { r.EncodeBool(bool(x.TTY)) @@ -13884,18 +17833,22 @@ func (x *Container) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1030[17] { + if yyq2[17] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("tty")) - yym1074 := z.EncBinary() - _ = yym1074 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym58 := z.EncBinary() + _ = yym58 if false { } else { r.EncodeBool(bool(x.TTY)) } } } - if yysep1030 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -13905,24 +17858,25 @@ func (x *Container) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1075 := z.DecBinary() - _ = yym1075 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1076 := r.ReadMapStart() - if yyl1076 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1076, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1076 := r.ReadArrayStart() - if yyl1076 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1076, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -13934,12 +17888,12 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1077Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1077Slc - var yyhl1077 bool = l >= 0 - for yyj1077 := 0; ; yyj1077++ { - if yyhl1077 { - if yyj1077 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -13947,9 +17901,11 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1077Slc = r.DecodeBytes(yys1077Slc, true, true) - yys1077 := string(yys1077Slc) - switch yys1077 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -13966,24 +17922,24 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Command = nil } else { - yyv1080 := &x.Command - yym1081 := z.DecBinary() - _ = yym1081 + yyv6 := &x.Command + yym7 := z.DecBinary() + _ = yym7 if false { } else { - z.F.DecSliceStringX(yyv1080, false, d) + z.F.DecSliceStringX(yyv6, false, d) } } case "args": if r.TryDecodeAsNil() { x.Args = nil } else { - yyv1082 := &x.Args - yym1083 := z.DecBinary() - _ = yym1083 + yyv8 := &x.Args + yym9 := z.DecBinary() + _ = yym9 if false { } else { - z.F.DecSliceStringX(yyv1082, false, d) + z.F.DecSliceStringX(yyv8, false, d) } } case "workingDir": @@ -13996,43 +17952,43 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv1085 := &x.Ports - yym1086 := z.DecBinary() - _ = yym1086 + yyv11 := &x.Ports + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSliceContainerPort((*[]ContainerPort)(yyv1085), d) + h.decSliceContainerPort((*[]ContainerPort)(yyv11), d) } } case "env": if r.TryDecodeAsNil() { x.Env = nil } else { - yyv1087 := &x.Env - yym1088 := z.DecBinary() - _ = yym1088 + yyv13 := &x.Env + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceEnvVar((*[]EnvVar)(yyv1087), d) + h.decSliceEnvVar((*[]EnvVar)(yyv13), d) } } case "resources": if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv1089 := &x.Resources - yyv1089.CodecDecodeSelf(d) + yyv15 := &x.Resources + yyv15.CodecDecodeSelf(d) } case "volumeMounts": if r.TryDecodeAsNil() { x.VolumeMounts = nil } else { - yyv1090 := &x.VolumeMounts - yym1091 := z.DecBinary() - _ = yym1091 + yyv16 := &x.VolumeMounts + yym17 := z.DecBinary() + _ = yym17 if false { } else { - h.decSliceVolumeMount((*[]VolumeMount)(yyv1090), d) + h.decSliceVolumeMount((*[]VolumeMount)(yyv16), d) } } case "livenessProbe": @@ -14110,197 +18066,205 @@ func (x *Container) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.TTY = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys1077) - } // end switch yys1077 - } // end for yyj1077 - if !yyhl1077 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1101 int - var yyb1101 bool - var yyhl1101 bool = l >= 0 - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + var yyj27 int + var yyb27 bool + var yyhl27 bool = l >= 0 + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Image = "" } else { x.Image = string(r.DecodeString()) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Command = nil } else { - yyv1104 := &x.Command - yym1105 := z.DecBinary() - _ = yym1105 + yyv30 := &x.Command + yym31 := z.DecBinary() + _ = yym31 if false { } else { - z.F.DecSliceStringX(yyv1104, false, d) + z.F.DecSliceStringX(yyv30, false, d) } } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Args = nil } else { - yyv1106 := &x.Args - yym1107 := z.DecBinary() - _ = yym1107 + yyv32 := &x.Args + yym33 := z.DecBinary() + _ = yym33 if false { } else { - z.F.DecSliceStringX(yyv1106, false, d) + z.F.DecSliceStringX(yyv32, false, d) } } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.WorkingDir = "" } else { x.WorkingDir = string(r.DecodeString()) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv1109 := &x.Ports - yym1110 := z.DecBinary() - _ = yym1110 + yyv35 := &x.Ports + yym36 := z.DecBinary() + _ = yym36 if false { } else { - h.decSliceContainerPort((*[]ContainerPort)(yyv1109), d) + h.decSliceContainerPort((*[]ContainerPort)(yyv35), d) } } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Env = nil } else { - yyv1111 := &x.Env - yym1112 := z.DecBinary() - _ = yym1112 + yyv37 := &x.Env + yym38 := z.DecBinary() + _ = yym38 if false { } else { - h.decSliceEnvVar((*[]EnvVar)(yyv1111), d) + h.decSliceEnvVar((*[]EnvVar)(yyv37), d) } } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Resources = ResourceRequirements{} } else { - yyv1113 := &x.Resources - yyv1113.CodecDecodeSelf(d) + yyv39 := &x.Resources + yyv39.CodecDecodeSelf(d) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.VolumeMounts = nil } else { - yyv1114 := &x.VolumeMounts - yym1115 := z.DecBinary() - _ = yym1115 + yyv40 := &x.VolumeMounts + yym41 := z.DecBinary() + _ = yym41 if false { } else { - h.decSliceVolumeMount((*[]VolumeMount)(yyv1114), d) + h.decSliceVolumeMount((*[]VolumeMount)(yyv40), d) } } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.LivenessProbe != nil { x.LivenessProbe = nil @@ -14311,16 +18275,17 @@ func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.LivenessProbe.CodecDecodeSelf(d) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ReadinessProbe != nil { x.ReadinessProbe = nil @@ -14331,16 +18296,17 @@ func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.ReadinessProbe.CodecDecodeSelf(d) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Lifecycle != nil { x.Lifecycle = nil @@ -14351,46 +18317,49 @@ func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Lifecycle.CodecDecodeSelf(d) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TerminationMessagePath = "" } else { x.TerminationMessagePath = string(r.DecodeString()) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ImagePullPolicy = "" } else { x.ImagePullPolicy = PullPolicy(r.DecodeString()) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SecurityContext != nil { x.SecurityContext = nil @@ -14401,64 +18370,68 @@ func (x *Container) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.SecurityContext.CodecDecodeSelf(d) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Stdin = false } else { x.Stdin = bool(r.DecodeBool()) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.StdinOnce = false } else { x.StdinOnce = bool(r.DecodeBool()) } - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { - r.ReadEnd() + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TTY = false } else { x.TTY = bool(r.DecodeBool()) } for { - yyj1101++ - if yyhl1101 { - yyb1101 = yyj1101 > l + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l } else { - yyb1101 = r.CheckBreak() + yyb27 = r.CheckBreak() } - if yyb1101 { + if yyb27 { break } - z.DecStructFieldNotFound(yyj1101-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj27-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { @@ -14468,32 +18441,35 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1125 := z.EncBinary() - _ = yym1125 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1126 := !z.EncBinary() - yy2arr1126 := z.EncBasicHandle().StructToArray - var yyq1126 [3]bool - _, _, _ = yysep1126, yyq1126, yy2arr1126 - const yyr1126 bool = false - yyq1126[0] = x.Exec != nil - yyq1126[1] = x.HTTPGet != nil - yyq1126[2] = x.TCPSocket != nil - if yyr1126 || yy2arr1126 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Exec != nil + yyq2[1] = x.HTTPGet != nil + yyq2[2] = x.TCPSocket != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1126 int = 0 - for _, b := range yyq1126 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1126++ + yynn2++ } } - r.EncodeMapStart(yynn1126) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1126 || yy2arr1126 { - if yyq1126[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Exec == nil { r.EncodeNil() } else { @@ -14503,8 +18479,10 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1126[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("exec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Exec == nil { r.EncodeNil() } else { @@ -14512,8 +18490,9 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1126 || yy2arr1126 { - if yyq1126[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.HTTPGet == nil { r.EncodeNil() } else { @@ -14523,8 +18502,10 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1126[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("httpGet")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.HTTPGet == nil { r.EncodeNil() } else { @@ -14532,8 +18513,9 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1126 || yy2arr1126 { - if yyq1126[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.TCPSocket == nil { r.EncodeNil() } else { @@ -14543,8 +18525,10 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1126[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("tcpSocket")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TCPSocket == nil { r.EncodeNil() } else { @@ -14552,8 +18536,10 @@ func (x *Handler) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1126 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -14563,24 +18549,25 @@ func (x *Handler) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1130 := z.DecBinary() - _ = yym1130 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1131 := r.ReadMapStart() - if yyl1131 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1131, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1131 := r.ReadArrayStart() - if yyl1131 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1131, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -14592,12 +18579,12 @@ func (x *Handler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1132Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1132Slc - var yyhl1132 bool = l >= 0 - for yyj1132 := 0; ; yyj1132++ { - if yyhl1132 { - if yyj1132 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -14605,9 +18592,11 @@ func (x *Handler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1132Slc = r.DecodeBytes(yys1132Slc, true, true) - yys1132 := string(yys1132Slc) - switch yys1132 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "exec": if r.TryDecodeAsNil() { if x.Exec != nil { @@ -14642,31 +18631,30 @@ func (x *Handler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.TCPSocket.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1132) - } // end switch yys1132 - } // end for yyj1132 - if !yyhl1132 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Handler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1136 int - var yyb1136 bool - var yyhl1136 bool = l >= 0 - yyj1136++ - if yyhl1136 { - yyb1136 = yyj1136 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1136 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1136 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Exec != nil { x.Exec = nil @@ -14677,16 +18665,17 @@ func (x *Handler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Exec.CodecDecodeSelf(d) } - yyj1136++ - if yyhl1136 { - yyb1136 = yyj1136 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1136 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1136 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HTTPGet != nil { x.HTTPGet = nil @@ -14697,16 +18686,17 @@ func (x *Handler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.HTTPGet.CodecDecodeSelf(d) } - yyj1136++ - if yyhl1136 { - yyb1136 = yyj1136 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1136 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1136 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.TCPSocket != nil { x.TCPSocket = nil @@ -14718,18 +18708,19 @@ func (x *Handler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.TCPSocket.CodecDecodeSelf(d) } for { - yyj1136++ - if yyhl1136 { - yyb1136 = yyj1136 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1136 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1136 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj1136-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { @@ -14739,31 +18730,34 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1140 := z.EncBinary() - _ = yym1140 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1141 := !z.EncBinary() - yy2arr1141 := z.EncBasicHandle().StructToArray - var yyq1141 [2]bool - _, _, _ = yysep1141, yyq1141, yy2arr1141 - const yyr1141 bool = false - yyq1141[0] = x.PostStart != nil - yyq1141[1] = x.PreStop != nil - if yyr1141 || yy2arr1141 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.PostStart != nil + yyq2[1] = x.PreStop != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1141 int = 0 - for _, b := range yyq1141 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1141++ + yynn2++ } } - r.EncodeMapStart(yynn1141) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1141 || yy2arr1141 { - if yyq1141[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.PostStart == nil { r.EncodeNil() } else { @@ -14773,8 +18767,10 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1141[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("postStart")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.PostStart == nil { r.EncodeNil() } else { @@ -14782,8 +18778,9 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1141 || yy2arr1141 { - if yyq1141[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.PreStop == nil { r.EncodeNil() } else { @@ -14793,8 +18790,10 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1141[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("preStop")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.PreStop == nil { r.EncodeNil() } else { @@ -14802,8 +18801,10 @@ func (x *Lifecycle) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1141 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -14813,24 +18814,25 @@ func (x *Lifecycle) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1144 := z.DecBinary() - _ = yym1144 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1145 := r.ReadMapStart() - if yyl1145 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1145, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1145 := r.ReadArrayStart() - if yyl1145 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1145, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -14842,12 +18844,12 @@ func (x *Lifecycle) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1146Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1146Slc - var yyhl1146 bool = l >= 0 - for yyj1146 := 0; ; yyj1146++ { - if yyhl1146 { - if yyj1146 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -14855,9 +18857,11 @@ func (x *Lifecycle) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1146Slc = r.DecodeBytes(yys1146Slc, true, true) - yys1146 := string(yys1146Slc) - switch yys1146 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "postStart": if r.TryDecodeAsNil() { if x.PostStart != nil { @@ -14881,31 +18885,30 @@ func (x *Lifecycle) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.PreStop.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1146) - } // end switch yys1146 - } // end for yyj1146 - if !yyhl1146 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Lifecycle) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1149 int - var yyb1149 bool - var yyhl1149 bool = l >= 0 - yyj1149++ - if yyhl1149 { - yyb1149 = yyj1149 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1149 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1149 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.PostStart != nil { x.PostStart = nil @@ -14916,16 +18919,17 @@ func (x *Lifecycle) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.PostStart.CodecDecodeSelf(d) } - yyj1149++ - if yyhl1149 { - yyb1149 = yyj1149 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1149 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1149 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.PreStop != nil { x.PreStop = nil @@ -14937,26 +18941,27 @@ func (x *Lifecycle) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.PreStop.CodecDecodeSelf(d) } for { - yyj1149++ - if yyhl1149 { - yyb1149 = yyj1149 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1149 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1149 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1149-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x ConditionStatus) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1152 := z.EncBinary() - _ = yym1152 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -14968,8 +18973,8 @@ func (x *ConditionStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1153 := z.DecBinary() - _ = yym1153 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -14984,33 +18989,36 @@ func (x *ContainerStateWaiting) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1154 := z.EncBinary() - _ = yym1154 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1155 := !z.EncBinary() - yy2arr1155 := z.EncBasicHandle().StructToArray - var yyq1155 [2]bool - _, _, _ = yysep1155, yyq1155, yy2arr1155 - const yyr1155 bool = false - yyq1155[0] = x.Reason != "" - yyq1155[1] = x.Message != "" - if yyr1155 || yy2arr1155 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Reason != "" + yyq2[1] = x.Message != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1155 int = 0 - for _, b := range yyq1155 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1155++ + yynn2++ } } - r.EncodeMapStart(yynn1155) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1155 || yy2arr1155 { - if yyq1155[0] { - yym1157 := z.EncBinary() - _ = yym1157 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -15019,20 +19027,23 @@ func (x *ContainerStateWaiting) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1155[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym1158 := z.EncBinary() - _ = yym1158 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr1155 || yy2arr1155 { - if yyq1155[1] { - yym1160 := z.EncBinary() - _ = yym1160 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -15041,18 +19052,22 @@ func (x *ContainerStateWaiting) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1155[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym1161 := z.EncBinary() - _ = yym1161 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yysep1155 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -15062,24 +19077,25 @@ func (x *ContainerStateWaiting) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1162 := z.DecBinary() - _ = yym1162 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1163 := r.ReadMapStart() - if yyl1163 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1163, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1163 := r.ReadArrayStart() - if yyl1163 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1163, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -15091,12 +19107,12 @@ func (x *ContainerStateWaiting) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1164Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1164Slc - var yyhl1164 bool = l >= 0 - for yyj1164 := 0; ; yyj1164++ { - if yyhl1164 { - if yyj1164 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -15104,9 +19120,11 @@ func (x *ContainerStateWaiting) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1164Slc = r.DecodeBytes(yys1164Slc, true, true) - yys1164 := string(yys1164Slc) - switch yys1164 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "reason": if r.TryDecodeAsNil() { x.Reason = "" @@ -15120,64 +19138,65 @@ func (x *ContainerStateWaiting) codecDecodeSelfFromMap(l int, d *codec1978.Decod x.Message = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1164) - } // end switch yys1164 - } // end for yyj1164 - if !yyhl1164 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerStateWaiting) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1167 int - var yyb1167 bool - var yyhl1167 bool = l >= 0 - yyj1167++ - if yyhl1167 { - yyb1167 = yyj1167 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1167 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1167 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj1167++ - if yyhl1167 { - yyb1167 = yyj1167 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1167 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1167 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } for { - yyj1167++ - if yyhl1167 { - yyb1167 = yyj1167 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1167 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1167 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1167-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerStateRunning) CodecEncodeSelf(e *codec1978.Encoder) { @@ -15187,64 +19206,71 @@ func (x *ContainerStateRunning) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1170 := z.EncBinary() - _ = yym1170 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1171 := !z.EncBinary() - yy2arr1171 := z.EncBasicHandle().StructToArray - var yyq1171 [1]bool - _, _, _ = yysep1171, yyq1171, yy2arr1171 - const yyr1171 bool = false - yyq1171[0] = true - if yyr1171 || yy2arr1171 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn1171 int = 0 - for _, b := range yyq1171 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1171++ + yynn2++ } } - r.EncodeMapStart(yynn1171) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1171 || yy2arr1171 { - if yyq1171[0] { - yy1173 := &x.StartedAt - yym1174 := z.EncBinary() - _ = yym1174 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.StartedAt + yym5 := z.EncBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.EncExt(yy1173) { - } else if yym1174 { - z.EncBinaryMarshal(yy1173) - } else if !yym1174 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1173) + } else if z.HasExtensions() && z.EncExt(yy4) { + } else if yym5 { + z.EncBinaryMarshal(yy4) + } else if !yym5 && z.IsJSONHandle() { + z.EncJSONMarshal(yy4) } else { - z.EncFallback(yy1173) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1171[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("startedAt")) - yy1175 := &x.StartedAt - yym1176 := z.EncBinary() - _ = yym1176 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.StartedAt + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1175) { - } else if yym1176 { - z.EncBinaryMarshal(yy1175) - } else if !yym1176 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1175) + } else if z.HasExtensions() && z.EncExt(yy6) { + } else if yym7 { + z.EncBinaryMarshal(yy6) + } else if !yym7 && z.IsJSONHandle() { + z.EncJSONMarshal(yy6) } else { - z.EncFallback(yy1175) + z.EncFallback(yy6) } } } - if yysep1171 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -15254,24 +19280,25 @@ func (x *ContainerStateRunning) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1177 := z.DecBinary() - _ = yym1177 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1178 := r.ReadMapStart() - if yyl1178 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1178, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1178 := r.ReadArrayStart() - if yyl1178 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1178, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -15283,12 +19310,12 @@ func (x *ContainerStateRunning) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1179Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1179Slc - var yyhl1179 bool = l >= 0 - for yyj1179 := 0; ; yyj1179++ { - if yyhl1179 { - if yyj1179 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -15296,81 +19323,83 @@ func (x *ContainerStateRunning) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1179Slc = r.DecodeBytes(yys1179Slc, true, true) - yys1179 := string(yys1179Slc) - switch yys1179 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "startedAt": if r.TryDecodeAsNil() { x.StartedAt = pkg2_unversioned.Time{} } else { - yyv1180 := &x.StartedAt - yym1181 := z.DecBinary() - _ = yym1181 + yyv4 := &x.StartedAt + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv1180) { - } else if yym1181 { - z.DecBinaryUnmarshal(yyv1180) - } else if !yym1181 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1180) + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else if yym5 { + z.DecBinaryUnmarshal(yyv4) + } else if !yym5 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv4) } else { - z.DecFallback(yyv1180, false) + z.DecFallback(yyv4, false) } } default: - z.DecStructFieldNotFound(-1, yys1179) - } // end switch yys1179 - } // end for yyj1179 - if !yyhl1179 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerStateRunning) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1182 int - var yyb1182 bool - var yyhl1182 bool = l >= 0 - yyj1182++ - if yyhl1182 { - yyb1182 = yyj1182 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1182 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1182 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.StartedAt = pkg2_unversioned.Time{} } else { - yyv1183 := &x.StartedAt - yym1184 := z.DecBinary() - _ = yym1184 + yyv7 := &x.StartedAt + yym8 := z.DecBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.DecExt(yyv1183) { - } else if yym1184 { - z.DecBinaryUnmarshal(yyv1183) - } else if !yym1184 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1183) + } else if z.HasExtensions() && z.DecExt(yyv7) { + } else if yym8 { + z.DecBinaryUnmarshal(yyv7) + } else if !yym8 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv7) } else { - z.DecFallback(yyv1183, false) + z.DecFallback(yyv7, false) } } for { - yyj1182++ - if yyhl1182 { - yyb1182 = yyj1182 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1182 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1182 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1182-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { @@ -15380,53 +19409,59 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1185 := z.EncBinary() - _ = yym1185 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1186 := !z.EncBinary() - yy2arr1186 := z.EncBasicHandle().StructToArray - var yyq1186 [7]bool - _, _, _ = yysep1186, yyq1186, yy2arr1186 - const yyr1186 bool = false - yyq1186[1] = x.Signal != 0 - yyq1186[2] = x.Reason != "" - yyq1186[3] = x.Message != "" - yyq1186[4] = true - yyq1186[5] = true - yyq1186[6] = x.ContainerID != "" - if yyr1186 || yy2arr1186 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Signal != 0 + yyq2[2] = x.Reason != "" + yyq2[3] = x.Message != "" + yyq2[4] = true + yyq2[5] = true + yyq2[6] = x.ContainerID != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(7) } else { - var yynn1186 int = 1 - for _, b := range yyq1186 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1186++ + yynn2++ } } - r.EncodeMapStart(yynn1186) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1186 || yy2arr1186 { - yym1188 := z.EncBinary() - _ = yym1188 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.ExitCode)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("exitCode")) - yym1189 := z.EncBinary() - _ = yym1189 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.ExitCode)) } } - if yyr1186 || yy2arr1186 { - if yyq1186[1] { - yym1191 := z.EncBinary() - _ = yym1191 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.Signal)) @@ -15435,20 +19470,23 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq1186[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("signal")) - yym1192 := z.EncBinary() - _ = yym1192 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.Signal)) } } } - if yyr1186 || yy2arr1186 { - if yyq1186[2] { - yym1194 := z.EncBinary() - _ = yym1194 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -15457,20 +19495,23 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1186[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym1195 := z.EncBinary() - _ = yym1195 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr1186 || yy2arr1186 { - if yyq1186[3] { - yym1197 := z.EncBinary() - _ = yym1197 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -15479,88 +19520,97 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1186[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym1198 := z.EncBinary() - _ = yym1198 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr1186 || yy2arr1186 { - if yyq1186[4] { - yy1200 := &x.StartedAt - yym1201 := z.EncBinary() - _ = yym1201 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yy16 := &x.StartedAt + yym17 := z.EncBinary() + _ = yym17 if false { - } else if z.HasExtensions() && z.EncExt(yy1200) { - } else if yym1201 { - z.EncBinaryMarshal(yy1200) - } else if !yym1201 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1200) + } else if z.HasExtensions() && z.EncExt(yy16) { + } else if yym17 { + z.EncBinaryMarshal(yy16) + } else if !yym17 && z.IsJSONHandle() { + z.EncJSONMarshal(yy16) } else { - z.EncFallback(yy1200) + z.EncFallback(yy16) } } else { r.EncodeNil() } } else { - if yyq1186[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("startedAt")) - yy1202 := &x.StartedAt - yym1203 := z.EncBinary() - _ = yym1203 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy18 := &x.StartedAt + yym19 := z.EncBinary() + _ = yym19 if false { - } else if z.HasExtensions() && z.EncExt(yy1202) { - } else if yym1203 { - z.EncBinaryMarshal(yy1202) - } else if !yym1203 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1202) + } else if z.HasExtensions() && z.EncExt(yy18) { + } else if yym19 { + z.EncBinaryMarshal(yy18) + } else if !yym19 && z.IsJSONHandle() { + z.EncJSONMarshal(yy18) } else { - z.EncFallback(yy1202) + z.EncFallback(yy18) } } } - if yyr1186 || yy2arr1186 { - if yyq1186[5] { - yy1205 := &x.FinishedAt - yym1206 := z.EncBinary() - _ = yym1206 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yy21 := &x.FinishedAt + yym22 := z.EncBinary() + _ = yym22 if false { - } else if z.HasExtensions() && z.EncExt(yy1205) { - } else if yym1206 { - z.EncBinaryMarshal(yy1205) - } else if !yym1206 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1205) + } else if z.HasExtensions() && z.EncExt(yy21) { + } else if yym22 { + z.EncBinaryMarshal(yy21) + } else if !yym22 && z.IsJSONHandle() { + z.EncJSONMarshal(yy21) } else { - z.EncFallback(yy1205) + z.EncFallback(yy21) } } else { r.EncodeNil() } } else { - if yyq1186[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("finishedAt")) - yy1207 := &x.FinishedAt - yym1208 := z.EncBinary() - _ = yym1208 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy23 := &x.FinishedAt + yym24 := z.EncBinary() + _ = yym24 if false { - } else if z.HasExtensions() && z.EncExt(yy1207) { - } else if yym1208 { - z.EncBinaryMarshal(yy1207) - } else if !yym1208 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1207) + } else if z.HasExtensions() && z.EncExt(yy23) { + } else if yym24 { + z.EncBinaryMarshal(yy23) + } else if !yym24 && z.IsJSONHandle() { + z.EncJSONMarshal(yy23) } else { - z.EncFallback(yy1207) + z.EncFallback(yy23) } } } - if yyr1186 || yy2arr1186 { - if yyq1186[6] { - yym1210 := z.EncBinary() - _ = yym1210 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym26 := z.EncBinary() + _ = yym26 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerID)) @@ -15569,18 +19619,22 @@ func (x *ContainerStateTerminated) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1186[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerID")) - yym1211 := z.EncBinary() - _ = yym1211 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym27 := z.EncBinary() + _ = yym27 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerID)) } } } - if yysep1186 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -15590,24 +19644,25 @@ func (x *ContainerStateTerminated) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1212 := z.DecBinary() - _ = yym1212 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1213 := r.ReadMapStart() - if yyl1213 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1213, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1213 := r.ReadArrayStart() - if yyl1213 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1213, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -15619,12 +19674,12 @@ func (x *ContainerStateTerminated) codecDecodeSelfFromMap(l int, d *codec1978.De var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1214Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1214Slc - var yyhl1214 bool = l >= 0 - for yyj1214 := 0; ; yyj1214++ { - if yyhl1214 { - if yyj1214 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -15632,20 +19687,22 @@ func (x *ContainerStateTerminated) codecDecodeSelfFromMap(l int, d *codec1978.De break } } - yys1214Slc = r.DecodeBytes(yys1214Slc, true, true) - yys1214 := string(yys1214Slc) - switch yys1214 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "exitCode": if r.TryDecodeAsNil() { x.ExitCode = 0 } else { - x.ExitCode = int(r.DecodeInt(codecSelferBitsize1234)) + x.ExitCode = int32(r.DecodeInt(32)) } case "signal": if r.TryDecodeAsNil() { x.Signal = 0 } else { - x.Signal = int(r.DecodeInt(codecSelferBitsize1234)) + x.Signal = int32(r.DecodeInt(32)) } case "reason": if r.TryDecodeAsNil() { @@ -15663,34 +19720,34 @@ func (x *ContainerStateTerminated) codecDecodeSelfFromMap(l int, d *codec1978.De if r.TryDecodeAsNil() { x.StartedAt = pkg2_unversioned.Time{} } else { - yyv1219 := &x.StartedAt - yym1220 := z.DecBinary() - _ = yym1220 + yyv8 := &x.StartedAt + yym9 := z.DecBinary() + _ = yym9 if false { - } else if z.HasExtensions() && z.DecExt(yyv1219) { - } else if yym1220 { - z.DecBinaryUnmarshal(yyv1219) - } else if !yym1220 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1219) + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else if yym9 { + z.DecBinaryUnmarshal(yyv8) + } else if !yym9 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv8) } else { - z.DecFallback(yyv1219, false) + z.DecFallback(yyv8, false) } } case "finishedAt": if r.TryDecodeAsNil() { x.FinishedAt = pkg2_unversioned.Time{} } else { - yyv1221 := &x.FinishedAt - yym1222 := z.DecBinary() - _ = yym1222 + yyv10 := &x.FinishedAt + yym11 := z.DecBinary() + _ = yym11 if false { - } else if z.HasExtensions() && z.DecExt(yyv1221) { - } else if yym1222 { - z.DecBinaryUnmarshal(yyv1221) - } else if !yym1222 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1221) + } else if z.HasExtensions() && z.DecExt(yyv10) { + } else if yym11 { + z.DecBinaryUnmarshal(yyv10) + } else if !yym11 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv10) } else { - z.DecFallback(yyv1221, false) + z.DecFallback(yyv10, false) } } case "containerID": @@ -15700,161 +19757,167 @@ func (x *ContainerStateTerminated) codecDecodeSelfFromMap(l int, d *codec1978.De x.ContainerID = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1214) - } // end switch yys1214 - } // end for yyj1214 - if !yyhl1214 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerStateTerminated) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1224 int - var yyb1224 bool - var yyhl1224 bool = l >= 0 - yyj1224++ - if yyhl1224 { - yyb1224 = yyj1224 > l + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1224 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1224 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ExitCode = 0 } else { - x.ExitCode = int(r.DecodeInt(codecSelferBitsize1234)) + x.ExitCode = int32(r.DecodeInt(32)) } - yyj1224++ - if yyhl1224 { - yyb1224 = yyj1224 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1224 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1224 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Signal = 0 } else { - x.Signal = int(r.DecodeInt(codecSelferBitsize1234)) + x.Signal = int32(r.DecodeInt(32)) } - yyj1224++ - if yyhl1224 { - yyb1224 = yyj1224 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1224 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1224 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj1224++ - if yyhl1224 { - yyb1224 = yyj1224 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1224 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1224 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj1224++ - if yyhl1224 { - yyb1224 = yyj1224 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1224 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1224 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.StartedAt = pkg2_unversioned.Time{} } else { - yyv1229 := &x.StartedAt - yym1230 := z.DecBinary() - _ = yym1230 + yyv18 := &x.StartedAt + yym19 := z.DecBinary() + _ = yym19 if false { - } else if z.HasExtensions() && z.DecExt(yyv1229) { - } else if yym1230 { - z.DecBinaryUnmarshal(yyv1229) - } else if !yym1230 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1229) + } else if z.HasExtensions() && z.DecExt(yyv18) { + } else if yym19 { + z.DecBinaryUnmarshal(yyv18) + } else if !yym19 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv18) } else { - z.DecFallback(yyv1229, false) + z.DecFallback(yyv18, false) } } - yyj1224++ - if yyhl1224 { - yyb1224 = yyj1224 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1224 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1224 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FinishedAt = pkg2_unversioned.Time{} } else { - yyv1231 := &x.FinishedAt - yym1232 := z.DecBinary() - _ = yym1232 + yyv20 := &x.FinishedAt + yym21 := z.DecBinary() + _ = yym21 if false { - } else if z.HasExtensions() && z.DecExt(yyv1231) { - } else if yym1232 { - z.DecBinaryUnmarshal(yyv1231) - } else if !yym1232 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1231) + } else if z.HasExtensions() && z.DecExt(yyv20) { + } else if yym21 { + z.DecBinaryUnmarshal(yyv20) + } else if !yym21 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv20) } else { - z.DecFallback(yyv1231, false) + z.DecFallback(yyv20, false) } } - yyj1224++ - if yyhl1224 { - yyb1224 = yyj1224 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1224 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1224 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerID = "" } else { x.ContainerID = string(r.DecodeString()) } for { - yyj1224++ - if yyhl1224 { - yyb1224 = yyj1224 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1224 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1224 { + if yyb13 { break } - z.DecStructFieldNotFound(yyj1224-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { @@ -15864,32 +19927,35 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1234 := z.EncBinary() - _ = yym1234 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1235 := !z.EncBinary() - yy2arr1235 := z.EncBasicHandle().StructToArray - var yyq1235 [3]bool - _, _, _ = yysep1235, yyq1235, yy2arr1235 - const yyr1235 bool = false - yyq1235[0] = x.Waiting != nil - yyq1235[1] = x.Running != nil - yyq1235[2] = x.Terminated != nil - if yyr1235 || yy2arr1235 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Waiting != nil + yyq2[1] = x.Running != nil + yyq2[2] = x.Terminated != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1235 int = 0 - for _, b := range yyq1235 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1235++ + yynn2++ } } - r.EncodeMapStart(yynn1235) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1235 || yy2arr1235 { - if yyq1235[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Waiting == nil { r.EncodeNil() } else { @@ -15899,8 +19965,10 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1235[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("waiting")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Waiting == nil { r.EncodeNil() } else { @@ -15908,8 +19976,9 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1235 || yy2arr1235 { - if yyq1235[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Running == nil { r.EncodeNil() } else { @@ -15919,8 +19988,10 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1235[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("running")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Running == nil { r.EncodeNil() } else { @@ -15928,8 +19999,9 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1235 || yy2arr1235 { - if yyq1235[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Terminated == nil { r.EncodeNil() } else { @@ -15939,8 +20011,10 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1235[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("terminated")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Terminated == nil { r.EncodeNil() } else { @@ -15948,8 +20022,10 @@ func (x *ContainerState) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1235 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -15959,24 +20035,25 @@ func (x *ContainerState) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1239 := z.DecBinary() - _ = yym1239 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1240 := r.ReadMapStart() - if yyl1240 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1240, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1240 := r.ReadArrayStart() - if yyl1240 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1240, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -15988,12 +20065,12 @@ func (x *ContainerState) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1241Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1241Slc - var yyhl1241 bool = l >= 0 - for yyj1241 := 0; ; yyj1241++ { - if yyhl1241 { - if yyj1241 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -16001,9 +20078,11 @@ func (x *ContainerState) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1241Slc = r.DecodeBytes(yys1241Slc, true, true) - yys1241 := string(yys1241Slc) - switch yys1241 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "waiting": if r.TryDecodeAsNil() { if x.Waiting != nil { @@ -16038,31 +20117,30 @@ func (x *ContainerState) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Terminated.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1241) - } // end switch yys1241 - } // end for yyj1241 - if !yyhl1241 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerState) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1245 int - var yyb1245 bool - var yyhl1245 bool = l >= 0 - yyj1245++ - if yyhl1245 { - yyb1245 = yyj1245 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1245 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1245 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Waiting != nil { x.Waiting = nil @@ -16073,16 +20151,17 @@ func (x *ContainerState) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Waiting.CodecDecodeSelf(d) } - yyj1245++ - if yyhl1245 { - yyb1245 = yyj1245 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1245 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1245 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Running != nil { x.Running = nil @@ -16093,16 +20172,17 @@ func (x *ContainerState) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Running.CodecDecodeSelf(d) } - yyj1245++ - if yyhl1245 { - yyb1245 = yyj1245 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1245 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1245 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Terminated != nil { x.Terminated = nil @@ -16114,18 +20194,19 @@ func (x *ContainerState) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.Terminated.CodecDecodeSelf(d) } for { - yyj1245++ - if yyhl1245 { - yyb1245 = yyj1245 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb1245 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb1245 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj1245-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ContainerStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -16135,142 +20216,166 @@ func (x *ContainerStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1249 := z.EncBinary() - _ = yym1249 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1250 := !z.EncBinary() - yy2arr1250 := z.EncBasicHandle().StructToArray - var yyq1250 [8]bool - _, _, _ = yysep1250, yyq1250, yy2arr1250 - const yyr1250 bool = false - yyq1250[1] = true - yyq1250[2] = true - yyq1250[7] = x.ContainerID != "" - if yyr1250 || yy2arr1250 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = true + yyq2[2] = true + yyq2[7] = x.ContainerID != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - var yynn1250 int = 5 - for _, b := range yyq1250 { + yynn2 = 5 + for _, b := range yyq2 { if b { - yynn1250++ + yynn2++ } } - r.EncodeMapStart(yynn1250) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1250 || yy2arr1250 { - yym1252 := z.EncBinary() - _ = yym1252 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym1253 := z.EncBinary() - _ = yym1253 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } - if yyr1250 || yy2arr1250 { - if yyq1250[1] { - yy1255 := &x.State - yy1255.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy7 := &x.State + yy7.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1250[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("state")) - yy1256 := &x.State - yy1256.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.State + yy9.CodecEncodeSelf(e) } } - if yyr1250 || yy2arr1250 { - if yyq1250[2] { - yy1258 := &x.LastTerminationState - yy1258.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy12 := &x.LastTerminationState + yy12.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1250[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastState")) - yy1259 := &x.LastTerminationState - yy1259.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy14 := &x.LastTerminationState + yy14.CodecEncodeSelf(e) } } - if yyr1250 || yy2arr1250 { - yym1261 := z.EncBinary() - _ = yym1261 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeBool(bool(x.Ready)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ready")) - yym1262 := z.EncBinary() - _ = yym1262 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 if false { } else { r.EncodeBool(bool(x.Ready)) } } - if yyr1250 || yy2arr1250 { - yym1264 := z.EncBinary() - _ = yym1264 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeInt(int64(x.RestartCount)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("restartCount")) - yym1265 := z.EncBinary() - _ = yym1265 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym21 := z.EncBinary() + _ = yym21 if false { } else { r.EncodeInt(int64(x.RestartCount)) } } - if yyr1250 || yy2arr1250 { - yym1267 := z.EncBinary() - _ = yym1267 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Image)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("image")) - yym1268 := z.EncBinary() - _ = yym1268 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym24 := z.EncBinary() + _ = yym24 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Image)) } } - if yyr1250 || yy2arr1250 { - yym1270 := z.EncBinary() - _ = yym1270 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym26 := z.EncBinary() + _ = yym26 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ImageID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("imageID")) - yym1271 := z.EncBinary() - _ = yym1271 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym27 := z.EncBinary() + _ = yym27 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ImageID)) } } - if yyr1250 || yy2arr1250 { - if yyq1250[7] { - yym1273 := z.EncBinary() - _ = yym1273 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym29 := z.EncBinary() + _ = yym29 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerID)) @@ -16279,18 +20384,22 @@ func (x *ContainerStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1250[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerID")) - yym1274 := z.EncBinary() - _ = yym1274 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym30 := z.EncBinary() + _ = yym30 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerID)) } } } - if yysep1250 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -16300,24 +20409,25 @@ func (x *ContainerStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1275 := z.DecBinary() - _ = yym1275 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1276 := r.ReadMapStart() - if yyl1276 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1276, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1276 := r.ReadArrayStart() - if yyl1276 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1276, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -16329,12 +20439,12 @@ func (x *ContainerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1277Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1277Slc - var yyhl1277 bool = l >= 0 - for yyj1277 := 0; ; yyj1277++ { - if yyhl1277 { - if yyj1277 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -16342,9 +20452,11 @@ func (x *ContainerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1277Slc = r.DecodeBytes(yys1277Slc, true, true) - yys1277 := string(yys1277Slc) - switch yys1277 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -16355,15 +20467,15 @@ func (x *ContainerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.State = ContainerState{} } else { - yyv1279 := &x.State - yyv1279.CodecDecodeSelf(d) + yyv5 := &x.State + yyv5.CodecDecodeSelf(d) } case "lastState": if r.TryDecodeAsNil() { x.LastTerminationState = ContainerState{} } else { - yyv1280 := &x.LastTerminationState - yyv1280.CodecDecodeSelf(d) + yyv6 := &x.LastTerminationState + yyv6.CodecDecodeSelf(d) } case "ready": if r.TryDecodeAsNil() { @@ -16375,7 +20487,7 @@ func (x *ContainerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.RestartCount = 0 } else { - x.RestartCount = int(r.DecodeInt(codecSelferBitsize1234)) + x.RestartCount = int32(r.DecodeInt(32)) } case "image": if r.TryDecodeAsNil() { @@ -16396,164 +20508,171 @@ func (x *ContainerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.ContainerID = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1277) - } // end switch yys1277 - } // end for yyj1277 - if !yyhl1277 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ContainerStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1286 int - var yyb1286 bool - var yyhl1286 bool = l >= 0 - yyj1286++ - if yyhl1286 { - yyb1286 = yyj1286 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1286 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1286 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj1286++ - if yyhl1286 { - yyb1286 = yyj1286 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1286 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1286 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.State = ContainerState{} } else { - yyv1288 := &x.State - yyv1288.CodecDecodeSelf(d) + yyv14 := &x.State + yyv14.CodecDecodeSelf(d) } - yyj1286++ - if yyhl1286 { - yyb1286 = yyj1286 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1286 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1286 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTerminationState = ContainerState{} } else { - yyv1289 := &x.LastTerminationState - yyv1289.CodecDecodeSelf(d) + yyv15 := &x.LastTerminationState + yyv15.CodecDecodeSelf(d) } - yyj1286++ - if yyhl1286 { - yyb1286 = yyj1286 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1286 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1286 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ready = false } else { x.Ready = bool(r.DecodeBool()) } - yyj1286++ - if yyhl1286 { - yyb1286 = yyj1286 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1286 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1286 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RestartCount = 0 } else { - x.RestartCount = int(r.DecodeInt(codecSelferBitsize1234)) + x.RestartCount = int32(r.DecodeInt(32)) } - yyj1286++ - if yyhl1286 { - yyb1286 = yyj1286 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1286 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1286 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Image = "" } else { x.Image = string(r.DecodeString()) } - yyj1286++ - if yyhl1286 { - yyb1286 = yyj1286 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1286 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1286 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ImageID = "" } else { x.ImageID = string(r.DecodeString()) } - yyj1286++ - if yyhl1286 { - yyb1286 = yyj1286 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1286 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1286 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerID = "" } else { x.ContainerID = string(r.DecodeString()) } for { - yyj1286++ - if yyhl1286 { - yyb1286 = yyj1286 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1286 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1286 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj1286-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x PodPhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1295 := z.EncBinary() - _ = yym1295 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -16565,8 +20684,8 @@ func (x *PodPhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1296 := z.DecBinary() - _ = yym1296 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -16578,8 +20697,8 @@ func (x PodConditionType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1297 := z.EncBinary() - _ = yym1297 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -16591,8 +20710,8 @@ func (x *PodConditionType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1298 := z.DecBinary() - _ = yym1298 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -16607,115 +20726,130 @@ func (x *PodCondition) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1299 := z.EncBinary() - _ = yym1299 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1300 := !z.EncBinary() - yy2arr1300 := z.EncBasicHandle().StructToArray - var yyq1300 [6]bool - _, _, _ = yysep1300, yyq1300, yy2arr1300 - const yyr1300 bool = false - yyq1300[2] = true - yyq1300[3] = true - yyq1300[4] = x.Reason != "" - yyq1300[5] = x.Message != "" - if yyr1300 || yy2arr1300 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = true + yyq2[3] = true + yyq2[4] = x.Reason != "" + yyq2[5] = x.Message != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn1300 int = 2 - for _, b := range yyq1300 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn1300++ + yynn2++ } } - r.EncodeMapStart(yynn1300) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1300 || yy2arr1300 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr1300 || yy2arr1300 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Status.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Status.CodecEncodeSelf(e) } - if yyr1300 || yy2arr1300 { - if yyq1300[2] { - yy1304 := &x.LastProbeTime - yym1305 := z.EncBinary() - _ = yym1305 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.LastProbeTime + yym11 := z.EncBinary() + _ = yym11 if false { - } else if z.HasExtensions() && z.EncExt(yy1304) { - } else if yym1305 { - z.EncBinaryMarshal(yy1304) - } else if !yym1305 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1304) + } else if z.HasExtensions() && z.EncExt(yy10) { + } else if yym11 { + z.EncBinaryMarshal(yy10) + } else if !yym11 && z.IsJSONHandle() { + z.EncJSONMarshal(yy10) } else { - z.EncFallback(yy1304) + z.EncFallback(yy10) } } else { r.EncodeNil() } } else { - if yyq1300[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastProbeTime")) - yy1306 := &x.LastProbeTime - yym1307 := z.EncBinary() - _ = yym1307 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.LastProbeTime + yym13 := z.EncBinary() + _ = yym13 if false { - } else if z.HasExtensions() && z.EncExt(yy1306) { - } else if yym1307 { - z.EncBinaryMarshal(yy1306) - } else if !yym1307 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1306) + } else if z.HasExtensions() && z.EncExt(yy12) { + } else if yym13 { + z.EncBinaryMarshal(yy12) + } else if !yym13 && z.IsJSONHandle() { + z.EncJSONMarshal(yy12) } else { - z.EncFallback(yy1306) + z.EncFallback(yy12) } } } - if yyr1300 || yy2arr1300 { - if yyq1300[3] { - yy1309 := &x.LastTransitionTime - yym1310 := z.EncBinary() - _ = yym1310 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yy15 := &x.LastTransitionTime + yym16 := z.EncBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.EncExt(yy1309) { - } else if yym1310 { - z.EncBinaryMarshal(yy1309) - } else if !yym1310 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1309) + } else if z.HasExtensions() && z.EncExt(yy15) { + } else if yym16 { + z.EncBinaryMarshal(yy15) + } else if !yym16 && z.IsJSONHandle() { + z.EncJSONMarshal(yy15) } else { - z.EncFallback(yy1309) + z.EncFallback(yy15) } } else { r.EncodeNil() } } else { - if yyq1300[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastTransitionTime")) - yy1311 := &x.LastTransitionTime - yym1312 := z.EncBinary() - _ = yym1312 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy17 := &x.LastTransitionTime + yym18 := z.EncBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.EncExt(yy1311) { - } else if yym1312 { - z.EncBinaryMarshal(yy1311) - } else if !yym1312 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1311) + } else if z.HasExtensions() && z.EncExt(yy17) { + } else if yym18 { + z.EncBinaryMarshal(yy17) + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(yy17) } else { - z.EncFallback(yy1311) + z.EncFallback(yy17) } } } - if yyr1300 || yy2arr1300 { - if yyq1300[4] { - yym1314 := z.EncBinary() - _ = yym1314 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -16724,20 +20858,23 @@ func (x *PodCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1300[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym1315 := z.EncBinary() - _ = yym1315 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym21 := z.EncBinary() + _ = yym21 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr1300 || yy2arr1300 { - if yyq1300[5] { - yym1317 := z.EncBinary() - _ = yym1317 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -16746,18 +20883,22 @@ func (x *PodCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1300[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym1318 := z.EncBinary() - _ = yym1318 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym24 := z.EncBinary() + _ = yym24 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yysep1300 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -16767,24 +20908,25 @@ func (x *PodCondition) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1319 := z.DecBinary() - _ = yym1319 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1320 := r.ReadMapStart() - if yyl1320 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1320, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1320 := r.ReadArrayStart() - if yyl1320 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1320, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -16796,12 +20938,12 @@ func (x *PodCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1321Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1321Slc - var yyhl1321 bool = l >= 0 - for yyj1321 := 0; ; yyj1321++ { - if yyhl1321 { - if yyj1321 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -16809,9 +20951,11 @@ func (x *PodCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1321Slc = r.DecodeBytes(yys1321Slc, true, true) - yys1321 := string(yys1321Slc) - switch yys1321 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -16828,34 +20972,34 @@ func (x *PodCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.LastProbeTime = pkg2_unversioned.Time{} } else { - yyv1324 := &x.LastProbeTime - yym1325 := z.DecBinary() - _ = yym1325 + yyv6 := &x.LastProbeTime + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv1324) { - } else if yym1325 { - z.DecBinaryUnmarshal(yyv1324) - } else if !yym1325 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1324) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if yym7 { + z.DecBinaryUnmarshal(yyv6) + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv1324, false) + z.DecFallback(yyv6, false) } } case "lastTransitionTime": if r.TryDecodeAsNil() { x.LastTransitionTime = pkg2_unversioned.Time{} } else { - yyv1326 := &x.LastTransitionTime - yym1327 := z.DecBinary() - _ = yym1327 + yyv8 := &x.LastTransitionTime + yym9 := z.DecBinary() + _ = yym9 if false { - } else if z.HasExtensions() && z.DecExt(yyv1326) { - } else if yym1327 { - z.DecBinaryUnmarshal(yyv1326) - } else if !yym1327 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1326) + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else if yym9 { + z.DecBinaryUnmarshal(yyv8) + } else if !yym9 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv8) } else { - z.DecFallback(yyv1326, false) + z.DecFallback(yyv8, false) } } case "reason": @@ -16871,154 +21015,159 @@ func (x *PodCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Message = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1321) - } // end switch yys1321 - } // end for yyj1321 - if !yyhl1321 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1330 int - var yyb1330 bool - var yyhl1330 bool = l >= 0 - yyj1330++ - if yyhl1330 { - yyb1330 = yyj1330 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1330 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1330 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = PodConditionType(r.DecodeString()) } - yyj1330++ - if yyhl1330 { - yyb1330 = yyj1330 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1330 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1330 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Status = "" } else { x.Status = ConditionStatus(r.DecodeString()) } - yyj1330++ - if yyhl1330 { - yyb1330 = yyj1330 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1330 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1330 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastProbeTime = pkg2_unversioned.Time{} } else { - yyv1333 := &x.LastProbeTime - yym1334 := z.DecBinary() - _ = yym1334 + yyv15 := &x.LastProbeTime + yym16 := z.DecBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.DecExt(yyv1333) { - } else if yym1334 { - z.DecBinaryUnmarshal(yyv1333) - } else if !yym1334 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1333) + } else if z.HasExtensions() && z.DecExt(yyv15) { + } else if yym16 { + z.DecBinaryUnmarshal(yyv15) + } else if !yym16 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv15) } else { - z.DecFallback(yyv1333, false) + z.DecFallback(yyv15, false) } } - yyj1330++ - if yyhl1330 { - yyb1330 = yyj1330 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1330 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1330 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTransitionTime = pkg2_unversioned.Time{} } else { - yyv1335 := &x.LastTransitionTime - yym1336 := z.DecBinary() - _ = yym1336 + yyv17 := &x.LastTransitionTime + yym18 := z.DecBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.DecExt(yyv1335) { - } else if yym1336 { - z.DecBinaryUnmarshal(yyv1335) - } else if !yym1336 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1335) + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else if yym18 { + z.DecBinaryUnmarshal(yyv17) + } else if !yym18 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv17) } else { - z.DecFallback(yyv1335, false) + z.DecFallback(yyv17, false) } } - yyj1330++ - if yyhl1330 { - yyb1330 = yyj1330 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1330 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1330 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj1330++ - if yyhl1330 { - yyb1330 = yyj1330 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1330 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1330 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } for { - yyj1330++ - if yyhl1330 { - yyb1330 = yyj1330 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb1330 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb1330 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj1330-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x RestartPolicy) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1339 := z.EncBinary() - _ = yym1339 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -17030,8 +21179,8 @@ func (x *RestartPolicy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1340 := z.DecBinary() - _ = yym1340 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -17043,8 +21192,8 @@ func (x DNSPolicy) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1341 := z.EncBinary() - _ = yym1341 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -17056,8 +21205,8 @@ func (x *DNSPolicy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1342 := z.DecBinary() - _ = yym1342 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -17065,6 +21214,1276 @@ func (x *DNSPolicy) CodecDecodeSelf(d *codec1978.Decoder) { } } +func (x *NodeSelector) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.NodeSelectorTerms == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceNodeSelectorTerm(([]NodeSelectorTerm)(x.NodeSelectorTerms), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeSelectorTerms")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NodeSelectorTerms == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceNodeSelectorTerm(([]NodeSelectorTerm)(x.NodeSelectorTerms), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NodeSelector) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NodeSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "nodeSelectorTerms": + if r.TryDecodeAsNil() { + x.NodeSelectorTerms = nil + } else { + yyv4 := &x.NodeSelectorTerms + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceNodeSelectorTerm((*[]NodeSelectorTerm)(yyv4), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NodeSelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NodeSelectorTerms = nil + } else { + yyv7 := &x.NodeSelectorTerms + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceNodeSelectorTerm((*[]NodeSelectorTerm)(yyv7), d) + } + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *NodeSelectorTerm) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.MatchExpressions == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceNodeSelectorRequirement(([]NodeSelectorRequirement)(x.MatchExpressions), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("matchExpressions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.MatchExpressions == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceNodeSelectorRequirement(([]NodeSelectorRequirement)(x.MatchExpressions), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NodeSelectorTerm) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NodeSelectorTerm) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "matchExpressions": + if r.TryDecodeAsNil() { + x.MatchExpressions = nil + } else { + yyv4 := &x.MatchExpressions + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceNodeSelectorRequirement((*[]NodeSelectorRequirement)(yyv4), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NodeSelectorTerm) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MatchExpressions = nil + } else { + yyv7 := &x.MatchExpressions + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceNodeSelectorRequirement((*[]NodeSelectorRequirement)(yyv7), d) + } + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *NodeSelectorRequirement) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = len(x.Values) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("key")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + x.Operator.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("operator")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + x.Operator.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.Values == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + z.F.EncSliceStringV(x.Values, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("values")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Values == nil { + r.EncodeNil() + } else { + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + z.F.EncSliceStringV(x.Values, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NodeSelectorRequirement) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NodeSelectorRequirement) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + case "operator": + if r.TryDecodeAsNil() { + x.Operator = "" + } else { + x.Operator = NodeSelectorOperator(r.DecodeString()) + } + case "values": + if r.TryDecodeAsNil() { + x.Values = nil + } else { + yyv6 := &x.Values + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + z.F.DecSliceStringX(yyv6, false, d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NodeSelectorRequirement) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Operator = "" + } else { + x.Operator = NodeSelectorOperator(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Values = nil + } else { + yyv11 := &x.Values + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + z.F.DecSliceStringX(yyv11, false, d) + } + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x NodeSelectorOperator) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x)) + } +} + +func (x *NodeSelectorOperator) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() + } +} + +func (x *Affinity) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.NodeAffinity != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.NodeAffinity == nil { + r.EncodeNil() + } else { + x.NodeAffinity.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeAffinity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NodeAffinity == nil { + r.EncodeNil() + } else { + x.NodeAffinity.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *Affinity) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *Affinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "nodeAffinity": + if r.TryDecodeAsNil() { + if x.NodeAffinity != nil { + x.NodeAffinity = nil + } + } else { + if x.NodeAffinity == nil { + x.NodeAffinity = new(NodeAffinity) + } + x.NodeAffinity.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *Affinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l + } else { + yyb5 = r.CheckBreak() + } + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.NodeAffinity != nil { + x.NodeAffinity = nil + } + } else { + if x.NodeAffinity == nil { + x.NodeAffinity = new(NodeAffinity) + } + x.NodeAffinity.CodecDecodeSelf(d) + } + for { + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l + } else { + yyb5 = r.CheckBreak() + } + if yyb5 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *NodeAffinity) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.RequiredDuringSchedulingIgnoredDuringExecution != nil + yyq2[1] = len(x.PreferredDuringSchedulingIgnoredDuringExecution) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { + r.EncodeNil() + } else { + x.RequiredDuringSchedulingIgnoredDuringExecution.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("requiredDuringSchedulingIgnoredDuringExecution")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { + r.EncodeNil() + } else { + x.RequiredDuringSchedulingIgnoredDuringExecution.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("preferredDuringSchedulingIgnoredDuringExecution")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.PreferredDuringSchedulingIgnoredDuringExecution == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + h.encSlicePreferredSchedulingTerm(([]PreferredSchedulingTerm)(x.PreferredDuringSchedulingIgnoredDuringExecution), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NodeAffinity) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NodeAffinity) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "requiredDuringSchedulingIgnoredDuringExecution": + if r.TryDecodeAsNil() { + if x.RequiredDuringSchedulingIgnoredDuringExecution != nil { + x.RequiredDuringSchedulingIgnoredDuringExecution = nil + } + } else { + if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { + x.RequiredDuringSchedulingIgnoredDuringExecution = new(NodeSelector) + } + x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d) + } + case "preferredDuringSchedulingIgnoredDuringExecution": + if r.TryDecodeAsNil() { + x.PreferredDuringSchedulingIgnoredDuringExecution = nil + } else { + yyv5 := &x.PreferredDuringSchedulingIgnoredDuringExecution + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv5), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NodeAffinity) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.RequiredDuringSchedulingIgnoredDuringExecution != nil { + x.RequiredDuringSchedulingIgnoredDuringExecution = nil + } + } else { + if x.RequiredDuringSchedulingIgnoredDuringExecution == nil { + x.RequiredDuringSchedulingIgnoredDuringExecution = new(NodeSelector) + } + x.RequiredDuringSchedulingIgnoredDuringExecution.CodecDecodeSelf(d) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PreferredDuringSchedulingIgnoredDuringExecution = nil + } else { + yyv9 := &x.PreferredDuringSchedulingIgnoredDuringExecution + yym10 := z.DecBinary() + _ = yym10 + if false { + } else { + h.decSlicePreferredSchedulingTerm((*[]PreferredSchedulingTerm)(yyv9), d) + } + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PreferredSchedulingTerm) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Weight)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("weight")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Weight)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.Preference + yy7.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("preference")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Preference + yy9.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PreferredSchedulingTerm) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PreferredSchedulingTerm) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "weight": + if r.TryDecodeAsNil() { + x.Weight = 0 + } else { + x.Weight = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "preference": + if r.TryDecodeAsNil() { + x.Preference = NodeSelectorTerm{} + } else { + yyv5 := &x.Preference + yyv5.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PreferredSchedulingTerm) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Weight = 0 + } else { + x.Weight = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Preference = NodeSelectorTerm{} + } else { + yyv8 := &x.Preference + yyv8.CodecDecodeSelf(d) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) @@ -17072,48 +22491,51 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1343 := z.EncBinary() - _ = yym1343 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1344 := !z.EncBinary() - yy2arr1344 := z.EncBasicHandle().StructToArray - var yyq1344 [15]bool - _, _, _ = yysep1344, yyq1344, yy2arr1344 - const yyr1344 bool = false - yyq1344[0] = len(x.Volumes) != 0 - yyq1344[2] = x.RestartPolicy != "" - yyq1344[3] = x.TerminationGracePeriodSeconds != nil - yyq1344[4] = x.ActiveDeadlineSeconds != nil - yyq1344[5] = x.DNSPolicy != "" - yyq1344[6] = len(x.NodeSelector) != 0 - yyq1344[7] = x.ServiceAccountName != "" - yyq1344[8] = x.DeprecatedServiceAccount != "" - yyq1344[9] = x.NodeName != "" - yyq1344[10] = x.HostNetwork != false - yyq1344[11] = x.HostPID != false - yyq1344[12] = x.HostIPC != false - yyq1344[13] = x.SecurityContext != nil - yyq1344[14] = len(x.ImagePullSecrets) != 0 - if yyr1344 || yy2arr1344 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [15]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Volumes) != 0 + yyq2[2] = x.RestartPolicy != "" + yyq2[3] = x.TerminationGracePeriodSeconds != nil + yyq2[4] = x.ActiveDeadlineSeconds != nil + yyq2[5] = x.DNSPolicy != "" + yyq2[6] = len(x.NodeSelector) != 0 + yyq2[7] = x.ServiceAccountName != "" + yyq2[8] = x.DeprecatedServiceAccount != "" + yyq2[9] = x.NodeName != "" + yyq2[10] = x.HostNetwork != false + yyq2[11] = x.HostPID != false + yyq2[12] = x.HostIPC != false + yyq2[13] = x.SecurityContext != nil + yyq2[14] = len(x.ImagePullSecrets) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(15) } else { - var yynn1344 int = 1 - for _, b := range yyq1344 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1344++ + yynn2++ } } - r.EncodeMapStart(yynn1344) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1344 || yy2arr1344 { - if yyq1344[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Volumes == nil { r.EncodeNil() } else { - yym1346 := z.EncBinary() - _ = yym1346 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceVolume(([]Volume)(x.Volumes), e) @@ -17123,13 +22545,15 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1344[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("volumes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Volumes == nil { r.EncodeNil() } else { - yym1347 := z.EncBinary() - _ = yym1347 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceVolume(([]Volume)(x.Volumes), e) @@ -17137,125 +22561,141 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1344 || yy2arr1344 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Containers == nil { r.EncodeNil() } else { - yym1349 := z.EncBinary() - _ = yym1349 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSliceContainer(([]Container)(x.Containers), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containers")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Containers == nil { r.EncodeNil() } else { - yym1350 := z.EncBinary() - _ = yym1350 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSliceContainer(([]Container)(x.Containers), e) } } } - if yyr1344 || yy2arr1344 { - if yyq1344[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { x.RestartPolicy.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1344[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("restartPolicy")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.RestartPolicy.CodecEncodeSelf(e) } } - if yyr1344 || yy2arr1344 { - if yyq1344[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.TerminationGracePeriodSeconds == nil { r.EncodeNil() } else { - yy1353 := *x.TerminationGracePeriodSeconds - yym1354 := z.EncBinary() - _ = yym1354 + yy13 := *x.TerminationGracePeriodSeconds + yym14 := z.EncBinary() + _ = yym14 if false { } else { - r.EncodeInt(int64(yy1353)) + r.EncodeInt(int64(yy13)) } } } else { r.EncodeNil() } } else { - if yyq1344[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("terminationGracePeriodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TerminationGracePeriodSeconds == nil { r.EncodeNil() } else { - yy1355 := *x.TerminationGracePeriodSeconds - yym1356 := z.EncBinary() - _ = yym1356 + yy15 := *x.TerminationGracePeriodSeconds + yym16 := z.EncBinary() + _ = yym16 if false { } else { - r.EncodeInt(int64(yy1355)) + r.EncodeInt(int64(yy15)) } } } } - if yyr1344 || yy2arr1344 { - if yyq1344[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.ActiveDeadlineSeconds == nil { r.EncodeNil() } else { - yy1358 := *x.ActiveDeadlineSeconds - yym1359 := z.EncBinary() - _ = yym1359 + yy18 := *x.ActiveDeadlineSeconds + yym19 := z.EncBinary() + _ = yym19 if false { } else { - r.EncodeInt(int64(yy1358)) + r.EncodeInt(int64(yy18)) } } } else { r.EncodeNil() } } else { - if yyq1344[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("activeDeadlineSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ActiveDeadlineSeconds == nil { r.EncodeNil() } else { - yy1360 := *x.ActiveDeadlineSeconds - yym1361 := z.EncBinary() - _ = yym1361 + yy20 := *x.ActiveDeadlineSeconds + yym21 := z.EncBinary() + _ = yym21 if false { } else { - r.EncodeInt(int64(yy1360)) + r.EncodeInt(int64(yy20)) } } } } - if yyr1344 || yy2arr1344 { - if yyq1344[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { x.DNSPolicy.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1344[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("dnsPolicy")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.DNSPolicy.CodecEncodeSelf(e) } } - if yyr1344 || yy2arr1344 { - if yyq1344[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.NodeSelector == nil { r.EncodeNil() } else { - yym1364 := z.EncBinary() - _ = yym1364 + yym26 := z.EncBinary() + _ = yym26 if false { } else { z.F.EncMapStringStringV(x.NodeSelector, false, e) @@ -17265,13 +22705,15 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1344[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nodeSelector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.NodeSelector == nil { r.EncodeNil() } else { - yym1365 := z.EncBinary() - _ = yym1365 + yym27 := z.EncBinary() + _ = yym27 if false { } else { z.F.EncMapStringStringV(x.NodeSelector, false, e) @@ -17279,10 +22721,11 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1344 || yy2arr1344 { - if yyq1344[7] { - yym1367 := z.EncBinary() - _ = yym1367 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym29 := z.EncBinary() + _ = yym29 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ServiceAccountName)) @@ -17291,20 +22734,23 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1344[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("serviceAccountName")) - yym1368 := z.EncBinary() - _ = yym1368 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym30 := z.EncBinary() + _ = yym30 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ServiceAccountName)) } } } - if yyr1344 || yy2arr1344 { - if yyq1344[8] { - yym1370 := z.EncBinary() - _ = yym1370 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + yym32 := z.EncBinary() + _ = yym32 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.DeprecatedServiceAccount)) @@ -17313,20 +22759,23 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1344[8] { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("serviceAccount")) - yym1371 := z.EncBinary() - _ = yym1371 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym33 := z.EncBinary() + _ = yym33 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.DeprecatedServiceAccount)) } } } - if yyr1344 || yy2arr1344 { - if yyq1344[9] { - yym1373 := z.EncBinary() - _ = yym1373 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { + yym35 := z.EncBinary() + _ = yym35 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.NodeName)) @@ -17335,20 +22784,23 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1344[9] { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nodeName")) - yym1374 := z.EncBinary() - _ = yym1374 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym36 := z.EncBinary() + _ = yym36 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.NodeName)) } } } - if yyr1344 || yy2arr1344 { - if yyq1344[10] { - yym1376 := z.EncBinary() - _ = yym1376 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { + yym38 := z.EncBinary() + _ = yym38 if false { } else { r.EncodeBool(bool(x.HostNetwork)) @@ -17357,20 +22809,23 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1344[10] { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostNetwork")) - yym1377 := z.EncBinary() - _ = yym1377 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym39 := z.EncBinary() + _ = yym39 if false { } else { r.EncodeBool(bool(x.HostNetwork)) } } } - if yyr1344 || yy2arr1344 { - if yyq1344[11] { - yym1379 := z.EncBinary() - _ = yym1379 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[11] { + yym41 := z.EncBinary() + _ = yym41 if false { } else { r.EncodeBool(bool(x.HostPID)) @@ -17379,20 +22834,23 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1344[11] { + if yyq2[11] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostPID")) - yym1380 := z.EncBinary() - _ = yym1380 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym42 := z.EncBinary() + _ = yym42 if false { } else { r.EncodeBool(bool(x.HostPID)) } } } - if yyr1344 || yy2arr1344 { - if yyq1344[12] { - yym1382 := z.EncBinary() - _ = yym1382 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[12] { + yym44 := z.EncBinary() + _ = yym44 if false { } else { r.EncodeBool(bool(x.HostIPC)) @@ -17401,18 +22859,21 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq1344[12] { + if yyq2[12] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostIPC")) - yym1383 := z.EncBinary() - _ = yym1383 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym45 := z.EncBinary() + _ = yym45 if false { } else { r.EncodeBool(bool(x.HostIPC)) } } } - if yyr1344 || yy2arr1344 { - if yyq1344[13] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[13] { if x.SecurityContext == nil { r.EncodeNil() } else { @@ -17422,8 +22883,10 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1344[13] { + if yyq2[13] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("securityContext")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SecurityContext == nil { r.EncodeNil() } else { @@ -17431,13 +22894,14 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1344 || yy2arr1344 { - if yyq1344[14] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[14] { if x.ImagePullSecrets == nil { r.EncodeNil() } else { - yym1386 := z.EncBinary() - _ = yym1386 + yym50 := z.EncBinary() + _ = yym50 if false { } else { h.encSliceLocalObjectReference(([]LocalObjectReference)(x.ImagePullSecrets), e) @@ -17447,13 +22911,15 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1344[14] { + if yyq2[14] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("imagePullSecrets")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ImagePullSecrets == nil { r.EncodeNil() } else { - yym1387 := z.EncBinary() - _ = yym1387 + yym51 := z.EncBinary() + _ = yym51 if false { } else { h.encSliceLocalObjectReference(([]LocalObjectReference)(x.ImagePullSecrets), e) @@ -17461,8 +22927,10 @@ func (x *PodSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1344 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -17472,24 +22940,25 @@ func (x *PodSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1388 := z.DecBinary() - _ = yym1388 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1389 := r.ReadMapStart() - if yyl1389 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1389, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1389 := r.ReadArrayStart() - if yyl1389 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1389, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -17501,12 +22970,12 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1390Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1390Slc - var yyhl1390 bool = l >= 0 - for yyj1390 := 0; ; yyj1390++ { - if yyhl1390 { - if yyj1390 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -17514,31 +22983,33 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1390Slc = r.DecodeBytes(yys1390Slc, true, true) - yys1390 := string(yys1390Slc) - switch yys1390 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "volumes": if r.TryDecodeAsNil() { x.Volumes = nil } else { - yyv1391 := &x.Volumes - yym1392 := z.DecBinary() - _ = yym1392 + yyv4 := &x.Volumes + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceVolume((*[]Volume)(yyv1391), d) + h.decSliceVolume((*[]Volume)(yyv4), d) } } case "containers": if r.TryDecodeAsNil() { x.Containers = nil } else { - yyv1393 := &x.Containers - yym1394 := z.DecBinary() - _ = yym1394 + yyv6 := &x.Containers + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceContainer((*[]Container)(yyv1393), d) + h.decSliceContainer((*[]Container)(yyv6), d) } } case "restartPolicy": @@ -17556,8 +23027,8 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.TerminationGracePeriodSeconds == nil { x.TerminationGracePeriodSeconds = new(int64) } - yym1397 := z.DecBinary() - _ = yym1397 + yym10 := z.DecBinary() + _ = yym10 if false { } else { *((*int64)(x.TerminationGracePeriodSeconds)) = int64(r.DecodeInt(64)) @@ -17572,8 +23043,8 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.ActiveDeadlineSeconds == nil { x.ActiveDeadlineSeconds = new(int64) } - yym1399 := z.DecBinary() - _ = yym1399 + yym12 := z.DecBinary() + _ = yym12 if false { } else { *((*int64)(x.ActiveDeadlineSeconds)) = int64(r.DecodeInt(64)) @@ -17589,12 +23060,12 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.NodeSelector = nil } else { - yyv1401 := &x.NodeSelector - yym1402 := z.DecBinary() - _ = yym1402 + yyv14 := &x.NodeSelector + yym15 := z.DecBinary() + _ = yym15 if false { } else { - z.F.DecMapStringStringX(yyv1401, false, d) + z.F.DecMapStringStringX(yyv14, false, d) } } case "serviceAccountName": @@ -17648,97 +23119,99 @@ func (x *PodSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.ImagePullSecrets = nil } else { - yyv1410 := &x.ImagePullSecrets - yym1411 := z.DecBinary() - _ = yym1411 + yyv23 := &x.ImagePullSecrets + yym24 := z.DecBinary() + _ = yym24 if false { } else { - h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv1410), d) + h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv23), d) } } default: - z.DecStructFieldNotFound(-1, yys1390) - } // end switch yys1390 - } // end for yyj1390 - if !yyhl1390 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1412 int - var yyb1412 bool - var yyhl1412 bool = l >= 0 - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + var yyj25 int + var yyb25 bool + var yyhl25 bool = l >= 0 + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Volumes = nil } else { - yyv1413 := &x.Volumes - yym1414 := z.DecBinary() - _ = yym1414 + yyv26 := &x.Volumes + yym27 := z.DecBinary() + _ = yym27 if false { } else { - h.decSliceVolume((*[]Volume)(yyv1413), d) + h.decSliceVolume((*[]Volume)(yyv26), d) } } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Containers = nil } else { - yyv1415 := &x.Containers - yym1416 := z.DecBinary() - _ = yym1416 + yyv28 := &x.Containers + yym29 := z.DecBinary() + _ = yym29 if false { } else { - h.decSliceContainer((*[]Container)(yyv1415), d) + h.decSliceContainer((*[]Container)(yyv28), d) } } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.RestartPolicy = "" } else { x.RestartPolicy = RestartPolicy(r.DecodeString()) } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.TerminationGracePeriodSeconds != nil { x.TerminationGracePeriodSeconds = nil @@ -17747,23 +23220,24 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.TerminationGracePeriodSeconds == nil { x.TerminationGracePeriodSeconds = new(int64) } - yym1419 := z.DecBinary() - _ = yym1419 + yym32 := z.DecBinary() + _ = yym32 if false { } else { *((*int64)(x.TerminationGracePeriodSeconds)) = int64(r.DecodeInt(64)) } } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ActiveDeadlineSeconds != nil { x.ActiveDeadlineSeconds = nil @@ -17772,149 +23246,158 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.ActiveDeadlineSeconds == nil { x.ActiveDeadlineSeconds = new(int64) } - yym1421 := z.DecBinary() - _ = yym1421 + yym34 := z.DecBinary() + _ = yym34 if false { } else { *((*int64)(x.ActiveDeadlineSeconds)) = int64(r.DecodeInt(64)) } } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DNSPolicy = "" } else { x.DNSPolicy = DNSPolicy(r.DecodeString()) } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NodeSelector = nil } else { - yyv1423 := &x.NodeSelector - yym1424 := z.DecBinary() - _ = yym1424 + yyv36 := &x.NodeSelector + yym37 := z.DecBinary() + _ = yym37 if false { } else { - z.F.DecMapStringStringX(yyv1423, false, d) + z.F.DecMapStringStringX(yyv36, false, d) } } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ServiceAccountName = "" } else { x.ServiceAccountName = string(r.DecodeString()) } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DeprecatedServiceAccount = "" } else { x.DeprecatedServiceAccount = string(r.DecodeString()) } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NodeName = "" } else { x.NodeName = string(r.DecodeString()) } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostNetwork = false } else { x.HostNetwork = bool(r.DecodeBool()) } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostPID = false } else { x.HostPID = bool(r.DecodeBool()) } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostIPC = false } else { x.HostIPC = bool(r.DecodeBool()) } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SecurityContext != nil { x.SecurityContext = nil @@ -17925,40 +23408,42 @@ func (x *PodSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.SecurityContext.CodecDecodeSelf(d) } - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { - r.ReadEnd() + if yyb25 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ImagePullSecrets = nil } else { - yyv1432 := &x.ImagePullSecrets - yym1433 := z.DecBinary() - _ = yym1433 + yyv45 := &x.ImagePullSecrets + yym46 := z.DecBinary() + _ = yym46 if false { } else { - h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv1432), d) + h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv45), d) } } for { - yyj1412++ - if yyhl1412 { - yyb1412 = yyj1412 > l + yyj25++ + if yyhl25 { + yyb25 = yyj25 > l } else { - yyb1412 = r.CheckBreak() + yyb25 = r.CheckBreak() } - if yyb1412 { + if yyb25 { break } - z.DecStructFieldNotFound(yyj1412-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj25-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { @@ -17968,63 +23453,37 @@ func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1434 := z.EncBinary() - _ = yym1434 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1435 := !z.EncBinary() - yy2arr1435 := z.EncBasicHandle().StructToArray - var yyq1435 [4]bool - _, _, _ = yysep1435, yyq1435, yy2arr1435 - const yyr1435 bool = false - yyq1435[0] = len(x.SupplementalGroups) != 0 - yyq1435[1] = x.SELinuxOptions != nil - yyq1435[2] = x.RunAsUser != nil - yyq1435[3] = x.RunAsNonRoot != nil - if yyr1435 || yy2arr1435 { - r.EncodeArrayStart(4) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.SELinuxOptions != nil + yyq2[1] = x.RunAsUser != nil + yyq2[2] = x.RunAsNonRoot != nil + yyq2[3] = len(x.SupplementalGroups) != 0 + yyq2[4] = x.FSGroup != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) } else { - var yynn1435 int = 0 - for _, b := range yyq1435 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1435++ + yynn2++ } } - r.EncodeMapStart(yynn1435) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1435 || yy2arr1435 { - if yyq1435[0] { - if x.SupplementalGroups == nil { - r.EncodeNil() - } else { - yym1437 := z.EncBinary() - _ = yym1437 - if false { - } else { - z.F.EncSliceInt64V(x.SupplementalGroups, false, e) - } - } - } else { - r.EncodeNil() - } - } else { - if yyq1435[0] { - r.EncodeString(codecSelferC_UTF81234, string("supplementalGroups")) - if x.SupplementalGroups == nil { - r.EncodeNil() - } else { - yym1438 := z.EncBinary() - _ = yym1438 - if false { - } else { - z.F.EncSliceInt64V(x.SupplementalGroups, false, e) - } - } - } - } - if yyr1435 || yy2arr1435 { - if yyq1435[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.SELinuxOptions == nil { r.EncodeNil() } else { @@ -18034,8 +23493,10 @@ func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1435[1] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("seLinuxOptions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SELinuxOptions == nil { r.EncodeNil() } else { @@ -18043,72 +23504,148 @@ func (x *PodSecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1435 || yy2arr1435 { - if yyq1435[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.RunAsUser == nil { r.EncodeNil() } else { - yy1441 := *x.RunAsUser - yym1442 := z.EncBinary() - _ = yym1442 + yy7 := *x.RunAsUser + yym8 := z.EncBinary() + _ = yym8 if false { } else { - r.EncodeInt(int64(yy1441)) + r.EncodeInt(int64(yy7)) } } } else { r.EncodeNil() } } else { - if yyq1435[2] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("runAsUser")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RunAsUser == nil { r.EncodeNil() } else { - yy1443 := *x.RunAsUser - yym1444 := z.EncBinary() - _ = yym1444 + yy9 := *x.RunAsUser + yym10 := z.EncBinary() + _ = yym10 if false { } else { - r.EncodeInt(int64(yy1443)) + r.EncodeInt(int64(yy9)) } } } } - if yyr1435 || yy2arr1435 { - if yyq1435[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.RunAsNonRoot == nil { r.EncodeNil() } else { - yy1446 := *x.RunAsNonRoot - yym1447 := z.EncBinary() - _ = yym1447 + yy12 := *x.RunAsNonRoot + yym13 := z.EncBinary() + _ = yym13 if false { } else { - r.EncodeBool(bool(yy1446)) + r.EncodeBool(bool(yy12)) } } } else { r.EncodeNil() } } else { - if yyq1435[3] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("runAsNonRoot")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RunAsNonRoot == nil { r.EncodeNil() } else { - yy1448 := *x.RunAsNonRoot - yym1449 := z.EncBinary() - _ = yym1449 + yy14 := *x.RunAsNonRoot + yym15 := z.EncBinary() + _ = yym15 if false { } else { - r.EncodeBool(bool(yy1448)) + r.EncodeBool(bool(yy14)) } } } } - if yysep1435 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + if x.SupplementalGroups == nil { + r.EncodeNil() + } else { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + z.F.EncSliceInt64V(x.SupplementalGroups, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("supplementalGroups")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SupplementalGroups == nil { + r.EncodeNil() + } else { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + z.F.EncSliceInt64V(x.SupplementalGroups, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.FSGroup == nil { + r.EncodeNil() + } else { + yy20 := *x.FSGroup + yym21 := z.EncBinary() + _ = yym21 + if false { + } else { + r.EncodeInt(int64(yy20)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fsGroup")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.FSGroup == nil { + r.EncodeNil() + } else { + yy22 := *x.FSGroup + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeInt(int64(yy22)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -18118,24 +23655,25 @@ func (x *PodSecurityContext) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1450 := z.DecBinary() - _ = yym1450 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1451 := r.ReadMapStart() - if yyl1451 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1451, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1451 := r.ReadArrayStart() - if yyl1451 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1451, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -18147,12 +23685,12 @@ func (x *PodSecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1452Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1452Slc - var yyhl1452 bool = l >= 0 - for yyj1452 := 0; ; yyj1452++ { - if yyhl1452 { - if yyj1452 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -18160,21 +23698,11 @@ func (x *PodSecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys1452Slc = r.DecodeBytes(yys1452Slc, true, true) - yys1452 := string(yys1452Slc) - switch yys1452 { - case "supplementalGroups": - if r.TryDecodeAsNil() { - x.SupplementalGroups = nil - } else { - yyv1453 := &x.SupplementalGroups - yym1454 := z.DecBinary() - _ = yym1454 - if false { - } else { - z.F.DecSliceInt64X(yyv1453, false, d) - } - } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "seLinuxOptions": if r.TryDecodeAsNil() { if x.SELinuxOptions != nil { @@ -18195,8 +23723,8 @@ func (x *PodSecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) if x.RunAsUser == nil { x.RunAsUser = new(int64) } - yym1457 := z.DecBinary() - _ = yym1457 + yym6 := z.DecBinary() + _ = yym6 if false { } else { *((*int64)(x.RunAsUser)) = int64(r.DecodeInt(64)) @@ -18211,60 +23739,66 @@ func (x *PodSecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) if x.RunAsNonRoot == nil { x.RunAsNonRoot = new(bool) } - yym1459 := z.DecBinary() - _ = yym1459 + yym8 := z.DecBinary() + _ = yym8 if false { } else { *((*bool)(x.RunAsNonRoot)) = r.DecodeBool() } } + case "supplementalGroups": + if r.TryDecodeAsNil() { + x.SupplementalGroups = nil + } else { + yyv9 := &x.SupplementalGroups + yym10 := z.DecBinary() + _ = yym10 + if false { + } else { + z.F.DecSliceInt64X(yyv9, false, d) + } + } + case "fsGroup": + if r.TryDecodeAsNil() { + if x.FSGroup != nil { + x.FSGroup = nil + } + } else { + if x.FSGroup == nil { + x.FSGroup = new(int64) + } + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + *((*int64)(x.FSGroup)) = int64(r.DecodeInt(64)) + } + } default: - z.DecStructFieldNotFound(-1, yys1452) - } // end switch yys1452 - } // end for yyj1452 - if !yyhl1452 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodSecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1460 int - var yyb1460 bool - var yyhl1460 bool = l >= 0 - yyj1460++ - if yyhl1460 { - yyb1460 = yyj1460 > l + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1460 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1460 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.SupplementalGroups = nil - } else { - yyv1461 := &x.SupplementalGroups - yym1462 := z.DecBinary() - _ = yym1462 - if false { - } else { - z.F.DecSliceInt64X(yyv1461, false, d) - } - } - yyj1460++ - if yyhl1460 { - yyb1460 = yyj1460 > l - } else { - yyb1460 = r.CheckBreak() - } - if yyb1460 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SELinuxOptions != nil { x.SELinuxOptions = nil @@ -18275,16 +23809,17 @@ func (x *PodSecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decode } x.SELinuxOptions.CodecDecodeSelf(d) } - yyj1460++ - if yyhl1460 { - yyb1460 = yyj1460 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1460 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1460 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RunAsUser != nil { x.RunAsUser = nil @@ -18293,23 +23828,24 @@ func (x *PodSecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decode if x.RunAsUser == nil { x.RunAsUser = new(int64) } - yym1465 := z.DecBinary() - _ = yym1465 + yym16 := z.DecBinary() + _ = yym16 if false { } else { *((*int64)(x.RunAsUser)) = int64(r.DecodeInt(64)) } } - yyj1460++ - if yyhl1460 { - yyb1460 = yyj1460 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb1460 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb1460 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RunAsNonRoot != nil { x.RunAsNonRoot = nil @@ -18318,26 +23854,75 @@ func (x *PodSecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decode if x.RunAsNonRoot == nil { x.RunAsNonRoot = new(bool) } - yym1467 := z.DecBinary() - _ = yym1467 + yym18 := z.DecBinary() + _ = yym18 if false { } else { *((*bool)(x.RunAsNonRoot)) = r.DecodeBool() } } - for { - yyj1460++ - if yyhl1460 { - yyb1460 = yyj1460 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SupplementalGroups = nil + } else { + yyv19 := &x.SupplementalGroups + yym20 := z.DecBinary() + _ = yym20 + if false { } else { - yyb1460 = r.CheckBreak() + z.F.DecSliceInt64X(yyv19, false, d) } - if yyb1460 { + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.FSGroup != nil { + x.FSGroup = nil + } + } else { + if x.FSGroup == nil { + x.FSGroup = new(int64) + } + yym22 := z.DecBinary() + _ = yym22 + if false { + } else { + *((*int64)(x.FSGroup)) = int64(r.DecodeInt(64)) + } + } + for { + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { break } - z.DecStructFieldNotFound(yyj1460-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -18347,54 +23932,60 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1468 := z.EncBinary() - _ = yym1468 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1469 := !z.EncBinary() - yy2arr1469 := z.EncBasicHandle().StructToArray - var yyq1469 [8]bool - _, _, _ = yysep1469, yyq1469, yy2arr1469 - const yyr1469 bool = false - yyq1469[0] = x.Phase != "" - yyq1469[1] = len(x.Conditions) != 0 - yyq1469[2] = x.Message != "" - yyq1469[3] = x.Reason != "" - yyq1469[4] = x.HostIP != "" - yyq1469[5] = x.PodIP != "" - yyq1469[6] = x.StartTime != nil - yyq1469[7] = len(x.ContainerStatuses) != 0 - if yyr1469 || yy2arr1469 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Phase != "" + yyq2[1] = len(x.Conditions) != 0 + yyq2[2] = x.Message != "" + yyq2[3] = x.Reason != "" + yyq2[4] = x.HostIP != "" + yyq2[5] = x.PodIP != "" + yyq2[6] = x.StartTime != nil + yyq2[7] = len(x.ContainerStatuses) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - var yynn1469 int = 0 - for _, b := range yyq1469 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1469++ + yynn2++ } } - r.EncodeMapStart(yynn1469) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1469 || yy2arr1469 { - if yyq1469[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1469[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yyr1469 || yy2arr1469 { - if yyq1469[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Conditions == nil { r.EncodeNil() } else { - yym1472 := z.EncBinary() - _ = yym1472 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSlicePodCondition(([]PodCondition)(x.Conditions), e) @@ -18404,13 +23995,15 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1469[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("conditions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Conditions == nil { r.EncodeNil() } else { - yym1473 := z.EncBinary() - _ = yym1473 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSlicePodCondition(([]PodCondition)(x.Conditions), e) @@ -18418,10 +24011,11 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1469 || yy2arr1469 { - if yyq1469[2] { - yym1475 := z.EncBinary() - _ = yym1475 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -18430,20 +24024,23 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1469[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym1476 := z.EncBinary() - _ = yym1476 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr1469 || yy2arr1469 { - if yyq1469[3] { - yym1478 := z.EncBinary() - _ = yym1478 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -18452,20 +24049,23 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1469[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym1479 := z.EncBinary() - _ = yym1479 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr1469 || yy2arr1469 { - if yyq1469[4] { - yym1481 := z.EncBinary() - _ = yym1481 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.HostIP)) @@ -18474,20 +24074,23 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1469[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostIP")) - yym1482 := z.EncBinary() - _ = yym1482 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.HostIP)) } } } - if yyr1469 || yy2arr1469 { - if yyq1469[5] { - yym1484 := z.EncBinary() - _ = yym1484 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PodIP)) @@ -18496,28 +24099,31 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1469[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("podIP")) - yym1485 := z.EncBinary() - _ = yym1485 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PodIP)) } } } - if yyr1469 || yy2arr1469 { - if yyq1469[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { if x.StartTime == nil { r.EncodeNil() } else { - yym1487 := z.EncBinary() - _ = yym1487 + yym22 := z.EncBinary() + _ = yym22 if false { } else if z.HasExtensions() && z.EncExt(x.StartTime) { - } else if yym1487 { + } else if yym22 { z.EncBinaryMarshal(x.StartTime) - } else if !yym1487 && z.IsJSONHandle() { + } else if !yym22 && z.IsJSONHandle() { z.EncJSONMarshal(x.StartTime) } else { z.EncFallback(x.StartTime) @@ -18527,18 +24133,20 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1469[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("startTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.StartTime == nil { r.EncodeNil() } else { - yym1488 := z.EncBinary() - _ = yym1488 + yym23 := z.EncBinary() + _ = yym23 if false { } else if z.HasExtensions() && z.EncExt(x.StartTime) { - } else if yym1488 { + } else if yym23 { z.EncBinaryMarshal(x.StartTime) - } else if !yym1488 && z.IsJSONHandle() { + } else if !yym23 && z.IsJSONHandle() { z.EncJSONMarshal(x.StartTime) } else { z.EncFallback(x.StartTime) @@ -18546,13 +24154,14 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1469 || yy2arr1469 { - if yyq1469[7] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { if x.ContainerStatuses == nil { r.EncodeNil() } else { - yym1490 := z.EncBinary() - _ = yym1490 + yym25 := z.EncBinary() + _ = yym25 if false { } else { h.encSliceContainerStatus(([]ContainerStatus)(x.ContainerStatuses), e) @@ -18562,13 +24171,15 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1469[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerStatuses")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ContainerStatuses == nil { r.EncodeNil() } else { - yym1491 := z.EncBinary() - _ = yym1491 + yym26 := z.EncBinary() + _ = yym26 if false { } else { h.encSliceContainerStatus(([]ContainerStatus)(x.ContainerStatuses), e) @@ -18576,8 +24187,10 @@ func (x *PodStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1469 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -18587,24 +24200,25 @@ func (x *PodStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1492 := z.DecBinary() - _ = yym1492 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1493 := r.ReadMapStart() - if yyl1493 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1493, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1493 := r.ReadArrayStart() - if yyl1493 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1493, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -18616,12 +24230,12 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1494Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1494Slc - var yyhl1494 bool = l >= 0 - for yyj1494 := 0; ; yyj1494++ { - if yyhl1494 { - if yyj1494 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -18629,9 +24243,11 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1494Slc = r.DecodeBytes(yys1494Slc, true, true) - yys1494 := string(yys1494Slc) - switch yys1494 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "phase": if r.TryDecodeAsNil() { x.Phase = "" @@ -18642,12 +24258,12 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv1496 := &x.Conditions - yym1497 := z.DecBinary() - _ = yym1497 + yyv5 := &x.Conditions + yym6 := z.DecBinary() + _ = yym6 if false { } else { - h.decSlicePodCondition((*[]PodCondition)(yyv1496), d) + h.decSlicePodCondition((*[]PodCondition)(yyv5), d) } } case "message": @@ -18683,13 +24299,13 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.StartTime == nil { x.StartTime = new(pkg2_unversioned.Time) } - yym1503 := z.DecBinary() - _ = yym1503 + yym12 := z.DecBinary() + _ = yym12 if false { } else if z.HasExtensions() && z.DecExt(x.StartTime) { - } else if yym1503 { + } else if yym12 { z.DecBinaryUnmarshal(x.StartTime) - } else if !yym1503 && z.IsJSONHandle() { + } else if !yym12 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.StartTime) } else { z.DecFallback(x.StartTime, false) @@ -18699,136 +24315,141 @@ func (x *PodStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.ContainerStatuses = nil } else { - yyv1504 := &x.ContainerStatuses - yym1505 := z.DecBinary() - _ = yym1505 + yyv13 := &x.ContainerStatuses + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceContainerStatus((*[]ContainerStatus)(yyv1504), d) + h.decSliceContainerStatus((*[]ContainerStatus)(yyv13), d) } } default: - z.DecStructFieldNotFound(-1, yys1494) - } // end switch yys1494 - } // end for yyj1494 - if !yyhl1494 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1506 int - var yyb1506 bool - var yyhl1506 bool = l >= 0 - yyj1506++ - if yyhl1506 { - yyb1506 = yyj1506 > l + var yyj15 int + var yyb15 bool + var yyhl15 bool = l >= 0 + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1506 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1506 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = PodPhase(r.DecodeString()) } - yyj1506++ - if yyhl1506 { - yyb1506 = yyj1506 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1506 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1506 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv1508 := &x.Conditions - yym1509 := z.DecBinary() - _ = yym1509 + yyv17 := &x.Conditions + yym18 := z.DecBinary() + _ = yym18 if false { } else { - h.decSlicePodCondition((*[]PodCondition)(yyv1508), d) + h.decSlicePodCondition((*[]PodCondition)(yyv17), d) } } - yyj1506++ - if yyhl1506 { - yyb1506 = yyj1506 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1506 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1506 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj1506++ - if yyhl1506 { - yyb1506 = yyj1506 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1506 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1506 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj1506++ - if yyhl1506 { - yyb1506 = yyj1506 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1506 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1506 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.HostIP = "" } else { x.HostIP = string(r.DecodeString()) } - yyj1506++ - if yyhl1506 { - yyb1506 = yyj1506 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1506 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1506 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.PodIP = "" } else { x.PodIP = string(r.DecodeString()) } - yyj1506++ - if yyhl1506 { - yyb1506 = yyj1506 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1506 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1506 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.StartTime != nil { x.StartTime = nil @@ -18837,52 +24458,54 @@ func (x *PodStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.StartTime == nil { x.StartTime = new(pkg2_unversioned.Time) } - yym1515 := z.DecBinary() - _ = yym1515 + yym24 := z.DecBinary() + _ = yym24 if false { } else if z.HasExtensions() && z.DecExt(x.StartTime) { - } else if yym1515 { + } else if yym24 { z.DecBinaryUnmarshal(x.StartTime) - } else if !yym1515 && z.IsJSONHandle() { + } else if !yym24 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.StartTime) } else { z.DecFallback(x.StartTime, false) } } - yyj1506++ - if yyhl1506 { - yyb1506 = yyj1506 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1506 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1506 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerStatuses = nil } else { - yyv1516 := &x.ContainerStatuses - yym1517 := z.DecBinary() - _ = yym1517 + yyv25 := &x.ContainerStatuses + yym26 := z.DecBinary() + _ = yym26 if false { } else { - h.decSliceContainerStatus((*[]ContainerStatus)(yyv1516), d) + h.decSliceContainerStatus((*[]ContainerStatus)(yyv25), d) } } for { - yyj1506++ - if yyhl1506 { - yyb1506 = yyj1506 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb1506 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb1506 { + if yyb15 { break } - z.DecStructFieldNotFound(yyj1506-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj15-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodStatusResult) CodecEncodeSelf(e *codec1978.Encoder) { @@ -18892,105 +24515,121 @@ func (x *PodStatusResult) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1518 := z.EncBinary() - _ = yym1518 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1519 := !z.EncBinary() - yy2arr1519 := z.EncBasicHandle().StructToArray - var yyq1519 [4]bool - _, _, _ = yysep1519, yyq1519, yy2arr1519 - const yyr1519 bool = false - yyq1519[0] = x.Kind != "" - yyq1519[1] = x.APIVersion != "" - yyq1519[2] = true - yyq1519[3] = true - if yyr1519 || yy2arr1519 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1519 int = 0 - for _, b := range yyq1519 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1519++ + yynn2++ } } - r.EncodeMapStart(yynn1519) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1519 || yy2arr1519 { - if yyq1519[0] { - yym1521 := z.EncBinary() - _ = yym1521 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1519[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1522 := z.EncBinary() - _ = yym1522 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1519 || yy2arr1519 { - if yyq1519[1] { - yym1524 := z.EncBinary() - _ = yym1524 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1519[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1525 := z.EncBinary() - _ = yym1525 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1519 || yy2arr1519 { - if yyq1519[2] { - yy1527 := &x.ObjectMeta - yy1527.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1519[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1528 := &x.ObjectMeta - yy1528.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1519 || yy2arr1519 { - if yyq1519[3] { - yy1530 := &x.Status - yy1530.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Status + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1519[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy1531 := &x.Status - yy1531.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Status + yy11.CodecEncodeSelf(e) } } - if yysep1519 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -19000,24 +24639,25 @@ func (x *PodStatusResult) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1532 := z.DecBinary() - _ = yym1532 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1533 := r.ReadMapStart() - if yyl1533 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1533, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1533 := r.ReadArrayStart() - if yyl1533 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1533, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -19029,12 +24669,12 @@ func (x *PodStatusResult) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1534Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1534Slc - var yyhl1534 bool = l >= 0 - for yyj1534 := 0; ; yyj1534++ { - if yyhl1534 { - if yyj1534 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -19042,9 +24682,25 @@ func (x *PodStatusResult) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1534Slc = r.DecodeBytes(yys1534Slc, true, true) - yys1534 := string(yys1534Slc) - switch yys1534 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = PodStatus{} + } else { + yyv5 := &x.Status + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -19057,111 +24713,100 @@ func (x *PodStatusResult) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1537 := &x.ObjectMeta - yyv1537.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = PodStatus{} - } else { - yyv1538 := &x.Status - yyv1538.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1534) - } // end switch yys1534 - } // end for yyj1534 - if !yyhl1534 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodStatusResult) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1539 int - var yyb1539 bool - var yyhl1539 bool = l >= 0 - yyj1539++ - if yyhl1539 { - yyb1539 = yyj1539 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1539 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1539 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = PodStatus{} + } else { + yyv10 := &x.Status + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1539++ - if yyhl1539 { - yyb1539 = yyj1539 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1539 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1539 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1539++ - if yyhl1539 { - yyb1539 = yyj1539 > l - } else { - yyb1539 = r.CheckBreak() - } - if yyb1539 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1542 := &x.ObjectMeta - yyv1542.CodecDecodeSelf(d) - } - yyj1539++ - if yyhl1539 { - yyb1539 = yyj1539 > l - } else { - yyb1539 = r.CheckBreak() - } - if yyb1539 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = PodStatus{} - } else { - yyv1543 := &x.Status - yyv1543.CodecDecodeSelf(d) - } for { - yyj1539++ - if yyhl1539 { - yyb1539 = yyj1539 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1539 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1539 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1539-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Pod) CodecEncodeSelf(e *codec1978.Encoder) { @@ -19171,120 +24816,139 @@ func (x *Pod) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1544 := z.EncBinary() - _ = yym1544 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1545 := !z.EncBinary() - yy2arr1545 := z.EncBasicHandle().StructToArray - var yyq1545 [5]bool - _, _, _ = yysep1545, yyq1545, yy2arr1545 - const yyr1545 bool = false - yyq1545[0] = x.Kind != "" - yyq1545[1] = x.APIVersion != "" - yyq1545[2] = true - yyq1545[3] = true - yyq1545[4] = true - if yyr1545 || yy2arr1545 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1545 int = 0 - for _, b := range yyq1545 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1545++ + yynn2++ } } - r.EncodeMapStart(yynn1545) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1545 || yy2arr1545 { - if yyq1545[0] { - yym1547 := z.EncBinary() - _ = yym1547 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1545[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1548 := z.EncBinary() - _ = yym1548 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1545 || yy2arr1545 { - if yyq1545[1] { - yym1550 := z.EncBinary() - _ = yym1550 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1545[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1551 := z.EncBinary() - _ = yym1551 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1545 || yy2arr1545 { - if yyq1545[2] { - yy1553 := &x.ObjectMeta - yy1553.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1545[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1554 := &x.ObjectMeta - yy1554.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1545 || yy2arr1545 { - if yyq1545[3] { - yy1556 := &x.Spec - yy1556.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1545[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1557 := &x.Spec - yy1557.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr1545 || yy2arr1545 { - if yyq1545[4] { - yy1559 := &x.Status - yy1559.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1545[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy1560 := &x.Status - yy1560.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep1545 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -19294,24 +24958,25 @@ func (x *Pod) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1561 := z.DecBinary() - _ = yym1561 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1562 := r.ReadMapStart() - if yyl1562 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1562, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1562 := r.ReadArrayStart() - if yyl1562 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1562, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -19323,12 +24988,12 @@ func (x *Pod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1563Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1563Slc - var yyhl1563 bool = l >= 0 - for yyj1563 := 0; ; yyj1563++ { - if yyhl1563 { - if yyj1563 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -19336,9 +25001,32 @@ func (x *Pod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1563Slc = r.DecodeBytes(yys1563Slc, true, true) - yys1563 := string(yys1563Slc) - switch yys1563 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = PodSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = PodStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -19351,134 +25039,117 @@ func (x *Pod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1566 := &x.ObjectMeta - yyv1566.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = PodSpec{} - } else { - yyv1567 := &x.Spec - yyv1567.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = PodStatus{} - } else { - yyv1568 := &x.Status - yyv1568.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1563) - } // end switch yys1563 - } // end for yyj1563 - if !yyhl1563 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Pod) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1569 int - var yyb1569 bool - var yyhl1569 bool = l >= 0 - yyj1569++ - if yyhl1569 { - yyb1569 = yyj1569 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1569 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1569 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = PodSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = PodStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1569++ - if yyhl1569 { - yyb1569 = yyj1569 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1569 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1569 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1569++ - if yyhl1569 { - yyb1569 = yyj1569 > l - } else { - yyb1569 = r.CheckBreak() - } - if yyb1569 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1572 := &x.ObjectMeta - yyv1572.CodecDecodeSelf(d) - } - yyj1569++ - if yyhl1569 { - yyb1569 = yyj1569 > l - } else { - yyb1569 = r.CheckBreak() - } - if yyb1569 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = PodSpec{} - } else { - yyv1573 := &x.Spec - yyv1573.CodecDecodeSelf(d) - } - yyj1569++ - if yyhl1569 { - yyb1569 = yyj1569 > l - } else { - yyb1569 = r.CheckBreak() - } - if yyb1569 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = PodStatus{} - } else { - yyv1574 := &x.Status - yyv1574.CodecDecodeSelf(d) - } for { - yyj1569++ - if yyhl1569 { - yyb1569 = yyj1569 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1569 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1569 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj1569-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -19488,126 +25159,142 @@ func (x *PodList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1575 := z.EncBinary() - _ = yym1575 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1576 := !z.EncBinary() - yy2arr1576 := z.EncBasicHandle().StructToArray - var yyq1576 [4]bool - _, _, _ = yysep1576, yyq1576, yy2arr1576 - const yyr1576 bool = false - yyq1576[0] = x.Kind != "" - yyq1576[1] = x.APIVersion != "" - yyq1576[2] = true - if yyr1576 || yy2arr1576 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1576 int = 1 - for _, b := range yyq1576 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1576++ + yynn2++ } } - r.EncodeMapStart(yynn1576) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1576 || yy2arr1576 { - if yyq1576[0] { - yym1578 := z.EncBinary() - _ = yym1578 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1576[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1579 := z.EncBinary() - _ = yym1579 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1576 || yy2arr1576 { - if yyq1576[1] { - yym1581 := z.EncBinary() - _ = yym1581 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1576[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1582 := z.EncBinary() - _ = yym1582 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1576 || yy2arr1576 { - if yyq1576[2] { - yy1584 := &x.ListMeta - yym1585 := z.EncBinary() - _ = yym1585 - if false { - } else if z.HasExtensions() && z.EncExt(yy1584) { - } else { - z.EncFallback(yy1584) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1576[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1586 := &x.ListMeta - yym1587 := z.EncBinary() - _ = yym1587 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1586) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1586) + z.EncFallback(yy6) } } } - if yyr1576 || yy2arr1576 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1589 := z.EncBinary() - _ = yym1589 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSlicePod(([]Pod)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1590 := z.EncBinary() - _ = yym1590 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSlicePod(([]Pod)(x.Items), e) } } } - if yysep1576 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -19617,24 +25304,25 @@ func (x *PodList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1591 := z.DecBinary() - _ = yym1591 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1592 := r.ReadMapStart() - if yyl1592 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1592, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1592 := r.ReadArrayStart() - if yyl1592 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1592, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -19646,12 +25334,12 @@ func (x *PodList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1593Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1593Slc - var yyhl1593 bool = l >= 0 - for yyj1593 := 0; ; yyj1593++ { - if yyhl1593 { - if yyj1593 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -19659,9 +25347,36 @@ func (x *PodList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1593Slc = r.DecodeBytes(yys1593Slc, true, true) - yys1593 := string(yys1593Slc) - switch yys1593 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePod((*[]Pod)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -19674,133 +25389,111 @@ func (x *PodList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1596 := &x.ListMeta - yym1597 := z.DecBinary() - _ = yym1597 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1596) { - } else { - z.DecFallback(yyv1596, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1598 := &x.Items - yym1599 := z.DecBinary() - _ = yym1599 - if false { - } else { - h.decSlicePod((*[]Pod)(yyv1598), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1593) - } // end switch yys1593 - } // end for yyj1593 - if !yyhl1593 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1600 int - var yyb1600 bool - var yyhl1600 bool = l >= 0 - yyj1600++ - if yyhl1600 { - yyb1600 = yyj1600 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1600 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1600 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePod((*[]Pod)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1600++ - if yyhl1600 { - yyb1600 = yyj1600 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1600 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1600 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1600++ - if yyhl1600 { - yyb1600 = yyj1600 > l - } else { - yyb1600 = r.CheckBreak() - } - if yyb1600 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1603 := &x.ListMeta - yym1604 := z.DecBinary() - _ = yym1604 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1603) { - } else { - z.DecFallback(yyv1603, false) - } - } - yyj1600++ - if yyhl1600 { - yyb1600 = yyj1600 > l - } else { - yyb1600 = r.CheckBreak() - } - if yyb1600 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1605 := &x.Items - yym1606 := z.DecBinary() - _ = yym1606 - if false { - } else { - h.decSlicePod((*[]Pod)(yyv1605), d) - } - } for { - yyj1600++ - if yyhl1600 { - yyb1600 = yyj1600 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1600 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1600 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1600-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodTemplateSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -19810,59 +25503,69 @@ func (x *PodTemplateSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1607 := z.EncBinary() - _ = yym1607 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1608 := !z.EncBinary() - yy2arr1608 := z.EncBasicHandle().StructToArray - var yyq1608 [2]bool - _, _, _ = yysep1608, yyq1608, yy2arr1608 - const yyr1608 bool = false - yyq1608[0] = true - yyq1608[1] = true - if yyr1608 || yy2arr1608 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1608 int = 0 - for _, b := range yyq1608 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1608++ + yynn2++ } } - r.EncodeMapStart(yynn1608) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1608 || yy2arr1608 { - if yyq1608[0] { - yy1610 := &x.ObjectMeta - yy1610.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1608[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1611 := &x.ObjectMeta - yy1611.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1608 || yy2arr1608 { - if yyq1608[1] { - yy1613 := &x.Spec - yy1613.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1608[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1614 := &x.Spec - yy1614.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yysep1608 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -19872,24 +25575,25 @@ func (x *PodTemplateSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1615 := z.DecBinary() - _ = yym1615 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1616 := r.ReadMapStart() - if yyl1616 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1616, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1616 := r.ReadArrayStart() - if yyl1616 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1616, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -19901,12 +25605,12 @@ func (x *PodTemplateSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1617Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1617Slc - var yyhl1617 bool = l >= 0 - for yyj1617 := 0; ; yyj1617++ { - if yyhl1617 { - if yyj1617 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -19914,84 +25618,87 @@ func (x *PodTemplateSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1617Slc = r.DecodeBytes(yys1617Slc, true, true) - yys1617 := string(yys1617Slc) - switch yys1617 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "metadata": if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv1618 := &x.ObjectMeta - yyv1618.CodecDecodeSelf(d) + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) } case "spec": if r.TryDecodeAsNil() { x.Spec = PodSpec{} } else { - yyv1619 := &x.Spec - yyv1619.CodecDecodeSelf(d) + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1617) - } // end switch yys1617 - } // end for yyj1617 - if !yyhl1617 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodTemplateSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1620 int - var yyb1620 bool - var yyhl1620 bool = l >= 0 - yyj1620++ - if yyhl1620 { - yyb1620 = yyj1620 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1620 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1620 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv1621 := &x.ObjectMeta - yyv1621.CodecDecodeSelf(d) + yyv7 := &x.ObjectMeta + yyv7.CodecDecodeSelf(d) } - yyj1620++ - if yyhl1620 { - yyb1620 = yyj1620 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1620 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1620 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Spec = PodSpec{} } else { - yyv1622 := &x.Spec - yyv1622.CodecDecodeSelf(d) + yyv8 := &x.Spec + yyv8.CodecDecodeSelf(d) } for { - yyj1620++ - if yyhl1620 { - yyb1620 = yyj1620 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1620 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1620 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1620-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodTemplate) CodecEncodeSelf(e *codec1978.Encoder) { @@ -20001,105 +25708,121 @@ func (x *PodTemplate) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1623 := z.EncBinary() - _ = yym1623 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1624 := !z.EncBinary() - yy2arr1624 := z.EncBasicHandle().StructToArray - var yyq1624 [4]bool - _, _, _ = yysep1624, yyq1624, yy2arr1624 - const yyr1624 bool = false - yyq1624[0] = x.Kind != "" - yyq1624[1] = x.APIVersion != "" - yyq1624[2] = true - yyq1624[3] = true - if yyr1624 || yy2arr1624 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1624 int = 0 - for _, b := range yyq1624 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1624++ + yynn2++ } } - r.EncodeMapStart(yynn1624) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1624 || yy2arr1624 { - if yyq1624[0] { - yym1626 := z.EncBinary() - _ = yym1626 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1624[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1627 := z.EncBinary() - _ = yym1627 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1624 || yy2arr1624 { - if yyq1624[1] { - yym1629 := z.EncBinary() - _ = yym1629 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1624[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1630 := z.EncBinary() - _ = yym1630 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1624 || yy2arr1624 { - if yyq1624[2] { - yy1632 := &x.ObjectMeta - yy1632.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1624[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1633 := &x.ObjectMeta - yy1633.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1624 || yy2arr1624 { - if yyq1624[3] { - yy1635 := &x.Template - yy1635.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Template + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1624[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("template")) - yy1636 := &x.Template - yy1636.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Template + yy11.CodecEncodeSelf(e) } } - if yysep1624 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -20109,24 +25832,25 @@ func (x *PodTemplate) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1637 := z.DecBinary() - _ = yym1637 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1638 := r.ReadMapStart() - if yyl1638 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1638, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1638 := r.ReadArrayStart() - if yyl1638 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1638, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -20138,12 +25862,12 @@ func (x *PodTemplate) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1639Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1639Slc - var yyhl1639 bool = l >= 0 - for yyj1639 := 0; ; yyj1639++ { - if yyhl1639 { - if yyj1639 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -20151,9 +25875,25 @@ func (x *PodTemplate) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1639Slc = r.DecodeBytes(yys1639Slc, true, true) - yys1639 := string(yys1639Slc) - switch yys1639 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "template": + if r.TryDecodeAsNil() { + x.Template = PodTemplateSpec{} + } else { + yyv5 := &x.Template + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -20166,111 +25906,100 @@ func (x *PodTemplate) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1642 := &x.ObjectMeta - yyv1642.CodecDecodeSelf(d) - } - case "template": - if r.TryDecodeAsNil() { - x.Template = PodTemplateSpec{} - } else { - yyv1643 := &x.Template - yyv1643.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1639) - } // end switch yys1639 - } // end for yyj1639 - if !yyhl1639 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodTemplate) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1644 int - var yyb1644 bool - var yyhl1644 bool = l >= 0 - yyj1644++ - if yyhl1644 { - yyb1644 = yyj1644 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1644 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1644 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Template = PodTemplateSpec{} + } else { + yyv10 := &x.Template + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1644++ - if yyhl1644 { - yyb1644 = yyj1644 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1644 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1644 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1644++ - if yyhl1644 { - yyb1644 = yyj1644 > l - } else { - yyb1644 = r.CheckBreak() - } - if yyb1644 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1647 := &x.ObjectMeta - yyv1647.CodecDecodeSelf(d) - } - yyj1644++ - if yyhl1644 { - yyb1644 = yyj1644 > l - } else { - yyb1644 = r.CheckBreak() - } - if yyb1644 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Template = PodTemplateSpec{} - } else { - yyv1648 := &x.Template - yyv1648.CodecDecodeSelf(d) - } for { - yyj1644++ - if yyhl1644 { - yyb1644 = yyj1644 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1644 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1644 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1644-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *PodTemplateList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -20280,126 +26009,142 @@ func (x *PodTemplateList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1649 := z.EncBinary() - _ = yym1649 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1650 := !z.EncBinary() - yy2arr1650 := z.EncBasicHandle().StructToArray - var yyq1650 [4]bool - _, _, _ = yysep1650, yyq1650, yy2arr1650 - const yyr1650 bool = false - yyq1650[0] = x.Kind != "" - yyq1650[1] = x.APIVersion != "" - yyq1650[2] = true - if yyr1650 || yy2arr1650 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1650 int = 1 - for _, b := range yyq1650 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1650++ + yynn2++ } } - r.EncodeMapStart(yynn1650) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1650 || yy2arr1650 { - if yyq1650[0] { - yym1652 := z.EncBinary() - _ = yym1652 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1650[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1653 := z.EncBinary() - _ = yym1653 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1650 || yy2arr1650 { - if yyq1650[1] { - yym1655 := z.EncBinary() - _ = yym1655 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1650[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1656 := z.EncBinary() - _ = yym1656 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1650 || yy2arr1650 { - if yyq1650[2] { - yy1658 := &x.ListMeta - yym1659 := z.EncBinary() - _ = yym1659 - if false { - } else if z.HasExtensions() && z.EncExt(yy1658) { - } else { - z.EncFallback(yy1658) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1650[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1660 := &x.ListMeta - yym1661 := z.EncBinary() - _ = yym1661 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1660) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1660) + z.EncFallback(yy6) } } } - if yyr1650 || yy2arr1650 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1663 := z.EncBinary() - _ = yym1663 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSlicePodTemplate(([]PodTemplate)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1664 := z.EncBinary() - _ = yym1664 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSlicePodTemplate(([]PodTemplate)(x.Items), e) } } } - if yysep1650 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -20409,24 +26154,25 @@ func (x *PodTemplateList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1665 := z.DecBinary() - _ = yym1665 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1666 := r.ReadMapStart() - if yyl1666 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1666, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1666 := r.ReadArrayStart() - if yyl1666 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1666, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -20438,12 +26184,12 @@ func (x *PodTemplateList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1667Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1667Slc - var yyhl1667 bool = l >= 0 - for yyj1667 := 0; ; yyj1667++ { - if yyhl1667 { - if yyj1667 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -20451,9 +26197,36 @@ func (x *PodTemplateList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1667Slc = r.DecodeBytes(yys1667Slc, true, true) - yys1667 := string(yys1667Slc) - switch yys1667 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePodTemplate((*[]PodTemplate)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -20466,133 +26239,111 @@ func (x *PodTemplateList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1670 := &x.ListMeta - yym1671 := z.DecBinary() - _ = yym1671 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1670) { - } else { - z.DecFallback(yyv1670, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1672 := &x.Items - yym1673 := z.DecBinary() - _ = yym1673 - if false { - } else { - h.decSlicePodTemplate((*[]PodTemplate)(yyv1672), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1667) - } // end switch yys1667 - } // end for yyj1667 - if !yyhl1667 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodTemplateList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1674 int - var yyb1674 bool - var yyhl1674 bool = l >= 0 - yyj1674++ - if yyhl1674 { - yyb1674 = yyj1674 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1674 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1674 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePodTemplate((*[]PodTemplate)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1674++ - if yyhl1674 { - yyb1674 = yyj1674 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1674 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1674 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1674++ - if yyhl1674 { - yyb1674 = yyj1674 > l - } else { - yyb1674 = r.CheckBreak() - } - if yyb1674 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1677 := &x.ListMeta - yym1678 := z.DecBinary() - _ = yym1678 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1677) { - } else { - z.DecFallback(yyv1677, false) - } - } - yyj1674++ - if yyhl1674 { - yyb1674 = yyj1674 > l - } else { - yyb1674 = r.CheckBreak() - } - if yyb1674 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1679 := &x.Items - yym1680 := z.DecBinary() - _ = yym1680 - if false { - } else { - h.decSlicePodTemplate((*[]PodTemplate)(yyv1679), d) - } - } for { - yyj1674++ - if yyhl1674 { - yyb1674 = yyj1674 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1674 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1674 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1674-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -20602,69 +26353,75 @@ func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1681 := z.EncBinary() - _ = yym1681 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1682 := !z.EncBinary() - yy2arr1682 := z.EncBasicHandle().StructToArray - var yyq1682 [3]bool - _, _, _ = yysep1682, yyq1682, yy2arr1682 - const yyr1682 bool = false - yyq1682[0] = x.Replicas != nil - yyq1682[1] = len(x.Selector) != 0 - yyq1682[2] = x.Template != nil - if yyr1682 || yy2arr1682 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Replicas != nil + yyq2[1] = len(x.Selector) != 0 + yyq2[2] = x.Template != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1682 int = 0 - for _, b := range yyq1682 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1682++ + yynn2++ } } - r.EncodeMapStart(yynn1682) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1682 || yy2arr1682 { - if yyq1682[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Replicas == nil { r.EncodeNil() } else { - yy1684 := *x.Replicas - yym1685 := z.EncBinary() - _ = yym1685 + yy4 := *x.Replicas + yym5 := z.EncBinary() + _ = yym5 if false { } else { - r.EncodeInt(int64(yy1684)) + r.EncodeInt(int64(yy4)) } } } else { r.EncodeNil() } } else { - if yyq1682[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Replicas == nil { r.EncodeNil() } else { - yy1686 := *x.Replicas - yym1687 := z.EncBinary() - _ = yym1687 + yy6 := *x.Replicas + yym7 := z.EncBinary() + _ = yym7 if false { } else { - r.EncodeInt(int64(yy1686)) + r.EncodeInt(int64(yy6)) } } } } - if yyr1682 || yy2arr1682 { - if yyq1682[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Selector == nil { r.EncodeNil() } else { - yym1689 := z.EncBinary() - _ = yym1689 + yym9 := z.EncBinary() + _ = yym9 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) @@ -20674,13 +26431,15 @@ func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1682[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym1690 := z.EncBinary() - _ = yym1690 + yym10 := z.EncBinary() + _ = yym10 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) @@ -20688,8 +26447,9 @@ func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1682 || yy2arr1682 { - if yyq1682[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Template == nil { r.EncodeNil() } else { @@ -20699,8 +26459,10 @@ func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1682[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("template")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Template == nil { r.EncodeNil() } else { @@ -20708,8 +26470,10 @@ func (x *ReplicationControllerSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1682 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -20719,24 +26483,25 @@ func (x *ReplicationControllerSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1692 := z.DecBinary() - _ = yym1692 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1693 := r.ReadMapStart() - if yyl1693 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1693, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1693 := r.ReadArrayStart() - if yyl1693 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1693, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -20748,12 +26513,12 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromMap(l int, d *codec1978.D var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1694Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1694Slc - var yyhl1694 bool = l >= 0 - for yyj1694 := 0; ; yyj1694++ { - if yyhl1694 { - if yyj1694 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -20761,9 +26526,11 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromMap(l int, d *codec1978.D break } } - yys1694Slc = r.DecodeBytes(yys1694Slc, true, true) - yys1694 := string(yys1694Slc) - switch yys1694 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { if x.Replicas != nil { @@ -20771,25 +26538,25 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromMap(l int, d *codec1978.D } } else { if x.Replicas == nil { - x.Replicas = new(int) + x.Replicas = new(int32) } - yym1696 := z.DecBinary() - _ = yym1696 + yym5 := z.DecBinary() + _ = yym5 if false { } else { - *((*int)(x.Replicas)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Replicas)) = int32(r.DecodeInt(32)) } } case "selector": if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv1697 := &x.Selector - yym1698 := z.DecBinary() - _ = yym1698 + yyv6 := &x.Selector + yym7 := z.DecBinary() + _ = yym7 if false { } else { - z.F.DecMapStringStringX(yyv1697, false, d) + z.F.DecMapStringStringX(yyv6, false, d) } } case "template": @@ -20804,77 +26571,78 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromMap(l int, d *codec1978.D x.Template.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1694) - } // end switch yys1694 - } // end for yyj1694 - if !yyhl1694 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationControllerSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1700 int - var yyb1700 bool - var yyhl1700 bool = l >= 0 - yyj1700++ - if yyhl1700 { - yyb1700 = yyj1700 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1700 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1700 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Replicas != nil { x.Replicas = nil } } else { if x.Replicas == nil { - x.Replicas = new(int) + x.Replicas = new(int32) } - yym1702 := z.DecBinary() - _ = yym1702 + yym11 := z.DecBinary() + _ = yym11 if false { } else { - *((*int)(x.Replicas)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Replicas)) = int32(r.DecodeInt(32)) } } - yyj1700++ - if yyhl1700 { - yyb1700 = yyj1700 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1700 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1700 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv1703 := &x.Selector - yym1704 := z.DecBinary() - _ = yym1704 + yyv12 := &x.Selector + yym13 := z.DecBinary() + _ = yym13 if false { } else { - z.F.DecMapStringStringX(yyv1703, false, d) + z.F.DecMapStringStringX(yyv12, false, d) } } - yyj1700++ - if yyhl1700 { - yyb1700 = yyj1700 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1700 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1700 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Template != nil { x.Template = nil @@ -20886,18 +26654,19 @@ func (x *ReplicationControllerSpec) codecDecodeSelfFromArray(l int, d *codec1978 x.Template.CodecDecodeSelf(d) } for { - yyj1700++ - if yyhl1700 { - yyb1700 = yyj1700 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1700 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1700 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj1700-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationControllerStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -20907,48 +26676,54 @@ func (x *ReplicationControllerStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1706 := z.EncBinary() - _ = yym1706 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1707 := !z.EncBinary() - yy2arr1707 := z.EncBasicHandle().StructToArray - var yyq1707 [2]bool - _, _, _ = yysep1707, yyq1707, yy2arr1707 - const yyr1707 bool = false - yyq1707[1] = x.ObservedGeneration != 0 - if yyr1707 || yy2arr1707 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.ObservedGeneration != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1707 int = 1 - for _, b := range yyq1707 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1707++ + yynn2++ } } - r.EncodeMapStart(yynn1707) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1707 || yy2arr1707 { - yym1709 := z.EncBinary() - _ = yym1709 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Replicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) - yym1710 := z.EncBinary() - _ = yym1710 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Replicas)) } } - if yyr1707 || yy2arr1707 { - if yyq1707[1] { - yym1712 := z.EncBinary() - _ = yym1712 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.ObservedGeneration)) @@ -20957,18 +26732,22 @@ func (x *ReplicationControllerStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq1707[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("observedGeneration")) - yym1713 := z.EncBinary() - _ = yym1713 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.ObservedGeneration)) } } } - if yysep1707 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -20978,24 +26757,25 @@ func (x *ReplicationControllerStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1714 := z.DecBinary() - _ = yym1714 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1715 := r.ReadMapStart() - if yyl1715 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1715, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1715 := r.ReadArrayStart() - if yyl1715 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1715, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -21007,12 +26787,12 @@ func (x *ReplicationControllerStatus) codecDecodeSelfFromMap(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1716Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1716Slc - var yyhl1716 bool = l >= 0 - for yyj1716 := 0; ; yyj1716++ { - if yyhl1716 { - if yyj1716 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -21020,14 +26800,16 @@ func (x *ReplicationControllerStatus) codecDecodeSelfFromMap(l int, d *codec1978 break } } - yys1716Slc = r.DecodeBytes(yys1716Slc, true, true) - yys1716 := string(yys1716Slc) - switch yys1716 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 } else { - x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.Replicas = int32(r.DecodeInt(32)) } case "observedGeneration": if r.TryDecodeAsNil() { @@ -21036,64 +26818,65 @@ func (x *ReplicationControllerStatus) codecDecodeSelfFromMap(l int, d *codec1978 x.ObservedGeneration = int64(r.DecodeInt(64)) } default: - z.DecStructFieldNotFound(-1, yys1716) - } // end switch yys1716 - } // end for yyj1716 - if !yyhl1716 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationControllerStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1719 int - var yyb1719 bool - var yyhl1719 bool = l >= 0 - yyj1719++ - if yyhl1719 { - yyb1719 = yyj1719 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1719 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1719 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { - x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.Replicas = int32(r.DecodeInt(32)) } - yyj1719++ - if yyhl1719 { - yyb1719 = yyj1719 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1719 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1719 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObservedGeneration = 0 } else { x.ObservedGeneration = int64(r.DecodeInt(64)) } for { - yyj1719++ - if yyhl1719 { - yyb1719 = yyj1719 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1719 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1719 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1719-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationController) CodecEncodeSelf(e *codec1978.Encoder) { @@ -21103,120 +26886,139 @@ func (x *ReplicationController) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1722 := z.EncBinary() - _ = yym1722 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1723 := !z.EncBinary() - yy2arr1723 := z.EncBasicHandle().StructToArray - var yyq1723 [5]bool - _, _, _ = yysep1723, yyq1723, yy2arr1723 - const yyr1723 bool = false - yyq1723[0] = x.Kind != "" - yyq1723[1] = x.APIVersion != "" - yyq1723[2] = true - yyq1723[3] = true - yyq1723[4] = true - if yyr1723 || yy2arr1723 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1723 int = 0 - for _, b := range yyq1723 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1723++ + yynn2++ } } - r.EncodeMapStart(yynn1723) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1723 || yy2arr1723 { - if yyq1723[0] { - yym1725 := z.EncBinary() - _ = yym1725 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1723[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1726 := z.EncBinary() - _ = yym1726 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1723 || yy2arr1723 { - if yyq1723[1] { - yym1728 := z.EncBinary() - _ = yym1728 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1723[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1729 := z.EncBinary() - _ = yym1729 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1723 || yy2arr1723 { - if yyq1723[2] { - yy1731 := &x.ObjectMeta - yy1731.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1723[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1732 := &x.ObjectMeta - yy1732.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1723 || yy2arr1723 { - if yyq1723[3] { - yy1734 := &x.Spec - yy1734.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1723[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1735 := &x.Spec - yy1735.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr1723 || yy2arr1723 { - if yyq1723[4] { - yy1737 := &x.Status - yy1737.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1723[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy1738 := &x.Status - yy1738.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep1723 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -21226,24 +27028,25 @@ func (x *ReplicationController) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1739 := z.DecBinary() - _ = yym1739 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1740 := r.ReadMapStart() - if yyl1740 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1740, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1740 := r.ReadArrayStart() - if yyl1740 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1740, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -21255,12 +27058,12 @@ func (x *ReplicationController) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1741Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1741Slc - var yyhl1741 bool = l >= 0 - for yyj1741 := 0; ; yyj1741++ { - if yyhl1741 { - if yyj1741 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -21268,9 +27071,32 @@ func (x *ReplicationController) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1741Slc = r.DecodeBytes(yys1741Slc, true, true) - yys1741 := string(yys1741Slc) - switch yys1741 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ReplicationControllerSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ReplicationControllerStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -21283,134 +27109,117 @@ func (x *ReplicationController) codecDecodeSelfFromMap(l int, d *codec1978.Decod } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1744 := &x.ObjectMeta - yyv1744.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ReplicationControllerSpec{} - } else { - yyv1745 := &x.Spec - yyv1745.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = ReplicationControllerStatus{} - } else { - yyv1746 := &x.Status - yyv1746.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1741) - } // end switch yys1741 - } // end for yyj1741 - if !yyhl1741 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationController) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1747 int - var yyb1747 bool - var yyhl1747 bool = l >= 0 - yyj1747++ - if yyhl1747 { - yyb1747 = yyj1747 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1747 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1747 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ReplicationControllerSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ReplicationControllerStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1747++ - if yyhl1747 { - yyb1747 = yyj1747 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1747 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1747 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1747++ - if yyhl1747 { - yyb1747 = yyj1747 > l - } else { - yyb1747 = r.CheckBreak() - } - if yyb1747 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1750 := &x.ObjectMeta - yyv1750.CodecDecodeSelf(d) - } - yyj1747++ - if yyhl1747 { - yyb1747 = yyj1747 > l - } else { - yyb1747 = r.CheckBreak() - } - if yyb1747 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ReplicationControllerSpec{} - } else { - yyv1751 := &x.Spec - yyv1751.CodecDecodeSelf(d) - } - yyj1747++ - if yyhl1747 { - yyb1747 = yyj1747 > l - } else { - yyb1747 = r.CheckBreak() - } - if yyb1747 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = ReplicationControllerStatus{} - } else { - yyv1752 := &x.Status - yyv1752.CodecDecodeSelf(d) - } for { - yyj1747++ - if yyhl1747 { - yyb1747 = yyj1747 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1747 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1747 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj1747-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationControllerList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -21420,126 +27229,142 @@ func (x *ReplicationControllerList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1753 := z.EncBinary() - _ = yym1753 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1754 := !z.EncBinary() - yy2arr1754 := z.EncBasicHandle().StructToArray - var yyq1754 [4]bool - _, _, _ = yysep1754, yyq1754, yy2arr1754 - const yyr1754 bool = false - yyq1754[0] = x.Kind != "" - yyq1754[1] = x.APIVersion != "" - yyq1754[2] = true - if yyr1754 || yy2arr1754 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1754 int = 1 - for _, b := range yyq1754 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1754++ + yynn2++ } } - r.EncodeMapStart(yynn1754) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1754 || yy2arr1754 { - if yyq1754[0] { - yym1756 := z.EncBinary() - _ = yym1756 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1754[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1757 := z.EncBinary() - _ = yym1757 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1754 || yy2arr1754 { - if yyq1754[1] { - yym1759 := z.EncBinary() - _ = yym1759 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1754[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1760 := z.EncBinary() - _ = yym1760 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1754 || yy2arr1754 { - if yyq1754[2] { - yy1762 := &x.ListMeta - yym1763 := z.EncBinary() - _ = yym1763 - if false { - } else if z.HasExtensions() && z.EncExt(yy1762) { - } else { - z.EncFallback(yy1762) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1754[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1764 := &x.ListMeta - yym1765 := z.EncBinary() - _ = yym1765 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1764) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1764) + z.EncFallback(yy6) } } } - if yyr1754 || yy2arr1754 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1767 := z.EncBinary() - _ = yym1767 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceReplicationController(([]ReplicationController)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1768 := z.EncBinary() - _ = yym1768 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceReplicationController(([]ReplicationController)(x.Items), e) } } } - if yysep1754 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -21549,24 +27374,25 @@ func (x *ReplicationControllerList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1769 := z.DecBinary() - _ = yym1769 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1770 := r.ReadMapStart() - if yyl1770 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1770, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1770 := r.ReadArrayStart() - if yyl1770 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1770, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -21578,12 +27404,12 @@ func (x *ReplicationControllerList) codecDecodeSelfFromMap(l int, d *codec1978.D var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1771Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1771Slc - var yyhl1771 bool = l >= 0 - for yyj1771 := 0; ; yyj1771++ { - if yyhl1771 { - if yyj1771 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -21591,9 +27417,36 @@ func (x *ReplicationControllerList) codecDecodeSelfFromMap(l int, d *codec1978.D break } } - yys1771Slc = r.DecodeBytes(yys1771Slc, true, true) - yys1771 := string(yys1771Slc) - switch yys1771 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceReplicationController((*[]ReplicationController)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -21606,141 +27459,119 @@ func (x *ReplicationControllerList) codecDecodeSelfFromMap(l int, d *codec1978.D } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1774 := &x.ListMeta - yym1775 := z.DecBinary() - _ = yym1775 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1774) { - } else { - z.DecFallback(yyv1774, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1776 := &x.Items - yym1777 := z.DecBinary() - _ = yym1777 - if false { - } else { - h.decSliceReplicationController((*[]ReplicationController)(yyv1776), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1771) - } // end switch yys1771 - } // end for yyj1771 - if !yyhl1771 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationControllerList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1778 int - var yyb1778 bool - var yyhl1778 bool = l >= 0 - yyj1778++ - if yyhl1778 { - yyb1778 = yyj1778 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1778 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1778 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceReplicationController((*[]ReplicationController)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1778++ - if yyhl1778 { - yyb1778 = yyj1778 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1778 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1778 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1778++ - if yyhl1778 { - yyb1778 = yyj1778 > l - } else { - yyb1778 = r.CheckBreak() - } - if yyb1778 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1781 := &x.ListMeta - yym1782 := z.DecBinary() - _ = yym1782 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1781) { - } else { - z.DecFallback(yyv1781, false) - } - } - yyj1778++ - if yyhl1778 { - yyb1778 = yyj1778 > l - } else { - yyb1778 = r.CheckBreak() - } - if yyb1778 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1783 := &x.Items - yym1784 := z.DecBinary() - _ = yym1784 - if false { - } else { - h.decSliceReplicationController((*[]ReplicationController)(yyv1783), d) - } - } for { - yyj1778++ - if yyhl1778 { - yyb1778 = yyj1778 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1778 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1778 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1778-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x ServiceAffinity) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1785 := z.EncBinary() - _ = yym1785 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -21752,8 +27583,8 @@ func (x *ServiceAffinity) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1786 := z.DecBinary() - _ = yym1786 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -21765,8 +27596,8 @@ func (x ServiceType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1787 := z.EncBinary() - _ = yym1787 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -21778,8 +27609,8 @@ func (x *ServiceType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1788 := z.DecBinary() - _ = yym1788 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -21794,44 +27625,51 @@ func (x *ServiceStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1789 := z.EncBinary() - _ = yym1789 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1790 := !z.EncBinary() - yy2arr1790 := z.EncBasicHandle().StructToArray - var yyq1790 [1]bool - _, _, _ = yysep1790, yyq1790, yy2arr1790 - const yyr1790 bool = false - yyq1790[0] = true - if yyr1790 || yy2arr1790 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn1790 int = 0 - for _, b := range yyq1790 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1790++ + yynn2++ } } - r.EncodeMapStart(yynn1790) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1790 || yy2arr1790 { - if yyq1790[0] { - yy1792 := &x.LoadBalancer - yy1792.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.LoadBalancer + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1790[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("loadBalancer")) - yy1793 := &x.LoadBalancer - yy1793.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.LoadBalancer + yy6.CodecEncodeSelf(e) } } - if yysep1790 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -21841,24 +27679,25 @@ func (x *ServiceStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1794 := z.DecBinary() - _ = yym1794 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1795 := r.ReadMapStart() - if yyl1795 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1795, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1795 := r.ReadArrayStart() - if yyl1795 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1795, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -21870,12 +27709,12 @@ func (x *ServiceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1796Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1796Slc - var yyhl1796 bool = l >= 0 - for yyj1796 := 0; ; yyj1796++ { - if yyhl1796 { - if yyj1796 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -21883,61 +27722,63 @@ func (x *ServiceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1796Slc = r.DecodeBytes(yys1796Slc, true, true) - yys1796 := string(yys1796Slc) - switch yys1796 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "loadBalancer": if r.TryDecodeAsNil() { x.LoadBalancer = LoadBalancerStatus{} } else { - yyv1797 := &x.LoadBalancer - yyv1797.CodecDecodeSelf(d) + yyv4 := &x.LoadBalancer + yyv4.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys1796) - } // end switch yys1796 - } // end for yyj1796 - if !yyhl1796 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1798 int - var yyb1798 bool - var yyhl1798 bool = l >= 0 - yyj1798++ - if yyhl1798 { - yyb1798 = yyj1798 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb1798 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb1798 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LoadBalancer = LoadBalancerStatus{} } else { - yyv1799 := &x.LoadBalancer - yyv1799.CodecDecodeSelf(d) + yyv6 := &x.LoadBalancer + yyv6.CodecDecodeSelf(d) } for { - yyj1798++ - if yyhl1798 { - yyb1798 = yyj1798 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb1798 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb1798 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj1798-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LoadBalancerStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -21947,35 +27788,38 @@ func (x *LoadBalancerStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1800 := z.EncBinary() - _ = yym1800 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1801 := !z.EncBinary() - yy2arr1801 := z.EncBasicHandle().StructToArray - var yyq1801 [1]bool - _, _, _ = yysep1801, yyq1801, yy2arr1801 - const yyr1801 bool = false - yyq1801[0] = len(x.Ingress) != 0 - if yyr1801 || yy2arr1801 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Ingress) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn1801 int = 0 - for _, b := range yyq1801 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1801++ + yynn2++ } } - r.EncodeMapStart(yynn1801) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1801 || yy2arr1801 { - if yyq1801[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Ingress == nil { r.EncodeNil() } else { - yym1803 := z.EncBinary() - _ = yym1803 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceLoadBalancerIngress(([]LoadBalancerIngress)(x.Ingress), e) @@ -21985,13 +27829,15 @@ func (x *LoadBalancerStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1801[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ingress")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Ingress == nil { r.EncodeNil() } else { - yym1804 := z.EncBinary() - _ = yym1804 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceLoadBalancerIngress(([]LoadBalancerIngress)(x.Ingress), e) @@ -21999,8 +27845,10 @@ func (x *LoadBalancerStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1801 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -22010,24 +27858,25 @@ func (x *LoadBalancerStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1805 := z.DecBinary() - _ = yym1805 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1806 := r.ReadMapStart() - if yyl1806 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1806, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1806 := r.ReadArrayStart() - if yyl1806 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1806, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -22039,12 +27888,12 @@ func (x *LoadBalancerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1807Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1807Slc - var yyhl1807 bool = l >= 0 - for yyj1807 := 0; ; yyj1807++ { - if yyhl1807 { - if yyj1807 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -22052,71 +27901,73 @@ func (x *LoadBalancerStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys1807Slc = r.DecodeBytes(yys1807Slc, true, true) - yys1807 := string(yys1807Slc) - switch yys1807 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "ingress": if r.TryDecodeAsNil() { x.Ingress = nil } else { - yyv1808 := &x.Ingress - yym1809 := z.DecBinary() - _ = yym1809 + yyv4 := &x.Ingress + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceLoadBalancerIngress((*[]LoadBalancerIngress)(yyv1808), d) + h.decSliceLoadBalancerIngress((*[]LoadBalancerIngress)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys1807) - } // end switch yys1807 - } // end for yyj1807 - if !yyhl1807 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LoadBalancerStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1810 int - var yyb1810 bool - var yyhl1810 bool = l >= 0 - yyj1810++ - if yyhl1810 { - yyb1810 = yyj1810 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1810 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1810 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ingress = nil } else { - yyv1811 := &x.Ingress - yym1812 := z.DecBinary() - _ = yym1812 + yyv7 := &x.Ingress + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceLoadBalancerIngress((*[]LoadBalancerIngress)(yyv1811), d) + h.decSliceLoadBalancerIngress((*[]LoadBalancerIngress)(yyv7), d) } } for { - yyj1810++ - if yyhl1810 { - yyb1810 = yyj1810 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1810 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1810 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1810-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LoadBalancerIngress) CodecEncodeSelf(e *codec1978.Encoder) { @@ -22126,33 +27977,36 @@ func (x *LoadBalancerIngress) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1813 := z.EncBinary() - _ = yym1813 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1814 := !z.EncBinary() - yy2arr1814 := z.EncBasicHandle().StructToArray - var yyq1814 [2]bool - _, _, _ = yysep1814, yyq1814, yy2arr1814 - const yyr1814 bool = false - yyq1814[0] = x.IP != "" - yyq1814[1] = x.Hostname != "" - if yyr1814 || yy2arr1814 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.IP != "" + yyq2[1] = x.Hostname != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn1814 int = 0 - for _, b := range yyq1814 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1814++ + yynn2++ } } - r.EncodeMapStart(yynn1814) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1814 || yy2arr1814 { - if yyq1814[0] { - yym1816 := z.EncBinary() - _ = yym1816 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IP)) @@ -22161,20 +28015,23 @@ func (x *LoadBalancerIngress) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1814[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ip")) - yym1817 := z.EncBinary() - _ = yym1817 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IP)) } } } - if yyr1814 || yy2arr1814 { - if yyq1814[1] { - yym1819 := z.EncBinary() - _ = yym1819 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Hostname)) @@ -22183,18 +28040,22 @@ func (x *LoadBalancerIngress) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1814[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hostname")) - yym1820 := z.EncBinary() - _ = yym1820 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Hostname)) } } } - if yysep1814 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -22204,24 +28065,25 @@ func (x *LoadBalancerIngress) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1821 := z.DecBinary() - _ = yym1821 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1822 := r.ReadMapStart() - if yyl1822 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1822, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1822 := r.ReadArrayStart() - if yyl1822 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1822, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -22233,12 +28095,12 @@ func (x *LoadBalancerIngress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1823Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1823Slc - var yyhl1823 bool = l >= 0 - for yyj1823 := 0; ; yyj1823++ { - if yyhl1823 { - if yyj1823 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -22246,9 +28108,11 @@ func (x *LoadBalancerIngress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys1823Slc = r.DecodeBytes(yys1823Slc, true, true) - yys1823 := string(yys1823Slc) - switch yys1823 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "ip": if r.TryDecodeAsNil() { x.IP = "" @@ -22262,64 +28126,65 @@ func (x *LoadBalancerIngress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder x.Hostname = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1823) - } // end switch yys1823 - } // end for yyj1823 - if !yyhl1823 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LoadBalancerIngress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1826 int - var yyb1826 bool - var yyhl1826 bool = l >= 0 - yyj1826++ - if yyhl1826 { - yyb1826 = yyj1826 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1826 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1826 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.IP = "" } else { x.IP = string(r.DecodeString()) } - yyj1826++ - if yyhl1826 { - yyb1826 = yyj1826 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1826 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1826 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Hostname = "" } else { x.Hostname = string(r.DecodeString()) } for { - yyj1826++ - if yyhl1826 { - yyb1826 = yyj1826 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1826 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1826 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1826-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -22329,65 +28194,71 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1829 := z.EncBinary() - _ = yym1829 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1830 := !z.EncBinary() - yy2arr1830 := z.EncBasicHandle().StructToArray - var yyq1830 [8]bool - _, _, _ = yysep1830, yyq1830, yy2arr1830 - const yyr1830 bool = false - yyq1830[1] = len(x.Selector) != 0 - yyq1830[2] = x.ClusterIP != "" - yyq1830[3] = x.Type != "" - yyq1830[4] = len(x.ExternalIPs) != 0 - yyq1830[5] = len(x.DeprecatedPublicIPs) != 0 - yyq1830[6] = x.SessionAffinity != "" - yyq1830[7] = x.LoadBalancerIP != "" - if yyr1830 || yy2arr1830 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = len(x.Selector) != 0 + yyq2[2] = x.ClusterIP != "" + yyq2[3] = x.Type != "" + yyq2[4] = len(x.ExternalIPs) != 0 + yyq2[5] = len(x.DeprecatedPublicIPs) != 0 + yyq2[6] = x.SessionAffinity != "" + yyq2[7] = x.LoadBalancerIP != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - var yynn1830 int = 1 - for _, b := range yyq1830 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1830++ + yynn2++ } } - r.EncodeMapStart(yynn1830) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1830 || yy2arr1830 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Ports == nil { r.EncodeNil() } else { - yym1832 := z.EncBinary() - _ = yym1832 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceServicePort(([]ServicePort)(x.Ports), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ports")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Ports == nil { r.EncodeNil() } else { - yym1833 := z.EncBinary() - _ = yym1833 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceServicePort(([]ServicePort)(x.Ports), e) } } } - if yyr1830 || yy2arr1830 { - if yyq1830[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Selector == nil { r.EncodeNil() } else { - yym1835 := z.EncBinary() - _ = yym1835 + yym7 := z.EncBinary() + _ = yym7 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) @@ -22397,13 +28268,15 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1830[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym1836 := z.EncBinary() - _ = yym1836 + yym8 := z.EncBinary() + _ = yym8 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) @@ -22411,10 +28284,11 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1830 || yy2arr1830 { - if yyq1830[2] { - yym1838 := z.EncBinary() - _ = yym1838 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ClusterIP)) @@ -22423,35 +28297,41 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1830[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("clusterIP")) - yym1839 := z.EncBinary() - _ = yym1839 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ClusterIP)) } } } - if yyr1830 || yy2arr1830 { - if yyq1830[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { x.Type.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1830[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } } - if yyr1830 || yy2arr1830 { - if yyq1830[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.ExternalIPs == nil { r.EncodeNil() } else { - yym1842 := z.EncBinary() - _ = yym1842 + yym16 := z.EncBinary() + _ = yym16 if false { } else { z.F.EncSliceStringV(x.ExternalIPs, false, e) @@ -22461,13 +28341,15 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1830[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("externalIPs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ExternalIPs == nil { r.EncodeNil() } else { - yym1843 := z.EncBinary() - _ = yym1843 + yym17 := z.EncBinary() + _ = yym17 if false { } else { z.F.EncSliceStringV(x.ExternalIPs, false, e) @@ -22475,13 +28357,14 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1830 || yy2arr1830 { - if yyq1830[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.DeprecatedPublicIPs == nil { r.EncodeNil() } else { - yym1845 := z.EncBinary() - _ = yym1845 + yym19 := z.EncBinary() + _ = yym19 if false { } else { z.F.EncSliceStringV(x.DeprecatedPublicIPs, false, e) @@ -22491,13 +28374,15 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1830[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("deprecatedPublicIPs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.DeprecatedPublicIPs == nil { r.EncodeNil() } else { - yym1846 := z.EncBinary() - _ = yym1846 + yym20 := z.EncBinary() + _ = yym20 if false { } else { z.F.EncSliceStringV(x.DeprecatedPublicIPs, false, e) @@ -22505,22 +28390,26 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1830 || yy2arr1830 { - if yyq1830[6] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { x.SessionAffinity.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1830[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("sessionAffinity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.SessionAffinity.CodecEncodeSelf(e) } } - if yyr1830 || yy2arr1830 { - if yyq1830[7] { - yym1849 := z.EncBinary() - _ = yym1849 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym25 := z.EncBinary() + _ = yym25 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.LoadBalancerIP)) @@ -22529,18 +28418,22 @@ func (x *ServiceSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1830[7] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("loadBalancerIP")) - yym1850 := z.EncBinary() - _ = yym1850 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.LoadBalancerIP)) } } } - if yysep1830 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -22550,24 +28443,25 @@ func (x *ServiceSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1851 := z.DecBinary() - _ = yym1851 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1852 := r.ReadMapStart() - if yyl1852 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1852, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1852 := r.ReadArrayStart() - if yyl1852 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1852, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -22579,12 +28473,12 @@ func (x *ServiceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1853Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1853Slc - var yyhl1853 bool = l >= 0 - for yyj1853 := 0; ; yyj1853++ { - if yyhl1853 { - if yyj1853 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -22592,31 +28486,33 @@ func (x *ServiceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1853Slc = r.DecodeBytes(yys1853Slc, true, true) - yys1853 := string(yys1853Slc) - switch yys1853 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "ports": if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv1854 := &x.Ports - yym1855 := z.DecBinary() - _ = yym1855 + yyv4 := &x.Ports + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceServicePort((*[]ServicePort)(yyv1854), d) + h.decSliceServicePort((*[]ServicePort)(yyv4), d) } } case "selector": if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv1856 := &x.Selector - yym1857 := z.DecBinary() - _ = yym1857 + yyv6 := &x.Selector + yym7 := z.DecBinary() + _ = yym7 if false { } else { - z.F.DecMapStringStringX(yyv1856, false, d) + z.F.DecMapStringStringX(yyv6, false, d) } } case "clusterIP": @@ -22635,24 +28531,24 @@ func (x *ServiceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.ExternalIPs = nil } else { - yyv1860 := &x.ExternalIPs - yym1861 := z.DecBinary() - _ = yym1861 + yyv10 := &x.ExternalIPs + yym11 := z.DecBinary() + _ = yym11 if false { } else { - z.F.DecSliceStringX(yyv1860, false, d) + z.F.DecSliceStringX(yyv10, false, d) } } case "deprecatedPublicIPs": if r.TryDecodeAsNil() { x.DeprecatedPublicIPs = nil } else { - yyv1862 := &x.DeprecatedPublicIPs - yym1863 := z.DecBinary() - _ = yym1863 + yyv12 := &x.DeprecatedPublicIPs + yym13 := z.DecBinary() + _ = yym13 if false { } else { - z.F.DecSliceStringX(yyv1862, false, d) + z.F.DecSliceStringX(yyv12, false, d) } } case "sessionAffinity": @@ -22668,178 +28564,185 @@ func (x *ServiceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.LoadBalancerIP = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys1853) - } // end switch yys1853 - } // end for yyj1853 - if !yyhl1853 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1866 int - var yyb1866 bool - var yyhl1866 bool = l >= 0 - yyj1866++ - if yyhl1866 { - yyb1866 = yyj1866 > l + var yyj16 int + var yyb16 bool + var yyhl16 bool = l >= 0 + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1866 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1866 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv1867 := &x.Ports - yym1868 := z.DecBinary() - _ = yym1868 + yyv17 := &x.Ports + yym18 := z.DecBinary() + _ = yym18 if false { } else { - h.decSliceServicePort((*[]ServicePort)(yyv1867), d) + h.decSliceServicePort((*[]ServicePort)(yyv17), d) } } - yyj1866++ - if yyhl1866 { - yyb1866 = yyj1866 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1866 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1866 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv1869 := &x.Selector - yym1870 := z.DecBinary() - _ = yym1870 + yyv19 := &x.Selector + yym20 := z.DecBinary() + _ = yym20 if false { } else { - z.F.DecMapStringStringX(yyv1869, false, d) + z.F.DecMapStringStringX(yyv19, false, d) } } - yyj1866++ - if yyhl1866 { - yyb1866 = yyj1866 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1866 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1866 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ClusterIP = "" } else { x.ClusterIP = string(r.DecodeString()) } - yyj1866++ - if yyhl1866 { - yyb1866 = yyj1866 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1866 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1866 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = ServiceType(r.DecodeString()) } - yyj1866++ - if yyhl1866 { - yyb1866 = yyj1866 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1866 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1866 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ExternalIPs = nil } else { - yyv1873 := &x.ExternalIPs - yym1874 := z.DecBinary() - _ = yym1874 + yyv23 := &x.ExternalIPs + yym24 := z.DecBinary() + _ = yym24 if false { } else { - z.F.DecSliceStringX(yyv1873, false, d) + z.F.DecSliceStringX(yyv23, false, d) } } - yyj1866++ - if yyhl1866 { - yyb1866 = yyj1866 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1866 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1866 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DeprecatedPublicIPs = nil } else { - yyv1875 := &x.DeprecatedPublicIPs - yym1876 := z.DecBinary() - _ = yym1876 + yyv25 := &x.DeprecatedPublicIPs + yym26 := z.DecBinary() + _ = yym26 if false { } else { - z.F.DecSliceStringX(yyv1875, false, d) + z.F.DecSliceStringX(yyv25, false, d) } } - yyj1866++ - if yyhl1866 { - yyb1866 = yyj1866 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1866 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1866 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SessionAffinity = "" } else { x.SessionAffinity = ServiceAffinity(r.DecodeString()) } - yyj1866++ - if yyhl1866 { - yyb1866 = yyj1866 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1866 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1866 { - r.ReadEnd() + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LoadBalancerIP = "" } else { x.LoadBalancerIP = string(r.DecodeString()) } for { - yyj1866++ - if yyhl1866 { - yyb1866 = yyj1866 > l + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l } else { - yyb1866 = r.CheckBreak() + yyb16 = r.CheckBreak() } - if yyb1866 { + if yyb16 { break } - z.DecStructFieldNotFound(yyj1866-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj16-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServicePort) CodecEncodeSelf(e *codec1978.Encoder) { @@ -22849,35 +28752,38 @@ func (x *ServicePort) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1879 := z.EncBinary() - _ = yym1879 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1880 := !z.EncBinary() - yy2arr1880 := z.EncBasicHandle().StructToArray - var yyq1880 [5]bool - _, _, _ = yysep1880, yyq1880, yy2arr1880 - const yyr1880 bool = false - yyq1880[0] = x.Name != "" - yyq1880[1] = x.Protocol != "" - yyq1880[3] = true - yyq1880[4] = x.NodePort != 0 - if yyr1880 || yy2arr1880 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Name != "" + yyq2[1] = x.Protocol != "" + yyq2[3] = true + yyq2[4] = x.NodePort != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1880 int = 1 - for _, b := range yyq1880 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1880++ + yynn2++ } } - r.EncodeMapStart(yynn1880) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1880 || yy2arr1880 { - if yyq1880[0] { - yym1882 := z.EncBinary() - _ = yym1882 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -22886,78 +28792,90 @@ func (x *ServicePort) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1880[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym1883 := z.EncBinary() - _ = yym1883 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr1880 || yy2arr1880 { - if yyq1880[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { x.Protocol.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq1880[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("protocol")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Protocol.CodecEncodeSelf(e) } } - if yyr1880 || yy2arr1880 { - yym1886 := z.EncBinary() - _ = yym1886 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.Port)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("port")) - yym1887 := z.EncBinary() - _ = yym1887 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.Port)) } } - if yyr1880 || yy2arr1880 { - if yyq1880[3] { - yy1889 := &x.TargetPort - yym1890 := z.EncBinary() - _ = yym1890 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yy13 := &x.TargetPort + yym14 := z.EncBinary() + _ = yym14 if false { - } else if z.HasExtensions() && z.EncExt(yy1889) { - } else if !yym1890 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1889) + } else if z.HasExtensions() && z.EncExt(yy13) { + } else if !yym14 && z.IsJSONHandle() { + z.EncJSONMarshal(yy13) } else { - z.EncFallback(yy1889) + z.EncFallback(yy13) } } else { r.EncodeNil() } } else { - if yyq1880[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("targetPort")) - yy1891 := &x.TargetPort - yym1892 := z.EncBinary() - _ = yym1892 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy15 := &x.TargetPort + yym16 := z.EncBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.EncExt(yy1891) { - } else if !yym1892 && z.IsJSONHandle() { - z.EncJSONMarshal(yy1891) + } else if z.HasExtensions() && z.EncExt(yy15) { + } else if !yym16 && z.IsJSONHandle() { + z.EncJSONMarshal(yy15) } else { - z.EncFallback(yy1891) + z.EncFallback(yy15) } } } - if yyr1880 || yy2arr1880 { - if yyq1880[4] { - yym1894 := z.EncBinary() - _ = yym1894 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 if false { } else { r.EncodeInt(int64(x.NodePort)) @@ -22966,18 +28884,22 @@ func (x *ServicePort) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq1880[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nodePort")) - yym1895 := z.EncBinary() - _ = yym1895 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeInt(int64(x.NodePort)) } } } - if yysep1880 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -22987,24 +28909,25 @@ func (x *ServicePort) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1896 := z.DecBinary() - _ = yym1896 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1897 := r.ReadMapStart() - if yyl1897 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1897, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1897 := r.ReadArrayStart() - if yyl1897 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1897, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -23016,12 +28939,12 @@ func (x *ServicePort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1898Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1898Slc - var yyhl1898 bool = l >= 0 - for yyj1898 := 0; ; yyj1898++ { - if yyhl1898 { - if yyj1898 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -23029,9 +28952,11 @@ func (x *ServicePort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1898Slc = r.DecodeBytes(yys1898Slc, true, true) - yys1898 := string(yys1898Slc) - switch yys1898 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -23048,142 +28973,146 @@ func (x *ServicePort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Port = 0 } else { - x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + x.Port = int32(r.DecodeInt(32)) } case "targetPort": if r.TryDecodeAsNil() { - x.TargetPort = pkg5_util.IntOrString{} + x.TargetPort = pkg5_intstr.IntOrString{} } else { - yyv1902 := &x.TargetPort - yym1903 := z.DecBinary() - _ = yym1903 + yyv7 := &x.TargetPort + yym8 := z.DecBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.DecExt(yyv1902) { - } else if !yym1903 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1902) + } else if z.HasExtensions() && z.DecExt(yyv7) { + } else if !yym8 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv7) } else { - z.DecFallback(yyv1902, false) + z.DecFallback(yyv7, false) } } case "nodePort": if r.TryDecodeAsNil() { x.NodePort = 0 } else { - x.NodePort = int(r.DecodeInt(codecSelferBitsize1234)) + x.NodePort = int32(r.DecodeInt(32)) } default: - z.DecStructFieldNotFound(-1, yys1898) - } // end switch yys1898 - } // end for yyj1898 - if !yyhl1898 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServicePort) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1905 int - var yyb1905 bool - var yyhl1905 bool = l >= 0 - yyj1905++ - if yyhl1905 { - yyb1905 = yyj1905 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1905 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1905 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj1905++ - if yyhl1905 { - yyb1905 = yyj1905 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1905 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1905 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Protocol = "" } else { x.Protocol = Protocol(r.DecodeString()) } - yyj1905++ - if yyhl1905 { - yyb1905 = yyj1905 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1905 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1905 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Port = 0 } else { - x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + x.Port = int32(r.DecodeInt(32)) } - yyj1905++ - if yyhl1905 { - yyb1905 = yyj1905 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1905 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1905 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.TargetPort = pkg5_util.IntOrString{} + x.TargetPort = pkg5_intstr.IntOrString{} } else { - yyv1909 := &x.TargetPort - yym1910 := z.DecBinary() - _ = yym1910 + yyv14 := &x.TargetPort + yym15 := z.DecBinary() + _ = yym15 if false { - } else if z.HasExtensions() && z.DecExt(yyv1909) { - } else if !yym1910 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv1909) + } else if z.HasExtensions() && z.DecExt(yyv14) { + } else if !yym15 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv14) } else { - z.DecFallback(yyv1909, false) + z.DecFallback(yyv14, false) } } - yyj1905++ - if yyhl1905 { - yyb1905 = yyj1905 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1905 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1905 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NodePort = 0 } else { - x.NodePort = int(r.DecodeInt(codecSelferBitsize1234)) + x.NodePort = int32(r.DecodeInt(32)) } for { - yyj1905++ - if yyhl1905 { - yyb1905 = yyj1905 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1905 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1905 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1905-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Service) CodecEncodeSelf(e *codec1978.Encoder) { @@ -23193,120 +29122,139 @@ func (x *Service) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1912 := z.EncBinary() - _ = yym1912 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1913 := !z.EncBinary() - yy2arr1913 := z.EncBasicHandle().StructToArray - var yyq1913 [5]bool - _, _, _ = yysep1913, yyq1913, yy2arr1913 - const yyr1913 bool = false - yyq1913[0] = x.Kind != "" - yyq1913[1] = x.APIVersion != "" - yyq1913[2] = true - yyq1913[3] = true - yyq1913[4] = true - if yyr1913 || yy2arr1913 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1913 int = 0 - for _, b := range yyq1913 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1913++ + yynn2++ } } - r.EncodeMapStart(yynn1913) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1913 || yy2arr1913 { - if yyq1913[0] { - yym1915 := z.EncBinary() - _ = yym1915 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1913[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1916 := z.EncBinary() - _ = yym1916 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1913 || yy2arr1913 { - if yyq1913[1] { - yym1918 := z.EncBinary() - _ = yym1918 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1913[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1919 := z.EncBinary() - _ = yym1919 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1913 || yy2arr1913 { - if yyq1913[2] { - yy1921 := &x.ObjectMeta - yy1921.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1913[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1922 := &x.ObjectMeta - yy1922.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1913 || yy2arr1913 { - if yyq1913[3] { - yy1924 := &x.Spec - yy1924.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1913[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1925 := &x.Spec - yy1925.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr1913 || yy2arr1913 { - if yyq1913[4] { - yy1927 := &x.Status - yy1927.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1913[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy1928 := &x.Status - yy1928.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep1913 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -23316,24 +29264,25 @@ func (x *Service) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1929 := z.DecBinary() - _ = yym1929 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1930 := r.ReadMapStart() - if yyl1930 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1930, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1930 := r.ReadArrayStart() - if yyl1930 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1930, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -23345,12 +29294,12 @@ func (x *Service) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1931Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1931Slc - var yyhl1931 bool = l >= 0 - for yyj1931 := 0; ; yyj1931++ { - if yyhl1931 { - if yyj1931 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -23358,9 +29307,32 @@ func (x *Service) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1931Slc = r.DecodeBytes(yys1931Slc, true, true) - yys1931 := string(yys1931Slc) - switch yys1931 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ServiceSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ServiceStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -23373,134 +29345,117 @@ func (x *Service) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1934 := &x.ObjectMeta - yyv1934.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ServiceSpec{} - } else { - yyv1935 := &x.Spec - yyv1935.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = ServiceStatus{} - } else { - yyv1936 := &x.Status - yyv1936.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1931) - } // end switch yys1931 - } // end for yyj1931 - if !yyhl1931 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Service) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1937 int - var yyb1937 bool - var yyhl1937 bool = l >= 0 - yyj1937++ - if yyhl1937 { - yyb1937 = yyj1937 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1937 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1937 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ServiceSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ServiceStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1937++ - if yyhl1937 { - yyb1937 = yyj1937 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1937 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1937 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1937++ - if yyhl1937 { - yyb1937 = yyj1937 > l - } else { - yyb1937 = r.CheckBreak() - } - if yyb1937 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1940 := &x.ObjectMeta - yyv1940.CodecDecodeSelf(d) - } - yyj1937++ - if yyhl1937 { - yyb1937 = yyj1937 > l - } else { - yyb1937 = r.CheckBreak() - } - if yyb1937 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ServiceSpec{} - } else { - yyv1941 := &x.Spec - yyv1941.CodecDecodeSelf(d) - } - yyj1937++ - if yyhl1937 { - yyb1937 = yyj1937 > l - } else { - yyb1937 = r.CheckBreak() - } - if yyb1937 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = ServiceStatus{} - } else { - yyv1942 := &x.Status - yyv1942.CodecDecodeSelf(d) - } for { - yyj1937++ - if yyhl1937 { - yyb1937 = yyj1937 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb1937 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb1937 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj1937-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServiceList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -23510,126 +29465,142 @@ func (x *ServiceList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1943 := z.EncBinary() - _ = yym1943 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1944 := !z.EncBinary() - yy2arr1944 := z.EncBasicHandle().StructToArray - var yyq1944 [4]bool - _, _, _ = yysep1944, yyq1944, yy2arr1944 - const yyr1944 bool = false - yyq1944[0] = x.Kind != "" - yyq1944[1] = x.APIVersion != "" - yyq1944[2] = true - if yyr1944 || yy2arr1944 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1944 int = 1 - for _, b := range yyq1944 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1944++ + yynn2++ } } - r.EncodeMapStart(yynn1944) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1944 || yy2arr1944 { - if yyq1944[0] { - yym1946 := z.EncBinary() - _ = yym1946 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1944[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1947 := z.EncBinary() - _ = yym1947 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1944 || yy2arr1944 { - if yyq1944[1] { - yym1949 := z.EncBinary() - _ = yym1949 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1944[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1950 := z.EncBinary() - _ = yym1950 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1944 || yy2arr1944 { - if yyq1944[2] { - yy1952 := &x.ListMeta - yym1953 := z.EncBinary() - _ = yym1953 - if false { - } else if z.HasExtensions() && z.EncExt(yy1952) { - } else { - z.EncFallback(yy1952) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1944[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1954 := &x.ListMeta - yym1955 := z.EncBinary() - _ = yym1955 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1954) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1954) + z.EncFallback(yy6) } } } - if yyr1944 || yy2arr1944 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1957 := z.EncBinary() - _ = yym1957 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceService(([]Service)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1958 := z.EncBinary() - _ = yym1958 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceService(([]Service)(x.Items), e) } } } - if yysep1944 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -23639,24 +29610,25 @@ func (x *ServiceList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1959 := z.DecBinary() - _ = yym1959 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1960 := r.ReadMapStart() - if yyl1960 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1960, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1960 := r.ReadArrayStart() - if yyl1960 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1960, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -23668,12 +29640,12 @@ func (x *ServiceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1961Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1961Slc - var yyhl1961 bool = l >= 0 - for yyj1961 := 0; ; yyj1961++ { - if yyhl1961 { - if yyj1961 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -23681,9 +29653,36 @@ func (x *ServiceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1961Slc = r.DecodeBytes(yys1961Slc, true, true) - yys1961 := string(yys1961Slc) - switch yys1961 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceService((*[]Service)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -23696,133 +29695,111 @@ func (x *ServiceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1964 := &x.ListMeta - yym1965 := z.DecBinary() - _ = yym1965 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1964) { - } else { - z.DecFallback(yyv1964, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1966 := &x.Items - yym1967 := z.DecBinary() - _ = yym1967 - if false { - } else { - h.decSliceService((*[]Service)(yyv1966), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1961) - } // end switch yys1961 - } // end for yyj1961 - if !yyhl1961 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1968 int - var yyb1968 bool - var yyhl1968 bool = l >= 0 - yyj1968++ - if yyhl1968 { - yyb1968 = yyj1968 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1968 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1968 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceService((*[]Service)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1968++ - if yyhl1968 { - yyb1968 = yyj1968 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1968 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1968 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1968++ - if yyhl1968 { - yyb1968 = yyj1968 > l - } else { - yyb1968 = r.CheckBreak() - } - if yyb1968 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv1971 := &x.ListMeta - yym1972 := z.DecBinary() - _ = yym1972 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1971) { - } else { - z.DecFallback(yyv1971, false) - } - } - yyj1968++ - if yyhl1968 { - yyb1968 = yyj1968 > l - } else { - yyb1968 = r.CheckBreak() - } - if yyb1968 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1973 := &x.Items - yym1974 := z.DecBinary() - _ = yym1974 - if false { - } else { - h.decSliceService((*[]Service)(yyv1973), d) - } - } for { - yyj1968++ - if yyhl1968 { - yyb1968 = yyj1968 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1968 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1968 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1968-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { @@ -23832,97 +29809,59 @@ func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1975 := z.EncBinary() - _ = yym1975 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1976 := !z.EncBinary() - yy2arr1976 := z.EncBasicHandle().StructToArray - var yyq1976 [5]bool - _, _, _ = yysep1976, yyq1976, yy2arr1976 - const yyr1976 bool = false - yyq1976[0] = x.Kind != "" - yyq1976[1] = x.APIVersion != "" - yyq1976[2] = true - yyq1976[3] = len(x.Secrets) != 0 - yyq1976[4] = len(x.ImagePullSecrets) != 0 - if yyr1976 || yy2arr1976 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Secrets) != 0 + yyq2[2] = len(x.ImagePullSecrets) != 0 + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn1976 int = 0 - for _, b := range yyq1976 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1976++ + yynn2++ } } - r.EncodeMapStart(yynn1976) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1976 || yy2arr1976 { - if yyq1976[0] { - yym1978 := z.EncBinary() - _ = yym1978 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1976[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1979 := z.EncBinary() - _ = yym1979 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1976 || yy2arr1976 { - if yyq1976[1] { - yym1981 := z.EncBinary() - _ = yym1981 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1976[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1982 := z.EncBinary() - _ = yym1982 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1976 || yy2arr1976 { - if yyq1976[2] { - yy1984 := &x.ObjectMeta - yy1984.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1976[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1985 := &x.ObjectMeta - yy1985.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1976 || yy2arr1976 { - if yyq1976[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Secrets == nil { r.EncodeNil() } else { - yym1987 := z.EncBinary() - _ = yym1987 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceObjectReference(([]ObjectReference)(x.Secrets), e) @@ -23932,13 +29871,15 @@ func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1976[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("secrets")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Secrets == nil { r.EncodeNil() } else { - yym1988 := z.EncBinary() - _ = yym1988 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceObjectReference(([]ObjectReference)(x.Secrets), e) @@ -23946,13 +29887,14 @@ func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr1976 || yy2arr1976 { - if yyq1976[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.ImagePullSecrets == nil { r.EncodeNil() } else { - yym1990 := z.EncBinary() - _ = yym1990 + yym12 := z.EncBinary() + _ = yym12 if false { } else { h.encSliceLocalObjectReference(([]LocalObjectReference)(x.ImagePullSecrets), e) @@ -23962,13 +29904,15 @@ func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1976[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("imagePullSecrets")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ImagePullSecrets == nil { r.EncodeNil() } else { - yym1991 := z.EncBinary() - _ = yym1991 + yym13 := z.EncBinary() + _ = yym13 if false { } else { h.encSliceLocalObjectReference(([]LocalObjectReference)(x.ImagePullSecrets), e) @@ -23976,8 +29920,60 @@ func (x *ServiceAccount) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1976 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -23987,24 +29983,25 @@ func (x *ServiceAccount) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1992 := z.DecBinary() - _ = yym1992 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1993 := r.ReadMapStart() - if yyl1993 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1993, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1993 := r.ReadArrayStart() - if yyl1993 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1993, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -24016,12 +30013,12 @@ func (x *ServiceAccount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1994Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1994Slc - var yyhl1994 bool = l >= 0 - for yyj1994 := 0; ; yyj1994++ { - if yyhl1994 { - if yyj1994 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -24029,9 +30026,42 @@ func (x *ServiceAccount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1994Slc = r.DecodeBytes(yys1994Slc, true, true) - yys1994 := string(yys1994Slc) - switch yys1994 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "secrets": + if r.TryDecodeAsNil() { + x.Secrets = nil + } else { + yyv5 := &x.Secrets + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceObjectReference((*[]ObjectReference)(yyv5), d) + } + } + case "imagePullSecrets": + if r.TryDecodeAsNil() { + x.ImagePullSecrets = nil + } else { + yyv7 := &x.ImagePullSecrets + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv7), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -24044,154 +30074,127 @@ func (x *ServiceAccount) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv1997 := &x.ObjectMeta - yyv1997.CodecDecodeSelf(d) - } - case "secrets": - if r.TryDecodeAsNil() { - x.Secrets = nil - } else { - yyv1998 := &x.Secrets - yym1999 := z.DecBinary() - _ = yym1999 - if false { - } else { - h.decSliceObjectReference((*[]ObjectReference)(yyv1998), d) - } - } - case "imagePullSecrets": - if r.TryDecodeAsNil() { - x.ImagePullSecrets = nil - } else { - yyv2000 := &x.ImagePullSecrets - yym2001 := z.DecBinary() - _ = yym2001 - if false { - } else { - h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv2000), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1994) - } // end switch yys1994 - } // end for yyj1994 - if !yyhl1994 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceAccount) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2002 int - var yyb2002 bool - var yyhl2002 bool = l >= 0 - yyj2002++ - if yyhl2002 { - yyb2002 = yyj2002 > l + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2002 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2002 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv12 := &x.ObjectMeta + yyv12.CodecDecodeSelf(d) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Secrets = nil + } else { + yyv13 := &x.Secrets + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceObjectReference((*[]ObjectReference)(yyv13), d) + } + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ImagePullSecrets = nil + } else { + yyv15 := &x.ImagePullSecrets + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv15), d) + } + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2002++ - if yyhl2002 { - yyb2002 = yyj2002 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2002 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2002 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2002++ - if yyhl2002 { - yyb2002 = yyj2002 > l - } else { - yyb2002 = r.CheckBreak() - } - if yyb2002 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2005 := &x.ObjectMeta - yyv2005.CodecDecodeSelf(d) - } - yyj2002++ - if yyhl2002 { - yyb2002 = yyj2002 > l - } else { - yyb2002 = r.CheckBreak() - } - if yyb2002 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Secrets = nil - } else { - yyv2006 := &x.Secrets - yym2007 := z.DecBinary() - _ = yym2007 - if false { - } else { - h.decSliceObjectReference((*[]ObjectReference)(yyv2006), d) - } - } - yyj2002++ - if yyhl2002 { - yyb2002 = yyj2002 > l - } else { - yyb2002 = r.CheckBreak() - } - if yyb2002 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ImagePullSecrets = nil - } else { - yyv2008 := &x.ImagePullSecrets - yym2009 := z.DecBinary() - _ = yym2009 - if false { - } else { - h.decSliceLocalObjectReference((*[]LocalObjectReference)(yyv2008), d) - } - } for { - yyj2002++ - if yyhl2002 { - yyb2002 = yyj2002 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2002 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2002 { + if yyb11 { break } - z.DecStructFieldNotFound(yyj2002-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ServiceAccountList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -24201,126 +30204,142 @@ func (x *ServiceAccountList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2010 := z.EncBinary() - _ = yym2010 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2011 := !z.EncBinary() - yy2arr2011 := z.EncBasicHandle().StructToArray - var yyq2011 [4]bool - _, _, _ = yysep2011, yyq2011, yy2arr2011 - const yyr2011 bool = false - yyq2011[0] = x.Kind != "" - yyq2011[1] = x.APIVersion != "" - yyq2011[2] = true - if yyr2011 || yy2arr2011 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2011 int = 1 - for _, b := range yyq2011 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2011++ + yynn2++ } } - r.EncodeMapStart(yynn2011) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2011 || yy2arr2011 { - if yyq2011[0] { - yym2013 := z.EncBinary() - _ = yym2013 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2011[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2014 := z.EncBinary() - _ = yym2014 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2011 || yy2arr2011 { - if yyq2011[1] { - yym2016 := z.EncBinary() - _ = yym2016 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2011[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2017 := z.EncBinary() - _ = yym2017 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2011 || yy2arr2011 { - if yyq2011[2] { - yy2019 := &x.ListMeta - yym2020 := z.EncBinary() - _ = yym2020 - if false { - } else if z.HasExtensions() && z.EncExt(yy2019) { - } else { - z.EncFallback(yy2019) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2011[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2021 := &x.ListMeta - yym2022 := z.EncBinary() - _ = yym2022 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2021) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2021) + z.EncFallback(yy6) } } } - if yyr2011 || yy2arr2011 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2024 := z.EncBinary() - _ = yym2024 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceServiceAccount(([]ServiceAccount)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2025 := z.EncBinary() - _ = yym2025 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceServiceAccount(([]ServiceAccount)(x.Items), e) } } } - if yysep2011 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -24330,24 +30349,25 @@ func (x *ServiceAccountList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2026 := z.DecBinary() - _ = yym2026 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2027 := r.ReadMapStart() - if yyl2027 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2027, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2027 := r.ReadArrayStart() - if yyl2027 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2027, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -24359,12 +30379,12 @@ func (x *ServiceAccountList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2028Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2028Slc - var yyhl2028 bool = l >= 0 - for yyj2028 := 0; ; yyj2028++ { - if yyhl2028 { - if yyj2028 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -24372,9 +30392,36 @@ func (x *ServiceAccountList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys2028Slc = r.DecodeBytes(yys2028Slc, true, true) - yys2028 := string(yys2028Slc) - switch yys2028 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceServiceAccount((*[]ServiceAccount)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -24387,133 +30434,111 @@ func (x *ServiceAccountList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2031 := &x.ListMeta - yym2032 := z.DecBinary() - _ = yym2032 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2031) { - } else { - z.DecFallback(yyv2031, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2033 := &x.Items - yym2034 := z.DecBinary() - _ = yym2034 - if false { - } else { - h.decSliceServiceAccount((*[]ServiceAccount)(yyv2033), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2028) - } // end switch yys2028 - } // end for yyj2028 - if !yyhl2028 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ServiceAccountList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2035 int - var yyb2035 bool - var yyhl2035 bool = l >= 0 - yyj2035++ - if yyhl2035 { - yyb2035 = yyj2035 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2035 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2035 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceServiceAccount((*[]ServiceAccount)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2035++ - if yyhl2035 { - yyb2035 = yyj2035 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2035 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2035 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2035++ - if yyhl2035 { - yyb2035 = yyj2035 > l - } else { - yyb2035 = r.CheckBreak() - } - if yyb2035 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2038 := &x.ListMeta - yym2039 := z.DecBinary() - _ = yym2039 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2038) { - } else { - z.DecFallback(yyv2038, false) - } - } - yyj2035++ - if yyhl2035 { - yyb2035 = yyj2035 > l - } else { - yyb2035 = r.CheckBreak() - } - if yyb2035 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2040 := &x.Items - yym2041 := z.DecBinary() - _ = yym2041 - if false { - } else { - h.decSliceServiceAccount((*[]ServiceAccount)(yyv2040), d) - } - } for { - yyj2035++ - if yyhl2035 { - yyb2035 = yyj2035 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2035 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2035 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2035-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Endpoints) CodecEncodeSelf(e *codec1978.Encoder) { @@ -24523,114 +30548,130 @@ func (x *Endpoints) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2042 := z.EncBinary() - _ = yym2042 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2043 := !z.EncBinary() - yy2arr2043 := z.EncBasicHandle().StructToArray - var yyq2043 [4]bool - _, _, _ = yysep2043, yyq2043, yy2arr2043 - const yyr2043 bool = false - yyq2043[0] = x.Kind != "" - yyq2043[1] = x.APIVersion != "" - yyq2043[2] = true - if yyr2043 || yy2arr2043 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2043 int = 1 - for _, b := range yyq2043 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2043++ + yynn2++ } } - r.EncodeMapStart(yynn2043) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2043 || yy2arr2043 { - if yyq2043[0] { - yym2045 := z.EncBinary() - _ = yym2045 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2043[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2046 := z.EncBinary() - _ = yym2046 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2043 || yy2arr2043 { - if yyq2043[1] { - yym2048 := z.EncBinary() - _ = yym2048 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2043[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2049 := z.EncBinary() - _ = yym2049 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2043 || yy2arr2043 { - if yyq2043[2] { - yy2051 := &x.ObjectMeta - yy2051.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2043[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2052 := &x.ObjectMeta - yy2052.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr2043 || yy2arr2043 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Subsets == nil { r.EncodeNil() } else { - yym2054 := z.EncBinary() - _ = yym2054 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceEndpointSubset(([]EndpointSubset)(x.Subsets), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("subsets")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Subsets == nil { r.EncodeNil() } else { - yym2055 := z.EncBinary() - _ = yym2055 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceEndpointSubset(([]EndpointSubset)(x.Subsets), e) } } } - if yysep2043 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -24640,24 +30681,25 @@ func (x *Endpoints) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2056 := z.DecBinary() - _ = yym2056 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2057 := r.ReadMapStart() - if yyl2057 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2057, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2057 := r.ReadArrayStart() - if yyl2057 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2057, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -24669,12 +30711,12 @@ func (x *Endpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2058Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2058Slc - var yyhl2058 bool = l >= 0 - for yyj2058 := 0; ; yyj2058++ { - if yyhl2058 { - if yyj2058 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -24682,9 +30724,30 @@ func (x *Endpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2058Slc = r.DecodeBytes(yys2058Slc, true, true) - yys2058 := string(yys2058Slc) - switch yys2058 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "subsets": + if r.TryDecodeAsNil() { + x.Subsets = nil + } else { + yyv5 := &x.Subsets + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceEndpointSubset((*[]EndpointSubset)(yyv5), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -24697,121 +30760,105 @@ func (x *Endpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2061 := &x.ObjectMeta - yyv2061.CodecDecodeSelf(d) - } - case "subsets": - if r.TryDecodeAsNil() { - x.Subsets = nil - } else { - yyv2062 := &x.Subsets - yym2063 := z.DecBinary() - _ = yym2063 - if false { - } else { - h.decSliceEndpointSubset((*[]EndpointSubset)(yyv2062), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2058) - } // end switch yys2058 - } // end for yyj2058 - if !yyhl2058 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Endpoints) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2064 int - var yyb2064 bool - var yyhl2064 bool = l >= 0 - yyj2064++ - if yyhl2064 { - yyb2064 = yyj2064 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2064 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2064 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Subsets = nil + } else { + yyv11 := &x.Subsets + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + h.decSliceEndpointSubset((*[]EndpointSubset)(yyv11), d) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2064++ - if yyhl2064 { - yyb2064 = yyj2064 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2064 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2064 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2064++ - if yyhl2064 { - yyb2064 = yyj2064 > l - } else { - yyb2064 = r.CheckBreak() - } - if yyb2064 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2067 := &x.ObjectMeta - yyv2067.CodecDecodeSelf(d) - } - yyj2064++ - if yyhl2064 { - yyb2064 = yyj2064 > l - } else { - yyb2064 = r.CheckBreak() - } - if yyb2064 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Subsets = nil - } else { - yyv2068 := &x.Subsets - yym2069 := z.DecBinary() - _ = yym2069 - if false { - } else { - h.decSliceEndpointSubset((*[]EndpointSubset)(yyv2068), d) - } - } for { - yyj2064++ - if yyhl2064 { - yyb2064 = yyj2064 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2064 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2064 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj2064-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { @@ -24821,37 +30868,40 @@ func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2070 := z.EncBinary() - _ = yym2070 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2071 := !z.EncBinary() - yy2arr2071 := z.EncBasicHandle().StructToArray - var yyq2071 [3]bool - _, _, _ = yysep2071, yyq2071, yy2arr2071 - const yyr2071 bool = false - yyq2071[0] = len(x.Addresses) != 0 - yyq2071[1] = len(x.NotReadyAddresses) != 0 - yyq2071[2] = len(x.Ports) != 0 - if yyr2071 || yy2arr2071 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Addresses) != 0 + yyq2[1] = len(x.NotReadyAddresses) != 0 + yyq2[2] = len(x.Ports) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn2071 int = 0 - for _, b := range yyq2071 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2071++ + yynn2++ } } - r.EncodeMapStart(yynn2071) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2071 || yy2arr2071 { - if yyq2071[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Addresses == nil { r.EncodeNil() } else { - yym2073 := z.EncBinary() - _ = yym2073 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceEndpointAddress(([]EndpointAddress)(x.Addresses), e) @@ -24861,13 +30911,15 @@ func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2071[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("addresses")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Addresses == nil { r.EncodeNil() } else { - yym2074 := z.EncBinary() - _ = yym2074 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceEndpointAddress(([]EndpointAddress)(x.Addresses), e) @@ -24875,13 +30927,14 @@ func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2071 || yy2arr2071 { - if yyq2071[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.NotReadyAddresses == nil { r.EncodeNil() } else { - yym2076 := z.EncBinary() - _ = yym2076 + yym7 := z.EncBinary() + _ = yym7 if false { } else { h.encSliceEndpointAddress(([]EndpointAddress)(x.NotReadyAddresses), e) @@ -24891,13 +30944,15 @@ func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2071[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("notReadyAddresses")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.NotReadyAddresses == nil { r.EncodeNil() } else { - yym2077 := z.EncBinary() - _ = yym2077 + yym8 := z.EncBinary() + _ = yym8 if false { } else { h.encSliceEndpointAddress(([]EndpointAddress)(x.NotReadyAddresses), e) @@ -24905,13 +30960,14 @@ func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2071 || yy2arr2071 { - if yyq2071[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Ports == nil { r.EncodeNil() } else { - yym2079 := z.EncBinary() - _ = yym2079 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceEndpointPort(([]EndpointPort)(x.Ports), e) @@ -24921,13 +30977,15 @@ func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2071[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ports")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Ports == nil { r.EncodeNil() } else { - yym2080 := z.EncBinary() - _ = yym2080 + yym11 := z.EncBinary() + _ = yym11 if false { } else { h.encSliceEndpointPort(([]EndpointPort)(x.Ports), e) @@ -24935,8 +30993,10 @@ func (x *EndpointSubset) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep2071 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -24946,24 +31006,25 @@ func (x *EndpointSubset) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2081 := z.DecBinary() - _ = yym2081 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2082 := r.ReadMapStart() - if yyl2082 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2082, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2082 := r.ReadArrayStart() - if yyl2082 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2082, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -24975,12 +31036,12 @@ func (x *EndpointSubset) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2083Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2083Slc - var yyhl2083 bool = l >= 0 - for yyj2083 := 0; ; yyj2083++ { - if yyhl2083 { - if yyj2083 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -24988,137 +31049,141 @@ func (x *EndpointSubset) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2083Slc = r.DecodeBytes(yys2083Slc, true, true) - yys2083 := string(yys2083Slc) - switch yys2083 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "addresses": if r.TryDecodeAsNil() { x.Addresses = nil } else { - yyv2084 := &x.Addresses - yym2085 := z.DecBinary() - _ = yym2085 + yyv4 := &x.Addresses + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceEndpointAddress((*[]EndpointAddress)(yyv2084), d) + h.decSliceEndpointAddress((*[]EndpointAddress)(yyv4), d) } } case "notReadyAddresses": if r.TryDecodeAsNil() { x.NotReadyAddresses = nil } else { - yyv2086 := &x.NotReadyAddresses - yym2087 := z.DecBinary() - _ = yym2087 + yyv6 := &x.NotReadyAddresses + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceEndpointAddress((*[]EndpointAddress)(yyv2086), d) + h.decSliceEndpointAddress((*[]EndpointAddress)(yyv6), d) } } case "ports": if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv2088 := &x.Ports - yym2089 := z.DecBinary() - _ = yym2089 + yyv8 := &x.Ports + yym9 := z.DecBinary() + _ = yym9 if false { } else { - h.decSliceEndpointPort((*[]EndpointPort)(yyv2088), d) + h.decSliceEndpointPort((*[]EndpointPort)(yyv8), d) } } default: - z.DecStructFieldNotFound(-1, yys2083) - } // end switch yys2083 - } // end for yyj2083 - if !yyhl2083 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EndpointSubset) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2090 int - var yyb2090 bool - var yyhl2090 bool = l >= 0 - yyj2090++ - if yyhl2090 { - yyb2090 = yyj2090 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2090 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2090 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Addresses = nil } else { - yyv2091 := &x.Addresses - yym2092 := z.DecBinary() - _ = yym2092 + yyv11 := &x.Addresses + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSliceEndpointAddress((*[]EndpointAddress)(yyv2091), d) + h.decSliceEndpointAddress((*[]EndpointAddress)(yyv11), d) } } - yyj2090++ - if yyhl2090 { - yyb2090 = yyj2090 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2090 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2090 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NotReadyAddresses = nil } else { - yyv2093 := &x.NotReadyAddresses - yym2094 := z.DecBinary() - _ = yym2094 + yyv13 := &x.NotReadyAddresses + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceEndpointAddress((*[]EndpointAddress)(yyv2093), d) + h.decSliceEndpointAddress((*[]EndpointAddress)(yyv13), d) } } - yyj2090++ - if yyhl2090 { - yyb2090 = yyj2090 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2090 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2090 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Ports = nil } else { - yyv2095 := &x.Ports - yym2096 := z.DecBinary() - _ = yym2096 + yyv15 := &x.Ports + yym16 := z.DecBinary() + _ = yym16 if false { } else { - h.decSliceEndpointPort((*[]EndpointPort)(yyv2095), d) + h.decSliceEndpointPort((*[]EndpointPort)(yyv15), d) } } for { - yyj2090++ - if yyhl2090 { - yyb2090 = yyj2090 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2090 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2090 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2090-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EndpointAddress) CodecEncodeSelf(e *codec1978.Encoder) { @@ -25128,46 +31193,52 @@ func (x *EndpointAddress) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2097 := z.EncBinary() - _ = yym2097 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2098 := !z.EncBinary() - yy2arr2098 := z.EncBasicHandle().StructToArray - var yyq2098 [2]bool - _, _, _ = yysep2098, yyq2098, yy2arr2098 - const yyr2098 bool = false - yyq2098[1] = x.TargetRef != nil - if yyr2098 || yy2arr2098 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.TargetRef != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn2098 int = 1 - for _, b := range yyq2098 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2098++ + yynn2++ } } - r.EncodeMapStart(yynn2098) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2098 || yy2arr2098 { - yym2100 := z.EncBinary() - _ = yym2100 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IP)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("ip")) - yym2101 := z.EncBinary() - _ = yym2101 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.IP)) } } - if yyr2098 || yy2arr2098 { - if yyq2098[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.TargetRef == nil { r.EncodeNil() } else { @@ -25177,8 +31248,10 @@ func (x *EndpointAddress) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2098[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("targetRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TargetRef == nil { r.EncodeNil() } else { @@ -25186,8 +31259,10 @@ func (x *EndpointAddress) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep2098 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -25197,24 +31272,25 @@ func (x *EndpointAddress) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2103 := z.DecBinary() - _ = yym2103 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2104 := r.ReadMapStart() - if yyl2104 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2104, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2104 := r.ReadArrayStart() - if yyl2104 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2104, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -25226,12 +31302,12 @@ func (x *EndpointAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2105Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2105Slc - var yyhl2105 bool = l >= 0 - for yyj2105 := 0; ; yyj2105++ { - if yyhl2105 { - if yyj2105 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -25239,9 +31315,11 @@ func (x *EndpointAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2105Slc = r.DecodeBytes(yys2105Slc, true, true) - yys2105 := string(yys2105Slc) - switch yys2105 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "ip": if r.TryDecodeAsNil() { x.IP = "" @@ -25260,46 +31338,46 @@ func (x *EndpointAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.TargetRef.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys2105) - } // end switch yys2105 - } // end for yyj2105 - if !yyhl2105 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EndpointAddress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2108 int - var yyb2108 bool - var yyhl2108 bool = l >= 0 - yyj2108++ - if yyhl2108 { - yyb2108 = yyj2108 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2108 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2108 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.IP = "" } else { x.IP = string(r.DecodeString()) } - yyj2108++ - if yyhl2108 { - yyb2108 = yyj2108 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2108 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2108 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.TargetRef != nil { x.TargetRef = nil @@ -25311,18 +31389,19 @@ func (x *EndpointAddress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) x.TargetRef.CodecDecodeSelf(d) } for { - yyj2108++ - if yyhl2108 { - yyb2108 = yyj2108 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2108 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2108 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj2108-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EndpointPort) CodecEncodeSelf(e *codec1978.Encoder) { @@ -25332,33 +31411,36 @@ func (x *EndpointPort) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2111 := z.EncBinary() - _ = yym2111 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2112 := !z.EncBinary() - yy2arr2112 := z.EncBasicHandle().StructToArray - var yyq2112 [3]bool - _, _, _ = yysep2112, yyq2112, yy2arr2112 - const yyr2112 bool = false - yyq2112[0] = x.Name != "" - yyq2112[2] = x.Protocol != "" - if yyr2112 || yy2arr2112 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Name != "" + yyq2[2] = x.Protocol != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn2112 int = 1 - for _, b := range yyq2112 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2112++ + yynn2++ } } - r.EncodeMapStart(yynn2112) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2112 || yy2arr2112 { - if yyq2112[0] { - yym2114 := z.EncBinary() - _ = yym2114 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -25367,46 +31449,56 @@ func (x *EndpointPort) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2112[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym2115 := z.EncBinary() - _ = yym2115 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr2112 || yy2arr2112 { - yym2117 := z.EncBinary() - _ = yym2117 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.Port)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("port")) - yym2118 := z.EncBinary() - _ = yym2118 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.Port)) } } - if yyr2112 || yy2arr2112 { - if yyq2112[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { x.Protocol.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2112[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("protocol")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Protocol.CodecEncodeSelf(e) } } - if yysep2112 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -25416,24 +31508,25 @@ func (x *EndpointPort) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2120 := z.DecBinary() - _ = yym2120 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2121 := r.ReadMapStart() - if yyl2121 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2121, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2121 := r.ReadArrayStart() - if yyl2121 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2121, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -25445,12 +31538,12 @@ func (x *EndpointPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2122Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2122Slc - var yyhl2122 bool = l >= 0 - for yyj2122 := 0; ; yyj2122++ { - if yyhl2122 { - if yyj2122 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -25458,9 +31551,11 @@ func (x *EndpointPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2122Slc = r.DecodeBytes(yys2122Slc, true, true) - yys2122 := string(yys2122Slc) - switch yys2122 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -25471,7 +31566,7 @@ func (x *EndpointPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Port = 0 } else { - x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + x.Port = int32(r.DecodeInt(32)) } case "protocol": if r.TryDecodeAsNil() { @@ -25480,79 +31575,81 @@ func (x *EndpointPort) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Protocol = Protocol(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2122) - } // end switch yys2122 - } // end for yyj2122 - if !yyhl2122 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EndpointPort) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2126 int - var yyb2126 bool - var yyhl2126 bool = l >= 0 - yyj2126++ - if yyhl2126 { - yyb2126 = yyj2126 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2126 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2126 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj2126++ - if yyhl2126 { - yyb2126 = yyj2126 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2126 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2126 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Port = 0 } else { - x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + x.Port = int32(r.DecodeInt(32)) } - yyj2126++ - if yyhl2126 { - yyb2126 = yyj2126 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2126 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2126 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Protocol = "" } else { x.Protocol = Protocol(r.DecodeString()) } for { - yyj2126++ - if yyhl2126 { - yyb2126 = yyj2126 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2126 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2126 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj2126-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EndpointsList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -25562,126 +31659,142 @@ func (x *EndpointsList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2130 := z.EncBinary() - _ = yym2130 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2131 := !z.EncBinary() - yy2arr2131 := z.EncBasicHandle().StructToArray - var yyq2131 [4]bool - _, _, _ = yysep2131, yyq2131, yy2arr2131 - const yyr2131 bool = false - yyq2131[0] = x.Kind != "" - yyq2131[1] = x.APIVersion != "" - yyq2131[2] = true - if yyr2131 || yy2arr2131 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2131 int = 1 - for _, b := range yyq2131 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2131++ + yynn2++ } } - r.EncodeMapStart(yynn2131) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2131 || yy2arr2131 { - if yyq2131[0] { - yym2133 := z.EncBinary() - _ = yym2133 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2131[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2134 := z.EncBinary() - _ = yym2134 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2131 || yy2arr2131 { - if yyq2131[1] { - yym2136 := z.EncBinary() - _ = yym2136 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2131[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2137 := z.EncBinary() - _ = yym2137 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2131 || yy2arr2131 { - if yyq2131[2] { - yy2139 := &x.ListMeta - yym2140 := z.EncBinary() - _ = yym2140 - if false { - } else if z.HasExtensions() && z.EncExt(yy2139) { - } else { - z.EncFallback(yy2139) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2131[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2141 := &x.ListMeta - yym2142 := z.EncBinary() - _ = yym2142 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2141) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2141) + z.EncFallback(yy6) } } } - if yyr2131 || yy2arr2131 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2144 := z.EncBinary() - _ = yym2144 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceEndpoints(([]Endpoints)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2145 := z.EncBinary() - _ = yym2145 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceEndpoints(([]Endpoints)(x.Items), e) } } } - if yysep2131 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -25691,24 +31804,25 @@ func (x *EndpointsList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2146 := z.DecBinary() - _ = yym2146 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2147 := r.ReadMapStart() - if yyl2147 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2147, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2147 := r.ReadArrayStart() - if yyl2147 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2147, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -25720,12 +31834,12 @@ func (x *EndpointsList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2148Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2148Slc - var yyhl2148 bool = l >= 0 - for yyj2148 := 0; ; yyj2148++ { - if yyhl2148 { - if yyj2148 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -25733,9 +31847,36 @@ func (x *EndpointsList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2148Slc = r.DecodeBytes(yys2148Slc, true, true) - yys2148 := string(yys2148Slc) - switch yys2148 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceEndpoints((*[]Endpoints)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -25748,133 +31889,111 @@ func (x *EndpointsList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2151 := &x.ListMeta - yym2152 := z.DecBinary() - _ = yym2152 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2151) { - } else { - z.DecFallback(yyv2151, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2153 := &x.Items - yym2154 := z.DecBinary() - _ = yym2154 - if false { - } else { - h.decSliceEndpoints((*[]Endpoints)(yyv2153), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2148) - } // end switch yys2148 - } // end for yyj2148 - if !yyhl2148 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EndpointsList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2155 int - var yyb2155 bool - var yyhl2155 bool = l >= 0 - yyj2155++ - if yyhl2155 { - yyb2155 = yyj2155 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2155 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2155 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceEndpoints((*[]Endpoints)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2155++ - if yyhl2155 { - yyb2155 = yyj2155 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2155 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2155 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2155++ - if yyhl2155 { - yyb2155 = yyj2155 > l - } else { - yyb2155 = r.CheckBreak() - } - if yyb2155 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2158 := &x.ListMeta - yym2159 := z.DecBinary() - _ = yym2159 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2158) { - } else { - z.DecFallback(yyv2158, false) - } - } - yyj2155++ - if yyhl2155 { - yyb2155 = yyj2155 > l - } else { - yyb2155 = r.CheckBreak() - } - if yyb2155 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2160 := &x.Items - yym2161 := z.DecBinary() - _ = yym2161 - if false { - } else { - h.decSliceEndpoints((*[]Endpoints)(yyv2160), d) - } - } for { - yyj2155++ - if yyhl2155 { - yyb2155 = yyj2155 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2155 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2155 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2155-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -25884,35 +32003,38 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2162 := z.EncBinary() - _ = yym2162 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2163 := !z.EncBinary() - yy2arr2163 := z.EncBasicHandle().StructToArray - var yyq2163 [4]bool - _, _, _ = yysep2163, yyq2163, yy2arr2163 - const yyr2163 bool = false - yyq2163[0] = x.PodCIDR != "" - yyq2163[1] = x.ExternalID != "" - yyq2163[2] = x.ProviderID != "" - yyq2163[3] = x.Unschedulable != false - if yyr2163 || yy2arr2163 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.PodCIDR != "" + yyq2[1] = x.ExternalID != "" + yyq2[2] = x.ProviderID != "" + yyq2[3] = x.Unschedulable != false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2163 int = 0 - for _, b := range yyq2163 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2163++ + yynn2++ } } - r.EncodeMapStart(yynn2163) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2163 || yy2arr2163 { - if yyq2163[0] { - yym2165 := z.EncBinary() - _ = yym2165 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PodCIDR)) @@ -25921,20 +32043,23 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2163[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("podCIDR")) - yym2166 := z.EncBinary() - _ = yym2166 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.PodCIDR)) } } } - if yyr2163 || yy2arr2163 { - if yyq2163[1] { - yym2168 := z.EncBinary() - _ = yym2168 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ExternalID)) @@ -25943,20 +32068,23 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2163[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("externalID")) - yym2169 := z.EncBinary() - _ = yym2169 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ExternalID)) } } } - if yyr2163 || yy2arr2163 { - if yyq2163[2] { - yym2171 := z.EncBinary() - _ = yym2171 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ProviderID)) @@ -25965,20 +32093,23 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2163[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("providerID")) - yym2172 := z.EncBinary() - _ = yym2172 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ProviderID)) } } } - if yyr2163 || yy2arr2163 { - if yyq2163[3] { - yym2174 := z.EncBinary() - _ = yym2174 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeBool(bool(x.Unschedulable)) @@ -25987,18 +32118,22 @@ func (x *NodeSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq2163[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("unschedulable")) - yym2175 := z.EncBinary() - _ = yym2175 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeBool(bool(x.Unschedulable)) } } } - if yysep2163 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -26008,24 +32143,25 @@ func (x *NodeSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2176 := z.DecBinary() - _ = yym2176 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2177 := r.ReadMapStart() - if yyl2177 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2177, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2177 := r.ReadArrayStart() - if yyl2177 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2177, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -26037,12 +32173,12 @@ func (x *NodeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2178Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2178Slc - var yyhl2178 bool = l >= 0 - for yyj2178 := 0; ; yyj2178++ { - if yyhl2178 { - if yyj2178 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -26050,9 +32186,11 @@ func (x *NodeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2178Slc = r.DecodeBytes(yys2178Slc, true, true) - yys2178 := string(yys2178Slc) - switch yys2178 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "podCIDR": if r.TryDecodeAsNil() { x.PodCIDR = "" @@ -26078,94 +32216,97 @@ func (x *NodeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Unschedulable = bool(r.DecodeBool()) } default: - z.DecStructFieldNotFound(-1, yys2178) - } // end switch yys2178 - } // end for yyj2178 - if !yyhl2178 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2183 int - var yyb2183 bool - var yyhl2183 bool = l >= 0 - yyj2183++ - if yyhl2183 { - yyb2183 = yyj2183 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2183 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2183 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.PodCIDR = "" } else { x.PodCIDR = string(r.DecodeString()) } - yyj2183++ - if yyhl2183 { - yyb2183 = yyj2183 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2183 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2183 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ExternalID = "" } else { x.ExternalID = string(r.DecodeString()) } - yyj2183++ - if yyhl2183 { - yyb2183 = yyj2183 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2183 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2183 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ProviderID = "" } else { x.ProviderID = string(r.DecodeString()) } - yyj2183++ - if yyhl2183 { - yyb2183 = yyj2183 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2183 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2183 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Unschedulable = false } else { x.Unschedulable = bool(r.DecodeBool()) } for { - yyj2183++ - if yyhl2183 { - yyb2183 = yyj2183 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2183 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2183 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj2183-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonEndpoint) CodecEncodeSelf(e *codec1978.Encoder) { @@ -26175,45 +32316,52 @@ func (x *DaemonEndpoint) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2188 := z.EncBinary() - _ = yym2188 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2189 := !z.EncBinary() - yy2arr2189 := z.EncBasicHandle().StructToArray - var yyq2189 [1]bool - _, _, _ = yysep2189, yyq2189, yy2arr2189 - const yyr2189 bool = false - if yyr2189 || yy2arr2189 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2189 int = 1 - for _, b := range yyq2189 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2189++ + yynn2++ } } - r.EncodeMapStart(yynn2189) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2189 || yy2arr2189 { - yym2191 := z.EncBinary() - _ = yym2191 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Port)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Port")) - yym2192 := z.EncBinary() - _ = yym2192 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Port)) } } - if yysep2189 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -26223,24 +32371,25 @@ func (x *DaemonEndpoint) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2193 := z.DecBinary() - _ = yym2193 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2194 := r.ReadMapStart() - if yyl2194 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2194, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2194 := r.ReadArrayStart() - if yyl2194 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2194, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -26252,12 +32401,12 @@ func (x *DaemonEndpoint) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2195Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2195Slc - var yyhl2195 bool = l >= 0 - for yyj2195 := 0; ; yyj2195++ { - if yyhl2195 { - if yyj2195 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -26265,59 +32414,61 @@ func (x *DaemonEndpoint) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2195Slc = r.DecodeBytes(yys2195Slc, true, true) - yys2195 := string(yys2195Slc) - switch yys2195 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "Port": if r.TryDecodeAsNil() { x.Port = 0 } else { - x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + x.Port = int32(r.DecodeInt(32)) } default: - z.DecStructFieldNotFound(-1, yys2195) - } // end switch yys2195 - } // end for yyj2195 - if !yyhl2195 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonEndpoint) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2197 int - var yyb2197 bool - var yyhl2197 bool = l >= 0 - yyj2197++ - if yyhl2197 { - yyb2197 = yyj2197 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2197 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2197 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Port = 0 } else { - x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + x.Port = int32(r.DecodeInt(32)) } for { - yyj2197++ - if yyhl2197 { - yyb2197 = yyj2197 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2197 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2197 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj2197-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeDaemonEndpoints) CodecEncodeSelf(e *codec1978.Encoder) { @@ -26327,44 +32478,51 @@ func (x *NodeDaemonEndpoints) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2199 := z.EncBinary() - _ = yym2199 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2200 := !z.EncBinary() - yy2arr2200 := z.EncBasicHandle().StructToArray - var yyq2200 [1]bool - _, _, _ = yysep2200, yyq2200, yy2arr2200 - const yyr2200 bool = false - yyq2200[0] = true - if yyr2200 || yy2arr2200 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2200 int = 0 - for _, b := range yyq2200 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2200++ + yynn2++ } } - r.EncodeMapStart(yynn2200) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2200 || yy2arr2200 { - if yyq2200[0] { - yy2202 := &x.KubeletEndpoint - yy2202.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.KubeletEndpoint + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2200[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kubeletEndpoint")) - yy2203 := &x.KubeletEndpoint - yy2203.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.KubeletEndpoint + yy6.CodecEncodeSelf(e) } } - if yysep2200 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -26374,24 +32532,25 @@ func (x *NodeDaemonEndpoints) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2204 := z.DecBinary() - _ = yym2204 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2205 := r.ReadMapStart() - if yyl2205 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2205, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2205 := r.ReadArrayStart() - if yyl2205 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2205, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -26403,12 +32562,12 @@ func (x *NodeDaemonEndpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2206Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2206Slc - var yyhl2206 bool = l >= 0 - for yyj2206 := 0; ; yyj2206++ { - if yyhl2206 { - if yyj2206 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -26416,61 +32575,63 @@ func (x *NodeDaemonEndpoints) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys2206Slc = r.DecodeBytes(yys2206Slc, true, true) - yys2206 := string(yys2206Slc) - switch yys2206 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "kubeletEndpoint": if r.TryDecodeAsNil() { x.KubeletEndpoint = DaemonEndpoint{} } else { - yyv2207 := &x.KubeletEndpoint - yyv2207.CodecDecodeSelf(d) + yyv4 := &x.KubeletEndpoint + yyv4.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys2206) - } // end switch yys2206 - } // end for yyj2206 - if !yyhl2206 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeDaemonEndpoints) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2208 int - var yyb2208 bool - var yyhl2208 bool = l >= 0 - yyj2208++ - if yyhl2208 { - yyb2208 = yyj2208 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2208 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2208 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.KubeletEndpoint = DaemonEndpoint{} } else { - yyv2209 := &x.KubeletEndpoint - yyv2209.CodecDecodeSelf(d) + yyv6 := &x.KubeletEndpoint + yyv6.CodecDecodeSelf(d) } for { - yyj2208++ - if yyhl2208 { - yyb2208 = yyj2208 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2208 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2208 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj2208-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeSystemInfo) CodecEncodeSelf(e *codec1978.Encoder) { @@ -26480,157 +32641,185 @@ func (x *NodeSystemInfo) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2210 := z.EncBinary() - _ = yym2210 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2211 := !z.EncBinary() - yy2arr2211 := z.EncBasicHandle().StructToArray - var yyq2211 [8]bool - _, _, _ = yysep2211, yyq2211, yy2arr2211 - const yyr2211 bool = false - if yyr2211 || yy2arr2211 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - var yynn2211 int = 8 - for _, b := range yyq2211 { + yynn2 = 8 + for _, b := range yyq2 { if b { - yynn2211++ + yynn2++ } } - r.EncodeMapStart(yynn2211) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2211 || yy2arr2211 { - yym2213 := z.EncBinary() - _ = yym2213 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.MachineID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("machineID")) - yym2214 := z.EncBinary() - _ = yym2214 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.MachineID)) } } - if yyr2211 || yy2arr2211 { - yym2216 := z.EncBinary() - _ = yym2216 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SystemUUID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("systemUUID")) - yym2217 := z.EncBinary() - _ = yym2217 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.SystemUUID)) } } - if yyr2211 || yy2arr2211 { - yym2219 := z.EncBinary() - _ = yym2219 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.BootID)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("bootID")) - yym2220 := z.EncBinary() - _ = yym2220 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.BootID)) } } - if yyr2211 || yy2arr2211 { - yym2222 := z.EncBinary() - _ = yym2222 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KernelVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kernelVersion")) - yym2223 := z.EncBinary() - _ = yym2223 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KernelVersion)) } } - if yyr2211 || yy2arr2211 { - yym2225 := z.EncBinary() - _ = yym2225 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym16 := z.EncBinary() + _ = yym16 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.OsImage)) + r.EncodeString(codecSelferC_UTF81234, string(x.OSImage)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("osImage")) - yym2226 := z.EncBinary() - _ = yym2226 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.OsImage)) + r.EncodeString(codecSelferC_UTF81234, string(x.OSImage)) } } - if yyr2211 || yy2arr2211 { - yym2228 := z.EncBinary() - _ = yym2228 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerRuntimeVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("containerRuntimeVersion")) - yym2229 := z.EncBinary() - _ = yym2229 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ContainerRuntimeVersion)) } } - if yyr2211 || yy2arr2211 { - yym2231 := z.EncBinary() - _ = yym2231 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym22 := z.EncBinary() + _ = yym22 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KubeletVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kubeletVersion")) - yym2232 := z.EncBinary() - _ = yym2232 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KubeletVersion)) } } - if yyr2211 || yy2arr2211 { - yym2234 := z.EncBinary() - _ = yym2234 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym25 := z.EncBinary() + _ = yym25 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KubeProxyVersion)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kubeProxyVersion")) - yym2235 := z.EncBinary() - _ = yym2235 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.KubeProxyVersion)) } } - if yysep2211 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -26640,24 +32829,25 @@ func (x *NodeSystemInfo) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2236 := z.DecBinary() - _ = yym2236 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2237 := r.ReadMapStart() - if yyl2237 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2237, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2237 := r.ReadArrayStart() - if yyl2237 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2237, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -26669,12 +32859,12 @@ func (x *NodeSystemInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2238Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2238Slc - var yyhl2238 bool = l >= 0 - for yyj2238 := 0; ; yyj2238++ { - if yyhl2238 { - if yyj2238 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -26682,9 +32872,11 @@ func (x *NodeSystemInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2238Slc = r.DecodeBytes(yys2238Slc, true, true) - yys2238 := string(yys2238Slc) - switch yys2238 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "machineID": if r.TryDecodeAsNil() { x.MachineID = "" @@ -26711,9 +32903,9 @@ func (x *NodeSystemInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "osImage": if r.TryDecodeAsNil() { - x.OsImage = "" + x.OSImage = "" } else { - x.OsImage = string(r.DecodeString()) + x.OSImage = string(r.DecodeString()) } case "containerRuntimeVersion": if r.TryDecodeAsNil() { @@ -26734,154 +32926,161 @@ func (x *NodeSystemInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.KubeProxyVersion = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2238) - } // end switch yys2238 - } // end for yyj2238 - if !yyhl2238 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeSystemInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2247 int - var yyb2247 bool - var yyhl2247 bool = l >= 0 - yyj2247++ - if yyhl2247 { - yyb2247 = yyj2247 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2247 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2247 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MachineID = "" } else { x.MachineID = string(r.DecodeString()) } - yyj2247++ - if yyhl2247 { - yyb2247 = yyj2247 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2247 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2247 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.SystemUUID = "" } else { x.SystemUUID = string(r.DecodeString()) } - yyj2247++ - if yyhl2247 { - yyb2247 = yyj2247 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2247 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2247 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.BootID = "" } else { x.BootID = string(r.DecodeString()) } - yyj2247++ - if yyhl2247 { - yyb2247 = yyj2247 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2247 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2247 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.KernelVersion = "" } else { x.KernelVersion = string(r.DecodeString()) } - yyj2247++ - if yyhl2247 { - yyb2247 = yyj2247 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2247 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2247 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.OsImage = "" + x.OSImage = "" } else { - x.OsImage = string(r.DecodeString()) + x.OSImage = string(r.DecodeString()) } - yyj2247++ - if yyhl2247 { - yyb2247 = yyj2247 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2247 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2247 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ContainerRuntimeVersion = "" } else { x.ContainerRuntimeVersion = string(r.DecodeString()) } - yyj2247++ - if yyhl2247 { - yyb2247 = yyj2247 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2247 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2247 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.KubeletVersion = "" } else { x.KubeletVersion = string(r.DecodeString()) } - yyj2247++ - if yyhl2247 { - yyb2247 = yyj2247 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2247 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2247 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.KubeProxyVersion = "" } else { x.KubeProxyVersion = string(r.DecodeString()) } for { - yyj2247++ - if yyhl2247 { - yyb2247 = yyj2247 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2247 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2247 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj2247-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -26891,35 +33090,39 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2256 := z.EncBinary() - _ = yym2256 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2257 := !z.EncBinary() - yy2arr2257 := z.EncBasicHandle().StructToArray - var yyq2257 [6]bool - _, _, _ = yysep2257, yyq2257, yy2arr2257 - const yyr2257 bool = false - yyq2257[0] = len(x.Capacity) != 0 - yyq2257[1] = x.Phase != "" - yyq2257[2] = len(x.Conditions) != 0 - yyq2257[3] = len(x.Addresses) != 0 - yyq2257[4] = true - yyq2257[5] = true - if yyr2257 || yy2arr2257 { - r.EncodeArrayStart(6) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Capacity) != 0 + yyq2[1] = len(x.Allocatable) != 0 + yyq2[2] = x.Phase != "" + yyq2[3] = len(x.Conditions) != 0 + yyq2[4] = len(x.Addresses) != 0 + yyq2[5] = true + yyq2[6] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(8) } else { - var yynn2257 int = 0 - for _, b := range yyq2257 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2257++ + yynn2++ } } - r.EncodeMapStart(yynn2257) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2257 || yy2arr2257 { - if yyq2257[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Capacity == nil { r.EncodeNil() } else { @@ -26929,8 +33132,10 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2257[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("capacity")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Capacity == nil { r.EncodeNil() } else { @@ -26938,25 +33143,52 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2257 || yy2arr2257 { - if yyq2257[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Allocatable == nil { + r.EncodeNil() + } else { + x.Allocatable.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("allocatable")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Allocatable == nil { + r.EncodeNil() + } else { + x.Allocatable.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2257[1] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yyr2257 || yy2arr2257 { - if yyq2257[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.Conditions == nil { r.EncodeNil() } else { - yym2261 := z.EncBinary() - _ = yym2261 + yym13 := z.EncBinary() + _ = yym13 if false { } else { h.encSliceNodeCondition(([]NodeCondition)(x.Conditions), e) @@ -26966,13 +33198,15 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2257[2] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("conditions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Conditions == nil { r.EncodeNil() } else { - yym2262 := z.EncBinary() - _ = yym2262 + yym14 := z.EncBinary() + _ = yym14 if false { } else { h.encSliceNodeCondition(([]NodeCondition)(x.Conditions), e) @@ -26980,13 +33214,14 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2257 || yy2arr2257 { - if yyq2257[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.Addresses == nil { r.EncodeNil() } else { - yym2264 := z.EncBinary() - _ = yym2264 + yym16 := z.EncBinary() + _ = yym16 if false { } else { h.encSliceNodeAddress(([]NodeAddress)(x.Addresses), e) @@ -26996,13 +33231,15 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2257[3] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("addresses")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Addresses == nil { r.EncodeNil() } else { - yym2265 := z.EncBinary() - _ = yym2265 + yym17 := z.EncBinary() + _ = yym17 if false { } else { h.encSliceNodeAddress(([]NodeAddress)(x.Addresses), e) @@ -27010,36 +33247,71 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2257 || yy2arr2257 { - if yyq2257[4] { - yy2267 := &x.DaemonEndpoints - yy2267.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yy19 := &x.DaemonEndpoints + yy19.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2257[4] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("daemonEndpoints")) - yy2268 := &x.DaemonEndpoints - yy2268.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy21 := &x.DaemonEndpoints + yy21.CodecEncodeSelf(e) } } - if yyr2257 || yy2arr2257 { - if yyq2257[5] { - yy2270 := &x.NodeInfo - yy2270.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yy24 := &x.NodeInfo + yy24.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2257[5] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nodeInfo")) - yy2271 := &x.NodeInfo - yy2271.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy26 := &x.NodeInfo + yy26.CodecEncodeSelf(e) } } - if yysep2257 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Images == nil { + r.EncodeNil() + } else { + yym29 := z.EncBinary() + _ = yym29 + if false { + } else { + h.encSliceContainerImage(([]ContainerImage)(x.Images), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("images")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Images == nil { + r.EncodeNil() + } else { + yym30 := z.EncBinary() + _ = yym30 + if false { + } else { + h.encSliceContainerImage(([]ContainerImage)(x.Images), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -27049,24 +33321,25 @@ func (x *NodeStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2272 := z.DecBinary() - _ = yym2272 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2273 := r.ReadMapStart() - if yyl2273 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2273, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2273 := r.ReadArrayStart() - if yyl2273 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2273, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -27078,12 +33351,12 @@ func (x *NodeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2274Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2274Slc - var yyhl2274 bool = l >= 0 - for yyj2274 := 0; ; yyj2274++ { - if yyhl2274 { - if yyj2274 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -27091,15 +33364,24 @@ func (x *NodeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2274Slc = r.DecodeBytes(yys2274Slc, true, true) - yys2274 := string(yys2274Slc) - switch yys2274 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "capacity": if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv2275 := &x.Capacity - yyv2275.CodecDecodeSelf(d) + yyv4 := &x.Capacity + yyv4.CodecDecodeSelf(d) + } + case "allocatable": + if r.TryDecodeAsNil() { + x.Allocatable = nil + } else { + yyv5 := &x.Allocatable + yyv5.CodecDecodeSelf(d) } case "phase": if r.TryDecodeAsNil() { @@ -27111,182 +33393,468 @@ func (x *NodeStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv2277 := &x.Conditions - yym2278 := z.DecBinary() - _ = yym2278 + yyv7 := &x.Conditions + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceNodeCondition((*[]NodeCondition)(yyv2277), d) + h.decSliceNodeCondition((*[]NodeCondition)(yyv7), d) } } case "addresses": if r.TryDecodeAsNil() { x.Addresses = nil } else { - yyv2279 := &x.Addresses - yym2280 := z.DecBinary() - _ = yym2280 + yyv9 := &x.Addresses + yym10 := z.DecBinary() + _ = yym10 if false { } else { - h.decSliceNodeAddress((*[]NodeAddress)(yyv2279), d) + h.decSliceNodeAddress((*[]NodeAddress)(yyv9), d) } } case "daemonEndpoints": if r.TryDecodeAsNil() { x.DaemonEndpoints = NodeDaemonEndpoints{} } else { - yyv2281 := &x.DaemonEndpoints - yyv2281.CodecDecodeSelf(d) + yyv11 := &x.DaemonEndpoints + yyv11.CodecDecodeSelf(d) } case "nodeInfo": if r.TryDecodeAsNil() { x.NodeInfo = NodeSystemInfo{} } else { - yyv2282 := &x.NodeInfo - yyv2282.CodecDecodeSelf(d) + yyv12 := &x.NodeInfo + yyv12.CodecDecodeSelf(d) + } + case "images": + if r.TryDecodeAsNil() { + x.Images = nil + } else { + yyv13 := &x.Images + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceContainerImage((*[]ContainerImage)(yyv13), d) + } } default: - z.DecStructFieldNotFound(-1, yys2274) - } // end switch yys2274 - } // end for yyj2274 - if !yyhl2274 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2283 int - var yyb2283 bool - var yyhl2283 bool = l >= 0 - yyj2283++ - if yyhl2283 { - yyb2283 = yyj2283 > l + var yyj15 int + var yyb15 bool + var yyhl15 bool = l >= 0 + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2283 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2283 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Capacity = nil } else { - yyv2284 := &x.Capacity - yyv2284.CodecDecodeSelf(d) + yyv16 := &x.Capacity + yyv16.CodecDecodeSelf(d) } - yyj2283++ - if yyhl2283 { - yyb2283 = yyj2283 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2283 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2283 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Allocatable = nil + } else { + yyv17 := &x.Allocatable + yyv17.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = NodePhase(r.DecodeString()) } - yyj2283++ - if yyhl2283 { - yyb2283 = yyj2283 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2283 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2283 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv2286 := &x.Conditions - yym2287 := z.DecBinary() - _ = yym2287 + yyv19 := &x.Conditions + yym20 := z.DecBinary() + _ = yym20 if false { } else { - h.decSliceNodeCondition((*[]NodeCondition)(yyv2286), d) + h.decSliceNodeCondition((*[]NodeCondition)(yyv19), d) } } - yyj2283++ - if yyhl2283 { - yyb2283 = yyj2283 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2283 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2283 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Addresses = nil } else { - yyv2288 := &x.Addresses - yym2289 := z.DecBinary() - _ = yym2289 + yyv21 := &x.Addresses + yym22 := z.DecBinary() + _ = yym22 if false { } else { - h.decSliceNodeAddress((*[]NodeAddress)(yyv2288), d) + h.decSliceNodeAddress((*[]NodeAddress)(yyv21), d) } } - yyj2283++ - if yyhl2283 { - yyb2283 = yyj2283 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2283 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2283 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DaemonEndpoints = NodeDaemonEndpoints{} } else { - yyv2290 := &x.DaemonEndpoints - yyv2290.CodecDecodeSelf(d) + yyv23 := &x.DaemonEndpoints + yyv23.CodecDecodeSelf(d) } - yyj2283++ - if yyhl2283 { - yyb2283 = yyj2283 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2283 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2283 { - r.ReadEnd() + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NodeInfo = NodeSystemInfo{} } else { - yyv2291 := &x.NodeInfo - yyv2291.CodecDecodeSelf(d) + yyv24 := &x.NodeInfo + yyv24.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Images = nil + } else { + yyv25 := &x.Images + yym26 := z.DecBinary() + _ = yym26 + if false { + } else { + h.decSliceContainerImage((*[]ContainerImage)(yyv25), d) + } } for { - yyj2283++ - if yyhl2283 { - yyb2283 = yyj2283 > l + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l } else { - yyb2283 = r.CheckBreak() + yyb15 = r.CheckBreak() } - if yyb2283 { + if yyb15 { break } - z.DecStructFieldNotFound(yyj2283-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj15-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Size != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.RepoTags == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + z.F.EncSliceStringV(x.RepoTags, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("repoTags")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.RepoTags == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + z.F.EncSliceStringV(x.RepoTags, false, e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(x.Size)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("size")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeInt(int64(x.Size)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ContainerImage) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ContainerImage) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "repoTags": + if r.TryDecodeAsNil() { + x.RepoTags = nil + } else { + yyv4 := &x.RepoTags + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + z.F.DecSliceStringX(yyv4, false, d) + } + } + case "size": + if r.TryDecodeAsNil() { + x.Size = 0 + } else { + x.Size = int64(r.DecodeInt(64)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ContainerImage) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RepoTags = nil + } else { + yyv8 := &x.RepoTags + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + z.F.DecSliceStringX(yyv8, false, d) + } + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Size = 0 + } else { + x.Size = int64(r.DecodeInt(64)) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x NodePhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2292 := z.EncBinary() - _ = yym2292 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -27298,8 +33866,8 @@ func (x *NodePhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2293 := z.DecBinary() - _ = yym2293 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -27311,8 +33879,8 @@ func (x NodeConditionType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2294 := z.EncBinary() - _ = yym2294 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -27324,8 +33892,8 @@ func (x *NodeConditionType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2295 := z.DecBinary() - _ = yym2295 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -27340,115 +33908,130 @@ func (x *NodeCondition) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2296 := z.EncBinary() - _ = yym2296 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2297 := !z.EncBinary() - yy2arr2297 := z.EncBasicHandle().StructToArray - var yyq2297 [6]bool - _, _, _ = yysep2297, yyq2297, yy2arr2297 - const yyr2297 bool = false - yyq2297[2] = true - yyq2297[3] = true - yyq2297[4] = x.Reason != "" - yyq2297[5] = x.Message != "" - if yyr2297 || yy2arr2297 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = true + yyq2[3] = true + yyq2[4] = x.Reason != "" + yyq2[5] = x.Message != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn2297 int = 2 - for _, b := range yyq2297 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn2297++ + yynn2++ } } - r.EncodeMapStart(yynn2297) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2297 || yy2arr2297 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr2297 || yy2arr2297 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Status.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Status.CodecEncodeSelf(e) } - if yyr2297 || yy2arr2297 { - if yyq2297[2] { - yy2301 := &x.LastHeartbeatTime - yym2302 := z.EncBinary() - _ = yym2302 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.LastHeartbeatTime + yym11 := z.EncBinary() + _ = yym11 if false { - } else if z.HasExtensions() && z.EncExt(yy2301) { - } else if yym2302 { - z.EncBinaryMarshal(yy2301) - } else if !yym2302 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2301) + } else if z.HasExtensions() && z.EncExt(yy10) { + } else if yym11 { + z.EncBinaryMarshal(yy10) + } else if !yym11 && z.IsJSONHandle() { + z.EncJSONMarshal(yy10) } else { - z.EncFallback(yy2301) + z.EncFallback(yy10) } } else { r.EncodeNil() } } else { - if yyq2297[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastHeartbeatTime")) - yy2303 := &x.LastHeartbeatTime - yym2304 := z.EncBinary() - _ = yym2304 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.LastHeartbeatTime + yym13 := z.EncBinary() + _ = yym13 if false { - } else if z.HasExtensions() && z.EncExt(yy2303) { - } else if yym2304 { - z.EncBinaryMarshal(yy2303) - } else if !yym2304 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2303) + } else if z.HasExtensions() && z.EncExt(yy12) { + } else if yym13 { + z.EncBinaryMarshal(yy12) + } else if !yym13 && z.IsJSONHandle() { + z.EncJSONMarshal(yy12) } else { - z.EncFallback(yy2303) + z.EncFallback(yy12) } } } - if yyr2297 || yy2arr2297 { - if yyq2297[3] { - yy2306 := &x.LastTransitionTime - yym2307 := z.EncBinary() - _ = yym2307 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yy15 := &x.LastTransitionTime + yym16 := z.EncBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.EncExt(yy2306) { - } else if yym2307 { - z.EncBinaryMarshal(yy2306) - } else if !yym2307 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2306) + } else if z.HasExtensions() && z.EncExt(yy15) { + } else if yym16 { + z.EncBinaryMarshal(yy15) + } else if !yym16 && z.IsJSONHandle() { + z.EncJSONMarshal(yy15) } else { - z.EncFallback(yy2306) + z.EncFallback(yy15) } } else { r.EncodeNil() } } else { - if yyq2297[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastTransitionTime")) - yy2308 := &x.LastTransitionTime - yym2309 := z.EncBinary() - _ = yym2309 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy17 := &x.LastTransitionTime + yym18 := z.EncBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.EncExt(yy2308) { - } else if yym2309 { - z.EncBinaryMarshal(yy2308) - } else if !yym2309 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2308) + } else if z.HasExtensions() && z.EncExt(yy17) { + } else if yym18 { + z.EncBinaryMarshal(yy17) + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(yy17) } else { - z.EncFallback(yy2308) + z.EncFallback(yy17) } } } - if yyr2297 || yy2arr2297 { - if yyq2297[4] { - yym2311 := z.EncBinary() - _ = yym2311 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -27457,20 +34040,23 @@ func (x *NodeCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2297[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym2312 := z.EncBinary() - _ = yym2312 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym21 := z.EncBinary() + _ = yym21 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr2297 || yy2arr2297 { - if yyq2297[5] { - yym2314 := z.EncBinary() - _ = yym2314 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -27479,18 +34065,22 @@ func (x *NodeCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2297[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym2315 := z.EncBinary() - _ = yym2315 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym24 := z.EncBinary() + _ = yym24 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yysep2297 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -27500,24 +34090,25 @@ func (x *NodeCondition) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2316 := z.DecBinary() - _ = yym2316 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2317 := r.ReadMapStart() - if yyl2317 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2317, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2317 := r.ReadArrayStart() - if yyl2317 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2317, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -27529,12 +34120,12 @@ func (x *NodeCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2318Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2318Slc - var yyhl2318 bool = l >= 0 - for yyj2318 := 0; ; yyj2318++ { - if yyhl2318 { - if yyj2318 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -27542,9 +34133,11 @@ func (x *NodeCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2318Slc = r.DecodeBytes(yys2318Slc, true, true) - yys2318 := string(yys2318Slc) - switch yys2318 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -27561,34 +34154,34 @@ func (x *NodeCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.LastHeartbeatTime = pkg2_unversioned.Time{} } else { - yyv2321 := &x.LastHeartbeatTime - yym2322 := z.DecBinary() - _ = yym2322 + yyv6 := &x.LastHeartbeatTime + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv2321) { - } else if yym2322 { - z.DecBinaryUnmarshal(yyv2321) - } else if !yym2322 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2321) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if yym7 { + z.DecBinaryUnmarshal(yyv6) + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv2321, false) + z.DecFallback(yyv6, false) } } case "lastTransitionTime": if r.TryDecodeAsNil() { x.LastTransitionTime = pkg2_unversioned.Time{} } else { - yyv2323 := &x.LastTransitionTime - yym2324 := z.DecBinary() - _ = yym2324 + yyv8 := &x.LastTransitionTime + yym9 := z.DecBinary() + _ = yym9 if false { - } else if z.HasExtensions() && z.DecExt(yyv2323) { - } else if yym2324 { - z.DecBinaryUnmarshal(yyv2323) - } else if !yym2324 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2323) + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else if yym9 { + z.DecBinaryUnmarshal(yyv8) + } else if !yym9 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv8) } else { - z.DecFallback(yyv2323, false) + z.DecFallback(yyv8, false) } } case "reason": @@ -27604,154 +34197,159 @@ func (x *NodeCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Message = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2318) - } // end switch yys2318 - } // end for yyj2318 - if !yyhl2318 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2327 int - var yyb2327 bool - var yyhl2327 bool = l >= 0 - yyj2327++ - if yyhl2327 { - yyb2327 = yyj2327 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2327 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2327 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = NodeConditionType(r.DecodeString()) } - yyj2327++ - if yyhl2327 { - yyb2327 = yyj2327 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2327 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2327 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Status = "" } else { x.Status = ConditionStatus(r.DecodeString()) } - yyj2327++ - if yyhl2327 { - yyb2327 = yyj2327 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2327 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2327 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastHeartbeatTime = pkg2_unversioned.Time{} } else { - yyv2330 := &x.LastHeartbeatTime - yym2331 := z.DecBinary() - _ = yym2331 + yyv15 := &x.LastHeartbeatTime + yym16 := z.DecBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.DecExt(yyv2330) { - } else if yym2331 { - z.DecBinaryUnmarshal(yyv2330) - } else if !yym2331 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2330) + } else if z.HasExtensions() && z.DecExt(yyv15) { + } else if yym16 { + z.DecBinaryUnmarshal(yyv15) + } else if !yym16 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv15) } else { - z.DecFallback(yyv2330, false) + z.DecFallback(yyv15, false) } } - yyj2327++ - if yyhl2327 { - yyb2327 = yyj2327 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2327 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2327 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTransitionTime = pkg2_unversioned.Time{} } else { - yyv2332 := &x.LastTransitionTime - yym2333 := z.DecBinary() - _ = yym2333 + yyv17 := &x.LastTransitionTime + yym18 := z.DecBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.DecExt(yyv2332) { - } else if yym2333 { - z.DecBinaryUnmarshal(yyv2332) - } else if !yym2333 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2332) + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else if yym18 { + z.DecBinaryUnmarshal(yyv17) + } else if !yym18 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv17) } else { - z.DecFallback(yyv2332, false) + z.DecFallback(yyv17, false) } } - yyj2327++ - if yyhl2327 { - yyb2327 = yyj2327 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2327 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2327 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj2327++ - if yyhl2327 { - yyb2327 = yyj2327 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2327 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2327 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } for { - yyj2327++ - if yyhl2327 { - yyb2327 = yyj2327 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb2327 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb2327 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj2327-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x NodeAddressType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2336 := z.EncBinary() - _ = yym2336 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -27763,8 +34361,8 @@ func (x *NodeAddressType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2337 := z.DecBinary() - _ = yym2337 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -27779,51 +34377,61 @@ func (x *NodeAddress) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2338 := z.EncBinary() - _ = yym2338 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2339 := !z.EncBinary() - yy2arr2339 := z.EncBasicHandle().StructToArray - var yyq2339 [2]bool - _, _, _ = yysep2339, yyq2339, yy2arr2339 - const yyr2339 bool = false - if yyr2339 || yy2arr2339 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn2339 int = 2 - for _, b := range yyq2339 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn2339++ + yynn2++ } } - r.EncodeMapStart(yynn2339) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2339 || yy2arr2339 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr2339 || yy2arr2339 { - yym2342 := z.EncBinary() - _ = yym2342 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Address)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("address")) - yym2343 := z.EncBinary() - _ = yym2343 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Address)) } } - if yysep2339 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -27833,24 +34441,25 @@ func (x *NodeAddress) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2344 := z.DecBinary() - _ = yym2344 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2345 := r.ReadMapStart() - if yyl2345 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2345, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2345 := r.ReadArrayStart() - if yyl2345 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2345, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -27862,12 +34471,12 @@ func (x *NodeAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2346Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2346Slc - var yyhl2346 bool = l >= 0 - for yyj2346 := 0; ; yyj2346++ { - if yyhl2346 { - if yyj2346 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -27875,9 +34484,11 @@ func (x *NodeAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2346Slc = r.DecodeBytes(yys2346Slc, true, true) - yys2346 := string(yys2346Slc) - switch yys2346 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -27891,72 +34502,73 @@ func (x *NodeAddress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Address = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2346) - } // end switch yys2346 - } // end for yyj2346 - if !yyhl2346 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeAddress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2349 int - var yyb2349 bool - var yyhl2349 bool = l >= 0 - yyj2349++ - if yyhl2349 { - yyb2349 = yyj2349 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2349 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2349 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = NodeAddressType(r.DecodeString()) } - yyj2349++ - if yyhl2349 { - yyb2349 = yyj2349 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2349 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2349 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Address = "" } else { x.Address = string(r.DecodeString()) } for { - yyj2349++ - if yyhl2349 { - yyb2349 = yyj2349 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2349 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2349 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj2349-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x ResourceName) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2352 := z.EncBinary() - _ = yym2352 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -27968,8 +34580,8 @@ func (x *ResourceName) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2353 := z.DecBinary() - _ = yym2353 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -27984,8 +34596,8 @@ func (x ResourceList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2354 := z.EncBinary() - _ = yym2354 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -27998,8 +34610,8 @@ func (x *ResourceList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2355 := z.DecBinary() - _ = yym2355 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -28014,120 +34626,139 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2356 := z.EncBinary() - _ = yym2356 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2357 := !z.EncBinary() - yy2arr2357 := z.EncBasicHandle().StructToArray - var yyq2357 [5]bool - _, _, _ = yysep2357, yyq2357, yy2arr2357 - const yyr2357 bool = false - yyq2357[0] = x.Kind != "" - yyq2357[1] = x.APIVersion != "" - yyq2357[2] = true - yyq2357[3] = true - yyq2357[4] = true - if yyr2357 || yy2arr2357 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn2357 int = 0 - for _, b := range yyq2357 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2357++ + yynn2++ } } - r.EncodeMapStart(yynn2357) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2357 || yy2arr2357 { - if yyq2357[0] { - yym2359 := z.EncBinary() - _ = yym2359 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2357[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2360 := z.EncBinary() - _ = yym2360 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2357 || yy2arr2357 { - if yyq2357[1] { - yym2362 := z.EncBinary() - _ = yym2362 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2357[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2363 := z.EncBinary() - _ = yym2363 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2357 || yy2arr2357 { - if yyq2357[2] { - yy2365 := &x.ObjectMeta - yy2365.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2357[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2366 := &x.ObjectMeta - yy2366.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr2357 || yy2arr2357 { - if yyq2357[3] { - yy2368 := &x.Spec - yy2368.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2357[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy2369 := &x.Spec - yy2369.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr2357 || yy2arr2357 { - if yyq2357[4] { - yy2371 := &x.Status - yy2371.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2357[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy2372 := &x.Status - yy2372.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep2357 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -28137,24 +34768,25 @@ func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2373 := z.DecBinary() - _ = yym2373 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2374 := r.ReadMapStart() - if yyl2374 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2374, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2374 := r.ReadArrayStart() - if yyl2374 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2374, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -28166,12 +34798,12 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2375Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2375Slc - var yyhl2375 bool = l >= 0 - for yyj2375 := 0; ; yyj2375++ { - if yyhl2375 { - if yyj2375 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -28179,9 +34811,32 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2375Slc = r.DecodeBytes(yys2375Slc, true, true) - yys2375 := string(yys2375Slc) - switch yys2375 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = NodeSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = NodeStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -28194,134 +34849,117 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2378 := &x.ObjectMeta - yyv2378.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = NodeSpec{} - } else { - yyv2379 := &x.Spec - yyv2379.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = NodeStatus{} - } else { - yyv2380 := &x.Status - yyv2380.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys2375) - } // end switch yys2375 - } // end for yyj2375 - if !yyhl2375 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2381 int - var yyb2381 bool - var yyhl2381 bool = l >= 0 - yyj2381++ - if yyhl2381 { - yyb2381 = yyj2381 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2381 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2381 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = NodeSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = NodeStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2381++ - if yyhl2381 { - yyb2381 = yyj2381 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2381 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2381 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2381++ - if yyhl2381 { - yyb2381 = yyj2381 > l - } else { - yyb2381 = r.CheckBreak() - } - if yyb2381 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2384 := &x.ObjectMeta - yyv2384.CodecDecodeSelf(d) - } - yyj2381++ - if yyhl2381 { - yyb2381 = yyj2381 > l - } else { - yyb2381 = r.CheckBreak() - } - if yyb2381 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = NodeSpec{} - } else { - yyv2385 := &x.Spec - yyv2385.CodecDecodeSelf(d) - } - yyj2381++ - if yyhl2381 { - yyb2381 = yyj2381 > l - } else { - yyb2381 = r.CheckBreak() - } - if yyb2381 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = NodeStatus{} - } else { - yyv2386 := &x.Status - yyv2386.CodecDecodeSelf(d) - } for { - yyj2381++ - if yyhl2381 { - yyb2381 = yyj2381 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2381 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2381 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj2381-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NodeList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -28331,126 +34969,142 @@ func (x *NodeList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2387 := z.EncBinary() - _ = yym2387 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2388 := !z.EncBinary() - yy2arr2388 := z.EncBasicHandle().StructToArray - var yyq2388 [4]bool - _, _, _ = yysep2388, yyq2388, yy2arr2388 - const yyr2388 bool = false - yyq2388[0] = x.Kind != "" - yyq2388[1] = x.APIVersion != "" - yyq2388[2] = true - if yyr2388 || yy2arr2388 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2388 int = 1 - for _, b := range yyq2388 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2388++ + yynn2++ } } - r.EncodeMapStart(yynn2388) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2388 || yy2arr2388 { - if yyq2388[0] { - yym2390 := z.EncBinary() - _ = yym2390 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2388[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2391 := z.EncBinary() - _ = yym2391 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2388 || yy2arr2388 { - if yyq2388[1] { - yym2393 := z.EncBinary() - _ = yym2393 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2388[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2394 := z.EncBinary() - _ = yym2394 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2388 || yy2arr2388 { - if yyq2388[2] { - yy2396 := &x.ListMeta - yym2397 := z.EncBinary() - _ = yym2397 - if false { - } else if z.HasExtensions() && z.EncExt(yy2396) { - } else { - z.EncFallback(yy2396) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2388[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2398 := &x.ListMeta - yym2399 := z.EncBinary() - _ = yym2399 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2398) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2398) + z.EncFallback(yy6) } } } - if yyr2388 || yy2arr2388 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2401 := z.EncBinary() - _ = yym2401 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceNode(([]Node)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2402 := z.EncBinary() - _ = yym2402 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceNode(([]Node)(x.Items), e) } } } - if yysep2388 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -28460,24 +35114,25 @@ func (x *NodeList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2403 := z.DecBinary() - _ = yym2403 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2404 := r.ReadMapStart() - if yyl2404 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2404, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2404 := r.ReadArrayStart() - if yyl2404 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2404, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -28489,12 +35144,12 @@ func (x *NodeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2405Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2405Slc - var yyhl2405 bool = l >= 0 - for yyj2405 := 0; ; yyj2405++ { - if yyhl2405 { - if yyj2405 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -28502,9 +35157,36 @@ func (x *NodeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2405Slc = r.DecodeBytes(yys2405Slc, true, true) - yys2405 := string(yys2405Slc) - switch yys2405 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceNode((*[]Node)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -28517,141 +35199,119 @@ func (x *NodeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2408 := &x.ListMeta - yym2409 := z.DecBinary() - _ = yym2409 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2408) { - } else { - z.DecFallback(yyv2408, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2410 := &x.Items - yym2411 := z.DecBinary() - _ = yym2411 - if false { - } else { - h.decSliceNode((*[]Node)(yyv2410), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2405) - } // end switch yys2405 - } // end for yyj2405 - if !yyhl2405 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2412 int - var yyb2412 bool - var yyhl2412 bool = l >= 0 - yyj2412++ - if yyhl2412 { - yyb2412 = yyj2412 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2412 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2412 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceNode((*[]Node)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2412++ - if yyhl2412 { - yyb2412 = yyj2412 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2412 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2412 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2412++ - if yyhl2412 { - yyb2412 = yyj2412 > l - } else { - yyb2412 = r.CheckBreak() - } - if yyb2412 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2415 := &x.ListMeta - yym2416 := z.DecBinary() - _ = yym2416 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2415) { - } else { - z.DecFallback(yyv2415, false) - } - } - yyj2412++ - if yyhl2412 { - yyb2412 = yyj2412 > l - } else { - yyb2412 = r.CheckBreak() - } - if yyb2412 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2417 := &x.Items - yym2418 := z.DecBinary() - _ = yym2418 - if false { - } else { - h.decSliceNode((*[]Node)(yyv2417), d) - } - } for { - yyj2412++ - if yyhl2412 { - yyb2412 = yyj2412 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2412 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2412 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2412-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x FinalizerName) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2419 := z.EncBinary() - _ = yym2419 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -28663,8 +35323,8 @@ func (x *FinalizerName) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2420 := z.DecBinary() - _ = yym2420 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -28679,35 +35339,38 @@ func (x *NamespaceSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2421 := z.EncBinary() - _ = yym2421 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2422 := !z.EncBinary() - yy2arr2422 := z.EncBasicHandle().StructToArray - var yyq2422 [1]bool - _, _, _ = yysep2422, yyq2422, yy2arr2422 - const yyr2422 bool = false - yyq2422[0] = len(x.Finalizers) != 0 - if yyr2422 || yy2arr2422 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Finalizers) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2422 int = 0 - for _, b := range yyq2422 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2422++ + yynn2++ } } - r.EncodeMapStart(yynn2422) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2422 || yy2arr2422 { - if yyq2422[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Finalizers == nil { r.EncodeNil() } else { - yym2424 := z.EncBinary() - _ = yym2424 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceFinalizerName(([]FinalizerName)(x.Finalizers), e) @@ -28717,13 +35380,15 @@ func (x *NamespaceSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2422[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("finalizers")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Finalizers == nil { r.EncodeNil() } else { - yym2425 := z.EncBinary() - _ = yym2425 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceFinalizerName(([]FinalizerName)(x.Finalizers), e) @@ -28731,8 +35396,10 @@ func (x *NamespaceSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep2422 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -28742,24 +35409,25 @@ func (x *NamespaceSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2426 := z.DecBinary() - _ = yym2426 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2427 := r.ReadMapStart() - if yyl2427 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2427, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2427 := r.ReadArrayStart() - if yyl2427 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2427, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -28771,12 +35439,12 @@ func (x *NamespaceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2428Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2428Slc - var yyhl2428 bool = l >= 0 - for yyj2428 := 0; ; yyj2428++ { - if yyhl2428 { - if yyj2428 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -28784,71 +35452,73 @@ func (x *NamespaceSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2428Slc = r.DecodeBytes(yys2428Slc, true, true) - yys2428 := string(yys2428Slc) - switch yys2428 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "finalizers": if r.TryDecodeAsNil() { x.Finalizers = nil } else { - yyv2429 := &x.Finalizers - yym2430 := z.DecBinary() - _ = yym2430 + yyv4 := &x.Finalizers + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceFinalizerName((*[]FinalizerName)(yyv2429), d) + h.decSliceFinalizerName((*[]FinalizerName)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys2428) - } // end switch yys2428 - } // end for yyj2428 - if !yyhl2428 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NamespaceSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2431 int - var yyb2431 bool - var yyhl2431 bool = l >= 0 - yyj2431++ - if yyhl2431 { - yyb2431 = yyj2431 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2431 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2431 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Finalizers = nil } else { - yyv2432 := &x.Finalizers - yym2433 := z.DecBinary() - _ = yym2433 + yyv7 := &x.Finalizers + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceFinalizerName((*[]FinalizerName)(yyv2432), d) + h.decSliceFinalizerName((*[]FinalizerName)(yyv7), d) } } for { - yyj2431++ - if yyhl2431 { - yyb2431 = yyj2431 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2431 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2431 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj2431-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NamespaceStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -28858,42 +35528,49 @@ func (x *NamespaceStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2434 := z.EncBinary() - _ = yym2434 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2435 := !z.EncBinary() - yy2arr2435 := z.EncBasicHandle().StructToArray - var yyq2435 [1]bool - _, _, _ = yysep2435, yyq2435, yy2arr2435 - const yyr2435 bool = false - yyq2435[0] = x.Phase != "" - if yyr2435 || yy2arr2435 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Phase != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2435 int = 0 - for _, b := range yyq2435 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2435++ + yynn2++ } } - r.EncodeMapStart(yynn2435) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2435 || yy2arr2435 { - if yyq2435[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Phase.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2435[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("phase")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Phase.CodecEncodeSelf(e) } } - if yysep2435 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -28903,24 +35580,25 @@ func (x *NamespaceStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2437 := z.DecBinary() - _ = yym2437 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2438 := r.ReadMapStart() - if yyl2438 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2438, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2438 := r.ReadArrayStart() - if yyl2438 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2438, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -28932,12 +35610,12 @@ func (x *NamespaceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2439Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2439Slc - var yyhl2439 bool = l >= 0 - for yyj2439 := 0; ; yyj2439++ { - if yyhl2439 { - if yyj2439 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -28945,9 +35623,11 @@ func (x *NamespaceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2439Slc = r.DecodeBytes(yys2439Slc, true, true) - yys2439 := string(yys2439Slc) - switch yys2439 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "phase": if r.TryDecodeAsNil() { x.Phase = "" @@ -28955,57 +35635,57 @@ func (x *NamespaceStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Phase = NamespacePhase(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2439) - } // end switch yys2439 - } // end for yyj2439 - if !yyhl2439 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NamespaceStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2441 int - var yyb2441 bool - var yyhl2441 bool = l >= 0 - yyj2441++ - if yyhl2441 { - yyb2441 = yyj2441 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2441 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2441 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Phase = "" } else { x.Phase = NamespacePhase(r.DecodeString()) } for { - yyj2441++ - if yyhl2441 { - yyb2441 = yyj2441 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2441 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2441 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj2441-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x NamespacePhase) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2443 := z.EncBinary() - _ = yym2443 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -29017,8 +35697,8 @@ func (x *NamespacePhase) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2444 := z.DecBinary() - _ = yym2444 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -29033,120 +35713,139 @@ func (x *Namespace) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2445 := z.EncBinary() - _ = yym2445 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2446 := !z.EncBinary() - yy2arr2446 := z.EncBasicHandle().StructToArray - var yyq2446 [5]bool - _, _, _ = yysep2446, yyq2446, yy2arr2446 - const yyr2446 bool = false - yyq2446[0] = x.Kind != "" - yyq2446[1] = x.APIVersion != "" - yyq2446[2] = true - yyq2446[3] = true - yyq2446[4] = true - if yyr2446 || yy2arr2446 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn2446 int = 0 - for _, b := range yyq2446 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2446++ + yynn2++ } } - r.EncodeMapStart(yynn2446) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2446 || yy2arr2446 { - if yyq2446[0] { - yym2448 := z.EncBinary() - _ = yym2448 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2446[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2449 := z.EncBinary() - _ = yym2449 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2446 || yy2arr2446 { - if yyq2446[1] { - yym2451 := z.EncBinary() - _ = yym2451 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2446[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2452 := z.EncBinary() - _ = yym2452 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2446 || yy2arr2446 { - if yyq2446[2] { - yy2454 := &x.ObjectMeta - yy2454.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2446[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2455 := &x.ObjectMeta - yy2455.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr2446 || yy2arr2446 { - if yyq2446[3] { - yy2457 := &x.Spec - yy2457.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2446[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy2458 := &x.Spec - yy2458.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr2446 || yy2arr2446 { - if yyq2446[4] { - yy2460 := &x.Status - yy2460.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2446[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy2461 := &x.Status - yy2461.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep2446 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -29156,24 +35855,25 @@ func (x *Namespace) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2462 := z.DecBinary() - _ = yym2462 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2463 := r.ReadMapStart() - if yyl2463 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2463, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2463 := r.ReadArrayStart() - if yyl2463 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2463, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -29185,12 +35885,12 @@ func (x *Namespace) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2464Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2464Slc - var yyhl2464 bool = l >= 0 - for yyj2464 := 0; ; yyj2464++ { - if yyhl2464 { - if yyj2464 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -29198,9 +35898,32 @@ func (x *Namespace) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2464Slc = r.DecodeBytes(yys2464Slc, true, true) - yys2464 := string(yys2464Slc) - switch yys2464 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = NamespaceSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = NamespaceStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -29213,134 +35936,117 @@ func (x *Namespace) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2467 := &x.ObjectMeta - yyv2467.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = NamespaceSpec{} - } else { - yyv2468 := &x.Spec - yyv2468.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = NamespaceStatus{} - } else { - yyv2469 := &x.Status - yyv2469.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys2464) - } // end switch yys2464 - } // end for yyj2464 - if !yyhl2464 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Namespace) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2470 int - var yyb2470 bool - var yyhl2470 bool = l >= 0 - yyj2470++ - if yyhl2470 { - yyb2470 = yyj2470 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2470 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2470 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = NamespaceSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = NamespaceStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2470++ - if yyhl2470 { - yyb2470 = yyj2470 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2470 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2470 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2470++ - if yyhl2470 { - yyb2470 = yyj2470 > l - } else { - yyb2470 = r.CheckBreak() - } - if yyb2470 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2473 := &x.ObjectMeta - yyv2473.CodecDecodeSelf(d) - } - yyj2470++ - if yyhl2470 { - yyb2470 = yyj2470 > l - } else { - yyb2470 = r.CheckBreak() - } - if yyb2470 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = NamespaceSpec{} - } else { - yyv2474 := &x.Spec - yyv2474.CodecDecodeSelf(d) - } - yyj2470++ - if yyhl2470 { - yyb2470 = yyj2470 > l - } else { - yyb2470 = r.CheckBreak() - } - if yyb2470 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = NamespaceStatus{} - } else { - yyv2475 := &x.Status - yyv2475.CodecDecodeSelf(d) - } for { - yyj2470++ - if yyhl2470 { - yyb2470 = yyj2470 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb2470 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb2470 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj2470-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *NamespaceList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -29350,126 +36056,142 @@ func (x *NamespaceList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2476 := z.EncBinary() - _ = yym2476 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2477 := !z.EncBinary() - yy2arr2477 := z.EncBasicHandle().StructToArray - var yyq2477 [4]bool - _, _, _ = yysep2477, yyq2477, yy2arr2477 - const yyr2477 bool = false - yyq2477[0] = x.Kind != "" - yyq2477[1] = x.APIVersion != "" - yyq2477[2] = true - if yyr2477 || yy2arr2477 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2477 int = 1 - for _, b := range yyq2477 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2477++ + yynn2++ } } - r.EncodeMapStart(yynn2477) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2477 || yy2arr2477 { - if yyq2477[0] { - yym2479 := z.EncBinary() - _ = yym2479 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2477[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2480 := z.EncBinary() - _ = yym2480 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2477 || yy2arr2477 { - if yyq2477[1] { - yym2482 := z.EncBinary() - _ = yym2482 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2477[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2483 := z.EncBinary() - _ = yym2483 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2477 || yy2arr2477 { - if yyq2477[2] { - yy2485 := &x.ListMeta - yym2486 := z.EncBinary() - _ = yym2486 - if false { - } else if z.HasExtensions() && z.EncExt(yy2485) { - } else { - z.EncFallback(yy2485) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2477[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2487 := &x.ListMeta - yym2488 := z.EncBinary() - _ = yym2488 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2487) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2487) + z.EncFallback(yy6) } } } - if yyr2477 || yy2arr2477 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2490 := z.EncBinary() - _ = yym2490 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceNamespace(([]Namespace)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2491 := z.EncBinary() - _ = yym2491 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceNamespace(([]Namespace)(x.Items), e) } } } - if yysep2477 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -29479,24 +36201,25 @@ func (x *NamespaceList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2492 := z.DecBinary() - _ = yym2492 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2493 := r.ReadMapStart() - if yyl2493 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2493, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2493 := r.ReadArrayStart() - if yyl2493 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2493, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -29508,12 +36231,12 @@ func (x *NamespaceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2494Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2494Slc - var yyhl2494 bool = l >= 0 - for yyj2494 := 0; ; yyj2494++ { - if yyhl2494 { - if yyj2494 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -29521,9 +36244,36 @@ func (x *NamespaceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2494Slc = r.DecodeBytes(yys2494Slc, true, true) - yys2494 := string(yys2494Slc) - switch yys2494 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceNamespace((*[]Namespace)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -29536,133 +36286,111 @@ func (x *NamespaceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2497 := &x.ListMeta - yym2498 := z.DecBinary() - _ = yym2498 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2497) { - } else { - z.DecFallback(yyv2497, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2499 := &x.Items - yym2500 := z.DecBinary() - _ = yym2500 - if false { - } else { - h.decSliceNamespace((*[]Namespace)(yyv2499), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2494) - } // end switch yys2494 - } // end for yyj2494 - if !yyhl2494 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NamespaceList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2501 int - var yyb2501 bool - var yyhl2501 bool = l >= 0 - yyj2501++ - if yyhl2501 { - yyb2501 = yyj2501 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2501 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2501 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceNamespace((*[]Namespace)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2501++ - if yyhl2501 { - yyb2501 = yyj2501 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2501 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2501 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2501++ - if yyhl2501 { - yyb2501 = yyj2501 > l - } else { - yyb2501 = r.CheckBreak() - } - if yyb2501 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2504 := &x.ListMeta - yym2505 := z.DecBinary() - _ = yym2505 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2504) { - } else { - z.DecFallback(yyv2504, false) - } - } - yyj2501++ - if yyhl2501 { - yyb2501 = yyj2501 > l - } else { - yyb2501 = r.CheckBreak() - } - if yyb2501 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2506 := &x.Items - yym2507 := z.DecBinary() - _ = yym2507 - if false { - } else { - h.decSliceNamespace((*[]Namespace)(yyv2506), d) - } - } for { - yyj2501++ - if yyhl2501 { - yyb2501 = yyj2501 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2501 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2501 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2501-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Binding) CodecEncodeSelf(e *codec1978.Encoder) { @@ -29672,98 +36400,114 @@ func (x *Binding) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2508 := z.EncBinary() - _ = yym2508 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2509 := !z.EncBinary() - yy2arr2509 := z.EncBasicHandle().StructToArray - var yyq2509 [4]bool - _, _, _ = yysep2509, yyq2509, yy2arr2509 - const yyr2509 bool = false - yyq2509[0] = x.Kind != "" - yyq2509[1] = x.APIVersion != "" - yyq2509[2] = true - if yyr2509 || yy2arr2509 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2509 int = 1 - for _, b := range yyq2509 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2509++ + yynn2++ } } - r.EncodeMapStart(yynn2509) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2509 || yy2arr2509 { - if yyq2509[0] { - yym2511 := z.EncBinary() - _ = yym2511 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2509[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2512 := z.EncBinary() - _ = yym2512 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2509 || yy2arr2509 { - if yyq2509[1] { - yym2514 := z.EncBinary() - _ = yym2514 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2509[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2515 := z.EncBinary() - _ = yym2515 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2509 || yy2arr2509 { - if yyq2509[2] { - yy2517 := &x.ObjectMeta - yy2517.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2509[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2518 := &x.ObjectMeta - yy2518.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr2509 || yy2arr2509 { - yy2520 := &x.Target - yy2520.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy9 := &x.Target + yy9.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("target")) - yy2521 := &x.Target - yy2521.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Target + yy11.CodecEncodeSelf(e) } - if yysep2509 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -29773,24 +36517,25 @@ func (x *Binding) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2522 := z.DecBinary() - _ = yym2522 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2523 := r.ReadMapStart() - if yyl2523 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2523, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2523 := r.ReadArrayStart() - if yyl2523 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2523, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -29802,12 +36547,12 @@ func (x *Binding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2524Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2524Slc - var yyhl2524 bool = l >= 0 - for yyj2524 := 0; ; yyj2524++ { - if yyhl2524 { - if yyj2524 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -29815,9 +36560,25 @@ func (x *Binding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2524Slc = r.DecodeBytes(yys2524Slc, true, true) - yys2524 := string(yys2524Slc) - switch yys2524 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "target": + if r.TryDecodeAsNil() { + x.Target = ObjectReference{} + } else { + yyv5 := &x.Target + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -29830,111 +36591,100 @@ func (x *Binding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2527 := &x.ObjectMeta - yyv2527.CodecDecodeSelf(d) - } - case "target": - if r.TryDecodeAsNil() { - x.Target = ObjectReference{} - } else { - yyv2528 := &x.Target - yyv2528.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys2524) - } // end switch yys2524 - } // end for yyj2524 - if !yyhl2524 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Binding) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2529 int - var yyb2529 bool - var yyhl2529 bool = l >= 0 - yyj2529++ - if yyhl2529 { - yyb2529 = yyj2529 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2529 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2529 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Target = ObjectReference{} + } else { + yyv10 := &x.Target + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2529++ - if yyhl2529 { - yyb2529 = yyj2529 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2529 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2529 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2529++ - if yyhl2529 { - yyb2529 = yyj2529 > l - } else { - yyb2529 = r.CheckBreak() - } - if yyb2529 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv2532 := &x.ObjectMeta - yyv2532.CodecDecodeSelf(d) - } - yyj2529++ - if yyhl2529 { - yyb2529 = yyj2529 > l - } else { - yyb2529 = r.CheckBreak() - } - if yyb2529 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Target = ObjectReference{} - } else { - yyv2533 := &x.Target - yyv2533.CodecDecodeSelf(d) - } for { - yyj2529++ - if yyhl2529 { - yyb2529 = yyj2529 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2529 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2529 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj2529-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { @@ -29944,101 +36694,114 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2534 := z.EncBinary() - _ = yym2534 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2535 := !z.EncBinary() - yy2arr2535 := z.EncBasicHandle().StructToArray - var yyq2535 [3]bool - _, _, _ = yysep2535, yyq2535, yy2arr2535 - const yyr2535 bool = false - yyq2535[0] = x.Kind != "" - yyq2535[1] = x.APIVersion != "" - if yyr2535 || yy2arr2535 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Kind != "" + yyq2[2] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn2535 int = 1 - for _, b := range yyq2535 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2535++ + yynn2++ } } - r.EncodeMapStart(yynn2535) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2535 || yy2arr2535 { - if yyq2535[0] { - yym2537 := z.EncBinary() - _ = yym2537 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2535[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2538 := z.EncBinary() - _ = yym2538 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2535 || yy2arr2535 { - if yyq2535[1] { - yym2540 := z.EncBinary() - _ = yym2540 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2535[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2541 := z.EncBinary() - _ = yym2541 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2535 || yy2arr2535 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.GracePeriodSeconds == nil { r.EncodeNil() } else { - yy2543 := *x.GracePeriodSeconds - yym2544 := z.EncBinary() - _ = yym2544 + yy4 := *x.GracePeriodSeconds + yym5 := z.EncBinary() + _ = yym5 if false { } else { - r.EncodeInt(int64(yy2543)) + r.EncodeInt(int64(yy4)) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("gracePeriodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.GracePeriodSeconds == nil { r.EncodeNil() } else { - yy2545 := *x.GracePeriodSeconds - yym2546 := z.EncBinary() - _ = yym2546 + yy6 := *x.GracePeriodSeconds + yym7 := z.EncBinary() + _ = yym7 if false { } else { - r.EncodeInt(int64(yy2545)) + r.EncodeInt(int64(yy6)) } } } - if yysep2535 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -30048,24 +36811,25 @@ func (x *DeleteOptions) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2547 := z.DecBinary() - _ = yym2547 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2548 := r.ReadMapStart() - if yyl2548 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2548, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2548 := r.ReadArrayStart() - if yyl2548 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2548, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -30077,12 +36841,12 @@ func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2549Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2549Slc - var yyhl2549 bool = l >= 0 - for yyj2549 := 0; ; yyj2549++ { - if yyhl2549 { - if yyj2549 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -30090,9 +36854,27 @@ func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2549Slc = r.DecodeBytes(yys2549Slc, true, true) - yys2549 := string(yys2549Slc) - switch yys2549 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "gracePeriodSeconds": + if r.TryDecodeAsNil() { + if x.GracePeriodSeconds != nil { + x.GracePeriodSeconds = nil + } + } else { + if x.GracePeriodSeconds == nil { + x.GracePeriodSeconds = new(int64) + } + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64)) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -30105,78 +36887,31 @@ func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "gracePeriodSeconds": - if r.TryDecodeAsNil() { - if x.GracePeriodSeconds != nil { - x.GracePeriodSeconds = nil - } - } else { - if x.GracePeriodSeconds == nil { - x.GracePeriodSeconds = new(int64) - } - yym2553 := z.DecBinary() - _ = yym2553 - if false { - } else { - *((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64)) - } - } default: - z.DecStructFieldNotFound(-1, yys2549) - } // end switch yys2549 - } // end for yyj2549 - if !yyhl2549 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2554 int - var yyb2554 bool - var yyhl2554 bool = l >= 0 - yyj2554++ - if yyhl2554 { - yyb2554 = yyj2554 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2554 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2554 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2554++ - if yyhl2554 { - yyb2554 = yyj2554 > l - } else { - yyb2554 = r.CheckBreak() - } - if yyb2554 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2554++ - if yyhl2554 { - yyb2554 = yyj2554 > l - } else { - yyb2554 = r.CheckBreak() - } - if yyb2554 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.GracePeriodSeconds != nil { x.GracePeriodSeconds = nil @@ -30185,26 +36920,358 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.GracePeriodSeconds == nil { x.GracePeriodSeconds = new(int64) } - yym2558 := z.DecBinary() - _ = yym2558 + yym10 := z.DecBinary() + _ = yym10 if false { } else { *((*int64)(x.GracePeriodSeconds)) = int64(r.DecodeInt(64)) } } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj2554++ - if yyhl2554 { - yyb2554 = yyj2554 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb2554 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb2554 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj2554-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ExportOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Export)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("export")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Export)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Exact)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("exact")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Exact)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ExportOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ExportOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "export": + if r.TryDecodeAsNil() { + x.Export = false + } else { + x.Export = bool(r.DecodeBool()) + } + case "exact": + if r.TryDecodeAsNil() { + x.Exact = false + } else { + x.Exact = bool(r.DecodeBool()) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ExportOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Export = false + } else { + x.Export = bool(r.DecodeBool()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Exact = false + } else { + x.Exact = bool(r.DecodeBool()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { @@ -30214,81 +37281,41 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2559 := z.EncBinary() - _ = yym2559 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2560 := !z.EncBinary() - yy2arr2560 := z.EncBasicHandle().StructToArray - var yyq2560 [6]bool - _, _, _ = yysep2560, yyq2560, yy2arr2560 - const yyr2560 bool = false - yyq2560[0] = x.Kind != "" - yyq2560[1] = x.APIVersion != "" - yyq2560[2] = x.LabelSelector != "" - yyq2560[3] = x.FieldSelector != "" - yyq2560[4] = x.Watch != false - yyq2560[5] = x.ResourceVersion != "" - if yyr2560 || yy2arr2560 { - r.EncodeArrayStart(6) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.LabelSelector != "" + yyq2[1] = x.FieldSelector != "" + yyq2[2] = x.Watch != false + yyq2[3] = x.ResourceVersion != "" + yyq2[4] = x.TimeoutSeconds != nil + yyq2[5] = x.Kind != "" + yyq2[6] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(7) } else { - var yynn2560 int = 0 - for _, b := range yyq2560 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2560++ + yynn2++ } } - r.EncodeMapStart(yynn2560) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2560 || yy2arr2560 { - if yyq2560[0] { - yym2562 := z.EncBinary() - _ = yym2562 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2560[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2563 := z.EncBinary() - _ = yym2563 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2560 || yy2arr2560 { - if yyq2560[1] { - yym2565 := z.EncBinary() - _ = yym2565 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2560[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2566 := z.EncBinary() - _ = yym2566 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2560 || yy2arr2560 { - if yyq2560[2] { - yym2568 := z.EncBinary() - _ = yym2568 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.LabelSelector)) @@ -30297,20 +37324,23 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2560[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("labelSelector")) - yym2569 := z.EncBinary() - _ = yym2569 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.LabelSelector)) } } } - if yyr2560 || yy2arr2560 { - if yyq2560[3] { - yym2571 := z.EncBinary() - _ = yym2571 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldSelector)) @@ -30319,20 +37349,23 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2560[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fieldSelector")) - yym2572 := z.EncBinary() - _ = yym2572 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldSelector)) } } } - if yyr2560 || yy2arr2560 { - if yyq2560[4] { - yym2574 := z.EncBinary() - _ = yym2574 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeBool(bool(x.Watch)) @@ -30341,20 +37374,23 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeBool(false) } } else { - if yyq2560[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("watch")) - yym2575 := z.EncBinary() - _ = yym2575 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeBool(bool(x.Watch)) } } } - if yyr2560 || yy2arr2560 { - if yyq2560[5] { - yym2577 := z.EncBinary() - _ = yym2577 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) @@ -30363,18 +37399,107 @@ func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2560[5] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resourceVersion")) - yym2578 := z.EncBinary() - _ = yym2578 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) } } } - if yysep2560 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.TimeoutSeconds == nil { + r.EncodeNil() + } else { + yy16 := *x.TimeoutSeconds + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeInt(int64(yy16)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("timeoutSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.TimeoutSeconds == nil { + r.EncodeNil() + } else { + yy18 := *x.TimeoutSeconds + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeInt(int64(yy18)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym21 := z.EncBinary() + _ = yym21 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym24 := z.EncBinary() + _ = yym24 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -30384,24 +37509,25 @@ func (x *ListOptions) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2579 := z.DecBinary() - _ = yym2579 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2580 := r.ReadMapStart() - if yyl2580 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2580, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2580 := r.ReadArrayStart() - if yyl2580 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2580, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -30413,12 +37539,12 @@ func (x *ListOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2581Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2581Slc - var yyhl2581 bool = l >= 0 - for yyj2581 := 0; ; yyj2581++ { - if yyhl2581 { - if yyj2581 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -30426,21 +37552,11 @@ func (x *ListOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2581Slc = r.DecodeBytes(yys2581Slc, true, true) - yys2581 := string(yys2581Slc) - switch yys2581 { - case "kind": - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - case "apiVersion": - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "labelSelector": if r.TryDecodeAsNil() { x.LabelSelector = "" @@ -30465,489 +37581,22 @@ func (x *ListOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.ResourceVersion = string(r.DecodeString()) } - default: - z.DecStructFieldNotFound(-1, yys2581) - } // end switch yys2581 - } // end for yyj2581 - if !yyhl2581 { - r.ReadEnd() - } -} - -func (x *ListOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj2588 int - var yyb2588 bool - var yyhl2588 bool = l >= 0 - yyj2588++ - if yyhl2588 { - yyb2588 = yyj2588 > l - } else { - yyb2588 = r.CheckBreak() - } - if yyb2588 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2588++ - if yyhl2588 { - yyb2588 = yyj2588 > l - } else { - yyb2588 = r.CheckBreak() - } - if yyb2588 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2588++ - if yyhl2588 { - yyb2588 = yyj2588 > l - } else { - yyb2588 = r.CheckBreak() - } - if yyb2588 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.LabelSelector = "" - } else { - x.LabelSelector = string(r.DecodeString()) - } - yyj2588++ - if yyhl2588 { - yyb2588 = yyj2588 > l - } else { - yyb2588 = r.CheckBreak() - } - if yyb2588 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.FieldSelector = "" - } else { - x.FieldSelector = string(r.DecodeString()) - } - yyj2588++ - if yyhl2588 { - yyb2588 = yyj2588 > l - } else { - yyb2588 = r.CheckBreak() - } - if yyb2588 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Watch = false - } else { - x.Watch = bool(r.DecodeBool()) - } - yyj2588++ - if yyhl2588 { - yyb2588 = yyj2588 > l - } else { - yyb2588 = r.CheckBreak() - } - if yyb2588 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ResourceVersion = "" - } else { - x.ResourceVersion = string(r.DecodeString()) - } - for { - yyj2588++ - if yyhl2588 { - yyb2588 = yyj2588 > l - } else { - yyb2588 = r.CheckBreak() - } - if yyb2588 { - break - } - z.DecStructFieldNotFound(yyj2588-1, "") - } - r.ReadEnd() -} - -func (x *PodLogOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym2595 := z.EncBinary() - _ = yym2595 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2596 := !z.EncBinary() - yy2arr2596 := z.EncBasicHandle().StructToArray - var yyq2596 [10]bool - _, _, _ = yysep2596, yyq2596, yy2arr2596 - const yyr2596 bool = false - yyq2596[0] = x.Kind != "" - yyq2596[1] = x.APIVersion != "" - yyq2596[2] = x.Container != "" - yyq2596[3] = x.Follow != false - yyq2596[4] = x.Previous != false - yyq2596[5] = x.SinceSeconds != nil - yyq2596[6] = x.SinceTime != nil - yyq2596[7] = x.Timestamps != false - yyq2596[8] = x.TailLines != nil - yyq2596[9] = x.LimitBytes != nil - if yyr2596 || yy2arr2596 { - r.EncodeArrayStart(10) - } else { - var yynn2596 int = 0 - for _, b := range yyq2596 { - if b { - yynn2596++ - } + case "timeoutSeconds": + if r.TryDecodeAsNil() { + if x.TimeoutSeconds != nil { + x.TimeoutSeconds = nil } - r.EncodeMapStart(yynn2596) - } - if yyr2596 || yy2arr2596 { - if yyq2596[0] { - yym2598 := z.EncBinary() - _ = yym2598 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } + } else { + if x.TimeoutSeconds == nil { + x.TimeoutSeconds = new(int64) + } + yym9 := z.DecBinary() + _ = yym9 + if false { } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2596[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2599 := z.EncBinary() - _ = yym2599 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } + *((*int64)(x.TimeoutSeconds)) = int64(r.DecodeInt(64)) } } - if yyr2596 || yy2arr2596 { - if yyq2596[1] { - yym2601 := z.EncBinary() - _ = yym2601 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2596[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2602 := z.EncBinary() - _ = yym2602 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2596 || yy2arr2596 { - if yyq2596[2] { - yym2604 := z.EncBinary() - _ = yym2604 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2596[2] { - r.EncodeString(codecSelferC_UTF81234, string("container")) - yym2605 := z.EncBinary() - _ = yym2605 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } - } - if yyr2596 || yy2arr2596 { - if yyq2596[3] { - yym2607 := z.EncBinary() - _ = yym2607 - if false { - } else { - r.EncodeBool(bool(x.Follow)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2596[3] { - r.EncodeString(codecSelferC_UTF81234, string("follow")) - yym2608 := z.EncBinary() - _ = yym2608 - if false { - } else { - r.EncodeBool(bool(x.Follow)) - } - } - } - if yyr2596 || yy2arr2596 { - if yyq2596[4] { - yym2610 := z.EncBinary() - _ = yym2610 - if false { - } else { - r.EncodeBool(bool(x.Previous)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2596[4] { - r.EncodeString(codecSelferC_UTF81234, string("previous")) - yym2611 := z.EncBinary() - _ = yym2611 - if false { - } else { - r.EncodeBool(bool(x.Previous)) - } - } - } - if yyr2596 || yy2arr2596 { - if yyq2596[5] { - if x.SinceSeconds == nil { - r.EncodeNil() - } else { - yy2613 := *x.SinceSeconds - yym2614 := z.EncBinary() - _ = yym2614 - if false { - } else { - r.EncodeInt(int64(yy2613)) - } - } - } else { - r.EncodeNil() - } - } else { - if yyq2596[5] { - r.EncodeString(codecSelferC_UTF81234, string("sinceSeconds")) - if x.SinceSeconds == nil { - r.EncodeNil() - } else { - yy2615 := *x.SinceSeconds - yym2616 := z.EncBinary() - _ = yym2616 - if false { - } else { - r.EncodeInt(int64(yy2615)) - } - } - } - } - if yyr2596 || yy2arr2596 { - if yyq2596[6] { - if x.SinceTime == nil { - r.EncodeNil() - } else { - yym2618 := z.EncBinary() - _ = yym2618 - if false { - } else if z.HasExtensions() && z.EncExt(x.SinceTime) { - } else if yym2618 { - z.EncBinaryMarshal(x.SinceTime) - } else if !yym2618 && z.IsJSONHandle() { - z.EncJSONMarshal(x.SinceTime) - } else { - z.EncFallback(x.SinceTime) - } - } - } else { - r.EncodeNil() - } - } else { - if yyq2596[6] { - r.EncodeString(codecSelferC_UTF81234, string("sinceTime")) - if x.SinceTime == nil { - r.EncodeNil() - } else { - yym2619 := z.EncBinary() - _ = yym2619 - if false { - } else if z.HasExtensions() && z.EncExt(x.SinceTime) { - } else if yym2619 { - z.EncBinaryMarshal(x.SinceTime) - } else if !yym2619 && z.IsJSONHandle() { - z.EncJSONMarshal(x.SinceTime) - } else { - z.EncFallback(x.SinceTime) - } - } - } - } - if yyr2596 || yy2arr2596 { - if yyq2596[7] { - yym2621 := z.EncBinary() - _ = yym2621 - if false { - } else { - r.EncodeBool(bool(x.Timestamps)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2596[7] { - r.EncodeString(codecSelferC_UTF81234, string("timestamps")) - yym2622 := z.EncBinary() - _ = yym2622 - if false { - } else { - r.EncodeBool(bool(x.Timestamps)) - } - } - } - if yyr2596 || yy2arr2596 { - if yyq2596[8] { - if x.TailLines == nil { - r.EncodeNil() - } else { - yy2624 := *x.TailLines - yym2625 := z.EncBinary() - _ = yym2625 - if false { - } else { - r.EncodeInt(int64(yy2624)) - } - } - } else { - r.EncodeNil() - } - } else { - if yyq2596[8] { - r.EncodeString(codecSelferC_UTF81234, string("tailLines")) - if x.TailLines == nil { - r.EncodeNil() - } else { - yy2626 := *x.TailLines - yym2627 := z.EncBinary() - _ = yym2627 - if false { - } else { - r.EncodeInt(int64(yy2626)) - } - } - } - } - if yyr2596 || yy2arr2596 { - if yyq2596[9] { - if x.LimitBytes == nil { - r.EncodeNil() - } else { - yy2629 := *x.LimitBytes - yym2630 := z.EncBinary() - _ = yym2630 - if false { - } else { - r.EncodeInt(int64(yy2629)) - } - } - } else { - r.EncodeNil() - } - } else { - if yyq2596[9] { - r.EncodeString(codecSelferC_UTF81234, string("limitBytes")) - if x.LimitBytes == nil { - r.EncodeNil() - } else { - yy2631 := *x.LimitBytes - yym2632 := z.EncBinary() - _ = yym2632 - if false { - } else { - r.EncodeInt(int64(yy2631)) - } - } - } - } - if yysep2596 { - r.EncodeEnd() - } - } - } -} - -func (x *PodLogOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym2633 := z.DecBinary() - _ = yym2633 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2634 := r.ReadMapStart() - if yyl2634 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl2634, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2634 := r.ReadArrayStart() - if yyl2634 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl2634, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys2635Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2635Slc - var yyhl2635 bool = l >= 0 - for yyj2635 := 0; ; yyj2635++ { - if yyhl2635 { - if yyj2635 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys2635Slc = r.DecodeBytes(yys2635Slc, true, true) - yys2635 := string(yys2635Slc) - switch yys2635 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -30960,6 +37609,557 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ListOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LabelSelector = "" + } else { + x.LabelSelector = string(r.DecodeString()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.FieldSelector = "" + } else { + x.FieldSelector = string(r.DecodeString()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Watch = false + } else { + x.Watch = bool(r.DecodeBool()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ResourceVersion = "" + } else { + x.ResourceVersion = string(r.DecodeString()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.TimeoutSeconds != nil { + x.TimeoutSeconds = nil + } + } else { + if x.TimeoutSeconds == nil { + x.TimeoutSeconds = new(int64) + } + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*int64)(x.TimeoutSeconds)) = int64(r.DecodeInt(64)) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodLogOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [10]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Container != "" + yyq2[1] = x.Follow != false + yyq2[2] = x.Previous != false + yyq2[3] = x.SinceSeconds != nil + yyq2[4] = x.SinceTime != nil + yyq2[5] = x.Timestamps != false + yyq2[6] = x.TailLines != nil + yyq2[7] = x.LimitBytes != nil + yyq2[8] = x.Kind != "" + yyq2[9] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(10) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("container")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Follow)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("follow")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Follow)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Previous)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("previous")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Previous)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + if x.SinceSeconds == nil { + r.EncodeNil() + } else { + yy13 := *x.SinceSeconds + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeInt(int64(yy13)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("sinceSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SinceSeconds == nil { + r.EncodeNil() + } else { + yy15 := *x.SinceSeconds + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeInt(int64(yy15)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.SinceTime == nil { + r.EncodeNil() + } else { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.EncExt(x.SinceTime) { + } else if yym18 { + z.EncBinaryMarshal(x.SinceTime) + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(x.SinceTime) + } else { + z.EncFallback(x.SinceTime) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("sinceTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SinceTime == nil { + r.EncodeNil() + } else { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else if z.HasExtensions() && z.EncExt(x.SinceTime) { + } else if yym19 { + z.EncBinaryMarshal(x.SinceTime) + } else if !yym19 && z.IsJSONHandle() { + z.EncJSONMarshal(x.SinceTime) + } else { + z.EncFallback(x.SinceTime) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym21 := z.EncBinary() + _ = yym21 + if false { + } else { + r.EncodeBool(bool(x.Timestamps)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("timestamps")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeBool(bool(x.Timestamps)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + if x.TailLines == nil { + r.EncodeNil() + } else { + yy24 := *x.TailLines + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeInt(int64(yy24)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tailLines")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.TailLines == nil { + r.EncodeNil() + } else { + yy26 := *x.TailLines + yym27 := z.EncBinary() + _ = yym27 + if false { + } else { + r.EncodeInt(int64(yy26)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + if x.LimitBytes == nil { + r.EncodeNil() + } else { + yy29 := *x.LimitBytes + yym30 := z.EncBinary() + _ = yym30 + if false { + } else { + r.EncodeInt(int64(yy29)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("limitBytes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.LimitBytes == nil { + r.EncodeNil() + } else { + yy31 := *x.LimitBytes + yym32 := z.EncBinary() + _ = yym32 + if false { + } else { + r.EncodeInt(int64(yy31)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + yym34 := z.EncBinary() + _ = yym34 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym35 := z.EncBinary() + _ = yym35 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { + yym37 := z.EncBinary() + _ = yym37 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym38 := z.EncBinary() + _ = yym38 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodLogOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "container": if r.TryDecodeAsNil() { x.Container = "" @@ -30987,8 +38187,8 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.SinceSeconds == nil { x.SinceSeconds = new(int64) } - yym2642 := z.DecBinary() - _ = yym2642 + yym8 := z.DecBinary() + _ = yym8 if false { } else { *((*int64)(x.SinceSeconds)) = int64(r.DecodeInt(64)) @@ -31003,13 +38203,13 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.SinceTime == nil { x.SinceTime = new(pkg2_unversioned.Time) } - yym2644 := z.DecBinary() - _ = yym2644 + yym10 := z.DecBinary() + _ = yym10 if false { } else if z.HasExtensions() && z.DecExt(x.SinceTime) { - } else if yym2644 { + } else if yym10 { z.DecBinaryUnmarshal(x.SinceTime) - } else if !yym2644 && z.IsJSONHandle() { + } else if !yym10 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.SinceTime) } else { z.DecFallback(x.SinceTime, false) @@ -31030,8 +38230,8 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.TailLines == nil { x.TailLines = new(int64) } - yym2647 := z.DecBinary() - _ = yym2647 + yym13 := z.DecBinary() + _ = yym13 if false { } else { *((*int64)(x.TailLines)) = int64(r.DecodeInt(64)) @@ -31046,484 +38246,13 @@ func (x *PodLogOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.LimitBytes == nil { x.LimitBytes = new(int64) } - yym2649 := z.DecBinary() - _ = yym2649 + yym15 := z.DecBinary() + _ = yym15 if false { } else { *((*int64)(x.LimitBytes)) = int64(r.DecodeInt(64)) } } - default: - z.DecStructFieldNotFound(-1, yys2635) - } // end switch yys2635 - } // end for yyj2635 - if !yyhl2635 { - r.ReadEnd() - } -} - -func (x *PodLogOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj2650 int - var yyb2650 bool - var yyhl2650 bool = l >= 0 - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Container = "" - } else { - x.Container = string(r.DecodeString()) - } - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Follow = false - } else { - x.Follow = bool(r.DecodeBool()) - } - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Previous = false - } else { - x.Previous = bool(r.DecodeBool()) - } - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.SinceSeconds != nil { - x.SinceSeconds = nil - } - } else { - if x.SinceSeconds == nil { - x.SinceSeconds = new(int64) - } - yym2657 := z.DecBinary() - _ = yym2657 - if false { - } else { - *((*int64)(x.SinceSeconds)) = int64(r.DecodeInt(64)) - } - } - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.SinceTime != nil { - x.SinceTime = nil - } - } else { - if x.SinceTime == nil { - x.SinceTime = new(pkg2_unversioned.Time) - } - yym2659 := z.DecBinary() - _ = yym2659 - if false { - } else if z.HasExtensions() && z.DecExt(x.SinceTime) { - } else if yym2659 { - z.DecBinaryUnmarshal(x.SinceTime) - } else if !yym2659 && z.IsJSONHandle() { - z.DecJSONUnmarshal(x.SinceTime) - } else { - z.DecFallback(x.SinceTime, false) - } - } - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Timestamps = false - } else { - x.Timestamps = bool(r.DecodeBool()) - } - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.TailLines != nil { - x.TailLines = nil - } - } else { - if x.TailLines == nil { - x.TailLines = new(int64) - } - yym2662 := z.DecBinary() - _ = yym2662 - if false { - } else { - *((*int64)(x.TailLines)) = int64(r.DecodeInt(64)) - } - } - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - if x.LimitBytes != nil { - x.LimitBytes = nil - } - } else { - if x.LimitBytes == nil { - x.LimitBytes = new(int64) - } - yym2664 := z.DecBinary() - _ = yym2664 - if false { - } else { - *((*int64)(x.LimitBytes)) = int64(r.DecodeInt(64)) - } - } - for { - yyj2650++ - if yyhl2650 { - yyb2650 = yyj2650 > l - } else { - yyb2650 = r.CheckBreak() - } - if yyb2650 { - break - } - z.DecStructFieldNotFound(yyj2650-1, "") - } - r.ReadEnd() -} - -func (x *PodAttachOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym2665 := z.EncBinary() - _ = yym2665 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2666 := !z.EncBinary() - yy2arr2666 := z.EncBasicHandle().StructToArray - var yyq2666 [7]bool - _, _, _ = yysep2666, yyq2666, yy2arr2666 - const yyr2666 bool = false - yyq2666[0] = x.Kind != "" - yyq2666[1] = x.APIVersion != "" - yyq2666[2] = x.Stdin != false - yyq2666[3] = x.Stdout != false - yyq2666[4] = x.Stderr != false - yyq2666[5] = x.TTY != false - yyq2666[6] = x.Container != "" - if yyr2666 || yy2arr2666 { - r.EncodeArrayStart(7) - } else { - var yynn2666 int = 0 - for _, b := range yyq2666 { - if b { - yynn2666++ - } - } - r.EncodeMapStart(yynn2666) - } - if yyr2666 || yy2arr2666 { - if yyq2666[0] { - yym2668 := z.EncBinary() - _ = yym2668 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2666[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2669 := z.EncBinary() - _ = yym2669 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2666 || yy2arr2666 { - if yyq2666[1] { - yym2671 := z.EncBinary() - _ = yym2671 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2666[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2672 := z.EncBinary() - _ = yym2672 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2666 || yy2arr2666 { - if yyq2666[2] { - yym2674 := z.EncBinary() - _ = yym2674 - if false { - } else { - r.EncodeBool(bool(x.Stdin)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2666[2] { - r.EncodeString(codecSelferC_UTF81234, string("stdin")) - yym2675 := z.EncBinary() - _ = yym2675 - if false { - } else { - r.EncodeBool(bool(x.Stdin)) - } - } - } - if yyr2666 || yy2arr2666 { - if yyq2666[3] { - yym2677 := z.EncBinary() - _ = yym2677 - if false { - } else { - r.EncodeBool(bool(x.Stdout)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2666[3] { - r.EncodeString(codecSelferC_UTF81234, string("stdout")) - yym2678 := z.EncBinary() - _ = yym2678 - if false { - } else { - r.EncodeBool(bool(x.Stdout)) - } - } - } - if yyr2666 || yy2arr2666 { - if yyq2666[4] { - yym2680 := z.EncBinary() - _ = yym2680 - if false { - } else { - r.EncodeBool(bool(x.Stderr)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2666[4] { - r.EncodeString(codecSelferC_UTF81234, string("stderr")) - yym2681 := z.EncBinary() - _ = yym2681 - if false { - } else { - r.EncodeBool(bool(x.Stderr)) - } - } - } - if yyr2666 || yy2arr2666 { - if yyq2666[5] { - yym2683 := z.EncBinary() - _ = yym2683 - if false { - } else { - r.EncodeBool(bool(x.TTY)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2666[5] { - r.EncodeString(codecSelferC_UTF81234, string("tty")) - yym2684 := z.EncBinary() - _ = yym2684 - if false { - } else { - r.EncodeBool(bool(x.TTY)) - } - } - } - if yyr2666 || yy2arr2666 { - if yyq2666[6] { - yym2686 := z.EncBinary() - _ = yym2686 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2666[6] { - r.EncodeString(codecSelferC_UTF81234, string("container")) - yym2687 := z.EncBinary() - _ = yym2687 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } - } - if yysep2666 { - r.EncodeEnd() - } - } - } -} - -func (x *PodAttachOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym2688 := z.DecBinary() - _ = yym2688 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2689 := r.ReadMapStart() - if yyl2689 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl2689, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2689 := r.ReadArrayStart() - if yyl2689 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl2689, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *PodAttachOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys2690Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2690Slc - var yyhl2690 bool = l >= 0 - for yyj2690 := 0; ; yyj2690++ { - if yyhl2690 { - if yyj2690 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys2690Slc = r.DecodeBytes(yys2690Slc, true, true) - yys2690 := string(yys2690Slc) - switch yys2690 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -31536,6 +38265,514 @@ func (x *PodAttachOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodLogOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj18 int + var yyb18 bool + var yyhl18 bool = l >= 0 + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Container = "" + } else { + x.Container = string(r.DecodeString()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Follow = false + } else { + x.Follow = bool(r.DecodeBool()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Previous = false + } else { + x.Previous = bool(r.DecodeBool()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SinceSeconds != nil { + x.SinceSeconds = nil + } + } else { + if x.SinceSeconds == nil { + x.SinceSeconds = new(int64) + } + yym23 := z.DecBinary() + _ = yym23 + if false { + } else { + *((*int64)(x.SinceSeconds)) = int64(r.DecodeInt(64)) + } + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SinceTime != nil { + x.SinceTime = nil + } + } else { + if x.SinceTime == nil { + x.SinceTime = new(pkg2_unversioned.Time) + } + yym25 := z.DecBinary() + _ = yym25 + if false { + } else if z.HasExtensions() && z.DecExt(x.SinceTime) { + } else if yym25 { + z.DecBinaryUnmarshal(x.SinceTime) + } else if !yym25 && z.IsJSONHandle() { + z.DecJSONUnmarshal(x.SinceTime) + } else { + z.DecFallback(x.SinceTime, false) + } + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Timestamps = false + } else { + x.Timestamps = bool(r.DecodeBool()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.TailLines != nil { + x.TailLines = nil + } + } else { + if x.TailLines == nil { + x.TailLines = new(int64) + } + yym28 := z.DecBinary() + _ = yym28 + if false { + } else { + *((*int64)(x.TailLines)) = int64(r.DecodeInt(64)) + } + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.LimitBytes != nil { + x.LimitBytes = nil + } + } else { + if x.LimitBytes == nil { + x.LimitBytes = new(int64) + } + yym30 := z.DecBinary() + _ = yym30 + if false { + } else { + *((*int64)(x.LimitBytes)) = int64(r.DecodeInt(64)) + } + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj18++ + if yyhl18 { + yyb18 = yyj18 > l + } else { + yyb18 = r.CheckBreak() + } + if yyb18 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj18-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodAttachOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Stdin != false + yyq2[1] = x.Stdout != false + yyq2[2] = x.Stderr != false + yyq2[3] = x.TTY != false + yyq2[4] = x.Container != "" + yyq2[5] = x.Kind != "" + yyq2[6] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(7) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Stdin)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("stdin")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Stdin)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Stdout)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("stdout")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Stdout)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Stderr)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("stderr")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Stderr)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.TTY)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tty")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.TTY)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("container")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodAttachOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodAttachOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "stdin": if r.TryDecodeAsNil() { x.Stdin = false @@ -31566,411 +38803,6 @@ func (x *PodAttachOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.Container = string(r.DecodeString()) } - default: - z.DecStructFieldNotFound(-1, yys2690) - } // end switch yys2690 - } // end for yyj2690 - if !yyhl2690 { - r.ReadEnd() - } -} - -func (x *PodAttachOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj2698 int - var yyb2698 bool - var yyhl2698 bool = l >= 0 - yyj2698++ - if yyhl2698 { - yyb2698 = yyj2698 > l - } else { - yyb2698 = r.CheckBreak() - } - if yyb2698 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2698++ - if yyhl2698 { - yyb2698 = yyj2698 > l - } else { - yyb2698 = r.CheckBreak() - } - if yyb2698 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2698++ - if yyhl2698 { - yyb2698 = yyj2698 > l - } else { - yyb2698 = r.CheckBreak() - } - if yyb2698 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stdin = false - } else { - x.Stdin = bool(r.DecodeBool()) - } - yyj2698++ - if yyhl2698 { - yyb2698 = yyj2698 > l - } else { - yyb2698 = r.CheckBreak() - } - if yyb2698 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stdout = false - } else { - x.Stdout = bool(r.DecodeBool()) - } - yyj2698++ - if yyhl2698 { - yyb2698 = yyj2698 > l - } else { - yyb2698 = r.CheckBreak() - } - if yyb2698 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stderr = false - } else { - x.Stderr = bool(r.DecodeBool()) - } - yyj2698++ - if yyhl2698 { - yyb2698 = yyj2698 > l - } else { - yyb2698 = r.CheckBreak() - } - if yyb2698 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.TTY = false - } else { - x.TTY = bool(r.DecodeBool()) - } - yyj2698++ - if yyhl2698 { - yyb2698 = yyj2698 > l - } else { - yyb2698 = r.CheckBreak() - } - if yyb2698 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Container = "" - } else { - x.Container = string(r.DecodeString()) - } - for { - yyj2698++ - if yyhl2698 { - yyb2698 = yyj2698 > l - } else { - yyb2698 = r.CheckBreak() - } - if yyb2698 { - break - } - z.DecStructFieldNotFound(yyj2698-1, "") - } - r.ReadEnd() -} - -func (x *PodExecOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym2706 := z.EncBinary() - _ = yym2706 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2707 := !z.EncBinary() - yy2arr2707 := z.EncBasicHandle().StructToArray - var yyq2707 [8]bool - _, _, _ = yysep2707, yyq2707, yy2arr2707 - const yyr2707 bool = false - yyq2707[0] = x.Kind != "" - yyq2707[1] = x.APIVersion != "" - yyq2707[2] = x.Stdin != false - yyq2707[3] = x.Stdout != false - yyq2707[4] = x.Stderr != false - yyq2707[5] = x.TTY != false - yyq2707[6] = x.Container != "" - if yyr2707 || yy2arr2707 { - r.EncodeArrayStart(8) - } else { - var yynn2707 int = 1 - for _, b := range yyq2707 { - if b { - yynn2707++ - } - } - r.EncodeMapStart(yynn2707) - } - if yyr2707 || yy2arr2707 { - if yyq2707[0] { - yym2709 := z.EncBinary() - _ = yym2709 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2707[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2710 := z.EncBinary() - _ = yym2710 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2707 || yy2arr2707 { - if yyq2707[1] { - yym2712 := z.EncBinary() - _ = yym2712 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2707[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2713 := z.EncBinary() - _ = yym2713 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2707 || yy2arr2707 { - if yyq2707[2] { - yym2715 := z.EncBinary() - _ = yym2715 - if false { - } else { - r.EncodeBool(bool(x.Stdin)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2707[2] { - r.EncodeString(codecSelferC_UTF81234, string("stdin")) - yym2716 := z.EncBinary() - _ = yym2716 - if false { - } else { - r.EncodeBool(bool(x.Stdin)) - } - } - } - if yyr2707 || yy2arr2707 { - if yyq2707[3] { - yym2718 := z.EncBinary() - _ = yym2718 - if false { - } else { - r.EncodeBool(bool(x.Stdout)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2707[3] { - r.EncodeString(codecSelferC_UTF81234, string("stdout")) - yym2719 := z.EncBinary() - _ = yym2719 - if false { - } else { - r.EncodeBool(bool(x.Stdout)) - } - } - } - if yyr2707 || yy2arr2707 { - if yyq2707[4] { - yym2721 := z.EncBinary() - _ = yym2721 - if false { - } else { - r.EncodeBool(bool(x.Stderr)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2707[4] { - r.EncodeString(codecSelferC_UTF81234, string("stderr")) - yym2722 := z.EncBinary() - _ = yym2722 - if false { - } else { - r.EncodeBool(bool(x.Stderr)) - } - } - } - if yyr2707 || yy2arr2707 { - if yyq2707[5] { - yym2724 := z.EncBinary() - _ = yym2724 - if false { - } else { - r.EncodeBool(bool(x.TTY)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2707[5] { - r.EncodeString(codecSelferC_UTF81234, string("tty")) - yym2725 := z.EncBinary() - _ = yym2725 - if false { - } else { - r.EncodeBool(bool(x.TTY)) - } - } - } - if yyr2707 || yy2arr2707 { - if yyq2707[6] { - yym2727 := z.EncBinary() - _ = yym2727 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2707[6] { - r.EncodeString(codecSelferC_UTF81234, string("container")) - yym2728 := z.EncBinary() - _ = yym2728 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Container)) - } - } - } - if yyr2707 || yy2arr2707 { - if x.Command == nil { - r.EncodeNil() - } else { - yym2730 := z.EncBinary() - _ = yym2730 - if false { - } else { - z.F.EncSliceStringV(x.Command, false, e) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("command")) - if x.Command == nil { - r.EncodeNil() - } else { - yym2731 := z.EncBinary() - _ = yym2731 - if false { - } else { - z.F.EncSliceStringV(x.Command, false, e) - } - } - } - if yysep2707 { - r.EncodeEnd() - } - } - } -} - -func (x *PodExecOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym2732 := z.DecBinary() - _ = yym2732 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2733 := r.ReadMapStart() - if yyl2733 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl2733, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2733 := r.ReadArrayStart() - if yyl2733 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl2733, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *PodExecOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys2734Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2734Slc - var yyhl2734 bool = l >= 0 - for yyj2734 := 0; ; yyj2734++ { - if yyhl2734 { - if yyj2734 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys2734Slc = r.DecodeBytes(yys2734Slc, true, true) - yys2734 := string(yys2734Slc) - switch yys2734 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -31983,6 +38815,448 @@ func (x *PodExecOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodAttachOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stdin = false + } else { + x.Stdin = bool(r.DecodeBool()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stdout = false + } else { + x.Stdout = bool(r.DecodeBool()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stderr = false + } else { + x.Stderr = bool(r.DecodeBool()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TTY = false + } else { + x.TTY = bool(r.DecodeBool()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Container = "" + } else { + x.Container = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodExecOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Stdin != false + yyq2[1] = x.Stdout != false + yyq2[2] = x.Stderr != false + yyq2[3] = x.TTY != false + yyq2[4] = x.Container != "" + yyq2[6] = x.Kind != "" + yyq2[7] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(8) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Stdin)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("stdin")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Stdin)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Stdout)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("stdout")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Stdout)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Stderr)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("stderr")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Stderr)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.TTY)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tty")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.TTY)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("container")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Container)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Command == nil { + r.EncodeNil() + } else { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + z.F.EncSliceStringV(x.Command, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("command")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Command == nil { + r.EncodeNil() + } else { + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + z.F.EncSliceStringV(x.Command, false, e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodExecOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodExecOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "stdin": if r.TryDecodeAsNil() { x.Stdin = false @@ -32017,324 +39291,14 @@ func (x *PodExecOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Command = nil } else { - yyv2742 := &x.Command - yym2743 := z.DecBinary() - _ = yym2743 + yyv9 := &x.Command + yym10 := z.DecBinary() + _ = yym10 if false { } else { - z.F.DecSliceStringX(yyv2742, false, d) + z.F.DecSliceStringX(yyv9, false, d) } } - default: - z.DecStructFieldNotFound(-1, yys2734) - } // end switch yys2734 - } // end for yyj2734 - if !yyhl2734 { - r.ReadEnd() - } -} - -func (x *PodExecOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj2744 int - var yyb2744 bool - var yyhl2744 bool = l >= 0 - yyj2744++ - if yyhl2744 { - yyb2744 = yyj2744 > l - } else { - yyb2744 = r.CheckBreak() - } - if yyb2744 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2744++ - if yyhl2744 { - yyb2744 = yyj2744 > l - } else { - yyb2744 = r.CheckBreak() - } - if yyb2744 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2744++ - if yyhl2744 { - yyb2744 = yyj2744 > l - } else { - yyb2744 = r.CheckBreak() - } - if yyb2744 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stdin = false - } else { - x.Stdin = bool(r.DecodeBool()) - } - yyj2744++ - if yyhl2744 { - yyb2744 = yyj2744 > l - } else { - yyb2744 = r.CheckBreak() - } - if yyb2744 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stdout = false - } else { - x.Stdout = bool(r.DecodeBool()) - } - yyj2744++ - if yyhl2744 { - yyb2744 = yyj2744 > l - } else { - yyb2744 = r.CheckBreak() - } - if yyb2744 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Stderr = false - } else { - x.Stderr = bool(r.DecodeBool()) - } - yyj2744++ - if yyhl2744 { - yyb2744 = yyj2744 > l - } else { - yyb2744 = r.CheckBreak() - } - if yyb2744 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.TTY = false - } else { - x.TTY = bool(r.DecodeBool()) - } - yyj2744++ - if yyhl2744 { - yyb2744 = yyj2744 > l - } else { - yyb2744 = r.CheckBreak() - } - if yyb2744 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Container = "" - } else { - x.Container = string(r.DecodeString()) - } - yyj2744++ - if yyhl2744 { - yyb2744 = yyj2744 > l - } else { - yyb2744 = r.CheckBreak() - } - if yyb2744 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Command = nil - } else { - yyv2752 := &x.Command - yym2753 := z.DecBinary() - _ = yym2753 - if false { - } else { - z.F.DecSliceStringX(yyv2752, false, d) - } - } - for { - yyj2744++ - if yyhl2744 { - yyb2744 = yyj2744 > l - } else { - yyb2744 = r.CheckBreak() - } - if yyb2744 { - break - } - z.DecStructFieldNotFound(yyj2744-1, "") - } - r.ReadEnd() -} - -func (x *PodProxyOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym2754 := z.EncBinary() - _ = yym2754 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2755 := !z.EncBinary() - yy2arr2755 := z.EncBasicHandle().StructToArray - var yyq2755 [3]bool - _, _, _ = yysep2755, yyq2755, yy2arr2755 - const yyr2755 bool = false - yyq2755[0] = x.Kind != "" - yyq2755[1] = x.APIVersion != "" - yyq2755[2] = x.Path != "" - if yyr2755 || yy2arr2755 { - r.EncodeArrayStart(3) - } else { - var yynn2755 int = 0 - for _, b := range yyq2755 { - if b { - yynn2755++ - } - } - r.EncodeMapStart(yynn2755) - } - if yyr2755 || yy2arr2755 { - if yyq2755[0] { - yym2757 := z.EncBinary() - _ = yym2757 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2755[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2758 := z.EncBinary() - _ = yym2758 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2755 || yy2arr2755 { - if yyq2755[1] { - yym2760 := z.EncBinary() - _ = yym2760 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2755[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2761 := z.EncBinary() - _ = yym2761 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2755 || yy2arr2755 { - if yyq2755[2] { - yym2763 := z.EncBinary() - _ = yym2763 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Path)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2755[2] { - r.EncodeString(codecSelferC_UTF81234, string("path")) - yym2764 := z.EncBinary() - _ = yym2764 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Path)) - } - } - } - if yysep2755 { - r.EncodeEnd() - } - } - } -} - -func (x *PodProxyOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym2765 := z.DecBinary() - _ = yym2765 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2766 := r.ReadMapStart() - if yyl2766 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl2766, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2766 := r.ReadArrayStart() - if yyl2766 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl2766, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *PodProxyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys2767Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2767Slc - var yyhl2767 bool = l >= 0 - for yyj2767 := 0; ; yyj2767++ { - if yyhl2767 { - if yyj2767 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys2767Slc = r.DecodeBytes(yys2767Slc, true, true) - yys2767 := string(yys2767Slc) - switch yys2767 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -32347,86 +39311,433 @@ func (x *PodProxyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodExecOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stdin = false + } else { + x.Stdin = bool(r.DecodeBool()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stdout = false + } else { + x.Stdout = bool(r.DecodeBool()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Stderr = false + } else { + x.Stderr = bool(r.DecodeBool()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TTY = false + } else { + x.TTY = bool(r.DecodeBool()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Container = "" + } else { + x.Container = string(r.DecodeString()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Command = nil + } else { + yyv19 := &x.Command + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + z.F.DecSliceStringX(yyv19, false, d) + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodProxyOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Path != "" + yyq2[1] = x.Kind != "" + yyq2[2] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("path")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodProxyOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodProxyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "path": if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } default: - z.DecStructFieldNotFound(-1, yys2767) - } // end switch yys2767 - } // end for yyj2767 - if !yyhl2767 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *PodProxyOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2771 int - var yyb2771 bool - var yyhl2771 bool = l >= 0 - yyj2771++ - if yyhl2771 { - yyb2771 = yyj2771 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2771 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2771 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2771++ - if yyhl2771 { - yyb2771 = yyj2771 > l - } else { - yyb2771 = r.CheckBreak() - } - if yyb2771 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2771++ - if yyhl2771 { - yyb2771 = yyj2771 > l - } else { - yyb2771 = r.CheckBreak() - } - if yyb2771 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj2771++ - if yyhl2771 { - yyb2771 = yyj2771 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2771 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2771 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj2771-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { @@ -32436,38 +39747,41 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2775 := z.EncBinary() - _ = yym2775 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2776 := !z.EncBinary() - yy2arr2776 := z.EncBasicHandle().StructToArray - var yyq2776 [7]bool - _, _, _ = yysep2776, yyq2776, yy2arr2776 - const yyr2776 bool = false - yyq2776[0] = x.Kind != "" - yyq2776[1] = x.Namespace != "" - yyq2776[2] = x.Name != "" - yyq2776[3] = x.UID != "" - yyq2776[4] = x.APIVersion != "" - yyq2776[5] = x.ResourceVersion != "" - yyq2776[6] = x.FieldPath != "" - if yyr2776 || yy2arr2776 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.Namespace != "" + yyq2[2] = x.Name != "" + yyq2[3] = x.UID != "" + yyq2[4] = x.APIVersion != "" + yyq2[5] = x.ResourceVersion != "" + yyq2[6] = x.FieldPath != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(7) } else { - var yynn2776 int = 0 - for _, b := range yyq2776 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2776++ + yynn2++ } } - r.EncodeMapStart(yynn2776) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2776 || yy2arr2776 { - if yyq2776[0] { - yym2778 := z.EncBinary() - _ = yym2778 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) @@ -32476,20 +39790,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2776[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2779 := z.EncBinary() - _ = yym2779 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) } } } - if yyr2776 || yy2arr2776 { - if yyq2776[1] { - yym2781 := z.EncBinary() - _ = yym2781 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) @@ -32498,20 +39815,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2776[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("namespace")) - yym2782 := z.EncBinary() - _ = yym2782 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) } } } - if yyr2776 || yy2arr2776 { - if yyq2776[2] { - yym2784 := z.EncBinary() - _ = yym2784 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -32520,20 +39840,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2776[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym2785 := z.EncBinary() - _ = yym2785 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr2776 || yy2arr2776 { - if yyq2776[3] { - yym2787 := z.EncBinary() - _ = yym2787 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else if z.HasExtensions() && z.EncExt(x.UID) { } else { @@ -32543,10 +39866,12 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2776[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("uid")) - yym2788 := z.EncBinary() - _ = yym2788 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else if z.HasExtensions() && z.EncExt(x.UID) { } else { @@ -32554,10 +39879,11 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2776 || yy2arr2776 { - if yyq2776[4] { - yym2790 := z.EncBinary() - _ = yym2790 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) @@ -32566,20 +39892,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2776[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2791 := z.EncBinary() - _ = yym2791 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) } } } - if yyr2776 || yy2arr2776 { - if yyq2776[5] { - yym2793 := z.EncBinary() - _ = yym2793 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) @@ -32588,20 +39917,23 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2776[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resourceVersion")) - yym2794 := z.EncBinary() - _ = yym2794 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) } } } - if yyr2776 || yy2arr2776 { - if yyq2776[6] { - yym2796 := z.EncBinary() - _ = yym2796 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldPath)) @@ -32610,18 +39942,22 @@ func (x *ObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2776[6] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fieldPath")) - yym2797 := z.EncBinary() - _ = yym2797 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.FieldPath)) } } } - if yysep2776 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -32631,24 +39967,25 @@ func (x *ObjectReference) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2798 := z.DecBinary() - _ = yym2798 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2799 := r.ReadMapStart() - if yyl2799 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2799, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2799 := r.ReadArrayStart() - if yyl2799 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2799, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -32660,12 +39997,12 @@ func (x *ObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2800Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2800Slc - var yyhl2800 bool = l >= 0 - for yyj2800 := 0; ; yyj2800++ { - if yyhl2800 { - if yyj2800 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -32673,9 +40010,11 @@ func (x *ObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2800Slc = r.DecodeBytes(yys2800Slc, true, true) - yys2800 := string(yys2800Slc) - switch yys2800 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -32719,139 +40058,145 @@ func (x *ObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.FieldPath = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2800) - } // end switch yys2800 - } // end for yyj2800 - if !yyhl2800 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ObjectReference) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2808 int - var yyb2808 bool - var yyhl2808 bool = l >= 0 - yyj2808++ - if yyhl2808 { - yyb2808 = yyj2808 > l + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2808 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2808 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2808++ - if yyhl2808 { - yyb2808 = yyj2808 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2808 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2808 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Namespace = "" } else { x.Namespace = string(r.DecodeString()) } - yyj2808++ - if yyhl2808 { - yyb2808 = yyj2808 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2808 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2808 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj2808++ - if yyhl2808 { - yyb2808 = yyj2808 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2808 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2808 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.UID = "" } else { x.UID = pkg1_types.UID(r.DecodeString()) } - yyj2808++ - if yyhl2808 { - yyb2808 = yyj2808 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2808 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2808 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2808++ - if yyhl2808 { - yyb2808 = yyj2808 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2808 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2808 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ResourceVersion = "" } else { x.ResourceVersion = string(r.DecodeString()) } - yyj2808++ - if yyhl2808 { - yyb2808 = yyj2808 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2808 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2808 { - r.ReadEnd() + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FieldPath = "" } else { x.FieldPath = string(r.DecodeString()) } for { - yyj2808++ - if yyhl2808 { - yyb2808 = yyj2808 > l + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l } else { - yyb2808 = r.CheckBreak() + yyb11 = r.CheckBreak() } - if yyb2808 { + if yyb11 { break } - z.DecStructFieldNotFound(yyj2808-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LocalObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { @@ -32861,32 +40206,35 @@ func (x *LocalObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2816 := z.EncBinary() - _ = yym2816 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2817 := !z.EncBinary() - yy2arr2817 := z.EncBasicHandle().StructToArray - var yyq2817 [1]bool - _, _, _ = yysep2817, yyq2817, yy2arr2817 - const yyr2817 bool = false - yyq2817[0] = x.Name != "" - if yyr2817 || yy2arr2817 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Name != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2817 int = 0 - for _, b := range yyq2817 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2817++ + yynn2++ } } - r.EncodeMapStart(yynn2817) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2817 || yy2arr2817 { - if yyq2817[0] { - yym2819 := z.EncBinary() - _ = yym2819 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -32895,18 +40243,22 @@ func (x *LocalObjectReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2817[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym2820 := z.EncBinary() - _ = yym2820 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yysep2817 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -32916,24 +40268,25 @@ func (x *LocalObjectReference) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2821 := z.DecBinary() - _ = yym2821 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2822 := r.ReadMapStart() - if yyl2822 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2822, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2822 := r.ReadArrayStart() - if yyl2822 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2822, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -32945,12 +40298,12 @@ func (x *LocalObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2823Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2823Slc - var yyhl2823 bool = l >= 0 - for yyj2823 := 0; ; yyj2823++ { - if yyhl2823 { - if yyj2823 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -32958,9 +40311,11 @@ func (x *LocalObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys2823Slc = r.DecodeBytes(yys2823Slc, true, true) - yys2823 := string(yys2823Slc) - switch yys2823 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -32968,49 +40323,49 @@ func (x *LocalObjectReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode x.Name = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2823) - } // end switch yys2823 - } // end for yyj2823 - if !yyhl2823 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LocalObjectReference) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2825 int - var yyb2825 bool - var yyhl2825 bool = l >= 0 - yyj2825++ - if yyhl2825 { - yyb2825 = yyj2825 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2825 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2825 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } for { - yyj2825++ - if yyhl2825 { - yyb2825 = yyj2825 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb2825 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb2825 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj2825-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SerializedReference) CodecEncodeSelf(e *codec1978.Encoder) { @@ -33020,90 +40375,103 @@ func (x *SerializedReference) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2827 := z.EncBinary() - _ = yym2827 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2828 := !z.EncBinary() - yy2arr2828 := z.EncBasicHandle().StructToArray - var yyq2828 [3]bool - _, _, _ = yysep2828, yyq2828, yy2arr2828 - const yyr2828 bool = false - yyq2828[0] = x.Kind != "" - yyq2828[1] = x.APIVersion != "" - yyq2828[2] = true - if yyr2828 || yy2arr2828 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = x.Kind != "" + yyq2[2] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn2828 int = 0 - for _, b := range yyq2828 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2828++ + yynn2++ } } - r.EncodeMapStart(yynn2828) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2828 || yy2arr2828 { - if yyq2828[0] { - yym2830 := z.EncBinary() - _ = yym2830 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2828[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2831 := z.EncBinary() - _ = yym2831 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2828 || yy2arr2828 { - if yyq2828[1] { - yym2833 := z.EncBinary() - _ = yym2833 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2828[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2834 := z.EncBinary() - _ = yym2834 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2828 || yy2arr2828 { - if yyq2828[2] { - yy2836 := &x.Reference - yy2836.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.Reference + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2828[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reference")) - yy2837 := &x.Reference - yy2837.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Reference + yy6.CodecEncodeSelf(e) } } - if yysep2828 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -33113,24 +40481,25 @@ func (x *SerializedReference) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2838 := z.DecBinary() - _ = yym2838 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2839 := r.ReadMapStart() - if yyl2839 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2839, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2839 := r.ReadArrayStart() - if yyl2839 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2839, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -33142,12 +40511,12 @@ func (x *SerializedReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2840Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2840Slc - var yyhl2840 bool = l >= 0 - for yyj2840 := 0; ; yyj2840++ { - if yyhl2840 { - if yyj2840 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -33155,9 +40524,18 @@ func (x *SerializedReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys2840Slc = r.DecodeBytes(yys2840Slc, true, true) - yys2840 := string(yys2840Slc) - switch yys2840 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "reference": + if r.TryDecodeAsNil() { + x.Reference = ObjectReference{} + } else { + yyv4 := &x.Reference + yyv4.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -33170,88 +40548,83 @@ func (x *SerializedReference) codecDecodeSelfFromMap(l int, d *codec1978.Decoder } else { x.APIVersion = string(r.DecodeString()) } - case "reference": - if r.TryDecodeAsNil() { - x.Reference = ObjectReference{} - } else { - yyv2843 := &x.Reference - yyv2843.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys2840) - } // end switch yys2840 - } // end for yyj2840 - if !yyhl2840 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SerializedReference) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2844 int - var yyb2844 bool - var yyhl2844 bool = l >= 0 - yyj2844++ - if yyhl2844 { - yyb2844 = yyj2844 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2844 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2844 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Reference = ObjectReference{} + } else { + yyv8 := &x.Reference + yyv8.CodecDecodeSelf(d) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2844++ - if yyhl2844 { - yyb2844 = yyj2844 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2844 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2844 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2844++ - if yyhl2844 { - yyb2844 = yyj2844 > l - } else { - yyb2844 = r.CheckBreak() - } - if yyb2844 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Reference = ObjectReference{} - } else { - yyv2847 := &x.Reference - yyv2847.CodecDecodeSelf(d) - } for { - yyj2844++ - if yyhl2844 { - yyb2844 = yyj2844 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb2844 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb2844 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj2844-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EventSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -33261,33 +40634,36 @@ func (x *EventSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2848 := z.EncBinary() - _ = yym2848 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2849 := !z.EncBinary() - yy2arr2849 := z.EncBasicHandle().StructToArray - var yyq2849 [2]bool - _, _, _ = yysep2849, yyq2849, yy2arr2849 - const yyr2849 bool = false - yyq2849[0] = x.Component != "" - yyq2849[1] = x.Host != "" - if yyr2849 || yy2arr2849 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Component != "" + yyq2[1] = x.Host != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn2849 int = 0 - for _, b := range yyq2849 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2849++ + yynn2++ } } - r.EncodeMapStart(yynn2849) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2849 || yy2arr2849 { - if yyq2849[0] { - yym2851 := z.EncBinary() - _ = yym2851 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Component)) @@ -33296,20 +40672,23 @@ func (x *EventSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2849[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("component")) - yym2852 := z.EncBinary() - _ = yym2852 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Component)) } } } - if yyr2849 || yy2arr2849 { - if yyq2849[1] { - yym2854 := z.EncBinary() - _ = yym2854 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) @@ -33318,18 +40697,22 @@ func (x *EventSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2849[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("host")) - yym2855 := z.EncBinary() - _ = yym2855 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) } } } - if yysep2849 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -33339,24 +40722,25 @@ func (x *EventSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2856 := z.DecBinary() - _ = yym2856 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2857 := r.ReadMapStart() - if yyl2857 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2857, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2857 := r.ReadArrayStart() - if yyl2857 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2857, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -33368,12 +40752,12 @@ func (x *EventSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2858Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2858Slc - var yyhl2858 bool = l >= 0 - for yyj2858 := 0; ; yyj2858++ { - if yyhl2858 { - if yyj2858 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -33381,9 +40765,11 @@ func (x *EventSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2858Slc = r.DecodeBytes(yys2858Slc, true, true) - yys2858 := string(yys2858Slc) - switch yys2858 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "component": if r.TryDecodeAsNil() { x.Component = "" @@ -33397,64 +40783,65 @@ func (x *EventSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Host = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2858) - } // end switch yys2858 - } // end for yyj2858 - if !yyhl2858 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EventSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2861 int - var yyb2861 bool - var yyhl2861 bool = l >= 0 - yyj2861++ - if yyhl2861 { - yyb2861 = yyj2861 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2861 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2861 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Component = "" } else { x.Component = string(r.DecodeString()) } - yyj2861++ - if yyhl2861 { - yyb2861 = yyj2861 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2861 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2861 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Host = "" } else { x.Host = string(r.DecodeString()) } for { - yyj2861++ - if yyhl2861 { - yyb2861 = yyj2861 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb2861 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb2861 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj2861-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { @@ -33464,99 +40851,65 @@ func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2864 := z.EncBinary() - _ = yym2864 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2865 := !z.EncBinary() - yy2arr2865 := z.EncBasicHandle().StructToArray - var yyq2865 [10]bool - _, _, _ = yysep2865, yyq2865, yy2arr2865 - const yyr2865 bool = false - yyq2865[0] = x.Kind != "" - yyq2865[1] = x.APIVersion != "" - yyq2865[4] = x.Reason != "" - yyq2865[5] = x.Message != "" - yyq2865[6] = true - yyq2865[7] = true - yyq2865[8] = true - yyq2865[9] = x.Count != 0 - if yyr2865 || yy2arr2865 { - r.EncodeArrayStart(10) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [11]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Reason != "" + yyq2[3] = x.Message != "" + yyq2[4] = true + yyq2[5] = true + yyq2[6] = true + yyq2[7] = x.Count != 0 + yyq2[8] = x.Type != "" + yyq2[9] = x.Kind != "" + yyq2[10] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(11) } else { - var yynn2865 int = 2 - for _, b := range yyq2865 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn2865++ + yynn2++ } } - r.EncodeMapStart(yynn2865) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2865 || yy2arr2865 { - if yyq2865[0] { - yym2867 := z.EncBinary() - _ = yym2867 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2865[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2868 := z.EncBinary() - _ = yym2868 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2865 || yy2arr2865 { - if yyq2865[1] { - yym2870 := z.EncBinary() - _ = yym2870 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2865[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2871 := z.EncBinary() - _ = yym2871 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2865 || yy2arr2865 { - yy2873 := &x.ObjectMeta - yy2873.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2874 := &x.ObjectMeta - yy2874.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } - if yyr2865 || yy2arr2865 { - yy2876 := &x.InvolvedObject - yy2876.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy9 := &x.InvolvedObject + yy9.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("involvedObject")) - yy2877 := &x.InvolvedObject - yy2877.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.InvolvedObject + yy11.CodecEncodeSelf(e) } - if yyr2865 || yy2arr2865 { - if yyq2865[4] { - yym2879 := z.EncBinary() - _ = yym2879 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -33565,20 +40918,23 @@ func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2865[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym2880 := z.EncBinary() - _ = yym2880 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr2865 || yy2arr2865 { - if yyq2865[5] { - yym2882 := z.EncBinary() - _ = yym2882 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -33587,102 +40943,114 @@ func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2865[5] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym2883 := z.EncBinary() - _ = yym2883 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr2865 || yy2arr2865 { - if yyq2865[6] { - yy2885 := &x.Source - yy2885.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yy20 := &x.Source + yy20.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2865[6] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("source")) - yy2886 := &x.Source - yy2886.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy22 := &x.Source + yy22.CodecEncodeSelf(e) } } - if yyr2865 || yy2arr2865 { - if yyq2865[7] { - yy2888 := &x.FirstTimestamp - yym2889 := z.EncBinary() - _ = yym2889 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yy25 := &x.FirstTimestamp + yym26 := z.EncBinary() + _ = yym26 if false { - } else if z.HasExtensions() && z.EncExt(yy2888) { - } else if yym2889 { - z.EncBinaryMarshal(yy2888) - } else if !yym2889 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2888) + } else if z.HasExtensions() && z.EncExt(yy25) { + } else if yym26 { + z.EncBinaryMarshal(yy25) + } else if !yym26 && z.IsJSONHandle() { + z.EncJSONMarshal(yy25) } else { - z.EncFallback(yy2888) + z.EncFallback(yy25) } } else { r.EncodeNil() } } else { - if yyq2865[7] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("firstTimestamp")) - yy2890 := &x.FirstTimestamp - yym2891 := z.EncBinary() - _ = yym2891 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy27 := &x.FirstTimestamp + yym28 := z.EncBinary() + _ = yym28 if false { - } else if z.HasExtensions() && z.EncExt(yy2890) { - } else if yym2891 { - z.EncBinaryMarshal(yy2890) - } else if !yym2891 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2890) + } else if z.HasExtensions() && z.EncExt(yy27) { + } else if yym28 { + z.EncBinaryMarshal(yy27) + } else if !yym28 && z.IsJSONHandle() { + z.EncJSONMarshal(yy27) } else { - z.EncFallback(yy2890) + z.EncFallback(yy27) } } } - if yyr2865 || yy2arr2865 { - if yyq2865[8] { - yy2893 := &x.LastTimestamp - yym2894 := z.EncBinary() - _ = yym2894 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yy30 := &x.LastTimestamp + yym31 := z.EncBinary() + _ = yym31 if false { - } else if z.HasExtensions() && z.EncExt(yy2893) { - } else if yym2894 { - z.EncBinaryMarshal(yy2893) - } else if !yym2894 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2893) + } else if z.HasExtensions() && z.EncExt(yy30) { + } else if yym31 { + z.EncBinaryMarshal(yy30) + } else if !yym31 && z.IsJSONHandle() { + z.EncJSONMarshal(yy30) } else { - z.EncFallback(yy2893) + z.EncFallback(yy30) } } else { r.EncodeNil() } } else { - if yyq2865[8] { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastTimestamp")) - yy2895 := &x.LastTimestamp - yym2896 := z.EncBinary() - _ = yym2896 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy32 := &x.LastTimestamp + yym33 := z.EncBinary() + _ = yym33 if false { - } else if z.HasExtensions() && z.EncExt(yy2895) { - } else if yym2896 { - z.EncBinaryMarshal(yy2895) - } else if !yym2896 && z.IsJSONHandle() { - z.EncJSONMarshal(yy2895) + } else if z.HasExtensions() && z.EncExt(yy32) { + } else if yym33 { + z.EncBinaryMarshal(yy32) + } else if !yym33 && z.IsJSONHandle() { + z.EncJSONMarshal(yy32) } else { - z.EncFallback(yy2895) + z.EncFallback(yy32) } } } - if yyr2865 || yy2arr2865 { - if yyq2865[9] { - yym2898 := z.EncBinary() - _ = yym2898 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yym35 := z.EncBinary() + _ = yym35 if false { } else { r.EncodeInt(int64(x.Count)) @@ -33691,18 +41059,97 @@ func (x *Event) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq2865[9] { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("count")) - yym2899 := z.EncBinary() - _ = yym2899 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym36 := z.EncBinary() + _ = yym36 if false { } else { r.EncodeInt(int64(x.Count)) } } } - if yysep2865 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + yym38 := z.EncBinary() + _ = yym38 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Type)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym39 := z.EncBinary() + _ = yym39 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Type)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { + yym41 := z.EncBinary() + _ = yym41 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym42 := z.EncBinary() + _ = yym42 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { + yym44 := z.EncBinary() + _ = yym44 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym45 := z.EncBinary() + _ = yym45 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -33712,24 +41159,25 @@ func (x *Event) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2900 := z.DecBinary() - _ = yym2900 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2901 := r.ReadMapStart() - if yyl2901 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2901, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2901 := r.ReadArrayStart() - if yyl2901 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2901, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -33741,12 +41189,12 @@ func (x *Event) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2902Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2902Slc - var yyhl2902 bool = l >= 0 - for yyj2902 := 0; ; yyj2902++ { - if yyhl2902 { - if yyj2902 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -33754,34 +41202,24 @@ func (x *Event) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2902Slc = r.DecodeBytes(yys2902Slc, true, true) - yys2902 := string(yys2902Slc) - switch yys2902 { - case "kind": - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - case "apiVersion": - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "metadata": if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv2905 := &x.ObjectMeta - yyv2905.CodecDecodeSelf(d) + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) } case "involvedObject": if r.TryDecodeAsNil() { x.InvolvedObject = ObjectReference{} } else { - yyv2906 := &x.InvolvedObject - yyv2906.CodecDecodeSelf(d) + yyv5 := &x.InvolvedObject + yyv5.CodecDecodeSelf(d) } case "reason": if r.TryDecodeAsNil() { @@ -33799,253 +41237,296 @@ func (x *Event) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Source = EventSource{} } else { - yyv2909 := &x.Source - yyv2909.CodecDecodeSelf(d) + yyv8 := &x.Source + yyv8.CodecDecodeSelf(d) } case "firstTimestamp": if r.TryDecodeAsNil() { x.FirstTimestamp = pkg2_unversioned.Time{} } else { - yyv2910 := &x.FirstTimestamp - yym2911 := z.DecBinary() - _ = yym2911 + yyv9 := &x.FirstTimestamp + yym10 := z.DecBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.DecExt(yyv2910) { - } else if yym2911 { - z.DecBinaryUnmarshal(yyv2910) - } else if !yym2911 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2910) + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if yym10 { + z.DecBinaryUnmarshal(yyv9) + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) } else { - z.DecFallback(yyv2910, false) + z.DecFallback(yyv9, false) } } case "lastTimestamp": if r.TryDecodeAsNil() { x.LastTimestamp = pkg2_unversioned.Time{} } else { - yyv2912 := &x.LastTimestamp - yym2913 := z.DecBinary() - _ = yym2913 + yyv11 := &x.LastTimestamp + yym12 := z.DecBinary() + _ = yym12 if false { - } else if z.HasExtensions() && z.DecExt(yyv2912) { - } else if yym2913 { - z.DecBinaryUnmarshal(yyv2912) - } else if !yym2913 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2912) + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else if yym12 { + z.DecBinaryUnmarshal(yyv11) + } else if !yym12 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv11) } else { - z.DecFallback(yyv2912, false) + z.DecFallback(yyv11, false) } } case "count": if r.TryDecodeAsNil() { x.Count = 0 } else { - x.Count = int(r.DecodeInt(codecSelferBitsize1234)) + x.Count = int32(r.DecodeInt(32)) + } + case "type": + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = string(r.DecodeString()) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys2902) - } // end switch yys2902 - } // end for yyj2902 - if !yyhl2902 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Event) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2915 int - var yyb2915 bool - var yyhl2915 bool = l >= 0 - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l + var yyj17 int + var yyb17 bool + var yyhl17 bool = l >= 0 + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2915 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2915 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l - } else { - yyb2915 = r.CheckBreak() - } - if yyb2915 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l - } else { - yyb2915 = r.CheckBreak() - } - if yyb2915 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv2918 := &x.ObjectMeta - yyv2918.CodecDecodeSelf(d) + yyv18 := &x.ObjectMeta + yyv18.CodecDecodeSelf(d) } - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2915 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2915 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.InvolvedObject = ObjectReference{} } else { - yyv2919 := &x.InvolvedObject - yyv2919.CodecDecodeSelf(d) + yyv19 := &x.InvolvedObject + yyv19.CodecDecodeSelf(d) } - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2915 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2915 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2915 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2915 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2915 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2915 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Source = EventSource{} } else { - yyv2922 := &x.Source - yyv2922.CodecDecodeSelf(d) + yyv22 := &x.Source + yyv22.CodecDecodeSelf(d) } - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2915 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2915 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FirstTimestamp = pkg2_unversioned.Time{} } else { - yyv2923 := &x.FirstTimestamp - yym2924 := z.DecBinary() - _ = yym2924 + yyv23 := &x.FirstTimestamp + yym24 := z.DecBinary() + _ = yym24 if false { - } else if z.HasExtensions() && z.DecExt(yyv2923) { - } else if yym2924 { - z.DecBinaryUnmarshal(yyv2923) - } else if !yym2924 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2923) + } else if z.HasExtensions() && z.DecExt(yyv23) { + } else if yym24 { + z.DecBinaryUnmarshal(yyv23) + } else if !yym24 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv23) } else { - z.DecFallback(yyv2923, false) + z.DecFallback(yyv23, false) } } - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2915 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2915 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTimestamp = pkg2_unversioned.Time{} } else { - yyv2925 := &x.LastTimestamp - yym2926 := z.DecBinary() - _ = yym2926 + yyv25 := &x.LastTimestamp + yym26 := z.DecBinary() + _ = yym26 if false { - } else if z.HasExtensions() && z.DecExt(yyv2925) { - } else if yym2926 { - z.DecBinaryUnmarshal(yyv2925) - } else if !yym2926 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv2925) + } else if z.HasExtensions() && z.DecExt(yyv25) { + } else if yym26 { + z.DecBinaryUnmarshal(yyv25) + } else if !yym26 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv25) } else { - z.DecFallback(yyv2925, false) + z.DecFallback(yyv25, false) } } - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2915 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2915 { - r.ReadEnd() + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Count = 0 } else { - x.Count = int(r.DecodeInt(codecSelferBitsize1234)) + x.Count = int32(r.DecodeInt(32)) + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = string(r.DecodeString()) + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) } for { - yyj2915++ - if yyhl2915 { - yyb2915 = yyj2915 > l + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l } else { - yyb2915 = r.CheckBreak() + yyb17 = r.CheckBreak() } - if yyb2915 { + if yyb17 { break } - z.DecStructFieldNotFound(yyj2915-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj17-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *EventList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -34055,126 +41536,142 @@ func (x *EventList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2928 := z.EncBinary() - _ = yym2928 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2929 := !z.EncBinary() - yy2arr2929 := z.EncBasicHandle().StructToArray - var yyq2929 [4]bool - _, _, _ = yysep2929, yyq2929, yy2arr2929 - const yyr2929 bool = false - yyq2929[0] = x.Kind != "" - yyq2929[1] = x.APIVersion != "" - yyq2929[2] = true - if yyr2929 || yy2arr2929 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2929 int = 1 - for _, b := range yyq2929 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2929++ + yynn2++ } } - r.EncodeMapStart(yynn2929) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2929 || yy2arr2929 { - if yyq2929[0] { - yym2931 := z.EncBinary() - _ = yym2931 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2929[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2932 := z.EncBinary() - _ = yym2932 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2929 || yy2arr2929 { - if yyq2929[1] { - yym2934 := z.EncBinary() - _ = yym2934 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2929[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2935 := z.EncBinary() - _ = yym2935 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2929 || yy2arr2929 { - if yyq2929[2] { - yy2937 := &x.ListMeta - yym2938 := z.EncBinary() - _ = yym2938 - if false { - } else if z.HasExtensions() && z.EncExt(yy2937) { - } else { - z.EncFallback(yy2937) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2929[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2939 := &x.ListMeta - yym2940 := z.EncBinary() - _ = yym2940 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2939) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2939) + z.EncFallback(yy6) } } } - if yyr2929 || yy2arr2929 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2942 := z.EncBinary() - _ = yym2942 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceEvent(([]Event)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2943 := z.EncBinary() - _ = yym2943 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceEvent(([]Event)(x.Items), e) } } } - if yysep2929 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -34184,24 +41681,25 @@ func (x *EventList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2944 := z.DecBinary() - _ = yym2944 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2945 := r.ReadMapStart() - if yyl2945 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2945, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2945 := r.ReadArrayStart() - if yyl2945 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2945, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -34213,12 +41711,12 @@ func (x *EventList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2946Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2946Slc - var yyhl2946 bool = l >= 0 - for yyj2946 := 0; ; yyj2946++ { - if yyhl2946 { - if yyj2946 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -34226,9 +41724,36 @@ func (x *EventList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2946Slc = r.DecodeBytes(yys2946Slc, true, true) - yys2946 := string(yys2946Slc) - switch yys2946 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceEvent((*[]Event)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -34241,133 +41766,111 @@ func (x *EventList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2949 := &x.ListMeta - yym2950 := z.DecBinary() - _ = yym2950 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2949) { - } else { - z.DecFallback(yyv2949, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2951 := &x.Items - yym2952 := z.DecBinary() - _ = yym2952 - if false { - } else { - h.decSliceEvent((*[]Event)(yyv2951), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2946) - } // end switch yys2946 - } // end for yyj2946 - if !yyhl2946 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *EventList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2953 int - var yyb2953 bool - var yyhl2953 bool = l >= 0 - yyj2953++ - if yyhl2953 { - yyb2953 = yyj2953 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2953 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2953 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceEvent((*[]Event)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2953++ - if yyhl2953 { - yyb2953 = yyj2953 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2953 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2953 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2953++ - if yyhl2953 { - yyb2953 = yyj2953 > l - } else { - yyb2953 = r.CheckBreak() - } - if yyb2953 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2956 := &x.ListMeta - yym2957 := z.DecBinary() - _ = yym2957 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2956) { - } else { - z.DecFallback(yyv2956, false) - } - } - yyj2953++ - if yyhl2953 { - yyb2953 = yyj2953 > l - } else { - yyb2953 = r.CheckBreak() - } - if yyb2953 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2958 := &x.Items - yym2959 := z.DecBinary() - _ = yym2959 - if false { - } else { - h.decSliceEvent((*[]Event)(yyv2958), d) - } - } for { - yyj2953++ - if yyhl2953 { - yyb2953 = yyj2953 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2953 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2953 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2953-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *List) CodecEncodeSelf(e *codec1978.Encoder) { @@ -34377,126 +41880,142 @@ func (x *List) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2960 := z.EncBinary() - _ = yym2960 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2961 := !z.EncBinary() - yy2arr2961 := z.EncBasicHandle().StructToArray - var yyq2961 [4]bool - _, _, _ = yysep2961, yyq2961, yy2arr2961 - const yyr2961 bool = false - yyq2961[0] = x.Kind != "" - yyq2961[1] = x.APIVersion != "" - yyq2961[2] = true - if yyr2961 || yy2arr2961 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2961 int = 1 - for _, b := range yyq2961 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn2961++ + yynn2++ } } - r.EncodeMapStart(yynn2961) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2961 || yy2arr2961 { - if yyq2961[0] { - yym2963 := z.EncBinary() - _ = yym2963 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2961[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym2964 := z.EncBinary() - _ = yym2964 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2961 || yy2arr2961 { - if yyq2961[1] { - yym2966 := z.EncBinary() - _ = yym2966 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2961[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym2967 := z.EncBinary() - _ = yym2967 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2961 || yy2arr2961 { - if yyq2961[2] { - yy2969 := &x.ListMeta - yym2970 := z.EncBinary() - _ = yym2970 - if false { - } else if z.HasExtensions() && z.EncExt(yy2969) { - } else { - z.EncFallback(yy2969) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq2961[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy2971 := &x.ListMeta - yym2972 := z.EncBinary() - _ = yym2972 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy2971) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy2971) + z.EncFallback(yy6) } } } - if yyr2961 || yy2arr2961 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym2974 := z.EncBinary() - _ = yym2974 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceruntime_RawExtension(([]pkg6_runtime.RawExtension)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym2975 := z.EncBinary() - _ = yym2975 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceruntime_RawExtension(([]pkg6_runtime.RawExtension)(x.Items), e) } } } - if yysep2961 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -34506,24 +42025,25 @@ func (x *List) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2976 := z.DecBinary() - _ = yym2976 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl2977 := r.ReadMapStart() - if yyl2977 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl2977, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl2977 := r.ReadArrayStart() - if yyl2977 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl2977, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -34535,12 +42055,12 @@ func (x *List) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys2978Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys2978Slc - var yyhl2978 bool = l >= 0 - for yyj2978 := 0; ; yyj2978++ { - if yyhl2978 { - if yyj2978 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -34548,9 +42068,36 @@ func (x *List) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys2978Slc = r.DecodeBytes(yys2978Slc, true, true) - yys2978 := string(yys2978Slc) - switch yys2978 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceruntime_RawExtension((*[]pkg6_runtime.RawExtension)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -34563,141 +42110,119 @@ func (x *List) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2981 := &x.ListMeta - yym2982 := z.DecBinary() - _ = yym2982 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2981) { - } else { - z.DecFallback(yyv2981, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2983 := &x.Items - yym2984 := z.DecBinary() - _ = yym2984 - if false { - } else { - h.decSliceruntime_RawExtension((*[]pkg6_runtime.RawExtension)(yyv2983), d) - } - } default: - z.DecStructFieldNotFound(-1, yys2978) - } // end switch yys2978 - } // end for yyj2978 - if !yyhl2978 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *List) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj2985 int - var yyb2985 bool - var yyhl2985 bool = l >= 0 - yyj2985++ - if yyhl2985 { - yyb2985 = yyj2985 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2985 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2985 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceruntime_RawExtension((*[]pkg6_runtime.RawExtension)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj2985++ - if yyhl2985 { - yyb2985 = yyj2985 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2985 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2985 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj2985++ - if yyhl2985 { - yyb2985 = yyj2985 > l - } else { - yyb2985 = r.CheckBreak() - } - if yyb2985 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv2988 := &x.ListMeta - yym2989 := z.DecBinary() - _ = yym2989 - if false { - } else if z.HasExtensions() && z.DecExt(yyv2988) { - } else { - z.DecFallback(yyv2988, false) - } - } - yyj2985++ - if yyhl2985 { - yyb2985 = yyj2985 > l - } else { - yyb2985 = r.CheckBreak() - } - if yyb2985 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv2990 := &x.Items - yym2991 := z.DecBinary() - _ = yym2991 - if false { - } else { - h.decSliceruntime_RawExtension((*[]pkg6_runtime.RawExtension)(yyv2990), d) - } - } for { - yyj2985++ - if yyhl2985 { - yyb2985 = yyj2985 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb2985 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb2985 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj2985-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x LimitType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym2992 := z.EncBinary() - _ = yym2992 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -34709,8 +42234,8 @@ func (x *LimitType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym2993 := z.DecBinary() - _ = yym2993 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -34725,47 +42250,53 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym2994 := z.EncBinary() - _ = yym2994 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep2995 := !z.EncBinary() - yy2arr2995 := z.EncBasicHandle().StructToArray - var yyq2995 [6]bool - _, _, _ = yysep2995, yyq2995, yy2arr2995 - const yyr2995 bool = false - yyq2995[0] = x.Type != "" - yyq2995[1] = len(x.Max) != 0 - yyq2995[2] = len(x.Min) != 0 - yyq2995[3] = len(x.Default) != 0 - yyq2995[4] = len(x.DefaultRequest) != 0 - yyq2995[5] = len(x.MaxLimitRequestRatio) != 0 - if yyr2995 || yy2arr2995 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Type != "" + yyq2[1] = len(x.Max) != 0 + yyq2[2] = len(x.Min) != 0 + yyq2[3] = len(x.Default) != 0 + yyq2[4] = len(x.DefaultRequest) != 0 + yyq2[5] = len(x.MaxLimitRequestRatio) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn2995 int = 0 - for _, b := range yyq2995 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn2995++ + yynn2++ } } - r.EncodeMapStart(yynn2995) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr2995 || yy2arr2995 { - if yyq2995[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Type.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq2995[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } } - if yyr2995 || yy2arr2995 { - if yyq2995[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Max == nil { r.EncodeNil() } else { @@ -34775,8 +42306,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2995[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("max")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Max == nil { r.EncodeNil() } else { @@ -34784,8 +42317,9 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2995 || yy2arr2995 { - if yyq2995[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Min == nil { r.EncodeNil() } else { @@ -34795,8 +42329,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2995[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("min")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Min == nil { r.EncodeNil() } else { @@ -34804,8 +42340,9 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2995 || yy2arr2995 { - if yyq2995[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.Default == nil { r.EncodeNil() } else { @@ -34815,8 +42352,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2995[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("default")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Default == nil { r.EncodeNil() } else { @@ -34824,8 +42363,9 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2995 || yy2arr2995 { - if yyq2995[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.DefaultRequest == nil { r.EncodeNil() } else { @@ -34835,8 +42375,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2995[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("defaultRequest")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.DefaultRequest == nil { r.EncodeNil() } else { @@ -34844,8 +42386,9 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr2995 || yy2arr2995 { - if yyq2995[5] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { if x.MaxLimitRequestRatio == nil { r.EncodeNil() } else { @@ -34855,8 +42398,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2995[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxLimitRequestRatio")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.MaxLimitRequestRatio == nil { r.EncodeNil() } else { @@ -34864,8 +42409,10 @@ func (x *LimitRangeItem) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep2995 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -34875,24 +42422,25 @@ func (x *LimitRangeItem) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3002 := z.DecBinary() - _ = yym3002 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3003 := r.ReadMapStart() - if yyl3003 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3003, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3003 := r.ReadArrayStart() - if yyl3003 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3003, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -34904,12 +42452,12 @@ func (x *LimitRangeItem) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3004Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3004Slc - var yyhl3004 bool = l >= 0 - for yyj3004 := 0; ; yyj3004++ { - if yyhl3004 { - if yyj3004 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -34917,9 +42465,11 @@ func (x *LimitRangeItem) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3004Slc = r.DecodeBytes(yys3004Slc, true, true) - yys3004 := string(yys3004Slc) - switch yys3004 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -34930,161 +42480,166 @@ func (x *LimitRangeItem) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Max = nil } else { - yyv3006 := &x.Max - yyv3006.CodecDecodeSelf(d) + yyv5 := &x.Max + yyv5.CodecDecodeSelf(d) } case "min": if r.TryDecodeAsNil() { x.Min = nil } else { - yyv3007 := &x.Min - yyv3007.CodecDecodeSelf(d) + yyv6 := &x.Min + yyv6.CodecDecodeSelf(d) } case "default": if r.TryDecodeAsNil() { x.Default = nil } else { - yyv3008 := &x.Default - yyv3008.CodecDecodeSelf(d) + yyv7 := &x.Default + yyv7.CodecDecodeSelf(d) } case "defaultRequest": if r.TryDecodeAsNil() { x.DefaultRequest = nil } else { - yyv3009 := &x.DefaultRequest - yyv3009.CodecDecodeSelf(d) + yyv8 := &x.DefaultRequest + yyv8.CodecDecodeSelf(d) } case "maxLimitRequestRatio": if r.TryDecodeAsNil() { x.MaxLimitRequestRatio = nil } else { - yyv3010 := &x.MaxLimitRequestRatio - yyv3010.CodecDecodeSelf(d) + yyv9 := &x.MaxLimitRequestRatio + yyv9.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys3004) - } // end switch yys3004 - } // end for yyj3004 - if !yyhl3004 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LimitRangeItem) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3011 int - var yyb3011 bool - var yyhl3011 bool = l >= 0 - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = LimitType(r.DecodeString()) } - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Max = nil } else { - yyv3013 := &x.Max - yyv3013.CodecDecodeSelf(d) + yyv12 := &x.Max + yyv12.CodecDecodeSelf(d) } - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Min = nil } else { - yyv3014 := &x.Min - yyv3014.CodecDecodeSelf(d) + yyv13 := &x.Min + yyv13.CodecDecodeSelf(d) } - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Default = nil } else { - yyv3015 := &x.Default - yyv3015.CodecDecodeSelf(d) + yyv14 := &x.Default + yyv14.CodecDecodeSelf(d) } - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DefaultRequest = nil } else { - yyv3016 := &x.DefaultRequest - yyv3016.CodecDecodeSelf(d) + yyv15 := &x.DefaultRequest + yyv15.CodecDecodeSelf(d) } - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MaxLimitRequestRatio = nil } else { - yyv3017 := &x.MaxLimitRequestRatio - yyv3017.CodecDecodeSelf(d) + yyv16 := &x.MaxLimitRequestRatio + yyv16.CodecDecodeSelf(d) } for { - yyj3011++ - if yyhl3011 { - yyb3011 = yyj3011 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3011 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3011 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3011-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LimitRangeSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -35094,53 +42649,60 @@ func (x *LimitRangeSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3018 := z.EncBinary() - _ = yym3018 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3019 := !z.EncBinary() - yy2arr3019 := z.EncBasicHandle().StructToArray - var yyq3019 [1]bool - _, _, _ = yysep3019, yyq3019, yy2arr3019 - const yyr3019 bool = false - if yyr3019 || yy2arr3019 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn3019 int = 1 - for _, b := range yyq3019 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3019++ + yynn2++ } } - r.EncodeMapStart(yynn3019) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3019 || yy2arr3019 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Limits == nil { r.EncodeNil() } else { - yym3021 := z.EncBinary() - _ = yym3021 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceLimitRangeItem(([]LimitRangeItem)(x.Limits), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("limits")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Limits == nil { r.EncodeNil() } else { - yym3022 := z.EncBinary() - _ = yym3022 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceLimitRangeItem(([]LimitRangeItem)(x.Limits), e) } } } - if yysep3019 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -35150,24 +42712,25 @@ func (x *LimitRangeSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3023 := z.DecBinary() - _ = yym3023 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3024 := r.ReadMapStart() - if yyl3024 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3024, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3024 := r.ReadArrayStart() - if yyl3024 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3024, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -35179,12 +42742,12 @@ func (x *LimitRangeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3025Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3025Slc - var yyhl3025 bool = l >= 0 - for yyj3025 := 0; ; yyj3025++ { - if yyhl3025 { - if yyj3025 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -35192,71 +42755,73 @@ func (x *LimitRangeSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3025Slc = r.DecodeBytes(yys3025Slc, true, true) - yys3025 := string(yys3025Slc) - switch yys3025 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "limits": if r.TryDecodeAsNil() { x.Limits = nil } else { - yyv3026 := &x.Limits - yym3027 := z.DecBinary() - _ = yym3027 + yyv4 := &x.Limits + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceLimitRangeItem((*[]LimitRangeItem)(yyv3026), d) + h.decSliceLimitRangeItem((*[]LimitRangeItem)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys3025) - } // end switch yys3025 - } // end for yyj3025 - if !yyhl3025 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LimitRangeSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3028 int - var yyb3028 bool - var yyhl3028 bool = l >= 0 - yyj3028++ - if yyhl3028 { - yyb3028 = yyj3028 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3028 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3028 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Limits = nil } else { - yyv3029 := &x.Limits - yym3030 := z.DecBinary() - _ = yym3030 + yyv7 := &x.Limits + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceLimitRangeItem((*[]LimitRangeItem)(yyv3029), d) + h.decSliceLimitRangeItem((*[]LimitRangeItem)(yyv7), d) } } for { - yyj3028++ - if yyhl3028 { - yyb3028 = yyj3028 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3028 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3028 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj3028-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LimitRange) CodecEncodeSelf(e *codec1978.Encoder) { @@ -35266,105 +42831,121 @@ func (x *LimitRange) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3031 := z.EncBinary() - _ = yym3031 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3032 := !z.EncBinary() - yy2arr3032 := z.EncBasicHandle().StructToArray - var yyq3032 [4]bool - _, _, _ = yysep3032, yyq3032, yy2arr3032 - const yyr3032 bool = false - yyq3032[0] = x.Kind != "" - yyq3032[1] = x.APIVersion != "" - yyq3032[2] = true - yyq3032[3] = true - if yyr3032 || yy2arr3032 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3032 int = 0 - for _, b := range yyq3032 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3032++ + yynn2++ } } - r.EncodeMapStart(yynn3032) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3032 || yy2arr3032 { - if yyq3032[0] { - yym3034 := z.EncBinary() - _ = yym3034 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3032[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3035 := z.EncBinary() - _ = yym3035 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3032 || yy2arr3032 { - if yyq3032[1] { - yym3037 := z.EncBinary() - _ = yym3037 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3032[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3038 := z.EncBinary() - _ = yym3038 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3032 || yy2arr3032 { - if yyq3032[2] { - yy3040 := &x.ObjectMeta - yy3040.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3032[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3041 := &x.ObjectMeta - yy3041.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3032 || yy2arr3032 { - if yyq3032[3] { - yy3043 := &x.Spec - yy3043.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3032[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy3044 := &x.Spec - yy3044.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yysep3032 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -35374,24 +42955,25 @@ func (x *LimitRange) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3045 := z.DecBinary() - _ = yym3045 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3046 := r.ReadMapStart() - if yyl3046 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3046, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3046 := r.ReadArrayStart() - if yyl3046 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3046, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -35403,12 +42985,12 @@ func (x *LimitRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3047Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3047Slc - var yyhl3047 bool = l >= 0 - for yyj3047 := 0; ; yyj3047++ { - if yyhl3047 { - if yyj3047 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -35416,9 +42998,25 @@ func (x *LimitRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3047Slc = r.DecodeBytes(yys3047Slc, true, true) - yys3047 := string(yys3047Slc) - switch yys3047 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = LimitRangeSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -35431,111 +43029,100 @@ func (x *LimitRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3050 := &x.ObjectMeta - yyv3050.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = LimitRangeSpec{} - } else { - yyv3051 := &x.Spec - yyv3051.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys3047) - } // end switch yys3047 - } // end for yyj3047 - if !yyhl3047 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LimitRange) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3052 int - var yyb3052 bool - var yyhl3052 bool = l >= 0 - yyj3052++ - if yyhl3052 { - yyb3052 = yyj3052 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3052 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3052 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = LimitRangeSpec{} + } else { + yyv10 := &x.Spec + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3052++ - if yyhl3052 { - yyb3052 = yyj3052 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3052 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3052 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3052++ - if yyhl3052 { - yyb3052 = yyj3052 > l - } else { - yyb3052 = r.CheckBreak() - } - if yyb3052 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3055 := &x.ObjectMeta - yyv3055.CodecDecodeSelf(d) - } - yyj3052++ - if yyhl3052 { - yyb3052 = yyj3052 > l - } else { - yyb3052 = r.CheckBreak() - } - if yyb3052 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = LimitRangeSpec{} - } else { - yyv3056 := &x.Spec - yyv3056.CodecDecodeSelf(d) - } for { - yyj3052++ - if yyhl3052 { - yyb3052 = yyj3052 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3052 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3052 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj3052-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *LimitRangeList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -35545,126 +43132,142 @@ func (x *LimitRangeList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3057 := z.EncBinary() - _ = yym3057 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3058 := !z.EncBinary() - yy2arr3058 := z.EncBasicHandle().StructToArray - var yyq3058 [4]bool - _, _, _ = yysep3058, yyq3058, yy2arr3058 - const yyr3058 bool = false - yyq3058[0] = x.Kind != "" - yyq3058[1] = x.APIVersion != "" - yyq3058[2] = true - if yyr3058 || yy2arr3058 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3058 int = 1 - for _, b := range yyq3058 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3058++ + yynn2++ } } - r.EncodeMapStart(yynn3058) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3058 || yy2arr3058 { - if yyq3058[0] { - yym3060 := z.EncBinary() - _ = yym3060 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3058[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3061 := z.EncBinary() - _ = yym3061 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3058 || yy2arr3058 { - if yyq3058[1] { - yym3063 := z.EncBinary() - _ = yym3063 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3058[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3064 := z.EncBinary() - _ = yym3064 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3058 || yy2arr3058 { - if yyq3058[2] { - yy3066 := &x.ListMeta - yym3067 := z.EncBinary() - _ = yym3067 - if false { - } else if z.HasExtensions() && z.EncExt(yy3066) { - } else { - z.EncFallback(yy3066) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq3058[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3068 := &x.ListMeta - yym3069 := z.EncBinary() - _ = yym3069 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy3068) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy3068) + z.EncFallback(yy6) } } } - if yyr3058 || yy2arr3058 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym3071 := z.EncBinary() - _ = yym3071 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceLimitRange(([]LimitRange)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3072 := z.EncBinary() - _ = yym3072 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceLimitRange(([]LimitRange)(x.Items), e) } } } - if yysep3058 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -35674,24 +43277,25 @@ func (x *LimitRangeList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3073 := z.DecBinary() - _ = yym3073 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3074 := r.ReadMapStart() - if yyl3074 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3074, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3074 := r.ReadArrayStart() - if yyl3074 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3074, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -35703,12 +43307,12 @@ func (x *LimitRangeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3075Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3075Slc - var yyhl3075 bool = l >= 0 - for yyj3075 := 0; ; yyj3075++ { - if yyhl3075 { - if yyj3075 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -35716,9 +43320,36 @@ func (x *LimitRangeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3075Slc = r.DecodeBytes(yys3075Slc, true, true) - yys3075 := string(yys3075Slc) - switch yys3075 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceLimitRange((*[]LimitRange)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -35731,133 +43362,111 @@ func (x *LimitRangeList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3078 := &x.ListMeta - yym3079 := z.DecBinary() - _ = yym3079 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3078) { - } else { - z.DecFallback(yyv3078, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3080 := &x.Items - yym3081 := z.DecBinary() - _ = yym3081 - if false { - } else { - h.decSliceLimitRange((*[]LimitRange)(yyv3080), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3075) - } // end switch yys3075 - } // end for yyj3075 - if !yyhl3075 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *LimitRangeList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3082 int - var yyb3082 bool - var yyhl3082 bool = l >= 0 - yyj3082++ - if yyhl3082 { - yyb3082 = yyj3082 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3082 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3082 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceLimitRange((*[]LimitRange)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3082++ - if yyhl3082 { - yyb3082 = yyj3082 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3082 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3082 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3082++ - if yyhl3082 { - yyb3082 = yyj3082 > l - } else { - yyb3082 = r.CheckBreak() - } - if yyb3082 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3085 := &x.ListMeta - yym3086 := z.DecBinary() - _ = yym3086 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3085) { - } else { - z.DecFallback(yyv3085, false) - } - } - yyj3082++ - if yyhl3082 { - yyb3082 = yyj3082 > l - } else { - yyb3082 = r.CheckBreak() - } - if yyb3082 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3087 := &x.Items - yym3088 := z.DecBinary() - _ = yym3088 - if false { - } else { - h.decSliceLimitRange((*[]LimitRange)(yyv3087), d) - } - } for { - yyj3082++ - if yyhl3082 { - yyb3082 = yyj3082 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3082 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3082 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3082-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceQuotaSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -35867,30 +43476,33 @@ func (x *ResourceQuotaSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3089 := z.EncBinary() - _ = yym3089 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3090 := !z.EncBinary() - yy2arr3090 := z.EncBasicHandle().StructToArray - var yyq3090 [1]bool - _, _, _ = yysep3090, yyq3090, yy2arr3090 - const yyr3090 bool = false - yyq3090[0] = len(x.Hard) != 0 - if yyr3090 || yy2arr3090 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Hard) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn3090 int = 0 - for _, b := range yyq3090 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3090++ + yynn2++ } } - r.EncodeMapStart(yynn3090) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3090 || yy2arr3090 { - if yyq3090[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Hard == nil { r.EncodeNil() } else { @@ -35900,8 +43512,10 @@ func (x *ResourceQuotaSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3090[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hard")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Hard == nil { r.EncodeNil() } else { @@ -35909,8 +43523,10 @@ func (x *ResourceQuotaSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep3090 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -35920,24 +43536,25 @@ func (x *ResourceQuotaSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3092 := z.DecBinary() - _ = yym3092 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3093 := r.ReadMapStart() - if yyl3093 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3093, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3093 := r.ReadArrayStart() - if yyl3093 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3093, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -35949,12 +43566,12 @@ func (x *ResourceQuotaSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3094Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3094Slc - var yyhl3094 bool = l >= 0 - for yyj3094 := 0; ; yyj3094++ { - if yyhl3094 { - if yyj3094 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -35962,61 +43579,63 @@ func (x *ResourceQuotaSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys3094Slc = r.DecodeBytes(yys3094Slc, true, true) - yys3094 := string(yys3094Slc) - switch yys3094 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "hard": if r.TryDecodeAsNil() { x.Hard = nil } else { - yyv3095 := &x.Hard - yyv3095.CodecDecodeSelf(d) + yyv4 := &x.Hard + yyv4.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys3094) - } // end switch yys3094 - } // end for yyj3094 - if !yyhl3094 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceQuotaSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3096 int - var yyb3096 bool - var yyhl3096 bool = l >= 0 - yyj3096++ - if yyhl3096 { - yyb3096 = yyj3096 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb3096 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb3096 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Hard = nil } else { - yyv3097 := &x.Hard - yyv3097.CodecDecodeSelf(d) + yyv6 := &x.Hard + yyv6.CodecDecodeSelf(d) } for { - yyj3096++ - if yyhl3096 { - yyb3096 = yyj3096 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb3096 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb3096 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj3096-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -36026,31 +43645,34 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3098 := z.EncBinary() - _ = yym3098 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3099 := !z.EncBinary() - yy2arr3099 := z.EncBasicHandle().StructToArray - var yyq3099 [2]bool - _, _, _ = yysep3099, yyq3099, yy2arr3099 - const yyr3099 bool = false - yyq3099[0] = len(x.Hard) != 0 - yyq3099[1] = len(x.Used) != 0 - if yyr3099 || yy2arr3099 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Hard) != 0 + yyq2[1] = len(x.Used) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn3099 int = 0 - for _, b := range yyq3099 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3099++ + yynn2++ } } - r.EncodeMapStart(yynn3099) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3099 || yy2arr3099 { - if yyq3099[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Hard == nil { r.EncodeNil() } else { @@ -36060,8 +43682,10 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3099[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("hard")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Hard == nil { r.EncodeNil() } else { @@ -36069,8 +43693,9 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3099 || yy2arr3099 { - if yyq3099[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Used == nil { r.EncodeNil() } else { @@ -36080,8 +43705,10 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3099[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("used")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Used == nil { r.EncodeNil() } else { @@ -36089,8 +43716,10 @@ func (x *ResourceQuotaStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep3099 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -36100,24 +43729,25 @@ func (x *ResourceQuotaStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3102 := z.DecBinary() - _ = yym3102 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3103 := r.ReadMapStart() - if yyl3103 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3103, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3103 := r.ReadArrayStart() - if yyl3103 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3103, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -36129,12 +43759,12 @@ func (x *ResourceQuotaStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3104Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3104Slc - var yyhl3104 bool = l >= 0 - for yyj3104 := 0; ; yyj3104++ { - if yyhl3104 { - if yyj3104 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -36142,84 +43772,87 @@ func (x *ResourceQuotaStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys3104Slc = r.DecodeBytes(yys3104Slc, true, true) - yys3104 := string(yys3104Slc) - switch yys3104 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "hard": if r.TryDecodeAsNil() { x.Hard = nil } else { - yyv3105 := &x.Hard - yyv3105.CodecDecodeSelf(d) + yyv4 := &x.Hard + yyv4.CodecDecodeSelf(d) } case "used": if r.TryDecodeAsNil() { x.Used = nil } else { - yyv3106 := &x.Used - yyv3106.CodecDecodeSelf(d) + yyv5 := &x.Used + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys3104) - } // end switch yys3104 - } // end for yyj3104 - if !yyhl3104 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceQuotaStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3107 int - var yyb3107 bool - var yyhl3107 bool = l >= 0 - yyj3107++ - if yyhl3107 { - yyb3107 = yyj3107 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3107 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3107 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Hard = nil } else { - yyv3108 := &x.Hard - yyv3108.CodecDecodeSelf(d) + yyv7 := &x.Hard + yyv7.CodecDecodeSelf(d) } - yyj3107++ - if yyhl3107 { - yyb3107 = yyj3107 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3107 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3107 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Used = nil } else { - yyv3109 := &x.Used - yyv3109.CodecDecodeSelf(d) + yyv8 := &x.Used + yyv8.CodecDecodeSelf(d) } for { - yyj3107++ - if yyhl3107 { - yyb3107 = yyj3107 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3107 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3107 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj3107-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceQuota) CodecEncodeSelf(e *codec1978.Encoder) { @@ -36229,120 +43862,139 @@ func (x *ResourceQuota) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3110 := z.EncBinary() - _ = yym3110 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3111 := !z.EncBinary() - yy2arr3111 := z.EncBasicHandle().StructToArray - var yyq3111 [5]bool - _, _, _ = yysep3111, yyq3111, yy2arr3111 - const yyr3111 bool = false - yyq3111[0] = x.Kind != "" - yyq3111[1] = x.APIVersion != "" - yyq3111[2] = true - yyq3111[3] = true - yyq3111[4] = true - if yyr3111 || yy2arr3111 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn3111 int = 0 - for _, b := range yyq3111 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3111++ + yynn2++ } } - r.EncodeMapStart(yynn3111) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3111 || yy2arr3111 { - if yyq3111[0] { - yym3113 := z.EncBinary() - _ = yym3113 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3111[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3114 := z.EncBinary() - _ = yym3114 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3111 || yy2arr3111 { - if yyq3111[1] { - yym3116 := z.EncBinary() - _ = yym3116 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3111[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3117 := z.EncBinary() - _ = yym3117 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3111 || yy2arr3111 { - if yyq3111[2] { - yy3119 := &x.ObjectMeta - yy3119.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3111[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3120 := &x.ObjectMeta - yy3120.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3111 || yy2arr3111 { - if yyq3111[3] { - yy3122 := &x.Spec - yy3122.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3111[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy3123 := &x.Spec - yy3123.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr3111 || yy2arr3111 { - if yyq3111[4] { - yy3125 := &x.Status - yy3125.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3111[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy3126 := &x.Status - yy3126.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep3111 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -36352,24 +44004,25 @@ func (x *ResourceQuota) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3127 := z.DecBinary() - _ = yym3127 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3128 := r.ReadMapStart() - if yyl3128 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3128, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3128 := r.ReadArrayStart() - if yyl3128 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3128, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -36381,12 +44034,12 @@ func (x *ResourceQuota) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3129Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3129Slc - var yyhl3129 bool = l >= 0 - for yyj3129 := 0; ; yyj3129++ { - if yyhl3129 { - if yyj3129 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -36394,9 +44047,32 @@ func (x *ResourceQuota) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3129Slc = r.DecodeBytes(yys3129Slc, true, true) - yys3129 := string(yys3129Slc) - switch yys3129 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ResourceQuotaSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ResourceQuotaStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -36409,134 +44085,117 @@ func (x *ResourceQuota) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3132 := &x.ObjectMeta - yyv3132.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ResourceQuotaSpec{} - } else { - yyv3133 := &x.Spec - yyv3133.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = ResourceQuotaStatus{} - } else { - yyv3134 := &x.Status - yyv3134.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys3129) - } // end switch yys3129 - } // end for yyj3129 - if !yyhl3129 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceQuota) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3135 int - var yyb3135 bool - var yyhl3135 bool = l >= 0 - yyj3135++ - if yyhl3135 { - yyb3135 = yyj3135 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3135 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3135 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ResourceQuotaSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ResourceQuotaStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3135++ - if yyhl3135 { - yyb3135 = yyj3135 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3135 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3135 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3135++ - if yyhl3135 { - yyb3135 = yyj3135 > l - } else { - yyb3135 = r.CheckBreak() - } - if yyb3135 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3138 := &x.ObjectMeta - yyv3138.CodecDecodeSelf(d) - } - yyj3135++ - if yyhl3135 { - yyb3135 = yyj3135 > l - } else { - yyb3135 = r.CheckBreak() - } - if yyb3135 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ResourceQuotaSpec{} - } else { - yyv3139 := &x.Spec - yyv3139.CodecDecodeSelf(d) - } - yyj3135++ - if yyhl3135 { - yyb3135 = yyj3135 > l - } else { - yyb3135 = r.CheckBreak() - } - if yyb3135 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = ResourceQuotaStatus{} - } else { - yyv3140 := &x.Status - yyv3140.CodecDecodeSelf(d) - } for { - yyj3135++ - if yyhl3135 { - yyb3135 = yyj3135 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3135 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3135 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj3135-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ResourceQuotaList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -36546,126 +44205,142 @@ func (x *ResourceQuotaList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3141 := z.EncBinary() - _ = yym3141 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3142 := !z.EncBinary() - yy2arr3142 := z.EncBasicHandle().StructToArray - var yyq3142 [4]bool - _, _, _ = yysep3142, yyq3142, yy2arr3142 - const yyr3142 bool = false - yyq3142[0] = x.Kind != "" - yyq3142[1] = x.APIVersion != "" - yyq3142[2] = true - if yyr3142 || yy2arr3142 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3142 int = 1 - for _, b := range yyq3142 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3142++ + yynn2++ } } - r.EncodeMapStart(yynn3142) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3142 || yy2arr3142 { - if yyq3142[0] { - yym3144 := z.EncBinary() - _ = yym3144 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3142[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3145 := z.EncBinary() - _ = yym3145 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3142 || yy2arr3142 { - if yyq3142[1] { - yym3147 := z.EncBinary() - _ = yym3147 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3142[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3148 := z.EncBinary() - _ = yym3148 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3142 || yy2arr3142 { - if yyq3142[2] { - yy3150 := &x.ListMeta - yym3151 := z.EncBinary() - _ = yym3151 - if false { - } else if z.HasExtensions() && z.EncExt(yy3150) { - } else { - z.EncFallback(yy3150) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq3142[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3152 := &x.ListMeta - yym3153 := z.EncBinary() - _ = yym3153 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy3152) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy3152) + z.EncFallback(yy6) } } } - if yyr3142 || yy2arr3142 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym3155 := z.EncBinary() - _ = yym3155 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceResourceQuota(([]ResourceQuota)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3156 := z.EncBinary() - _ = yym3156 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceResourceQuota(([]ResourceQuota)(x.Items), e) } } } - if yysep3142 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -36675,24 +44350,25 @@ func (x *ResourceQuotaList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3157 := z.DecBinary() - _ = yym3157 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3158 := r.ReadMapStart() - if yyl3158 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3158, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3158 := r.ReadArrayStart() - if yyl3158 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3158, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -36704,12 +44380,12 @@ func (x *ResourceQuotaList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3159Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3159Slc - var yyhl3159 bool = l >= 0 - for yyj3159 := 0; ; yyj3159++ { - if yyhl3159 { - if yyj3159 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -36717,9 +44393,36 @@ func (x *ResourceQuotaList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys3159Slc = r.DecodeBytes(yys3159Slc, true, true) - yys3159 := string(yys3159Slc) - switch yys3159 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceResourceQuota((*[]ResourceQuota)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -36732,133 +44435,111 @@ func (x *ResourceQuotaList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3162 := &x.ListMeta - yym3163 := z.DecBinary() - _ = yym3163 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3162) { - } else { - z.DecFallback(yyv3162, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3164 := &x.Items - yym3165 := z.DecBinary() - _ = yym3165 - if false { - } else { - h.decSliceResourceQuota((*[]ResourceQuota)(yyv3164), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3159) - } // end switch yys3159 - } // end for yyj3159 - if !yyhl3159 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ResourceQuotaList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3166 int - var yyb3166 bool - var yyhl3166 bool = l >= 0 - yyj3166++ - if yyhl3166 { - yyb3166 = yyj3166 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3166 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3166 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceResourceQuota((*[]ResourceQuota)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3166++ - if yyhl3166 { - yyb3166 = yyj3166 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3166 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3166 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3166++ - if yyhl3166 { - yyb3166 = yyj3166 > l - } else { - yyb3166 = r.CheckBreak() - } - if yyb3166 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3169 := &x.ListMeta - yym3170 := z.DecBinary() - _ = yym3170 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3169) { - } else { - z.DecFallback(yyv3169, false) - } - } - yyj3166++ - if yyhl3166 { - yyb3166 = yyj3166 > l - } else { - yyb3166 = r.CheckBreak() - } - if yyb3166 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3171 := &x.Items - yym3172 := z.DecBinary() - _ = yym3172 - if false { - } else { - h.decSliceResourceQuota((*[]ResourceQuota)(yyv3171), d) - } - } for { - yyj3166++ - if yyhl3166 { - yyb3166 = yyj3166 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3166 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3166 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3166-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Secret) CodecEncodeSelf(e *codec1978.Encoder) { @@ -36868,97 +44549,59 @@ func (x *Secret) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3173 := z.EncBinary() - _ = yym3173 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3174 := !z.EncBinary() - yy2arr3174 := z.EncBasicHandle().StructToArray - var yyq3174 [5]bool - _, _, _ = yysep3174, yyq3174, yy2arr3174 - const yyr3174 bool = false - yyq3174[0] = x.Kind != "" - yyq3174[1] = x.APIVersion != "" - yyq3174[2] = true - yyq3174[3] = len(x.Data) != 0 - yyq3174[4] = x.Type != "" - if yyr3174 || yy2arr3174 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Data) != 0 + yyq2[2] = x.Type != "" + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn3174 int = 0 - for _, b := range yyq3174 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3174++ + yynn2++ } } - r.EncodeMapStart(yynn3174) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3174 || yy2arr3174 { - if yyq3174[0] { - yym3176 := z.EncBinary() - _ = yym3176 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3174[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3177 := z.EncBinary() - _ = yym3177 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3174 || yy2arr3174 { - if yyq3174[1] { - yym3179 := z.EncBinary() - _ = yym3179 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3174[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3180 := z.EncBinary() - _ = yym3180 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3174 || yy2arr3174 { - if yyq3174[2] { - yy3182 := &x.ObjectMeta - yy3182.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3174[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3183 := &x.ObjectMeta - yy3183.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3174 || yy2arr3174 { - if yyq3174[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Data == nil { r.EncodeNil() } else { - yym3185 := z.EncBinary() - _ = yym3185 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encMapstringSliceuint8((map[string][]uint8)(x.Data), e) @@ -36968,13 +44611,15 @@ func (x *Secret) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3174[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("data")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Data == nil { r.EncodeNil() } else { - yym3186 := z.EncBinary() - _ = yym3186 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encMapstringSliceuint8((map[string][]uint8)(x.Data), e) @@ -36982,20 +44627,75 @@ func (x *Secret) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3174 || yy2arr3174 { - if yyq3174[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { x.Type.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3174[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } } - if yysep3174 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -37005,24 +44705,25 @@ func (x *Secret) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3188 := z.DecBinary() - _ = yym3188 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3189 := r.ReadMapStart() - if yyl3189 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3189, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3189 := r.ReadArrayStart() - if yyl3189 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3189, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -37034,12 +44735,12 @@ func (x *Secret) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3190Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3190Slc - var yyhl3190 bool = l >= 0 - for yyj3190 := 0; ; yyj3190++ { - if yyhl3190 { - if yyj3190 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -37047,9 +44748,36 @@ func (x *Secret) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3190Slc = r.DecodeBytes(yys3190Slc, true, true) - yys3190 := string(yys3190Slc) - switch yys3190 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "data": + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv5 := &x.Data + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decMapstringSliceuint8((*map[string][]uint8)(yyv5), d) + } + } + case "type": + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = SecretType(r.DecodeString()) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -37062,150 +44790,129 @@ func (x *Secret) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3193 := &x.ObjectMeta - yyv3193.CodecDecodeSelf(d) - } - case "data": - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv3194 := &x.Data - yym3195 := z.DecBinary() - _ = yym3195 - if false { - } else { - h.decMapstringSliceuint8((*map[string][]uint8)(yyv3194), d) - } - } - case "type": - if r.TryDecodeAsNil() { - x.Type = "" - } else { - x.Type = SecretType(r.DecodeString()) - } default: - z.DecStructFieldNotFound(-1, yys3190) - } // end switch yys3190 - } // end for yyj3190 - if !yyhl3190 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Secret) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3197 int - var yyb3197 bool - var yyhl3197 bool = l >= 0 - yyj3197++ - if yyhl3197 { - yyb3197 = yyj3197 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3197 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3197 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj3197++ - if yyhl3197 { - yyb3197 = yyj3197 > l - } else { - yyb3197 = r.CheckBreak() - } - if yyb3197 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj3197++ - if yyhl3197 { - yyb3197 = yyj3197 > l - } else { - yyb3197 = r.CheckBreak() - } - if yyb3197 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv3200 := &x.ObjectMeta - yyv3200.CodecDecodeSelf(d) + yyv11 := &x.ObjectMeta + yyv11.CodecDecodeSelf(d) } - yyj3197++ - if yyhl3197 { - yyb3197 = yyj3197 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3197 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3197 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Data = nil } else { - yyv3201 := &x.Data - yym3202 := z.DecBinary() - _ = yym3202 + yyv12 := &x.Data + yym13 := z.DecBinary() + _ = yym13 if false { } else { - h.decMapstringSliceuint8((*map[string][]uint8)(yyv3201), d) + h.decMapstringSliceuint8((*map[string][]uint8)(yyv12), d) } } - yyj3197++ - if yyhl3197 { - yyb3197 = yyj3197 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3197 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3197 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = SecretType(r.DecodeString()) } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj3197++ - if yyhl3197 { - yyb3197 = yyj3197 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3197 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3197 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3197-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x SecretType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym3204 := z.EncBinary() - _ = yym3204 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -37217,8 +44924,8 @@ func (x *SecretType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3205 := z.DecBinary() - _ = yym3205 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -37233,126 +44940,142 @@ func (x *SecretList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3206 := z.EncBinary() - _ = yym3206 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3207 := !z.EncBinary() - yy2arr3207 := z.EncBasicHandle().StructToArray - var yyq3207 [4]bool - _, _, _ = yysep3207, yyq3207, yy2arr3207 - const yyr3207 bool = false - yyq3207[0] = x.Kind != "" - yyq3207[1] = x.APIVersion != "" - yyq3207[2] = true - if yyr3207 || yy2arr3207 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3207 int = 1 - for _, b := range yyq3207 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3207++ + yynn2++ } } - r.EncodeMapStart(yynn3207) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3207 || yy2arr3207 { - if yyq3207[0] { - yym3209 := z.EncBinary() - _ = yym3209 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3207[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3210 := z.EncBinary() - _ = yym3210 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3207 || yy2arr3207 { - if yyq3207[1] { - yym3212 := z.EncBinary() - _ = yym3212 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3207[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3213 := z.EncBinary() - _ = yym3213 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3207 || yy2arr3207 { - if yyq3207[2] { - yy3215 := &x.ListMeta - yym3216 := z.EncBinary() - _ = yym3216 - if false { - } else if z.HasExtensions() && z.EncExt(yy3215) { - } else { - z.EncFallback(yy3215) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq3207[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3217 := &x.ListMeta - yym3218 := z.EncBinary() - _ = yym3218 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy3217) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy3217) + z.EncFallback(yy6) } } } - if yyr3207 || yy2arr3207 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym3220 := z.EncBinary() - _ = yym3220 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceSecret(([]Secret)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3221 := z.EncBinary() - _ = yym3221 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceSecret(([]Secret)(x.Items), e) } } } - if yysep3207 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -37362,24 +45085,25 @@ func (x *SecretList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3222 := z.DecBinary() - _ = yym3222 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3223 := r.ReadMapStart() - if yyl3223 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3223, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3223 := r.ReadArrayStart() - if yyl3223 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3223, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -37391,12 +45115,12 @@ func (x *SecretList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3224Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3224Slc - var yyhl3224 bool = l >= 0 - for yyj3224 := 0; ; yyj3224++ { - if yyhl3224 { - if yyj3224 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -37404,9 +45128,36 @@ func (x *SecretList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3224Slc = r.DecodeBytes(yys3224Slc, true, true) - yys3224 := string(yys3224Slc) - switch yys3224 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceSecret((*[]Secret)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -37419,141 +45170,797 @@ func (x *SecretList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3227 := &x.ListMeta - yym3228 := z.DecBinary() - _ = yym3228 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3227) { - } else { - z.DecFallback(yyv3227, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3229 := &x.Items - yym3230 := z.DecBinary() - _ = yym3230 - if false { - } else { - h.decSliceSecret((*[]Secret)(yyv3229), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3224) - } // end switch yys3224 - } // end for yyj3224 - if !yyhl3224 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SecretList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3231 int - var yyb3231 bool - var yyhl3231 bool = l >= 0 - yyj3231++ - if yyhl3231 { - yyb3231 = yyj3231 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3231 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3231 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceSecret((*[]Secret)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3231++ - if yyhl3231 { - yyb3231 = yyj3231 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3231 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3231 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3231++ - if yyhl3231 { - yyb3231 = yyj3231 > l - } else { - yyb3231 = r.CheckBreak() + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - if yyb3231 { - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ConfigMap) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Data) != 0 + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Data == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + z.F.EncMapStringStringV(x.Data, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("data")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Data == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + z.F.EncMapStringStringV(x.Data, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ConfigMap) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ConfigMap) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "data": + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv5 := &x.Data + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + z.F.DecMapStringStringX(yyv5, false, d) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ConfigMap) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv11 := &x.Data + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + z.F.DecMapStringStringX(yyv11, false, d) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ConfigMapList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Items) != 0 + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.EncExt(yy4) { + } else { + z.EncFallback(yy4) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(yy6) { + } else { + z.EncFallback(yy6) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Items == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + h.encSliceConfigMap(([]ConfigMap)(x.Items), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSliceConfigMap(([]ConfigMap)(x.Items), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ConfigMapList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ConfigMapList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceConfigMap((*[]ConfigMap)(yyv6), d) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ConfigMapList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ListMeta = pkg2_unversioned.ListMeta{} } else { - yyv3234 := &x.ListMeta - yym3235 := z.DecBinary() - _ = yym3235 + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 if false { - } else if z.HasExtensions() && z.DecExt(yyv3234) { + } else if z.HasExtensions() && z.DecExt(yyv11) { } else { - z.DecFallback(yyv3234, false) + z.DecFallback(yyv11, false) } } - yyj3231++ - if yyhl3231 { - yyb3231 = yyj3231 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3231 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3231 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Items = nil } else { - yyv3236 := &x.Items - yym3237 := z.DecBinary() - _ = yym3237 + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceSecret((*[]Secret)(yyv3236), d) + h.decSliceConfigMap((*[]ConfigMap)(yyv13), d) } } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj3231++ - if yyhl3231 { - yyb3231 = yyj3231 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3231 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3231 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3231-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x ComponentConditionType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym3238 := z.EncBinary() - _ = yym3238 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -37565,8 +45972,8 @@ func (x *ComponentConditionType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3239 := z.DecBinary() - _ = yym3239 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -37581,45 +45988,54 @@ func (x *ComponentCondition) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3240 := z.EncBinary() - _ = yym3240 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3241 := !z.EncBinary() - yy2arr3241 := z.EncBasicHandle().StructToArray - var yyq3241 [4]bool - _, _, _ = yysep3241, yyq3241, yy2arr3241 - const yyr3241 bool = false - yyq3241[2] = x.Message != "" - yyq3241[3] = x.Error != "" - if yyr3241 || yy2arr3241 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Message != "" + yyq2[3] = x.Error != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3241 int = 2 - for _, b := range yyq3241 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn3241++ + yynn2++ } } - r.EncodeMapStart(yynn3241) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3241 || yy2arr3241 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr3241 || yy2arr3241 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Status.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Status.CodecEncodeSelf(e) } - if yyr3241 || yy2arr3241 { - if yyq3241[2] { - yym3245 := z.EncBinary() - _ = yym3245 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -37628,20 +46044,23 @@ func (x *ComponentCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3241[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym3246 := z.EncBinary() - _ = yym3246 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yyr3241 || yy2arr3241 { - if yyq3241[3] { - yym3248 := z.EncBinary() - _ = yym3248 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Error)) @@ -37650,18 +46069,22 @@ func (x *ComponentCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3241[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("error")) - yym3249 := z.EncBinary() - _ = yym3249 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Error)) } } } - if yysep3241 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -37671,24 +46094,25 @@ func (x *ComponentCondition) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3250 := z.DecBinary() - _ = yym3250 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3251 := r.ReadMapStart() - if yyl3251 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3251, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3251 := r.ReadArrayStart() - if yyl3251 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3251, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -37700,12 +46124,12 @@ func (x *ComponentCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3252Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3252Slc - var yyhl3252 bool = l >= 0 - for yyj3252 := 0; ; yyj3252++ { - if yyhl3252 { - if yyj3252 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -37713,9 +46137,11 @@ func (x *ComponentCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys3252Slc = r.DecodeBytes(yys3252Slc, true, true) - yys3252 := string(yys3252Slc) - switch yys3252 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -37741,94 +46167,97 @@ func (x *ComponentCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.Error = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys3252) - } // end switch yys3252 - } // end for yyj3252 - if !yyhl3252 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ComponentCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3257 int - var yyb3257 bool - var yyhl3257 bool = l >= 0 - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3257 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3257 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = ComponentConditionType(r.DecodeString()) } - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3257 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3257 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Status = "" } else { x.Status = ConditionStatus(r.DecodeString()) } - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3257 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3257 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3257 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3257 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Error = "" } else { x.Error = string(r.DecodeString()) } for { - yyj3257++ - if yyhl3257 { - yyb3257 = yyj3257 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3257 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3257 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj3257-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ComponentStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -37838,96 +46267,58 @@ func (x *ComponentStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3262 := z.EncBinary() - _ = yym3262 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3263 := !z.EncBinary() - yy2arr3263 := z.EncBasicHandle().StructToArray - var yyq3263 [4]bool - _, _, _ = yysep3263, yyq3263, yy2arr3263 - const yyr3263 bool = false - yyq3263[0] = x.Kind != "" - yyq3263[1] = x.APIVersion != "" - yyq3263[2] = true - yyq3263[3] = len(x.Conditions) != 0 - if yyr3263 || yy2arr3263 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Conditions) != 0 + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3263 int = 0 - for _, b := range yyq3263 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3263++ + yynn2++ } } - r.EncodeMapStart(yynn3263) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3263 || yy2arr3263 { - if yyq3263[0] { - yym3265 := z.EncBinary() - _ = yym3265 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3263[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3266 := z.EncBinary() - _ = yym3266 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3263 || yy2arr3263 { - if yyq3263[1] { - yym3268 := z.EncBinary() - _ = yym3268 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3263[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3269 := z.EncBinary() - _ = yym3269 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3263 || yy2arr3263 { - if yyq3263[2] { - yy3271 := &x.ObjectMeta - yy3271.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3263[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3272 := &x.ObjectMeta - yy3272.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3263 || yy2arr3263 { - if yyq3263[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Conditions == nil { r.EncodeNil() } else { - yym3274 := z.EncBinary() - _ = yym3274 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceComponentCondition(([]ComponentCondition)(x.Conditions), e) @@ -37937,13 +46328,15 @@ func (x *ComponentStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3263[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("conditions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Conditions == nil { r.EncodeNil() } else { - yym3275 := z.EncBinary() - _ = yym3275 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceComponentCondition(([]ComponentCondition)(x.Conditions), e) @@ -37951,8 +46344,60 @@ func (x *ComponentStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep3263 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -37962,24 +46407,25 @@ func (x *ComponentStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3276 := z.DecBinary() - _ = yym3276 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3277 := r.ReadMapStart() - if yyl3277 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3277, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3277 := r.ReadArrayStart() - if yyl3277 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3277, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -37991,12 +46437,12 @@ func (x *ComponentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3278Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3278Slc - var yyhl3278 bool = l >= 0 - for yyj3278 := 0; ; yyj3278++ { - if yyhl3278 { - if yyj3278 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -38004,9 +46450,30 @@ func (x *ComponentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3278Slc = r.DecodeBytes(yys3278Slc, true, true) - yys3278 := string(yys3278Slc) - switch yys3278 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "conditions": + if r.TryDecodeAsNil() { + x.Conditions = nil + } else { + yyv5 := &x.Conditions + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceComponentCondition((*[]ComponentCondition)(yyv5), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -38019,121 +46486,105 @@ func (x *ComponentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3281 := &x.ObjectMeta - yyv3281.CodecDecodeSelf(d) - } - case "conditions": - if r.TryDecodeAsNil() { - x.Conditions = nil - } else { - yyv3282 := &x.Conditions - yym3283 := z.DecBinary() - _ = yym3283 - if false { - } else { - h.decSliceComponentCondition((*[]ComponentCondition)(yyv3282), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3278) - } // end switch yys3278 - } // end for yyj3278 - if !yyhl3278 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ComponentStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3284 int - var yyb3284 bool - var yyhl3284 bool = l >= 0 - yyj3284++ - if yyhl3284 { - yyb3284 = yyj3284 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3284 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3284 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Conditions = nil + } else { + yyv11 := &x.Conditions + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + h.decSliceComponentCondition((*[]ComponentCondition)(yyv11), d) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3284++ - if yyhl3284 { - yyb3284 = yyj3284 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3284 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3284 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3284++ - if yyhl3284 { - yyb3284 = yyj3284 > l - } else { - yyb3284 = r.CheckBreak() - } - if yyb3284 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3287 := &x.ObjectMeta - yyv3287.CodecDecodeSelf(d) - } - yyj3284++ - if yyhl3284 { - yyb3284 = yyj3284 > l - } else { - yyb3284 = r.CheckBreak() - } - if yyb3284 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Conditions = nil - } else { - yyv3288 := &x.Conditions - yym3289 := z.DecBinary() - _ = yym3289 - if false { - } else { - h.decSliceComponentCondition((*[]ComponentCondition)(yyv3288), d) - } - } for { - yyj3284++ - if yyhl3284 { - yyb3284 = yyj3284 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb3284 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb3284 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj3284-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ComponentStatusList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -38143,126 +46594,142 @@ func (x *ComponentStatusList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3290 := z.EncBinary() - _ = yym3290 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3291 := !z.EncBinary() - yy2arr3291 := z.EncBasicHandle().StructToArray - var yyq3291 [4]bool - _, _, _ = yysep3291, yyq3291, yy2arr3291 - const yyr3291 bool = false - yyq3291[0] = x.Kind != "" - yyq3291[1] = x.APIVersion != "" - yyq3291[2] = true - if yyr3291 || yy2arr3291 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3291 int = 1 - for _, b := range yyq3291 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn3291++ + yynn2++ } } - r.EncodeMapStart(yynn3291) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3291 || yy2arr3291 { - if yyq3291[0] { - yym3293 := z.EncBinary() - _ = yym3293 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3291[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3294 := z.EncBinary() - _ = yym3294 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3291 || yy2arr3291 { - if yyq3291[1] { - yym3296 := z.EncBinary() - _ = yym3296 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3291[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3297 := z.EncBinary() - _ = yym3297 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3291 || yy2arr3291 { - if yyq3291[2] { - yy3299 := &x.ListMeta - yym3300 := z.EncBinary() - _ = yym3300 - if false { - } else if z.HasExtensions() && z.EncExt(yy3299) { - } else { - z.EncFallback(yy3299) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq3291[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3301 := &x.ListMeta - yym3302 := z.EncBinary() - _ = yym3302 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy3301) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy3301) + z.EncFallback(yy6) } } } - if yyr3291 || yy2arr3291 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym3304 := z.EncBinary() - _ = yym3304 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceComponentStatus(([]ComponentStatus)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3305 := z.EncBinary() - _ = yym3305 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceComponentStatus(([]ComponentStatus)(x.Items), e) } } } - if yysep3291 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -38272,24 +46739,25 @@ func (x *ComponentStatusList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3306 := z.DecBinary() - _ = yym3306 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3307 := r.ReadMapStart() - if yyl3307 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3307, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3307 := r.ReadArrayStart() - if yyl3307 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3307, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -38301,12 +46769,12 @@ func (x *ComponentStatusList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3308Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3308Slc - var yyhl3308 bool = l >= 0 - for yyj3308 := 0; ; yyj3308++ { - if yyhl3308 { - if yyj3308 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -38314,9 +46782,36 @@ func (x *ComponentStatusList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder break } } - yys3308Slc = r.DecodeBytes(yys3308Slc, true, true) - yys3308 := string(yys3308Slc) - switch yys3308 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceComponentStatus((*[]ComponentStatus)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -38329,133 +46824,111 @@ func (x *ComponentStatusList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3311 := &x.ListMeta - yym3312 := z.DecBinary() - _ = yym3312 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3311) { - } else { - z.DecFallback(yyv3311, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3313 := &x.Items - yym3314 := z.DecBinary() - _ = yym3314 - if false { - } else { - h.decSliceComponentStatus((*[]ComponentStatus)(yyv3313), d) - } - } default: - z.DecStructFieldNotFound(-1, yys3308) - } // end switch yys3308 - } // end for yyj3308 - if !yyhl3308 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ComponentStatusList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3315 int - var yyb3315 bool - var yyhl3315 bool = l >= 0 - yyj3315++ - if yyhl3315 { - yyb3315 = yyj3315 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3315 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3315 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg2_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceComponentStatus((*[]ComponentStatus)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj3315++ - if yyhl3315 { - yyb3315 = yyj3315 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3315 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3315 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj3315++ - if yyhl3315 { - yyb3315 = yyj3315 > l - } else { - yyb3315 = r.CheckBreak() - } - if yyb3315 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg2_unversioned.ListMeta{} - } else { - yyv3318 := &x.ListMeta - yym3319 := z.DecBinary() - _ = yym3319 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3318) { - } else { - z.DecFallback(yyv3318, false) - } - } - yyj3315++ - if yyhl3315 { - yyb3315 = yyj3315 > l - } else { - yyb3315 = r.CheckBreak() - } - if yyb3315 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv3320 := &x.Items - yym3321 := z.DecBinary() - _ = yym3321 - if false { - } else { - h.decSliceComponentStatus((*[]ComponentStatus)(yyv3320), d) - } - } for { - yyj3315++ - if yyhl3315 { - yyb3315 = yyj3315 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3315 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3315 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3315-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DownwardAPIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -38465,35 +46938,38 @@ func (x *DownwardAPIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3322 := z.EncBinary() - _ = yym3322 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3323 := !z.EncBinary() - yy2arr3323 := z.EncBasicHandle().StructToArray - var yyq3323 [1]bool - _, _, _ = yysep3323, yyq3323, yy2arr3323 - const yyr3323 bool = false - yyq3323[0] = len(x.Items) != 0 - if yyr3323 || yy2arr3323 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Items) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn3323 int = 0 - for _, b := range yyq3323 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3323++ + yynn2++ } } - r.EncodeMapStart(yynn3323) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3323 || yy2arr3323 { - if yyq3323[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Items == nil { r.EncodeNil() } else { - yym3325 := z.EncBinary() - _ = yym3325 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceDownwardAPIVolumeFile(([]DownwardAPIVolumeFile)(x.Items), e) @@ -38503,13 +46979,15 @@ func (x *DownwardAPIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3323[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym3326 := z.EncBinary() - _ = yym3326 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceDownwardAPIVolumeFile(([]DownwardAPIVolumeFile)(x.Items), e) @@ -38517,8 +46995,10 @@ func (x *DownwardAPIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep3323 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -38528,24 +47008,25 @@ func (x *DownwardAPIVolumeSource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3327 := z.DecBinary() - _ = yym3327 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3328 := r.ReadMapStart() - if yyl3328 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3328, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3328 := r.ReadArrayStart() - if yyl3328 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3328, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -38557,12 +47038,12 @@ func (x *DownwardAPIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Dec var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3329Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3329Slc - var yyhl3329 bool = l >= 0 - for yyj3329 := 0; ; yyj3329++ { - if yyhl3329 { - if yyj3329 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -38570,71 +47051,73 @@ func (x *DownwardAPIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Dec break } } - yys3329Slc = r.DecodeBytes(yys3329Slc, true, true) - yys3329 := string(yys3329Slc) - switch yys3329 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "items": if r.TryDecodeAsNil() { x.Items = nil } else { - yyv3330 := &x.Items - yym3331 := z.DecBinary() - _ = yym3331 + yyv4 := &x.Items + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceDownwardAPIVolumeFile((*[]DownwardAPIVolumeFile)(yyv3330), d) + h.decSliceDownwardAPIVolumeFile((*[]DownwardAPIVolumeFile)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys3329) - } // end switch yys3329 - } // end for yyj3329 - if !yyhl3329 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DownwardAPIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3332 int - var yyb3332 bool - var yyhl3332 bool = l >= 0 - yyj3332++ - if yyhl3332 { - yyb3332 = yyj3332 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3332 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3332 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Items = nil } else { - yyv3333 := &x.Items - yym3334 := z.DecBinary() - _ = yym3334 + yyv7 := &x.Items + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceDownwardAPIVolumeFile((*[]DownwardAPIVolumeFile)(yyv3333), d) + h.decSliceDownwardAPIVolumeFile((*[]DownwardAPIVolumeFile)(yyv7), d) } } for { - yyj3332++ - if yyhl3332 { - yyb3332 = yyj3332 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3332 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3332 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj3332-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DownwardAPIVolumeFile) CodecEncodeSelf(e *codec1978.Encoder) { @@ -38644,53 +47127,63 @@ func (x *DownwardAPIVolumeFile) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3335 := z.EncBinary() - _ = yym3335 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3336 := !z.EncBinary() - yy2arr3336 := z.EncBasicHandle().StructToArray - var yyq3336 [2]bool - _, _, _ = yysep3336, yyq3336, yy2arr3336 - const yyr3336 bool = false - if yyr3336 || yy2arr3336 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn3336 int = 2 - for _, b := range yyq3336 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn3336++ + yynn2++ } } - r.EncodeMapStart(yynn3336) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3336 || yy2arr3336 { - yym3338 := z.EncBinary() - _ = yym3338 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym3339 := z.EncBinary() - _ = yym3339 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } - if yyr3336 || yy2arr3336 { - yy3341 := &x.FieldRef - yy3341.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.FieldRef + yy7.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("fieldRef")) - yy3342 := &x.FieldRef - yy3342.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.FieldRef + yy9.CodecEncodeSelf(e) } - if yysep3336 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -38700,24 +47193,25 @@ func (x *DownwardAPIVolumeFile) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3343 := z.DecBinary() - _ = yym3343 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3344 := r.ReadMapStart() - if yyl3344 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3344, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3344 := r.ReadArrayStart() - if yyl3344 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3344, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -38729,12 +47223,12 @@ func (x *DownwardAPIVolumeFile) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3345Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3345Slc - var yyhl3345 bool = l >= 0 - for yyj3345 := 0; ; yyj3345++ { - if yyhl3345 { - if yyj3345 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -38742,9 +47236,11 @@ func (x *DownwardAPIVolumeFile) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys3345Slc = r.DecodeBytes(yys3345Slc, true, true) - yys3345 := string(yys3345Slc) - switch yys3345 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "path": if r.TryDecodeAsNil() { x.Path = "" @@ -38755,69 +47251,70 @@ func (x *DownwardAPIVolumeFile) codecDecodeSelfFromMap(l int, d *codec1978.Decod if r.TryDecodeAsNil() { x.FieldRef = ObjectFieldSelector{} } else { - yyv3347 := &x.FieldRef - yyv3347.CodecDecodeSelf(d) + yyv5 := &x.FieldRef + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys3345) - } // end switch yys3345 - } // end for yyj3345 - if !yyhl3345 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DownwardAPIVolumeFile) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3348 int - var yyb3348 bool - var yyhl3348 bool = l >= 0 - yyj3348++ - if yyhl3348 { - yyb3348 = yyj3348 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3348 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3348 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj3348++ - if yyhl3348 { - yyb3348 = yyj3348 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3348 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3348 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.FieldRef = ObjectFieldSelector{} } else { - yyv3350 := &x.FieldRef - yyv3350.CodecDecodeSelf(d) + yyv8 := &x.FieldRef + yyv8.CodecDecodeSelf(d) } for { - yyj3348++ - if yyhl3348 { - yyb3348 = yyj3348 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb3348 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb3348 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj3348-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { @@ -38827,34 +47324,38 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3351 := z.EncBinary() - _ = yym3351 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3352 := !z.EncBinary() - yy2arr3352 := z.EncBasicHandle().StructToArray - var yyq3352 [5]bool - _, _, _ = yysep3352, yyq3352, yy2arr3352 - const yyr3352 bool = false - yyq3352[0] = x.Capabilities != nil - yyq3352[1] = x.Privileged != nil - yyq3352[2] = x.SELinuxOptions != nil - yyq3352[3] = x.RunAsUser != nil - yyq3352[4] = x.RunAsNonRoot != nil - if yyr3352 || yy2arr3352 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Capabilities != nil + yyq2[1] = x.Privileged != nil + yyq2[2] = x.SELinuxOptions != nil + yyq2[3] = x.RunAsUser != nil + yyq2[4] = x.RunAsNonRoot != nil + yyq2[5] = x.ReadOnlyRootFilesystem != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(6) } else { - var yynn3352 int = 0 - for _, b := range yyq3352 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3352++ + yynn2++ } } - r.EncodeMapStart(yynn3352) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3352 || yy2arr3352 { - if yyq3352[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Capabilities == nil { r.EncodeNil() } else { @@ -38864,8 +47365,10 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3352[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("capabilities")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Capabilities == nil { r.EncodeNil() } else { @@ -38873,40 +47376,44 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3352 || yy2arr3352 { - if yyq3352[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Privileged == nil { r.EncodeNil() } else { - yy3355 := *x.Privileged - yym3356 := z.EncBinary() - _ = yym3356 + yy7 := *x.Privileged + yym8 := z.EncBinary() + _ = yym8 if false { } else { - r.EncodeBool(bool(yy3355)) + r.EncodeBool(bool(yy7)) } } } else { r.EncodeNil() } } else { - if yyq3352[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("privileged")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Privileged == nil { r.EncodeNil() } else { - yy3357 := *x.Privileged - yym3358 := z.EncBinary() - _ = yym3358 + yy9 := *x.Privileged + yym10 := z.EncBinary() + _ = yym10 if false { } else { - r.EncodeBool(bool(yy3357)) + r.EncodeBool(bool(yy9)) } } } } - if yyr3352 || yy2arr3352 { - if yyq3352[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.SELinuxOptions == nil { r.EncodeNil() } else { @@ -38916,8 +47423,10 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq3352[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("seLinuxOptions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.SELinuxOptions == nil { r.EncodeNil() } else { @@ -38925,72 +47434,115 @@ func (x *SecurityContext) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr3352 || yy2arr3352 { - if yyq3352[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.RunAsUser == nil { r.EncodeNil() } else { - yy3361 := *x.RunAsUser - yym3362 := z.EncBinary() - _ = yym3362 + yy15 := *x.RunAsUser + yym16 := z.EncBinary() + _ = yym16 if false { } else { - r.EncodeInt(int64(yy3361)) + r.EncodeInt(int64(yy15)) } } } else { r.EncodeNil() } } else { - if yyq3352[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("runAsUser")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RunAsUser == nil { r.EncodeNil() } else { - yy3363 := *x.RunAsUser - yym3364 := z.EncBinary() - _ = yym3364 + yy17 := *x.RunAsUser + yym18 := z.EncBinary() + _ = yym18 if false { } else { - r.EncodeInt(int64(yy3363)) + r.EncodeInt(int64(yy17)) } } } } - if yyr3352 || yy2arr3352 { - if yyq3352[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.RunAsNonRoot == nil { r.EncodeNil() } else { - yy3366 := *x.RunAsNonRoot - yym3367 := z.EncBinary() - _ = yym3367 + yy20 := *x.RunAsNonRoot + yym21 := z.EncBinary() + _ = yym21 if false { } else { - r.EncodeBool(bool(yy3366)) + r.EncodeBool(bool(yy20)) } } } else { r.EncodeNil() } } else { - if yyq3352[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("runAsNonRoot")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RunAsNonRoot == nil { r.EncodeNil() } else { - yy3368 := *x.RunAsNonRoot - yym3369 := z.EncBinary() - _ = yym3369 + yy22 := *x.RunAsNonRoot + yym23 := z.EncBinary() + _ = yym23 if false { } else { - r.EncodeBool(bool(yy3368)) + r.EncodeBool(bool(yy22)) } } } } - if yysep3352 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + if x.ReadOnlyRootFilesystem == nil { + r.EncodeNil() + } else { + yy25 := *x.ReadOnlyRootFilesystem + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeBool(bool(yy25)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("readOnlyRootFilesystem")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ReadOnlyRootFilesystem == nil { + r.EncodeNil() + } else { + yy27 := *x.ReadOnlyRootFilesystem + yym28 := z.EncBinary() + _ = yym28 + if false { + } else { + r.EncodeBool(bool(yy27)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -39000,24 +47552,25 @@ func (x *SecurityContext) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3370 := z.DecBinary() - _ = yym3370 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3371 := r.ReadMapStart() - if yyl3371 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3371, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3371 := r.ReadArrayStart() - if yyl3371 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3371, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -39029,12 +47582,12 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3372Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3372Slc - var yyhl3372 bool = l >= 0 - for yyj3372 := 0; ; yyj3372++ { - if yyhl3372 { - if yyj3372 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -39042,9 +47595,11 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3372Slc = r.DecodeBytes(yys3372Slc, true, true) - yys3372 := string(yys3372Slc) - switch yys3372 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "capabilities": if r.TryDecodeAsNil() { if x.Capabilities != nil { @@ -39065,8 +47620,8 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.Privileged == nil { x.Privileged = new(bool) } - yym3375 := z.DecBinary() - _ = yym3375 + yym6 := z.DecBinary() + _ = yym6 if false { } else { *((*bool)(x.Privileged)) = r.DecodeBool() @@ -39092,8 +47647,8 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.RunAsUser == nil { x.RunAsUser = new(int64) } - yym3378 := z.DecBinary() - _ = yym3378 + yym9 := z.DecBinary() + _ = yym9 if false { } else { *((*int64)(x.RunAsUser)) = int64(r.DecodeInt(64)) @@ -39108,39 +47663,54 @@ func (x *SecurityContext) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.RunAsNonRoot == nil { x.RunAsNonRoot = new(bool) } - yym3380 := z.DecBinary() - _ = yym3380 + yym11 := z.DecBinary() + _ = yym11 if false { } else { *((*bool)(x.RunAsNonRoot)) = r.DecodeBool() } } + case "readOnlyRootFilesystem": + if r.TryDecodeAsNil() { + if x.ReadOnlyRootFilesystem != nil { + x.ReadOnlyRootFilesystem = nil + } + } else { + if x.ReadOnlyRootFilesystem == nil { + x.ReadOnlyRootFilesystem = new(bool) + } + yym13 := z.DecBinary() + _ = yym13 + if false { + } else { + *((*bool)(x.ReadOnlyRootFilesystem)) = r.DecodeBool() + } + } default: - z.DecStructFieldNotFound(-1, yys3372) - } // end switch yys3372 - } // end for yyj3372 - if !yyhl3372 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3381 int - var yyb3381 bool - var yyhl3381 bool = l >= 0 - yyj3381++ - if yyhl3381 { - yyb3381 = yyj3381 > l + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3381 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3381 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Capabilities != nil { x.Capabilities = nil @@ -39151,16 +47721,17 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) } x.Capabilities.CodecDecodeSelf(d) } - yyj3381++ - if yyhl3381 { - yyb3381 = yyj3381 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3381 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3381 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Privileged != nil { x.Privileged = nil @@ -39169,23 +47740,24 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) if x.Privileged == nil { x.Privileged = new(bool) } - yym3384 := z.DecBinary() - _ = yym3384 + yym17 := z.DecBinary() + _ = yym17 if false { } else { *((*bool)(x.Privileged)) = r.DecodeBool() } } - yyj3381++ - if yyhl3381 { - yyb3381 = yyj3381 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3381 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3381 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.SELinuxOptions != nil { x.SELinuxOptions = nil @@ -39196,16 +47768,17 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) } x.SELinuxOptions.CodecDecodeSelf(d) } - yyj3381++ - if yyhl3381 { - yyb3381 = yyj3381 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3381 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3381 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RunAsUser != nil { x.RunAsUser = nil @@ -39214,23 +47787,24 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) if x.RunAsUser == nil { x.RunAsUser = new(int64) } - yym3387 := z.DecBinary() - _ = yym3387 + yym20 := z.DecBinary() + _ = yym20 if false { } else { *((*int64)(x.RunAsUser)) = int64(r.DecodeInt(64)) } } - yyj3381++ - if yyhl3381 { - yyb3381 = yyj3381 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb3381 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb3381 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RunAsNonRoot != nil { x.RunAsNonRoot = nil @@ -39239,26 +47813,53 @@ func (x *SecurityContext) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) if x.RunAsNonRoot == nil { x.RunAsNonRoot = new(bool) } - yym3389 := z.DecBinary() - _ = yym3389 + yym22 := z.DecBinary() + _ = yym22 if false { } else { *((*bool)(x.RunAsNonRoot)) = r.DecodeBool() } } - for { - yyj3381++ - if yyhl3381 { - yyb3381 = yyj3381 > l - } else { - yyb3381 = r.CheckBreak() + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ReadOnlyRootFilesystem != nil { + x.ReadOnlyRootFilesystem = nil } - if yyb3381 { + } else { + if x.ReadOnlyRootFilesystem == nil { + x.ReadOnlyRootFilesystem = new(bool) + } + yym24 := z.DecBinary() + _ = yym24 + if false { + } else { + *((*bool)(x.ReadOnlyRootFilesystem)) = r.DecodeBool() + } + } + for { + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { break } - z.DecStructFieldNotFound(yyj3381-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj14-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { @@ -39268,35 +47869,38 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3390 := z.EncBinary() - _ = yym3390 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3391 := !z.EncBinary() - yy2arr3391 := z.EncBasicHandle().StructToArray - var yyq3391 [4]bool - _, _, _ = yysep3391, yyq3391, yy2arr3391 - const yyr3391 bool = false - yyq3391[0] = x.User != "" - yyq3391[1] = x.Role != "" - yyq3391[2] = x.Type != "" - yyq3391[3] = x.Level != "" - if yyr3391 || yy2arr3391 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.User != "" + yyq2[1] = x.Role != "" + yyq2[2] = x.Type != "" + yyq2[3] = x.Level != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn3391 int = 0 - for _, b := range yyq3391 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn3391++ + yynn2++ } } - r.EncodeMapStart(yynn3391) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3391 || yy2arr3391 { - if yyq3391[0] { - yym3393 := z.EncBinary() - _ = yym3393 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.User)) @@ -39305,20 +47909,23 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3391[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("user")) - yym3394 := z.EncBinary() - _ = yym3394 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.User)) } } } - if yyr3391 || yy2arr3391 { - if yyq3391[1] { - yym3396 := z.EncBinary() - _ = yym3396 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Role)) @@ -39327,20 +47934,23 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3391[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("role")) - yym3397 := z.EncBinary() - _ = yym3397 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Role)) } } } - if yyr3391 || yy2arr3391 { - if yyq3391[2] { - yym3399 := z.EncBinary() - _ = yym3399 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Type)) @@ -39349,20 +47959,23 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3391[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) - yym3400 := z.EncBinary() - _ = yym3400 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Type)) } } } - if yyr3391 || yy2arr3391 { - if yyq3391[3] { - yym3402 := z.EncBinary() - _ = yym3402 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Level)) @@ -39371,18 +47984,22 @@ func (x *SELinuxOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq3391[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("level")) - yym3403 := z.EncBinary() - _ = yym3403 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Level)) } } } - if yysep3391 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -39392,24 +48009,25 @@ func (x *SELinuxOptions) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3404 := z.DecBinary() - _ = yym3404 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3405 := r.ReadMapStart() - if yyl3405 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3405, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3405 := r.ReadArrayStart() - if yyl3405 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3405, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -39421,12 +48039,12 @@ func (x *SELinuxOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3406Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3406Slc - var yyhl3406 bool = l >= 0 - for yyj3406 := 0; ; yyj3406++ { - if yyhl3406 { - if yyj3406 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -39434,9 +48052,11 @@ func (x *SELinuxOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3406Slc = r.DecodeBytes(yys3406Slc, true, true) - yys3406 := string(yys3406Slc) - switch yys3406 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "user": if r.TryDecodeAsNil() { x.User = "" @@ -39462,94 +48082,97 @@ func (x *SELinuxOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Level = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys3406) - } // end switch yys3406 - } // end for yyj3406 - if !yyhl3406 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SELinuxOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3411 int - var yyb3411 bool - var yyhl3411 bool = l >= 0 - yyj3411++ - if yyhl3411 { - yyb3411 = yyj3411 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3411 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3411 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.User = "" } else { x.User = string(r.DecodeString()) } - yyj3411++ - if yyhl3411 { - yyb3411 = yyj3411 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3411 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3411 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Role = "" } else { x.Role = string(r.DecodeString()) } - yyj3411++ - if yyhl3411 { - yyb3411 = yyj3411 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3411 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3411 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = string(r.DecodeString()) } - yyj3411++ - if yyhl3411 { - yyb3411 = yyj3411 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3411 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3411 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Level = "" } else { x.Level = string(r.DecodeString()) } for { - yyj3411++ - if yyhl3411 { - yyb3411 = yyj3411 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb3411 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb3411 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj3411-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *RangeAllocation) CodecEncodeSelf(e *codec1978.Encoder) { @@ -39559,130 +48182,149 @@ func (x *RangeAllocation) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym3416 := z.EncBinary() - _ = yym3416 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep3417 := !z.EncBinary() - yy2arr3417 := z.EncBasicHandle().StructToArray - var yyq3417 [5]bool - _, _, _ = yysep3417, yyq3417, yy2arr3417 - const yyr3417 bool = false - yyq3417[0] = x.Kind != "" - yyq3417[1] = x.APIVersion != "" - yyq3417[2] = true - if yyr3417 || yy2arr3417 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn3417 int = 2 - for _, b := range yyq3417 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn3417++ + yynn2++ } } - r.EncodeMapStart(yynn3417) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr3417 || yy2arr3417 { - if yyq3417[0] { - yym3419 := z.EncBinary() - _ = yym3419 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3417[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym3420 := z.EncBinary() - _ = yym3420 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr3417 || yy2arr3417 { - if yyq3417[1] { - yym3422 := z.EncBinary() - _ = yym3422 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq3417[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym3423 := z.EncBinary() - _ = yym3423 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr3417 || yy2arr3417 { - if yyq3417[2] { - yy3425 := &x.ObjectMeta - yy3425.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq3417[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy3426 := &x.ObjectMeta - yy3426.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr3417 || yy2arr3417 { - yym3428 := z.EncBinary() - _ = yym3428 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym9 := z.EncBinary() + _ = yym9 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Range)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("range")) - yym3429 := z.EncBinary() - _ = yym3429 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Range)) } } - if yyr3417 || yy2arr3417 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Data == nil { r.EncodeNil() } else { - yym3431 := z.EncBinary() - _ = yym3431 + yym12 := z.EncBinary() + _ = yym12 if false { } else { r.EncodeStringBytes(codecSelferC_RAW1234, []byte(x.Data)) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("data")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Data == nil { r.EncodeNil() } else { - yym3432 := z.EncBinary() - _ = yym3432 + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeStringBytes(codecSelferC_RAW1234, []byte(x.Data)) } } } - if yysep3417 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -39692,24 +48334,25 @@ func (x *RangeAllocation) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym3433 := z.DecBinary() - _ = yym3433 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl3434 := r.ReadMapStart() - if yyl3434 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl3434, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl3434 := r.ReadArrayStart() - if yyl3434 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl3434, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -39721,12 +48364,12 @@ func (x *RangeAllocation) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys3435Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3435Slc - var yyhl3435 bool = l >= 0 - for yyj3435 := 0; ; yyj3435++ { - if yyhl3435 { - if yyj3435 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -39734,9 +48377,36 @@ func (x *RangeAllocation) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys3435Slc = r.DecodeBytes(yys3435Slc, true, true) - yys3435 := string(yys3435Slc) - switch yys3435 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "range": + if r.TryDecodeAsNil() { + x.Range = "" + } else { + x.Range = string(r.DecodeString()) + } + case "data": + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv6 := &x.Data + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *yyv6 = r.DecodeBytes(*(*[]byte)(yyv6), false, false) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -39749,142 +48419,121 @@ func (x *RangeAllocation) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = ObjectMeta{} - } else { - yyv3438 := &x.ObjectMeta - yyv3438.CodecDecodeSelf(d) - } - case "range": - if r.TryDecodeAsNil() { - x.Range = "" - } else { - x.Range = string(r.DecodeString()) - } - case "data": - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv3440 := &x.Data - yym3441 := z.DecBinary() - _ = yym3441 - if false { - } else { - *yyv3440 = r.DecodeBytes(*(*[]byte)(yyv3440), false, false) - } - } default: - z.DecStructFieldNotFound(-1, yys3435) - } // end switch yys3435 - } // end for yyj3435 - if !yyhl3435 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *RangeAllocation) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj3442 int - var yyb3442 bool - var yyhl3442 bool = l >= 0 - yyj3442++ - if yyhl3442 { - yyb3442 = yyj3442 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3442 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3442 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj3442++ - if yyhl3442 { - yyb3442 = yyj3442 > l - } else { - yyb3442 = r.CheckBreak() - } - if yyb3442 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj3442++ - if yyhl3442 { - yyb3442 = yyj3442 > l - } else { - yyb3442 = r.CheckBreak() - } - if yyb3442 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = ObjectMeta{} } else { - yyv3445 := &x.ObjectMeta - yyv3445.CodecDecodeSelf(d) + yyv11 := &x.ObjectMeta + yyv11.CodecDecodeSelf(d) } - yyj3442++ - if yyhl3442 { - yyb3442 = yyj3442 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3442 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3442 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Range = "" } else { x.Range = string(r.DecodeString()) } - yyj3442++ - if yyhl3442 { - yyb3442 = yyj3442 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3442 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3442 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Data = nil } else { - yyv3447 := &x.Data - yym3448 := z.DecBinary() - _ = yym3448 + yyv13 := &x.Data + yym14 := z.DecBinary() + _ = yym14 if false { } else { - *yyv3447 = r.DecodeBytes(*(*[]byte)(yyv3447), false, false) + *yyv13 = r.DecodeBytes(*(*[]byte)(yyv13), false, false) } } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj3442++ - if yyhl3442 { - yyb3442 = yyj3442 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb3442 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb3442 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj3442-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) encSlicePersistentVolumeAccessMode(v []PersistentVolumeAccessMode, e *codec1978.Encoder) { @@ -39892,10 +48541,11 @@ func (x codecSelfer1234) encSlicePersistentVolumeAccessMode(v []PersistentVolume z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3449 := range v { - yyv3449.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yyv1.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePersistentVolumeAccessMode(v *[]PersistentVolumeAccessMode, d *codec1978.Decoder) { @@ -39903,77 +48553,78 @@ func (x codecSelfer1234) decSlicePersistentVolumeAccessMode(v *[]PersistentVolum z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3450 := *v - yyh3450, yyl3450 := z.DecSliceHelperStart() - - var yyrr3450, yyrl3450 int - var yyc3450, yyrt3450 bool - _, _, _ = yyc3450, yyrt3450, yyrl3450 - yyrr3450 = yyl3450 - - if yyv3450 == nil { - if yyrl3450, yyrt3450 = z.DecInferLen(yyl3450, z.DecBasicHandle().MaxInitLen, 16); yyrt3450 { - yyrr3450 = yyrl3450 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PersistentVolumeAccessMode{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3450 = make([]PersistentVolumeAccessMode, yyrl3450) - yyc3450 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3450 == 0 { - if len(yyv3450) != 0 { - yyv3450 = yyv3450[:0] - yyc3450 = true - } - } else if yyl3450 > 0 { - - if yyl3450 > cap(yyv3450) { - yyrl3450, yyrt3450 = z.DecInferLen(yyl3450, z.DecBasicHandle().MaxInitLen, 16) - - yyv23450 := yyv3450 - yyv3450 = make([]PersistentVolumeAccessMode, yyrl3450) - if len(yyv3450) > 0 { - copy(yyv3450, yyv23450[:cap(yyv23450)]) - } - yyc3450 = true - - yyrr3450 = len(yyv3450) - } else if yyl3450 != len(yyv3450) { - yyv3450 = yyv3450[:yyl3450] - yyc3450 = true - } - yyj3450 := 0 - for ; yyj3450 < yyrr3450; yyj3450++ { - if r.TryDecodeAsNil() { - yyv3450[yyj3450] = "" - } else { - yyv3450[yyj3450] = PersistentVolumeAccessMode(r.DecodeString()) - } - - } - if yyrt3450 { - for ; yyj3450 < yyl3450; yyj3450++ { - yyv3450 = append(yyv3450, "") - if r.TryDecodeAsNil() { - yyv3450[yyj3450] = "" + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] } else { - yyv3450[yyj3450] = PersistentVolumeAccessMode(r.DecodeString()) + yyv1 = make([]PersistentVolumeAccessMode, yyrl1) + } + } else { + yyv1 = make([]PersistentVolumeAccessMode, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = PersistentVolumeAccessMode(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = PersistentVolumeAccessMode(r.DecodeString()) } } } } else { - for yyj3450 := 0; !r.CheckBreak(); yyj3450++ { - if yyj3450 >= len(yyv3450) { - yyv3450 = append(yyv3450, "") // var yyz3450 PersistentVolumeAccessMode - yyc3450 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3450 < len(yyv3450) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 PersistentVolumeAccessMode + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3450[yyj3450] = "" + yyv1[yyj1] = "" } else { - yyv3450[yyj3450] = PersistentVolumeAccessMode(r.DecodeString()) + yyv1[yyj1] = PersistentVolumeAccessMode(r.DecodeString()) } } else { @@ -39981,12 +48632,18 @@ func (x codecSelfer1234) decSlicePersistentVolumeAccessMode(v *[]PersistentVolum } } - yyh3450.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PersistentVolumeAccessMode{} + yyc1 = true + } } - if yyc3450 { - *v = yyv3450 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePersistentVolume(v []PersistentVolume, e *codec1978.Encoder) { @@ -39994,11 +48651,12 @@ func (x codecSelfer1234) encSlicePersistentVolume(v []PersistentVolume, e *codec z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3454 := range v { - yy3455 := &yyv3454 - yy3455.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePersistentVolume(v *[]PersistentVolume, d *codec1978.Decoder) { @@ -40006,75 +48664,86 @@ func (x codecSelfer1234) decSlicePersistentVolume(v *[]PersistentVolume, d *code z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3456 := *v - yyh3456, yyl3456 := z.DecSliceHelperStart() - - var yyrr3456, yyrl3456 int - var yyc3456, yyrt3456 bool - _, _, _ = yyc3456, yyrt3456, yyrl3456 - yyrr3456 = yyl3456 - - if yyv3456 == nil { - if yyrl3456, yyrt3456 = z.DecInferLen(yyl3456, z.DecBasicHandle().MaxInitLen, 384); yyrt3456 { - yyrr3456 = yyrl3456 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PersistentVolume{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3456 = make([]PersistentVolume, yyrl3456) - yyc3456 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3456 == 0 { - if len(yyv3456) != 0 { - yyv3456 = yyv3456[:0] - yyc3456 = true - } - } else if yyl3456 > 0 { - - if yyl3456 > cap(yyv3456) { - yyrl3456, yyrt3456 = z.DecInferLen(yyl3456, z.DecBasicHandle().MaxInitLen, 384) - yyv3456 = make([]PersistentVolume, yyrl3456) - yyc3456 = true - - yyrr3456 = len(yyv3456) - } else if yyl3456 != len(yyv3456) { - yyv3456 = yyv3456[:yyl3456] - yyc3456 = true - } - yyj3456 := 0 - for ; yyj3456 < yyrr3456; yyj3456++ { - if r.TryDecodeAsNil() { - yyv3456[yyj3456] = PersistentVolume{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 400) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PersistentVolume, yyrl1) + } } else { - yyv3457 := &yyv3456[yyj3456] - yyv3457.CodecDecodeSelf(d) + yyv1 = make([]PersistentVolume, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PersistentVolume{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3456 { - for ; yyj3456 < yyl3456; yyj3456++ { - yyv3456 = append(yyv3456, PersistentVolume{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PersistentVolume{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3456[yyj3456] = PersistentVolume{} + yyv1[yyj1] = PersistentVolume{} } else { - yyv3458 := &yyv3456[yyj3456] - yyv3458.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3456 := 0; !r.CheckBreak(); yyj3456++ { - if yyj3456 >= len(yyv3456) { - yyv3456 = append(yyv3456, PersistentVolume{}) // var yyz3456 PersistentVolume - yyc3456 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3456 < len(yyv3456) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PersistentVolume{}) // var yyz1 PersistentVolume + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3456[yyj3456] = PersistentVolume{} + yyv1[yyj1] = PersistentVolume{} } else { - yyv3459 := &yyv3456[yyj3456] - yyv3459.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40082,12 +48751,18 @@ func (x codecSelfer1234) decSlicePersistentVolume(v *[]PersistentVolume, d *code } } - yyh3456.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PersistentVolume{} + yyc1 = true + } } - if yyc3456 { - *v = yyv3456 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePersistentVolumeClaim(v []PersistentVolumeClaim, e *codec1978.Encoder) { @@ -40095,11 +48770,12 @@ func (x codecSelfer1234) encSlicePersistentVolumeClaim(v []PersistentVolumeClaim z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3460 := range v { - yy3461 := &yyv3460 - yy3461.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePersistentVolumeClaim(v *[]PersistentVolumeClaim, d *codec1978.Decoder) { @@ -40107,75 +48783,86 @@ func (x codecSelfer1234) decSlicePersistentVolumeClaim(v *[]PersistentVolumeClai z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3462 := *v - yyh3462, yyl3462 := z.DecSliceHelperStart() - - var yyrr3462, yyrl3462 int - var yyc3462, yyrt3462 bool - _, _, _ = yyc3462, yyrt3462, yyrl3462 - yyrr3462 = yyl3462 - - if yyv3462 == nil { - if yyrl3462, yyrt3462 = z.DecInferLen(yyl3462, z.DecBasicHandle().MaxInitLen, 296); yyrt3462 { - yyrr3462 = yyrl3462 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PersistentVolumeClaim{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3462 = make([]PersistentVolumeClaim, yyrl3462) - yyc3462 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3462 == 0 { - if len(yyv3462) != 0 { - yyv3462 = yyv3462[:0] - yyc3462 = true - } - } else if yyl3462 > 0 { - - if yyl3462 > cap(yyv3462) { - yyrl3462, yyrt3462 = z.DecInferLen(yyl3462, z.DecBasicHandle().MaxInitLen, 296) - yyv3462 = make([]PersistentVolumeClaim, yyrl3462) - yyc3462 = true - - yyrr3462 = len(yyv3462) - } else if yyl3462 != len(yyv3462) { - yyv3462 = yyv3462[:yyl3462] - yyc3462 = true - } - yyj3462 := 0 - for ; yyj3462 < yyrr3462; yyj3462++ { - if r.TryDecodeAsNil() { - yyv3462[yyj3462] = PersistentVolumeClaim{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 296) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PersistentVolumeClaim, yyrl1) + } } else { - yyv3463 := &yyv3462[yyj3462] - yyv3463.CodecDecodeSelf(d) + yyv1 = make([]PersistentVolumeClaim, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PersistentVolumeClaim{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3462 { - for ; yyj3462 < yyl3462; yyj3462++ { - yyv3462 = append(yyv3462, PersistentVolumeClaim{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PersistentVolumeClaim{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3462[yyj3462] = PersistentVolumeClaim{} + yyv1[yyj1] = PersistentVolumeClaim{} } else { - yyv3464 := &yyv3462[yyj3462] - yyv3464.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3462 := 0; !r.CheckBreak(); yyj3462++ { - if yyj3462 >= len(yyv3462) { - yyv3462 = append(yyv3462, PersistentVolumeClaim{}) // var yyz3462 PersistentVolumeClaim - yyc3462 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3462 < len(yyv3462) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PersistentVolumeClaim{}) // var yyz1 PersistentVolumeClaim + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3462[yyj3462] = PersistentVolumeClaim{} + yyv1[yyj1] = PersistentVolumeClaim{} } else { - yyv3465 := &yyv3462[yyj3462] - yyv3465.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40183,12 +48870,256 @@ func (x codecSelfer1234) decSlicePersistentVolumeClaim(v *[]PersistentVolumeClai } } - yyh3462.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PersistentVolumeClaim{} + yyc1 = true + } } - if yyc3462 { - *v = yyv3462 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceKeyToPath(v []KeyToPath, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceKeyToPath(v *[]KeyToPath, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []KeyToPath{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]KeyToPath, yyrl1) + } + } else { + yyv1 = make([]KeyToPath, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = KeyToPath{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, KeyToPath{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = KeyToPath{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, KeyToPath{}) // var yyz1 KeyToPath + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = KeyToPath{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []KeyToPath{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceHTTPHeader(v []HTTPHeader, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceHTTPHeader(v *[]HTTPHeader, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []HTTPHeader{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]HTTPHeader, yyrl1) + } + } else { + yyv1 = make([]HTTPHeader, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HTTPHeader{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, HTTPHeader{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HTTPHeader{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, HTTPHeader{}) // var yyz1 HTTPHeader + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = HTTPHeader{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []HTTPHeader{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceCapability(v []Capability, e *codec1978.Encoder) { @@ -40196,10 +49127,11 @@ func (x codecSelfer1234) encSliceCapability(v []Capability, e *codec1978.Encoder z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3466 := range v { - yyv3466.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yyv1.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceCapability(v *[]Capability, d *codec1978.Decoder) { @@ -40207,77 +49139,78 @@ func (x codecSelfer1234) decSliceCapability(v *[]Capability, d *codec1978.Decode z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3467 := *v - yyh3467, yyl3467 := z.DecSliceHelperStart() - - var yyrr3467, yyrl3467 int - var yyc3467, yyrt3467 bool - _, _, _ = yyc3467, yyrt3467, yyrl3467 - yyrr3467 = yyl3467 - - if yyv3467 == nil { - if yyrl3467, yyrt3467 = z.DecInferLen(yyl3467, z.DecBasicHandle().MaxInitLen, 16); yyrt3467 { - yyrr3467 = yyrl3467 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Capability{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3467 = make([]Capability, yyrl3467) - yyc3467 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3467 == 0 { - if len(yyv3467) != 0 { - yyv3467 = yyv3467[:0] - yyc3467 = true - } - } else if yyl3467 > 0 { - - if yyl3467 > cap(yyv3467) { - yyrl3467, yyrt3467 = z.DecInferLen(yyl3467, z.DecBasicHandle().MaxInitLen, 16) - - yyv23467 := yyv3467 - yyv3467 = make([]Capability, yyrl3467) - if len(yyv3467) > 0 { - copy(yyv3467, yyv23467[:cap(yyv23467)]) - } - yyc3467 = true - - yyrr3467 = len(yyv3467) - } else if yyl3467 != len(yyv3467) { - yyv3467 = yyv3467[:yyl3467] - yyc3467 = true - } - yyj3467 := 0 - for ; yyj3467 < yyrr3467; yyj3467++ { - if r.TryDecodeAsNil() { - yyv3467[yyj3467] = "" - } else { - yyv3467[yyj3467] = Capability(r.DecodeString()) - } - - } - if yyrt3467 { - for ; yyj3467 < yyl3467; yyj3467++ { - yyv3467 = append(yyv3467, "") - if r.TryDecodeAsNil() { - yyv3467[yyj3467] = "" + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] } else { - yyv3467[yyj3467] = Capability(r.DecodeString()) + yyv1 = make([]Capability, yyrl1) + } + } else { + yyv1 = make([]Capability, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = Capability(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = Capability(r.DecodeString()) } } } } else { - for yyj3467 := 0; !r.CheckBreak(); yyj3467++ { - if yyj3467 >= len(yyv3467) { - yyv3467 = append(yyv3467, "") // var yyz3467 Capability - yyc3467 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3467 < len(yyv3467) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 Capability + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3467[yyj3467] = "" + yyv1[yyj1] = "" } else { - yyv3467[yyj3467] = Capability(r.DecodeString()) + yyv1[yyj1] = Capability(r.DecodeString()) } } else { @@ -40285,12 +49218,18 @@ func (x codecSelfer1234) decSliceCapability(v *[]Capability, d *codec1978.Decode } } - yyh3467.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Capability{} + yyc1 = true + } } - if yyc3467 { - *v = yyv3467 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceContainerPort(v []ContainerPort, e *codec1978.Encoder) { @@ -40298,11 +49237,12 @@ func (x codecSelfer1234) encSliceContainerPort(v []ContainerPort, e *codec1978.E z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3471 := range v { - yy3472 := &yyv3471 - yy3472.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceContainerPort(v *[]ContainerPort, d *codec1978.Decoder) { @@ -40310,75 +49250,86 @@ func (x codecSelfer1234) decSliceContainerPort(v *[]ContainerPort, d *codec1978. z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3473 := *v - yyh3473, yyl3473 := z.DecSliceHelperStart() - - var yyrr3473, yyrl3473 int - var yyc3473, yyrt3473 bool - _, _, _ = yyc3473, yyrt3473, yyrl3473 - yyrr3473 = yyl3473 - - if yyv3473 == nil { - if yyrl3473, yyrt3473 = z.DecInferLen(yyl3473, z.DecBasicHandle().MaxInitLen, 64); yyrt3473 { - yyrr3473 = yyrl3473 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ContainerPort{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3473 = make([]ContainerPort, yyrl3473) - yyc3473 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3473 == 0 { - if len(yyv3473) != 0 { - yyv3473 = yyv3473[:0] - yyc3473 = true - } - } else if yyl3473 > 0 { - - if yyl3473 > cap(yyv3473) { - yyrl3473, yyrt3473 = z.DecInferLen(yyl3473, z.DecBasicHandle().MaxInitLen, 64) - yyv3473 = make([]ContainerPort, yyrl3473) - yyc3473 = true - - yyrr3473 = len(yyv3473) - } else if yyl3473 != len(yyv3473) { - yyv3473 = yyv3473[:yyl3473] - yyc3473 = true - } - yyj3473 := 0 - for ; yyj3473 < yyrr3473; yyj3473++ { - if r.TryDecodeAsNil() { - yyv3473[yyj3473] = ContainerPort{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 56) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ContainerPort, yyrl1) + } } else { - yyv3474 := &yyv3473[yyj3473] - yyv3474.CodecDecodeSelf(d) + yyv1 = make([]ContainerPort, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerPort{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3473 { - for ; yyj3473 < yyl3473; yyj3473++ { - yyv3473 = append(yyv3473, ContainerPort{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ContainerPort{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3473[yyj3473] = ContainerPort{} + yyv1[yyj1] = ContainerPort{} } else { - yyv3475 := &yyv3473[yyj3473] - yyv3475.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3473 := 0; !r.CheckBreak(); yyj3473++ { - if yyj3473 >= len(yyv3473) { - yyv3473 = append(yyv3473, ContainerPort{}) // var yyz3473 ContainerPort - yyc3473 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3473 < len(yyv3473) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ContainerPort{}) // var yyz1 ContainerPort + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3473[yyj3473] = ContainerPort{} + yyv1[yyj1] = ContainerPort{} } else { - yyv3476 := &yyv3473[yyj3473] - yyv3476.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40386,12 +49337,18 @@ func (x codecSelfer1234) decSliceContainerPort(v *[]ContainerPort, d *codec1978. } } - yyh3473.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ContainerPort{} + yyc1 = true + } } - if yyc3473 { - *v = yyv3473 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEnvVar(v []EnvVar, e *codec1978.Encoder) { @@ -40399,11 +49356,12 @@ func (x codecSelfer1234) encSliceEnvVar(v []EnvVar, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3477 := range v { - yy3478 := &yyv3477 - yy3478.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEnvVar(v *[]EnvVar, d *codec1978.Decoder) { @@ -40411,75 +49369,86 @@ func (x codecSelfer1234) decSliceEnvVar(v *[]EnvVar, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3479 := *v - yyh3479, yyl3479 := z.DecSliceHelperStart() - - var yyrr3479, yyrl3479 int - var yyc3479, yyrt3479 bool - _, _, _ = yyc3479, yyrt3479, yyrl3479 - yyrr3479 = yyl3479 - - if yyv3479 == nil { - if yyrl3479, yyrt3479 = z.DecInferLen(yyl3479, z.DecBasicHandle().MaxInitLen, 40); yyrt3479 { - yyrr3479 = yyrl3479 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []EnvVar{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3479 = make([]EnvVar, yyrl3479) - yyc3479 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3479 == 0 { - if len(yyv3479) != 0 { - yyv3479 = yyv3479[:0] - yyc3479 = true - } - } else if yyl3479 > 0 { - - if yyl3479 > cap(yyv3479) { - yyrl3479, yyrt3479 = z.DecInferLen(yyl3479, z.DecBasicHandle().MaxInitLen, 40) - yyv3479 = make([]EnvVar, yyrl3479) - yyc3479 = true - - yyrr3479 = len(yyv3479) - } else if yyl3479 != len(yyv3479) { - yyv3479 = yyv3479[:yyl3479] - yyc3479 = true - } - yyj3479 := 0 - for ; yyj3479 < yyrr3479; yyj3479++ { - if r.TryDecodeAsNil() { - yyv3479[yyj3479] = EnvVar{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]EnvVar, yyrl1) + } } else { - yyv3480 := &yyv3479[yyj3479] - yyv3480.CodecDecodeSelf(d) + yyv1 = make([]EnvVar, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = EnvVar{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3479 { - for ; yyj3479 < yyl3479; yyj3479++ { - yyv3479 = append(yyv3479, EnvVar{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, EnvVar{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3479[yyj3479] = EnvVar{} + yyv1[yyj1] = EnvVar{} } else { - yyv3481 := &yyv3479[yyj3479] - yyv3481.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3479 := 0; !r.CheckBreak(); yyj3479++ { - if yyj3479 >= len(yyv3479) { - yyv3479 = append(yyv3479, EnvVar{}) // var yyz3479 EnvVar - yyc3479 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3479 < len(yyv3479) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, EnvVar{}) // var yyz1 EnvVar + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3479[yyj3479] = EnvVar{} + yyv1[yyj1] = EnvVar{} } else { - yyv3482 := &yyv3479[yyj3479] - yyv3482.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40487,12 +49456,18 @@ func (x codecSelfer1234) decSliceEnvVar(v *[]EnvVar, d *codec1978.Decoder) { } } - yyh3479.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []EnvVar{} + yyc1 = true + } } - if yyc3479 { - *v = yyv3479 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceVolumeMount(v []VolumeMount, e *codec1978.Encoder) { @@ -40500,11 +49475,12 @@ func (x codecSelfer1234) encSliceVolumeMount(v []VolumeMount, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3483 := range v { - yy3484 := &yyv3483 - yy3484.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceVolumeMount(v *[]VolumeMount, d *codec1978.Decoder) { @@ -40512,75 +49488,86 @@ func (x codecSelfer1234) decSliceVolumeMount(v *[]VolumeMount, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3485 := *v - yyh3485, yyl3485 := z.DecSliceHelperStart() - - var yyrr3485, yyrl3485 int - var yyc3485, yyrt3485 bool - _, _, _ = yyc3485, yyrt3485, yyrl3485 - yyrr3485 = yyl3485 - - if yyv3485 == nil { - if yyrl3485, yyrt3485 = z.DecInferLen(yyl3485, z.DecBasicHandle().MaxInitLen, 40); yyrt3485 { - yyrr3485 = yyrl3485 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []VolumeMount{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3485 = make([]VolumeMount, yyrl3485) - yyc3485 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3485 == 0 { - if len(yyv3485) != 0 { - yyv3485 = yyv3485[:0] - yyc3485 = true - } - } else if yyl3485 > 0 { - - if yyl3485 > cap(yyv3485) { - yyrl3485, yyrt3485 = z.DecInferLen(yyl3485, z.DecBasicHandle().MaxInitLen, 40) - yyv3485 = make([]VolumeMount, yyrl3485) - yyc3485 = true - - yyrr3485 = len(yyv3485) - } else if yyl3485 != len(yyv3485) { - yyv3485 = yyv3485[:yyl3485] - yyc3485 = true - } - yyj3485 := 0 - for ; yyj3485 < yyrr3485; yyj3485++ { - if r.TryDecodeAsNil() { - yyv3485[yyj3485] = VolumeMount{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]VolumeMount, yyrl1) + } } else { - yyv3486 := &yyv3485[yyj3485] - yyv3486.CodecDecodeSelf(d) + yyv1 = make([]VolumeMount, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = VolumeMount{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3485 { - for ; yyj3485 < yyl3485; yyj3485++ { - yyv3485 = append(yyv3485, VolumeMount{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, VolumeMount{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3485[yyj3485] = VolumeMount{} + yyv1[yyj1] = VolumeMount{} } else { - yyv3487 := &yyv3485[yyj3485] - yyv3487.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3485 := 0; !r.CheckBreak(); yyj3485++ { - if yyj3485 >= len(yyv3485) { - yyv3485 = append(yyv3485, VolumeMount{}) // var yyz3485 VolumeMount - yyc3485 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3485 < len(yyv3485) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, VolumeMount{}) // var yyz1 VolumeMount + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3485[yyj3485] = VolumeMount{} + yyv1[yyj1] = VolumeMount{} } else { - yyv3488 := &yyv3485[yyj3485] - yyv3488.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40588,12 +49575,375 @@ func (x codecSelfer1234) decSliceVolumeMount(v *[]VolumeMount, d *codec1978.Deco } } - yyh3485.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []VolumeMount{} + yyc1 = true + } } - if yyc3485 { - *v = yyv3485 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceNodeSelectorTerm(v []NodeSelectorTerm, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceNodeSelectorTerm(v *[]NodeSelectorTerm, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeSelectorTerm{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeSelectorTerm, yyrl1) + } + } else { + yyv1 = make([]NodeSelectorTerm, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorTerm{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeSelectorTerm{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorTerm{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeSelectorTerm{}) // var yyz1 NodeSelectorTerm + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorTerm{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeSelectorTerm{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceNodeSelectorRequirement(v []NodeSelectorRequirement, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceNodeSelectorRequirement(v *[]NodeSelectorRequirement, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeSelectorRequirement{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 56) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeSelectorRequirement, yyrl1) + } + } else { + yyv1 = make([]NodeSelectorRequirement, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorRequirement{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeSelectorRequirement{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorRequirement{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeSelectorRequirement{}) // var yyz1 NodeSelectorRequirement + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeSelectorRequirement{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeSelectorRequirement{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSlicePreferredSchedulingTerm(v []PreferredSchedulingTerm, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSlicePreferredSchedulingTerm(v *[]PreferredSchedulingTerm, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PreferredSchedulingTerm{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PreferredSchedulingTerm, yyrl1) + } + } else { + yyv1 = make([]PreferredSchedulingTerm, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PreferredSchedulingTerm{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PreferredSchedulingTerm{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PreferredSchedulingTerm{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PreferredSchedulingTerm{}) // var yyz1 PreferredSchedulingTerm + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = PreferredSchedulingTerm{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PreferredSchedulingTerm{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceVolume(v []Volume, e *codec1978.Encoder) { @@ -40601,11 +49951,12 @@ func (x codecSelfer1234) encSliceVolume(v []Volume, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3489 := range v { - yy3490 := &yyv3489 - yy3490.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceVolume(v *[]Volume, d *codec1978.Decoder) { @@ -40613,75 +49964,86 @@ func (x codecSelfer1234) decSliceVolume(v *[]Volume, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3491 := *v - yyh3491, yyl3491 := z.DecSliceHelperStart() - - var yyrr3491, yyrl3491 int - var yyc3491, yyrt3491 bool - _, _, _ = yyc3491, yyrt3491, yyrl3491 - yyrr3491 = yyl3491 - - if yyv3491 == nil { - if yyrl3491, yyrt3491 = z.DecInferLen(yyl3491, z.DecBasicHandle().MaxInitLen, 144); yyrt3491 { - yyrr3491 = yyrl3491 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Volume{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3491 = make([]Volume, yyrl3491) - yyc3491 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3491 == 0 { - if len(yyv3491) != 0 { - yyv3491 = yyv3491[:0] - yyc3491 = true - } - } else if yyl3491 > 0 { - - if yyl3491 > cap(yyv3491) { - yyrl3491, yyrt3491 = z.DecInferLen(yyl3491, z.DecBasicHandle().MaxInitLen, 144) - yyv3491 = make([]Volume, yyrl3491) - yyc3491 = true - - yyrr3491 = len(yyv3491) - } else if yyl3491 != len(yyv3491) { - yyv3491 = yyv3491[:yyl3491] - yyc3491 = true - } - yyj3491 := 0 - for ; yyj3491 < yyrr3491; yyj3491++ { - if r.TryDecodeAsNil() { - yyv3491[yyj3491] = Volume{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 168) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Volume, yyrl1) + } } else { - yyv3492 := &yyv3491[yyj3491] - yyv3492.CodecDecodeSelf(d) + yyv1 = make([]Volume, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Volume{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3491 { - for ; yyj3491 < yyl3491; yyj3491++ { - yyv3491 = append(yyv3491, Volume{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Volume{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3491[yyj3491] = Volume{} + yyv1[yyj1] = Volume{} } else { - yyv3493 := &yyv3491[yyj3491] - yyv3493.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3491 := 0; !r.CheckBreak(); yyj3491++ { - if yyj3491 >= len(yyv3491) { - yyv3491 = append(yyv3491, Volume{}) // var yyz3491 Volume - yyc3491 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3491 < len(yyv3491) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Volume{}) // var yyz1 Volume + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3491[yyj3491] = Volume{} + yyv1[yyj1] = Volume{} } else { - yyv3494 := &yyv3491[yyj3491] - yyv3494.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40689,12 +50051,18 @@ func (x codecSelfer1234) decSliceVolume(v *[]Volume, d *codec1978.Decoder) { } } - yyh3491.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Volume{} + yyc1 = true + } } - if yyc3491 { - *v = yyv3491 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceContainer(v []Container, e *codec1978.Encoder) { @@ -40702,11 +50070,12 @@ func (x codecSelfer1234) encSliceContainer(v []Container, e *codec1978.Encoder) z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3495 := range v { - yy3496 := &yyv3495 - yy3496.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceContainer(v *[]Container, d *codec1978.Decoder) { @@ -40714,75 +50083,86 @@ func (x codecSelfer1234) decSliceContainer(v *[]Container, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3497 := *v - yyh3497, yyl3497 := z.DecSliceHelperStart() - - var yyrr3497, yyrl3497 int - var yyc3497, yyrt3497 bool - _, _, _ = yyc3497, yyrt3497, yyrl3497 - yyrr3497 = yyl3497 - - if yyv3497 == nil { - if yyrl3497, yyrt3497 = z.DecInferLen(yyl3497, z.DecBasicHandle().MaxInitLen, 256); yyrt3497 { - yyrr3497 = yyrl3497 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Container{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3497 = make([]Container, yyrl3497) - yyc3497 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3497 == 0 { - if len(yyv3497) != 0 { - yyv3497 = yyv3497[:0] - yyc3497 = true - } - } else if yyl3497 > 0 { - - if yyl3497 > cap(yyv3497) { - yyrl3497, yyrt3497 = z.DecInferLen(yyl3497, z.DecBasicHandle().MaxInitLen, 256) - yyv3497 = make([]Container, yyrl3497) - yyc3497 = true - - yyrr3497 = len(yyv3497) - } else if yyl3497 != len(yyv3497) { - yyv3497 = yyv3497[:yyl3497] - yyc3497 = true - } - yyj3497 := 0 - for ; yyj3497 < yyrr3497; yyj3497++ { - if r.TryDecodeAsNil() { - yyv3497[yyj3497] = Container{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 256) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Container, yyrl1) + } } else { - yyv3498 := &yyv3497[yyj3497] - yyv3498.CodecDecodeSelf(d) + yyv1 = make([]Container, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Container{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3497 { - for ; yyj3497 < yyl3497; yyj3497++ { - yyv3497 = append(yyv3497, Container{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Container{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3497[yyj3497] = Container{} + yyv1[yyj1] = Container{} } else { - yyv3499 := &yyv3497[yyj3497] - yyv3499.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3497 := 0; !r.CheckBreak(); yyj3497++ { - if yyj3497 >= len(yyv3497) { - yyv3497 = append(yyv3497, Container{}) // var yyz3497 Container - yyc3497 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3497 < len(yyv3497) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Container{}) // var yyz1 Container + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3497[yyj3497] = Container{} + yyv1[yyj1] = Container{} } else { - yyv3500 := &yyv3497[yyj3497] - yyv3500.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40790,12 +50170,18 @@ func (x codecSelfer1234) decSliceContainer(v *[]Container, d *codec1978.Decoder) } } - yyh3497.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Container{} + yyc1 = true + } } - if yyc3497 { - *v = yyv3497 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceLocalObjectReference(v []LocalObjectReference, e *codec1978.Encoder) { @@ -40803,11 +50189,12 @@ func (x codecSelfer1234) encSliceLocalObjectReference(v []LocalObjectReference, z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3501 := range v { - yy3502 := &yyv3501 - yy3502.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceLocalObjectReference(v *[]LocalObjectReference, d *codec1978.Decoder) { @@ -40815,75 +50202,86 @@ func (x codecSelfer1234) decSliceLocalObjectReference(v *[]LocalObjectReference, z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3503 := *v - yyh3503, yyl3503 := z.DecSliceHelperStart() - - var yyrr3503, yyrl3503 int - var yyc3503, yyrt3503 bool - _, _, _ = yyc3503, yyrt3503, yyrl3503 - yyrr3503 = yyl3503 - - if yyv3503 == nil { - if yyrl3503, yyrt3503 = z.DecInferLen(yyl3503, z.DecBasicHandle().MaxInitLen, 16); yyrt3503 { - yyrr3503 = yyrl3503 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []LocalObjectReference{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3503 = make([]LocalObjectReference, yyrl3503) - yyc3503 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3503 == 0 { - if len(yyv3503) != 0 { - yyv3503 = yyv3503[:0] - yyc3503 = true - } - } else if yyl3503 > 0 { - - if yyl3503 > cap(yyv3503) { - yyrl3503, yyrt3503 = z.DecInferLen(yyl3503, z.DecBasicHandle().MaxInitLen, 16) - yyv3503 = make([]LocalObjectReference, yyrl3503) - yyc3503 = true - - yyrr3503 = len(yyv3503) - } else if yyl3503 != len(yyv3503) { - yyv3503 = yyv3503[:yyl3503] - yyc3503 = true - } - yyj3503 := 0 - for ; yyj3503 < yyrr3503; yyj3503++ { - if r.TryDecodeAsNil() { - yyv3503[yyj3503] = LocalObjectReference{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]LocalObjectReference, yyrl1) + } } else { - yyv3504 := &yyv3503[yyj3503] - yyv3504.CodecDecodeSelf(d) + yyv1 = make([]LocalObjectReference, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = LocalObjectReference{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3503 { - for ; yyj3503 < yyl3503; yyj3503++ { - yyv3503 = append(yyv3503, LocalObjectReference{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, LocalObjectReference{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3503[yyj3503] = LocalObjectReference{} + yyv1[yyj1] = LocalObjectReference{} } else { - yyv3505 := &yyv3503[yyj3503] - yyv3505.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3503 := 0; !r.CheckBreak(); yyj3503++ { - if yyj3503 >= len(yyv3503) { - yyv3503 = append(yyv3503, LocalObjectReference{}) // var yyz3503 LocalObjectReference - yyc3503 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3503 < len(yyv3503) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LocalObjectReference{}) // var yyz1 LocalObjectReference + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3503[yyj3503] = LocalObjectReference{} + yyv1[yyj1] = LocalObjectReference{} } else { - yyv3506 := &yyv3503[yyj3503] - yyv3506.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40891,12 +50289,18 @@ func (x codecSelfer1234) decSliceLocalObjectReference(v *[]LocalObjectReference, } } - yyh3503.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []LocalObjectReference{} + yyc1 = true + } } - if yyc3503 { - *v = yyv3503 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePodCondition(v []PodCondition, e *codec1978.Encoder) { @@ -40904,11 +50308,12 @@ func (x codecSelfer1234) encSlicePodCondition(v []PodCondition, e *codec1978.Enc z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3507 := range v { - yy3508 := &yyv3507 - yy3508.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePodCondition(v *[]PodCondition, d *codec1978.Decoder) { @@ -40916,75 +50321,86 @@ func (x codecSelfer1234) decSlicePodCondition(v *[]PodCondition, d *codec1978.De z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3509 := *v - yyh3509, yyl3509 := z.DecSliceHelperStart() - - var yyrr3509, yyrl3509 int - var yyc3509, yyrt3509 bool - _, _, _ = yyc3509, yyrt3509, yyrl3509 - yyrr3509 = yyl3509 - - if yyv3509 == nil { - if yyrl3509, yyrt3509 = z.DecInferLen(yyl3509, z.DecBasicHandle().MaxInitLen, 112); yyrt3509 { - yyrr3509 = yyrl3509 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PodCondition{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3509 = make([]PodCondition, yyrl3509) - yyc3509 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3509 == 0 { - if len(yyv3509) != 0 { - yyv3509 = yyv3509[:0] - yyc3509 = true - } - } else if yyl3509 > 0 { - - if yyl3509 > cap(yyv3509) { - yyrl3509, yyrt3509 = z.DecInferLen(yyl3509, z.DecBasicHandle().MaxInitLen, 112) - yyv3509 = make([]PodCondition, yyrl3509) - yyc3509 = true - - yyrr3509 = len(yyv3509) - } else if yyl3509 != len(yyv3509) { - yyv3509 = yyv3509[:yyl3509] - yyc3509 = true - } - yyj3509 := 0 - for ; yyj3509 < yyrr3509; yyj3509++ { - if r.TryDecodeAsNil() { - yyv3509[yyj3509] = PodCondition{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 112) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PodCondition, yyrl1) + } } else { - yyv3510 := &yyv3509[yyj3509] - yyv3510.CodecDecodeSelf(d) + yyv1 = make([]PodCondition, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodCondition{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3509 { - for ; yyj3509 < yyl3509; yyj3509++ { - yyv3509 = append(yyv3509, PodCondition{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PodCondition{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3509[yyj3509] = PodCondition{} + yyv1[yyj1] = PodCondition{} } else { - yyv3511 := &yyv3509[yyj3509] - yyv3511.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3509 := 0; !r.CheckBreak(); yyj3509++ { - if yyj3509 >= len(yyv3509) { - yyv3509 = append(yyv3509, PodCondition{}) // var yyz3509 PodCondition - yyc3509 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3509 < len(yyv3509) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PodCondition{}) // var yyz1 PodCondition + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3509[yyj3509] = PodCondition{} + yyv1[yyj1] = PodCondition{} } else { - yyv3512 := &yyv3509[yyj3509] - yyv3512.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -40992,12 +50408,18 @@ func (x codecSelfer1234) decSlicePodCondition(v *[]PodCondition, d *codec1978.De } } - yyh3509.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PodCondition{} + yyc1 = true + } } - if yyc3509 { - *v = yyv3509 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceContainerStatus(v []ContainerStatus, e *codec1978.Encoder) { @@ -41005,11 +50427,12 @@ func (x codecSelfer1234) encSliceContainerStatus(v []ContainerStatus, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3513 := range v { - yy3514 := &yyv3513 - yy3514.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceContainerStatus(v *[]ContainerStatus, d *codec1978.Decoder) { @@ -41017,75 +50440,86 @@ func (x codecSelfer1234) decSliceContainerStatus(v *[]ContainerStatus, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3515 := *v - yyh3515, yyl3515 := z.DecSliceHelperStart() - - var yyrr3515, yyrl3515 int - var yyc3515, yyrt3515 bool - _, _, _ = yyc3515, yyrt3515, yyrl3515 - yyrr3515 = yyl3515 - - if yyv3515 == nil { - if yyrl3515, yyrt3515 = z.DecInferLen(yyl3515, z.DecBasicHandle().MaxInitLen, 128); yyrt3515 { - yyrr3515 = yyrl3515 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ContainerStatus{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3515 = make([]ContainerStatus, yyrl3515) - yyc3515 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3515 == 0 { - if len(yyv3515) != 0 { - yyv3515 = yyv3515[:0] - yyc3515 = true - } - } else if yyl3515 > 0 { - - if yyl3515 > cap(yyv3515) { - yyrl3515, yyrt3515 = z.DecInferLen(yyl3515, z.DecBasicHandle().MaxInitLen, 128) - yyv3515 = make([]ContainerStatus, yyrl3515) - yyc3515 = true - - yyrr3515 = len(yyv3515) - } else if yyl3515 != len(yyv3515) { - yyv3515 = yyv3515[:yyl3515] - yyc3515 = true - } - yyj3515 := 0 - for ; yyj3515 < yyrr3515; yyj3515++ { - if r.TryDecodeAsNil() { - yyv3515[yyj3515] = ContainerStatus{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 120) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ContainerStatus, yyrl1) + } } else { - yyv3516 := &yyv3515[yyj3515] - yyv3516.CodecDecodeSelf(d) + yyv1 = make([]ContainerStatus, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerStatus{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3515 { - for ; yyj3515 < yyl3515; yyj3515++ { - yyv3515 = append(yyv3515, ContainerStatus{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ContainerStatus{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3515[yyj3515] = ContainerStatus{} + yyv1[yyj1] = ContainerStatus{} } else { - yyv3517 := &yyv3515[yyj3515] - yyv3517.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3515 := 0; !r.CheckBreak(); yyj3515++ { - if yyj3515 >= len(yyv3515) { - yyv3515 = append(yyv3515, ContainerStatus{}) // var yyz3515 ContainerStatus - yyc3515 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3515 < len(yyv3515) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ContainerStatus{}) // var yyz1 ContainerStatus + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3515[yyj3515] = ContainerStatus{} + yyv1[yyj1] = ContainerStatus{} } else { - yyv3518 := &yyv3515[yyj3515] - yyv3518.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41093,12 +50527,18 @@ func (x codecSelfer1234) decSliceContainerStatus(v *[]ContainerStatus, d *codec1 } } - yyh3515.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ContainerStatus{} + yyc1 = true + } } - if yyc3515 { - *v = yyv3515 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePod(v []Pod, e *codec1978.Encoder) { @@ -41106,11 +50546,12 @@ func (x codecSelfer1234) encSlicePod(v []Pod, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3519 := range v { - yy3520 := &yyv3519 - yy3520.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePod(v *[]Pod, d *codec1978.Decoder) { @@ -41118,75 +50559,86 @@ func (x codecSelfer1234) decSlicePod(v *[]Pod, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3521 := *v - yyh3521, yyl3521 := z.DecSliceHelperStart() - - var yyrr3521, yyrl3521 int - var yyc3521, yyrt3521 bool - _, _, _ = yyc3521, yyrt3521, yyrl3521 - yyrr3521 = yyl3521 - - if yyv3521 == nil { - if yyrl3521, yyrt3521 = z.DecInferLen(yyl3521, z.DecBasicHandle().MaxInitLen, 520); yyrt3521 { - yyrr3521 = yyrl3521 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Pod{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3521 = make([]Pod, yyrl3521) - yyc3521 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3521 == 0 { - if len(yyv3521) != 0 { - yyv3521 = yyv3521[:0] - yyc3521 = true - } - } else if yyl3521 > 0 { - - if yyl3521 > cap(yyv3521) { - yyrl3521, yyrt3521 = z.DecInferLen(yyl3521, z.DecBasicHandle().MaxInitLen, 520) - yyv3521 = make([]Pod, yyrl3521) - yyc3521 = true - - yyrr3521 = len(yyv3521) - } else if yyl3521 != len(yyv3521) { - yyv3521 = yyv3521[:yyl3521] - yyc3521 = true - } - yyj3521 := 0 - for ; yyj3521 < yyrr3521; yyj3521++ { - if r.TryDecodeAsNil() { - yyv3521[yyj3521] = Pod{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 520) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Pod, yyrl1) + } } else { - yyv3522 := &yyv3521[yyj3521] - yyv3522.CodecDecodeSelf(d) + yyv1 = make([]Pod, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Pod{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3521 { - for ; yyj3521 < yyl3521; yyj3521++ { - yyv3521 = append(yyv3521, Pod{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Pod{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3521[yyj3521] = Pod{} + yyv1[yyj1] = Pod{} } else { - yyv3523 := &yyv3521[yyj3521] - yyv3523.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3521 := 0; !r.CheckBreak(); yyj3521++ { - if yyj3521 >= len(yyv3521) { - yyv3521 = append(yyv3521, Pod{}) // var yyz3521 Pod - yyc3521 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3521 < len(yyv3521) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Pod{}) // var yyz1 Pod + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3521[yyj3521] = Pod{} + yyv1[yyj1] = Pod{} } else { - yyv3524 := &yyv3521[yyj3521] - yyv3524.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41194,12 +50646,18 @@ func (x codecSelfer1234) decSlicePod(v *[]Pod, d *codec1978.Decoder) { } } - yyh3521.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Pod{} + yyc1 = true + } } - if yyc3521 { - *v = yyv3521 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSlicePodTemplate(v []PodTemplate, e *codec1978.Encoder) { @@ -41207,11 +50665,12 @@ func (x codecSelfer1234) encSlicePodTemplate(v []PodTemplate, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3525 := range v { - yy3526 := &yyv3525 - yy3526.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSlicePodTemplate(v *[]PodTemplate, d *codec1978.Decoder) { @@ -41219,75 +50678,86 @@ func (x codecSelfer1234) decSlicePodTemplate(v *[]PodTemplate, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3527 := *v - yyh3527, yyl3527 := z.DecSliceHelperStart() - - var yyrr3527, yyrl3527 int - var yyc3527, yyrt3527 bool - _, _, _ = yyc3527, yyrt3527, yyrl3527 - yyrr3527 = yyl3527 - - if yyv3527 == nil { - if yyrl3527, yyrt3527 = z.DecInferLen(yyl3527, z.DecBasicHandle().MaxInitLen, 544); yyrt3527 { - yyrr3527 = yyrl3527 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PodTemplate{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3527 = make([]PodTemplate, yyrl3527) - yyc3527 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3527 == 0 { - if len(yyv3527) != 0 { - yyv3527 = yyv3527[:0] - yyc3527 = true - } - } else if yyl3527 > 0 { - - if yyl3527 > cap(yyv3527) { - yyrl3527, yyrt3527 = z.DecInferLen(yyl3527, z.DecBasicHandle().MaxInitLen, 544) - yyv3527 = make([]PodTemplate, yyrl3527) - yyc3527 = true - - yyrr3527 = len(yyv3527) - } else if yyl3527 != len(yyv3527) { - yyv3527 = yyv3527[:yyl3527] - yyc3527 = true - } - yyj3527 := 0 - for ; yyj3527 < yyrr3527; yyj3527++ { - if r.TryDecodeAsNil() { - yyv3527[yyj3527] = PodTemplate{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 544) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PodTemplate, yyrl1) + } } else { - yyv3528 := &yyv3527[yyj3527] - yyv3528.CodecDecodeSelf(d) + yyv1 = make([]PodTemplate, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodTemplate{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3527 { - for ; yyj3527 < yyl3527; yyj3527++ { - yyv3527 = append(yyv3527, PodTemplate{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PodTemplate{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3527[yyj3527] = PodTemplate{} + yyv1[yyj1] = PodTemplate{} } else { - yyv3529 := &yyv3527[yyj3527] - yyv3529.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3527 := 0; !r.CheckBreak(); yyj3527++ { - if yyj3527 >= len(yyv3527) { - yyv3527 = append(yyv3527, PodTemplate{}) // var yyz3527 PodTemplate - yyc3527 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3527 < len(yyv3527) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PodTemplate{}) // var yyz1 PodTemplate + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3527[yyj3527] = PodTemplate{} + yyv1[yyj1] = PodTemplate{} } else { - yyv3530 := &yyv3527[yyj3527] - yyv3530.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41295,12 +50765,18 @@ func (x codecSelfer1234) decSlicePodTemplate(v *[]PodTemplate, d *codec1978.Deco } } - yyh3527.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PodTemplate{} + yyc1 = true + } } - if yyc3527 { - *v = yyv3527 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceReplicationController(v []ReplicationController, e *codec1978.Encoder) { @@ -41308,11 +50784,12 @@ func (x codecSelfer1234) encSliceReplicationController(v []ReplicationController z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3531 := range v { - yy3532 := &yyv3531 - yy3532.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceReplicationController(v *[]ReplicationController, d *codec1978.Decoder) { @@ -41320,75 +50797,86 @@ func (x codecSelfer1234) decSliceReplicationController(v *[]ReplicationControlle z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3533 := *v - yyh3533, yyl3533 := z.DecSliceHelperStart() - - var yyrr3533, yyrl3533 int - var yyc3533, yyrt3533 bool - _, _, _ = yyc3533, yyrt3533, yyrl3533 - yyrr3533 = yyl3533 - - if yyv3533 == nil { - if yyrl3533, yyrt3533 = z.DecInferLen(yyl3533, z.DecBasicHandle().MaxInitLen, 232); yyrt3533 { - yyrr3533 = yyrl3533 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ReplicationController{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3533 = make([]ReplicationController, yyrl3533) - yyc3533 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3533 == 0 { - if len(yyv3533) != 0 { - yyv3533 = yyv3533[:0] - yyc3533 = true - } - } else if yyl3533 > 0 { - - if yyl3533 > cap(yyv3533) { - yyrl3533, yyrt3533 = z.DecInferLen(yyl3533, z.DecBasicHandle().MaxInitLen, 232) - yyv3533 = make([]ReplicationController, yyrl3533) - yyc3533 = true - - yyrr3533 = len(yyv3533) - } else if yyl3533 != len(yyv3533) { - yyv3533 = yyv3533[:yyl3533] - yyc3533 = true - } - yyj3533 := 0 - for ; yyj3533 < yyrr3533; yyj3533++ { - if r.TryDecodeAsNil() { - yyv3533[yyj3533] = ReplicationController{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 232) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ReplicationController, yyrl1) + } } else { - yyv3534 := &yyv3533[yyj3533] - yyv3534.CodecDecodeSelf(d) + yyv1 = make([]ReplicationController, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ReplicationController{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3533 { - for ; yyj3533 < yyl3533; yyj3533++ { - yyv3533 = append(yyv3533, ReplicationController{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ReplicationController{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3533[yyj3533] = ReplicationController{} + yyv1[yyj1] = ReplicationController{} } else { - yyv3535 := &yyv3533[yyj3533] - yyv3535.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3533 := 0; !r.CheckBreak(); yyj3533++ { - if yyj3533 >= len(yyv3533) { - yyv3533 = append(yyv3533, ReplicationController{}) // var yyz3533 ReplicationController - yyc3533 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3533 < len(yyv3533) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ReplicationController{}) // var yyz1 ReplicationController + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3533[yyj3533] = ReplicationController{} + yyv1[yyj1] = ReplicationController{} } else { - yyv3536 := &yyv3533[yyj3533] - yyv3536.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41396,12 +50884,18 @@ func (x codecSelfer1234) decSliceReplicationController(v *[]ReplicationControlle } } - yyh3533.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ReplicationController{} + yyc1 = true + } } - if yyc3533 { - *v = yyv3533 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceLoadBalancerIngress(v []LoadBalancerIngress, e *codec1978.Encoder) { @@ -41409,11 +50903,12 @@ func (x codecSelfer1234) encSliceLoadBalancerIngress(v []LoadBalancerIngress, e z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3537 := range v { - yy3538 := &yyv3537 - yy3538.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceLoadBalancerIngress(v *[]LoadBalancerIngress, d *codec1978.Decoder) { @@ -41421,75 +50916,86 @@ func (x codecSelfer1234) decSliceLoadBalancerIngress(v *[]LoadBalancerIngress, d z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3539 := *v - yyh3539, yyl3539 := z.DecSliceHelperStart() - - var yyrr3539, yyrl3539 int - var yyc3539, yyrt3539 bool - _, _, _ = yyc3539, yyrt3539, yyrl3539 - yyrr3539 = yyl3539 - - if yyv3539 == nil { - if yyrl3539, yyrt3539 = z.DecInferLen(yyl3539, z.DecBasicHandle().MaxInitLen, 32); yyrt3539 { - yyrr3539 = yyrl3539 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []LoadBalancerIngress{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3539 = make([]LoadBalancerIngress, yyrl3539) - yyc3539 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3539 == 0 { - if len(yyv3539) != 0 { - yyv3539 = yyv3539[:0] - yyc3539 = true - } - } else if yyl3539 > 0 { - - if yyl3539 > cap(yyv3539) { - yyrl3539, yyrt3539 = z.DecInferLen(yyl3539, z.DecBasicHandle().MaxInitLen, 32) - yyv3539 = make([]LoadBalancerIngress, yyrl3539) - yyc3539 = true - - yyrr3539 = len(yyv3539) - } else if yyl3539 != len(yyv3539) { - yyv3539 = yyv3539[:yyl3539] - yyc3539 = true - } - yyj3539 := 0 - for ; yyj3539 < yyrr3539; yyj3539++ { - if r.TryDecodeAsNil() { - yyv3539[yyj3539] = LoadBalancerIngress{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]LoadBalancerIngress, yyrl1) + } } else { - yyv3540 := &yyv3539[yyj3539] - yyv3540.CodecDecodeSelf(d) + yyv1 = make([]LoadBalancerIngress, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = LoadBalancerIngress{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3539 { - for ; yyj3539 < yyl3539; yyj3539++ { - yyv3539 = append(yyv3539, LoadBalancerIngress{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, LoadBalancerIngress{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3539[yyj3539] = LoadBalancerIngress{} + yyv1[yyj1] = LoadBalancerIngress{} } else { - yyv3541 := &yyv3539[yyj3539] - yyv3541.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3539 := 0; !r.CheckBreak(); yyj3539++ { - if yyj3539 >= len(yyv3539) { - yyv3539 = append(yyv3539, LoadBalancerIngress{}) // var yyz3539 LoadBalancerIngress - yyc3539 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3539 < len(yyv3539) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LoadBalancerIngress{}) // var yyz1 LoadBalancerIngress + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3539[yyj3539] = LoadBalancerIngress{} + yyv1[yyj1] = LoadBalancerIngress{} } else { - yyv3542 := &yyv3539[yyj3539] - yyv3542.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41497,12 +51003,18 @@ func (x codecSelfer1234) decSliceLoadBalancerIngress(v *[]LoadBalancerIngress, d } } - yyh3539.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []LoadBalancerIngress{} + yyc1 = true + } } - if yyc3539 { - *v = yyv3539 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceServicePort(v []ServicePort, e *codec1978.Encoder) { @@ -41510,11 +51022,12 @@ func (x codecSelfer1234) encSliceServicePort(v []ServicePort, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3543 := range v { - yy3544 := &yyv3543 - yy3544.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceServicePort(v *[]ServicePort, d *codec1978.Decoder) { @@ -41522,75 +51035,86 @@ func (x codecSelfer1234) decSliceServicePort(v *[]ServicePort, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3545 := *v - yyh3545, yyl3545 := z.DecSliceHelperStart() - - var yyrr3545, yyrl3545 int - var yyc3545, yyrt3545 bool - _, _, _ = yyc3545, yyrt3545, yyrl3545 - yyrr3545 = yyl3545 - - if yyv3545 == nil { - if yyrl3545, yyrt3545 = z.DecInferLen(yyl3545, z.DecBasicHandle().MaxInitLen, 80); yyrt3545 { - yyrr3545 = yyrl3545 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ServicePort{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3545 = make([]ServicePort, yyrl3545) - yyc3545 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3545 == 0 { - if len(yyv3545) != 0 { - yyv3545 = yyv3545[:0] - yyc3545 = true - } - } else if yyl3545 > 0 { - - if yyl3545 > cap(yyv3545) { - yyrl3545, yyrt3545 = z.DecInferLen(yyl3545, z.DecBasicHandle().MaxInitLen, 80) - yyv3545 = make([]ServicePort, yyrl3545) - yyc3545 = true - - yyrr3545 = len(yyv3545) - } else if yyl3545 != len(yyv3545) { - yyv3545 = yyv3545[:yyl3545] - yyc3545 = true - } - yyj3545 := 0 - for ; yyj3545 < yyrr3545; yyj3545++ { - if r.TryDecodeAsNil() { - yyv3545[yyj3545] = ServicePort{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 80) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ServicePort, yyrl1) + } } else { - yyv3546 := &yyv3545[yyj3545] - yyv3546.CodecDecodeSelf(d) + yyv1 = make([]ServicePort, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ServicePort{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3545 { - for ; yyj3545 < yyl3545; yyj3545++ { - yyv3545 = append(yyv3545, ServicePort{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ServicePort{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3545[yyj3545] = ServicePort{} + yyv1[yyj1] = ServicePort{} } else { - yyv3547 := &yyv3545[yyj3545] - yyv3547.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3545 := 0; !r.CheckBreak(); yyj3545++ { - if yyj3545 >= len(yyv3545) { - yyv3545 = append(yyv3545, ServicePort{}) // var yyz3545 ServicePort - yyc3545 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3545 < len(yyv3545) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ServicePort{}) // var yyz1 ServicePort + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3545[yyj3545] = ServicePort{} + yyv1[yyj1] = ServicePort{} } else { - yyv3548 := &yyv3545[yyj3545] - yyv3548.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41598,12 +51122,18 @@ func (x codecSelfer1234) decSliceServicePort(v *[]ServicePort, d *codec1978.Deco } } - yyh3545.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ServicePort{} + yyc1 = true + } } - if yyc3545 { - *v = yyv3545 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceService(v []Service, e *codec1978.Encoder) { @@ -41611,11 +51141,12 @@ func (x codecSelfer1234) encSliceService(v []Service, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3549 := range v { - yy3550 := &yyv3549 - yy3550.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceService(v *[]Service, d *codec1978.Decoder) { @@ -41623,75 +51154,86 @@ func (x codecSelfer1234) decSliceService(v *[]Service, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3551 := *v - yyh3551, yyl3551 := z.DecSliceHelperStart() - - var yyrr3551, yyrl3551 int - var yyc3551, yyrt3551 bool - _, _, _ = yyc3551, yyrt3551, yyrl3551 - yyrr3551 = yyl3551 - - if yyv3551 == nil { - if yyrl3551, yyrt3551 = z.DecInferLen(yyl3551, z.DecBasicHandle().MaxInitLen, 360); yyrt3551 { - yyrr3551 = yyrl3551 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Service{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3551 = make([]Service, yyrl3551) - yyc3551 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3551 == 0 { - if len(yyv3551) != 0 { - yyv3551 = yyv3551[:0] - yyc3551 = true - } - } else if yyl3551 > 0 { - - if yyl3551 > cap(yyv3551) { - yyrl3551, yyrt3551 = z.DecInferLen(yyl3551, z.DecBasicHandle().MaxInitLen, 360) - yyv3551 = make([]Service, yyrl3551) - yyc3551 = true - - yyrr3551 = len(yyv3551) - } else if yyl3551 != len(yyv3551) { - yyv3551 = yyv3551[:yyl3551] - yyc3551 = true - } - yyj3551 := 0 - for ; yyj3551 < yyrr3551; yyj3551++ { - if r.TryDecodeAsNil() { - yyv3551[yyj3551] = Service{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 360) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Service, yyrl1) + } } else { - yyv3552 := &yyv3551[yyj3551] - yyv3552.CodecDecodeSelf(d) + yyv1 = make([]Service, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Service{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3551 { - for ; yyj3551 < yyl3551; yyj3551++ { - yyv3551 = append(yyv3551, Service{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Service{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3551[yyj3551] = Service{} + yyv1[yyj1] = Service{} } else { - yyv3553 := &yyv3551[yyj3551] - yyv3553.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3551 := 0; !r.CheckBreak(); yyj3551++ { - if yyj3551 >= len(yyv3551) { - yyv3551 = append(yyv3551, Service{}) // var yyz3551 Service - yyc3551 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3551 < len(yyv3551) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Service{}) // var yyz1 Service + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3551[yyj3551] = Service{} + yyv1[yyj1] = Service{} } else { - yyv3554 := &yyv3551[yyj3551] - yyv3554.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41699,12 +51241,18 @@ func (x codecSelfer1234) decSliceService(v *[]Service, d *codec1978.Decoder) { } } - yyh3551.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Service{} + yyc1 = true + } } - if yyc3551 { - *v = yyv3551 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceObjectReference(v []ObjectReference, e *codec1978.Encoder) { @@ -41712,11 +51260,12 @@ func (x codecSelfer1234) encSliceObjectReference(v []ObjectReference, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3555 := range v { - yy3556 := &yyv3555 - yy3556.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceObjectReference(v *[]ObjectReference, d *codec1978.Decoder) { @@ -41724,75 +51273,86 @@ func (x codecSelfer1234) decSliceObjectReference(v *[]ObjectReference, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3557 := *v - yyh3557, yyl3557 := z.DecSliceHelperStart() - - var yyrr3557, yyrl3557 int - var yyc3557, yyrt3557 bool - _, _, _ = yyc3557, yyrt3557, yyrl3557 - yyrr3557 = yyl3557 - - if yyv3557 == nil { - if yyrl3557, yyrt3557 = z.DecInferLen(yyl3557, z.DecBasicHandle().MaxInitLen, 112); yyrt3557 { - yyrr3557 = yyrl3557 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ObjectReference{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3557 = make([]ObjectReference, yyrl3557) - yyc3557 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3557 == 0 { - if len(yyv3557) != 0 { - yyv3557 = yyv3557[:0] - yyc3557 = true - } - } else if yyl3557 > 0 { - - if yyl3557 > cap(yyv3557) { - yyrl3557, yyrt3557 = z.DecInferLen(yyl3557, z.DecBasicHandle().MaxInitLen, 112) - yyv3557 = make([]ObjectReference, yyrl3557) - yyc3557 = true - - yyrr3557 = len(yyv3557) - } else if yyl3557 != len(yyv3557) { - yyv3557 = yyv3557[:yyl3557] - yyc3557 = true - } - yyj3557 := 0 - for ; yyj3557 < yyrr3557; yyj3557++ { - if r.TryDecodeAsNil() { - yyv3557[yyj3557] = ObjectReference{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 112) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ObjectReference, yyrl1) + } } else { - yyv3558 := &yyv3557[yyj3557] - yyv3558.CodecDecodeSelf(d) + yyv1 = make([]ObjectReference, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ObjectReference{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3557 { - for ; yyj3557 < yyl3557; yyj3557++ { - yyv3557 = append(yyv3557, ObjectReference{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ObjectReference{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3557[yyj3557] = ObjectReference{} + yyv1[yyj1] = ObjectReference{} } else { - yyv3559 := &yyv3557[yyj3557] - yyv3559.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3557 := 0; !r.CheckBreak(); yyj3557++ { - if yyj3557 >= len(yyv3557) { - yyv3557 = append(yyv3557, ObjectReference{}) // var yyz3557 ObjectReference - yyc3557 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3557 < len(yyv3557) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ObjectReference{}) // var yyz1 ObjectReference + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3557[yyj3557] = ObjectReference{} + yyv1[yyj1] = ObjectReference{} } else { - yyv3560 := &yyv3557[yyj3557] - yyv3560.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41800,12 +51360,18 @@ func (x codecSelfer1234) decSliceObjectReference(v *[]ObjectReference, d *codec1 } } - yyh3557.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ObjectReference{} + yyc1 = true + } } - if yyc3557 { - *v = yyv3557 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceServiceAccount(v []ServiceAccount, e *codec1978.Encoder) { @@ -41813,11 +51379,12 @@ func (x codecSelfer1234) encSliceServiceAccount(v []ServiceAccount, e *codec1978 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3561 := range v { - yy3562 := &yyv3561 - yy3562.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceServiceAccount(v *[]ServiceAccount, d *codec1978.Decoder) { @@ -41825,75 +51392,86 @@ func (x codecSelfer1234) decSliceServiceAccount(v *[]ServiceAccount, d *codec197 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3563 := *v - yyh3563, yyl3563 := z.DecSliceHelperStart() - - var yyrr3563, yyrl3563 int - var yyc3563, yyrt3563 bool - _, _, _ = yyc3563, yyrt3563, yyrl3563 - yyrr3563 = yyl3563 - - if yyv3563 == nil { - if yyrl3563, yyrt3563 = z.DecInferLen(yyl3563, z.DecBasicHandle().MaxInitLen, 240); yyrt3563 { - yyrr3563 = yyrl3563 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ServiceAccount{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3563 = make([]ServiceAccount, yyrl3563) - yyc3563 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3563 == 0 { - if len(yyv3563) != 0 { - yyv3563 = yyv3563[:0] - yyc3563 = true - } - } else if yyl3563 > 0 { - - if yyl3563 > cap(yyv3563) { - yyrl3563, yyrt3563 = z.DecInferLen(yyl3563, z.DecBasicHandle().MaxInitLen, 240) - yyv3563 = make([]ServiceAccount, yyrl3563) - yyc3563 = true - - yyrr3563 = len(yyv3563) - } else if yyl3563 != len(yyv3563) { - yyv3563 = yyv3563[:yyl3563] - yyc3563 = true - } - yyj3563 := 0 - for ; yyj3563 < yyrr3563; yyj3563++ { - if r.TryDecodeAsNil() { - yyv3563[yyj3563] = ServiceAccount{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 240) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ServiceAccount, yyrl1) + } } else { - yyv3564 := &yyv3563[yyj3563] - yyv3564.CodecDecodeSelf(d) + yyv1 = make([]ServiceAccount, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ServiceAccount{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3563 { - for ; yyj3563 < yyl3563; yyj3563++ { - yyv3563 = append(yyv3563, ServiceAccount{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ServiceAccount{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3563[yyj3563] = ServiceAccount{} + yyv1[yyj1] = ServiceAccount{} } else { - yyv3565 := &yyv3563[yyj3563] - yyv3565.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3563 := 0; !r.CheckBreak(); yyj3563++ { - if yyj3563 >= len(yyv3563) { - yyv3563 = append(yyv3563, ServiceAccount{}) // var yyz3563 ServiceAccount - yyc3563 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3563 < len(yyv3563) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ServiceAccount{}) // var yyz1 ServiceAccount + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3563[yyj3563] = ServiceAccount{} + yyv1[yyj1] = ServiceAccount{} } else { - yyv3566 := &yyv3563[yyj3563] - yyv3566.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -41901,12 +51479,18 @@ func (x codecSelfer1234) decSliceServiceAccount(v *[]ServiceAccount, d *codec197 } } - yyh3563.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ServiceAccount{} + yyc1 = true + } } - if yyc3563 { - *v = yyv3563 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEndpointSubset(v []EndpointSubset, e *codec1978.Encoder) { @@ -41914,11 +51498,12 @@ func (x codecSelfer1234) encSliceEndpointSubset(v []EndpointSubset, e *codec1978 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3567 := range v { - yy3568 := &yyv3567 - yy3568.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEndpointSubset(v *[]EndpointSubset, d *codec1978.Decoder) { @@ -41926,75 +51511,86 @@ func (x codecSelfer1234) decSliceEndpointSubset(v *[]EndpointSubset, d *codec197 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3569 := *v - yyh3569, yyl3569 := z.DecSliceHelperStart() - - var yyrr3569, yyrl3569 int - var yyc3569, yyrt3569 bool - _, _, _ = yyc3569, yyrt3569, yyrl3569 - yyrr3569 = yyl3569 - - if yyv3569 == nil { - if yyrl3569, yyrt3569 = z.DecInferLen(yyl3569, z.DecBasicHandle().MaxInitLen, 72); yyrt3569 { - yyrr3569 = yyrl3569 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []EndpointSubset{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3569 = make([]EndpointSubset, yyrl3569) - yyc3569 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3569 == 0 { - if len(yyv3569) != 0 { - yyv3569 = yyv3569[:0] - yyc3569 = true - } - } else if yyl3569 > 0 { - - if yyl3569 > cap(yyv3569) { - yyrl3569, yyrt3569 = z.DecInferLen(yyl3569, z.DecBasicHandle().MaxInitLen, 72) - yyv3569 = make([]EndpointSubset, yyrl3569) - yyc3569 = true - - yyrr3569 = len(yyv3569) - } else if yyl3569 != len(yyv3569) { - yyv3569 = yyv3569[:yyl3569] - yyc3569 = true - } - yyj3569 := 0 - for ; yyj3569 < yyrr3569; yyj3569++ { - if r.TryDecodeAsNil() { - yyv3569[yyj3569] = EndpointSubset{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 72) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]EndpointSubset, yyrl1) + } } else { - yyv3570 := &yyv3569[yyj3569] - yyv3570.CodecDecodeSelf(d) + yyv1 = make([]EndpointSubset, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = EndpointSubset{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3569 { - for ; yyj3569 < yyl3569; yyj3569++ { - yyv3569 = append(yyv3569, EndpointSubset{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, EndpointSubset{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3569[yyj3569] = EndpointSubset{} + yyv1[yyj1] = EndpointSubset{} } else { - yyv3571 := &yyv3569[yyj3569] - yyv3571.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3569 := 0; !r.CheckBreak(); yyj3569++ { - if yyj3569 >= len(yyv3569) { - yyv3569 = append(yyv3569, EndpointSubset{}) // var yyz3569 EndpointSubset - yyc3569 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3569 < len(yyv3569) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, EndpointSubset{}) // var yyz1 EndpointSubset + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3569[yyj3569] = EndpointSubset{} + yyv1[yyj1] = EndpointSubset{} } else { - yyv3572 := &yyv3569[yyj3569] - yyv3572.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42002,12 +51598,18 @@ func (x codecSelfer1234) decSliceEndpointSubset(v *[]EndpointSubset, d *codec197 } } - yyh3569.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []EndpointSubset{} + yyc1 = true + } } - if yyc3569 { - *v = yyv3569 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEndpointAddress(v []EndpointAddress, e *codec1978.Encoder) { @@ -42015,11 +51617,12 @@ func (x codecSelfer1234) encSliceEndpointAddress(v []EndpointAddress, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3573 := range v { - yy3574 := &yyv3573 - yy3574.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEndpointAddress(v *[]EndpointAddress, d *codec1978.Decoder) { @@ -42027,75 +51630,86 @@ func (x codecSelfer1234) decSliceEndpointAddress(v *[]EndpointAddress, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3575 := *v - yyh3575, yyl3575 := z.DecSliceHelperStart() - - var yyrr3575, yyrl3575 int - var yyc3575, yyrt3575 bool - _, _, _ = yyc3575, yyrt3575, yyrl3575 - yyrr3575 = yyl3575 - - if yyv3575 == nil { - if yyrl3575, yyrt3575 = z.DecInferLen(yyl3575, z.DecBasicHandle().MaxInitLen, 24); yyrt3575 { - yyrr3575 = yyrl3575 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []EndpointAddress{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3575 = make([]EndpointAddress, yyrl3575) - yyc3575 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3575 == 0 { - if len(yyv3575) != 0 { - yyv3575 = yyv3575[:0] - yyc3575 = true - } - } else if yyl3575 > 0 { - - if yyl3575 > cap(yyv3575) { - yyrl3575, yyrt3575 = z.DecInferLen(yyl3575, z.DecBasicHandle().MaxInitLen, 24) - yyv3575 = make([]EndpointAddress, yyrl3575) - yyc3575 = true - - yyrr3575 = len(yyv3575) - } else if yyl3575 != len(yyv3575) { - yyv3575 = yyv3575[:yyl3575] - yyc3575 = true - } - yyj3575 := 0 - for ; yyj3575 < yyrr3575; yyj3575++ { - if r.TryDecodeAsNil() { - yyv3575[yyj3575] = EndpointAddress{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]EndpointAddress, yyrl1) + } } else { - yyv3576 := &yyv3575[yyj3575] - yyv3576.CodecDecodeSelf(d) + yyv1 = make([]EndpointAddress, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = EndpointAddress{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3575 { - for ; yyj3575 < yyl3575; yyj3575++ { - yyv3575 = append(yyv3575, EndpointAddress{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, EndpointAddress{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3575[yyj3575] = EndpointAddress{} + yyv1[yyj1] = EndpointAddress{} } else { - yyv3577 := &yyv3575[yyj3575] - yyv3577.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3575 := 0; !r.CheckBreak(); yyj3575++ { - if yyj3575 >= len(yyv3575) { - yyv3575 = append(yyv3575, EndpointAddress{}) // var yyz3575 EndpointAddress - yyc3575 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3575 < len(yyv3575) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, EndpointAddress{}) // var yyz1 EndpointAddress + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3575[yyj3575] = EndpointAddress{} + yyv1[yyj1] = EndpointAddress{} } else { - yyv3578 := &yyv3575[yyj3575] - yyv3578.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42103,12 +51717,18 @@ func (x codecSelfer1234) decSliceEndpointAddress(v *[]EndpointAddress, d *codec1 } } - yyh3575.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []EndpointAddress{} + yyc1 = true + } } - if yyc3575 { - *v = yyv3575 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEndpointPort(v []EndpointPort, e *codec1978.Encoder) { @@ -42116,11 +51736,12 @@ func (x codecSelfer1234) encSliceEndpointPort(v []EndpointPort, e *codec1978.Enc z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3579 := range v { - yy3580 := &yyv3579 - yy3580.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEndpointPort(v *[]EndpointPort, d *codec1978.Decoder) { @@ -42128,75 +51749,86 @@ func (x codecSelfer1234) decSliceEndpointPort(v *[]EndpointPort, d *codec1978.De z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3581 := *v - yyh3581, yyl3581 := z.DecSliceHelperStart() - - var yyrr3581, yyrl3581 int - var yyc3581, yyrt3581 bool - _, _, _ = yyc3581, yyrt3581, yyrl3581 - yyrr3581 = yyl3581 - - if yyv3581 == nil { - if yyrl3581, yyrt3581 = z.DecInferLen(yyl3581, z.DecBasicHandle().MaxInitLen, 40); yyrt3581 { - yyrr3581 = yyrl3581 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []EndpointPort{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3581 = make([]EndpointPort, yyrl3581) - yyc3581 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3581 == 0 { - if len(yyv3581) != 0 { - yyv3581 = yyv3581[:0] - yyc3581 = true - } - } else if yyl3581 > 0 { - - if yyl3581 > cap(yyv3581) { - yyrl3581, yyrt3581 = z.DecInferLen(yyl3581, z.DecBasicHandle().MaxInitLen, 40) - yyv3581 = make([]EndpointPort, yyrl3581) - yyc3581 = true - - yyrr3581 = len(yyv3581) - } else if yyl3581 != len(yyv3581) { - yyv3581 = yyv3581[:yyl3581] - yyc3581 = true - } - yyj3581 := 0 - for ; yyj3581 < yyrr3581; yyj3581++ { - if r.TryDecodeAsNil() { - yyv3581[yyj3581] = EndpointPort{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]EndpointPort, yyrl1) + } } else { - yyv3582 := &yyv3581[yyj3581] - yyv3582.CodecDecodeSelf(d) + yyv1 = make([]EndpointPort, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = EndpointPort{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3581 { - for ; yyj3581 < yyl3581; yyj3581++ { - yyv3581 = append(yyv3581, EndpointPort{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, EndpointPort{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3581[yyj3581] = EndpointPort{} + yyv1[yyj1] = EndpointPort{} } else { - yyv3583 := &yyv3581[yyj3581] - yyv3583.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3581 := 0; !r.CheckBreak(); yyj3581++ { - if yyj3581 >= len(yyv3581) { - yyv3581 = append(yyv3581, EndpointPort{}) // var yyz3581 EndpointPort - yyc3581 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3581 < len(yyv3581) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, EndpointPort{}) // var yyz1 EndpointPort + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3581[yyj3581] = EndpointPort{} + yyv1[yyj1] = EndpointPort{} } else { - yyv3584 := &yyv3581[yyj3581] - yyv3584.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42204,12 +51836,18 @@ func (x codecSelfer1234) decSliceEndpointPort(v *[]EndpointPort, d *codec1978.De } } - yyh3581.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []EndpointPort{} + yyc1 = true + } } - if yyc3581 { - *v = yyv3581 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEndpoints(v []Endpoints, e *codec1978.Encoder) { @@ -42217,11 +51855,12 @@ func (x codecSelfer1234) encSliceEndpoints(v []Endpoints, e *codec1978.Encoder) z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3585 := range v { - yy3586 := &yyv3585 - yy3586.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEndpoints(v *[]Endpoints, d *codec1978.Decoder) { @@ -42229,75 +51868,86 @@ func (x codecSelfer1234) decSliceEndpoints(v *[]Endpoints, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3587 := *v - yyh3587, yyl3587 := z.DecSliceHelperStart() - - var yyrr3587, yyrl3587 int - var yyc3587, yyrt3587 bool - _, _, _ = yyc3587, yyrt3587, yyrl3587 - yyrr3587 = yyl3587 - - if yyv3587 == nil { - if yyrl3587, yyrt3587 = z.DecInferLen(yyl3587, z.DecBasicHandle().MaxInitLen, 216); yyrt3587 { - yyrr3587 = yyrl3587 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Endpoints{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3587 = make([]Endpoints, yyrl3587) - yyc3587 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3587 == 0 { - if len(yyv3587) != 0 { - yyv3587 = yyv3587[:0] - yyc3587 = true - } - } else if yyl3587 > 0 { - - if yyl3587 > cap(yyv3587) { - yyrl3587, yyrt3587 = z.DecInferLen(yyl3587, z.DecBasicHandle().MaxInitLen, 216) - yyv3587 = make([]Endpoints, yyrl3587) - yyc3587 = true - - yyrr3587 = len(yyv3587) - } else if yyl3587 != len(yyv3587) { - yyv3587 = yyv3587[:yyl3587] - yyc3587 = true - } - yyj3587 := 0 - for ; yyj3587 < yyrr3587; yyj3587++ { - if r.TryDecodeAsNil() { - yyv3587[yyj3587] = Endpoints{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Endpoints, yyrl1) + } } else { - yyv3588 := &yyv3587[yyj3587] - yyv3588.CodecDecodeSelf(d) + yyv1 = make([]Endpoints, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Endpoints{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3587 { - for ; yyj3587 < yyl3587; yyj3587++ { - yyv3587 = append(yyv3587, Endpoints{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Endpoints{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3587[yyj3587] = Endpoints{} + yyv1[yyj1] = Endpoints{} } else { - yyv3589 := &yyv3587[yyj3587] - yyv3589.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3587 := 0; !r.CheckBreak(); yyj3587++ { - if yyj3587 >= len(yyv3587) { - yyv3587 = append(yyv3587, Endpoints{}) // var yyz3587 Endpoints - yyc3587 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3587 < len(yyv3587) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Endpoints{}) // var yyz1 Endpoints + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3587[yyj3587] = Endpoints{} + yyv1[yyj1] = Endpoints{} } else { - yyv3590 := &yyv3587[yyj3587] - yyv3590.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42305,12 +51955,18 @@ func (x codecSelfer1234) decSliceEndpoints(v *[]Endpoints, d *codec1978.Decoder) } } - yyh3587.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Endpoints{} + yyc1 = true + } } - if yyc3587 { - *v = yyv3587 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceNodeCondition(v []NodeCondition, e *codec1978.Encoder) { @@ -42318,11 +51974,12 @@ func (x codecSelfer1234) encSliceNodeCondition(v []NodeCondition, e *codec1978.E z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3591 := range v { - yy3592 := &yyv3591 - yy3592.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNodeCondition(v *[]NodeCondition, d *codec1978.Decoder) { @@ -42330,75 +51987,86 @@ func (x codecSelfer1234) decSliceNodeCondition(v *[]NodeCondition, d *codec1978. z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3593 := *v - yyh3593, yyl3593 := z.DecSliceHelperStart() - - var yyrr3593, yyrl3593 int - var yyc3593, yyrt3593 bool - _, _, _ = yyc3593, yyrt3593, yyrl3593 - yyrr3593 = yyl3593 - - if yyv3593 == nil { - if yyrl3593, yyrt3593 = z.DecInferLen(yyl3593, z.DecBasicHandle().MaxInitLen, 112); yyrt3593 { - yyrr3593 = yyrl3593 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeCondition{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3593 = make([]NodeCondition, yyrl3593) - yyc3593 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3593 == 0 { - if len(yyv3593) != 0 { - yyv3593 = yyv3593[:0] - yyc3593 = true - } - } else if yyl3593 > 0 { - - if yyl3593 > cap(yyv3593) { - yyrl3593, yyrt3593 = z.DecInferLen(yyl3593, z.DecBasicHandle().MaxInitLen, 112) - yyv3593 = make([]NodeCondition, yyrl3593) - yyc3593 = true - - yyrr3593 = len(yyv3593) - } else if yyl3593 != len(yyv3593) { - yyv3593 = yyv3593[:yyl3593] - yyc3593 = true - } - yyj3593 := 0 - for ; yyj3593 < yyrr3593; yyj3593++ { - if r.TryDecodeAsNil() { - yyv3593[yyj3593] = NodeCondition{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 112) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeCondition, yyrl1) + } } else { - yyv3594 := &yyv3593[yyj3593] - yyv3594.CodecDecodeSelf(d) + yyv1 = make([]NodeCondition, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeCondition{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3593 { - for ; yyj3593 < yyl3593; yyj3593++ { - yyv3593 = append(yyv3593, NodeCondition{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeCondition{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3593[yyj3593] = NodeCondition{} + yyv1[yyj1] = NodeCondition{} } else { - yyv3595 := &yyv3593[yyj3593] - yyv3595.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3593 := 0; !r.CheckBreak(); yyj3593++ { - if yyj3593 >= len(yyv3593) { - yyv3593 = append(yyv3593, NodeCondition{}) // var yyz3593 NodeCondition - yyc3593 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3593 < len(yyv3593) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeCondition{}) // var yyz1 NodeCondition + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3593[yyj3593] = NodeCondition{} + yyv1[yyj1] = NodeCondition{} } else { - yyv3596 := &yyv3593[yyj3593] - yyv3596.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42406,12 +52074,18 @@ func (x codecSelfer1234) decSliceNodeCondition(v *[]NodeCondition, d *codec1978. } } - yyh3593.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeCondition{} + yyc1 = true + } } - if yyc3593 { - *v = yyv3593 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceNodeAddress(v []NodeAddress, e *codec1978.Encoder) { @@ -42419,11 +52093,12 @@ func (x codecSelfer1234) encSliceNodeAddress(v []NodeAddress, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3597 := range v { - yy3598 := &yyv3597 - yy3598.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNodeAddress(v *[]NodeAddress, d *codec1978.Decoder) { @@ -42431,75 +52106,86 @@ func (x codecSelfer1234) decSliceNodeAddress(v *[]NodeAddress, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3599 := *v - yyh3599, yyl3599 := z.DecSliceHelperStart() - - var yyrr3599, yyrl3599 int - var yyc3599, yyrt3599 bool - _, _, _ = yyc3599, yyrt3599, yyrl3599 - yyrr3599 = yyl3599 - - if yyv3599 == nil { - if yyrl3599, yyrt3599 = z.DecInferLen(yyl3599, z.DecBasicHandle().MaxInitLen, 32); yyrt3599 { - yyrr3599 = yyrl3599 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeAddress{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3599 = make([]NodeAddress, yyrl3599) - yyc3599 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3599 == 0 { - if len(yyv3599) != 0 { - yyv3599 = yyv3599[:0] - yyc3599 = true - } - } else if yyl3599 > 0 { - - if yyl3599 > cap(yyv3599) { - yyrl3599, yyrt3599 = z.DecInferLen(yyl3599, z.DecBasicHandle().MaxInitLen, 32) - yyv3599 = make([]NodeAddress, yyrl3599) - yyc3599 = true - - yyrr3599 = len(yyv3599) - } else if yyl3599 != len(yyv3599) { - yyv3599 = yyv3599[:yyl3599] - yyc3599 = true - } - yyj3599 := 0 - for ; yyj3599 < yyrr3599; yyj3599++ { - if r.TryDecodeAsNil() { - yyv3599[yyj3599] = NodeAddress{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeAddress, yyrl1) + } } else { - yyv3600 := &yyv3599[yyj3599] - yyv3600.CodecDecodeSelf(d) + yyv1 = make([]NodeAddress, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeAddress{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3599 { - for ; yyj3599 < yyl3599; yyj3599++ { - yyv3599 = append(yyv3599, NodeAddress{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeAddress{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3599[yyj3599] = NodeAddress{} + yyv1[yyj1] = NodeAddress{} } else { - yyv3601 := &yyv3599[yyj3599] - yyv3601.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3599 := 0; !r.CheckBreak(); yyj3599++ { - if yyj3599 >= len(yyv3599) { - yyv3599 = append(yyv3599, NodeAddress{}) // var yyz3599 NodeAddress - yyc3599 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3599 < len(yyv3599) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeAddress{}) // var yyz1 NodeAddress + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3599[yyj3599] = NodeAddress{} + yyv1[yyj1] = NodeAddress{} } else { - yyv3602 := &yyv3599[yyj3599] - yyv3602.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42507,12 +52193,137 @@ func (x codecSelfer1234) decSliceNodeAddress(v *[]NodeAddress, d *codec1978.Deco } } - yyh3599.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeAddress{} + yyc1 = true + } } - if yyc3599 { - *v = yyv3599 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceContainerImage(v []ContainerImage, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceContainerImage(v *[]ContainerImage, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ContainerImage{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ContainerImage, yyrl1) + } + } else { + yyv1 = make([]ContainerImage, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerImage{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ContainerImage{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerImage{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ContainerImage{}) // var yyz1 ContainerImage + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = ContainerImage{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ContainerImage{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encResourceList(v ResourceList, e *codec1978.Encoder) { @@ -42520,20 +52331,22 @@ func (x codecSelfer1234) encResourceList(v ResourceList, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeMapStart(len(v)) - for yyk3603, yyv3603 := range v { - yyk3603.CodecEncodeSelf(e) - yy3604 := &yyv3603 - yym3605 := z.EncBinary() - _ = yym3605 + for yyk1, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + yyk1.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy3 := &yyv1 + yym4 := z.EncBinary() + _ = yym4 if false { - } else if z.HasExtensions() && z.EncExt(yy3604) { - } else if !yym3605 && z.IsJSONHandle() { - z.EncJSONMarshal(yy3604) + } else if z.HasExtensions() && z.EncExt(yy3) { + } else if !yym4 && z.IsJSONHandle() { + z.EncJSONMarshal(yy3) } else { - z.EncFallback(yy3604) + z.EncFallback(yy3) } } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } func (x codecSelfer1234) decResourceList(v *ResourceList, d *codec1978.Decoder) { @@ -42541,86 +52354,90 @@ func (x codecSelfer1234) decResourceList(v *ResourceList, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3606 := *v - yyl3606 := r.ReadMapStart() - yybh3606 := z.DecBasicHandle() - if yyv3606 == nil { - yyrl3606, _ := z.DecInferLen(yyl3606, yybh3606.MaxInitLen, 40) - yyv3606 = make(map[ResourceName]pkg3_resource.Quantity, yyrl3606) - *v = yyv3606 + yyv1 := *v + yyl1 := r.ReadMapStart() + yybh1 := z.DecBasicHandle() + if yyv1 == nil { + yyrl1, _ := z.DecInferLen(yyl1, yybh1.MaxInitLen, 40) + yyv1 = make(map[ResourceName]pkg3_resource.Quantity, yyrl1) + *v = yyv1 } - var yymk3606 ResourceName - var yymv3606 pkg3_resource.Quantity - var yymg3606 bool - if yybh3606.MapValueReset { - yymg3606 = true + var yymk1 ResourceName + var yymv1 pkg3_resource.Quantity + var yymg1 bool + if yybh1.MapValueReset { + yymg1 = true } - if yyl3606 > 0 { - for yyj3606 := 0; yyj3606 < yyl3606; yyj3606++ { + if yyl1 > 0 { + for yyj1 := 0; yyj1 < yyl1; yyj1++ { + z.DecSendContainerState(codecSelfer_containerMapKey1234) if r.TryDecodeAsNil() { - yymk3606 = "" + yymk1 = "" } else { - yymk3606 = ResourceName(r.DecodeString()) + yymk1 = ResourceName(r.DecodeString()) } - if yymg3606 { - yymv3606 = yyv3606[yymk3606] + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yymv3606 = pkg3_resource.Quantity{} + yymv1 = pkg3_resource.Quantity{} } + z.DecSendContainerState(codecSelfer_containerMapValue1234) if r.TryDecodeAsNil() { - yymv3606 = pkg3_resource.Quantity{} + yymv1 = pkg3_resource.Quantity{} } else { - yyv3608 := &yymv3606 - yym3609 := z.DecBinary() - _ = yym3609 + yyv3 := &yymv1 + yym4 := z.DecBinary() + _ = yym4 if false { - } else if z.HasExtensions() && z.DecExt(yyv3608) { - } else if !yym3609 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv3608) + } else if z.HasExtensions() && z.DecExt(yyv3) { + } else if !yym4 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv3) } else { - z.DecFallback(yyv3608, false) + z.DecFallback(yyv3, false) } } - if yyv3606 != nil { - yyv3606[yymk3606] = yymv3606 + if yyv1 != nil { + yyv1[yymk1] = yymv1 } } - } else if yyl3606 < 0 { - for yyj3606 := 0; !r.CheckBreak(); yyj3606++ { + } else if yyl1 < 0 { + for yyj1 := 0; !r.CheckBreak(); yyj1++ { + z.DecSendContainerState(codecSelfer_containerMapKey1234) if r.TryDecodeAsNil() { - yymk3606 = "" + yymk1 = "" } else { - yymk3606 = ResourceName(r.DecodeString()) + yymk1 = ResourceName(r.DecodeString()) } - if yymg3606 { - yymv3606 = yyv3606[yymk3606] + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yymv3606 = pkg3_resource.Quantity{} + yymv1 = pkg3_resource.Quantity{} } + z.DecSendContainerState(codecSelfer_containerMapValue1234) if r.TryDecodeAsNil() { - yymv3606 = pkg3_resource.Quantity{} + yymv1 = pkg3_resource.Quantity{} } else { - yyv3611 := &yymv3606 - yym3612 := z.DecBinary() - _ = yym3612 + yyv6 := &yymv1 + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv3611) { - } else if !yym3612 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv3611) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv3611, false) + z.DecFallback(yyv6, false) } } - if yyv3606 != nil { - yyv3606[yymk3606] = yymv3606 + if yyv1 != nil { + yyv1[yymk1] = yymv1 } } - r.ReadEnd() } // else len==0: TODO: Should we clear map entries? + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x codecSelfer1234) encSliceNode(v []Node, e *codec1978.Encoder) { @@ -42628,11 +52445,12 @@ func (x codecSelfer1234) encSliceNode(v []Node, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3613 := range v { - yy3614 := &yyv3613 - yy3614.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNode(v *[]Node, d *codec1978.Decoder) { @@ -42640,75 +52458,86 @@ func (x codecSelfer1234) decSliceNode(v *[]Node, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3615 := *v - yyh3615, yyl3615 := z.DecSliceHelperStart() - - var yyrr3615, yyrl3615 int - var yyc3615, yyrt3615 bool - _, _, _ = yyc3615, yyrt3615, yyrl3615 - yyrr3615 = yyl3615 - - if yyv3615 == nil { - if yyrl3615, yyrt3615 = z.DecInferLen(yyl3615, z.DecBasicHandle().MaxInitLen, 456); yyrt3615 { - yyrr3615 = yyrl3615 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Node{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3615 = make([]Node, yyrl3615) - yyc3615 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3615 == 0 { - if len(yyv3615) != 0 { - yyv3615 = yyv3615[:0] - yyc3615 = true - } - } else if yyl3615 > 0 { - - if yyl3615 > cap(yyv3615) { - yyrl3615, yyrt3615 = z.DecInferLen(yyl3615, z.DecBasicHandle().MaxInitLen, 456) - yyv3615 = make([]Node, yyrl3615) - yyc3615 = true - - yyrr3615 = len(yyv3615) - } else if yyl3615 != len(yyv3615) { - yyv3615 = yyv3615[:yyl3615] - yyc3615 = true - } - yyj3615 := 0 - for ; yyj3615 < yyrr3615; yyj3615++ { - if r.TryDecodeAsNil() { - yyv3615[yyj3615] = Node{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 488) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Node, yyrl1) + } } else { - yyv3616 := &yyv3615[yyj3615] - yyv3616.CodecDecodeSelf(d) + yyv1 = make([]Node, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Node{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3615 { - for ; yyj3615 < yyl3615; yyj3615++ { - yyv3615 = append(yyv3615, Node{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Node{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3615[yyj3615] = Node{} + yyv1[yyj1] = Node{} } else { - yyv3617 := &yyv3615[yyj3615] - yyv3617.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3615 := 0; !r.CheckBreak(); yyj3615++ { - if yyj3615 >= len(yyv3615) { - yyv3615 = append(yyv3615, Node{}) // var yyz3615 Node - yyc3615 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3615 < len(yyv3615) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Node{}) // var yyz1 Node + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3615[yyj3615] = Node{} + yyv1[yyj1] = Node{} } else { - yyv3618 := &yyv3615[yyj3615] - yyv3618.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42716,12 +52545,18 @@ func (x codecSelfer1234) decSliceNode(v *[]Node, d *codec1978.Decoder) { } } - yyh3615.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Node{} + yyc1 = true + } } - if yyc3615 { - *v = yyv3615 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceFinalizerName(v []FinalizerName, e *codec1978.Encoder) { @@ -42729,10 +52564,11 @@ func (x codecSelfer1234) encSliceFinalizerName(v []FinalizerName, e *codec1978.E z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3619 := range v { - yyv3619.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yyv1.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceFinalizerName(v *[]FinalizerName, d *codec1978.Decoder) { @@ -42740,77 +52576,78 @@ func (x codecSelfer1234) decSliceFinalizerName(v *[]FinalizerName, d *codec1978. z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3620 := *v - yyh3620, yyl3620 := z.DecSliceHelperStart() - - var yyrr3620, yyrl3620 int - var yyc3620, yyrt3620 bool - _, _, _ = yyc3620, yyrt3620, yyrl3620 - yyrr3620 = yyl3620 - - if yyv3620 == nil { - if yyrl3620, yyrt3620 = z.DecInferLen(yyl3620, z.DecBasicHandle().MaxInitLen, 16); yyrt3620 { - yyrr3620 = yyrl3620 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []FinalizerName{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3620 = make([]FinalizerName, yyrl3620) - yyc3620 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3620 == 0 { - if len(yyv3620) != 0 { - yyv3620 = yyv3620[:0] - yyc3620 = true - } - } else if yyl3620 > 0 { - - if yyl3620 > cap(yyv3620) { - yyrl3620, yyrt3620 = z.DecInferLen(yyl3620, z.DecBasicHandle().MaxInitLen, 16) - - yyv23620 := yyv3620 - yyv3620 = make([]FinalizerName, yyrl3620) - if len(yyv3620) > 0 { - copy(yyv3620, yyv23620[:cap(yyv23620)]) - } - yyc3620 = true - - yyrr3620 = len(yyv3620) - } else if yyl3620 != len(yyv3620) { - yyv3620 = yyv3620[:yyl3620] - yyc3620 = true - } - yyj3620 := 0 - for ; yyj3620 < yyrr3620; yyj3620++ { - if r.TryDecodeAsNil() { - yyv3620[yyj3620] = "" - } else { - yyv3620[yyj3620] = FinalizerName(r.DecodeString()) - } - - } - if yyrt3620 { - for ; yyj3620 < yyl3620; yyj3620++ { - yyv3620 = append(yyv3620, "") - if r.TryDecodeAsNil() { - yyv3620[yyj3620] = "" + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] } else { - yyv3620[yyj3620] = FinalizerName(r.DecodeString()) + yyv1 = make([]FinalizerName, yyrl1) + } + } else { + yyv1 = make([]FinalizerName, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FinalizerName(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FinalizerName(r.DecodeString()) } } } } else { - for yyj3620 := 0; !r.CheckBreak(); yyj3620++ { - if yyj3620 >= len(yyv3620) { - yyv3620 = append(yyv3620, "") // var yyz3620 FinalizerName - yyc3620 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3620 < len(yyv3620) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 FinalizerName + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3620[yyj3620] = "" + yyv1[yyj1] = "" } else { - yyv3620[yyj3620] = FinalizerName(r.DecodeString()) + yyv1[yyj1] = FinalizerName(r.DecodeString()) } } else { @@ -42818,12 +52655,18 @@ func (x codecSelfer1234) decSliceFinalizerName(v *[]FinalizerName, d *codec1978. } } - yyh3620.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []FinalizerName{} + yyc1 = true + } } - if yyc3620 { - *v = yyv3620 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceNamespace(v []Namespace, e *codec1978.Encoder) { @@ -42831,11 +52674,12 @@ func (x codecSelfer1234) encSliceNamespace(v []Namespace, e *codec1978.Encoder) z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3624 := range v { - yy3625 := &yyv3624 - yy3625.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNamespace(v *[]Namespace, d *codec1978.Decoder) { @@ -42843,75 +52687,86 @@ func (x codecSelfer1234) decSliceNamespace(v *[]Namespace, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3626 := *v - yyh3626, yyl3626 := z.DecSliceHelperStart() - - var yyrr3626, yyrl3626 int - var yyc3626, yyrt3626 bool - _, _, _ = yyc3626, yyrt3626, yyrl3626 - yyrr3626 = yyl3626 - - if yyv3626 == nil { - if yyrl3626, yyrt3626 = z.DecInferLen(yyl3626, z.DecBasicHandle().MaxInitLen, 232); yyrt3626 { - yyrr3626 = yyrl3626 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Namespace{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3626 = make([]Namespace, yyrl3626) - yyc3626 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3626 == 0 { - if len(yyv3626) != 0 { - yyv3626 = yyv3626[:0] - yyc3626 = true - } - } else if yyl3626 > 0 { - - if yyl3626 > cap(yyv3626) { - yyrl3626, yyrt3626 = z.DecInferLen(yyl3626, z.DecBasicHandle().MaxInitLen, 232) - yyv3626 = make([]Namespace, yyrl3626) - yyc3626 = true - - yyrr3626 = len(yyv3626) - } else if yyl3626 != len(yyv3626) { - yyv3626 = yyv3626[:yyl3626] - yyc3626 = true - } - yyj3626 := 0 - for ; yyj3626 < yyrr3626; yyj3626++ { - if r.TryDecodeAsNil() { - yyv3626[yyj3626] = Namespace{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 232) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Namespace, yyrl1) + } } else { - yyv3627 := &yyv3626[yyj3626] - yyv3627.CodecDecodeSelf(d) + yyv1 = make([]Namespace, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Namespace{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3626 { - for ; yyj3626 < yyl3626; yyj3626++ { - yyv3626 = append(yyv3626, Namespace{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Namespace{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3626[yyj3626] = Namespace{} + yyv1[yyj1] = Namespace{} } else { - yyv3628 := &yyv3626[yyj3626] - yyv3628.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3626 := 0; !r.CheckBreak(); yyj3626++ { - if yyj3626 >= len(yyv3626) { - yyv3626 = append(yyv3626, Namespace{}) // var yyz3626 Namespace - yyc3626 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3626 < len(yyv3626) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Namespace{}) // var yyz1 Namespace + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3626[yyj3626] = Namespace{} + yyv1[yyj1] = Namespace{} } else { - yyv3629 := &yyv3626[yyj3626] - yyv3629.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -42919,12 +52774,18 @@ func (x codecSelfer1234) decSliceNamespace(v *[]Namespace, d *codec1978.Decoder) } } - yyh3626.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Namespace{} + yyc1 = true + } } - if yyc3626 { - *v = yyv3626 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceEvent(v []Event, e *codec1978.Encoder) { @@ -42932,11 +52793,12 @@ func (x codecSelfer1234) encSliceEvent(v []Event, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3630 := range v { - yy3631 := &yyv3630 - yy3631.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceEvent(v *[]Event, d *codec1978.Decoder) { @@ -42944,75 +52806,86 @@ func (x codecSelfer1234) decSliceEvent(v *[]Event, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3632 := *v - yyh3632, yyl3632 := z.DecSliceHelperStart() - - var yyrr3632, yyrl3632 int - var yyc3632, yyrt3632 bool - _, _, _ = yyc3632, yyrt3632, yyrl3632 - yyrr3632 = yyl3632 - - if yyv3632 == nil { - if yyrl3632, yyrt3632 = z.DecInferLen(yyl3632, z.DecBasicHandle().MaxInitLen, 424); yyrt3632 { - yyrr3632 = yyrl3632 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Event{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3632 = make([]Event, yyrl3632) - yyc3632 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3632 == 0 { - if len(yyv3632) != 0 { - yyv3632 = yyv3632[:0] - yyc3632 = true - } - } else if yyl3632 > 0 { - - if yyl3632 > cap(yyv3632) { - yyrl3632, yyrt3632 = z.DecInferLen(yyl3632, z.DecBasicHandle().MaxInitLen, 424) - yyv3632 = make([]Event, yyrl3632) - yyc3632 = true - - yyrr3632 = len(yyv3632) - } else if yyl3632 != len(yyv3632) { - yyv3632 = yyv3632[:yyl3632] - yyc3632 = true - } - yyj3632 := 0 - for ; yyj3632 < yyrr3632; yyj3632++ { - if r.TryDecodeAsNil() { - yyv3632[yyj3632] = Event{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 440) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Event, yyrl1) + } } else { - yyv3633 := &yyv3632[yyj3632] - yyv3633.CodecDecodeSelf(d) + yyv1 = make([]Event, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Event{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3632 { - for ; yyj3632 < yyl3632; yyj3632++ { - yyv3632 = append(yyv3632, Event{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Event{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3632[yyj3632] = Event{} + yyv1[yyj1] = Event{} } else { - yyv3634 := &yyv3632[yyj3632] - yyv3634.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3632 := 0; !r.CheckBreak(); yyj3632++ { - if yyj3632 >= len(yyv3632) { - yyv3632 = append(yyv3632, Event{}) // var yyz3632 Event - yyc3632 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3632 < len(yyv3632) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Event{}) // var yyz1 Event + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3632[yyj3632] = Event{} + yyv1[yyj1] = Event{} } else { - yyv3635 := &yyv3632[yyj3632] - yyv3635.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43020,12 +52893,18 @@ func (x codecSelfer1234) decSliceEvent(v *[]Event, d *codec1978.Decoder) { } } - yyh3632.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Event{} + yyc1 = true + } } - if yyc3632 { - *v = yyv3632 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceruntime_RawExtension(v []pkg6_runtime.RawExtension, e *codec1978.Encoder) { @@ -43033,19 +52912,20 @@ func (x codecSelfer1234) encSliceruntime_RawExtension(v []pkg6_runtime.RawExtens z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3636 := range v { - yy3637 := &yyv3636 - yym3638 := z.EncBinary() - _ = yym3638 + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yym3 := z.EncBinary() + _ = yym3 if false { - } else if z.HasExtensions() && z.EncExt(yy3637) { - } else if !yym3638 && z.IsJSONHandle() { - z.EncJSONMarshal(yy3637) + } else if z.HasExtensions() && z.EncExt(yy2) { + } else if !yym3 && z.IsJSONHandle() { + z.EncJSONMarshal(yy2) } else { - z.EncFallback(yy3637) + z.EncFallback(yy2) } } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceruntime_RawExtension(v *[]pkg6_runtime.RawExtension, d *codec1978.Decoder) { @@ -43053,72 +52933,81 @@ func (x codecSelfer1234) decSliceruntime_RawExtension(v *[]pkg6_runtime.RawExten z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3639 := *v - yyh3639, yyl3639 := z.DecSliceHelperStart() - - var yyrr3639, yyrl3639 int - var yyc3639, yyrt3639 bool - _, _, _ = yyc3639, yyrt3639, yyrl3639 - yyrr3639 = yyl3639 - - if yyv3639 == nil { - if yyrl3639, yyrt3639 = z.DecInferLen(yyl3639, z.DecBasicHandle().MaxInitLen, 24); yyrt3639 { - yyrr3639 = yyrl3639 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []pkg6_runtime.RawExtension{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3639 = make([]pkg6_runtime.RawExtension, yyrl3639) - yyc3639 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3639 == 0 { - if len(yyv3639) != 0 { - yyv3639 = yyv3639[:0] - yyc3639 = true - } - } else if yyl3639 > 0 { - - if yyl3639 > cap(yyv3639) { - yyrl3639, yyrt3639 = z.DecInferLen(yyl3639, z.DecBasicHandle().MaxInitLen, 24) - yyv3639 = make([]pkg6_runtime.RawExtension, yyrl3639) - yyc3639 = true - - yyrr3639 = len(yyv3639) - } else if yyl3639 != len(yyv3639) { - yyv3639 = yyv3639[:yyl3639] - yyc3639 = true - } - yyj3639 := 0 - for ; yyj3639 < yyrr3639; yyj3639++ { - if r.TryDecodeAsNil() { - yyv3639[yyj3639] = pkg6_runtime.RawExtension{} - } else { - yyv3640 := &yyv3639[yyj3639] - yym3641 := z.DecBinary() - _ = yym3641 - if false { - } else if z.HasExtensions() && z.DecExt(yyv3640) { - } else if !yym3641 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv3640) + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] } else { - z.DecFallback(yyv3640, false) + yyv1 = make([]pkg6_runtime.RawExtension, yyrl1) + } + } else { + yyv1 = make([]pkg6_runtime.RawExtension, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = pkg6_runtime.RawExtension{} + } else { + yyv2 := &yyv1[yyj1] + yym3 := z.DecBinary() + _ = yym3 + if false { + } else if z.HasExtensions() && z.DecExt(yyv2) { + } else if !yym3 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv2) + } else { + z.DecFallback(yyv2, false) } } } - if yyrt3639 { - for ; yyj3639 < yyl3639; yyj3639++ { - yyv3639 = append(yyv3639, pkg6_runtime.RawExtension{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, pkg6_runtime.RawExtension{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3639[yyj3639] = pkg6_runtime.RawExtension{} + yyv1[yyj1] = pkg6_runtime.RawExtension{} } else { - yyv3642 := &yyv3639[yyj3639] - yym3643 := z.DecBinary() - _ = yym3643 + yyv4 := &yyv1[yyj1] + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv3642) { - } else if !yym3643 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv3642) + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else if !yym5 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv4) } else { - z.DecFallback(yyv3642, false) + z.DecFallback(yyv4, false) } } @@ -43126,25 +53015,27 @@ func (x codecSelfer1234) decSliceruntime_RawExtension(v *[]pkg6_runtime.RawExten } } else { - for yyj3639 := 0; !r.CheckBreak(); yyj3639++ { - if yyj3639 >= len(yyv3639) { - yyv3639 = append(yyv3639, pkg6_runtime.RawExtension{}) // var yyz3639 pkg6_runtime.RawExtension - yyc3639 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3639 < len(yyv3639) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, pkg6_runtime.RawExtension{}) // var yyz1 pkg6_runtime.RawExtension + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3639[yyj3639] = pkg6_runtime.RawExtension{} + yyv1[yyj1] = pkg6_runtime.RawExtension{} } else { - yyv3644 := &yyv3639[yyj3639] - yym3645 := z.DecBinary() - _ = yym3645 + yyv6 := &yyv1[yyj1] + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv3644) { - } else if !yym3645 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv3644) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv3644, false) + z.DecFallback(yyv6, false) } } @@ -43153,12 +53044,18 @@ func (x codecSelfer1234) decSliceruntime_RawExtension(v *[]pkg6_runtime.RawExten } } - yyh3639.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []pkg6_runtime.RawExtension{} + yyc1 = true + } } - if yyc3639 { - *v = yyv3639 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceLimitRangeItem(v []LimitRangeItem, e *codec1978.Encoder) { @@ -43166,11 +53063,12 @@ func (x codecSelfer1234) encSliceLimitRangeItem(v []LimitRangeItem, e *codec1978 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3646 := range v { - yy3647 := &yyv3646 - yy3647.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceLimitRangeItem(v *[]LimitRangeItem, d *codec1978.Decoder) { @@ -43178,75 +53076,86 @@ func (x codecSelfer1234) decSliceLimitRangeItem(v *[]LimitRangeItem, d *codec197 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3648 := *v - yyh3648, yyl3648 := z.DecSliceHelperStart() - - var yyrr3648, yyrl3648 int - var yyc3648, yyrt3648 bool - _, _, _ = yyc3648, yyrt3648, yyrl3648 - yyrr3648 = yyl3648 - - if yyv3648 == nil { - if yyrl3648, yyrt3648 = z.DecInferLen(yyl3648, z.DecBasicHandle().MaxInitLen, 56); yyrt3648 { - yyrr3648 = yyrl3648 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []LimitRangeItem{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3648 = make([]LimitRangeItem, yyrl3648) - yyc3648 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3648 == 0 { - if len(yyv3648) != 0 { - yyv3648 = yyv3648[:0] - yyc3648 = true - } - } else if yyl3648 > 0 { - - if yyl3648 > cap(yyv3648) { - yyrl3648, yyrt3648 = z.DecInferLen(yyl3648, z.DecBasicHandle().MaxInitLen, 56) - yyv3648 = make([]LimitRangeItem, yyrl3648) - yyc3648 = true - - yyrr3648 = len(yyv3648) - } else if yyl3648 != len(yyv3648) { - yyv3648 = yyv3648[:yyl3648] - yyc3648 = true - } - yyj3648 := 0 - for ; yyj3648 < yyrr3648; yyj3648++ { - if r.TryDecodeAsNil() { - yyv3648[yyj3648] = LimitRangeItem{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 56) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]LimitRangeItem, yyrl1) + } } else { - yyv3649 := &yyv3648[yyj3648] - yyv3649.CodecDecodeSelf(d) + yyv1 = make([]LimitRangeItem, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = LimitRangeItem{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3648 { - for ; yyj3648 < yyl3648; yyj3648++ { - yyv3648 = append(yyv3648, LimitRangeItem{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, LimitRangeItem{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3648[yyj3648] = LimitRangeItem{} + yyv1[yyj1] = LimitRangeItem{} } else { - yyv3650 := &yyv3648[yyj3648] - yyv3650.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3648 := 0; !r.CheckBreak(); yyj3648++ { - if yyj3648 >= len(yyv3648) { - yyv3648 = append(yyv3648, LimitRangeItem{}) // var yyz3648 LimitRangeItem - yyc3648 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3648 < len(yyv3648) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LimitRangeItem{}) // var yyz1 LimitRangeItem + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3648[yyj3648] = LimitRangeItem{} + yyv1[yyj1] = LimitRangeItem{} } else { - yyv3651 := &yyv3648[yyj3648] - yyv3651.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43254,12 +53163,18 @@ func (x codecSelfer1234) decSliceLimitRangeItem(v *[]LimitRangeItem, d *codec197 } } - yyh3648.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []LimitRangeItem{} + yyc1 = true + } } - if yyc3648 { - *v = yyv3648 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceLimitRange(v []LimitRange, e *codec1978.Encoder) { @@ -43267,11 +53182,12 @@ func (x codecSelfer1234) encSliceLimitRange(v []LimitRange, e *codec1978.Encoder z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3652 := range v { - yy3653 := &yyv3652 - yy3653.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceLimitRange(v *[]LimitRange, d *codec1978.Decoder) { @@ -43279,75 +53195,86 @@ func (x codecSelfer1234) decSliceLimitRange(v *[]LimitRange, d *codec1978.Decode z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3654 := *v - yyh3654, yyl3654 := z.DecSliceHelperStart() - - var yyrr3654, yyrl3654 int - var yyc3654, yyrt3654 bool - _, _, _ = yyc3654, yyrt3654, yyrl3654 - yyrr3654 = yyl3654 - - if yyv3654 == nil { - if yyrl3654, yyrt3654 = z.DecInferLen(yyl3654, z.DecBasicHandle().MaxInitLen, 216); yyrt3654 { - yyrr3654 = yyrl3654 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []LimitRange{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3654 = make([]LimitRange, yyrl3654) - yyc3654 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3654 == 0 { - if len(yyv3654) != 0 { - yyv3654 = yyv3654[:0] - yyc3654 = true - } - } else if yyl3654 > 0 { - - if yyl3654 > cap(yyv3654) { - yyrl3654, yyrt3654 = z.DecInferLen(yyl3654, z.DecBasicHandle().MaxInitLen, 216) - yyv3654 = make([]LimitRange, yyrl3654) - yyc3654 = true - - yyrr3654 = len(yyv3654) - } else if yyl3654 != len(yyv3654) { - yyv3654 = yyv3654[:yyl3654] - yyc3654 = true - } - yyj3654 := 0 - for ; yyj3654 < yyrr3654; yyj3654++ { - if r.TryDecodeAsNil() { - yyv3654[yyj3654] = LimitRange{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]LimitRange, yyrl1) + } } else { - yyv3655 := &yyv3654[yyj3654] - yyv3655.CodecDecodeSelf(d) + yyv1 = make([]LimitRange, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = LimitRange{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3654 { - for ; yyj3654 < yyl3654; yyj3654++ { - yyv3654 = append(yyv3654, LimitRange{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, LimitRange{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3654[yyj3654] = LimitRange{} + yyv1[yyj1] = LimitRange{} } else { - yyv3656 := &yyv3654[yyj3654] - yyv3656.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3654 := 0; !r.CheckBreak(); yyj3654++ { - if yyj3654 >= len(yyv3654) { - yyv3654 = append(yyv3654, LimitRange{}) // var yyz3654 LimitRange - yyc3654 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3654 < len(yyv3654) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LimitRange{}) // var yyz1 LimitRange + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3654[yyj3654] = LimitRange{} + yyv1[yyj1] = LimitRange{} } else { - yyv3657 := &yyv3654[yyj3654] - yyv3657.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43355,12 +53282,18 @@ func (x codecSelfer1234) decSliceLimitRange(v *[]LimitRange, d *codec1978.Decode } } - yyh3654.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []LimitRange{} + yyc1 = true + } } - if yyc3654 { - *v = yyv3654 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceResourceQuota(v []ResourceQuota, e *codec1978.Encoder) { @@ -43368,11 +53301,12 @@ func (x codecSelfer1234) encSliceResourceQuota(v []ResourceQuota, e *codec1978.E z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3658 := range v { - yy3659 := &yyv3658 - yy3659.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceResourceQuota(v *[]ResourceQuota, d *codec1978.Decoder) { @@ -43380,75 +53314,86 @@ func (x codecSelfer1234) decSliceResourceQuota(v *[]ResourceQuota, d *codec1978. z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3660 := *v - yyh3660, yyl3660 := z.DecSliceHelperStart() - - var yyrr3660, yyrl3660 int - var yyc3660, yyrt3660 bool - _, _, _ = yyc3660, yyrt3660, yyrl3660 - yyrr3660 = yyl3660 - - if yyv3660 == nil { - if yyrl3660, yyrt3660 = z.DecInferLen(yyl3660, z.DecBasicHandle().MaxInitLen, 216); yyrt3660 { - yyrr3660 = yyrl3660 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ResourceQuota{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3660 = make([]ResourceQuota, yyrl3660) - yyc3660 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3660 == 0 { - if len(yyv3660) != 0 { - yyv3660 = yyv3660[:0] - yyc3660 = true - } - } else if yyl3660 > 0 { - - if yyl3660 > cap(yyv3660) { - yyrl3660, yyrt3660 = z.DecInferLen(yyl3660, z.DecBasicHandle().MaxInitLen, 216) - yyv3660 = make([]ResourceQuota, yyrl3660) - yyc3660 = true - - yyrr3660 = len(yyv3660) - } else if yyl3660 != len(yyv3660) { - yyv3660 = yyv3660[:yyl3660] - yyc3660 = true - } - yyj3660 := 0 - for ; yyj3660 < yyrr3660; yyj3660++ { - if r.TryDecodeAsNil() { - yyv3660[yyj3660] = ResourceQuota{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ResourceQuota, yyrl1) + } } else { - yyv3661 := &yyv3660[yyj3660] - yyv3661.CodecDecodeSelf(d) + yyv1 = make([]ResourceQuota, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ResourceQuota{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3660 { - for ; yyj3660 < yyl3660; yyj3660++ { - yyv3660 = append(yyv3660, ResourceQuota{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ResourceQuota{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3660[yyj3660] = ResourceQuota{} + yyv1[yyj1] = ResourceQuota{} } else { - yyv3662 := &yyv3660[yyj3660] - yyv3662.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3660 := 0; !r.CheckBreak(); yyj3660++ { - if yyj3660 >= len(yyv3660) { - yyv3660 = append(yyv3660, ResourceQuota{}) // var yyz3660 ResourceQuota - yyc3660 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3660 < len(yyv3660) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ResourceQuota{}) // var yyz1 ResourceQuota + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3660[yyj3660] = ResourceQuota{} + yyv1[yyj1] = ResourceQuota{} } else { - yyv3663 := &yyv3660[yyj3660] - yyv3663.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43456,12 +53401,18 @@ func (x codecSelfer1234) decSliceResourceQuota(v *[]ResourceQuota, d *codec1978. } } - yyh3660.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ResourceQuota{} + yyc1 = true + } } - if yyc3660 { - *v = yyv3660 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encMapstringSliceuint8(v map[string][]uint8, e *codec1978.Encoder) { @@ -43469,25 +53420,27 @@ func (x codecSelfer1234) encMapstringSliceuint8(v map[string][]uint8, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeMapStart(len(v)) - for yyk3664, yyv3664 := range v { - yym3665 := z.EncBinary() - _ = yym3665 + for yyk1, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + yym2 := z.EncBinary() + _ = yym2 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(yyk3664)) + r.EncodeString(codecSelferC_UTF81234, string(yyk1)) } - if yyv3664 == nil { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyv1 == nil { r.EncodeNil() } else { - yym3666 := z.EncBinary() - _ = yym3666 + yym3 := z.EncBinary() + _ = yym3 if false { } else { - r.EncodeStringBytes(codecSelferC_RAW1234, []byte(yyv3664)) + r.EncodeStringBytes(codecSelferC_RAW1234, []byte(yyv1)) } } } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } func (x codecSelfer1234) decMapstringSliceuint8(v *map[string][]uint8, d *codec1978.Decoder) { @@ -43495,80 +53448,199 @@ func (x codecSelfer1234) decMapstringSliceuint8(v *map[string][]uint8, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3667 := *v - yyl3667 := r.ReadMapStart() - yybh3667 := z.DecBasicHandle() - if yyv3667 == nil { - yyrl3667, _ := z.DecInferLen(yyl3667, yybh3667.MaxInitLen, 40) - yyv3667 = make(map[string][]uint8, yyrl3667) - *v = yyv3667 + yyv1 := *v + yyl1 := r.ReadMapStart() + yybh1 := z.DecBasicHandle() + if yyv1 == nil { + yyrl1, _ := z.DecInferLen(yyl1, yybh1.MaxInitLen, 40) + yyv1 = make(map[string][]uint8, yyrl1) + *v = yyv1 } - var yymk3667 string - var yymv3667 []uint8 - var yymg3667 bool - if yybh3667.MapValueReset { - yymg3667 = true + var yymk1 string + var yymv1 []uint8 + var yymg1 bool + if yybh1.MapValueReset { + yymg1 = true } - if yyl3667 > 0 { - for yyj3667 := 0; yyj3667 < yyl3667; yyj3667++ { + if yyl1 > 0 { + for yyj1 := 0; yyj1 < yyl1; yyj1++ { + z.DecSendContainerState(codecSelfer_containerMapKey1234) if r.TryDecodeAsNil() { - yymk3667 = "" + yymk1 = "" } else { - yymk3667 = string(r.DecodeString()) + yymk1 = string(r.DecodeString()) } - if yymg3667 { - yymv3667 = yyv3667[yymk3667] + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yymv3667 = nil + yymv1 = nil } + z.DecSendContainerState(codecSelfer_containerMapValue1234) if r.TryDecodeAsNil() { - yymv3667 = nil + yymv1 = nil } else { - yyv3669 := &yymv3667 - yym3670 := z.DecBinary() - _ = yym3670 + yyv3 := &yymv1 + yym4 := z.DecBinary() + _ = yym4 if false { } else { - *yyv3669 = r.DecodeBytes(*(*[]byte)(yyv3669), false, false) + *yyv3 = r.DecodeBytes(*(*[]byte)(yyv3), false, false) } } - if yyv3667 != nil { - yyv3667[yymk3667] = yymv3667 + if yyv1 != nil { + yyv1[yymk1] = yymv1 } } - } else if yyl3667 < 0 { - for yyj3667 := 0; !r.CheckBreak(); yyj3667++ { + } else if yyl1 < 0 { + for yyj1 := 0; !r.CheckBreak(); yyj1++ { + z.DecSendContainerState(codecSelfer_containerMapKey1234) if r.TryDecodeAsNil() { - yymk3667 = "" + yymk1 = "" } else { - yymk3667 = string(r.DecodeString()) + yymk1 = string(r.DecodeString()) } - if yymg3667 { - yymv3667 = yyv3667[yymk3667] + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yymv3667 = nil + yymv1 = nil } + z.DecSendContainerState(codecSelfer_containerMapValue1234) if r.TryDecodeAsNil() { - yymv3667 = nil + yymv1 = nil } else { - yyv3672 := &yymv3667 - yym3673 := z.DecBinary() - _ = yym3673 + yyv6 := &yymv1 + yym7 := z.DecBinary() + _ = yym7 if false { } else { - *yyv3672 = r.DecodeBytes(*(*[]byte)(yyv3672), false, false) + *yyv6 = r.DecodeBytes(*(*[]byte)(yyv6), false, false) } } - if yyv3667 != nil { - yyv3667[yymk3667] = yymv3667 + if yyv1 != nil { + yyv1[yymk1] = yymv1 } } - r.ReadEnd() } // else len==0: TODO: Should we clear map entries? + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x codecSelfer1234) encSliceuint8(v []uint8, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym2 := z.EncBinary() + _ = yym2 + if false { + } else { + r.EncodeUint(uint64(yyv1)) + } + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceuint8(v *[]uint8, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []uint8{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]uint8, yyrl1) + } + } else { + yyv1 = make([]uint8, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = 0 + } else { + yyv1[yyj1] = uint8(r.DecodeUint(8)) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, 0) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = 0 + } else { + yyv1[yyj1] = uint8(r.DecodeUint(8)) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, 0) // var yyz1 uint8 + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = 0 + } else { + yyv1[yyj1] = uint8(r.DecodeUint(8)) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []uint8{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceSecret(v []Secret, e *codec1978.Encoder) { @@ -43576,11 +53648,12 @@ func (x codecSelfer1234) encSliceSecret(v []Secret, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3674 := range v { - yy3675 := &yyv3674 - yy3675.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceSecret(v *[]Secret, d *codec1978.Decoder) { @@ -43588,75 +53661,86 @@ func (x codecSelfer1234) decSliceSecret(v *[]Secret, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3676 := *v - yyh3676, yyl3676 := z.DecSliceHelperStart() - - var yyrr3676, yyrl3676 int - var yyc3676, yyrt3676 bool - _, _, _ = yyc3676, yyrt3676, yyrl3676 - yyrr3676 = yyl3676 - - if yyv3676 == nil { - if yyrl3676, yyrt3676 = z.DecInferLen(yyl3676, z.DecBasicHandle().MaxInitLen, 216); yyrt3676 { - yyrr3676 = yyrl3676 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Secret{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3676 = make([]Secret, yyrl3676) - yyc3676 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3676 == 0 { - if len(yyv3676) != 0 { - yyv3676 = yyv3676[:0] - yyc3676 = true - } - } else if yyl3676 > 0 { - - if yyl3676 > cap(yyv3676) { - yyrl3676, yyrt3676 = z.DecInferLen(yyl3676, z.DecBasicHandle().MaxInitLen, 216) - yyv3676 = make([]Secret, yyrl3676) - yyc3676 = true - - yyrr3676 = len(yyv3676) - } else if yyl3676 != len(yyv3676) { - yyv3676 = yyv3676[:yyl3676] - yyc3676 = true - } - yyj3676 := 0 - for ; yyj3676 < yyrr3676; yyj3676++ { - if r.TryDecodeAsNil() { - yyv3676[yyj3676] = Secret{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Secret, yyrl1) + } } else { - yyv3677 := &yyv3676[yyj3676] - yyv3677.CodecDecodeSelf(d) + yyv1 = make([]Secret, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Secret{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3676 { - for ; yyj3676 < yyl3676; yyj3676++ { - yyv3676 = append(yyv3676, Secret{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Secret{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3676[yyj3676] = Secret{} + yyv1[yyj1] = Secret{} } else { - yyv3678 := &yyv3676[yyj3676] - yyv3678.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3676 := 0; !r.CheckBreak(); yyj3676++ { - if yyj3676 >= len(yyv3676) { - yyv3676 = append(yyv3676, Secret{}) // var yyz3676 Secret - yyc3676 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3676 < len(yyv3676) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Secret{}) // var yyz1 Secret + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3676[yyj3676] = Secret{} + yyv1[yyj1] = Secret{} } else { - yyv3679 := &yyv3676[yyj3676] - yyv3679.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43664,12 +53748,137 @@ func (x codecSelfer1234) decSliceSecret(v *[]Secret, d *codec1978.Decoder) { } } - yyh3676.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Secret{} + yyc1 = true + } } - if yyc3676 { - *v = yyv3676 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceConfigMap(v []ConfigMap, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceConfigMap(v *[]ConfigMap, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ConfigMap{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 200) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ConfigMap, yyrl1) + } + } else { + yyv1 = make([]ConfigMap, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ConfigMap{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ConfigMap{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ConfigMap{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ConfigMap{}) // var yyz1 ConfigMap + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = ConfigMap{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ConfigMap{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceComponentCondition(v []ComponentCondition, e *codec1978.Encoder) { @@ -43677,11 +53886,12 @@ func (x codecSelfer1234) encSliceComponentCondition(v []ComponentCondition, e *c z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3680 := range v { - yy3681 := &yyv3680 - yy3681.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceComponentCondition(v *[]ComponentCondition, d *codec1978.Decoder) { @@ -43689,75 +53899,86 @@ func (x codecSelfer1234) decSliceComponentCondition(v *[]ComponentCondition, d * z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3682 := *v - yyh3682, yyl3682 := z.DecSliceHelperStart() - - var yyrr3682, yyrl3682 int - var yyc3682, yyrt3682 bool - _, _, _ = yyc3682, yyrt3682, yyrl3682 - yyrr3682 = yyl3682 - - if yyv3682 == nil { - if yyrl3682, yyrt3682 = z.DecInferLen(yyl3682, z.DecBasicHandle().MaxInitLen, 64); yyrt3682 { - yyrr3682 = yyrl3682 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ComponentCondition{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3682 = make([]ComponentCondition, yyrl3682) - yyc3682 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3682 == 0 { - if len(yyv3682) != 0 { - yyv3682 = yyv3682[:0] - yyc3682 = true - } - } else if yyl3682 > 0 { - - if yyl3682 > cap(yyv3682) { - yyrl3682, yyrt3682 = z.DecInferLen(yyl3682, z.DecBasicHandle().MaxInitLen, 64) - yyv3682 = make([]ComponentCondition, yyrl3682) - yyc3682 = true - - yyrr3682 = len(yyv3682) - } else if yyl3682 != len(yyv3682) { - yyv3682 = yyv3682[:yyl3682] - yyc3682 = true - } - yyj3682 := 0 - for ; yyj3682 < yyrr3682; yyj3682++ { - if r.TryDecodeAsNil() { - yyv3682[yyj3682] = ComponentCondition{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 64) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ComponentCondition, yyrl1) + } } else { - yyv3683 := &yyv3682[yyj3682] - yyv3683.CodecDecodeSelf(d) + yyv1 = make([]ComponentCondition, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ComponentCondition{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3682 { - for ; yyj3682 < yyl3682; yyj3682++ { - yyv3682 = append(yyv3682, ComponentCondition{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ComponentCondition{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3682[yyj3682] = ComponentCondition{} + yyv1[yyj1] = ComponentCondition{} } else { - yyv3684 := &yyv3682[yyj3682] - yyv3684.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3682 := 0; !r.CheckBreak(); yyj3682++ { - if yyj3682 >= len(yyv3682) { - yyv3682 = append(yyv3682, ComponentCondition{}) // var yyz3682 ComponentCondition - yyc3682 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3682 < len(yyv3682) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ComponentCondition{}) // var yyz1 ComponentCondition + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3682[yyj3682] = ComponentCondition{} + yyv1[yyj1] = ComponentCondition{} } else { - yyv3685 := &yyv3682[yyj3682] - yyv3685.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43765,12 +53986,18 @@ func (x codecSelfer1234) decSliceComponentCondition(v *[]ComponentCondition, d * } } - yyh3682.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ComponentCondition{} + yyc1 = true + } } - if yyc3682 { - *v = yyv3682 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceComponentStatus(v []ComponentStatus, e *codec1978.Encoder) { @@ -43778,11 +54005,12 @@ func (x codecSelfer1234) encSliceComponentStatus(v []ComponentStatus, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3686 := range v { - yy3687 := &yyv3686 - yy3687.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceComponentStatus(v *[]ComponentStatus, d *codec1978.Decoder) { @@ -43790,75 +54018,86 @@ func (x codecSelfer1234) decSliceComponentStatus(v *[]ComponentStatus, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3688 := *v - yyh3688, yyl3688 := z.DecSliceHelperStart() - - var yyrr3688, yyrl3688 int - var yyc3688, yyrt3688 bool - _, _, _ = yyc3688, yyrt3688, yyrl3688 - yyrr3688 = yyl3688 - - if yyv3688 == nil { - if yyrl3688, yyrt3688 = z.DecInferLen(yyl3688, z.DecBasicHandle().MaxInitLen, 216); yyrt3688 { - yyrr3688 = yyrl3688 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ComponentStatus{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3688 = make([]ComponentStatus, yyrl3688) - yyc3688 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3688 == 0 { - if len(yyv3688) != 0 { - yyv3688 = yyv3688[:0] - yyc3688 = true - } - } else if yyl3688 > 0 { - - if yyl3688 > cap(yyv3688) { - yyrl3688, yyrt3688 = z.DecInferLen(yyl3688, z.DecBasicHandle().MaxInitLen, 216) - yyv3688 = make([]ComponentStatus, yyrl3688) - yyc3688 = true - - yyrr3688 = len(yyv3688) - } else if yyl3688 != len(yyv3688) { - yyv3688 = yyv3688[:yyl3688] - yyc3688 = true - } - yyj3688 := 0 - for ; yyj3688 < yyrr3688; yyj3688++ { - if r.TryDecodeAsNil() { - yyv3688[yyj3688] = ComponentStatus{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ComponentStatus, yyrl1) + } } else { - yyv3689 := &yyv3688[yyj3688] - yyv3689.CodecDecodeSelf(d) + yyv1 = make([]ComponentStatus, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ComponentStatus{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3688 { - for ; yyj3688 < yyl3688; yyj3688++ { - yyv3688 = append(yyv3688, ComponentStatus{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ComponentStatus{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3688[yyj3688] = ComponentStatus{} + yyv1[yyj1] = ComponentStatus{} } else { - yyv3690 := &yyv3688[yyj3688] - yyv3690.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3688 := 0; !r.CheckBreak(); yyj3688++ { - if yyj3688 >= len(yyv3688) { - yyv3688 = append(yyv3688, ComponentStatus{}) // var yyz3688 ComponentStatus - yyc3688 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3688 < len(yyv3688) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ComponentStatus{}) // var yyz1 ComponentStatus + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3688[yyj3688] = ComponentStatus{} + yyv1[yyj1] = ComponentStatus{} } else { - yyv3691 := &yyv3688[yyj3688] - yyv3691.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43866,12 +54105,18 @@ func (x codecSelfer1234) decSliceComponentStatus(v *[]ComponentStatus, d *codec1 } } - yyh3688.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ComponentStatus{} + yyc1 = true + } } - if yyc3688 { - *v = yyv3688 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceDownwardAPIVolumeFile(v []DownwardAPIVolumeFile, e *codec1978.Encoder) { @@ -43879,11 +54124,12 @@ func (x codecSelfer1234) encSliceDownwardAPIVolumeFile(v []DownwardAPIVolumeFile z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv3692 := range v { - yy3693 := &yyv3692 - yy3693.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceDownwardAPIVolumeFile(v *[]DownwardAPIVolumeFile, d *codec1978.Decoder) { @@ -43891,75 +54137,86 @@ func (x codecSelfer1234) decSliceDownwardAPIVolumeFile(v *[]DownwardAPIVolumeFil z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv3694 := *v - yyh3694, yyl3694 := z.DecSliceHelperStart() - - var yyrr3694, yyrl3694 int - var yyc3694, yyrt3694 bool - _, _, _ = yyc3694, yyrt3694, yyrl3694 - yyrr3694 = yyl3694 - - if yyv3694 == nil { - if yyrl3694, yyrt3694 = z.DecInferLen(yyl3694, z.DecBasicHandle().MaxInitLen, 48); yyrt3694 { - yyrr3694 = yyrl3694 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []DownwardAPIVolumeFile{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv3694 = make([]DownwardAPIVolumeFile, yyrl3694) - yyc3694 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl3694 == 0 { - if len(yyv3694) != 0 { - yyv3694 = yyv3694[:0] - yyc3694 = true - } - } else if yyl3694 > 0 { - - if yyl3694 > cap(yyv3694) { - yyrl3694, yyrt3694 = z.DecInferLen(yyl3694, z.DecBasicHandle().MaxInitLen, 48) - yyv3694 = make([]DownwardAPIVolumeFile, yyrl3694) - yyc3694 = true - - yyrr3694 = len(yyv3694) - } else if yyl3694 != len(yyv3694) { - yyv3694 = yyv3694[:yyl3694] - yyc3694 = true - } - yyj3694 := 0 - for ; yyj3694 < yyrr3694; yyj3694++ { - if r.TryDecodeAsNil() { - yyv3694[yyj3694] = DownwardAPIVolumeFile{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 48) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]DownwardAPIVolumeFile, yyrl1) + } } else { - yyv3695 := &yyv3694[yyj3694] - yyv3695.CodecDecodeSelf(d) + yyv1 = make([]DownwardAPIVolumeFile, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = DownwardAPIVolumeFile{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt3694 { - for ; yyj3694 < yyl3694; yyj3694++ { - yyv3694 = append(yyv3694, DownwardAPIVolumeFile{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, DownwardAPIVolumeFile{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv3694[yyj3694] = DownwardAPIVolumeFile{} + yyv1[yyj1] = DownwardAPIVolumeFile{} } else { - yyv3696 := &yyv3694[yyj3694] - yyv3696.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj3694 := 0; !r.CheckBreak(); yyj3694++ { - if yyj3694 >= len(yyv3694) { - yyv3694 = append(yyv3694, DownwardAPIVolumeFile{}) // var yyz3694 DownwardAPIVolumeFile - yyc3694 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj3694 < len(yyv3694) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, DownwardAPIVolumeFile{}) // var yyz1 DownwardAPIVolumeFile + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv3694[yyj3694] = DownwardAPIVolumeFile{} + yyv1[yyj1] = DownwardAPIVolumeFile{} } else { - yyv3697 := &yyv3694[yyj3694] - yyv3697.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -43967,10 +54224,16 @@ func (x codecSelfer1234) decSliceDownwardAPIVolumeFile(v *[]DownwardAPIVolumeFil } } - yyh3694.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []DownwardAPIVolumeFile{} + yyc1 = true + } } - if yyc3694 { - *v = yyv3694 + yyh1.End() + if yyc1 { + *v = yyv1 } - } diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/types.go b/vendor/k8s.io/kubernetes/pkg/api/v1/types.go index 4e8a23321..63b201561 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/types.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/types.go @@ -21,7 +21,7 @@ import ( "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/types" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) // The comments for the structs and fields can be used from go-resful to @@ -198,7 +198,7 @@ type Volume struct { VolumeSource `json:",inline"` } -// VolumeSource represents the source location of a volume to mount. +// Represents the source of a volume to mount. // Only one of its members may be specified. type VolumeSource struct { // HostPath represents a pre-existing file or directory on the host @@ -243,6 +243,10 @@ type VolumeSource struct { // RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md RBD *RBDVolumeSource `json:"rbd,omitempty"` + // FlexVolume represents a generic volume resource that is + // provisioned/attached using a exec based plugin. This is an + // alpha feature and may change in future. + FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty"` // Cinder represents a cinder volume attached and mounted on kubelets host machine // More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md Cinder *CinderVolumeSource `json:"cinder,omitempty"` @@ -257,6 +261,10 @@ type VolumeSource struct { DownwardAPI *DownwardAPIVolumeSource `json:"downwardAPI,omitempty"` // FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. FC *FCVolumeSource `json:"fc,omitempty"` + // AzureFile represents an Azure File Service mount on the host and bind mount to the pod. + AzureFile *AzureFileVolumeSource `json:"azureFile,omitempty"` + // ConfigMap represents a configMap that should populate this volume + ConfigMap *ConfigMapVolumeSource `json:"configMap,omitempty"` } // PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. @@ -311,8 +319,16 @@ type PersistentVolumeSource struct { FC *FCVolumeSource `json:"fc,omitempty"` // Flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running Flocker *FlockerVolumeSource `json:"flocker,omitempty"` + // FlexVolume represents a generic volume resource that is + // provisioned/attached using a exec based plugin. This is an + // alpha feature and may change in future. + FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty"` + // AzureFile represents an Azure File Service mount on the host and bind mount to the pod. + AzureFile *AzureFileVolumeSource `json:"azureFile,omitempty"` } +// +genclient=true,nonNamespaced=true + // PersistentVolume (PV) is a storage resource provisioned by an administrator. // It is analogous to a node. // More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md @@ -484,14 +500,16 @@ const ( ClaimBound PersistentVolumeClaimPhase = "Bound" ) -// HostPathVolumeSource represents bare host directory volume. +// Represents a host path mapped into a pod. +// Host path volumes do not support ownership management or SELinux relabeling. type HostPathVolumeSource struct { // Path of the directory on the host. // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#hostpath Path string `json:"path"` } -// EmptyDirVolumeSource is temporary directory that shares a pod's lifetime. +// Represents an empty directory for a pod. +// Empty directory volumes support ownership management and SELinux relabeling. type EmptyDirVolumeSource struct { // What type of storage medium should back this directory. // The default is "" which means to use the node's default medium. @@ -500,7 +518,8 @@ type EmptyDirVolumeSource struct { Medium StorageMedium `json:"medium,omitempty"` } -// GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod. +// Represents a Glusterfs mount that lasts the lifetime of a pod. +// Glusterfs volumes do not support ownership management or SELinux relabeling. type GlusterfsVolumeSource struct { // EndpointsName is the endpoint name that details Glusterfs topology. // More info: http://releases.k8s.io/HEAD/examples/glusterfs/README.md#create-a-pod @@ -516,10 +535,8 @@ type GlusterfsVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// StorageMedium defines ways that storage can be allocated to a volume. -type StorageMedium string - -// RBDVolumeSource represents a Rados Block Device Mount that lasts the lifetime of a pod +// Represents a Rados Block Device mount that lasts the lifetime of a pod. +// RBD volumes support ownership management and SELinux relabeling. type RBDVolumeSource struct { // A collection of Ceph monitors. // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it @@ -529,7 +546,7 @@ type RBDVolumeSource struct { RBDImage string `json:"image"` // Filesystem type of the volume that you want to mount. // Tip: Ensure that the filesystem type is supported by the host operating system. - // Examples: "ext4", "xfs", "ntfs". + // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#rbd // TODO: how do we prevent errors in the filesystem from compromising the machine FSType string `json:"fsType,omitempty"` @@ -556,16 +573,17 @@ type RBDVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// CinderVolumeSource represents a cinder volume resource in Openstack. +// Represents a cinder volume resource in Openstack. // A Cinder volume must exist before mounting to a container. // The volume must also be in the same region as the kubelet. +// Cinder volumes support ownership management and SELinux relabeling. type CinderVolumeSource struct { // volume id used to identify the volume in cinder // More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md VolumeID string `json:"volumeID"` - // Required: Filesystem type to mount. + // Filesystem type to mount. // Must be a filesystem type supported by the host operating system. - // Only ext3 and ext4 are allowed + // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md FSType string `json:"fsType,omitempty"` // Optional: Defaults to false (read/write). ReadOnly here will force @@ -574,11 +592,14 @@ type CinderVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// CephFSVolumeSource represents a Ceph Filesystem Mount that lasts the lifetime of a pod +// Represents a Ceph Filesystem mount that lasts the lifetime of a pod +// Cephfs volumes do not support ownership management or SELinux relabeling. type CephFSVolumeSource struct { // Required: Monitors is a collection of Ceph monitors // More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it Monitors []string `json:"monitors"` + // Optional: Used as the mounted root, rather than the full Ceph tree, default is / + Path string `json:"path,omitempty"` // Optional: User is the rados user name, default is admin // More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it User string `json:"user,omitempty"` @@ -594,12 +615,16 @@ type CephFSVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// FlockerVolumeSource represents a Flocker volume mounted by the Flocker agent. +// Represents a Flocker volume mounted by the Flocker agent. +// Flocker volumes do not support ownership management or SELinux relabeling. type FlockerVolumeSource struct { // Required: the volume name. This is going to be store on metadata -> name on the payload for Flocker DatasetName string `json:"datasetName"` } +// StorageMedium defines ways that storage can be allocated to a volume. +type StorageMedium string + const ( StorageMediumDefault StorageMedium = "" // use whatever the default is for the node StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs) @@ -615,76 +640,107 @@ const ( ProtocolUDP Protocol = "UDP" ) -// GCEPersistentDiskVolumeSource represents a Persistent Disk resource in Google Compute Engine. +// Represents a Persistent Disk resource in Google Compute Engine. // // A GCE PD must exist and be formatted before mounting to a container. // The disk must also be in the same GCE project and zone as the kubelet. // A GCE PD can only be mounted as read/write once. +// GCE PDs support ownership management and SELinux relabeling. type GCEPersistentDiskVolumeSource struct { // Unique name of the PD resource in GCE. Used to identify the disk in GCE. // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk PDName string `json:"pdName"` // Filesystem type of the volume that you want to mount. // Tip: Ensure that the filesystem type is supported by the host operating system. - // Examples: "ext4", "xfs", "ntfs". + // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk // TODO: how do we prevent errors in the filesystem from compromising the machine - FSType string `json:"fsType"` + FSType string `json:"fsType,omitempty"` // The partition in the volume that you want to mount. // If omitted, the default is to mount by volume name. // Examples: For volume /dev/sda1, you specify the partition as "1". // Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk - Partition int `json:"partition,omitempty"` + Partition int32 `json:"partition,omitempty"` // ReadOnly here will force the ReadOnly setting in VolumeMounts. // Defaults to false. // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk ReadOnly bool `json:"readOnly,omitempty"` } -// Represents a persistent disk resource in AWS. +// FlexVolume represents a generic volume resource that is +// provisioned/attached using a exec based plugin. This is an alpha feature and may change in future. +type FlexVolumeSource struct { + // Driver is the name of the driver to use for this volume. + Driver string `json:"driver"` + // Filesystem type to mount. + // Must be a filesystem type supported by the host operating system. + // Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + FSType string `json:"fsType,omitempty"` + // Optional: SecretRef is reference to the authentication secret for User, default is empty. + SecretRef *LocalObjectReference `json:"secretRef,omitempty"` + // Optional: Defaults to false (read/write). ReadOnly here will force + // the ReadOnly setting in VolumeMounts. + ReadOnly bool `json:"readOnly,omitempty"` + // Optional: Extra command options if any. + Options map[string]string `json:"options,omitempty"` +} + +// Represents a Persistent Disk resource in AWS. // -// An Amazon Elastic Block Store (EBS) must already be created, formatted, -// and reside in the same AWS zone as the kubelet before it can be mounted. -// Note: Amazon EBS volumes can be mounted to only one instance at a time. +// An AWS EBS disk must exist and be formatted before mounting to a container. +// The disk must also be in the same AWS zone as the kubelet. +// An AWS EBS disk can only be mounted as read/write once. +// AWS EBS volumes support ownership management and SELinux relabeling. type AWSElasticBlockStoreVolumeSource struct { // Unique ID of the persistent disk resource in AWS (Amazon EBS volume). // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#awselasticblockstore VolumeID string `json:"volumeID"` // Filesystem type of the volume that you want to mount. // Tip: Ensure that the filesystem type is supported by the host operating system. - // Examples: "ext4", "xfs", "ntfs". + // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#awselasticblockstore // TODO: how do we prevent errors in the filesystem from compromising the machine - FSType string `json:"fsType"` + FSType string `json:"fsType,omitempty"` // The partition in the volume that you want to mount. // If omitted, the default is to mount by volume name. // Examples: For volume /dev/sda1, you specify the partition as "1". // Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). - Partition int `json:"partition,omitempty"` + Partition int32 `json:"partition,omitempty"` // Specify "true" to force and set the ReadOnly property in VolumeMounts to "true". // If omitted, the default is "false". // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#awselasticblockstore ReadOnly bool `json:"readOnly,omitempty"` } -// GitRepoVolumeSource represents a volume that is pulled from git when the pod is created. +// Represents a volume that is populated with the contents of a git repository. +// Git repo volumes do not support ownership management. +// Git repo volumes support SELinux relabeling. type GitRepoVolumeSource struct { // Repository URL Repository string `json:"repository"` // Commit hash for the specified revision. - Revision string `json:"revision"` + Revision string `json:"revision,omitempty"` + // Target directory name. + // Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + // git repository. Otherwise, if specified, the volume will contain the git repository in + // the subdirectory with the given name. + Directory string `json:"directory,omitempty"` } -// SecretVolumeSource adapts a Secret into a VolumeSource. -// More info: http://releases.k8s.io/HEAD/docs/design/secrets.md +// Adapts a Secret into a volume. +// +// The contents of the target Secret's Data field will be presented in a volume +// as files using the keys in the Data field as the file names. +// Secret volumes support ownership management and SELinux relabeling. type SecretVolumeSource struct { - // SecretName is the name of a secret in the pod's namespace. + // Name of the secret in the pod's namespace to use. // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#secrets - SecretName string `json:"secretName"` + SecretName string `json:"secretName,omitempty"` } -// NFSVolumeSource represents an NFS mount that lasts the lifetime of a pod +// Represents an NFS mount that lasts the lifetime of a pod. +// NFS volumes do not support ownership management or SELinux relabeling. type NFSVolumeSource struct { // Server is the hostname or IP address of the NFS server. // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#nfs @@ -701,7 +757,9 @@ type NFSVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// ISCSIVolumeSource describes an ISCSI Disk can only be mounted as read/write once. +// Represents an ISCSI disk. +// ISCSI volumes can only be mounted as read/write once. +// ISCSI volumes support ownership management and SELinux relabeling. type ISCSIVolumeSource struct { // iSCSI target portal. The portal is either an IP or ip_addr:port if the port // is other than default (typically TCP ports 860 and 3260). @@ -709,34 +767,79 @@ type ISCSIVolumeSource struct { // Target iSCSI Qualified Name. IQN string `json:"iqn"` // iSCSI target lun number. - Lun int `json:"lun"` + Lun int32 `json:"lun"` + // Optional: Defaults to 'default' (tcp). iSCSI interface name that uses an iSCSI transport. + ISCSIInterface string `json:"iscsiInterface,omitempty"` // Filesystem type of the volume that you want to mount. // Tip: Ensure that the filesystem type is supported by the host operating system. - // Examples: "ext4", "xfs", "ntfs". + // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#iscsi // TODO: how do we prevent errors in the filesystem from compromising the machine - FSType string `json:"fsType"` + FSType string `json:"fsType,omitempty"` // ReadOnly here will force the ReadOnly setting in VolumeMounts. // Defaults to false. ReadOnly bool `json:"readOnly,omitempty"` } -// A Fibre Channel Disk can only be mounted as read/write once. +// Represents a Fibre Channel volume. +// Fibre Channel volumes can only be mounted as read/write once. +// Fibre Channel volumes support ownership management and SELinux relabeling. type FCVolumeSource struct { // Required: FC target world wide names (WWNs) TargetWWNs []string `json:"targetWWNs"` // Required: FC target lun number - Lun *int `json:"lun"` - // Required: Filesystem type to mount. + Lun *int32 `json:"lun"` + // Filesystem type to mount. // Must be a filesystem type supported by the host operating system. - // Ex. "ext4", "xfs", "ntfs" + // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // TODO: how do we prevent errors in the filesystem from compromising the machine - FSType string `json:"fsType"` + FSType string `json:"fsType,omitempty"` // Optional: Defaults to false (read/write). ReadOnly here will force // the ReadOnly setting in VolumeMounts. ReadOnly bool `json:"readOnly,omitempty"` } +// AzureFile represents an Azure File Service mount on the host and bind mount to the pod. +type AzureFileVolumeSource struct { + // the name of secret that contains Azure Storage Account Name and Key + SecretName string `json:"secretName"` + // Share Name + ShareName string `json:"shareName"` + // Defaults to false (read/write). ReadOnly here will force + // the ReadOnly setting in VolumeMounts. + ReadOnly bool `json:"readOnly,omitempty"` +} + +// Adapts a ConfigMap into a volume. +// +// The contents of the target ConfigMap's Data field will be presented in a +// volume as files using the keys in the Data field as the file names, unless +// the items element is populated with specific mappings of keys to paths. +// ConfigMap volumes support ownership management and SELinux relabeling. +type ConfigMapVolumeSource struct { + LocalObjectReference `json:",inline"` + // If unspecified, each key-value pair in the Data field of the referenced + // ConfigMap will be projected into the volume as a file whose name is the + // key and content is the value. If specified, the listed keys will be + // projected into the specified paths, and unlisted keys will not be + // present. If a key is specified which is not present in the ConfigMap, + // the volume setup will error. Paths must be relative and may not contain + // the '..' path or start with '..'. + Items []KeyToPath `json:"items,omitempty"` +} + +// Maps a string key to a path within a volume. +type KeyToPath struct { + // The key to project. + Key string `json:"key"` + + // The relative path of the file to map the key to. + // May not be an absolute path. + // May not contain the path element '..'. + // May not start with the string '..'. + Path string `json:"path"` +} + // ContainerPort represents a network port in a single container. type ContainerPort struct { // If specified, this must be an IANA_SVC_NAME and unique within the pod. Each @@ -747,10 +850,10 @@ type ContainerPort struct { // If specified, this must be a valid port number, 0 < x < 65536. // If HostNetwork is specified, this must match ContainerPort. // Most containers do not need this. - HostPort int `json:"hostPort,omitempty"` + HostPort int32 `json:"hostPort,omitempty"` // Number of port to expose on the pod's IP address. // This must be a valid port number, 0 < x < 65536. - ContainerPort int `json:"containerPort"` + ContainerPort int32 `json:"containerPort"` // Protocol for port. Must be UDP or TCP. // Defaults to "TCP". Protocol Protocol `json:"protocol,omitempty"` @@ -791,8 +894,12 @@ type EnvVar struct { // EnvVarSource represents a source for the value of an EnvVar. type EnvVarSource struct { - // Selects a field of the pod. Only name and namespace are supported. - FieldRef *ObjectFieldSelector `json:"fieldRef"` + // Selects a field of the pod; only name and namespace are supported. + FieldRef *ObjectFieldSelector `json:"fieldRef,omitempty"` + // Selects a key of a ConfigMap. + ConfigMapKeyRef *ConfigMapKeySelector `json:"configMapKeyRef,omitempty"` + // Selects a key of a secret in the pod's namespace + SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty"` } // ObjectFieldSelector selects an APIVersioned field of an object. @@ -803,6 +910,30 @@ type ObjectFieldSelector struct { FieldPath string `json:"fieldPath"` } +// Selects a key from a ConfigMap. +type ConfigMapKeySelector struct { + // The ConfigMap to select from. + LocalObjectReference `json:",inline"` + // The key to select. + Key string `json:"key"` +} + +// SecretKeySelector selects a key of a Secret. +type SecretKeySelector struct { + // The name of the secret in the pod's namespace to select from. + LocalObjectReference `json:",inline"` + // The key of the secret to select from. Must be a valid secret key. + Key string `json:"key"` +} + +// HTTPHeader describes a custom header to be used in HTTP probes +type HTTPHeader struct { + // The header field name + Name string `json:"name"` + // The header field value + Value string `json:"value"` +} + // HTTPGetAction describes an action based on HTTP Get requests. type HTTPGetAction struct { // Path to access on the HTTP server. @@ -810,12 +941,15 @@ type HTTPGetAction struct { // Name or number of the port to access on the container. // Number must be in the range 1 to 65535. // Name must be an IANA_SVC_NAME. - Port util.IntOrString `json:"port"` - // Host name to connect to, defaults to the pod IP. + Port intstr.IntOrString `json:"port"` + // Host name to connect to, defaults to the pod IP. You probably want to set + // "Host" in httpHeaders instead. Host string `json:"host,omitempty"` // Scheme to use for connecting to the host. // Defaults to HTTP. Scheme URIScheme `json:"scheme,omitempty"` + // Custom headers to set in the request. HTTP allows repeated headers. + HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"` } // URIScheme identifies the scheme used for connection to a host for Get actions @@ -833,7 +967,7 @@ type TCPSocketAction struct { // Number or name of the port to access on the container. // Number must be in the range 1 to 65535. // Name must be an IANA_SVC_NAME. - Port util.IntOrString `json:"port"` + Port intstr.IntOrString `json:"port"` } // ExecAction describes a "run in container" action. @@ -846,17 +980,27 @@ type ExecAction struct { Command []string `json:"command,omitempty"` } -// Probe describes a liveness probe to be examined to the container. +// Probe describes a health check to be performed against a container to determine whether it is +// alive or ready to receive traffic. type Probe struct { // The action taken to determine the health of a container Handler `json:",inline"` // Number of seconds after the container has started before liveness probes are initiated. // More info: http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#container-probes - InitialDelaySeconds int64 `json:"initialDelaySeconds,omitempty"` - // Number of seconds after which liveness probes timeout. - // Defaults to 1 second. + InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"` + // Number of seconds after which the probe times out. + // Defaults to 1 second. Minimum value is 1. // More info: http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#container-probes - TimeoutSeconds int64 `json:"timeoutSeconds,omitempty"` + TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"` + // How often (in seconds) to perform the probe. + // Default to 10 seconds. Minimum value is 1. + PeriodSeconds int32 `json:"periodSeconds,omitempty"` + // Minimum consecutive successes for the probe to be considered successful after having failed. + // Defaults to 1. Must be 1 for liveness. Minimum value is 1. + SuccessThreshold int32 `json:"successThreshold,omitempty"` + // Minimum consecutive failures for the probe to be considered failed after having succeeded. + // Defaults to 3. Minimum value is 1. + FailureThreshold int32 `json:"failureThreshold,omitempty"` } // PullPolicy describes a policy for if/when to pull a container image @@ -909,7 +1053,7 @@ type Container struct { // More info: http://releases.k8s.io/HEAD/docs/user-guide/images.md Image string `json:"image,omitempty"` // Entrypoint array. Not executed within a shell. - // The docker image's entrypoint is used if this is not provided. + // The docker image's ENTRYPOINT is used if this is not provided. // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, @@ -918,7 +1062,7 @@ type Container struct { // More info: http://releases.k8s.io/HEAD/docs/user-guide/containers.md#containers-and-commands Command []string `json:"command,omitempty"` // Arguments to the entrypoint. - // The docker image's cmd is used if this is not provided. + // The docker image's CMD is used if this is not provided. // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, @@ -927,11 +1071,16 @@ type Container struct { // More info: http://releases.k8s.io/HEAD/docs/user-guide/containers.md#containers-and-commands Args []string `json:"args,omitempty"` // Container's working directory. - // Defaults to Docker's default. D - // efaults to image's default. + // If not specified, the container runtime's default will be used, which + // might be configured in the container image. // Cannot be updated. WorkingDir string `json:"workingDir,omitempty"` - // List of ports to expose from the container. + // List of ports to expose from the container. Exposing a port here gives + // the system additional information about the network connections a + // container uses, but is primarily informational. Not specifying a port here + // DOES NOT prevent that port from being exposed. Any port which is + // listening on the default "0.0.0.0" address inside a container will be + // accessible from the network. // Cannot be updated. Ports []ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort"` // List of environment variables to set in the container. @@ -1054,9 +1203,9 @@ type ContainerStateRunning struct { // ContainerStateTerminated is a terminated state of a container. type ContainerStateTerminated struct { // Exit status from the last termination of the container - ExitCode int `json:"exitCode"` + ExitCode int32 `json:"exitCode"` // Signal from the last termination of the container - Signal int `json:"signal,omitempty"` + Signal int32 `json:"signal,omitempty"` // (brief) reason from the last termination of the container Reason string `json:"reason,omitempty"` // Message regarding the last termination of the container @@ -1096,7 +1245,7 @@ type ContainerStatus struct { // the number of dead containers that have not yet been removed. // Note that this is calculated from dead containers. But those containers are subject to // garbage collection. This value will get capped at 5 by GC. - RestartCount int `json:"restartCount"` + RestartCount int32 `json:"restartCount"` // The image the container is running. // More info: http://releases.k8s.io/HEAD/docs/user-guide/images.md // TODO(dchen1107): Which image the container is running with? @@ -1189,6 +1338,93 @@ const ( DefaultTerminationGracePeriodSeconds = 30 ) +// A node selector represents the union of the results of one or more label queries +// over a set of nodes; that is, it represents the OR of the selectors represented +// by the node selector terms. +type NodeSelector struct { + //Required. A list of node selector terms. The terms are ORed. + NodeSelectorTerms []NodeSelectorTerm `json:"nodeSelectorTerms"` +} + +// A null or empty node selector term matches no objects. +type NodeSelectorTerm struct { + //Required. A list of node selector requirements. The requirements are ANDed. + MatchExpressions []NodeSelectorRequirement `json:"matchExpressions"` +} + +// A node selector requirement is a selector that contains values, a key, and an operator +// that relates the key and values. +type NodeSelectorRequirement struct { + // The label key that the selector applies to. + Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key"` + // Represents a key's relationship to a set of values. + // Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + Operator NodeSelectorOperator `json:"operator"` + // An array of string values. If the operator is In or NotIn, + // the values array must be non-empty. If the operator is Exists or DoesNotExist, + // the values array must be empty. If the operator is Gt or Lt, the values + // array must have a single element, which will be interpreted as an integer. + // This array is replaced during a strategic merge patch. + Values []string `json:"values,omitempty"` +} + +// A node selector operator is the set of operators that can be used in +// a node selector requirement. +type NodeSelectorOperator string + +const ( + NodeSelectorOpIn NodeSelectorOperator = "In" + NodeSelectorOpNotIn NodeSelectorOperator = "NotIn" + NodeSelectorOpExists NodeSelectorOperator = "Exists" + NodeSelectorOpDoesNotExist NodeSelectorOperator = "DoesNotExist" + NodeSelectorOpGt NodeSelectorOperator = "Gt" + NodeSelectorOpLt NodeSelectorOperator = "Lt" +) + +// Affinity is a group of affinity scheduling rules, currently +// only node affinity, but in the future also inter-pod affinity. +type Affinity struct { + // Describes node affinity scheduling rules for the pod. + NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty"` +} + +// Node affinity is a group of node affinity scheduling rules. +type NodeAffinity struct { + // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. + // If the affinity requirements specified by this field are not met at + // scheduling time, the pod will not be scheduled onto the node. + // If the affinity requirements specified by this field cease to be met + // at some point during pod execution (e.g. due to an update), the system + // will try to eventually evict the pod from its node. + // RequiredDuringSchedulingRequiredDuringExecution *NodeSelector `json:"requiredDuringSchedulingRequiredDuringExecution,omitempty"` + + // If the affinity requirements specified by this field are not met at + // scheduling time, the pod will not be scheduled onto the node. + // If the affinity requirements specified by this field cease to be met + // at some point during pod execution (e.g. due to an update), the system + // may or may not try to eventually evict the pod from its node. + RequiredDuringSchedulingIgnoredDuringExecution *NodeSelector `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` + // The scheduler will prefer to schedule pods to nodes that satisfy + // the affinity expressions specified by this field, but it may choose + // a node that violates one or more of the expressions. The node that is + // most preferred is the one with the greatest sum of weights, i.e. + // for each node that meets all of the scheduling requirements (resource + // request, requiredDuringScheduling affinity expressions, etc.), + // compute a sum by iterating through the elements of this field and adding + // "weight" to the sum if the node matches the corresponding matchExpressions; the + // node(s) with the highest sum are the most preferred. + PreferredDuringSchedulingIgnoredDuringExecution []PreferredSchedulingTerm `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"` +} + +// An empty preferred scheduling term matches all objects with implicit weight 0 +// (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). +type PreferredSchedulingTerm struct { + // Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. + Weight int `json:"weight"` + // A node selector term, associated with the corresponding weight. + Preference NodeSelectorTerm `json:"preference"` +} + // PodSpec is a description of a pod. type PodSpec struct { // List of volumes that can be mounted by containers belonging to the pod. @@ -1258,13 +1494,10 @@ type PodSpec struct { } // PodSecurityContext holds pod-level security attributes and common container settings. +// Some fields are also present in container.securityContext. Field values of +// container.securityContext take precedence over field values of PodSecurityContext. type PodSecurityContext struct { - // SupplementalGroups can be used to specify a list of - // additional groups which the main container process will run - // as. This will be applied to all containers in the pod in - // addition to the primary group of the container. - SupplementalGroups []int64 `json:"supplementalGroups,omitempty"` - // SELinuxOptions is the SELinux context to be applied to all containers + // The SELinux context to be applied to all containers. // If unspecified, the container runtime will allocate a random SELinux context for each // container. May also be set in SecurityContext. If set in // both SecurityContext and PodSecurityContext, the value specified in SecurityContext @@ -1283,6 +1516,20 @@ type PodSecurityContext struct { // May also be set in SecurityContext. If set in both SecurityContext and // PodSecurityContext, the value specified in SecurityContext takes precedence. RunAsNonRoot *bool `json:"runAsNonRoot,omitempty"` + // A list of groups applied to the first process run in each container, in addition + // to the container's primary GID. If unspecified, no groups will be added to + // any container. + SupplementalGroups []int64 `json:"supplementalGroups,omitempty"` + // A special supplemental group that applies to all containers in a pod. + // Some volume types allow the Kubelet to change the ownership of that volume + // to be owned by the pod: + // + // 1. The owning GID will be the FSGroup + // 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) + // 3. The permission bits are OR'd with rw-rw---- + // + // If unset, the Kubelet will not modify the ownership and permissions of any volume. + FSGroup *int64 `json:"fsGroup,omitempty"` } // PodStatus represents information about the status of a pod. Status may trail the actual @@ -1330,6 +1577,8 @@ type PodStatusResult struct { Status PodStatus `json:"status,omitempty"` } +// +genclient=true + // Pod is a collection of containers that can run on a host. This resource is created // by clients and scheduled onto hosts. type Pod struct { @@ -1373,6 +1622,8 @@ type PodTemplateSpec struct { Spec PodSpec `json:"spec,omitempty"` } +// +genclient=true + // PodTemplate describes a template for creating copies of a predefined pod. type PodTemplate struct { unversioned.TypeMeta `json:",inline"` @@ -1402,7 +1653,7 @@ type ReplicationControllerSpec struct { // This is a pointer to distinguish between explicit zero and unspecified. // Defaults to 1. // More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller - Replicas *int `json:"replicas,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` // Selector is a label query over pods that should match the Replicas count. // If Selector is empty, it is defaulted to the labels present on the Pod template. @@ -1427,12 +1678,14 @@ type ReplicationControllerSpec struct { type ReplicationControllerStatus struct { // Replicas is the most recently oberved number of replicas. // More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller - Replicas int `json:"replicas"` + Replicas int32 `json:"replicas"` // ObservedGeneration reflects the generation of the most recently observed replication controller. ObservedGeneration int64 `json:"observedGeneration,omitempty"` } +// +genclient=true + // ReplicationController represents the configuration of a replication controller. type ReplicationController struct { unversioned.TypeMeta `json:",inline"` @@ -1591,7 +1844,7 @@ type ServicePort struct { Protocol Protocol `json:"protocol,omitempty"` // The port that will be exposed by this service. - Port int `json:"port"` + Port int32 `json:"port"` // Number or name of the port to access on the pods targeted by the service. // Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. @@ -1600,16 +1853,18 @@ type ServicePort struct { // of Port is used (an identity map). // Defaults to the service port. // More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service - TargetPort util.IntOrString `json:"targetPort,omitempty"` + TargetPort intstr.IntOrString `json:"targetPort,omitempty"` // The port on each node on which this service is exposed when type=NodePort or LoadBalancer. // Usually assigned by the system. If specified, it will be allocated to the service // if unused or else creation of the service will fail. // Default is to auto-allocate a port if the ServiceType of this Service requires one. // More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#type--nodeport - NodePort int `json:"nodePort,omitempty"` + NodePort int32 `json:"nodePort,omitempty"` } +// +genclient=true + // Service is a named abstraction of software service (for example, mysql) consisting of local port // (for example 3306) that the proxy listens on, and the selector that determines which pods // will answer requests sent through the proxy. @@ -1647,6 +1902,8 @@ type ServiceList struct { Items []Service `json:"items"` } +// +genclient=true + // ServiceAccount binds together: // * a name, understood by users, and perhaps by peripheral systems, for an identity // * a principal that can be authenticated and authorized @@ -1680,6 +1937,8 @@ type ServiceAccountList struct { Items []ServiceAccount `json:"items"` } +// +genclient=true + // Endpoints is a collection of endpoints that implement the actual service. Example: // Name: "mysvc", // Subsets: [ @@ -1750,7 +2009,7 @@ type EndpointPort struct { Name string `json:"name,omitempty"` // The port number of the endpoint. - Port int `json:"port"` + Port int32 `json:"port"` // The IP protocol for this port. // Must be UDP or TCP. @@ -1786,7 +2045,7 @@ type NodeSpec struct { // DaemonEndpoint contains information about a single Daemon endpoint. type DaemonEndpoint struct { // Port number of the given endpoint. - Port int `json:port` + Port int32 `json:port` } // NodeDaemonEndpoints lists ports opened by daemons running on the Node. @@ -1806,7 +2065,7 @@ type NodeSystemInfo struct { // Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64). KernelVersion string `json:"kernelVersion"` // OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)). - OsImage string `json:"osImage"` + OSImage string `json:"osImage"` // ContainerRuntime Version reported by the node through runtime remote API (e.g. docker://1.5.0). ContainerRuntimeVersion string `json:"containerRuntimeVersion"` // Kubelet Version reported by the node. @@ -1817,9 +2076,12 @@ type NodeSystemInfo struct { // NodeStatus is information about the current status of a node. type NodeStatus struct { - // Capacity represents the available resources of a node. + // Capacity represents the total resources of a node. // More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#capacity for more details. Capacity ResourceList `json:"capacity,omitempty"` + // Allocatable represents the resources of a node that are available for scheduling. + // Defaults to Capacity. + Allocatable ResourceList `json:"allocatable,omitempty"` // NodePhase is the recently observed lifecycle phase of the node. // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-phase Phase NodePhase `json:"phase,omitempty"` @@ -1835,6 +2097,17 @@ type NodeStatus struct { // Set of ids/uuids to uniquely identify the node. // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-info NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"` + // List of container images on this node + Images []ContainerImage `json:"images",omitempty` +} + +// Describe a container image +type ContainerImage struct { + // Names by which this image is known. + // e.g. ["gcr.io/google_containers/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"] + RepoTags []string `json:"repoTags"` + // The size of the image in bytes. + Size int64 `json:"size,omitempty"` } type NodePhase string @@ -1857,11 +2130,14 @@ type NodeConditionType string const ( // NodeReady means kubelet is healthy and ready to accept pods. NodeReady NodeConditionType = "Ready" + // NodeOutOfDisk means the kubelet will not accept new pods due to insufficient free disk + // space on the node. + NodeOutOfDisk NodeConditionType = "OutOfDisk" ) // NodeCondition contains condition infromation for a node. type NodeCondition struct { - // Type of node condition, currently only Ready. + // Type of node condition. Type NodeConditionType `json:"type"` // Status of the condition, one of True, False, Unknown. Status ConditionStatus `json:"status"` @@ -1907,6 +2183,8 @@ const ( // ResourceList is a set of (resource name, quantity) pairs. type ResourceList map[ResourceName]resource.Quantity +// +genclient=true,nonNamespaced=true + // Node is a worker node in Kubernetes, formerly known as minion. // Each node will have a unique identifier in the cache (i.e. in etcd). type Node struct { @@ -1968,6 +2246,8 @@ const ( NamespaceTerminating NamespacePhase = "Terminating" ) +// +genclient=true,nonNamespaced=true + // Namespace provides a scope for Names. // Use of multiple namespaces is optional. type Namespace struct { @@ -2020,6 +2300,16 @@ type DeleteOptions struct { GracePeriodSeconds *int64 `json:"gracePeriodSeconds"` } +// ExportOptions is the query options to the standard REST get call. +type ExportOptions struct { + unversioned.TypeMeta `json:",inline"` + + // Should this value be exported. Export strips fields that a user can not specify. + Export bool `json:"export"` + // Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace' + Exact bool `json:"exact"` +} + // ListOptions is the query options to a standard REST list call. type ListOptions struct { unversioned.TypeMeta `json:",inline"` @@ -2036,6 +2326,8 @@ type ListOptions struct { // When specified with a watch call, shows changes that occur after that particular version of a resource. // Defaults to changes from the beginning of history. ResourceVersion string `json:"resourceVersion,omitempty"` + // Timeout for the list/watch call. + TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` } // PodLogOptions is the query options for a Pod's logs REST call. @@ -2194,6 +2486,16 @@ type EventSource struct { Host string `json:"host,omitempty"` } +// Valid values for event types (new types could be added in future) +const ( + // Information only and will not cause any problems + EventTypeNormal string = "Normal" + // These events are to warn that something might go wrong + EventTypeWarning string = "Warning" +) + +// +genclient=true + // Event is a report of an event somewhere in the cluster. // TODO: Decide whether to store these separately or with the object they apply to. type Event struct { @@ -2224,7 +2526,10 @@ type Event struct { LastTimestamp unversioned.Time `json:"lastTimestamp,omitempty"` // The number of times this event has occurred. - Count int `json:"count,omitempty"` + Count int32 `json:"count,omitempty"` + + // Type of this event (Normal, Warning), new types could be added in the future + Type string `json:"type,omitempty"` } // EventList is a list of events. @@ -2281,6 +2586,8 @@ type LimitRangeSpec struct { Limits []LimitRangeItem `json:"limits"` } +// +genclient=true + // LimitRange sets resource usage limits for each kind of resource in a Namespace. type LimitRange struct { unversioned.TypeMeta `json:",inline"` @@ -2337,6 +2644,8 @@ type ResourceQuotaStatus struct { Used ResourceList `json:"used,omitempty"` } +// +genclient=true + // ResourceQuota sets aggregate quota restrictions enforced per namespace type ResourceQuota struct { unversioned.TypeMeta `json:",inline"` @@ -2365,6 +2674,8 @@ type ResourceQuotaList struct { Items []ResourceQuota `json:"items"` } +// +genclient=true + // Secret holds secret data of a certain type. The total bytes of the values in // the Data field must be less than MaxSecretSize bytes. type Secret struct { @@ -2410,6 +2721,8 @@ const ( ServiceAccountKubeconfigKey = "kubernetes.kubeconfig" // ServiceAccountRootCAKey is the key of the optional root certificate authority for SecretTypeServiceAccountToken secrets ServiceAccountRootCAKey = "ca.crt" + // ServiceAccountNamespaceKey is the key of the optional namespace to use as the default for namespaced API calls + ServiceAccountNamespaceKey = "namespace" // SecretTypeDockercfg contains a dockercfg file that follows the same format rules as ~/.dockercfg // @@ -2419,6 +2732,21 @@ const ( // DockerConfigKey is the key of the required data for SecretTypeDockercfg secrets DockerConfigKey = ".dockercfg" + + // SecretTypeTLS contains information about a TLS client or server secret. It + // is primarily used with TLS termination of the Ingress resource, but may be + // used in other types. + // + // Required fields: + // - Secret.Data["tls.key"] - TLS private key. + // Secret.Data["tls.crt"] - TLS certificate. + // TODO: Consider supporting different formats, specifying CA/destinationCA. + SecretTypeTLS SecretType = "kubernetes.io/tls" + + // TLSCertKey is the key for tls certificates in a TLS secert. + TLSCertKey = "tls.crt" + // TLSPrivateKeyKey is the key for the private key field in a TLS secret. + TLSPrivateKeyKey = "tls.key" ) // SecretList is a list of Secret. @@ -2433,6 +2761,31 @@ type SecretList struct { Items []Secret `json:"items"` } +// +genclient=true + +// ConfigMap holds configuration data for pods to consume. +type ConfigMap struct { + unversioned.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + ObjectMeta `json:"metadata,omitempty"` + + // Data contains the configuration data. + // Each key must be a valid DNS_SUBDOMAIN with an optional leading dot. + Data map[string]string `json:"data,omitempty"` +} + +// ConfigMapList is a resource containing a list of ConfigMap objects. +type ConfigMapList struct { + unversioned.TypeMeta `json:",inline"` + + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + unversioned.ListMeta `json:"metadata,omitempty"` + + // Items is the list of ConfigMaps. + Items []ConfigMap `json:"items,omitempty"` +} + // Type and constants for component health validation. type ComponentConditionType string @@ -2457,6 +2810,8 @@ type ComponentCondition struct { Error string `json:"error,omitempty"` } +// +genclient=true,nonNamespaced=true + // ComponentStatus (and ComponentStatusList) holds the cluster validation info. type ComponentStatus struct { unversioned.TypeMeta `json:",inline"` @@ -2479,7 +2834,8 @@ type ComponentStatusList struct { Items []ComponentStatus `json:"items"` } -// DownwardAPIVolumeSource represents a volume containing downward API info +// DownwardAPIVolumeSource represents a volume containing downward API info. +// Downward API volumes support ownership management and SELinux relabeling. type DownwardAPIVolumeSource struct { // Items is a list of downward API volume file Items []DownwardAPIVolumeFile `json:"items,omitempty"` @@ -2521,6 +2877,9 @@ type SecurityContext struct { // May also be set in PodSecurityContext. If set in both SecurityContext and // PodSecurityContext, the value specified in SecurityContext takes precedence. RunAsNonRoot *bool `json:"runAsNonRoot,omitempty"` + // Whether this container has a read-only root filesystem. + // Default is false. + ReadOnlyRootFilesystem *bool `json:"readOnlyRootFilesystem,omitempty"` } // SELinuxOptions are the labels to be applied to the container @@ -2547,3 +2906,8 @@ type RangeAllocation struct { // Data is a bit array containing all allocated addresses in the previous segment. Data []byte `json:"data"` } + +const ( + // "default-scheduler" is the name of default scheduler. + DefaultSchedulerName = "default-scheduler" +) diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/types_swagger_doc_generated.go b/vendor/k8s.io/kubernetes/pkg/api/v1/types_swagger_doc_generated.go index 6c13ce617..2ca06ac0f 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/types_swagger_doc_generated.go @@ -28,9 +28,9 @@ package v1 // AUTO-GENERATED FUNCTIONS START HERE var map_AWSElasticBlockStoreVolumeSource = map[string]string{ - "": "Represents a persistent disk resource in AWS.\n\nAn Amazon Elastic Block Store (EBS) must already be created, formatted, and reside in the same AWS zone as the kubelet before it can be mounted. Note: Amazon EBS volumes can be mounted to only one instance at a time.", + "": "Represents a Persistent Disk resource in AWS.\n\nAn AWS EBS disk must exist and be formatted before mounting to a container. The disk must also be in the same AWS zone as the kubelet. An AWS EBS disk can only be mounted as read/write once. AWS EBS volumes support ownership management and SELinux relabeling.", "volumeID": "Unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#awselasticblockstore", - "fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#awselasticblockstore", + "fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#awselasticblockstore", "partition": "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty).", "readOnly": "Specify \"true\" to force and set the ReadOnly property in VolumeMounts to \"true\". If omitted, the default is \"false\". More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#awselasticblockstore", } @@ -39,6 +39,26 @@ func (AWSElasticBlockStoreVolumeSource) SwaggerDoc() map[string]string { return map_AWSElasticBlockStoreVolumeSource } +var map_Affinity = map[string]string{ + "": "Affinity is a group of affinity scheduling rules, currently only node affinity, but in the future also inter-pod affinity.", + "nodeAffinity": "Describes node affinity scheduling rules for the pod.", +} + +func (Affinity) SwaggerDoc() map[string]string { + return map_Affinity +} + +var map_AzureFileVolumeSource = map[string]string{ + "": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + "secretName": "the name of secret that contains Azure Storage Account Name and Key", + "shareName": "Share Name", + "readOnly": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", +} + +func (AzureFileVolumeSource) SwaggerDoc() map[string]string { + return map_AzureFileVolumeSource +} + var map_Binding = map[string]string{ "": "Binding ties one object to another. For example, a pod is bound to a node by a scheduler.", "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", @@ -60,8 +80,9 @@ func (Capabilities) SwaggerDoc() map[string]string { } var map_CephFSVolumeSource = map[string]string{ - "": "CephFSVolumeSource represents a Ceph Filesystem Mount that lasts the lifetime of a pod", + "": "Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.", "monitors": "Required: Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it", + "path": "Optional: Used as the mounted root, rather than the full Ceph tree, default is /", "user": "Optional: User is the rados user name, default is admin More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it", "secretFile": "Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it", "secretRef": "Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it", @@ -73,9 +94,9 @@ func (CephFSVolumeSource) SwaggerDoc() map[string]string { } var map_CinderVolumeSource = map[string]string{ - "": "CinderVolumeSource represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet.", + "": "Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling.", "volumeID": "volume id used to identify the volume in cinder More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", - "fsType": "Required: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Only ext3 and ext4 are allowed More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + "fsType": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", "readOnly": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", } @@ -115,14 +136,52 @@ func (ComponentStatusList) SwaggerDoc() map[string]string { return map_ComponentStatusList } +var map_ConfigMap = map[string]string{ + "": "ConfigMap holds configuration data for pods to consume.", + "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", + "data": "Data contains the configuration data. Each key must be a valid DNS_SUBDOMAIN with an optional leading dot.", +} + +func (ConfigMap) SwaggerDoc() map[string]string { + return map_ConfigMap +} + +var map_ConfigMapKeySelector = map[string]string{ + "": "Selects a key from a ConfigMap.", + "key": "The key to select.", +} + +func (ConfigMapKeySelector) SwaggerDoc() map[string]string { + return map_ConfigMapKeySelector +} + +var map_ConfigMapList = map[string]string{ + "": "ConfigMapList is a resource containing a list of ConfigMap objects.", + "metadata": "More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", + "items": "Items is the list of ConfigMaps.", +} + +func (ConfigMapList) SwaggerDoc() map[string]string { + return map_ConfigMapList +} + +var map_ConfigMapVolumeSource = map[string]string{ + "": "Adapts a ConfigMap into a volume.\n\nThe contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. ConfigMap volumes support ownership management and SELinux relabeling.", + "items": "If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error. Paths must be relative and may not contain the '..' path or start with '..'.", +} + +func (ConfigMapVolumeSource) SwaggerDoc() map[string]string { + return map_ConfigMapVolumeSource +} + var map_Container = map[string]string{ "": "A single application container that you want to run within a pod.", "name": "Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.", "image": "Docker image name. More info: http://releases.k8s.io/HEAD/docs/user-guide/images.md", - "command": "Entrypoint array. Not executed within a shell. The docker image's entrypoint is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: http://releases.k8s.io/HEAD/docs/user-guide/containers.md#containers-and-commands", - "args": "Arguments to the entrypoint. The docker image's cmd is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: http://releases.k8s.io/HEAD/docs/user-guide/containers.md#containers-and-commands", - "workingDir": "Container's working directory. Defaults to Docker's default. D efaults to image's default. Cannot be updated.", - "ports": "List of ports to expose from the container. Cannot be updated.", + "command": "Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: http://releases.k8s.io/HEAD/docs/user-guide/containers.md#containers-and-commands", + "args": "Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: http://releases.k8s.io/HEAD/docs/user-guide/containers.md#containers-and-commands", + "workingDir": "Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.", + "ports": "List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated.", "env": "List of environment variables to set in the container. Cannot be updated.", "resources": "Compute Resources required by this container. Cannot be updated. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#resources", "volumeMounts": "Pod volumes to mount into the container's filesyste. Cannot be updated.", @@ -141,6 +200,16 @@ func (Container) SwaggerDoc() map[string]string { return map_Container } +var map_ContainerImage = map[string]string{ + "": "Describe a container image", + "repoTags": "Names by which this image is known. e.g. [\"gcr.io/google_containers/hyperkube:v1.0.7\", \"dockerhub.io/google_containers/hyperkube:v1.0.7\"]", + "size": "The size of the image in bytes.", +} + +func (ContainerImage) SwaggerDoc() map[string]string { + return map_ContainerImage +} + var map_ContainerPort = map[string]string{ "": "ContainerPort represents a network port in a single container.", "name": "If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.", @@ -244,7 +313,7 @@ func (DownwardAPIVolumeFile) SwaggerDoc() map[string]string { } var map_DownwardAPIVolumeSource = map[string]string{ - "": "DownwardAPIVolumeSource represents a volume containing downward API info", + "": "DownwardAPIVolumeSource represents a volume containing downward API info. Downward API volumes support ownership management and SELinux relabeling.", "items": "Items is a list of downward API volume file", } @@ -253,7 +322,7 @@ func (DownwardAPIVolumeSource) SwaggerDoc() map[string]string { } var map_EmptyDirVolumeSource = map[string]string{ - "": "EmptyDirVolumeSource is temporary directory that shares a pod's lifetime.", + "": "Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.", "medium": "What type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#emptydir", } @@ -325,8 +394,10 @@ func (EnvVar) SwaggerDoc() map[string]string { } var map_EnvVarSource = map[string]string{ - "": "EnvVarSource represents a source for the value of an EnvVar.", - "fieldRef": "Selects a field of the pod. Only name and namespace are supported.", + "": "EnvVarSource represents a source for the value of an EnvVar.", + "fieldRef": "Selects a field of the pod; only name and namespace are supported.", + "configMapKeyRef": "Selects a key of a ConfigMap.", + "secretKeyRef": "Selects a key of a secret in the pod's namespace", } func (EnvVarSource) SwaggerDoc() map[string]string { @@ -343,6 +414,7 @@ var map_Event = map[string]string{ "firstTimestamp": "The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)", "lastTimestamp": "The time at which the most recent occurrence of this event was recorded.", "count": "The number of times this event has occurred.", + "type": "Type of this event (Normal, Warning), new types could be added in the future", } func (Event) SwaggerDoc() map[string]string { @@ -378,11 +450,21 @@ func (ExecAction) SwaggerDoc() map[string]string { return map_ExecAction } +var map_ExportOptions = map[string]string{ + "": "ExportOptions is the query options to the standard REST get call.", + "export": "Should this value be exported. Export strips fields that a user can not specify.", + "exact": "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'", +} + +func (ExportOptions) SwaggerDoc() map[string]string { + return map_ExportOptions +} + var map_FCVolumeSource = map[string]string{ - "": "A Fibre Channel Disk can only be mounted as read/write once.", + "": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.", "targetWWNs": "Required: FC target world wide names (WWNs)", "lun": "Required: FC target lun number", - "fsType": "Required: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\"", + "fsType": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", "readOnly": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", } @@ -390,8 +472,21 @@ func (FCVolumeSource) SwaggerDoc() map[string]string { return map_FCVolumeSource } +var map_FlexVolumeSource = map[string]string{ + "": "FlexVolume represents a generic volume resource that is provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.", + "driver": "Driver is the name of the driver to use for this volume.", + "fsType": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default filesystem depends on FlexVolume script.", + "secretRef": "Optional: SecretRef is reference to the authentication secret for User, default is empty.", + "readOnly": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + "options": "Optional: Extra command options if any.", +} + +func (FlexVolumeSource) SwaggerDoc() map[string]string { + return map_FlexVolumeSource +} + var map_FlockerVolumeSource = map[string]string{ - "": "FlockerVolumeSource represents a Flocker volume mounted by the Flocker agent.", + "": "Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.", "datasetName": "Required: the volume name. This is going to be store on metadata -> name on the payload for Flocker", } @@ -400,9 +495,9 @@ func (FlockerVolumeSource) SwaggerDoc() map[string]string { } var map_GCEPersistentDiskVolumeSource = map[string]string{ - "": "GCEPersistentDiskVolumeSource represents a Persistent Disk resource in Google Compute Engine.\n\nA GCE PD must exist and be formatted before mounting to a container. The disk must also be in the same GCE project and zone as the kubelet. A GCE PD can only be mounted as read/write once.", + "": "Represents a Persistent Disk resource in Google Compute Engine.\n\nA GCE PD must exist and be formatted before mounting to a container. The disk must also be in the same GCE project and zone as the kubelet. A GCE PD can only be mounted as read/write once. GCE PDs support ownership management and SELinux relabeling.", "pdName": "Unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk", - "fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk", + "fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk", "partition": "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty). More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk", "readOnly": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk", } @@ -412,9 +507,10 @@ func (GCEPersistentDiskVolumeSource) SwaggerDoc() map[string]string { } var map_GitRepoVolumeSource = map[string]string{ - "": "GitRepoVolumeSource represents a volume that is pulled from git when the pod is created.", + "": "Represents a volume that is populated with the contents of a git repository. Git repo volumes do not support ownership management. Git repo volumes support SELinux relabeling.", "repository": "Repository URL", "revision": "Commit hash for the specified revision.", + "directory": "Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name.", } func (GitRepoVolumeSource) SwaggerDoc() map[string]string { @@ -422,7 +518,7 @@ func (GitRepoVolumeSource) SwaggerDoc() map[string]string { } var map_GlusterfsVolumeSource = map[string]string{ - "": "GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod.", + "": "Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling.", "endpoints": "EndpointsName is the endpoint name that details Glusterfs topology. More info: http://releases.k8s.io/HEAD/examples/glusterfs/README.md#create-a-pod", "path": "Path is the Glusterfs volume path. More info: http://releases.k8s.io/HEAD/examples/glusterfs/README.md#create-a-pod", "readOnly": "ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: http://releases.k8s.io/HEAD/examples/glusterfs/README.md#create-a-pod", @@ -433,17 +529,28 @@ func (GlusterfsVolumeSource) SwaggerDoc() map[string]string { } var map_HTTPGetAction = map[string]string{ - "": "HTTPGetAction describes an action based on HTTP Get requests.", - "path": "Path to access on the HTTP server.", - "port": "Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.", - "host": "Host name to connect to, defaults to the pod IP.", - "scheme": "Scheme to use for connecting to the host. Defaults to HTTP.", + "": "HTTPGetAction describes an action based on HTTP Get requests.", + "path": "Path to access on the HTTP server.", + "port": "Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.", + "host": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.", + "scheme": "Scheme to use for connecting to the host. Defaults to HTTP.", + "httpHeaders": "Custom headers to set in the request. HTTP allows repeated headers.", } func (HTTPGetAction) SwaggerDoc() map[string]string { return map_HTTPGetAction } +var map_HTTPHeader = map[string]string{ + "": "HTTPHeader describes a custom header to be used in HTTP probes", + "name": "The header field name", + "value": "The header field value", +} + +func (HTTPHeader) SwaggerDoc() map[string]string { + return map_HTTPHeader +} + var map_Handler = map[string]string{ "": "Handler defines a specific action that should be taken", "exec": "One and only one of the following should be specified. Exec specifies the action to take.", @@ -456,7 +563,7 @@ func (Handler) SwaggerDoc() map[string]string { } var map_HostPathVolumeSource = map[string]string{ - "": "HostPathVolumeSource represents bare host directory volume.", + "": "Represents a host path mapped into a pod. Host path volumes do not support ownership management or SELinux relabeling.", "path": "Path of the directory on the host. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#hostpath", } @@ -465,18 +572,29 @@ func (HostPathVolumeSource) SwaggerDoc() map[string]string { } var map_ISCSIVolumeSource = map[string]string{ - "": "ISCSIVolumeSource describes an ISCSI Disk can only be mounted as read/write once.", - "targetPortal": "iSCSI target portal. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", - "iqn": "Target iSCSI Qualified Name.", - "lun": "iSCSI target lun number.", - "fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#iscsi", - "readOnly": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.", + "": "Represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling.", + "targetPortal": "iSCSI target portal. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", + "iqn": "Target iSCSI Qualified Name.", + "lun": "iSCSI target lun number.", + "iscsiInterface": "Optional: Defaults to 'default' (tcp). iSCSI interface name that uses an iSCSI transport.", + "fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#iscsi", + "readOnly": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.", } func (ISCSIVolumeSource) SwaggerDoc() map[string]string { return map_ISCSIVolumeSource } +var map_KeyToPath = map[string]string{ + "": "Maps a string key to a path within a volume.", + "key": "The key to project.", + "path": "The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'.", +} + +func (KeyToPath) SwaggerDoc() map[string]string { + return map_KeyToPath +} + var map_Lifecycle = map[string]string{ "": "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.", "postStart": "PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: http://releases.k8s.io/HEAD/docs/user-guide/container-environment.md#hook-details", @@ -546,6 +664,7 @@ var map_ListOptions = map[string]string{ "fieldSelector": "A selector to restrict the list of returned objects by their fields. Defaults to everything.", "watch": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.", "resourceVersion": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.", + "timeoutSeconds": "Timeout for the list/watch call.", } func (ListOptions) SwaggerDoc() map[string]string { @@ -581,7 +700,7 @@ func (LocalObjectReference) SwaggerDoc() map[string]string { } var map_NFSVolumeSource = map[string]string{ - "": "NFSVolumeSource represents an NFS mount that lasts the lifetime of a pod", + "": "Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling.", "server": "Server is the hostname or IP address of the NFS server. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#nfs", "path": "Path that is exported by the NFS server. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#nfs", "readOnly": "ReadOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#nfs", @@ -651,9 +770,19 @@ func (NodeAddress) SwaggerDoc() map[string]string { return map_NodeAddress } +var map_NodeAffinity = map[string]string{ + "": "Node affinity is a group of node affinity scheduling rules.", + "requiredDuringSchedulingIgnoredDuringExecution": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.", + "preferredDuringSchedulingIgnoredDuringExecution": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.", +} + +func (NodeAffinity) SwaggerDoc() map[string]string { + return map_NodeAffinity +} + var map_NodeCondition = map[string]string{ "": "NodeCondition contains condition infromation for a node.", - "type": "Type of node condition, currently only Ready.", + "type": "Type of node condition.", "status": "Status of the condition, one of True, False, Unknown.", "lastHeartbeatTime": "Last time we got an update on a given condition.", "lastTransitionTime": "Last time the condition transit from one status to another.", @@ -684,6 +813,35 @@ func (NodeList) SwaggerDoc() map[string]string { return map_NodeList } +var map_NodeSelector = map[string]string{ + "": "A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.", + "nodeSelectorTerms": "Required. A list of node selector terms. The terms are ORed.", +} + +func (NodeSelector) SwaggerDoc() map[string]string { + return map_NodeSelector +} + +var map_NodeSelectorRequirement = map[string]string{ + "": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "key": "The label key that the selector applies to.", + "operator": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.", + "values": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.", +} + +func (NodeSelectorRequirement) SwaggerDoc() map[string]string { + return map_NodeSelectorRequirement +} + +var map_NodeSelectorTerm = map[string]string{ + "": "A null or empty node selector term matches no objects.", + "matchExpressions": "Required. A list of node selector requirements. The requirements are ANDed.", +} + +func (NodeSelectorTerm) SwaggerDoc() map[string]string { + return map_NodeSelectorTerm +} + var map_NodeSpec = map[string]string{ "": "NodeSpec describes the attributes that a node is created with.", "podCIDR": "PodCIDR represents the pod IP range assigned to the node.", @@ -698,12 +856,14 @@ func (NodeSpec) SwaggerDoc() map[string]string { var map_NodeStatus = map[string]string{ "": "NodeStatus is information about the current status of a node.", - "capacity": "Capacity represents the available resources of a node. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#capacity for more details.", + "capacity": "Capacity represents the total resources of a node. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#capacity for more details.", + "allocatable": "Allocatable represents the resources of a node that are available for scheduling. Defaults to Capacity.", "phase": "NodePhase is the recently observed lifecycle phase of the node. More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-phase", "conditions": "Conditions is an array of current observed node conditions. More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-condition", "addresses": "List of addresses reachable to the node. Queried from cloud provider, if available. More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-addresses", "daemonEndpoints": "Endpoints of daemons running on the Node.", "nodeInfo": "Set of ids/uuids to uniquely identify the node. More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-info", + "images": "List of container images on this node", } func (NodeStatus) SwaggerDoc() map[string]string { @@ -858,6 +1018,8 @@ var map_PersistentVolumeSource = map[string]string{ "cephfs": "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime", "fc": "FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.", "flocker": "Flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running", + "flexVolume": "FlexVolume represents a generic volume resource that is provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.", + "azureFile": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", } func (PersistentVolumeSource) SwaggerDoc() map[string]string { @@ -975,11 +1137,12 @@ func (PodProxyOptions) SwaggerDoc() map[string]string { } var map_PodSecurityContext = map[string]string{ - "": "PodSecurityContext holds pod-level security attributes and common container settings.", - "supplementalGroups": "SupplementalGroups can be used to specify a list of additional groups which the main container process will run as. This will be applied to all containers in the pod in addition to the primary group of the container.", - "seLinuxOptions": "SELinuxOptions is the SELinux context to be applied to all containers If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.", + "": "PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.", + "seLinuxOptions": "The SELinux context to be applied to all containers. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.", "runAsUser": "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.", "runAsNonRoot": "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "supplementalGroups": "A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.", + "fsGroup": "A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw ", } func (PodSecurityContext) SwaggerDoc() map[string]string { @@ -1065,10 +1228,23 @@ func (PodTemplateSpec) SwaggerDoc() map[string]string { return map_PodTemplateSpec } +var map_PreferredSchedulingTerm = map[string]string{ + "": "An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).", + "weight": "Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.", + "preference": "A node selector term, associated with the corresponding weight.", +} + +func (PreferredSchedulingTerm) SwaggerDoc() map[string]string { + return map_PreferredSchedulingTerm +} + var map_Probe = map[string]string{ - "": "Probe describes a liveness probe to be examined to the container.", + "": "Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.", "initialDelaySeconds": "Number of seconds after the container has started before liveness probes are initiated. More info: http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#container-probes", - "timeoutSeconds": "Number of seconds after which liveness probes timeout. Defaults to 1 second. More info: http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#container-probes", + "timeoutSeconds": "Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#container-probes", + "periodSeconds": "How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.", + "successThreshold": "Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.", + "failureThreshold": "Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.", } func (Probe) SwaggerDoc() map[string]string { @@ -1076,10 +1252,10 @@ func (Probe) SwaggerDoc() map[string]string { } var map_RBDVolumeSource = map[string]string{ - "": "RBDVolumeSource represents a Rados Block Device Mount that lasts the lifetime of a pod", + "": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.", "monitors": "A collection of Ceph monitors. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it", "image": "The rados image name. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it", - "fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#rbd", + "fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#rbd", "pool": "The rados pool name. Default is rbd. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it.", "user": "The rados user name. Default is admin. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it", "keyring": "Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it", @@ -1217,6 +1393,15 @@ func (Secret) SwaggerDoc() map[string]string { return map_Secret } +var map_SecretKeySelector = map[string]string{ + "": "SecretKeySelector selects a key of a Secret.", + "key": "The key of the secret to select from. Must be a valid secret key.", +} + +func (SecretKeySelector) SwaggerDoc() map[string]string { + return map_SecretKeySelector +} + var map_SecretList = map[string]string{ "": "SecretList is a list of Secret.", "metadata": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds", @@ -1228,8 +1413,8 @@ func (SecretList) SwaggerDoc() map[string]string { } var map_SecretVolumeSource = map[string]string{ - "": "SecretVolumeSource adapts a Secret into a VolumeSource. More info: http://releases.k8s.io/HEAD/docs/design/secrets.md", - "secretName": "SecretName is the name of a secret in the pod's namespace. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#secrets", + "": "Adapts a Secret into a volume.\n\nThe contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names. Secret volumes support ownership management and SELinux relabeling.", + "secretName": "Name of the secret in the pod's namespace to use. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#secrets", } func (SecretVolumeSource) SwaggerDoc() map[string]string { @@ -1237,12 +1422,13 @@ func (SecretVolumeSource) SwaggerDoc() map[string]string { } var map_SecurityContext = map[string]string{ - "": "SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.", - "capabilities": "The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime.", - "privileged": "Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.", - "seLinuxOptions": "The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", - "runAsUser": "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", - "runAsNonRoot": "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "": "SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.", + "capabilities": "The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime.", + "privileged": "Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.", + "seLinuxOptions": "The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "runAsUser": "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "runAsNonRoot": "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "readOnlyRootFilesystem": "Whether this container has a read-only root filesystem. Default is false.", } func (SecurityContext) SwaggerDoc() map[string]string { @@ -1368,7 +1554,7 @@ func (VolumeMount) SwaggerDoc() map[string]string { } var map_VolumeSource = map[string]string{ - "": "VolumeSource represents the source location of a volume to mount. Only one of its members may be specified.", + "": "Represents the source of a volume to mount. Only one of its members may be specified.", "hostPath": "HostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#hostpath", "emptyDir": "EmptyDir represents a temporary directory that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#emptydir", "gcePersistentDisk": "GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk", @@ -1380,11 +1566,14 @@ var map_VolumeSource = map[string]string{ "glusterfs": "Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/examples/glusterfs/README.md", "persistentVolumeClaim": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#persistentvolumeclaims", "rbd": "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md", + "flexVolume": "FlexVolume represents a generic volume resource that is provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.", "cinder": "Cinder represents a cinder volume attached and mounted on kubelets host machine More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", "cephfs": "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime", "flocker": "Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running", "downwardAPI": "DownwardAPI represents downward API about the pod that should populate this volume", "fc": "FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.", + "azureFile": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + "configMap": "ConfigMap represents a configMap that should populate this volume", } func (VolumeSource) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/kubernetes/pkg/api/validation/events.go b/vendor/k8s.io/kubernetes/pkg/api/validation/events.go index cc44d2b6b..d1a89c45c 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/validation/events.go +++ b/vendor/k8s.io/kubernetes/pkg/api/validation/events.go @@ -18,20 +18,27 @@ package validation import ( "k8s.io/kubernetes/pkg/api" - errs "k8s.io/kubernetes/pkg/util/fielderrors" "k8s.io/kubernetes/pkg/util/validation" + "k8s.io/kubernetes/pkg/util/validation/field" ) // ValidateEvent makes sure that the event makes sense. -func ValidateEvent(event *api.Event) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - // TODO: There is no namespace required for node. +func ValidateEvent(event *api.Event) field.ErrorList { + allErrs := field.ErrorList{} + // There is no namespace required for node. + // However, older client code accidentally sets event.Namespace + // to api.NamespaceDefault, so we accept that too, but "" is preferred. + if event.InvolvedObject.Kind == "Node" && + event.Namespace != api.NamespaceDefault && + event.Namespace != "" { + allErrs = append(allErrs, field.Invalid(field.NewPath("involvedObject", "namespace"), event.InvolvedObject.Namespace, "not allowed for node")) + } if event.InvolvedObject.Kind != "Node" && event.Namespace != event.InvolvedObject.Namespace { - allErrs = append(allErrs, errs.NewFieldInvalid("involvedObject.namespace", event.InvolvedObject.Namespace, "namespace does not match involvedObject")) + allErrs = append(allErrs, field.Invalid(field.NewPath("involvedObject", "namespace"), event.InvolvedObject.Namespace, "does not match involvedObject")) } if !validation.IsDNS1123Subdomain(event.Namespace) { - allErrs = append(allErrs, errs.NewFieldInvalid("namespace", event.Namespace, "")) + allErrs = append(allErrs, field.Invalid(field.NewPath("namespace"), event.Namespace, "")) } return allErrs } diff --git a/vendor/k8s.io/kubernetes/pkg/api/validation/name.go b/vendor/k8s.io/kubernetes/pkg/api/validation/name.go index ffd547b43..e36775b60 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/validation/name.go +++ b/vendor/k8s.io/kubernetes/pkg/api/validation/name.go @@ -27,14 +27,11 @@ var NameMayNotBe = []string{".", ".."} // NameMayNotContain specifies substrings that cannot be used in names specified as path segments (like the REST API or etcd store) var NameMayNotContain = []string{"/", "%"} -// ValidatePathSegmentName validates the name can be used as a path segment -func ValidatePathSegmentName(name string, prefix bool) (bool, string) { - // Only check for exact matches if this is the full name (not a prefix) - if prefix == false { - for _, illegalName := range NameMayNotBe { - if name == illegalName { - return false, fmt.Sprintf(`name may not be %q`, illegalName) - } +// IsValidPathSegmentName validates the name can be safely encoded as a path segment +func IsValidPathSegmentName(name string) (bool, string) { + for _, illegalName := range NameMayNotBe { + if name == illegalName { + return false, fmt.Sprintf(`name may not be %q`, illegalName) } } @@ -46,3 +43,24 @@ func ValidatePathSegmentName(name string, prefix bool) (bool, string) { return true, "" } + +// IsValidPathSegmentPrefix validates the name can be used as a prefix for a name which will be encoded as a path segment +// It does not check for exact matches with disallowed names, since an arbitrary suffix might make the name valid +func IsValidPathSegmentPrefix(name string) (bool, string) { + for _, illegalContent := range NameMayNotContain { + if strings.Contains(name, illegalContent) { + return false, fmt.Sprintf(`name may not contain %q`, illegalContent) + } + } + + return true, "" +} + +// ValidatePathSegmentName validates the name can be safely encoded as a path segment +func ValidatePathSegmentName(name string, prefix bool) (bool, string) { + if prefix { + return IsValidPathSegmentPrefix(name) + } else { + return IsValidPathSegmentName(name) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/validation/schema.go b/vendor/k8s.io/kubernetes/pkg/api/validation/schema.go index 86a2c9888..24c1e2619 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/validation/schema.go +++ b/vendor/k8s.io/kubernetes/pkg/api/validation/schema.go @@ -27,7 +27,6 @@ import ( "github.com/golang/glog" apiutil "k8s.io/kubernetes/pkg/api/util" utilerrors "k8s.io/kubernetes/pkg/util/errors" - errs "k8s.io/kubernetes/pkg/util/fielderrors" "k8s.io/kubernetes/pkg/util/yaml" ) @@ -67,11 +66,11 @@ func NewSwaggerSchemaFromBytes(data []byte) (Schema, error) { return schema, nil } -// validateList unpack a list and validate every item in the list. +// validateList unpacks a list and validate every item in the list. // It return nil if every item is ok. // Otherwise it return an error list contain errors of every item. -func (s *SwaggerSchema) validateList(obj map[string]interface{}) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func (s *SwaggerSchema) validateList(obj map[string]interface{}) []error { + allErrs := []error{} items, exists := obj["items"] if !exists { return append(allErrs, fmt.Errorf("no items field in %#v", obj)) @@ -160,8 +159,8 @@ func (s *SwaggerSchema) ValidateBytes(data []byte) error { return utilerrors.NewAggregate(allErrs) } -func (s *SwaggerSchema) ValidateObject(obj interface{}, fieldName, typeName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func (s *SwaggerSchema) ValidateObject(obj interface{}, fieldName, typeName string) []error { + allErrs := []error{} models := s.api.Models model, ok := models.At(typeName) if !ok { @@ -215,7 +214,7 @@ func (s *SwaggerSchema) ValidateObject(obj interface{}, fieldName, typeName stri // This matches type name in the swagger spec, such as "v1.Binding". var versionRegexp = regexp.MustCompile(`^v.+\..*`) -func (s *SwaggerSchema) validateField(value interface{}, fieldName, fieldType string, fieldDetails *swagger.ModelProperty) errs.ValidationErrorList { +func (s *SwaggerSchema) validateField(value interface{}, fieldName, fieldType string, fieldDetails *swagger.ModelProperty) []error { // TODO: caesarxuchao: because we have multiple group/versions and objects // may reference objects in other group, the commented out way of checking // if a filedType is a type defined by us is outdated. We use a hacky way @@ -229,7 +228,7 @@ func (s *SwaggerSchema) validateField(value interface{}, fieldName, fieldType st // if strings.HasPrefix(fieldType, apiVersion) { return s.ValidateObject(value, fieldName, fieldType) } - allErrs := errs.ValidationErrorList{} + allErrs := []error{} switch fieldType { case "string": // Be loose about what we accept for 'string' since we use IntOrString in a couple of places diff --git a/vendor/k8s.io/kubernetes/pkg/api/validation/schema_test.go b/vendor/k8s.io/kubernetes/pkg/api/validation/schema_test.go index b2b5ea1a6..be6fc83e7 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/validation/schema_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/validation/schema_test.go @@ -28,7 +28,7 @@ import ( ) func readPod(filename string) (string, error) { - data, err := ioutil.ReadFile("testdata/" + testapi.Default.Version() + "/" + filename) + data, err := ioutil.ReadFile("testdata/" + testapi.Default.GroupVersion().Version + "/" + filename) if err != nil { return "", err } @@ -36,7 +36,8 @@ func readPod(filename string) (string, error) { } func loadSchemaForTest() (Schema, error) { - pathToSwaggerSpec := "../../../api/swagger-spec/" + testapi.Default.Version() + ".json" + // TODO this path is broken + pathToSwaggerSpec := "../../../api/swagger-spec/" + testapi.Default.GroupVersion().Version + ".json" data, err := ioutil.ReadFile(pathToSwaggerSpec) if err != nil { return nil, err @@ -66,12 +67,12 @@ func TestValidateOk(t *testing.T) { } seed := rand.Int63() - apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(seed)) + apiObjectFuzzer := apitesting.FuzzerFor(nil, testapi.Default.InternalGroupVersion(), rand.NewSource(seed)) for i := 0; i < 5; i++ { for _, test := range tests { testObj := test.obj apiObjectFuzzer.Fuzz(testObj) - data, err := testapi.Default.Codec().Encode(testObj) + data, err := runtime.Encode(testapi.Default.Codec(), testObj) if err != nil { t.Errorf("unexpected error: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/validation/validation.go b/vendor/k8s.io/kubernetes/pkg/api/validation/validation.go index e270f8364..755e36bf9 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/validation/validation.go +++ b/vendor/k8s.io/kubernetes/pkg/api/validation/validation.go @@ -19,6 +19,7 @@ package validation import ( "encoding/json" "fmt" + "math" "net" "os" "path" @@ -30,10 +31,10 @@ import ( "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/capabilities" "k8s.io/kubernetes/pkg/labels" - "k8s.io/kubernetes/pkg/util" - errs "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/intstr" "k8s.io/kubernetes/pkg/util/sets" "k8s.io/kubernetes/pkg/util/validation" + "k8s.io/kubernetes/pkg/util/validation/field" "github.com/golang/glog" ) @@ -42,13 +43,13 @@ import ( // fields by default. var RepairMalformedUpdates bool = true -const cIdentifierErrorMsg string = `must be a C identifier (matching regex ` + validation.CIdentifierFmt + `): e.g. "my_name" or "MyName"` -const isNegativeErrorMsg string = `must be non-negative` -const isNotIntegerErrorMsg string = `must be an integer` +const isNegativeErrorMsg string = `must be greater than or equal to 0` const fieldImmutableErrorMsg string = `field is immutable` +const cIdentifierErrorMsg string = `must be a C identifier (matching regex ` + validation.CIdentifierFmt + `): e.g. "my_name" or "MyName"` +const isNotIntegerErrorMsg string = `must be an integer` -func intervalErrorMsg(lo, hi int) string { - return fmt.Sprintf(`must be greater than %d and less than %d`, lo, hi) +func InclusiveRangeErrorMsg(lo, hi int) string { + return fmt.Sprintf(`must be between %d and %d, inclusive`, lo, hi) } var labelValueErrorMsg string = fmt.Sprintf(`must have at most %d characters, matching regex %s: e.g. "MyValue" or ""`, validation.LabelValueMaxLength, validation.LabelValueFmt) @@ -56,44 +57,49 @@ var qualifiedNameErrorMsg string = fmt.Sprintf(`must be a qualified name (at mos var DNSSubdomainErrorMsg string = fmt.Sprintf(`must be a DNS subdomain (at most %d characters, matching regex %s): e.g. "example.com"`, validation.DNS1123SubdomainMaxLength, validation.DNS1123SubdomainFmt) var DNS1123LabelErrorMsg string = fmt.Sprintf(`must be a DNS label (at most %d characters, matching regex %s): e.g. "my-name"`, validation.DNS1123LabelMaxLength, validation.DNS1123LabelFmt) var DNS952LabelErrorMsg string = fmt.Sprintf(`must be a DNS 952 label (at most %d characters, matching regex %s): e.g. "my-name"`, validation.DNS952LabelMaxLength, validation.DNS952LabelFmt) -var pdPartitionErrorMsg string = intervalErrorMsg(0, 255) -var portRangeErrorMsg string = intervalErrorMsg(0, 65536) -var portNameErrorMsg string = fmt.Sprintf(`must be an IANA_SVC_NAME (at most 15 characters, matching regex %s, it must contain at least one letter [a-z], and hyphens cannot be adjacent to other hyphens): e.g. "http"`, validation.IdentifierNoHyphensBeginEndFmt) +var pdPartitionErrorMsg string = InclusiveRangeErrorMsg(1, 255) +var PortRangeErrorMsg string = InclusiveRangeErrorMsg(1, 65535) +var IdRangeErrorMsg string = InclusiveRangeErrorMsg(0, math.MaxInt32) +var PortNameErrorMsg string = fmt.Sprintf(`must be an IANA_SVC_NAME (at most 15 characters, matching regex %s, it must contain at least one letter [a-z], and hyphens cannot be adjacent to other hyphens): e.g. "http"`, validation.IdentifierNoHyphensBeginEndFmt) const totalAnnotationSizeLimitB int = 256 * (1 << 10) // 256 kB -func ValidateLabelName(labelName, fieldName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateLabelName(labelName string, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if !validation.IsQualifiedName(labelName) { - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName, labelName, qualifiedNameErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath, labelName, qualifiedNameErrorMsg)) } return allErrs } // ValidateLabels validates that a set of labels are correctly defined. -func ValidateLabels(labels map[string]string, field string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateLabels(labels map[string]string, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} for k, v := range labels { - allErrs = append(allErrs, ValidateLabelName(k, field)...) + allErrs = append(allErrs, ValidateLabelName(k, fldPath)...) if !validation.IsValidLabelValue(v) { - allErrs = append(allErrs, errs.NewFieldInvalid(field, v, labelValueErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath, v, labelValueErrorMsg)) } } return allErrs } // ValidateAnnotations validates that a set of annotations are correctly defined. -func ValidateAnnotations(annotations map[string]string, field string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} var totalSize int64 for k, v := range annotations { if !validation.IsQualifiedName(strings.ToLower(k)) { - allErrs = append(allErrs, errs.NewFieldInvalid(field, k, qualifiedNameErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath, k, qualifiedNameErrorMsg)) } totalSize += (int64)(len(k)) + (int64)(len(v)) } if totalSize > (int64)(totalAnnotationSizeLimitB) { - allErrs = append(allErrs, errs.NewFieldTooLong(field, "", totalAnnotationSizeLimitB)) + allErrs = append(allErrs, field.TooLong(fldPath, "", totalAnnotationSizeLimitB)) + } + + if annotations[api.AffinityAnnotationKey] != "" { + allErrs = append(allErrs, ValidateAffinityInPodAnnotations(annotations, fldPath)...) } return allErrs } @@ -218,404 +224,509 @@ func NameIsDNS952Label(name string, prefix bool) (bool, string) { } // Validates that given value is not negative. -func ValidatePositiveField(value int64, fieldName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateNonnegativeField(value int64, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if value < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName, value, isNegativeErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath, value, isNegativeErrorMsg)) } return allErrs } // Validates that a Quantity is not negative -func ValidatePositiveQuantity(value resource.Quantity, fieldName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateNonnegativeQuantity(value resource.Quantity, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if value.Cmp(resource.Quantity{}) < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName, value.String(), isNegativeErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath, value.String(), isNegativeErrorMsg)) + } + return allErrs +} + +func ValidateImmutableField(newVal, oldVal interface{}, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if !api.Semantic.DeepEqual(oldVal, newVal) { + allErrs = append(allErrs, field.Invalid(fldPath, newVal, fieldImmutableErrorMsg)) } return allErrs } // ValidateObjectMeta validates an object's metadata on creation. It expects that name generation has already // been performed. +// It doesn't return an error for rootscoped resources with namespace, because namespace should already be cleared before. // TODO: Remove calls to this method scattered in validations of specific resources, e.g., ValidatePodUpdate. -func ValidateObjectMeta(meta *api.ObjectMeta, requiresNamespace bool, nameFn ValidateNameFunc) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateObjectMeta(meta *api.ObjectMeta, requiresNamespace bool, nameFn ValidateNameFunc, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if len(meta.GenerateName) != 0 { if ok, qualifier := nameFn(meta.GenerateName, true); !ok { - allErrs = append(allErrs, errs.NewFieldInvalid("generateName", meta.GenerateName, qualifier)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("generateName"), meta.GenerateName, qualifier)) } } // If the generated name validates, but the calculated value does not, it's a problem with generation, and we // report it here. This may confuse users, but indicates a programming bug and still must be validated. // If there are multiple fields out of which one is required then add a or as a separator if len(meta.Name) == 0 { - requiredErr := errs.NewFieldRequired("name") - requiredErr.Detail = "name or generateName is required" - allErrs = append(allErrs, requiredErr) + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "name or generateName is required")) } else { if ok, qualifier := nameFn(meta.Name, false); !ok { - allErrs = append(allErrs, errs.NewFieldInvalid("name", meta.Name, qualifier)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), meta.Name, qualifier)) } } - allErrs = append(allErrs, ValidatePositiveField(meta.Generation, "generation")...) if requiresNamespace { if len(meta.Namespace) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("namespace")) + allErrs = append(allErrs, field.Required(fldPath.Child("namespace"), "")) } else if ok, _ := ValidateNamespaceName(meta.Namespace, false); !ok { - allErrs = append(allErrs, errs.NewFieldInvalid("namespace", meta.Namespace, DNS1123LabelErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("namespace"), meta.Namespace, DNS1123LabelErrorMsg)) } } else { if len(meta.Namespace) != 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("namespace", meta.Namespace, "namespace is not allowed on this type")) + allErrs = append(allErrs, field.Forbidden(fldPath.Child("namespace"), "not allowed on this type")) } } - allErrs = append(allErrs, ValidateLabels(meta.Labels, "labels")...) - allErrs = append(allErrs, ValidateAnnotations(meta.Annotations, "annotations")...) + allErrs = append(allErrs, ValidateNonnegativeField(meta.Generation, fldPath.Child("generation"))...) + allErrs = append(allErrs, ValidateLabels(meta.Labels, fldPath.Child("labels"))...) + allErrs = append(allErrs, ValidateAnnotations(meta.Annotations, fldPath.Child("annotations"))...) return allErrs } // ValidateObjectMetaUpdate validates an object's metadata when updated -func ValidateObjectMetaUpdate(new, old *api.ObjectMeta) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateObjectMetaUpdate(newMeta, oldMeta *api.ObjectMeta, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} - if !RepairMalformedUpdates && new.UID != old.UID { - allErrs = append(allErrs, errs.NewFieldInvalid("uid", new.UID, "field is immutable")) + if !RepairMalformedUpdates && newMeta.UID != oldMeta.UID { + allErrs = append(allErrs, field.Invalid(fldPath.Child("uid"), newMeta.UID, "field is immutable")) } // in the event it is left empty, set it, to allow clients more flexibility // TODO: remove the following code that repairs the update request when we retire the clients that modify the immutable fields. // Please do not copy this pattern elsewhere; validation functions should not be modifying the objects they are passed! if RepairMalformedUpdates { - if len(new.UID) == 0 { - new.UID = old.UID + if len(newMeta.UID) == 0 { + newMeta.UID = oldMeta.UID } // ignore changes to timestamp - if old.CreationTimestamp.IsZero() { - old.CreationTimestamp = new.CreationTimestamp + if oldMeta.CreationTimestamp.IsZero() { + oldMeta.CreationTimestamp = newMeta.CreationTimestamp } else { - new.CreationTimestamp = old.CreationTimestamp + newMeta.CreationTimestamp = oldMeta.CreationTimestamp } // an object can never remove a deletion timestamp or clear/change grace period seconds - if !old.DeletionTimestamp.IsZero() { - new.DeletionTimestamp = old.DeletionTimestamp + if !oldMeta.DeletionTimestamp.IsZero() { + newMeta.DeletionTimestamp = oldMeta.DeletionTimestamp } - if old.DeletionGracePeriodSeconds != nil && new.DeletionGracePeriodSeconds == nil { - new.DeletionGracePeriodSeconds = old.DeletionGracePeriodSeconds + if oldMeta.DeletionGracePeriodSeconds != nil && newMeta.DeletionGracePeriodSeconds == nil { + newMeta.DeletionGracePeriodSeconds = oldMeta.DeletionGracePeriodSeconds } } - // TODO: needs to check if new==nil && old !=nil after the repair logic is removed. - if new.DeletionGracePeriodSeconds != nil && old.DeletionGracePeriodSeconds != nil && *new.DeletionGracePeriodSeconds != *old.DeletionGracePeriodSeconds { - allErrs = append(allErrs, errs.NewFieldInvalid("deletionGracePeriodSeconds", new.DeletionGracePeriodSeconds, "field is immutable; may only be changed via deletion")) + // TODO: needs to check if newMeta==nil && oldMeta !=nil after the repair logic is removed. + if newMeta.DeletionGracePeriodSeconds != nil && oldMeta.DeletionGracePeriodSeconds != nil && *newMeta.DeletionGracePeriodSeconds != *oldMeta.DeletionGracePeriodSeconds { + allErrs = append(allErrs, field.Invalid(fldPath.Child("deletionGracePeriodSeconds"), newMeta.DeletionGracePeriodSeconds, "field is immutable; may only be changed via deletion")) } // Reject updates that don't specify a resource version - if new.ResourceVersion == "" { - allErrs = append(allErrs, errs.NewFieldInvalid("resourceVersion", new.ResourceVersion, "resourceVersion must be specified for an update")) + if len(newMeta.ResourceVersion) == 0 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("resourceVersion"), newMeta.ResourceVersion, "must be specified for an update")) } - if old.Name != new.Name { - allErrs = append(allErrs, errs.NewFieldInvalid("name", new.Name, fieldImmutableErrorMsg)) - } - if old.Namespace != new.Namespace { - allErrs = append(allErrs, errs.NewFieldInvalid("namespace", new.Namespace, fieldImmutableErrorMsg)) - } - if old.UID != new.UID { - allErrs = append(allErrs, errs.NewFieldInvalid("uid", new.UID, fieldImmutableErrorMsg)) - } - if old.CreationTimestamp != new.CreationTimestamp { - allErrs = append(allErrs, errs.NewFieldInvalid("creationTimestamp", new.CreationTimestamp, fieldImmutableErrorMsg)) - } + allErrs = append(allErrs, ValidateImmutableField(newMeta.Name, oldMeta.Name, fldPath.Child("name"))...) + allErrs = append(allErrs, ValidateImmutableField(newMeta.Namespace, oldMeta.Namespace, fldPath.Child("namespace"))...) + allErrs = append(allErrs, ValidateImmutableField(newMeta.UID, oldMeta.UID, fldPath.Child("uid"))...) + allErrs = append(allErrs, ValidateImmutableField(newMeta.CreationTimestamp, oldMeta.CreationTimestamp, fldPath.Child("creationTimestamp"))...) - allErrs = append(allErrs, ValidateLabels(new.Labels, "labels")...) - allErrs = append(allErrs, ValidateAnnotations(new.Annotations, "annotations")...) + allErrs = append(allErrs, ValidateLabels(newMeta.Labels, fldPath.Child("labels"))...) + allErrs = append(allErrs, ValidateAnnotations(newMeta.Annotations, fldPath.Child("annotations"))...) return allErrs } -func validateVolumes(volumes []api.Volume) (sets.String, errs.ValidationErrorList) { - allErrs := errs.ValidationErrorList{} +func validateVolumes(volumes []api.Volume, fldPath *field.Path) (sets.String, field.ErrorList) { + allErrs := field.ErrorList{} allNames := sets.String{} for i, vol := range volumes { - el := validateSource(&vol.VolumeSource).Prefix("source") + idxPath := fldPath.Index(i) + el := validateVolumeSource(&vol.VolumeSource, idxPath) if len(vol.Name) == 0 { - el = append(el, errs.NewFieldRequired("name")) + el = append(el, field.Required(idxPath.Child("name"), "")) } else if !validation.IsDNS1123Label(vol.Name) { - el = append(el, errs.NewFieldInvalid("name", vol.Name, DNS1123LabelErrorMsg)) + el = append(el, field.Invalid(idxPath.Child("name"), vol.Name, DNS1123LabelErrorMsg)) } else if allNames.Has(vol.Name) { - el = append(el, errs.NewFieldDuplicate("name", vol.Name)) + el = append(el, field.Duplicate(idxPath.Child("name"), vol.Name)) } if len(el) == 0 { allNames.Insert(vol.Name) } else { - allErrs = append(allErrs, el.PrefixIndex(i)...) + allErrs = append(allErrs, el...) } + } return allNames, allErrs } -func validateSource(source *api.VolumeSource) errs.ValidationErrorList { +func validateVolumeSource(source *api.VolumeSource, fldPath *field.Path) field.ErrorList { numVolumes := 0 - allErrs := errs.ValidationErrorList{} - if source.HostPath != nil { - numVolumes++ - allErrs = append(allErrs, validateHostPathVolumeSource(source.HostPath).Prefix("hostPath")...) - } + allErrs := field.ErrorList{} if source.EmptyDir != nil { numVolumes++ // EmptyDirs have nothing to validate } + if source.HostPath != nil { + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("hostPath"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateHostPathVolumeSource(source.HostPath, fldPath.Child("hostPath"))...) + } + } if source.GitRepo != nil { - numVolumes++ - allErrs = append(allErrs, validateGitRepoVolumeSource(source.GitRepo).Prefix("gitRepo")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("gitRepo"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateGitRepoVolumeSource(source.GitRepo, fldPath.Child("gitRepo"))...) + } } if source.GCEPersistentDisk != nil { - numVolumes++ - allErrs = append(allErrs, validateGCEPersistentDiskVolumeSource(source.GCEPersistentDisk).Prefix("persistentDisk")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("gcePersistentDisk"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateGCEPersistentDiskVolumeSource(source.GCEPersistentDisk, fldPath.Child("persistentDisk"))...) + } } if source.AWSElasticBlockStore != nil { - numVolumes++ - allErrs = append(allErrs, validateAWSElasticBlockStoreVolumeSource(source.AWSElasticBlockStore).Prefix("awsElasticBlockStore")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("awsElasticBlockStore"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateAWSElasticBlockStoreVolumeSource(source.AWSElasticBlockStore, fldPath.Child("awsElasticBlockStore"))...) + } } if source.Secret != nil { - numVolumes++ - allErrs = append(allErrs, validateSecretVolumeSource(source.Secret).Prefix("secret")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("secret"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateSecretVolumeSource(source.Secret, fldPath.Child("secret"))...) + } } if source.NFS != nil { - numVolumes++ - allErrs = append(allErrs, validateNFS(source.NFS).Prefix("nfs")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("nfs"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateNFSVolumeSource(source.NFS, fldPath.Child("nfs"))...) + } } if source.ISCSI != nil { - numVolumes++ - allErrs = append(allErrs, validateISCSIVolumeSource(source.ISCSI).Prefix("iscsi")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("iscsi"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateISCSIVolumeSource(source.ISCSI, fldPath.Child("iscsi"))...) + } } if source.Glusterfs != nil { - numVolumes++ - allErrs = append(allErrs, validateGlusterfs(source.Glusterfs).Prefix("glusterfs")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("glusterfs"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateGlusterfs(source.Glusterfs, fldPath.Child("glusterfs"))...) + } } if source.Flocker != nil { - numVolumes++ - allErrs = append(allErrs, validateFlocker(source.Flocker).Prefix("flocker")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("flocker"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateFlockerVolumeSource(source.Flocker, fldPath.Child("flocker"))...) + } } if source.PersistentVolumeClaim != nil { - numVolumes++ - allErrs = append(allErrs, validatePersistentClaimVolumeSource(source.PersistentVolumeClaim).Prefix("persistentVolumeClaim")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("persistentVolumeClaim"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validatePersistentClaimVolumeSource(source.PersistentVolumeClaim, fldPath.Child("persistentVolumeClaim"))...) + } } if source.RBD != nil { - numVolumes++ - allErrs = append(allErrs, validateRBD(source.RBD).Prefix("rbd")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("rbd"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateRBDVolumeSource(source.RBD, fldPath.Child("rbd"))...) + } } if source.Cinder != nil { - numVolumes++ - allErrs = append(allErrs, validateCinderVolumeSource(source.Cinder).Prefix("cinder")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("cinder"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateCinderVolumeSource(source.Cinder, fldPath.Child("cinder"))...) + } } if source.CephFS != nil { - numVolumes++ - allErrs = append(allErrs, validateCephFS(source.CephFS).Prefix("cephfs")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("cephFS"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateCephFSVolumeSource(source.CephFS, fldPath.Child("cephfs"))...) + } } if source.DownwardAPI != nil { - numVolumes++ - allErrs = append(allErrs, validateDownwardAPIVolumeSource(source.DownwardAPI).Prefix("downwardApi")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("downwarAPI"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateDownwardAPIVolumeSource(source.DownwardAPI, fldPath.Child("downwardAPI"))...) + } } if source.FC != nil { + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("fc"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateFCVolumeSource(source.FC, fldPath.Child("fc"))...) + } + } + if source.FlexVolume != nil { + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("flexVolume"), "may not specifiy more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateFlexVolumeSource(source.FlexVolume, fldPath.Child("flexVolume"))...) + } + } + if source.ConfigMap != nil { + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("configMap"), "may not specifiy more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateConfigMapVolumeSource(source.ConfigMap, fldPath.Child("configMap"))...) + } + } + if source.AzureFile != nil { numVolumes++ - allErrs = append(allErrs, validateFCVolumeSource(source.FC).Prefix("fc")...) + allErrs = append(allErrs, validateAzureFile(source.AzureFile, fldPath.Child("azureFile"))...) } - if numVolumes != 1 { - allErrs = append(allErrs, errs.NewFieldInvalid("", source, "exactly 1 volume type is required")) + if numVolumes == 0 { + allErrs = append(allErrs, field.Required(fldPath, "must specify a volume type")) } return allErrs } -func validateHostPathVolumeSource(hostPath *api.HostPathVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if hostPath.Path == "" { - allErrs = append(allErrs, errs.NewFieldRequired("path")) +func validateHostPathVolumeSource(hostPath *api.HostPathVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(hostPath.Path) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("path"), "")) } return allErrs } -func validateGitRepoVolumeSource(gitRepo *api.GitRepoVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if gitRepo.Repository == "" { - allErrs = append(allErrs, errs.NewFieldRequired("repository")) +func validateGitRepoVolumeSource(gitRepo *api.GitRepoVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(gitRepo.Repository) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("repository"), "")) } + + pathErrs := validateVolumeSourcePath(gitRepo.Directory, fldPath.Child("directory")) + allErrs = append(allErrs, pathErrs...) return allErrs } -func validateISCSIVolumeSource(iscsi *api.ISCSIVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if iscsi.TargetPortal == "" { - allErrs = append(allErrs, errs.NewFieldRequired("targetPortal")) +func validateISCSIVolumeSource(iscsi *api.ISCSIVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(iscsi.TargetPortal) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("targetPortal"), "")) } - if iscsi.IQN == "" { - allErrs = append(allErrs, errs.NewFieldRequired("iqn")) - } - if iscsi.FSType == "" { - allErrs = append(allErrs, errs.NewFieldRequired("fsType")) + if len(iscsi.IQN) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("iqn"), "")) } if iscsi.Lun < 0 || iscsi.Lun > 255 { - allErrs = append(allErrs, errs.NewFieldInvalid("lun", iscsi.Lun, "")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("lun"), iscsi.Lun, InclusiveRangeErrorMsg(0, 255))) } return allErrs } -func validateFCVolumeSource(fc *api.FCVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateFCVolumeSource(fc *api.FCVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if len(fc.TargetWWNs) < 1 { - allErrs = append(allErrs, errs.NewFieldRequired("targetWWNs")) - } - if fc.FSType == "" { - allErrs = append(allErrs, errs.NewFieldRequired("fsType")) + allErrs = append(allErrs, field.Required(fldPath.Child("targetWWNs"), "")) } if fc.Lun == nil { - allErrs = append(allErrs, errs.NewFieldRequired("lun")) + allErrs = append(allErrs, field.Required(fldPath.Child("lun"), "")) } else { if *fc.Lun < 0 || *fc.Lun > 255 { - allErrs = append(allErrs, errs.NewFieldInvalid("lun", fc.Lun, "")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("lun"), fc.Lun, InclusiveRangeErrorMsg(0, 255))) } } return allErrs } -func validateGCEPersistentDiskVolumeSource(PD *api.GCEPersistentDiskVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if PD.PDName == "" { - allErrs = append(allErrs, errs.NewFieldRequired("pdName")) +func validateGCEPersistentDiskVolumeSource(pd *api.GCEPersistentDiskVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(pd.PDName) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("pdName"), "")) } - if PD.FSType == "" { - allErrs = append(allErrs, errs.NewFieldRequired("fsType")) + if pd.Partition < 0 || pd.Partition > 255 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("partition"), pd.Partition, pdPartitionErrorMsg)) + } + return allErrs +} + +func validateAWSElasticBlockStoreVolumeSource(PD *api.AWSElasticBlockStoreVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(PD.VolumeID) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("volumeID"), "")) } if PD.Partition < 0 || PD.Partition > 255 { - allErrs = append(allErrs, errs.NewFieldInvalid("partition", PD.Partition, pdPartitionErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("partition"), PD.Partition, pdPartitionErrorMsg)) } return allErrs } -func validateAWSElasticBlockStoreVolumeSource(PD *api.AWSElasticBlockStoreVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if PD.VolumeID == "" { - allErrs = append(allErrs, errs.NewFieldRequired("volumeID")) - } - if PD.FSType == "" { - allErrs = append(allErrs, errs.NewFieldRequired("fsType")) - } - if PD.Partition < 0 || PD.Partition > 255 { - allErrs = append(allErrs, errs.NewFieldInvalid("partition", PD.Partition, pdPartitionErrorMsg)) +func validateSecretVolumeSource(secretSource *api.SecretVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(secretSource.SecretName) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("secretName"), "")) } return allErrs } -func validateSecretVolumeSource(secretSource *api.SecretVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if secretSource.SecretName == "" { - allErrs = append(allErrs, errs.NewFieldRequired("secretName")) +func validateConfigMapVolumeSource(configMapSource *api.ConfigMapVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(configMapSource.Name) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "")) } return allErrs } -func validatePersistentClaimVolumeSource(claim *api.PersistentVolumeClaimVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if claim.ClaimName == "" { - allErrs = append(allErrs, errs.NewFieldRequired("claimName")) +func validatePersistentClaimVolumeSource(claim *api.PersistentVolumeClaimVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(claim.ClaimName) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("claimName"), "")) } return allErrs } -func validateNFS(nfs *api.NFSVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if nfs.Server == "" { - allErrs = append(allErrs, errs.NewFieldRequired("server")) +func validateNFSVolumeSource(nfs *api.NFSVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(nfs.Server) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("server"), "")) } - if nfs.Path == "" { - allErrs = append(allErrs, errs.NewFieldRequired("path")) + if len(nfs.Path) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("path"), "")) } if !path.IsAbs(nfs.Path) { - allErrs = append(allErrs, errs.NewFieldInvalid("path", nfs.Path, "must be an absolute path")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("path"), nfs.Path, "must be an absolute path")) } return allErrs } -func validateGlusterfs(glusterfs *api.GlusterfsVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if glusterfs.EndpointsName == "" { - allErrs = append(allErrs, errs.NewFieldRequired("endpoints")) +func validateGlusterfs(glusterfs *api.GlusterfsVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(glusterfs.EndpointsName) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("endpoints"), "")) } - if glusterfs.Path == "" { - allErrs = append(allErrs, errs.NewFieldRequired("path")) + if len(glusterfs.Path) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("path"), "")) } return allErrs } -func validateFlocker(flocker *api.FlockerVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if flocker.DatasetName == "" { - allErrs = append(allErrs, errs.NewFieldRequired("datasetName")) +func validateFlockerVolumeSource(flocker *api.FlockerVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(flocker.DatasetName) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("datasetName"), "")) } if strings.Contains(flocker.DatasetName, "/") { - allErrs = append(allErrs, errs.NewFieldInvalid("datasetName", flocker.DatasetName, "must not contain '/'")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("datasetName"), flocker.DatasetName, "must not contain '/'")) } return allErrs } var validDownwardAPIFieldPathExpressions = sets.NewString("metadata.name", "metadata.namespace", "metadata.labels", "metadata.annotations") -func validateDownwardAPIVolumeSource(downwardAPIVolume *api.DownwardAPIVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateDownwardAPIVolumeSource(downwardAPIVolume *api.DownwardAPIVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} for _, downwardAPIVolumeFile := range downwardAPIVolume.Items { if len(downwardAPIVolumeFile.Path) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("path")) + allErrs = append(allErrs, field.Required(fldPath.Child("path"), "")) } - if path.IsAbs(downwardAPIVolumeFile.Path) { - allErrs = append(allErrs, errs.NewFieldForbidden("path", "must not be an absolute path")) - } - items := strings.Split(downwardAPIVolumeFile.Path, string(os.PathSeparator)) - for _, item := range items { - if item == ".." { - allErrs = append(allErrs, errs.NewFieldInvalid("path", downwardAPIVolumeFile.Path, "must not contain \"..\".")) - } - } - if strings.HasPrefix(items[0], "..") && len(items[0]) > 2 { - allErrs = append(allErrs, errs.NewFieldInvalid("path", downwardAPIVolumeFile.Path, "must not start with \"..\".")) - } - allErrs = append(allErrs, validateObjectFieldSelector(&downwardAPIVolumeFile.FieldRef, &validDownwardAPIFieldPathExpressions).Prefix("FieldRef")...) + allErrs = append(allErrs, validateVolumeSourcePath(downwardAPIVolumeFile.Path, fldPath.Child("path"))...) + allErrs = append(allErrs, validateObjectFieldSelector(&downwardAPIVolumeFile.FieldRef, &validDownwardAPIFieldPathExpressions, fldPath.Child("fieldRef"))...) } return allErrs } -func validateRBD(rbd *api.RBDVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +// This validate will make sure targetPath: +// 1. is not abs path +// 2. does not contain '..' +// 3. does not start with '..' +func validateVolumeSourcePath(targetPath string, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if path.IsAbs(targetPath) { + allErrs = append(allErrs, field.Invalid(fldPath, targetPath, "must be a relative path")) + } + // TODO assume OS of api server & nodes are the same for now + items := strings.Split(targetPath, string(os.PathSeparator)) + + for _, item := range items { + if item == ".." { + allErrs = append(allErrs, field.Invalid(fldPath, targetPath, "must not contain '..'")) + } + } + if strings.HasPrefix(items[0], "..") && len(items[0]) > 2 { + allErrs = append(allErrs, field.Invalid(fldPath, targetPath, "must not start with '..'")) + } + return allErrs +} + +func validateRBDVolumeSource(rbd *api.RBDVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if len(rbd.CephMonitors) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("monitors")) + allErrs = append(allErrs, field.Required(fldPath.Child("monitors"), "")) } - if rbd.RBDImage == "" { - allErrs = append(allErrs, errs.NewFieldRequired("image")) - } - if rbd.FSType == "" { - allErrs = append(allErrs, errs.NewFieldRequired("fsType")) + if len(rbd.RBDImage) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("image"), "")) } return allErrs } -func validateCinderVolumeSource(cd *api.CinderVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if cd.VolumeID == "" { - allErrs = append(allErrs, errs.NewFieldRequired("volumeID")) - } - if cd.FSType == "" || (cd.FSType != "ext3" && cd.FSType != "ext4") { - allErrs = append(allErrs, errs.NewFieldRequired("fsType required and should be of type ext3 or ext4")) +func validateCinderVolumeSource(cd *api.CinderVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(cd.VolumeID) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("volumeID"), "")) } return allErrs } -func validateCephFS(cephfs *api.CephFSVolumeSource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateCephFSVolumeSource(cephfs *api.CephFSVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if len(cephfs.Monitors) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("monitors")) + allErrs = append(allErrs, field.Required(fldPath.Child("monitors"), "")) + } + return allErrs +} + +func validateFlexVolumeSource(fv *api.FlexVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(fv.Driver) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("driver"), "")) + } + return allErrs +} + +func validateAzureFile(azure *api.AzureFileVolumeSource, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if azure.SecretName == "" { + allErrs = append(allErrs, field.Required(fldPath.Child("secretName"), "")) + } + if azure.ShareName == "" { + allErrs = append(allErrs, field.Required(fldPath.Child("shareName"), "")) } return allErrs } @@ -624,87 +735,140 @@ func ValidatePersistentVolumeName(name string, prefix bool) (bool, string) { return NameIsDNSSubdomain(name, prefix) } -func ValidatePersistentVolume(pv *api.PersistentVolume) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&pv.ObjectMeta, false, ValidatePersistentVolumeName).Prefix("metadata")...) +var supportedAccessModes = sets.NewString(string(api.ReadWriteOnce), string(api.ReadOnlyMany), string(api.ReadWriteMany)) +func ValidatePersistentVolume(pv *api.PersistentVolume) field.ErrorList { + allErrs := ValidateObjectMeta(&pv.ObjectMeta, false, ValidatePersistentVolumeName, field.NewPath("metadata")) + + specPath := field.NewPath("spec") if len(pv.Spec.AccessModes) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("persistentVolume.AccessModes")) + allErrs = append(allErrs, field.Required(specPath.Child("accessModes"), "")) } - for _, mode := range pv.Spec.AccessModes { - if mode != api.ReadWriteOnce && mode != api.ReadOnlyMany && mode != api.ReadWriteMany { - allErrs = append(allErrs, errs.NewFieldInvalid("persistentVolume.Spec.AccessModes", mode, fmt.Sprintf("only %s, %s, and %s are valid", api.ReadWriteOnce, api.ReadOnlyMany, api.ReadWriteMany))) + if !supportedAccessModes.Has(string(mode)) { + allErrs = append(allErrs, field.NotSupported(specPath.Child("accessModes"), mode, supportedAccessModes.List())) } } if len(pv.Spec.Capacity) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("persistentVolume.Capacity")) + allErrs = append(allErrs, field.Required(specPath.Child("capacity"), "")) } if _, ok := pv.Spec.Capacity[api.ResourceStorage]; !ok || len(pv.Spec.Capacity) > 1 { - allErrs = append(allErrs, errs.NewFieldInvalid("", pv.Spec.Capacity, fmt.Sprintf("only %s is expected", api.ResourceStorage))) + allErrs = append(allErrs, field.NotSupported(specPath.Child("capacity"), pv.Spec.Capacity, []string{string(api.ResourceStorage)})) } - - for _, qty := range pv.Spec.Capacity { - allErrs = append(allErrs, validateBasicResource(qty)...) + capPath := specPath.Child("capacity") + for r, qty := range pv.Spec.Capacity { + allErrs = append(allErrs, validateBasicResource(qty, capPath.Key(string(r)))...) } numVolumes := 0 if pv.Spec.HostPath != nil { - numVolumes++ - allErrs = append(allErrs, validateHostPathVolumeSource(pv.Spec.HostPath).Prefix("hostPath")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("hostPath"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateHostPathVolumeSource(pv.Spec.HostPath, specPath.Child("hostPath"))...) + } } if pv.Spec.GCEPersistentDisk != nil { - numVolumes++ - allErrs = append(allErrs, validateGCEPersistentDiskVolumeSource(pv.Spec.GCEPersistentDisk).Prefix("persistentDisk")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("gcePersistentDisk"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateGCEPersistentDiskVolumeSource(pv.Spec.GCEPersistentDisk, specPath.Child("persistentDisk"))...) + } } if pv.Spec.AWSElasticBlockStore != nil { - numVolumes++ - allErrs = append(allErrs, validateAWSElasticBlockStoreVolumeSource(pv.Spec.AWSElasticBlockStore).Prefix("awsElasticBlockStore")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("awsElasticBlockStore"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateAWSElasticBlockStoreVolumeSource(pv.Spec.AWSElasticBlockStore, specPath.Child("awsElasticBlockStore"))...) + } } if pv.Spec.Glusterfs != nil { - numVolumes++ - allErrs = append(allErrs, validateGlusterfs(pv.Spec.Glusterfs).Prefix("glusterfs")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("glusterfs"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateGlusterfs(pv.Spec.Glusterfs, specPath.Child("glusterfs"))...) + } } if pv.Spec.Flocker != nil { - numVolumes++ - allErrs = append(allErrs, validateFlocker(pv.Spec.Flocker).Prefix("flocker")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("flocker"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateFlockerVolumeSource(pv.Spec.Flocker, specPath.Child("flocker"))...) + } } if pv.Spec.NFS != nil { - numVolumes++ - allErrs = append(allErrs, validateNFS(pv.Spec.NFS).Prefix("nfs")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("nfs"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateNFSVolumeSource(pv.Spec.NFS, specPath.Child("nfs"))...) + } } if pv.Spec.RBD != nil { - numVolumes++ - allErrs = append(allErrs, validateRBD(pv.Spec.RBD).Prefix("rbd")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("rbd"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateRBDVolumeSource(pv.Spec.RBD, specPath.Child("rbd"))...) + } } if pv.Spec.CephFS != nil { - numVolumes++ - allErrs = append(allErrs, validateCephFS(pv.Spec.CephFS).Prefix("cephfs")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("cephFS"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateCephFSVolumeSource(pv.Spec.CephFS, specPath.Child("cephfs"))...) + } } if pv.Spec.ISCSI != nil { - numVolumes++ - allErrs = append(allErrs, validateISCSIVolumeSource(pv.Spec.ISCSI).Prefix("iscsi")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("iscsi"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateISCSIVolumeSource(pv.Spec.ISCSI, specPath.Child("iscsi"))...) + } } if pv.Spec.Cinder != nil { - numVolumes++ - allErrs = append(allErrs, validateCinderVolumeSource(pv.Spec.Cinder).Prefix("cinder")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("cinder"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateCinderVolumeSource(pv.Spec.Cinder, specPath.Child("cinder"))...) + } } if pv.Spec.FC != nil { - numVolumes++ - allErrs = append(allErrs, validateFCVolumeSource(pv.Spec.FC).Prefix("fc")...) + if numVolumes > 0 { + allErrs = append(allErrs, field.Forbidden(specPath.Child("fc"), "may not specify more than 1 volume type")) + } else { + numVolumes++ + allErrs = append(allErrs, validateFCVolumeSource(pv.Spec.FC, specPath.Child("fc"))...) + } } - if numVolumes != 1 { - allErrs = append(allErrs, errs.NewFieldInvalid("", pv.Spec.PersistentVolumeSource, "exactly 1 volume type is required")) + if pv.Spec.FlexVolume != nil { + numVolumes++ + allErrs = append(allErrs, validateFlexVolumeSource(pv.Spec.FlexVolume, specPath.Child("flexVolume"))...) + } + if pv.Spec.AzureFile != nil { + numVolumes++ + allErrs = append(allErrs, validateAzureFile(pv.Spec.AzureFile, specPath.Child("azureFile"))...) + } + if numVolumes == 0 { + allErrs = append(allErrs, field.Required(specPath, "must specify a volume type")) } return allErrs } // ValidatePersistentVolumeUpdate tests to see if the update is legal for an end user to make. // newPv is updated with fields that cannot be changed. -func ValidatePersistentVolumeUpdate(newPv, oldPv *api.PersistentVolume) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidatePersistentVolumeUpdate(newPv, oldPv *api.PersistentVolume) field.ErrorList { + allErrs := field.ErrorList{} allErrs = ValidatePersistentVolume(newPv) newPv.Status = oldPv.Status return allErrs @@ -712,50 +876,56 @@ func ValidatePersistentVolumeUpdate(newPv, oldPv *api.PersistentVolume) errs.Val // ValidatePersistentVolumeStatusUpdate tests to see if the status update is legal for an end user to make. // newPv is updated with fields that cannot be changed. -func ValidatePersistentVolumeStatusUpdate(newPv, oldPv *api.PersistentVolume) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newPv.ObjectMeta, &oldPv.ObjectMeta).Prefix("metadata")...) - if newPv.ResourceVersion == "" { - allErrs = append(allErrs, errs.NewFieldRequired("resourceVersion")) +func ValidatePersistentVolumeStatusUpdate(newPv, oldPv *api.PersistentVolume) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newPv.ObjectMeta, &oldPv.ObjectMeta, field.NewPath("metadata")) + if len(newPv.ResourceVersion) == 0 { + allErrs = append(allErrs, field.Required(field.NewPath("resourceVersion"), "")) } newPv.Spec = oldPv.Spec return allErrs } -func ValidatePersistentVolumeClaim(pvc *api.PersistentVolumeClaim) errs.ValidationErrorList { - allErrs := ValidateObjectMeta(&pvc.ObjectMeta, true, ValidatePersistentVolumeName) +func ValidatePersistentVolumeClaim(pvc *api.PersistentVolumeClaim) field.ErrorList { + allErrs := ValidateObjectMeta(&pvc.ObjectMeta, true, ValidatePersistentVolumeName, field.NewPath("metadata")) + specPath := field.NewPath("spec") if len(pvc.Spec.AccessModes) == 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("persistentVolumeClaim.Spec.AccessModes", pvc.Spec.AccessModes, "at least 1 PersistentVolumeAccessMode is required")) + allErrs = append(allErrs, field.Required(specPath.Child("accessModes"), "at least 1 accessMode is required")) } for _, mode := range pvc.Spec.AccessModes { if mode != api.ReadWriteOnce && mode != api.ReadOnlyMany && mode != api.ReadWriteMany { - allErrs = append(allErrs, errs.NewFieldInvalid("persistentVolumeClaim.Spec.AccessModes", mode, fmt.Sprintf("only %s, %s, and %s are valid", api.ReadWriteOnce, api.ReadOnlyMany, api.ReadWriteMany))) + allErrs = append(allErrs, field.NotSupported(specPath.Child("accessModes"), mode, supportedAccessModes.List())) } } if _, ok := pvc.Spec.Resources.Requests[api.ResourceStorage]; !ok { - allErrs = append(allErrs, errs.NewFieldInvalid("persistentVolumeClaim.Spec.Resources.Requests", pvc.Spec.Resources.Requests, "No Storage size specified")) + allErrs = append(allErrs, field.Required(specPath.Child("resources").Key(string(api.ResourceStorage)), "")) } return allErrs } -func ValidatePersistentVolumeClaimUpdate(newPvc, oldPvc *api.PersistentVolumeClaim) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = ValidatePersistentVolumeClaim(newPvc) +func ValidatePersistentVolumeClaimUpdate(newPvc, oldPvc *api.PersistentVolumeClaim) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newPvc.ObjectMeta, &oldPvc.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, ValidatePersistentVolumeClaim(newPvc)...) + // if a pvc had a bound volume, we should not allow updates to resources or access modes + if len(oldPvc.Spec.VolumeName) != 0 { + if !api.Semantic.DeepEqual(newPvc.Spec, oldPvc.Spec) { + allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "spec is immutable once a claim has been bound to a volume")) + } + } newPvc.Status = oldPvc.Status return allErrs } -func ValidatePersistentVolumeClaimStatusUpdate(newPvc, oldPvc *api.PersistentVolumeClaim) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newPvc.ObjectMeta, &oldPvc.ObjectMeta).Prefix("metadata")...) - if newPvc.ResourceVersion == "" { - allErrs = append(allErrs, errs.NewFieldRequired("resourceVersion")) +func ValidatePersistentVolumeClaimStatusUpdate(newPvc, oldPvc *api.PersistentVolumeClaim) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newPvc.ObjectMeta, &oldPvc.ObjectMeta, field.NewPath("metadata")) + if len(newPvc.ResourceVersion) == 0 { + allErrs = append(allErrs, field.Required(field.NewPath("resourceVersion"), "")) } if len(newPvc.Spec.AccessModes) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("persistentVolume.AccessModes")) + allErrs = append(allErrs, field.Required(field.NewPath("Spec", "accessModes"), "")) } - for _, qty := range newPvc.Status.Capacity { - allErrs = append(allErrs, validateBasicResource(qty)...) + capPath := field.NewPath("status", "capacity") + for r, qty := range newPvc.Status.Capacity { + allErrs = append(allErrs, validateBasicResource(qty, capPath.Key(string(r)))...) } newPvc.Spec = oldPvc.Spec return allErrs @@ -763,59 +933,57 @@ func ValidatePersistentVolumeClaimStatusUpdate(newPvc, oldPvc *api.PersistentVol var supportedPortProtocols = sets.NewString(string(api.ProtocolTCP), string(api.ProtocolUDP)) -func validatePorts(ports []api.ContainerPort) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateContainerPorts(ports []api.ContainerPort, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} allNames := sets.String{} for i, port := range ports { - pErrs := errs.ValidationErrorList{} + idxPath := fldPath.Index(i) if len(port.Name) > 0 { if !validation.IsValidPortName(port.Name) { - pErrs = append(pErrs, errs.NewFieldInvalid("name", port.Name, portNameErrorMsg)) + allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), port.Name, PortNameErrorMsg)) } else if allNames.Has(port.Name) { - pErrs = append(pErrs, errs.NewFieldDuplicate("name", port.Name)) + allErrs = append(allErrs, field.Duplicate(idxPath.Child("name"), port.Name)) } else { allNames.Insert(port.Name) } } if port.ContainerPort == 0 { - pErrs = append(pErrs, errs.NewFieldInvalid("containerPort", port.ContainerPort, portRangeErrorMsg)) + allErrs = append(allErrs, field.Invalid(idxPath.Child("containerPort"), port.ContainerPort, PortRangeErrorMsg)) } else if !validation.IsValidPortNum(port.ContainerPort) { - pErrs = append(pErrs, errs.NewFieldInvalid("containerPort", port.ContainerPort, portRangeErrorMsg)) + allErrs = append(allErrs, field.Invalid(idxPath.Child("containerPort"), port.ContainerPort, PortRangeErrorMsg)) } if port.HostPort != 0 && !validation.IsValidPortNum(port.HostPort) { - pErrs = append(pErrs, errs.NewFieldInvalid("hostPort", port.HostPort, portRangeErrorMsg)) + allErrs = append(allErrs, field.Invalid(idxPath.Child("hostPort"), port.HostPort, PortRangeErrorMsg)) } if len(port.Protocol) == 0 { - pErrs = append(pErrs, errs.NewFieldRequired("protocol")) + allErrs = append(allErrs, field.Required(idxPath.Child("protocol"), "")) } else if !supportedPortProtocols.Has(string(port.Protocol)) { - pErrs = append(pErrs, errs.NewFieldValueNotSupported("protocol", port.Protocol, supportedPortProtocols.List())) + allErrs = append(allErrs, field.NotSupported(idxPath.Child("protocol"), port.Protocol, supportedPortProtocols.List())) } - allErrs = append(allErrs, pErrs.PrefixIndex(i)...) } return allErrs } -func validateEnv(vars []api.EnvVar) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateEnv(vars []api.EnvVar, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} for i, ev := range vars { - vErrs := errs.ValidationErrorList{} + idxPath := fldPath.Index(i) if len(ev.Name) == 0 { - vErrs = append(vErrs, errs.NewFieldRequired("name")) + allErrs = append(allErrs, field.Required(idxPath.Child("name"), "")) } else if !validation.IsCIdentifier(ev.Name) { - vErrs = append(vErrs, errs.NewFieldInvalid("name", ev.Name, cIdentifierErrorMsg)) + allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), ev.Name, cIdentifierErrorMsg)) } - vErrs = append(vErrs, validateEnvVarValueFrom(ev).Prefix("valueFrom")...) - allErrs = append(allErrs, vErrs.PrefixIndex(i)...) + allErrs = append(allErrs, validateEnvVarValueFrom(ev, idxPath.Child("valueFrom"))...) } return allErrs } var validFieldPathExpressionsEnv = sets.NewString("metadata.name", "metadata.namespace", "status.podIP") -func validateEnvVarValueFrom(ev api.EnvVar) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateEnvVarValueFrom(ev api.EnvVar, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if ev.ValueFrom == nil { return allErrs @@ -823,263 +991,328 @@ func validateEnvVarValueFrom(ev api.EnvVar) errs.ValidationErrorList { numSources := 0 - switch { - case ev.ValueFrom.FieldRef != nil: + if ev.ValueFrom.FieldRef != nil { numSources++ - allErrs = append(allErrs, validateObjectFieldSelector(ev.ValueFrom.FieldRef, &validFieldPathExpressionsEnv).Prefix("fieldRef")...) + allErrs = append(allErrs, validateObjectFieldSelector(ev.ValueFrom.FieldRef, &validFieldPathExpressionsEnv, fldPath.Child("fieldRef"))...) + } + if ev.ValueFrom.ConfigMapKeyRef != nil { + numSources++ + allErrs = append(allErrs, validateConfigMapKeySelector(ev.ValueFrom.ConfigMapKeyRef, fldPath.Child("configMapKeyRef"))...) + } + if ev.ValueFrom.SecretKeyRef != nil { + numSources++ + allErrs = append(allErrs, validateSecretKeySelector(ev.ValueFrom.SecretKeyRef, fldPath.Child("secretKeyRef"))...) } - if ev.Value != "" && numSources != 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("", "", "sources cannot be specified when value is not empty")) + if len(ev.Value) != 0 { + if numSources != 0 { + allErrs = append(allErrs, field.Invalid(fldPath, "", "may not be specified when `value` is not empty")) + } + } else if numSources != 1 { + allErrs = append(allErrs, field.Invalid(fldPath, "", "may not have more than one field specified at a time")) } return allErrs } -func validateObjectFieldSelector(fs *api.ObjectFieldSelector, expressions *sets.String) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateObjectFieldSelector(fs *api.ObjectFieldSelector, expressions *sets.String, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} - if fs.APIVersion == "" { - allErrs = append(allErrs, errs.NewFieldRequired("apiVersion")) - } else if fs.FieldPath == "" { - allErrs = append(allErrs, errs.NewFieldRequired("fieldPath")) + if len(fs.APIVersion) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("apiVersion"), "")) + } else if len(fs.FieldPath) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("fieldPath"), "")) } else { internalFieldPath, _, err := api.Scheme.ConvertFieldLabel(fs.APIVersion, "Pod", fs.FieldPath, "") if err != nil { - allErrs = append(allErrs, errs.NewFieldInvalid("fieldPath", fs.FieldPath, "error converting fieldPath")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("fieldPath"), fs.FieldPath, fmt.Sprintf("error converting fieldPath: %v", err))) } else if !expressions.Has(internalFieldPath) { - allErrs = append(allErrs, errs.NewFieldValueNotSupported("fieldPath", internalFieldPath, expressions.List())) + allErrs = append(allErrs, field.NotSupported(fldPath.Child("fieldPath"), internalFieldPath, expressions.List())) } } return allErrs } -func validateVolumeMounts(mounts []api.VolumeMount, volumes sets.String) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateConfigMapKeySelector(s *api.ConfigMapKeySelector, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if len(s.Name) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "")) + } + if len(s.Key) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("key"), "")) + } else if !IsSecretKey(s.Key) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("key"), s.Key, fmt.Sprintf("must have at most %d characters and match regex %s", validation.DNS1123SubdomainMaxLength, SecretKeyFmt))) + } + + return allErrs +} + +func validateSecretKeySelector(s *api.SecretKeySelector, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if len(s.Name) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "")) + } + if len(s.Key) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("key"), "")) + } else if !IsSecretKey(s.Key) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("key"), s.Key, fmt.Sprintf("must have at most %d characters and match regex %s", validation.DNS1123SubdomainMaxLength, SecretKeyFmt))) + } + + return allErrs +} + +func validateVolumeMounts(mounts []api.VolumeMount, volumes sets.String, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} for i, mnt := range mounts { - mErrs := errs.ValidationErrorList{} + idxPath := fldPath.Index(i) if len(mnt.Name) == 0 { - mErrs = append(mErrs, errs.NewFieldRequired("name")) + allErrs = append(allErrs, field.Required(idxPath.Child("name"), "")) } else if !volumes.Has(mnt.Name) { - mErrs = append(mErrs, errs.NewFieldNotFound("name", mnt.Name)) + allErrs = append(allErrs, field.NotFound(idxPath.Child("name"), mnt.Name)) } if len(mnt.MountPath) == 0 { - mErrs = append(mErrs, errs.NewFieldRequired("mountPath")) + allErrs = append(allErrs, field.Required(idxPath.Child("mountPath"), "")) } - allErrs = append(allErrs, mErrs.PrefixIndex(i)...) } return allErrs } -func validateProbe(probe *api.Probe) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateProbe(probe *api.Probe, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if probe == nil { return allErrs } - allErrs = append(allErrs, validateHandler(&probe.Handler)...) - if probe.InitialDelaySeconds < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("initialDelay", probe.InitialDelaySeconds, "may not be less than zero")) - } - if probe.TimeoutSeconds < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("timeout", probe.TimeoutSeconds, "may not be less than zero")) - } + allErrs = append(allErrs, validateHandler(&probe.Handler, fldPath)...) + + allErrs = append(allErrs, ValidateNonnegativeField(int64(probe.InitialDelaySeconds), fldPath.Child("initialDelaySeconds"))...) + allErrs = append(allErrs, ValidateNonnegativeField(int64(probe.TimeoutSeconds), fldPath.Child("timeoutSeconds"))...) + allErrs = append(allErrs, ValidateNonnegativeField(int64(probe.PeriodSeconds), fldPath.Child("periodSeconds"))...) + allErrs = append(allErrs, ValidateNonnegativeField(int64(probe.SuccessThreshold), fldPath.Child("successThreshold"))...) + allErrs = append(allErrs, ValidateNonnegativeField(int64(probe.FailureThreshold), fldPath.Child("failureThreshold"))...) return allErrs } // AccumulateUniqueHostPorts extracts each HostPort of each Container, // accumulating the results and returning an error if any ports conflict. -func AccumulateUniqueHostPorts(containers []api.Container, accumulator *sets.String) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func AccumulateUniqueHostPorts(containers []api.Container, accumulator *sets.String, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} for ci, ctr := range containers { - cErrs := errs.ValidationErrorList{} + idxPath := fldPath.Index(ci) + portsPath := idxPath.Child("ports") for pi := range ctr.Ports { + idxPath := portsPath.Index(pi) port := ctr.Ports[pi].HostPort if port == 0 { continue } str := fmt.Sprintf("%d/%s", port, ctr.Ports[pi].Protocol) if accumulator.Has(str) { - cErrs = append(cErrs, errs.NewFieldDuplicate("port", str)) + allErrs = append(allErrs, field.Duplicate(idxPath.Child("hostPort"), str)) } else { accumulator.Insert(str) } } - allErrs = append(allErrs, cErrs.PrefixIndex(ci)...) } return allErrs } // checkHostPortConflicts checks for colliding Port.HostPort values across // a slice of containers. -func checkHostPortConflicts(containers []api.Container) errs.ValidationErrorList { +func checkHostPortConflicts(containers []api.Container, fldPath *field.Path) field.ErrorList { allPorts := sets.String{} - return AccumulateUniqueHostPorts(containers, &allPorts) + return AccumulateUniqueHostPorts(containers, &allPorts, fldPath) } -func validateExecAction(exec *api.ExecAction) errs.ValidationErrorList { - allErrors := errs.ValidationErrorList{} +func validateExecAction(exec *api.ExecAction, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} if len(exec.Command) == 0 { - allErrors = append(allErrors, errs.NewFieldRequired("command")) + allErrors = append(allErrors, field.Required(fldPath.Child("command"), "")) } return allErrors } -func validateHTTPGetAction(http *api.HTTPGetAction) errs.ValidationErrorList { - allErrors := errs.ValidationErrorList{} +func validateHTTPGetAction(http *api.HTTPGetAction, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} if len(http.Path) == 0 { - allErrors = append(allErrors, errs.NewFieldRequired("path")) + allErrors = append(allErrors, field.Required(fldPath.Child("path"), "")) } - if http.Port.Kind == util.IntstrInt && !validation.IsValidPortNum(http.Port.IntVal) { - allErrors = append(allErrors, errs.NewFieldInvalid("port", http.Port, portRangeErrorMsg)) - } else if http.Port.Kind == util.IntstrString && !validation.IsValidPortName(http.Port.StrVal) { - allErrors = append(allErrors, errs.NewFieldInvalid("port", http.Port.StrVal, portNameErrorMsg)) + if http.Port.Type == intstr.Int && !validation.IsValidPortNum(http.Port.IntValue()) { + allErrors = append(allErrors, field.Invalid(fldPath.Child("port"), http.Port, PortRangeErrorMsg)) + } else if http.Port.Type == intstr.String && !validation.IsValidPortName(http.Port.StrVal) { + allErrors = append(allErrors, field.Invalid(fldPath.Child("port"), http.Port.StrVal, PortNameErrorMsg)) } supportedSchemes := sets.NewString(string(api.URISchemeHTTP), string(api.URISchemeHTTPS)) if !supportedSchemes.Has(string(http.Scheme)) { - allErrors = append(allErrors, errs.NewFieldInvalid("scheme", http.Scheme, fmt.Sprintf("must be one of %v", supportedSchemes.List()))) + allErrors = append(allErrors, field.Invalid(fldPath.Child("scheme"), http.Scheme, fmt.Sprintf("must be one of %v", supportedSchemes.List()))) + } + for _, header := range http.HTTPHeaders { + if !validation.IsHTTPHeaderName(header.Name) { + allErrors = append(allErrors, field.Invalid(fldPath.Child("httpHeaders"), header.Name, fmt.Sprintf("name must match %s", validation.HTTPHeaderNameFmt))) + } } return allErrors } -func validateTCPSocketAction(tcp *api.TCPSocketAction) errs.ValidationErrorList { - allErrors := errs.ValidationErrorList{} - if tcp.Port.Kind == util.IntstrInt && !validation.IsValidPortNum(tcp.Port.IntVal) { - allErrors = append(allErrors, errs.NewFieldInvalid("port", tcp.Port, portRangeErrorMsg)) - } else if tcp.Port.Kind == util.IntstrString && !validation.IsValidPortName(tcp.Port.StrVal) { - allErrors = append(allErrors, errs.NewFieldInvalid("port", tcp.Port.StrVal, portNameErrorMsg)) +func validateTCPSocketAction(tcp *api.TCPSocketAction, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} + if tcp.Port.Type == intstr.Int && !validation.IsValidPortNum(tcp.Port.IntValue()) { + allErrors = append(allErrors, field.Invalid(fldPath.Child("port"), tcp.Port, PortRangeErrorMsg)) + } else if tcp.Port.Type == intstr.String && !validation.IsValidPortName(tcp.Port.StrVal) { + allErrors = append(allErrors, field.Invalid(fldPath.Child("port"), tcp.Port.StrVal, PortNameErrorMsg)) } return allErrors } -func validateHandler(handler *api.Handler) errs.ValidationErrorList { +func validateHandler(handler *api.Handler, fldPath *field.Path) field.ErrorList { numHandlers := 0 - allErrors := errs.ValidationErrorList{} + allErrors := field.ErrorList{} if handler.Exec != nil { - numHandlers++ - allErrors = append(allErrors, validateExecAction(handler.Exec).Prefix("exec")...) + if numHandlers > 0 { + allErrors = append(allErrors, field.Forbidden(fldPath.Child("exec"), "may not specify more than 1 handler type")) + } else { + numHandlers++ + allErrors = append(allErrors, validateExecAction(handler.Exec, fldPath.Child("exec"))...) + } } if handler.HTTPGet != nil { - numHandlers++ - allErrors = append(allErrors, validateHTTPGetAction(handler.HTTPGet).Prefix("httpGet")...) + if numHandlers > 0 { + allErrors = append(allErrors, field.Forbidden(fldPath.Child("httpGet"), "may not specify more than 1 handler type")) + } else { + numHandlers++ + allErrors = append(allErrors, validateHTTPGetAction(handler.HTTPGet, fldPath.Child("httpGet"))...) + } } if handler.TCPSocket != nil { - numHandlers++ - allErrors = append(allErrors, validateTCPSocketAction(handler.TCPSocket).Prefix("tcpSocket")...) + if numHandlers > 0 { + allErrors = append(allErrors, field.Forbidden(fldPath.Child("tcpSocket"), "may not specify more than 1 handler type")) + } else { + numHandlers++ + allErrors = append(allErrors, validateTCPSocketAction(handler.TCPSocket, fldPath.Child("tcpSocket"))...) + } } - if numHandlers != 1 { - allErrors = append(allErrors, errs.NewFieldInvalid("", handler, "exactly 1 handler type is required")) + if numHandlers == 0 { + allErrors = append(allErrors, field.Required(fldPath, "must specify a handler type")) } return allErrors } -func validateLifecycle(lifecycle *api.Lifecycle) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateLifecycle(lifecycle *api.Lifecycle, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if lifecycle.PostStart != nil { - allErrs = append(allErrs, validateHandler(lifecycle.PostStart).Prefix("postStart")...) + allErrs = append(allErrs, validateHandler(lifecycle.PostStart, fldPath.Child("postStart"))...) } if lifecycle.PreStop != nil { - allErrs = append(allErrs, validateHandler(lifecycle.PreStop).Prefix("preStop")...) + allErrs = append(allErrs, validateHandler(lifecycle.PreStop, fldPath.Child("preStop"))...) } return allErrs } -func validatePullPolicy(ctr *api.Container) errs.ValidationErrorList { - allErrors := errs.ValidationErrorList{} +var supportedPullPolicies = sets.NewString(string(api.PullAlways), string(api.PullIfNotPresent), string(api.PullNever)) - switch ctr.ImagePullPolicy { +func validatePullPolicy(policy api.PullPolicy, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} + + switch policy { case api.PullAlways, api.PullIfNotPresent, api.PullNever: break case "": - allErrors = append(allErrors, errs.NewFieldRequired("")) + allErrors = append(allErrors, field.Required(fldPath, "")) default: - validValues := []string{string(api.PullAlways), string(api.PullIfNotPresent), string(api.PullNever)} - allErrors = append(allErrors, errs.NewFieldValueNotSupported("", ctr.ImagePullPolicy, validValues)) + allErrors = append(allErrors, field.NotSupported(fldPath, policy, supportedPullPolicies.List())) } return allErrors } -func validateContainers(containers []api.Container, volumes sets.String) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateContainers(containers []api.Container, volumes sets.String, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if len(containers) == 0 { - return append(allErrs, errs.NewFieldRequired("")) + return append(allErrs, field.Required(fldPath, "")) } allNames := sets.String{} for i, ctr := range containers { - cErrs := errs.ValidationErrorList{} + idxPath := fldPath.Index(i) if len(ctr.Name) == 0 { - cErrs = append(cErrs, errs.NewFieldRequired("name")) + allErrs = append(allErrs, field.Required(idxPath.Child("name"), "")) } else if !validation.IsDNS1123Label(ctr.Name) { - cErrs = append(cErrs, errs.NewFieldInvalid("name", ctr.Name, DNS1123LabelErrorMsg)) + allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), ctr.Name, DNS1123LabelErrorMsg)) } else if allNames.Has(ctr.Name) { - cErrs = append(cErrs, errs.NewFieldDuplicate("name", ctr.Name)) + allErrs = append(allErrs, field.Duplicate(idxPath.Child("name"), ctr.Name)) } else { allNames.Insert(ctr.Name) } if len(ctr.Image) == 0 { - cErrs = append(cErrs, errs.NewFieldRequired("image")) + allErrs = append(allErrs, field.Required(idxPath.Child("image"), "")) } if ctr.Lifecycle != nil { - cErrs = append(cErrs, validateLifecycle(ctr.Lifecycle).Prefix("lifecycle")...) + allErrs = append(allErrs, validateLifecycle(ctr.Lifecycle, idxPath.Child("lifecycle"))...) } - cErrs = append(cErrs, validateProbe(ctr.LivenessProbe).Prefix("livenessProbe")...) - cErrs = append(cErrs, validateProbe(ctr.ReadinessProbe).Prefix("readinessProbe")...) - cErrs = append(cErrs, validatePorts(ctr.Ports).Prefix("ports")...) - cErrs = append(cErrs, validateEnv(ctr.Env).Prefix("env")...) - cErrs = append(cErrs, validateVolumeMounts(ctr.VolumeMounts, volumes).Prefix("volumeMounts")...) - cErrs = append(cErrs, validatePullPolicy(&ctr).Prefix("imagePullPolicy")...) - cErrs = append(cErrs, ValidateResourceRequirements(&ctr.Resources).Prefix("resources")...) - cErrs = append(cErrs, ValidateSecurityContext(ctr.SecurityContext).Prefix("securityContext")...) - allErrs = append(allErrs, cErrs.PrefixIndex(i)...) + allErrs = append(allErrs, validateProbe(ctr.LivenessProbe, idxPath.Child("livenessProbe"))...) + // Liveness-specific validation + if ctr.LivenessProbe != nil && ctr.LivenessProbe.SuccessThreshold != 1 { + allErrs = append(allErrs, field.Invalid(idxPath.Child("livenessProbe", "successThreshold"), ctr.LivenessProbe.SuccessThreshold, "must be 1")) + } + + allErrs = append(allErrs, validateProbe(ctr.ReadinessProbe, idxPath.Child("readinessProbe"))...) + allErrs = append(allErrs, validateContainerPorts(ctr.Ports, idxPath.Child("ports"))...) + allErrs = append(allErrs, validateEnv(ctr.Env, idxPath.Child("env"))...) + allErrs = append(allErrs, validateVolumeMounts(ctr.VolumeMounts, volumes, idxPath.Child("volumeMounts"))...) + allErrs = append(allErrs, validatePullPolicy(ctr.ImagePullPolicy, idxPath.Child("imagePullPolicy"))...) + allErrs = append(allErrs, ValidateResourceRequirements(&ctr.Resources, idxPath.Child("resources"))...) + allErrs = append(allErrs, ValidateSecurityContext(ctr.SecurityContext, idxPath.Child("securityContext"))...) } // Check for colliding ports across all containers. - allErrs = append(allErrs, checkHostPortConflicts(containers)...) + allErrs = append(allErrs, checkHostPortConflicts(containers, fldPath)...) return allErrs } -func validateRestartPolicy(restartPolicy *api.RestartPolicy) errs.ValidationErrorList { - allErrors := errs.ValidationErrorList{} +func validateRestartPolicy(restartPolicy *api.RestartPolicy, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} switch *restartPolicy { case api.RestartPolicyAlways, api.RestartPolicyOnFailure, api.RestartPolicyNever: break case "": - allErrors = append(allErrors, errs.NewFieldRequired("")) + allErrors = append(allErrors, field.Required(fldPath, "")) default: validValues := []string{string(api.RestartPolicyAlways), string(api.RestartPolicyOnFailure), string(api.RestartPolicyNever)} - allErrors = append(allErrors, errs.NewFieldValueNotSupported("", *restartPolicy, validValues)) + allErrors = append(allErrors, field.NotSupported(fldPath, *restartPolicy, validValues)) } return allErrors } -func validateDNSPolicy(dnsPolicy *api.DNSPolicy) errs.ValidationErrorList { - allErrors := errs.ValidationErrorList{} +func validateDNSPolicy(dnsPolicy *api.DNSPolicy, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} switch *dnsPolicy { case api.DNSClusterFirst, api.DNSDefault: break case "": - allErrors = append(allErrors, errs.NewFieldRequired("")) + allErrors = append(allErrors, field.Required(fldPath, "")) default: validValues := []string{string(api.DNSClusterFirst), string(api.DNSDefault)} - allErrors = append(allErrors, errs.NewFieldValueNotSupported("", dnsPolicy, validValues)) + allErrors = append(allErrors, field.NotSupported(fldPath, dnsPolicy, validValues)) } return allErrors } -func validateHostNetwork(hostNetwork bool, containers []api.Container) errs.ValidationErrorList { - allErrors := errs.ValidationErrorList{} +func validateHostNetwork(hostNetwork bool, containers []api.Container, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} if hostNetwork { - for _, container := range containers { - for _, port := range container.Ports { + for i, container := range containers { + portsPath := fldPath.Index(i).Child("ports") + for i, port := range container.Ports { + idxPath := portsPath.Index(i) if port.HostPort != port.ContainerPort { - allErrors = append(allErrors, errs.NewFieldInvalid("containerPort", port.ContainerPort, "containerPort must match hostPort if hostNetwork is set to true")) + allErrors = append(allErrors, field.Invalid(idxPath.Child("containerPort"), port.ContainerPort, "must match `hostPort` when `hostNetwork` is true")) } } } @@ -1087,26 +1320,26 @@ func validateHostNetwork(hostNetwork bool, containers []api.Container) errs.Vali return allErrors } -// validateImagePullSecrets checks to make sure the pull secrets are well formed. Right now, we only expect name to be set (it's the only field). If this ever changes -// and someone decides to set those fields, we'd like to know. -func validateImagePullSecrets(imagePullSecrets []api.LocalObjectReference) errs.ValidationErrorList { - allErrors := errs.ValidationErrorList{} +// validateImagePullSecrets checks to make sure the pull secrets are well +// formed. Right now, we only expect name to be set (it's the only field). If +// this ever changes and someone decides to set those fields, we'd like to +// know. +func validateImagePullSecrets(imagePullSecrets []api.LocalObjectReference, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} for i, currPullSecret := range imagePullSecrets { + idxPath := fldPath.Index(i) strippedRef := api.LocalObjectReference{Name: currPullSecret.Name} - if !reflect.DeepEqual(strippedRef, currPullSecret) { - allErrors = append(allErrors, errs.NewFieldInvalid(fmt.Sprintf("[%d]", i), currPullSecret, "only name may be set")) + allErrors = append(allErrors, field.Invalid(idxPath, currPullSecret, "only name may be set")) } } return allErrors } // ValidatePod tests if required fields in the pod are set. -func ValidatePod(pod *api.Pod) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&pod.ObjectMeta, true, ValidatePodName).Prefix("metadata")...) - allErrs = append(allErrs, ValidatePodSpec(&pod.Spec).Prefix("spec")...) - +func ValidatePod(pod *api.Pod) field.ErrorList { + allErrs := ValidateObjectMeta(&pod.ObjectMeta, true, ValidatePodName, field.NewPath("metadata")) + allErrs = append(allErrs, ValidatePodSpec(&pod.Spec, field.NewPath("spec"))...) return allErrs } @@ -1114,37 +1347,153 @@ func ValidatePod(pod *api.Pod) errs.ValidationErrorList { // This includes checking formatting and uniqueness. It also canonicalizes the // structure by setting default values and implementing any backwards-compatibility // tricks. -func ValidatePodSpec(spec *api.PodSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidatePodSpec(spec *api.PodSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} - allVolumes, vErrs := validateVolumes(spec.Volumes) - allErrs = append(allErrs, vErrs.Prefix("volumes")...) - allErrs = append(allErrs, validateContainers(spec.Containers, allVolumes).Prefix("containers")...) - allErrs = append(allErrs, validateRestartPolicy(&spec.RestartPolicy).Prefix("restartPolicy")...) - allErrs = append(allErrs, validateDNSPolicy(&spec.DNSPolicy).Prefix("dnsPolicy")...) - allErrs = append(allErrs, ValidateLabels(spec.NodeSelector, "nodeSelector")...) - allErrs = append(allErrs, ValidatePodSecurityContext(spec.SecurityContext, spec).Prefix("securityContext")...) - allErrs = append(allErrs, validateImagePullSecrets(spec.ImagePullSecrets).Prefix("imagePullSecrets")...) + allVolumes, vErrs := validateVolumes(spec.Volumes, fldPath.Child("volumes")) + allErrs = append(allErrs, vErrs...) + allErrs = append(allErrs, validateContainers(spec.Containers, allVolumes, fldPath.Child("containers"))...) + allErrs = append(allErrs, validateRestartPolicy(&spec.RestartPolicy, fldPath.Child("restartPolicy"))...) + allErrs = append(allErrs, validateDNSPolicy(&spec.DNSPolicy, fldPath.Child("dnsPolicy"))...) + allErrs = append(allErrs, ValidateLabels(spec.NodeSelector, fldPath.Child("nodeSelector"))...) + allErrs = append(allErrs, ValidatePodSecurityContext(spec.SecurityContext, spec, fldPath, fldPath.Child("securityContext"))...) + allErrs = append(allErrs, validateImagePullSecrets(spec.ImagePullSecrets, fldPath.Child("imagePullSecrets"))...) if len(spec.ServiceAccountName) > 0 { if ok, msg := ValidateServiceAccountName(spec.ServiceAccountName, false); !ok { - allErrs = append(allErrs, errs.NewFieldInvalid("serviceAccountName", spec.ServiceAccountName, msg)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("serviceAccountName"), spec.ServiceAccountName, msg)) + } + } + + if len(spec.NodeName) > 0 { + if ok, msg := ValidateNodeName(spec.NodeName, false); !ok { + allErrs = append(allErrs, field.Invalid(fldPath.Child("nodeName"), spec.NodeName, msg)) } } if spec.ActiveDeadlineSeconds != nil { if *spec.ActiveDeadlineSeconds <= 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("activeDeadlineSeconds", spec.ActiveDeadlineSeconds, "activeDeadlineSeconds must be a positive integer greater than 0")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("activeDeadlineSeconds"), spec.ActiveDeadlineSeconds, "must be greater than 0")) } } return allErrs } +// ValidateNodeSelectorRequirement tests that the specified NodeSelectorRequirement fields has valid data +func ValidateNodeSelectorRequirement(rq api.NodeSelectorRequirement, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + switch rq.Operator { + case api.NodeSelectorOpIn, api.NodeSelectorOpNotIn: + if len(rq.Values) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified when `operator` is 'In' or 'NotIn'")) + } + case api.NodeSelectorOpExists, api.NodeSelectorOpDoesNotExist: + if len(rq.Values) > 0 { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("values"), "may not be specified when `operator` is 'Exists' or 'DoesNotExist'")) + } + + case api.NodeSelectorOpGt, api.NodeSelectorOpLt: + if len(rq.Values) != 1 { + allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified single value when `operator` is 'Lt' or 'Gt'")) + } + default: + allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), rq.Operator, "not a valid selector operator")) + } + allErrs = append(allErrs, ValidateLabelName(rq.Key, fldPath.Child("key"))...) + return allErrs +} + +// ValidateNodeSelectorTerm tests that the specified node selector term has valid data +func ValidateNodeSelectorTerm(term api.NodeSelectorTerm, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if len(term.MatchExpressions) == 0 { + return append(allErrs, field.Required(fldPath.Child("matchExpressions"), "must have at least one node selector requirement")) + } + for j, req := range term.MatchExpressions { + allErrs = append(allErrs, ValidateNodeSelectorRequirement(req, fldPath.Child("matchExpressions").Index(j))...) + } + return allErrs +} + +// ValidateNodeSelector tests that the specified nodeSelector fields has valid data +func ValidateNodeSelector(nodeSelector *api.NodeSelector, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + termFldPath := fldPath.Child("nodeSelectorTerms") + if len(nodeSelector.NodeSelectorTerms) == 0 { + return append(allErrs, field.Required(termFldPath, "must have at least one node selector term")) + } + + for i, term := range nodeSelector.NodeSelectorTerms { + allErrs = append(allErrs, ValidateNodeSelectorTerm(term, termFldPath.Index(i))...) + } + + return allErrs +} + +// ValidatePreferredSchedulingTerms tests that the specified SoftNodeAffinity fields has valid data +func ValidatePreferredSchedulingTerms(terms []api.PreferredSchedulingTerm, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + for i, term := range terms { + if term.Weight <= 0 || term.Weight > 100 { + allErrs = append(allErrs, field.Invalid(fldPath.Index(i).Child("weight"), term.Weight, "must be in the range 1-100")) + } + + allErrs = append(allErrs, ValidateNodeSelectorTerm(term.Preference, fldPath.Index(i).Child("preference"))...) + } + return allErrs +} + +// ValidateAffinityInPodAnnotations tests that the serialized Affinity in Pod.Annotations has valid data +func ValidateAffinityInPodAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + affinity, err := api.GetAffinityFromPodAnnotations(annotations) + if err != nil { + allErrs = append(allErrs, field.Invalid(fldPath, api.AffinityAnnotationKey, err.Error())) + return allErrs + } + + if affinity.NodeAffinity != nil { + na := affinity.NodeAffinity + + // TODO: Uncomment the next three lines once RequiredDuringSchedulingRequiredDuringExecution is implemented. + // if na.RequiredDuringSchedulingRequiredDuringExecution != nil { + // allErrs = append(allErrs, ValidateNodeSelector(na.RequiredDuringSchedulingRequiredDuringExecution, fldPath.Child("requiredDuringSchedulingRequiredDuringExecution"))...) + // } + + if na.RequiredDuringSchedulingIgnoredDuringExecution != nil { + allErrs = append(allErrs, ValidateNodeSelector(na.RequiredDuringSchedulingIgnoredDuringExecution, fldPath.Child("requiredDuringSchedulingIgnoredDuringExecution"))...) + } + + if len(na.PreferredDuringSchedulingIgnoredDuringExecution) > 0 { + allErrs = append(allErrs, ValidatePreferredSchedulingTerms(na.PreferredDuringSchedulingIgnoredDuringExecution, fldPath.Child("preferredDuringSchedulingIgnoredDuringExecution"))...) + + } + } + + return allErrs +} + // ValidatePodSecurityContext test that the specified PodSecurityContext has valid data. -func ValidatePodSecurityContext(securityContext *api.PodSecurityContext, spec *api.PodSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidatePodSecurityContext(securityContext *api.PodSecurityContext, spec *api.PodSpec, specPath, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if securityContext != nil { - allErrs = append(allErrs, validateHostNetwork(securityContext.HostNetwork, spec.Containers).Prefix("hostNetwork")...) + allErrs = append(allErrs, validateHostNetwork(securityContext.HostNetwork, spec.Containers, specPath.Child("containers"))...) + if securityContext.FSGroup != nil && !validation.IsValidGroupId(*securityContext.FSGroup) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("fsGroup"), *(securityContext.FSGroup), IdRangeErrorMsg)) + } + if securityContext.RunAsUser != nil && !validation.IsValidUserId(*securityContext.RunAsUser) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("runAsUser"), *(securityContext.RunAsUser), IdRangeErrorMsg)) + } + for i, gid := range securityContext.SupplementalGroups { + if !validation.IsValidGroupId(gid) { + supplementalGroup := fmt.Sprintf(`supplementalGroups[%d]`, i) + allErrs = append(allErrs, field.Invalid(fldPath.Child(supplementalGroup), gid, IdRangeErrorMsg)) + } + } } return allErrs @@ -1152,43 +1501,78 @@ func ValidatePodSecurityContext(securityContext *api.PodSecurityContext, spec *a // ValidatePodUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields // that cannot be changed. -func ValidatePodUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newPod.ObjectMeta, &oldPod.ObjectMeta).Prefix("metadata")...) +func ValidatePodUpdate(newPod, oldPod *api.Pod) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newPod.ObjectMeta, &oldPod.ObjectMeta, field.NewPath("metadata")) + specPath := field.NewPath("spec") if len(newPod.Spec.Containers) != len(oldPod.Spec.Containers) { //TODO: Pinpoint the specific container that causes the invalid error after we have strategic merge diff - allErrs = append(allErrs, errs.NewFieldInvalid("spec.containers", "content of spec.containers is not printed out, please refer to the \"details\"", "may not add or remove containers")) + allErrs = append(allErrs, field.Forbidden(specPath.Child("containers"), "pod updates may not add or remove containers")) return allErrs } - pod := *newPod - // Tricky, we need to copy the container list so that we don't overwrite the update + + // validate updateable fields: + // 1. containers[*].image + // 2. spec.activeDeadlineSeconds + + // validate updated container images + for i, ctr := range newPod.Spec.Containers { + if len(ctr.Image) == 0 { + allErrs = append(allErrs, field.Required(specPath.Child("containers").Index(i).Child("image"), "")) + } + } + + // validate updated spec.activeDeadlineSeconds. two types of updates are allowed: + // 1. from nil to a positive value + // 2. from a positive value to a lesser, non-negative value + if newPod.Spec.ActiveDeadlineSeconds != nil { + newActiveDeadlineSeconds := *newPod.Spec.ActiveDeadlineSeconds + if newActiveDeadlineSeconds < 0 { + allErrs = append(allErrs, field.Invalid(specPath.Child("activeDeadlineSeconds"), newActiveDeadlineSeconds, isNegativeErrorMsg)) + return allErrs + } + if oldPod.Spec.ActiveDeadlineSeconds != nil { + oldActiveDeadlineSeconds := *oldPod.Spec.ActiveDeadlineSeconds + if oldActiveDeadlineSeconds < newActiveDeadlineSeconds { + allErrs = append(allErrs, field.Invalid(specPath.Child("activeDeadlineSeconds"), newActiveDeadlineSeconds, "must be less than or equal to previous value")) + return allErrs + } + } + } else if oldPod.Spec.ActiveDeadlineSeconds != nil { + allErrs = append(allErrs, field.Invalid(specPath.Child("activeDeadlineSeconds"), newPod.Spec.ActiveDeadlineSeconds, "must not update from a positive integer to nil value")) + } + + // handle updateable fields by munging those fields prior to deep equal comparison. + mungedPod := *newPod + // munge containers[*].image var newContainers []api.Container - for ix, container := range pod.Spec.Containers { + for ix, container := range mungedPod.Spec.Containers { container.Image = oldPod.Spec.Containers[ix].Image newContainers = append(newContainers, container) } - pod.Spec.Containers = newContainers - if !api.Semantic.DeepEqual(pod.Spec, oldPod.Spec) { + mungedPod.Spec.Containers = newContainers + // munge spec.activeDeadlineSeconds + mungedPod.Spec.ActiveDeadlineSeconds = nil + if oldPod.Spec.ActiveDeadlineSeconds != nil { + activeDeadlineSeconds := *oldPod.Spec.ActiveDeadlineSeconds + mungedPod.Spec.ActiveDeadlineSeconds = &activeDeadlineSeconds + } + if !api.Semantic.DeepEqual(mungedPod.Spec, oldPod.Spec) { //TODO: Pinpoint the specific field that causes the invalid error after we have strategic merge diff - allErrs = append(allErrs, errs.NewFieldInvalid("spec", "content of spec is not printed out, please refer to the \"details\"", "may not update fields other than container.image")) + allErrs = append(allErrs, field.Forbidden(specPath, "pod updates may not change fields other than `containers[*].image` or `spec.activeDeadlineSeconds`")) } - newPod.Status = oldPod.Status return allErrs } // ValidatePodStatusUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields // that cannot be changed. -func ValidatePodStatusUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newPod.ObjectMeta, &oldPod.ObjectMeta).Prefix("metadata")...) +func ValidatePodStatusUpdate(newPod, oldPod *api.Pod) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newPod.ObjectMeta, &oldPod.ObjectMeta, field.NewPath("metadata")) // TODO: allow change when bindings are properly decoupled from pods if newPod.Spec.NodeName != oldPod.Spec.NodeName { - allErrs = append(allErrs, errs.NewFieldInvalid("status.nodeName", newPod.Spec.NodeName, "pod nodename cannot be changed directly")) + allErrs = append(allErrs, field.Forbidden(field.NewPath("status", "nodeName"), "may not be changed directly")) } // For status update we ignore changes to pod spec. @@ -1197,20 +1581,34 @@ func ValidatePodStatusUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList { return allErrs } +// ValidatePodBinding tests if required fields in the pod binding are legal. +func ValidatePodBinding(binding *api.Binding) field.ErrorList { + allErrs := field.ErrorList{} + + if len(binding.Target.Kind) != 0 && binding.Target.Kind != "Node" { + // TODO: When validation becomes versioned, this gets more complicated. + allErrs = append(allErrs, field.NotSupported(field.NewPath("target", "kind"), binding.Target.Kind, []string{"Node", ""})) + } + if len(binding.Target.Name) == 0 { + // TODO: When validation becomes versioned, this gets more complicated. + allErrs = append(allErrs, field.Required(field.NewPath("target", "name"), "")) + } + + return allErrs +} + // ValidatePodTemplate tests if required fields in the pod template are set. -func ValidatePodTemplate(pod *api.PodTemplate) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&pod.ObjectMeta, true, ValidatePodName).Prefix("metadata")...) - allErrs = append(allErrs, ValidatePodTemplateSpec(&pod.Template).Prefix("template")...) +func ValidatePodTemplate(pod *api.PodTemplate) field.ErrorList { + allErrs := ValidateObjectMeta(&pod.ObjectMeta, true, ValidatePodName, field.NewPath("metadata")) + allErrs = append(allErrs, ValidatePodTemplateSpec(&pod.Template, field.NewPath("template"))...) return allErrs } // ValidatePodTemplateUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields // that cannot be changed. -func ValidatePodTemplateUpdate(newPod, oldPod *api.PodTemplate) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&oldPod.ObjectMeta, &newPod.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, ValidatePodTemplateSpec(&newPod.Template).Prefix("template")...) +func ValidatePodTemplateUpdate(newPod, oldPod *api.PodTemplate) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&oldPod.ObjectMeta, &newPod.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, ValidatePodTemplateSpec(&newPod.Template, field.NewPath("template"))...) return allErrs } @@ -1219,84 +1617,106 @@ var supportedServiceType = sets.NewString(string(api.ServiceTypeClusterIP), stri string(api.ServiceTypeLoadBalancer)) // ValidateService tests if required fields in the service are set. -func ValidateService(service *api.Service) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&service.ObjectMeta, true, ValidateServiceName).Prefix("metadata")...) +func ValidateService(service *api.Service) field.ErrorList { + allErrs := ValidateObjectMeta(&service.ObjectMeta, true, ValidateServiceName, field.NewPath("metadata")) - if len(service.Spec.Ports) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("spec.ports")) + specPath := field.NewPath("spec") + if len(service.Spec.Ports) == 0 && service.Spec.ClusterIP != api.ClusterIPNone { + allErrs = append(allErrs, field.Required(specPath.Child("ports"), "")) } if service.Spec.Type == api.ServiceTypeLoadBalancer { for ix := range service.Spec.Ports { port := &service.Spec.Ports[ix] + // This is a workaround for broken cloud environments that + // over-open firewalls. Hopefully it can go away when more clouds + // understand containers better. if port.Port == 10250 { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.ports[%d].port", ix), port.Port, "can not expose port 10250 externally since it is used by kubelet")) + portPath := specPath.Child("ports").Index(ix) + allErrs = append(allErrs, field.Invalid(portPath, port.Port, "may not expose port 10250 externally since it is used by kubelet")) } } } + + isHeadlessService := service.Spec.ClusterIP == api.ClusterIPNone allPortNames := sets.String{} + portsPath := specPath.Child("ports") for i := range service.Spec.Ports { - allErrs = append(allErrs, validateServicePort(&service.Spec.Ports[i], len(service.Spec.Ports) > 1, &allPortNames).PrefixIndex(i).Prefix("spec.ports")...) + portPath := portsPath.Index(i) + allErrs = append(allErrs, validateServicePort(&service.Spec.Ports[i], len(service.Spec.Ports) > 1, isHeadlessService, &allPortNames, portPath)...) } if service.Spec.Selector != nil { - allErrs = append(allErrs, ValidateLabels(service.Spec.Selector, "spec.selector")...) + allErrs = append(allErrs, ValidateLabels(service.Spec.Selector, specPath.Child("selector"))...) } - if service.Spec.SessionAffinity == "" { - allErrs = append(allErrs, errs.NewFieldRequired("spec.sessionAffinity")) + if len(service.Spec.SessionAffinity) == 0 { + allErrs = append(allErrs, field.Required(specPath.Child("sessionAffinity"), "")) } else if !supportedSessionAffinityType.Has(string(service.Spec.SessionAffinity)) { - allErrs = append(allErrs, errs.NewFieldValueNotSupported("spec.sessionAffinity", service.Spec.SessionAffinity, supportedSessionAffinityType.List())) + allErrs = append(allErrs, field.NotSupported(specPath.Child("sessionAffinity"), service.Spec.SessionAffinity, supportedSessionAffinityType.List())) } if api.IsServiceIPSet(service) { if ip := net.ParseIP(service.Spec.ClusterIP); ip == nil { - allErrs = append(allErrs, errs.NewFieldInvalid("spec.clusterIP", service.Spec.ClusterIP, "clusterIP should be empty, 'None', or a valid IP address")) + allErrs = append(allErrs, field.Invalid(specPath.Child("clusterIP"), service.Spec.ClusterIP, "must be empty, 'None', or a valid IP address")) } } - for _, ip := range service.Spec.ExternalIPs { + ipPath := specPath.Child("externalIPs") + for i, ip := range service.Spec.ExternalIPs { + idxPath := ipPath.Index(i) if ip == "0.0.0.0" { - allErrs = append(allErrs, errs.NewFieldInvalid("spec.externalIPs", ip, "is not an IP address")) + allErrs = append(allErrs, field.Invalid(idxPath, ip, "must be a valid IP address")) } - allErrs = append(allErrs, validateIpIsNotLinkLocalOrLoopback(ip, "spec.externalIPs")...) + allErrs = append(allErrs, validateIpIsNotLinkLocalOrLoopback(ip, idxPath)...) } - if service.Spec.Type == "" { - allErrs = append(allErrs, errs.NewFieldRequired("spec.type")) + if len(service.Spec.Type) == 0 { + allErrs = append(allErrs, field.Required(specPath.Child("type"), "")) } else if !supportedServiceType.Has(string(service.Spec.Type)) { - allErrs = append(allErrs, errs.NewFieldValueNotSupported("spec.type", service.Spec.Type, supportedServiceType.List())) + allErrs = append(allErrs, field.NotSupported(specPath.Child("type"), service.Spec.Type, supportedServiceType.List())) } if service.Spec.Type == api.ServiceTypeLoadBalancer { + portsPath := specPath.Child("ports") + includeProtocols := sets.NewString() for i := range service.Spec.Ports { - if service.Spec.Ports[i].Protocol != api.ProtocolTCP { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.ports[%d].protocol", i), service.Spec.Ports[i].Protocol, "cannot create an external load balancer with non-TCP ports")) + portPath := portsPath.Index(i) + if !supportedPortProtocols.Has(string(service.Spec.Ports[i].Protocol)) { + allErrs = append(allErrs, field.Invalid(portPath.Child("protocol"), service.Spec.Ports[i].Protocol, "cannot create an external load balancer with non-TCP/UDP ports")) + } else { + includeProtocols.Insert(string(service.Spec.Ports[i].Protocol)) } } + if includeProtocols.Len() > 1 { + allErrs = append(allErrs, field.Invalid(portsPath, service.Spec.Ports, "cannot create an external load balancer with mix protocols")) + } } if service.Spec.Type == api.ServiceTypeClusterIP { + portsPath := specPath.Child("ports") for i := range service.Spec.Ports { + portPath := portsPath.Index(i) if service.Spec.Ports[i].NodePort != 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.ports[%d].nodePort", i), service.Spec.Ports[i].NodePort, "cannot specify a node port with services of type ClusterIP")) + allErrs = append(allErrs, field.Invalid(portPath.Child("nodePort"), service.Spec.Ports[i].NodePort, "may not be used when `type` is 'ClusterIP'")) } } } // Check for duplicate NodePorts, considering (protocol,port) pairs + portsPath = specPath.Child("ports") nodePorts := make(map[api.ServicePort]bool) for i := range service.Spec.Ports { port := &service.Spec.Ports[i] if port.NodePort == 0 { continue } + portPath := portsPath.Index(i) var key api.ServicePort key.Protocol = port.Protocol key.NodePort = port.NodePort _, found := nodePorts[key] if found { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.ports[%d].nodePort", i), port.NodePort, "duplicate nodePort specified")) + allErrs = append(allErrs, field.Duplicate(portPath.Child("nodePort"), port.NodePort)) } nodePorts[key] = true } @@ -1304,140 +1724,151 @@ func ValidateService(service *api.Service) errs.ValidationErrorList { return allErrs } -func validateServicePort(sp *api.ServicePort, requireName bool, allNames *sets.String) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateServicePort(sp *api.ServicePort, requireName, isHeadlessService bool, allNames *sets.String, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} - if requireName && sp.Name == "" { - allErrs = append(allErrs, errs.NewFieldRequired("name")) - } else if sp.Name != "" { + if requireName && len(sp.Name) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "")) + } else if len(sp.Name) != 0 { if !validation.IsDNS1123Label(sp.Name) { - allErrs = append(allErrs, errs.NewFieldInvalid("name", sp.Name, DNS1123LabelErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), sp.Name, DNS1123LabelErrorMsg)) } else if allNames.Has(sp.Name) { - allErrs = append(allErrs, errs.NewFieldDuplicate("name", sp.Name)) + allErrs = append(allErrs, field.Duplicate(fldPath.Child("name"), sp.Name)) } else { allNames.Insert(sp.Name) } } if !validation.IsValidPortNum(sp.Port) { - allErrs = append(allErrs, errs.NewFieldInvalid("port", sp.Port, portRangeErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("port"), sp.Port, PortRangeErrorMsg)) } if len(sp.Protocol) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("protocol")) + allErrs = append(allErrs, field.Required(fldPath.Child("protocol"), "")) } else if !supportedPortProtocols.Has(string(sp.Protocol)) { - allErrs = append(allErrs, errs.NewFieldValueNotSupported("protocol", sp.Protocol, supportedPortProtocols.List())) + allErrs = append(allErrs, field.NotSupported(fldPath.Child("protocol"), sp.Protocol, supportedPortProtocols.List())) } - if sp.TargetPort.Kind == util.IntstrInt && !validation.IsValidPortNum(sp.TargetPort.IntVal) { - allErrs = append(allErrs, errs.NewFieldInvalid("targetPort", sp.TargetPort, portRangeErrorMsg)) + if sp.TargetPort.Type == intstr.Int && !validation.IsValidPortNum(sp.TargetPort.IntValue()) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("targetPort"), sp.TargetPort, PortRangeErrorMsg)) } - if sp.TargetPort.Kind == util.IntstrString && !validation.IsValidPortName(sp.TargetPort.StrVal) { - allErrs = append(allErrs, errs.NewFieldInvalid("targetPort", sp.TargetPort, portNameErrorMsg)) + if sp.TargetPort.Type == intstr.String && !validation.IsValidPortName(sp.TargetPort.StrVal) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("targetPort"), sp.TargetPort, PortNameErrorMsg)) + } + + if isHeadlessService { + if sp.TargetPort.Type == intstr.String || (sp.TargetPort.Type == intstr.Int && sp.Port != sp.TargetPort.IntValue()) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("port"), sp.Port, "must be equal to targetPort when clusterIP = None")) + } } return allErrs } // ValidateServiceUpdate tests if required fields in the service are set during an update -func ValidateServiceUpdate(oldService, service *api.Service) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&service.ObjectMeta, &oldService.ObjectMeta).Prefix("metadata")...) +func ValidateServiceUpdate(service, oldService *api.Service) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&service.ObjectMeta, &oldService.ObjectMeta, field.NewPath("metadata")) - if api.IsServiceIPSet(oldService) && service.Spec.ClusterIP != oldService.Spec.ClusterIP { - allErrs = append(allErrs, errs.NewFieldInvalid("spec.clusterIP", service.Spec.ClusterIP, fieldImmutableErrorMsg)) + if api.IsServiceIPSet(oldService) { + allErrs = append(allErrs, ValidateImmutableField(service.Spec.ClusterIP, oldService.Spec.ClusterIP, field.NewPath("spec", "clusterIP"))...) } allErrs = append(allErrs, ValidateService(service)...) return allErrs } +// ValidateServiceStatusUpdate tests if required fields in the Service are set when updating status. +func ValidateServiceStatusUpdate(service, oldService *api.Service) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&service.ObjectMeta, &oldService.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateLoadBalancerStatus(&service.Status.LoadBalancer, field.NewPath("status", "loadBalancer"))...) + return allErrs +} + // ValidateReplicationController tests if required fields in the replication controller are set. -func ValidateReplicationController(controller *api.ReplicationController) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&controller.ObjectMeta, true, ValidateReplicationControllerName).Prefix("metadata")...) - allErrs = append(allErrs, ValidateReplicationControllerSpec(&controller.Spec).Prefix("spec")...) +func ValidateReplicationController(controller *api.ReplicationController) field.ErrorList { + allErrs := ValidateObjectMeta(&controller.ObjectMeta, true, ValidateReplicationControllerName, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateReplicationControllerSpec(&controller.Spec, field.NewPath("spec"))...) return allErrs } // ValidateReplicationControllerUpdate tests if required fields in the replication controller are set. -func ValidateReplicationControllerUpdate(oldController, controller *api.ReplicationController) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, ValidateReplicationControllerSpec(&controller.Spec).Prefix("spec")...) +func ValidateReplicationControllerUpdate(controller, oldController *api.ReplicationController) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateReplicationControllerSpec(&controller.Spec, field.NewPath("spec"))...) return allErrs } // ValidateReplicationControllerStatusUpdate tests if required fields in the replication controller are set. -func ValidateReplicationControllerStatusUpdate(oldController, controller *api.ReplicationController) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, ValidatePositiveField(int64(controller.Status.Replicas), "status.replicas")...) - allErrs = append(allErrs, ValidatePositiveField(int64(controller.Status.ObservedGeneration), "status.observedGeneration")...) +func ValidateReplicationControllerStatusUpdate(controller, oldController *api.ReplicationController) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta, field.NewPath("metadata")) + statusPath := field.NewPath("status") + allErrs = append(allErrs, ValidateNonnegativeField(int64(controller.Status.Replicas), statusPath.Child("replicas"))...) + allErrs = append(allErrs, ValidateNonnegativeField(int64(controller.Status.ObservedGeneration), statusPath.Child("observedGeneration"))...) return allErrs } // Validates that the given selector is non-empty. -func ValidateNonEmptySelector(selectorMap map[string]string, fieldName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateNonEmptySelector(selectorMap map[string]string, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} selector := labels.Set(selectorMap).AsSelector() if selector.Empty() { - allErrs = append(allErrs, errs.NewFieldRequired(fieldName)) + allErrs = append(allErrs, field.Required(fldPath, "")) } return allErrs } // Validates the given template and ensures that it is in accordance with the desrired selector and replicas. -func ValidatePodTemplateSpecForRC(template *api.PodTemplateSpec, selectorMap map[string]string, replicas int, fieldName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidatePodTemplateSpecForRC(template *api.PodTemplateSpec, selectorMap map[string]string, replicas int, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if template == nil { - allErrs = append(allErrs, errs.NewFieldRequired(fieldName)) + allErrs = append(allErrs, field.Required(fldPath, "")) } else { selector := labels.Set(selectorMap).AsSelector() if !selector.Empty() { // Verify that the RC selector matches the labels in template. labels := labels.Set(template.Labels) if !selector.Matches(labels) { - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName+".metadata.labels", template.Labels, "selector does not match labels in "+fieldName)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("metadata", "labels"), template.Labels, "`selector` does not match template `labels`")) } } - allErrs = append(allErrs, ValidatePodTemplateSpec(template).Prefix(fieldName)...) + allErrs = append(allErrs, ValidatePodTemplateSpec(template, fldPath)...) if replicas > 1 { - allErrs = append(allErrs, ValidateReadOnlyPersistentDisks(template.Spec.Volumes).Prefix(fieldName+".spec.volumes")...) + allErrs = append(allErrs, ValidateReadOnlyPersistentDisks(template.Spec.Volumes, fldPath.Child("spec", "volumes"))...) } // RestartPolicy has already been first-order validated as per ValidatePodTemplateSpec(). if template.Spec.RestartPolicy != api.RestartPolicyAlways { - allErrs = append(allErrs, errs.NewFieldValueNotSupported(fieldName+".spec.restartPolicy", template.Spec.RestartPolicy, []string{string(api.RestartPolicyAlways)})) + allErrs = append(allErrs, field.NotSupported(fldPath.Child("spec", "restartPolicy"), template.Spec.RestartPolicy, []string{string(api.RestartPolicyAlways)})) } } return allErrs } // ValidateReplicationControllerSpec tests if required fields in the replication controller spec are set. -func ValidateReplicationControllerSpec(spec *api.ReplicationControllerSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - - allErrs = append(allErrs, ValidateNonEmptySelector(spec.Selector, "selector")...) - allErrs = append(allErrs, ValidatePositiveField(int64(spec.Replicas), "replicas")...) - allErrs = append(allErrs, ValidatePodTemplateSpecForRC(spec.Template, spec.Selector, spec.Replicas, "template")...) +func ValidateReplicationControllerSpec(spec *api.ReplicationControllerSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, ValidateNonEmptySelector(spec.Selector, fldPath.Child("selector"))...) + allErrs = append(allErrs, ValidateNonnegativeField(int64(spec.Replicas), fldPath.Child("replicas"))...) + allErrs = append(allErrs, ValidatePodTemplateSpecForRC(spec.Template, spec.Selector, spec.Replicas, fldPath.Child("template"))...) return allErrs } // ValidatePodTemplateSpec validates the spec of a pod template -func ValidatePodTemplateSpec(spec *api.PodTemplateSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateLabels(spec.Labels, "labels")...) - allErrs = append(allErrs, ValidateAnnotations(spec.Annotations, "annotations")...) - allErrs = append(allErrs, ValidatePodSpec(&spec.Spec).Prefix("spec")...) +func ValidatePodTemplateSpec(spec *api.PodTemplateSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, ValidateLabels(spec.Labels, fldPath.Child("labels"))...) + allErrs = append(allErrs, ValidateAnnotations(spec.Annotations, fldPath.Child("annotations"))...) + allErrs = append(allErrs, ValidatePodSpec(&spec.Spec, fldPath.Child("spec"))...) return allErrs } -func ValidateReadOnlyPersistentDisks(volumes []api.Volume) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - for _, vol := range volumes { +func ValidateReadOnlyPersistentDisks(volumes []api.Volume, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + for i := range volumes { + vol := &volumes[i] + idxPath := fldPath.Index(i) if vol.GCEPersistentDisk != nil { if vol.GCEPersistentDisk.ReadOnly == false { - allErrs = append(allErrs, errs.NewFieldInvalid("GCEPersistentDisk.ReadOnly", false, "ReadOnly must be true for replicated pods > 1, as GCE PD can only be mounted on multiple machines if it is read-only.")) + allErrs = append(allErrs, field.Invalid(idxPath.Child("gcePersistentDisk", "readOnly"), false, "must be true for replicated pods > 1; GCE PD can only be mounted on multiple machines if it is read-only")) } } // TODO: What to do for AWS? It doesn't support replicas @@ -1446,15 +1877,14 @@ func ValidateReadOnlyPersistentDisks(volumes []api.Volume) errs.ValidationErrorL } // ValidateNode tests if required fields in the node are set. -func ValidateNode(node *api.Node) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&node.ObjectMeta, false, ValidateNodeName).Prefix("metadata")...) +func ValidateNode(node *api.Node) field.ErrorList { + allErrs := ValidateObjectMeta(&node.ObjectMeta, false, ValidateNodeName, field.NewPath("metadata")) // Only validate spec. All status fields are optional and can be updated later. // external ID is required. if len(node.Spec.ExternalID) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("spec.ExternalID")) + allErrs = append(allErrs, field.Required(field.NewPath("spec", "externalID"), "")) } // TODO(rjnagal): Ignore PodCIDR till its completely implemented. @@ -1462,41 +1892,46 @@ func ValidateNode(node *api.Node) errs.ValidationErrorList { } // ValidateNodeUpdate tests to make sure a node update can be applied. Modifies oldNode. -func ValidateNodeUpdate(oldNode *api.Node, node *api.Node) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&node.ObjectMeta, &oldNode.ObjectMeta).Prefix("metadata")...) +func ValidateNodeUpdate(node, oldNode *api.Node) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&node.ObjectMeta, &oldNode.ObjectMeta, field.NewPath("metadata")) // TODO: Enable the code once we have better api object.status update model. Currently, // anyone can update node status. // if !api.Semantic.DeepEqual(node.Status, api.NodeStatus{}) { - // allErrs = append(allErrs, errs.NewFieldInvalid("status", node.Status, "status must be empty")) + // allErrs = append(allErrs, field.Invalid("status", node.Status, "must be empty")) // } // Validte no duplicate addresses in node status. addresses := make(map[api.NodeAddress]bool) - for _, address := range node.Status.Addresses { + for i, address := range node.Status.Addresses { if _, ok := addresses[address]; ok { - allErrs = append(allErrs, fmt.Errorf("duplicate node addresses found")) + allErrs = append(allErrs, field.Duplicate(field.NewPath("status", "addresses").Index(i), address)) } addresses[address] = true } + if len(oldNode.Spec.PodCIDR) == 0 { + // Allow the controller manager to assign a CIDR to a node if it doesn't have one. + oldNode.Spec.PodCIDR = node.Spec.PodCIDR + } else { + if oldNode.Spec.PodCIDR != node.Spec.PodCIDR { + allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "podCIDR"), "node updates may not change podCIDR except from \"\" to valid")) + } + } // TODO: move reset function to its own location // Ignore metadata changes now that they have been tested oldNode.ObjectMeta = node.ObjectMeta // Allow users to update capacity oldNode.Status.Capacity = node.Status.Capacity - // Allow the controller manager to assign a CIDR to a node. - oldNode.Spec.PodCIDR = node.Spec.PodCIDR // Allow users to unschedule node oldNode.Spec.Unschedulable = node.Spec.Unschedulable // Clear status oldNode.Status = node.Status - // TODO: Add a 'real' ValidationError type for this error and provide print actual diffs. + // TODO: Add a 'real' error type for this error and provide print actual diffs. if !api.Semantic.DeepEqual(oldNode, node) { glog.V(4).Infof("Update failed validation %#v vs %#v", oldNode, node) - allErrs = append(allErrs, fmt.Errorf("update contains more than labels or capacity changes")) + allErrs = append(allErrs, field.Forbidden(field.NewPath(""), "node updates may only change labels or capacity")) } return allErrs @@ -1504,33 +1939,34 @@ func ValidateNodeUpdate(oldNode *api.Node, node *api.Node) errs.ValidationErrorL // Validate compute resource typename. // Refer to docs/design/resources.md for more details. -func validateResourceName(value string, field string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateResourceName(value string, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if !validation.IsQualifiedName(value) { - return append(allErrs, errs.NewFieldInvalid(field, value, "resource typename: "+qualifiedNameErrorMsg)) + return append(allErrs, field.Invalid(fldPath, value, qualifiedNameErrorMsg)) } if len(strings.Split(value, "/")) == 1 { if !api.IsStandardResourceName(value) { - return append(allErrs, errs.NewFieldInvalid(field, value, "is neither a standard resource type nor is fully qualified")) + return append(allErrs, field.Invalid(fldPath, value, "must be a standard resource type or fully qualified")) } } - return errs.ValidationErrorList{} + return field.ErrorList{} } // ValidateLimitRange tests if required fields in the LimitRange are set. -func ValidateLimitRange(limitRange *api.LimitRange) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&limitRange.ObjectMeta, true, ValidateLimitRangeName).Prefix("metadata")...) +func ValidateLimitRange(limitRange *api.LimitRange) field.ErrorList { + allErrs := ValidateObjectMeta(&limitRange.ObjectMeta, true, ValidateLimitRangeName, field.NewPath("metadata")) // ensure resource names are properly qualified per docs/design/resources.md limitTypeSet := map[api.LimitType]bool{} + fldPath := field.NewPath("spec", "limits") for i := range limitRange.Spec.Limits { - limit := limitRange.Spec.Limits[i] + idxPath := fldPath.Index(i) + limit := &limitRange.Spec.Limits[i] _, found := limitTypeSet[limit.Type] if found { - allErrs = append(allErrs, errs.NewFieldDuplicate(fmt.Sprintf("spec.limits[%d].type", i), limit.Type)) + allErrs = append(allErrs, field.Duplicate(idxPath.Child("type"), limit.Type)) } limitTypeSet[limit.Type] = true @@ -1542,38 +1978,38 @@ func ValidateLimitRange(limitRange *api.LimitRange) errs.ValidationErrorList { maxLimitRequestRatios := map[string]resource.Quantity{} for k, q := range limit.Max { - allErrs = append(allErrs, validateResourceName(string(k), fmt.Sprintf("spec.limits[%d].max[%s]", i, k))...) + allErrs = append(allErrs, validateResourceName(string(k), idxPath.Child("max").Key(string(k)))...) keys.Insert(string(k)) max[string(k)] = q } for k, q := range limit.Min { - allErrs = append(allErrs, validateResourceName(string(k), fmt.Sprintf("spec.limits[%d].min[%s]", i, k))...) + allErrs = append(allErrs, validateResourceName(string(k), idxPath.Child("min").Key(string(k)))...) keys.Insert(string(k)) min[string(k)] = q } if limit.Type == api.LimitTypePod { if len(limit.Default) > 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("spec.limits[%d].default", limit.Default, "Default is not supported when limit type is Pod")) + allErrs = append(allErrs, field.Forbidden(idxPath.Child("default"), "may not be specified when `type` is 'Pod'")) } if len(limit.DefaultRequest) > 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("spec.limits[%d].defaultRequest", limit.DefaultRequest, "DefaultRequest is not supported when limit type is Pod")) + allErrs = append(allErrs, field.Forbidden(idxPath.Child("defaultRequest"), "may not be specified when `type` is 'Pod'")) } } else { for k, q := range limit.Default { - allErrs = append(allErrs, validateResourceName(string(k), fmt.Sprintf("spec.limits[%d].default[%s]", i, k))...) + allErrs = append(allErrs, validateResourceName(string(k), idxPath.Child("default").Key(string(k)))...) keys.Insert(string(k)) defaults[string(k)] = q } for k, q := range limit.DefaultRequest { - allErrs = append(allErrs, validateResourceName(string(k), fmt.Sprintf("spec.limits[%d].defaultRequest[%s]", i, k))...) + allErrs = append(allErrs, validateResourceName(string(k), idxPath.Child("defaultRequest").Key(string(k)))...) keys.Insert(string(k)) defaultRequests[string(k)] = q } } for k, q := range limit.MaxLimitRequestRatio { - allErrs = append(allErrs, validateResourceName(string(k), fmt.Sprintf("spec.limits[%d].maxLimitRequestRatio[%s]", i, k))...) + allErrs = append(allErrs, validateResourceName(string(k), idxPath.Child("maxLimitRequestRatio").Key(string(k)))...) keys.Insert(string(k)) maxLimitRequestRatios[string(k)] = q } @@ -1586,30 +2022,30 @@ func ValidateLimitRange(limitRange *api.LimitRange) errs.ValidationErrorList { maxRatio, maxRatioFound := maxLimitRequestRatios[k] if minQuantityFound && maxQuantityFound && minQuantity.Cmp(maxQuantity) > 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.limits[%d].min[%s]", i, k), minQuantity, fmt.Sprintf("min value %s is greater than max value %s", minQuantity.String(), maxQuantity.String()))) + allErrs = append(allErrs, field.Invalid(idxPath.Child("min").Key(string(k)), minQuantity, fmt.Sprintf("min value %s is greater than max value %s", minQuantity.String(), maxQuantity.String()))) } if defaultRequestQuantityFound && minQuantityFound && minQuantity.Cmp(defaultRequestQuantity) > 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.limits[%d].defaultRequest[%s]", i, k), defaultRequestQuantity, fmt.Sprintf("min value %s is greater than default request value %s", minQuantity.String(), defaultRequestQuantity.String()))) + allErrs = append(allErrs, field.Invalid(idxPath.Child("defaultRequest").Key(string(k)), defaultRequestQuantity, fmt.Sprintf("min value %s is greater than default request value %s", minQuantity.String(), defaultRequestQuantity.String()))) } if defaultRequestQuantityFound && maxQuantityFound && defaultRequestQuantity.Cmp(maxQuantity) > 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.limits[%d].defaultRequest[%s]", i, k), defaultRequestQuantity, fmt.Sprintf("default request value %s is greater than max value %s", defaultRequestQuantity.String(), maxQuantity.String()))) + allErrs = append(allErrs, field.Invalid(idxPath.Child("defaultRequest").Key(string(k)), defaultRequestQuantity, fmt.Sprintf("default request value %s is greater than max value %s", defaultRequestQuantity.String(), maxQuantity.String()))) } if defaultRequestQuantityFound && defaultQuantityFound && defaultRequestQuantity.Cmp(defaultQuantity) > 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.limits[%d].defaultRequest[%s]", i, k), defaultRequestQuantity, fmt.Sprintf("default request value %s is greater than default limit value %s", defaultRequestQuantity.String(), defaultQuantity.String()))) + allErrs = append(allErrs, field.Invalid(idxPath.Child("defaultRequest").Key(string(k)), defaultRequestQuantity, fmt.Sprintf("default request value %s is greater than default limit value %s", defaultRequestQuantity.String(), defaultQuantity.String()))) } if defaultQuantityFound && minQuantityFound && minQuantity.Cmp(defaultQuantity) > 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.limits[%d].default[%s]", i, k), minQuantity, fmt.Sprintf("min value %s is greater than default value %s", minQuantity.String(), defaultQuantity.String()))) + allErrs = append(allErrs, field.Invalid(idxPath.Child("default").Key(string(k)), minQuantity, fmt.Sprintf("min value %s is greater than default value %s", minQuantity.String(), defaultQuantity.String()))) } if defaultQuantityFound && maxQuantityFound && defaultQuantity.Cmp(maxQuantity) > 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.limits[%d].default[%s]", i, k), maxQuantity, fmt.Sprintf("default value %s is greater than max value %s", defaultQuantity.String(), maxQuantity.String()))) + allErrs = append(allErrs, field.Invalid(idxPath.Child("default").Key(string(k)), maxQuantity, fmt.Sprintf("default value %s is greater than max value %s", defaultQuantity.String(), maxQuantity.String()))) } if maxRatioFound && maxRatio.Cmp(*resource.NewQuantity(1, resource.DecimalSI)) < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.limits[%d].maxLimitRequestRatio[%s]", i, k), maxRatio, fmt.Sprintf("maxLimitRequestRatio %s is less than 1", maxRatio.String()))) + allErrs = append(allErrs, field.Invalid(idxPath.Child("maxLimitRequestRatio").Key(string(k)), maxRatio, fmt.Sprintf("ratio %s is less than 1", maxRatio.String()))) } if maxRatioFound && minQuantityFound && maxQuantityFound { maxRatioValue := float64(maxRatio.Value()) @@ -1622,7 +2058,7 @@ func ValidateLimitRange(limitRange *api.LimitRange) errs.ValidationErrorList { } maxRatioLimit := float64(maxQuantityValue) / float64(minQuantityValue) if maxRatioValue > maxRatioLimit { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("spec.limits[%d].maxLimitRequestRatio[%s]", i, k), maxRatio, fmt.Sprintf("maxLimitRequestRatio %s is greater than max/min = %f", maxRatio.String(), maxRatioLimit))) + allErrs = append(allErrs, field.Invalid(idxPath.Child("maxLimitRequestRatio").Key(string(k)), maxRatio, fmt.Sprintf("ratio %s is greater than max/min = %f", maxRatio.String(), maxRatioLimit))) } } } @@ -1632,16 +2068,14 @@ func ValidateLimitRange(limitRange *api.LimitRange) errs.ValidationErrorList { } // ValidateServiceAccount tests if required fields in the ServiceAccount are set. -func ValidateServiceAccount(serviceAccount *api.ServiceAccount) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&serviceAccount.ObjectMeta, true, ValidateServiceAccountName).Prefix("metadata")...) +func ValidateServiceAccount(serviceAccount *api.ServiceAccount) field.ErrorList { + allErrs := ValidateObjectMeta(&serviceAccount.ObjectMeta, true, ValidateServiceAccountName, field.NewPath("metadata")) return allErrs } // ValidateServiceAccountUpdate tests if required fields in the ServiceAccount are set. -func ValidateServiceAccountUpdate(oldServiceAccount, newServiceAccount *api.ServiceAccount) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newServiceAccount.ObjectMeta, &oldServiceAccount.ObjectMeta).Prefix("metadata")...) +func ValidateServiceAccountUpdate(newServiceAccount, oldServiceAccount *api.ServiceAccount) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newServiceAccount.ObjectMeta, &oldServiceAccount.ObjectMeta, field.NewPath("metadata")) allErrs = append(allErrs, ValidateServiceAccount(newServiceAccount)...) return allErrs } @@ -1657,21 +2091,19 @@ func IsSecretKey(value string) bool { } // ValidateSecret tests if required fields in the Secret are set. -func ValidateSecret(secret *api.Secret) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&secret.ObjectMeta, true, ValidateSecretName).Prefix("metadata")...) +func ValidateSecret(secret *api.Secret) field.ErrorList { + allErrs := ValidateObjectMeta(&secret.ObjectMeta, true, ValidateSecretName, field.NewPath("metadata")) + dataPath := field.NewPath("data") totalSize := 0 for key, value := range secret.Data { if !IsSecretKey(key) { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("data[%s]", key), key, fmt.Sprintf("must have at most %d characters and match regex %s", validation.DNS1123SubdomainMaxLength, SecretKeyFmt))) + allErrs = append(allErrs, field.Invalid(dataPath.Key(key), key, fmt.Sprintf("must have at most %d characters and match regex %s", validation.DNS1123SubdomainMaxLength, SecretKeyFmt))) } - totalSize += len(value) } - if totalSize > api.MaxSecretSize { - allErrs = append(allErrs, errs.NewFieldForbidden("data", "Maximum secret size exceeded")) + allErrs = append(allErrs, field.TooLong(dataPath, "", api.MaxSecretSize)) } switch secret.Type { @@ -1679,22 +2111,56 @@ func ValidateSecret(secret *api.Secret) errs.ValidationErrorList { // Only require Annotations[kubernetes.io/service-account.name] // Additional fields (like Annotations[kubernetes.io/service-account.uid] and Data[token]) might be contributed later by a controller loop if value := secret.Annotations[api.ServiceAccountNameKey]; len(value) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired(fmt.Sprintf("metadata.annotations[%s]", api.ServiceAccountNameKey))) + allErrs = append(allErrs, field.Required(field.NewPath("metadata", "annotations").Key(api.ServiceAccountNameKey), "")) } case api.SecretTypeOpaque, "": // no-op case api.SecretTypeDockercfg: dockercfgBytes, exists := secret.Data[api.DockerConfigKey] if !exists { - allErrs = append(allErrs, errs.NewFieldRequired(fmt.Sprintf("data[%s]", api.DockerConfigKey))) + allErrs = append(allErrs, field.Required(dataPath.Key(api.DockerConfigKey), "")) break } // make sure that the content is well-formed json. if err := json.Unmarshal(dockercfgBytes, &map[string]interface{}{}); err != nil { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("data[%s]", api.DockerConfigKey), "", err.Error())) + allErrs = append(allErrs, field.Invalid(dataPath.Key(api.DockerConfigKey), "", err.Error())) + } + case api.SecretTypeDockerConfigJson: + dockerConfigJsonBytes, exists := secret.Data[api.DockerConfigJsonKey] + if !exists { + allErrs = append(allErrs, field.Required(dataPath.Key(api.DockerConfigJsonKey), "")) + break } + // make sure that the content is well-formed json. + if err := json.Unmarshal(dockerConfigJsonBytes, &map[string]interface{}{}); err != nil { + allErrs = append(allErrs, field.Invalid(dataPath.Key(api.DockerConfigJsonKey), "", err.Error())) + } + case api.SecretTypeBasicAuth: + _, usernameFieldExists := secret.Data[api.BasicAuthUsernameKey] + _, passwordFieldExists := secret.Data[api.BasicAuthPasswordKey] + + // username or password might be empty, but the field must be present + if !usernameFieldExists && !passwordFieldExists { + allErrs = append(allErrs, field.Required(field.NewPath("data[%s]").Key(api.BasicAuthUsernameKey), "")) + allErrs = append(allErrs, field.Required(field.NewPath("data[%s]").Key(api.BasicAuthPasswordKey), "")) + break + } + case api.SecretTypeSSHAuth: + if len(secret.Data[api.SSHAuthPrivateKey]) == 0 { + allErrs = append(allErrs, field.Required(field.NewPath("data[%s]").Key(api.SSHAuthPrivateKey), "")) + break + } + + case api.SecretTypeTLS: + if _, exists := secret.Data[api.TLSCertKey]; !exists { + allErrs = append(allErrs, field.Required(dataPath.Key(api.TLSCertKey), "")) + } + if _, exists := secret.Data[api.TLSPrivateKeyKey]; !exists { + allErrs = append(allErrs, field.Required(dataPath.Key(api.TLSPrivateKeyKey), "")) + } + // TODO: Verify that the key matches the cert. default: // no-op } @@ -1703,90 +2169,125 @@ func ValidateSecret(secret *api.Secret) errs.ValidationErrorList { } // ValidateSecretUpdate tests if required fields in the Secret are set. -func ValidateSecretUpdate(oldSecret, newSecret *api.Secret) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newSecret.ObjectMeta, &oldSecret.ObjectMeta).Prefix("metadata")...) +func ValidateSecretUpdate(newSecret, oldSecret *api.Secret) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newSecret.ObjectMeta, &oldSecret.ObjectMeta, field.NewPath("metadata")) if len(newSecret.Type) == 0 { newSecret.Type = oldSecret.Type } - if newSecret.Type != oldSecret.Type { - allErrs = append(allErrs, errs.NewFieldInvalid("type", newSecret.Type, fieldImmutableErrorMsg)) - } + + allErrs = append(allErrs, ValidateImmutableField(newSecret.Type, oldSecret.Type, field.NewPath("type"))...) allErrs = append(allErrs, ValidateSecret(newSecret)...) return allErrs } -func validateBasicResource(quantity resource.Quantity) errs.ValidationErrorList { - if quantity.Value() < 0 { - return errs.ValidationErrorList{errs.NewFieldInvalid("", quantity.Value(), "must be a valid resource quantity")} +// ValidateConfigMapName can be used to check whether the given ConfigMap name is valid. +// Prefix indicates this name will be used as part of generation, in which case +// trailing dashes are allowed. +func ValidateConfigMapName(name string, prefix bool) (bool, string) { + return NameIsDNSSubdomain(name, prefix) +} + +// ValidateConfigMap tests whether required fields in the ConfigMap are set. +func ValidateConfigMap(cfg *api.ConfigMap) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, ValidateObjectMeta(&cfg.ObjectMeta, true, ValidateConfigMapName, field.NewPath("metadata"))...) + + totalSize := 0 + + for key, value := range cfg.Data { + if !IsSecretKey(key) { + allErrs = append(allErrs, field.Invalid(field.NewPath("data").Key(key), key, fmt.Sprintf("must have at most %d characters and match regex %s", validation.DNS1123SubdomainMaxLength, SecretKeyFmt))) + } + totalSize += len(value) } - return errs.ValidationErrorList{} + if totalSize > api.MaxSecretSize { + allErrs = append(allErrs, field.TooLong(field.NewPath("data"), "", api.MaxSecretSize)) + } + + return allErrs +} + +// ValidateConfigMapUpdate tests if required fields in the ConfigMap are set. +func ValidateConfigMapUpdate(newCfg, oldCfg *api.ConfigMap) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, ValidateObjectMetaUpdate(&newCfg.ObjectMeta, &oldCfg.ObjectMeta, field.NewPath("metadata"))...) + allErrs = append(allErrs, ValidateConfigMap(newCfg)...) + + return allErrs +} + +func validateBasicResource(quantity resource.Quantity, fldPath *field.Path) field.ErrorList { + if quantity.Value() < 0 { + return field.ErrorList{field.Invalid(fldPath, quantity.Value(), "must be a valid resource quantity")} + } + return field.ErrorList{} } // Validates resource requirement spec. -func ValidateResourceRequirements(requirements *api.ResourceRequirements) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateResourceRequirements(requirements *api.ResourceRequirements, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + limPath := fldPath.Child("limits") for resourceName, quantity := range requirements.Limits { + fldPath := limPath.Key(string(resourceName)) // Validate resource name. - allErrs = append(allErrs, validateResourceName(resourceName.String(), fmt.Sprintf("resources.limits[%s]", resourceName))...) - if api.IsStandardResourceName(resourceName.String()) { - allErrs = append(allErrs, validateBasicResource(quantity).Prefix(fmt.Sprintf("Resource %s: ", resourceName))...) + allErrs = append(allErrs, validateResourceName(string(resourceName), fldPath)...) + if api.IsStandardResourceName(string(resourceName)) { + allErrs = append(allErrs, validateBasicResource(quantity, fldPath.Key(string(resourceName)))...) } // Check that request <= limit. requestQuantity, exists := requirements.Requests[resourceName] if exists { - var requestValue, limitValue int64 - requestValue = requestQuantity.Value() - limitValue = quantity.Value() - // Do a more precise comparison if possible (if the value won't overflow). - if requestValue <= resource.MaxMilliValue && limitValue <= resource.MaxMilliValue { - requestValue = requestQuantity.MilliValue() - limitValue = quantity.MilliValue() - } - if limitValue < requestValue { - allErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf("resources.limits[%s]", resourceName), quantity.String(), "limit cannot be smaller than request")) + if quantity.Cmp(requestQuantity) < 0 { + allErrs = append(allErrs, field.Invalid(fldPath, quantity.String(), "must be greater than or equal to request")) } } } + reqPath := fldPath.Child("requests") for resourceName, quantity := range requirements.Requests { + fldPath := reqPath.Key(string(resourceName)) // Validate resource name. - allErrs = append(allErrs, validateResourceName(resourceName.String(), fmt.Sprintf("resources.requests[%s]", resourceName))...) - if api.IsStandardResourceName(resourceName.String()) { - allErrs = append(allErrs, validateBasicResource(quantity).Prefix(fmt.Sprintf("Resource %s: ", resourceName))...) + allErrs = append(allErrs, validateResourceName(string(resourceName), fldPath)...) + if api.IsStandardResourceName(string(resourceName)) { + allErrs = append(allErrs, validateBasicResource(quantity, fldPath.Key(string(resourceName)))...) } } return allErrs } // ValidateResourceQuota tests if required fields in the ResourceQuota are set. -func ValidateResourceQuota(resourceQuota *api.ResourceQuota) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&resourceQuota.ObjectMeta, true, ValidateResourceQuotaName).Prefix("metadata")...) +func ValidateResourceQuota(resourceQuota *api.ResourceQuota) field.ErrorList { + allErrs := ValidateObjectMeta(&resourceQuota.ObjectMeta, true, ValidateResourceQuotaName, field.NewPath("metadata")) + fldPath := field.NewPath("spec", "hard") for k, v := range resourceQuota.Spec.Hard { - allErrs = append(allErrs, validateResourceName(string(k), string(resourceQuota.TypeMeta.Kind))...) - allErrs = append(allErrs, validateResourceQuantityValue(string(k), v)...) + resPath := fldPath.Key(string(k)) + allErrs = append(allErrs, validateResourceName(string(k), resPath)...) + allErrs = append(allErrs, validateResourceQuantityValue(string(k), v, resPath)...) } + fldPath = field.NewPath("status", "hard") for k, v := range resourceQuota.Status.Hard { - allErrs = append(allErrs, validateResourceName(string(k), string(resourceQuota.TypeMeta.Kind))...) - allErrs = append(allErrs, validateResourceQuantityValue(string(k), v)...) + resPath := fldPath.Key(string(k)) + allErrs = append(allErrs, validateResourceName(string(k), resPath)...) + allErrs = append(allErrs, validateResourceQuantityValue(string(k), v, resPath)...) } + fldPath = field.NewPath("status", "used") for k, v := range resourceQuota.Status.Used { - allErrs = append(allErrs, validateResourceName(string(k), string(resourceQuota.TypeMeta.Kind))...) - allErrs = append(allErrs, validateResourceQuantityValue(string(k), v)...) + resPath := fldPath.Key(string(k)) + allErrs = append(allErrs, validateResourceName(string(k), resPath)...) + allErrs = append(allErrs, validateResourceQuantityValue(string(k), v, resPath)...) } return allErrs } // validateResourceQuantityValue enforces that specified quantity is valid for specified resource -func validateResourceQuantityValue(resource string, value resource.Quantity) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidatePositiveQuantity(value, resource)...) +func validateResourceQuantityValue(resource string, value resource.Quantity, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, ValidateNonnegativeQuantity(value, fldPath)...) if api.IsIntegerResourceName(resource) { if value.MilliValue()%int64(1000) != int64(0) { - allErrs = append(allErrs, errs.NewFieldInvalid(resource, value, isNotIntegerErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath, value, isNotIntegerErrorMsg)) } } return allErrs @@ -1794,12 +2295,13 @@ func validateResourceQuantityValue(resource string, value resource.Quantity) err // ValidateResourceQuotaUpdate tests to see if the update is legal for an end user to make. // newResourceQuota is updated with fields that cannot be changed. -func ValidateResourceQuotaUpdate(newResourceQuota, oldResourceQuota *api.ResourceQuota) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newResourceQuota.ObjectMeta, &oldResourceQuota.ObjectMeta).Prefix("metadata")...) +func ValidateResourceQuotaUpdate(newResourceQuota, oldResourceQuota *api.ResourceQuota) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newResourceQuota.ObjectMeta, &oldResourceQuota.ObjectMeta, field.NewPath("metadata")) + fldPath := field.NewPath("spec", "hard") for k, v := range newResourceQuota.Spec.Hard { - allErrs = append(allErrs, validateResourceName(string(k), string(newResourceQuota.TypeMeta.Kind))...) - allErrs = append(allErrs, validateResourceQuantityValue(string(k), v)...) + resPath := fldPath.Key(string(k)) + allErrs = append(allErrs, validateResourceName(string(k), resPath)...) + allErrs = append(allErrs, validateResourceQuantityValue(string(k), v, resPath)...) } newResourceQuota.Status = oldResourceQuota.Status return allErrs @@ -1807,55 +2309,56 @@ func ValidateResourceQuotaUpdate(newResourceQuota, oldResourceQuota *api.Resourc // ValidateResourceQuotaStatusUpdate tests to see if the status update is legal for an end user to make. // newResourceQuota is updated with fields that cannot be changed. -func ValidateResourceQuotaStatusUpdate(newResourceQuota, oldResourceQuota *api.ResourceQuota) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newResourceQuota.ObjectMeta, &oldResourceQuota.ObjectMeta).Prefix("metadata")...) - if newResourceQuota.ResourceVersion == "" { - allErrs = append(allErrs, errs.NewFieldRequired("resourceVersion")) +func ValidateResourceQuotaStatusUpdate(newResourceQuota, oldResourceQuota *api.ResourceQuota) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newResourceQuota.ObjectMeta, &oldResourceQuota.ObjectMeta, field.NewPath("metadata")) + if len(newResourceQuota.ResourceVersion) == 0 { + allErrs = append(allErrs, field.Required(field.NewPath("resourceVersion"), "")) } + fldPath := field.NewPath("status", "hard") for k, v := range newResourceQuota.Status.Hard { - allErrs = append(allErrs, validateResourceName(string(k), string(newResourceQuota.TypeMeta.Kind))...) - allErrs = append(allErrs, validateResourceQuantityValue(string(k), v)...) + resPath := fldPath.Key(string(k)) + allErrs = append(allErrs, validateResourceName(string(k), resPath)...) + allErrs = append(allErrs, validateResourceQuantityValue(string(k), v, resPath)...) } + fldPath = field.NewPath("status", "used") for k, v := range newResourceQuota.Status.Used { - allErrs = append(allErrs, validateResourceName(string(k), string(newResourceQuota.TypeMeta.Kind))...) - allErrs = append(allErrs, validateResourceQuantityValue(string(k), v)...) + resPath := fldPath.Key(string(k)) + allErrs = append(allErrs, validateResourceName(string(k), resPath)...) + allErrs = append(allErrs, validateResourceQuantityValue(string(k), v, resPath)...) } newResourceQuota.Spec = oldResourceQuota.Spec return allErrs } // ValidateNamespace tests if required fields are set. -func ValidateNamespace(namespace *api.Namespace) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&namespace.ObjectMeta, false, ValidateNamespaceName).Prefix("metadata")...) +func ValidateNamespace(namespace *api.Namespace) field.ErrorList { + allErrs := ValidateObjectMeta(&namespace.ObjectMeta, false, ValidateNamespaceName, field.NewPath("metadata")) for i := range namespace.Spec.Finalizers { - allErrs = append(allErrs, validateFinalizerName(string(namespace.Spec.Finalizers[i]))...) + allErrs = append(allErrs, validateFinalizerName(string(namespace.Spec.Finalizers[i]), field.NewPath("spec", "finalizers"))...) } return allErrs } // Validate finalizer names -func validateFinalizerName(stringValue string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateFinalizerName(stringValue string, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if !validation.IsQualifiedName(stringValue) { - return append(allErrs, errs.NewFieldInvalid("spec.finalizers", stringValue, qualifiedNameErrorMsg)) + return append(allErrs, field.Invalid(fldPath, stringValue, qualifiedNameErrorMsg)) } if len(strings.Split(stringValue, "/")) == 1 { if !api.IsStandardFinalizerName(stringValue) { - return append(allErrs, errs.NewFieldInvalid("spec.finalizers", stringValue, fmt.Sprintf("finalizer name is neither a standard finalizer name nor is it fully qualified"))) + return append(allErrs, field.Invalid(fldPath, stringValue, fmt.Sprintf("name is neither a standard finalizer name nor is it fully qualified"))) } } - return errs.ValidationErrorList{} + return field.ErrorList{} } // ValidateNamespaceUpdate tests to make sure a namespace update can be applied. // newNamespace is updated with fields that cannot be changed -func ValidateNamespaceUpdate(newNamespace *api.Namespace, oldNamespace *api.Namespace) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newNamespace.ObjectMeta, &oldNamespace.ObjectMeta).Prefix("metadata")...) +func ValidateNamespaceUpdate(newNamespace *api.Namespace, oldNamespace *api.Namespace) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newNamespace.ObjectMeta, &oldNamespace.ObjectMeta, field.NewPath("metadata")) newNamespace.Spec.Finalizers = oldNamespace.Spec.Finalizers newNamespace.Status = oldNamespace.Status return allErrs @@ -1863,17 +2366,16 @@ func ValidateNamespaceUpdate(newNamespace *api.Namespace, oldNamespace *api.Name // ValidateNamespaceStatusUpdate tests to see if the update is legal for an end user to make. newNamespace is updated with fields // that cannot be changed. -func ValidateNamespaceStatusUpdate(newNamespace, oldNamespace *api.Namespace) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newNamespace.ObjectMeta, &oldNamespace.ObjectMeta).Prefix("metadata")...) +func ValidateNamespaceStatusUpdate(newNamespace, oldNamespace *api.Namespace) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newNamespace.ObjectMeta, &oldNamespace.ObjectMeta, field.NewPath("metadata")) newNamespace.Spec = oldNamespace.Spec if newNamespace.DeletionTimestamp.IsZero() { if newNamespace.Status.Phase != api.NamespaceActive { - allErrs = append(allErrs, errs.NewFieldInvalid("Status.Phase", newNamespace.Status.Phase, "A namespace may only be in active status if it does not have a deletion timestamp.")) + allErrs = append(allErrs, field.Invalid(field.NewPath("status", "Phase"), newNamespace.Status.Phase, "may only be 'Active' if `deletionTimestamp` is empty")) } } else { if newNamespace.Status.Phase != api.NamespaceTerminating { - allErrs = append(allErrs, errs.NewFieldInvalid("Status.Phase", newNamespace.Status.Phase, "A namespace may only be in terminating status if it has a deletion timestamp.")) + allErrs = append(allErrs, field.Invalid(field.NewPath("status", "Phase"), newNamespace.Status.Phase, "may only be 'Terminating' if `deletionTimestamp` is not empty")) } } return allErrs @@ -1881,112 +2383,110 @@ func ValidateNamespaceStatusUpdate(newNamespace, oldNamespace *api.Namespace) er // ValidateNamespaceFinalizeUpdate tests to see if the update is legal for an end user to make. // newNamespace is updated with fields that cannot be changed. -func ValidateNamespaceFinalizeUpdate(newNamespace, oldNamespace *api.Namespace) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newNamespace.ObjectMeta, &oldNamespace.ObjectMeta).Prefix("metadata")...) +func ValidateNamespaceFinalizeUpdate(newNamespace, oldNamespace *api.Namespace) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newNamespace.ObjectMeta, &oldNamespace.ObjectMeta, field.NewPath("metadata")) + + fldPath := field.NewPath("spec", "finalizers") for i := range newNamespace.Spec.Finalizers { - allErrs = append(allErrs, validateFinalizerName(string(newNamespace.Spec.Finalizers[i]))...) + idxPath := fldPath.Index(i) + allErrs = append(allErrs, validateFinalizerName(string(newNamespace.Spec.Finalizers[i]), idxPath)...) } newNamespace.Status = oldNamespace.Status return allErrs } // ValidateEndpoints tests if required fields are set. -func ValidateEndpoints(endpoints *api.Endpoints) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMeta(&endpoints.ObjectMeta, true, ValidateEndpointsName).Prefix("metadata")...) - allErrs = append(allErrs, validateEndpointSubsets(endpoints.Subsets).Prefix("subsets")...) +func ValidateEndpoints(endpoints *api.Endpoints) field.ErrorList { + allErrs := ValidateObjectMeta(&endpoints.ObjectMeta, true, ValidateEndpointsName, field.NewPath("metadata")) + allErrs = append(allErrs, validateEndpointSubsets(endpoints.Subsets, field.NewPath("subsets"))...) return allErrs } -func validateEndpointSubsets(subsets []api.EndpointSubset) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateEndpointSubsets(subsets []api.EndpointSubset, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} for i := range subsets { ss := &subsets[i] - - ssErrs := errs.ValidationErrorList{} + idxPath := fldPath.Index(i) if len(ss.Addresses) == 0 && len(ss.NotReadyAddresses) == 0 { - ssErrs = append(ssErrs, errs.NewFieldRequired("addresses or notReadyAddresses")) + //TODO: consider adding a RequiredOneOf() error for this and similar cases + allErrs = append(allErrs, field.Required(idxPath, "must specify `addresses` or `notReadyAddresses`")) } if len(ss.Ports) == 0 { - ssErrs = append(ssErrs, errs.NewFieldRequired("ports")) + allErrs = append(allErrs, field.Required(idxPath.Child("ports"), "")) } for addr := range ss.Addresses { - ssErrs = append(ssErrs, validateEndpointAddress(&ss.Addresses[addr]).PrefixIndex(addr).Prefix("addresses")...) + allErrs = append(allErrs, validateEndpointAddress(&ss.Addresses[addr], idxPath.Child("addresses").Index(addr))...) } for port := range ss.Ports { - ssErrs = append(ssErrs, validateEndpointPort(&ss.Ports[port], len(ss.Ports) > 1).PrefixIndex(port).Prefix("ports")...) + allErrs = append(allErrs, validateEndpointPort(&ss.Ports[port], len(ss.Ports) > 1, idxPath.Child("ports").Index(port))...) } - - allErrs = append(allErrs, ssErrs.PrefixIndex(i)...) } return allErrs } -func validateEndpointAddress(address *api.EndpointAddress) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateEndpointAddress(address *api.EndpointAddress, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if !validation.IsValidIPv4(address.IP) { - allErrs = append(allErrs, errs.NewFieldInvalid("ip", address.IP, "invalid IPv4 address")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("ip"), address.IP, "must be a valid IPv4 address")) return allErrs } - return validateIpIsNotLinkLocalOrLoopback(address.IP, "ip") + return validateIpIsNotLinkLocalOrLoopback(address.IP, fldPath.Child("ip")) } -func validateIpIsNotLinkLocalOrLoopback(ipAddress, fieldName string) errs.ValidationErrorList { +func validateIpIsNotLinkLocalOrLoopback(ipAddress string, fldPath *field.Path) field.ErrorList { // We disallow some IPs as endpoints or external-ips. Specifically, loopback addresses are // nonsensical and link-local addresses tend to be used for node-centric purposes (e.g. metadata service). - allErrs := errs.ValidationErrorList{} + allErrs := field.ErrorList{} ip := net.ParseIP(ipAddress) if ip == nil { - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName, ipAddress, "not a valid IP address")) + allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "must be a valid IP address")) return allErrs } if ip.IsLoopback() { - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName, ipAddress, "may not be in the loopback range (127.0.0.0/8)")) + allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "may not be in the loopback range (127.0.0.0/8)")) } if ip.IsLinkLocalUnicast() { - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName, ipAddress, "may not be in the link-local range (169.254.0.0/16)")) + allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "may not be in the link-local range (169.254.0.0/16)")) } if ip.IsLinkLocalMulticast() { - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName, ipAddress, "may not be in the link-local multicast range (224.0.0.0/24)")) + allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "may not be in the link-local multicast range (224.0.0.0/24)")) } return allErrs } -func validateEndpointPort(port *api.EndpointPort, requireName bool) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if requireName && port.Name == "" { - allErrs = append(allErrs, errs.NewFieldRequired("name")) - } else if port.Name != "" { +func validateEndpointPort(port *api.EndpointPort, requireName bool, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if requireName && len(port.Name) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "")) + } else if len(port.Name) != 0 { if !validation.IsDNS1123Label(port.Name) { - allErrs = append(allErrs, errs.NewFieldInvalid("name", port.Name, DNS1123LabelErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), port.Name, DNS1123LabelErrorMsg)) } } if !validation.IsValidPortNum(port.Port) { - allErrs = append(allErrs, errs.NewFieldInvalid("port", port.Port, portRangeErrorMsg)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("port"), port.Port, PortRangeErrorMsg)) } if len(port.Protocol) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("protocol")) + allErrs = append(allErrs, field.Required(fldPath.Child("protocol"), "")) } else if !supportedPortProtocols.Has(string(port.Protocol)) { - allErrs = append(allErrs, errs.NewFieldValueNotSupported("protocol", port.Protocol, supportedPortProtocols.List())) + allErrs = append(allErrs, field.NotSupported(fldPath.Child("protocol"), port.Protocol, supportedPortProtocols.List())) } return allErrs } // ValidateEndpointsUpdate tests to make sure an endpoints update can be applied. -func ValidateEndpointsUpdate(oldEndpoints, newEndpoints *api.Endpoints) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateObjectMetaUpdate(&newEndpoints.ObjectMeta, &oldEndpoints.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, validateEndpointSubsets(newEndpoints.Subsets).Prefix("subsets")...) +func ValidateEndpointsUpdate(newEndpoints, oldEndpoints *api.Endpoints) field.ErrorList { + allErrs := ValidateObjectMetaUpdate(&newEndpoints.ObjectMeta, &oldEndpoints.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, validateEndpointSubsets(newEndpoints.Subsets, field.NewPath("subsets"))...) return allErrs } // ValidateSecurityContext ensure the security context contains valid settings -func ValidateSecurityContext(sc *api.SecurityContext) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateSecurityContext(sc *api.SecurityContext, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} //this should only be true for testing since SecurityContext is defaulted by the api if sc == nil { return allErrs @@ -1994,53 +2494,53 @@ func ValidateSecurityContext(sc *api.SecurityContext) errs.ValidationErrorList { if sc.Privileged != nil { if *sc.Privileged && !capabilities.Get().AllowPrivileged { - allErrs = append(allErrs, errs.NewFieldForbidden("privileged", sc.Privileged)) + allErrs = append(allErrs, field.Forbidden(fldPath.Child("privileged"), "disallowed by policy")) } } if sc.RunAsUser != nil { if *sc.RunAsUser < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("runAsUser", *sc.RunAsUser, "runAsUser cannot be negative")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("runAsUser"), *sc.RunAsUser, isNegativeErrorMsg)) } } return allErrs } -func ValidatePodLogOptions(opts *api.PodLogOptions) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidatePodLogOptions(opts *api.PodLogOptions) field.ErrorList { + allErrs := field.ErrorList{} if opts.TailLines != nil && *opts.TailLines < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("tailLines", *opts.TailLines, "tailLines must be a non-negative integer or nil")) + allErrs = append(allErrs, field.Invalid(field.NewPath("tailLines"), *opts.TailLines, isNegativeErrorMsg)) } if opts.LimitBytes != nil && *opts.LimitBytes < 1 { - allErrs = append(allErrs, errs.NewFieldInvalid("limitBytes", *opts.LimitBytes, "limitBytes must be a positive integer or nil")) + allErrs = append(allErrs, field.Invalid(field.NewPath("limitBytes"), *opts.LimitBytes, "must be greater than 0")) } switch { case opts.SinceSeconds != nil && opts.SinceTime != nil: - allErrs = append(allErrs, errs.NewFieldInvalid("sinceSeconds", *opts.SinceSeconds, "only one of sinceTime or sinceSeconds can be provided")) - allErrs = append(allErrs, errs.NewFieldInvalid("sinceTime", *opts.SinceTime, "only one of sinceTime or sinceSeconds can be provided")) + allErrs = append(allErrs, field.Forbidden(field.NewPath(""), "at most one of `sinceTime` or `sinceSeconds` may be specified")) case opts.SinceSeconds != nil: if *opts.SinceSeconds < 1 { - allErrs = append(allErrs, errs.NewFieldInvalid("sinceSeconds", *opts.SinceSeconds, "sinceSeconds must be a positive integer")) + allErrs = append(allErrs, field.Invalid(field.NewPath("sinceSeconds"), *opts.SinceSeconds, "must be greater than 0")) } } return allErrs } // ValidateLoadBalancerStatus validates required fields on a LoadBalancerStatus -func ValidateLoadBalancerStatus(status *api.LoadBalancerStatus) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - for _, ingress := range status.Ingress { +func ValidateLoadBalancerStatus(status *api.LoadBalancerStatus, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + for i, ingress := range status.Ingress { + idxPath := fldPath.Child("ingress").Index(i) if len(ingress.IP) > 0 { if isIP := (net.ParseIP(ingress.IP) != nil); !isIP { - allErrs = append(allErrs, errs.NewFieldInvalid("ingress.ip", ingress.IP, "must be an IP address")) + allErrs = append(allErrs, field.Invalid(idxPath.Child("ip"), ingress.IP, "must be a valid IP address")) } } if len(ingress.Hostname) > 0 { if valid, errMsg := NameIsDNSSubdomain(ingress.Hostname, false); !valid { - allErrs = append(allErrs, errs.NewFieldInvalid("ingress.hostname", ingress.Hostname, errMsg)) + allErrs = append(allErrs, field.Invalid(idxPath.Child("hostname"), ingress.Hostname, errMsg)) } if isIP := (net.ParseIP(ingress.Hostname) != nil); isIP { - allErrs = append(allErrs, errs.NewFieldInvalid("ingress.hostname", ingress.Hostname, "must be a DNS name, not an IP address")) + allErrs = append(allErrs, field.Invalid(idxPath.Child("hostname"), ingress.Hostname, "must be a DNS name, not an IP address")) } } } diff --git a/vendor/k8s.io/kubernetes/pkg/api/validation/validation_test.go b/vendor/k8s.io/kubernetes/pkg/api/validation/validation_test.go index b288e2da1..5f93808c0 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/validation/validation_test.go +++ b/vendor/k8s.io/kubernetes/pkg/api/validation/validation_test.go @@ -18,6 +18,7 @@ package validation import ( "math/rand" + "reflect" "strings" "testing" "time" @@ -27,16 +28,14 @@ import ( "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/capabilities" - "k8s.io/kubernetes/pkg/util" - utilerrors "k8s.io/kubernetes/pkg/util/errors" - "k8s.io/kubernetes/pkg/util/fielderrors" - errors "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/intstr" "k8s.io/kubernetes/pkg/util/sets" + "k8s.io/kubernetes/pkg/util/validation/field" ) -func expectPrefix(t *testing.T, prefix string, errs fielderrors.ValidationErrorList) { +func expectPrefix(t *testing.T, prefix string, errs field.ErrorList) { for i := range errs { - if f, p := errs[i].(*errors.ValidationError).Field, prefix; !strings.HasPrefix(f, p) { + if f, p := errs[i].Field, prefix; !strings.HasPrefix(f, p) { t.Errorf("expected prefix '%s' for field '%s' (%v)", p, f, errs[i]) } } @@ -44,12 +43,16 @@ func expectPrefix(t *testing.T, prefix string, errs fielderrors.ValidationErrorL // Ensure custom name functions are allowed func TestValidateObjectMetaCustomName(t *testing.T) { - errs := ValidateObjectMeta(&api.ObjectMeta{Name: "test", GenerateName: "foo"}, false, func(s string, prefix bool) (bool, string) { - if s == "test" { - return true, "" - } - return false, "name-gen" - }) + errs := ValidateObjectMeta( + &api.ObjectMeta{Name: "test", GenerateName: "foo"}, + false, + func(s string, prefix bool) (bool, string) { + if s == "test" { + return true, "" + } + return false, "name-gen" + }, + field.NewPath("field")) if len(errs) != 1 { t.Fatalf("unexpected errors: %v", errs) } @@ -60,13 +63,17 @@ func TestValidateObjectMetaCustomName(t *testing.T) { // Ensure namespace names follow dns label format func TestValidateObjectMetaNamespaces(t *testing.T) { - errs := ValidateObjectMeta(&api.ObjectMeta{Name: "test", Namespace: "foo.bar"}, false, func(s string, prefix bool) (bool, string) { - return true, "" - }) + errs := ValidateObjectMeta( + &api.ObjectMeta{Name: "test", Namespace: "foo.bar"}, + true, + func(s string, prefix bool) (bool, string) { + return true, "" + }, + field.NewPath("field")) if len(errs) != 1 { t.Fatalf("unexpected errors: %v", errs) } - if !strings.Contains(errs[0].Error(), "invalid value 'foo.bar'") { + if !strings.Contains(errs[0].Error(), `Invalid value: "foo.bar"`) { t.Errorf("unexpected error message: %v", errs) } maxLength := 63 @@ -75,13 +82,17 @@ func TestValidateObjectMetaNamespaces(t *testing.T) { for i := range b { b[i] = letters[rand.Intn(len(letters))] } - errs = ValidateObjectMeta(&api.ObjectMeta{Name: "test", Namespace: string(b)}, false, func(s string, prefix bool) (bool, string) { - return true, "" - }) + errs = ValidateObjectMeta( + &api.ObjectMeta{Name: "test", Namespace: string(b)}, + true, + func(s string, prefix bool) (bool, string) { + return true, "" + }, + field.NewPath("field")) if len(errs) != 1 { t.Fatalf("unexpected errors: %v", errs) } - if !strings.Contains(errs[0].Error(), "invalid value") { + if !strings.Contains(errs[0].Error(), "Invalid value") { t.Errorf("unexpected error message: %v", errs) } } @@ -90,18 +101,21 @@ func TestValidateObjectMetaUpdateIgnoresCreationTimestamp(t *testing.T) { if errs := ValidateObjectMetaUpdate( &api.ObjectMeta{Name: "test", ResourceVersion: "1"}, &api.ObjectMeta{Name: "test", ResourceVersion: "1", CreationTimestamp: unversioned.NewTime(time.Unix(10, 0))}, + field.NewPath("field"), ); len(errs) != 0 { t.Fatalf("unexpected errors: %v", errs) } if errs := ValidateObjectMetaUpdate( &api.ObjectMeta{Name: "test", ResourceVersion: "1", CreationTimestamp: unversioned.NewTime(time.Unix(10, 0))}, &api.ObjectMeta{Name: "test", ResourceVersion: "1"}, + field.NewPath("field"), ); len(errs) != 0 { t.Fatalf("unexpected errors: %v", errs) } if errs := ValidateObjectMetaUpdate( &api.ObjectMeta{Name: "test", ResourceVersion: "1", CreationTimestamp: unversioned.NewTime(time.Unix(10, 0))}, &api.ObjectMeta{Name: "test", ResourceVersion: "1", CreationTimestamp: unversioned.NewTime(time.Unix(11, 0))}, + field.NewPath("field"), ); len(errs) != 0 { t.Fatalf("unexpected errors: %v", errs) } @@ -109,7 +123,11 @@ func TestValidateObjectMetaUpdateIgnoresCreationTimestamp(t *testing.T) { // Ensure trailing slash is allowed in generate name func TestValidateObjectMetaTrimsTrailingSlash(t *testing.T) { - errs := ValidateObjectMeta(&api.ObjectMeta{Name: "test", GenerateName: "foo-"}, false, NameIsDNSSubdomain) + errs := ValidateObjectMeta( + &api.ObjectMeta{Name: "test", GenerateName: "foo-"}, + false, + NameIsDNSSubdomain, + field.NewPath("field")) if len(errs) != 0 { t.Fatalf("unexpected errors: %v", errs) } @@ -133,7 +151,7 @@ func TestValidateLabels(t *testing.T) { {"goodvalue": "123_-.BaR"}, } for i := range successCases { - errs := ValidateLabels(successCases[i], "field") + errs := ValidateLabels(successCases[i], field.NewPath("field")) if len(errs) != 0 { t.Errorf("case[%d] expected success, got %#v", i, errs) } @@ -146,11 +164,11 @@ func TestValidateLabels(t *testing.T) { {strings.Repeat("a", 254): "bar"}, } for i := range labelNameErrorCases { - errs := ValidateLabels(labelNameErrorCases[i], "field") + errs := ValidateLabels(labelNameErrorCases[i], field.NewPath("field")) if len(errs) != 1 { t.Errorf("case[%d] expected failure", i) } else { - detail := errs[0].(*errors.ValidationError).Detail + detail := errs[0].Detail if detail != qualifiedNameErrorMsg { t.Errorf("error detail %s should be equal %s", detail, qualifiedNameErrorMsg) } @@ -164,11 +182,11 @@ func TestValidateLabels(t *testing.T) { {"strangecharsinvalue": "?#$notsogood"}, } for i := range labelValueErrorCases { - errs := ValidateLabels(labelValueErrorCases[i], "field") + errs := ValidateLabels(labelValueErrorCases[i], field.NewPath("field")) if len(errs) != 1 { t.Errorf("case[%d] expected failure", i) } else { - detail := errs[0].(*errors.ValidationError).Detail + detail := errs[0].Detail if detail != labelValueErrorMsg { t.Errorf("error detail %s should be equal %s", detail, labelValueErrorMsg) } @@ -198,7 +216,7 @@ func TestValidateAnnotations(t *testing.T) { }, } for i := range successCases { - errs := ValidateAnnotations(successCases[i], "field") + errs := ValidateAnnotations(successCases[i], field.NewPath("field")) if len(errs) != 0 { t.Errorf("case[%d] expected success, got %#v", i, errs) } @@ -211,11 +229,11 @@ func TestValidateAnnotations(t *testing.T) { {strings.Repeat("a", 254): "bar"}, } for i := range nameErrorCases { - errs := ValidateAnnotations(nameErrorCases[i], "field") + errs := ValidateAnnotations(nameErrorCases[i], field.NewPath("field")) if len(errs) != 1 { t.Errorf("case[%d] expected failure", i) } - detail := errs[0].(*errors.ValidationError).Detail + detail := errs[0].Detail if detail != qualifiedNameErrorMsg { t.Errorf("error detail %s should be equal %s", detail, qualifiedNameErrorMsg) } @@ -228,7 +246,7 @@ func TestValidateAnnotations(t *testing.T) { }, } for i := range totalSizeErrorCases { - errs := ValidateAnnotations(totalSizeErrorCases[i], "field") + errs := ValidateAnnotations(totalSizeErrorCases[i], field.NewPath("field")) if len(errs) != 1 { t.Errorf("case[%d] expected failure", i) } @@ -445,6 +463,89 @@ func TestValidatePersistentVolumeClaim(t *testing.T) { } } +func TestValidatePersistentVolumeClaimUpdate(t *testing.T) { + validClaim := testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{ + AccessModes: []api.PersistentVolumeAccessMode{ + api.ReadWriteOnce, + api.ReadOnlyMany, + }, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), + }, + }, + }) + validUpdateClaim := testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{ + AccessModes: []api.PersistentVolumeAccessMode{ + api.ReadWriteOnce, + api.ReadOnlyMany, + }, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), + }, + }, + VolumeName: "volume", + }) + invalidUpdateClaimResources := testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{ + AccessModes: []api.PersistentVolumeAccessMode{ + api.ReadWriteOnce, + api.ReadOnlyMany, + }, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceStorage): resource.MustParse("20G"), + }, + }, + VolumeName: "volume", + }) + invalidUpdateClaimAccessModes := testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{ + AccessModes: []api.PersistentVolumeAccessMode{ + api.ReadWriteOnce, + }, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), + }, + }, + VolumeName: "volume", + }) + scenarios := map[string]struct { + isExpectedFailure bool + oldClaim *api.PersistentVolumeClaim + newClaim *api.PersistentVolumeClaim + }{ + "valid-update": { + isExpectedFailure: false, + oldClaim: validClaim, + newClaim: validUpdateClaim, + }, + "invalid-update-change-resources-on-bound-claim": { + isExpectedFailure: true, + oldClaim: validUpdateClaim, + newClaim: invalidUpdateClaimResources, + }, + "invalid-update-change-access-modes-on-bound-claim": { + isExpectedFailure: true, + oldClaim: validUpdateClaim, + newClaim: invalidUpdateClaimAccessModes, + }, + } + + for name, scenario := range scenarios { + // ensure we have a resource version specified for updates + scenario.oldClaim.ResourceVersion = "1" + scenario.newClaim.ResourceVersion = "1" + errs := ValidatePersistentVolumeClaimUpdate(scenario.newClaim, scenario.oldClaim) + if len(errs) == 0 && scenario.isExpectedFailure { + t.Errorf("Unexpected success for scenario: %s", name) + } + if len(errs) > 0 && !scenario.isExpectedFailure { + t.Errorf("Unexpected failure for scenario: %s - %+v", name, errs) + } + } +} + func TestValidateVolumes(t *testing.T) { lun := 1 successCase := []api.Volume{ @@ -454,7 +555,8 @@ func TestValidateVolumes(t *testing.T) { {Name: "empty", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, {Name: "gcepd", VolumeSource: api.VolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{PDName: "my-PD", FSType: "ext4", Partition: 1, ReadOnly: false}}}, {Name: "awsebs", VolumeSource: api.VolumeSource{AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{VolumeID: "my-PD", FSType: "ext4", Partition: 1, ReadOnly: false}}}, - {Name: "gitrepo", VolumeSource: api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{Repository: "my-repo", Revision: "hashstring"}}}, + {Name: "gitrepo", VolumeSource: api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{Repository: "my-repo", Revision: "hashstring", Directory: "target"}}}, + {Name: "gitrepodot", VolumeSource: api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{Repository: "my-repo", Directory: "."}}}, {Name: "iscsidisk", VolumeSource: api.VolumeSource{ISCSI: &api.ISCSIVolumeSource{TargetPortal: "127.0.0.1", IQN: "iqn.2015-02.example.com:test", Lun: 1, FSType: "ext4", ReadOnly: false}}}, {Name: "secret", VolumeSource: api.VolumeSource{Secret: &api.SecretVolumeSource{SecretName: "my-secret"}}}, {Name: "glusterfs", VolumeSource: api.VolumeSource{Glusterfs: &api.GlusterfsVolumeSource{EndpointsName: "host1", Path: "path", ReadOnly: false}}}, @@ -489,12 +591,14 @@ func TestValidateVolumes(t *testing.T) { FieldPath: "metadata.labels"}}, }}}}, {Name: "fc", VolumeSource: api.VolumeSource{FC: &api.FCVolumeSource{[]string{"some_wwn"}, &lun, "ext4", false}}}, + {Name: "flexvolume", VolumeSource: api.VolumeSource{FlexVolume: &api.FlexVolumeSource{Driver: "kubernetes.io/blue", FSType: "ext4"}}}, + {Name: "azure", VolumeSource: api.VolumeSource{AzureFile: &api.AzureFileVolumeSource{"key", "share", false}}}, } - names, errs := validateVolumes(successCase) + names, errs := validateVolumes(successCase, field.NewPath("field")) if len(errs) != 0 { t.Errorf("expected success: %v", errs) } - if len(names) != len(successCase) || !names.HasAll("abc", "123", "abc-123", "empty", "gcepd", "gitrepo", "secret", "iscsidisk", "cinder", "cephfs", "fc") { + if len(names) != len(successCase) || !names.HasAll("abc", "123", "abc-123", "empty", "gcepd", "gitrepo", "secret", "iscsidisk", "cinder", "cephfs", "flexvolume", "fc") { t.Errorf("wrong names result: %v", names) } emptyVS := api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}} @@ -506,6 +610,9 @@ func TestValidateVolumes(t *testing.T) { emptyMon := api.VolumeSource{RBD: &api.RBDVolumeSource{CephMonitors: []string{}, RBDImage: "bar", FSType: "ext4"}} emptyImage := api.VolumeSource{RBD: &api.RBDVolumeSource{CephMonitors: []string{"foo"}, RBDImage: "", FSType: "ext4"}} emptyCephFSMon := api.VolumeSource{CephFS: &api.CephFSVolumeSource{Monitors: []string{}}} + startsWithDots := api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{Repository: "foo", Directory: "..dots/bar"}} + containsDots := api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{Repository: "foo", Directory: "dots/../bar"}} + absPath := api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{Repository: "foo", Directory: "/abstarget"}} emptyPathName := api.VolumeSource{DownwardAPI: &api.DownwardAPIVolumeSource{Items: []api.DownwardAPIVolumeFile{{Path: "", FieldRef: api.ObjectFieldSelector{ APIVersion: "v1", @@ -534,49 +641,155 @@ func TestValidateVolumes(t *testing.T) { zeroWWN := api.VolumeSource{FC: &api.FCVolumeSource{[]string{}, &lun, "ext4", false}} emptyLun := api.VolumeSource{FC: &api.FCVolumeSource{[]string{"wwn"}, nil, "ext4", false}} slashInName := api.VolumeSource{Flocker: &api.FlockerVolumeSource{DatasetName: "foo/bar"}} + emptyAzureSecret := api.VolumeSource{AzureFile: &api.AzureFileVolumeSource{"", "share", false}} + emptyAzureShare := api.VolumeSource{AzureFile: &api.AzureFileVolumeSource{"name", "", false}} errorCases := map[string]struct { V []api.Volume - T errors.ValidationErrorType + T field.ErrorType F string D string }{ - "zero-length name": {[]api.Volume{{Name: "", VolumeSource: emptyVS}}, errors.ValidationErrorTypeRequired, "[0].name", ""}, - "name > 63 characters": {[]api.Volume{{Name: strings.Repeat("a", 64), VolumeSource: emptyVS}}, errors.ValidationErrorTypeInvalid, "[0].name", "must be a DNS label (at most 63 characters, matching regex [a-z0-9]([-a-z0-9]*[a-z0-9])?): e.g. \"my-name\""}, - "name not a DNS label": {[]api.Volume{{Name: "a.b.c", VolumeSource: emptyVS}}, errors.ValidationErrorTypeInvalid, "[0].name", "must be a DNS label (at most 63 characters, matching regex [a-z0-9]([-a-z0-9]*[a-z0-9])?): e.g. \"my-name\""}, - "name not unique": {[]api.Volume{{Name: "abc", VolumeSource: emptyVS}, {Name: "abc", VolumeSource: emptyVS}}, errors.ValidationErrorTypeDuplicate, "[1].name", ""}, - "empty portal": {[]api.Volume{{Name: "badportal", VolumeSource: emptyPortal}}, errors.ValidationErrorTypeRequired, "[0].source.iscsi.targetPortal", ""}, - "empty iqn": {[]api.Volume{{Name: "badiqn", VolumeSource: emptyIQN}}, errors.ValidationErrorTypeRequired, "[0].source.iscsi.iqn", ""}, - "empty hosts": {[]api.Volume{{Name: "badhost", VolumeSource: emptyHosts}}, errors.ValidationErrorTypeRequired, "[0].source.glusterfs.endpoints", ""}, - "empty path": {[]api.Volume{{Name: "badpath", VolumeSource: emptyPath}}, errors.ValidationErrorTypeRequired, "[0].source.glusterfs.path", ""}, - "empty datasetName": {[]api.Volume{{Name: "badname", VolumeSource: emptyName}}, errors.ValidationErrorTypeRequired, "[0].source.flocker.datasetName", ""}, - "empty mon": {[]api.Volume{{Name: "badmon", VolumeSource: emptyMon}}, errors.ValidationErrorTypeRequired, "[0].source.rbd.monitors", ""}, - "empty image": {[]api.Volume{{Name: "badimage", VolumeSource: emptyImage}}, errors.ValidationErrorTypeRequired, "[0].source.rbd.image", ""}, - "empty cephfs mon": {[]api.Volume{{Name: "badmon", VolumeSource: emptyCephFSMon}}, errors.ValidationErrorTypeRequired, "[0].source.cephfs.monitors", ""}, - "empty metatada path": {[]api.Volume{{Name: "emptyname", VolumeSource: emptyPathName}}, errors.ValidationErrorTypeRequired, "[0].source.downwardApi.path", ""}, - "absolute path": {[]api.Volume{{Name: "absolutepath", VolumeSource: absolutePathName}}, errors.ValidationErrorTypeForbidden, "[0].source.downwardApi.path", ""}, - "dot dot path": {[]api.Volume{{Name: "dotdotpath", VolumeSource: dotDotInPath}}, errors.ValidationErrorTypeInvalid, "[0].source.downwardApi.path", "must not contain \"..\"."}, - "dot dot file name": {[]api.Volume{{Name: "dotdotfilename", VolumeSource: dotDotPathName}}, errors.ValidationErrorTypeInvalid, "[0].source.downwardApi.path", "must not start with \"..\"."}, - "dot dot first level dirent": {[]api.Volume{{Name: "dotdotdirfilename", VolumeSource: dotDotFirstLevelDirent}}, errors.ValidationErrorTypeInvalid, "[0].source.downwardApi.path", "must not start with \"..\"."}, - "empty wwn": {[]api.Volume{{Name: "badimage", VolumeSource: zeroWWN}}, errors.ValidationErrorTypeRequired, "[0].source.fc.targetWWNs", ""}, - "empty lun": {[]api.Volume{{Name: "badimage", VolumeSource: emptyLun}}, errors.ValidationErrorTypeRequired, "[0].source.fc.lun", ""}, - "slash in datasetName": {[]api.Volume{{Name: "slashinname", VolumeSource: slashInName}}, errors.ValidationErrorTypeInvalid, "[0].source.flocker.datasetName", "must not contain '/'"}, + "zero-length name": { + []api.Volume{{Name: "", VolumeSource: emptyVS}}, + field.ErrorTypeRequired, + "name", "", + }, + "name > 63 characters": { + []api.Volume{{Name: strings.Repeat("a", 64), VolumeSource: emptyVS}}, + field.ErrorTypeInvalid, + "name", "must be a DNS label", + }, + "name not a DNS label": { + []api.Volume{{Name: "a.b.c", VolumeSource: emptyVS}}, + field.ErrorTypeInvalid, + "name", "must be a DNS label", + }, + "name not unique": { + []api.Volume{{Name: "abc", VolumeSource: emptyVS}, {Name: "abc", VolumeSource: emptyVS}}, + field.ErrorTypeDuplicate, + "[1].name", "", + }, + "empty portal": { + []api.Volume{{Name: "badportal", VolumeSource: emptyPortal}}, + field.ErrorTypeRequired, + "iscsi.targetPortal", "", + }, + "empty iqn": { + []api.Volume{{Name: "badiqn", VolumeSource: emptyIQN}}, + field.ErrorTypeRequired, + "iscsi.iqn", "", + }, + "empty hosts": { + []api.Volume{{Name: "badhost", VolumeSource: emptyHosts}}, + field.ErrorTypeRequired, + "glusterfs.endpoints", "", + }, + "empty path": { + []api.Volume{{Name: "badpath", VolumeSource: emptyPath}}, + field.ErrorTypeRequired, + "glusterfs.path", "", + }, + "empty datasetName": { + []api.Volume{{Name: "badname", VolumeSource: emptyName}}, + field.ErrorTypeRequired, + "flocker.datasetName", "", + }, + "empty mon": { + []api.Volume{{Name: "badmon", VolumeSource: emptyMon}}, + field.ErrorTypeRequired, + "rbd.monitors", "", + }, + "empty image": { + []api.Volume{{Name: "badimage", VolumeSource: emptyImage}}, + field.ErrorTypeRequired, + "rbd.image", "", + }, + "empty cephfs mon": { + []api.Volume{{Name: "badmon", VolumeSource: emptyCephFSMon}}, + field.ErrorTypeRequired, + "cephfs.monitors", "", + }, + "empty metatada path": { + []api.Volume{{Name: "emptyname", VolumeSource: emptyPathName}}, + field.ErrorTypeRequired, + "downwardAPI.path", "", + }, + "absolute path": { + []api.Volume{{Name: "absolutepath", VolumeSource: absolutePathName}}, + field.ErrorTypeInvalid, + "downwardAPI.path", "", + }, + "dot dot path": { + []api.Volume{{Name: "dotdotpath", VolumeSource: dotDotInPath}}, + field.ErrorTypeInvalid, + "downwardAPI.path", `must not contain '..'`, + }, + "dot dot file name": { + []api.Volume{{Name: "dotdotfilename", VolumeSource: dotDotPathName}}, + field.ErrorTypeInvalid, + "downwardAPI.path", `must not start with '..'`, + }, + "dot dot first level dirent": { + []api.Volume{{Name: "dotdotdirfilename", VolumeSource: dotDotFirstLevelDirent}}, + field.ErrorTypeInvalid, + "downwardAPI.path", `must not start with '..'`, + }, + "empty wwn": { + []api.Volume{{Name: "badimage", VolumeSource: zeroWWN}}, + field.ErrorTypeRequired, + "fc.targetWWNs", "", + }, + "empty lun": { + []api.Volume{{Name: "badimage", VolumeSource: emptyLun}}, + field.ErrorTypeRequired, + "fc.lun", "", + }, + "slash in datasetName": { + []api.Volume{{Name: "slashinname", VolumeSource: slashInName}}, + field.ErrorTypeInvalid, + "flocker.datasetName", "must not contain '/'", + }, + "starts with '..'": { + []api.Volume{{Name: "badprefix", VolumeSource: startsWithDots}}, + field.ErrorTypeInvalid, + "gitRepo.directory", `must not start with '..'`, + }, + "contains '..'": { + []api.Volume{{Name: "containsdots", VolumeSource: containsDots}}, + field.ErrorTypeInvalid, + "gitRepo.directory", `must not contain '..'`, + }, + "absolute target": { + []api.Volume{{Name: "absolutetarget", VolumeSource: absPath}}, + field.ErrorTypeInvalid, + "gitRepo.directory", "", + }, + "empty secret": { + []api.Volume{{Name: "emptyaccount", VolumeSource: emptyAzureSecret}}, + field.ErrorTypeRequired, + "azureFile.secretName", "", + }, + "empty share": { + []api.Volume{{Name: "emptyaccount", VolumeSource: emptyAzureShare}}, + field.ErrorTypeRequired, + "azureFile.shareName", "", + }, } for k, v := range errorCases { - _, errs := validateVolumes(v.V) + _, errs := validateVolumes(v.V, field.NewPath("field")) if len(errs) == 0 { t.Errorf("expected failure %s for %v", k, v.V) continue } for i := range errs { - if errs[i].(*errors.ValidationError).Type != v.T { - t.Errorf("%s: expected errors to have type %s: %v", k, v.T, errs[i]) + if errs[i].Type != v.T { + t.Errorf("%s: expected error to have type %q: %q", k, v.T, errs[i].Type) } - if errs[i].(*errors.ValidationError).Field != v.F { - t.Errorf("%s: expected errors to have field %s: %v", k, v.F, errs[i]) + if !strings.Contains(errs[i].Field, v.F) { + t.Errorf("%s: expected error field %q: %q", k, v.F, errs[i].Field) } - detail := errs[i].(*errors.ValidationError).Detail - if detail != v.D { - t.Errorf("%s: expected error detail \"%s\", got \"%s\"", k, v.D, detail) + if !strings.Contains(errs[i].Detail, v.D) { + t.Errorf("%s: expected error detail %q, got %q", k, v.D, errs[i].Detail) } } } @@ -590,52 +803,91 @@ func TestValidatePorts(t *testing.T) { {Name: "do-re-me", ContainerPort: 84, Protocol: "UDP"}, {ContainerPort: 85, Protocol: "TCP"}, } - if errs := validatePorts(successCase); len(errs) != 0 { + if errs := validateContainerPorts(successCase, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } nonCanonicalCase := []api.ContainerPort{ {ContainerPort: 80, Protocol: "TCP"}, } - if errs := validatePorts(nonCanonicalCase); len(errs) != 0 { + if errs := validateContainerPorts(nonCanonicalCase, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } errorCases := map[string]struct { P []api.ContainerPort - T errors.ValidationErrorType + T field.ErrorType F string D string }{ - "name > 15 characters": {[]api.ContainerPort{{Name: strings.Repeat("a", 16), ContainerPort: 80, Protocol: "TCP"}}, errors.ValidationErrorTypeInvalid, "[0].name", portNameErrorMsg}, - "name not a IANA svc name ": {[]api.ContainerPort{{Name: "a.b.c", ContainerPort: 80, Protocol: "TCP"}}, errors.ValidationErrorTypeInvalid, "[0].name", portNameErrorMsg}, - "name not a IANA svc name (i.e. a number)": {[]api.ContainerPort{{Name: "80", ContainerPort: 80, Protocol: "TCP"}}, errors.ValidationErrorTypeInvalid, "[0].name", portNameErrorMsg}, - "name not unique": {[]api.ContainerPort{ - {Name: "abc", ContainerPort: 80, Protocol: "TCP"}, - {Name: "abc", ContainerPort: 81, Protocol: "TCP"}, - }, errors.ValidationErrorTypeDuplicate, "[1].name", ""}, - "zero container port": {[]api.ContainerPort{{ContainerPort: 0, Protocol: "TCP"}}, errors.ValidationErrorTypeInvalid, "[0].containerPort", portRangeErrorMsg}, - "invalid container port": {[]api.ContainerPort{{ContainerPort: 65536, Protocol: "TCP"}}, errors.ValidationErrorTypeInvalid, "[0].containerPort", portRangeErrorMsg}, - "invalid host port": {[]api.ContainerPort{{ContainerPort: 80, HostPort: 65536, Protocol: "TCP"}}, errors.ValidationErrorTypeInvalid, "[0].hostPort", portRangeErrorMsg}, - "invalid protocol case": {[]api.ContainerPort{{ContainerPort: 80, Protocol: "tcp"}}, errors.ValidationErrorTypeNotSupported, "[0].protocol", "supported values: TCP, UDP"}, - "invalid protocol": {[]api.ContainerPort{{ContainerPort: 80, Protocol: "ICMP"}}, errors.ValidationErrorTypeNotSupported, "[0].protocol", "supported values: TCP, UDP"}, - "protocol required": {[]api.ContainerPort{{Name: "abc", ContainerPort: 80}}, errors.ValidationErrorTypeRequired, "[0].protocol", ""}, + "name > 15 characters": { + []api.ContainerPort{{Name: strings.Repeat("a", 16), ContainerPort: 80, Protocol: "TCP"}}, + field.ErrorTypeInvalid, + "name", PortNameErrorMsg, + }, + "name not a IANA svc name ": { + []api.ContainerPort{{Name: "a.b.c", ContainerPort: 80, Protocol: "TCP"}}, + field.ErrorTypeInvalid, + "name", PortNameErrorMsg, + }, + "name not a IANA svc name (i.e. a number)": { + []api.ContainerPort{{Name: "80", ContainerPort: 80, Protocol: "TCP"}}, + field.ErrorTypeInvalid, + "name", PortNameErrorMsg, + }, + "name not unique": { + []api.ContainerPort{ + {Name: "abc", ContainerPort: 80, Protocol: "TCP"}, + {Name: "abc", ContainerPort: 81, Protocol: "TCP"}, + }, + field.ErrorTypeDuplicate, + "[1].name", "", + }, + "zero container port": { + []api.ContainerPort{{ContainerPort: 0, Protocol: "TCP"}}, + field.ErrorTypeInvalid, + "containerPort", PortRangeErrorMsg, + }, + "invalid container port": { + []api.ContainerPort{{ContainerPort: 65536, Protocol: "TCP"}}, + field.ErrorTypeInvalid, + "containerPort", PortRangeErrorMsg, + }, + "invalid host port": { + []api.ContainerPort{{ContainerPort: 80, HostPort: 65536, Protocol: "TCP"}}, + field.ErrorTypeInvalid, + "hostPort", PortRangeErrorMsg, + }, + "invalid protocol case": { + []api.ContainerPort{{ContainerPort: 80, Protocol: "tcp"}}, + field.ErrorTypeNotSupported, + "protocol", "supported values: TCP, UDP", + }, + "invalid protocol": { + []api.ContainerPort{{ContainerPort: 80, Protocol: "ICMP"}}, + field.ErrorTypeNotSupported, + "protocol", "supported values: TCP, UDP", + }, + "protocol required": { + []api.ContainerPort{{Name: "abc", ContainerPort: 80}}, + field.ErrorTypeRequired, + "protocol", "", + }, } for k, v := range errorCases { - errs := validatePorts(v.P) + errs := validateContainerPorts(v.P, field.NewPath("field")) if len(errs) == 0 { t.Errorf("expected failure for %s", k) } for i := range errs { - if errs[i].(*errors.ValidationError).Type != v.T { - t.Errorf("%s: expected errors to have type %s: %v", k, v.T, errs[i]) + if errs[i].Type != v.T { + t.Errorf("%s: expected error to have type %q: %q", k, v.T, errs[i].Type) } - if errs[i].(*errors.ValidationError).Field != v.F { - t.Errorf("%s: expected errors to have field %s: %v", k, v.F, errs[i]) + if !strings.Contains(errs[i].Field, v.F) { + t.Errorf("%s: expected error field %q: %q", k, v.F, errs[i].Field) } - detail := errs[i].(*errors.ValidationError).Detail - if detail != v.D { - t.Errorf("%s: expected error detail either empty or %s, got %s", k, v.D, detail) + if !strings.Contains(errs[i].Detail, v.D) { + t.Errorf("%s: expected error detail %q, got %q", k, v.D, errs[i].Detail) } } } @@ -651,13 +903,35 @@ func TestValidateEnv(t *testing.T) { Name: "abc", ValueFrom: &api.EnvVarSource{ FieldRef: &api.ObjectFieldSelector{ - APIVersion: testapi.Default.Version(), + APIVersion: testapi.Default.GroupVersion().String(), FieldPath: "metadata.name", }, }, }, + { + Name: "secret_value", + ValueFrom: &api.EnvVarSource{ + SecretKeyRef: &api.SecretKeySelector{ + LocalObjectReference: api.LocalObjectReference{ + Name: "some-secret", + }, + Key: "secret-key", + }, + }, + }, + { + Name: "ENV_VAR_1", + ValueFrom: &api.EnvVarSource{ + ConfigMapKeyRef: &api.ConfigMapKeySelector{ + LocalObjectReference: api.LocalObjectReference{ + Name: "some-config-map", + }, + Key: "some-key", + }, + }, + }, } - if errs := validateEnv(successCase); len(errs) != 0 { + if errs := validateEnv(successCase, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } @@ -669,12 +943,12 @@ func TestValidateEnv(t *testing.T) { { name: "zero-length name", envs: []api.EnvVar{{Name: ""}}, - expectedError: "[0].name: required value", + expectedError: "[0].name: Required value", }, { name: "name not a C identifier", envs: []api.EnvVar{{Name: "a.b.c"}}, - expectedError: `[0].name: invalid value 'a.b.c', Details: must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"`, + expectedError: `[0].name: Invalid value: "a.b.c": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"`, }, { name: "value and valueFrom specified", @@ -683,12 +957,75 @@ func TestValidateEnv(t *testing.T) { Value: "foo", ValueFrom: &api.EnvVarSource{ FieldRef: &api.ObjectFieldSelector{ - APIVersion: testapi.Default.Version(), + APIVersion: testapi.Default.GroupVersion().String(), FieldPath: "metadata.name", }, }, }}, - expectedError: "[0].valueFrom: invalid value '', Details: sources cannot be specified when value is not empty", + expectedError: "[0].valueFrom: Invalid value: \"\": may not be specified when `value` is not empty", + }, + { + name: "valueFrom.fieldRef and valueFrom.secretKeyRef specified", + envs: []api.EnvVar{{ + Name: "abc", + ValueFrom: &api.EnvVarSource{ + FieldRef: &api.ObjectFieldSelector{ + APIVersion: testapi.Default.GroupVersion().String(), + FieldPath: "metadata.name", + }, + SecretKeyRef: &api.SecretKeySelector{ + LocalObjectReference: api.LocalObjectReference{ + Name: "a-secret", + }, + Key: "a-key", + }, + }, + }}, + expectedError: "[0].valueFrom: Invalid value: \"\": may not have more than one field specified at a time", + }, + { + name: "valueFrom.fieldRef and valueFrom.configMapKeyRef set", + envs: []api.EnvVar{{ + Name: "some_var_name", + ValueFrom: &api.EnvVarSource{ + FieldRef: &api.ObjectFieldSelector{ + APIVersion: testapi.Default.GroupVersion().String(), + FieldPath: "metadata.name", + }, + ConfigMapKeyRef: &api.ConfigMapKeySelector{ + LocalObjectReference: api.LocalObjectReference{ + Name: "some-config-map", + }, + Key: "some-key", + }, + }, + }}, + expectedError: `[0].valueFrom: Invalid value: "": may not have more than one field specified at a time`, + }, + { + name: "valueFrom.fieldRef and valueFrom.secretKeyRef specified", + envs: []api.EnvVar{{ + Name: "abc", + ValueFrom: &api.EnvVarSource{ + FieldRef: &api.ObjectFieldSelector{ + APIVersion: testapi.Default.GroupVersion().String(), + FieldPath: "metadata.name", + }, + SecretKeyRef: &api.SecretKeySelector{ + LocalObjectReference: api.LocalObjectReference{ + Name: "a-secret", + }, + Key: "a-key", + }, + ConfigMapKeyRef: &api.ConfigMapKeySelector{ + LocalObjectReference: api.LocalObjectReference{ + Name: "some-config-map", + }, + Key: "some-key", + }, + }, + }}, + expectedError: `[0].valueFrom: Invalid value: "": may not have more than one field specified at a time`, }, { name: "missing FieldPath on ObjectFieldSelector", @@ -696,11 +1033,11 @@ func TestValidateEnv(t *testing.T) { Name: "abc", ValueFrom: &api.EnvVarSource{ FieldRef: &api.ObjectFieldSelector{ - APIVersion: testapi.Default.Version(), + APIVersion: testapi.Default.GroupVersion().String(), }, }, }}, - expectedError: "[0].valueFrom.fieldRef.fieldPath: required value", + expectedError: `[0].valueFrom.fieldRef.fieldPath: Required value`, }, { name: "missing APIVersion on ObjectFieldSelector", @@ -712,7 +1049,7 @@ func TestValidateEnv(t *testing.T) { }, }, }}, - expectedError: "[0].valueFrom.fieldRef.apiVersion: required value", + expectedError: `[0].valueFrom.fieldRef.apiVersion: Required value`, }, { name: "invalid fieldPath", @@ -721,11 +1058,11 @@ func TestValidateEnv(t *testing.T) { ValueFrom: &api.EnvVarSource{ FieldRef: &api.ObjectFieldSelector{ FieldPath: "metadata.whoops", - APIVersion: testapi.Default.Version(), + APIVersion: testapi.Default.GroupVersion().String(), }, }, }}, - expectedError: "[0].valueFrom.fieldRef.fieldPath: invalid value 'metadata.whoops', Details: error converting fieldPath", + expectedError: `[0].valueFrom.fieldRef.fieldPath: Invalid value: "metadata.whoops": error converting fieldPath`, }, { name: "invalid fieldPath labels", @@ -738,7 +1075,7 @@ func TestValidateEnv(t *testing.T) { }, }, }}, - expectedError: "[0].valueFrom.fieldRef.fieldPath: unsupported value 'metadata.labels', Details: supported values: metadata.name, metadata.namespace, status.podIP", + expectedError: `[0].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.labels": supported values: metadata.name, metadata.namespace, status.podIP`, }, { name: "invalid fieldPath annotations", @@ -751,7 +1088,7 @@ func TestValidateEnv(t *testing.T) { }, }, }}, - expectedError: "[0].valueFrom.fieldRef.fieldPath: unsupported value 'metadata.annotations', Details: supported values: metadata.name, metadata.namespace, status.podIP", + expectedError: `[0].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.annotations": supported values: metadata.name, metadata.namespace, status.podIP`, }, { name: "unsupported fieldPath", @@ -760,21 +1097,21 @@ func TestValidateEnv(t *testing.T) { ValueFrom: &api.EnvVarSource{ FieldRef: &api.ObjectFieldSelector{ FieldPath: "status.phase", - APIVersion: testapi.Default.Version(), + APIVersion: testapi.Default.GroupVersion().String(), }, }, }}, - expectedError: "[0].valueFrom.fieldRef.fieldPath: unsupported value 'status.phase', Details: supported values: metadata.name, metadata.namespace, status.podIP", + expectedError: `valueFrom.fieldRef.fieldPath: Unsupported value: "status.phase": supported values: metadata.name, metadata.namespace, status.podIP`, }, } for _, tc := range errorCases { - if errs := validateEnv(tc.envs); len(errs) == 0 { + if errs := validateEnv(tc.envs, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure for %s", tc.name) } else { for i := range errs { - str := errs[i].(*errors.ValidationError).Error() - if str != "" && str != tc.expectedError { - t.Errorf("%s: expected error detail either empty or %s, got %s", tc.name, tc.expectedError, str) + str := errs[i].Error() + if str != "" && !strings.Contains(str, tc.expectedError) { + t.Errorf("%s: expected error detail either empty or %q, got %q", tc.name, tc.expectedError, str) } } } @@ -789,7 +1126,7 @@ func TestValidateVolumeMounts(t *testing.T) { {Name: "123", MountPath: "/foo"}, {Name: "abc-123", MountPath: "/bar"}, } - if errs := validateVolumeMounts(successCase, volumes); len(errs) != 0 { + if errs := validateVolumeMounts(successCase, volumes, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } @@ -799,7 +1136,7 @@ func TestValidateVolumeMounts(t *testing.T) { "empty mountpath": {{Name: "abc", MountPath: ""}}, } for k, v := range errorCases { - if errs := validateVolumeMounts(v, volumes); len(errs) == 0 { + if errs := validateVolumeMounts(v, volumes, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure for %s", k) } } @@ -807,25 +1144,29 @@ func TestValidateVolumeMounts(t *testing.T) { func TestValidateProbe(t *testing.T) { handler := api.Handler{Exec: &api.ExecAction{Command: []string{"echo"}}} - successCases := []*api.Probe{ - nil, - {TimeoutSeconds: 10, InitialDelaySeconds: 0, Handler: handler}, - {TimeoutSeconds: 0, InitialDelaySeconds: 10, Handler: handler}, + // These fields must be positive. + positiveFields := [...]string{"InitialDelaySeconds", "TimeoutSeconds", "PeriodSeconds", "SuccessThreshold", "FailureThreshold"} + successCases := []*api.Probe{nil} + for _, field := range positiveFields { + probe := &api.Probe{Handler: handler} + reflect.ValueOf(probe).Elem().FieldByName(field).SetInt(10) + successCases = append(successCases, probe) } + for _, p := range successCases { - if errs := validateProbe(p); len(errs) != 0 { + if errs := validateProbe(p, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } - errorCases := []*api.Probe{ - {TimeoutSeconds: 10, InitialDelaySeconds: 10}, - {TimeoutSeconds: 10, InitialDelaySeconds: -10, Handler: handler}, - {TimeoutSeconds: -10, InitialDelaySeconds: 10, Handler: handler}, - {TimeoutSeconds: -10, InitialDelaySeconds: -10, Handler: handler}, + errorCases := []*api.Probe{{TimeoutSeconds: 10, InitialDelaySeconds: 10}} + for _, field := range positiveFields { + probe := &api.Probe{Handler: handler} + reflect.ValueOf(probe).Elem().FieldByName(field).SetInt(-10) + errorCases = append(errorCases, probe) } for _, p := range errorCases { - if errs := validateProbe(p); len(errs) == 0 { + if errs := validateProbe(p, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure for %v", p) } } @@ -834,12 +1175,14 @@ func TestValidateProbe(t *testing.T) { func TestValidateHandler(t *testing.T) { successCases := []api.Handler{ {Exec: &api.ExecAction{Command: []string{"echo"}}}, - {HTTPGet: &api.HTTPGetAction{Path: "/", Port: util.NewIntOrStringFromInt(1), Host: "", Scheme: "HTTP"}}, - {HTTPGet: &api.HTTPGetAction{Path: "/foo", Port: util.NewIntOrStringFromInt(65535), Host: "host", Scheme: "HTTP"}}, - {HTTPGet: &api.HTTPGetAction{Path: "/", Port: util.NewIntOrStringFromString("port"), Host: "", Scheme: "HTTP"}}, + {HTTPGet: &api.HTTPGetAction{Path: "/", Port: intstr.FromInt(1), Host: "", Scheme: "HTTP"}}, + {HTTPGet: &api.HTTPGetAction{Path: "/foo", Port: intstr.FromInt(65535), Host: "host", Scheme: "HTTP"}}, + {HTTPGet: &api.HTTPGetAction{Path: "/", Port: intstr.FromString("port"), Host: "", Scheme: "HTTP"}}, + {HTTPGet: &api.HTTPGetAction{Path: "/", Port: intstr.FromString("port"), Host: "", Scheme: "HTTP", HTTPHeaders: []api.HTTPHeader{{"Host", "foo.example.com"}}}}, + {HTTPGet: &api.HTTPGetAction{Path: "/", Port: intstr.FromString("port"), Host: "", Scheme: "HTTP", HTTPHeaders: []api.HTTPHeader{{"X-Forwarded-For", "1.2.3.4"}, {"X-Forwarded-For", "5.6.7.8"}}}}, } for _, h := range successCases { - if errs := validateHandler(&h); len(errs) != 0 { + if errs := validateHandler(&h, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } @@ -847,12 +1190,14 @@ func TestValidateHandler(t *testing.T) { errorCases := []api.Handler{ {}, {Exec: &api.ExecAction{Command: []string{}}}, - {HTTPGet: &api.HTTPGetAction{Path: "", Port: util.NewIntOrStringFromInt(0), Host: ""}}, - {HTTPGet: &api.HTTPGetAction{Path: "/foo", Port: util.NewIntOrStringFromInt(65536), Host: "host"}}, - {HTTPGet: &api.HTTPGetAction{Path: "", Port: util.NewIntOrStringFromString(""), Host: ""}}, + {HTTPGet: &api.HTTPGetAction{Path: "", Port: intstr.FromInt(0), Host: ""}}, + {HTTPGet: &api.HTTPGetAction{Path: "/foo", Port: intstr.FromInt(65536), Host: "host"}}, + {HTTPGet: &api.HTTPGetAction{Path: "", Port: intstr.FromString(""), Host: ""}}, + {HTTPGet: &api.HTTPGetAction{Path: "/", Port: intstr.FromString("port"), Host: "", Scheme: "HTTP", HTTPHeaders: []api.HTTPHeader{{"Host:", "foo.example.com"}}}}, + {HTTPGet: &api.HTTPGetAction{Path: "/", Port: intstr.FromString("port"), Host: "", Scheme: "HTTP", HTTPHeaders: []api.HTTPHeader{{"X_Forwarded_For", "foo.example.com"}}}}, } for _, h := range errorCases { - if errs := validateHandler(&h); len(errs) == 0 { + if errs := validateHandler(&h, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure for %#v", h) } } @@ -891,7 +1236,7 @@ func TestValidatePullPolicy(t *testing.T) { } for k, v := range testCases { ctr := &v.Container - errs := validatePullPolicy(ctr) + errs := validatePullPolicy(ctr.ImagePullPolicy, field.NewPath("field")) if len(errs) != 0 { t.Errorf("case[%s] expected success, got %#v", k, errs) } @@ -1007,7 +1352,7 @@ func TestValidateContainers(t *testing.T) { }, {Name: "abc-1234", Image: "image", ImagePullPolicy: "IfNotPresent", SecurityContext: fakeValidSecurityContext(true)}, } - if errs := validateContainers(successCase, volumes); len(errs) != 0 { + if errs := validateContainers(successCase, volumes, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } @@ -1079,7 +1424,7 @@ func TestValidateContainers(t *testing.T) { Lifecycle: &api.Lifecycle{ PreStop: &api.Handler{ TCPSocket: &api.TCPSocketAction{ - Port: util.IntOrString{IntVal: 0}, + Port: intstr.FromInt(0), }, }, }, @@ -1187,7 +1532,7 @@ func TestValidateContainers(t *testing.T) { }, } for k, v := range errorCases { - if errs := validateContainers(v, volumes); len(errs) == 0 { + if errs := validateContainers(v, volumes, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure for %s", k) } } @@ -1200,7 +1545,7 @@ func TestValidateRestartPolicy(t *testing.T) { api.RestartPolicyNever, } for _, policy := range successCases { - if errs := validateRestartPolicy(&policy); len(errs) != 0 { + if errs := validateRestartPolicy(&policy, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } @@ -1208,7 +1553,7 @@ func TestValidateRestartPolicy(t *testing.T) { errorCases := []api.RestartPolicy{"", "newpolicy"} for k, policy := range errorCases { - if errs := validateRestartPolicy(&policy); len(errs) == 0 { + if errs := validateRestartPolicy(&policy, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure for %d", k) } } @@ -1217,14 +1562,14 @@ func TestValidateRestartPolicy(t *testing.T) { func TestValidateDNSPolicy(t *testing.T) { successCases := []api.DNSPolicy{api.DNSClusterFirst, api.DNSDefault, api.DNSPolicy(api.DNSClusterFirst)} for _, policy := range successCases { - if errs := validateDNSPolicy(&policy); len(errs) != 0 { + if errs := validateDNSPolicy(&policy, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } errorCases := []api.DNSPolicy{api.DNSPolicy("invalid")} for _, policy := range errorCases { - if errs := validateDNSPolicy(&policy); len(errs) == 0 { + if errs := validateDNSPolicy(&policy, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure for %v", policy) } } @@ -1232,6 +1577,8 @@ func TestValidateDNSPolicy(t *testing.T) { func TestValidatePodSpec(t *testing.T) { activeDeadlineSeconds := int64(30) + minID := int64(0) + maxID := int64(2147483647) successCases := []api.PodSpec{ { // Populate basic fields, leave defaults for most. Volumes: []api.Volume{{Name: "vol", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}}, @@ -1265,6 +1612,26 @@ func TestValidatePodSpec(t *testing.T) { RestartPolicy: api.RestartPolicyAlways, DNSPolicy: api.DNSClusterFirst, }, + { // Populate RunAsUser SupplementalGroups FSGroup with minID 0 + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + SecurityContext: &api.PodSecurityContext{ + SupplementalGroups: []int64{minID}, + RunAsUser: &minID, + FSGroup: &minID, + }, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + { // Populate RunAsUser SupplementalGroups FSGroup with maxID 2147483647 + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + SecurityContext: &api.PodSecurityContext{ + SupplementalGroups: []int64{maxID}, + RunAsUser: &maxID, + FSGroup: &maxID, + }, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, { // Populate HostIPC. SecurityContext: &api.PodSecurityContext{ HostIPC: true, @@ -1283,14 +1650,22 @@ func TestValidatePodSpec(t *testing.T) { RestartPolicy: api.RestartPolicyAlways, DNSPolicy: api.DNSClusterFirst, }, + { // Populate Affinity. + Volumes: []api.Volume{{Name: "vol", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}}, + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, } for i := range successCases { - if errs := ValidatePodSpec(&successCases[i]); len(errs) != 0 { + if errs := ValidatePodSpec(&successCases[i], field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } activeDeadlineSeconds = int64(0) + minID = int64(-1) + maxID = int64(2147483648) failureCases := map[string]api.PodSpec{ "bad volume": { Volumes: []api.Volume{{}}, @@ -1335,6 +1710,60 @@ func TestValidatePodSpec(t *testing.T) { RestartPolicy: api.RestartPolicyAlways, DNSPolicy: api.DNSClusterFirst, }, + "bad supplementalGroups large than math.MaxInt32": { + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + SecurityContext: &api.PodSecurityContext{ + HostNetwork: false, + SupplementalGroups: []int64{maxID, 1234}, + }, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + "bad supplementalGroups less than 0": { + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + SecurityContext: &api.PodSecurityContext{ + HostNetwork: false, + SupplementalGroups: []int64{minID, 1234}, + }, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + "bad runAsUser large than math.MaxInt32": { + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + SecurityContext: &api.PodSecurityContext{ + HostNetwork: false, + RunAsUser: &maxID, + }, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + "bad runAsUser less than 0": { + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + SecurityContext: &api.PodSecurityContext{ + HostNetwork: false, + RunAsUser: &minID, + }, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + "bad fsGroup large than math.MaxInt32": { + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + SecurityContext: &api.PodSecurityContext{ + HostNetwork: false, + FSGroup: &maxID, + }, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + "bad fsGroup less than 0": { + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + SecurityContext: &api.PodSecurityContext{ + HostNetwork: false, + FSGroup: &minID, + }, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, "bad-active-deadline-seconds": { Volumes: []api.Volume{ {Name: "vol", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, @@ -1348,9 +1777,16 @@ func TestValidatePodSpec(t *testing.T) { DNSPolicy: api.DNSClusterFirst, ActiveDeadlineSeconds: &activeDeadlineSeconds, }, + "bad nodeName": { + NodeName: "node name", + Volumes: []api.Volume{{Name: "vol", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}}, + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, } for k, v := range failureCases { - if errs := ValidatePodSpec(&v); len(errs) == 0 { + if errs := ValidatePodSpec(&v, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure for %q", k) } } @@ -1382,6 +1818,52 @@ func TestValidatePod(t *testing.T) { NodeName: "foobar", }, }, + { // Serialized affinity requirements in annotations. + ObjectMeta: api.ObjectMeta{ + Name: "123", + Namespace: "ns", + // TODO: Uncomment and move this block into Annotations map once + // RequiredDuringSchedulingRequiredDuringExecution is implemented + // "requiredDuringSchedulingRequiredDuringExecution": { + // "nodeSelectorTerms": [{ + // "matchExpressions": [{ + // "key": "key1", + // "operator": "Exists" + // }] + // }] + // }, + Annotations: map[string]string{ + api.AffinityAnnotationKey: ` + {"nodeAffinity": { + "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [{ + "matchExpressions": [{ + "key": "key2", + "operator": "In", + "values": ["value1", "value2"] + }] + }] + }, + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 10, + "preference": {"matchExpressions": [ + { + "key": "foo", + "operator": "In", "values": ["bar"] + } + ]} + } + ] + }}`, + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + }, } for _, pod := range successCases { if errs := ValidatePod(&pod); len(errs) != 0 { @@ -1426,6 +1908,111 @@ func TestValidatePod(t *testing.T) { Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, }, }, + "invalid json of affinity in pod annotations": { + ObjectMeta: api.ObjectMeta{ + Name: "123", + Namespace: "ns", + Annotations: map[string]string{ + api.AffinityAnnotationKey: ` + {"nodeAffinity": { + "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [{ + `, + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + }, + "invalid node selector requirement in affinity in pod annotations, operator can't be null": { + ObjectMeta: api.ObjectMeta{ + Name: "123", + Namespace: "ns", + Annotations: map[string]string{ + api.AffinityAnnotationKey: ` + {"nodeAffinity": {"requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [{ + "matchExpressions": [{ + "key": "key1", + }] + }] + }}}`, + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + }, + "invalid preferredSchedulingTerm in affinity in pod annotations, weight should be in range 1-100": { + ObjectMeta: api.ObjectMeta{ + Name: "123", + Namespace: "ns", + Annotations: map[string]string{ + api.AffinityAnnotationKey: ` + {"nodeAffinity": {"preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 199, + "preference": {"matchExpressions": [ + { + "key": "foo", + "operator": "In", + "values": ["bar"] + } + ]} + } + ]}}`, + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + }, + "invalid requiredDuringSchedulingIgnoredDuringExecution node selector, nodeSelectorTerms must have at least one term": { + ObjectMeta: api.ObjectMeta{ + Name: "123", + Namespace: "ns", + Annotations: map[string]string{ + api.AffinityAnnotationKey: ` + {"nodeAffinity": { + "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [] + }, + }}`, + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + }, + "invalid requiredDuringSchedulingIgnoredDuringExecution node selector term, matchExpressions must have at least one node selector requirement": { + ObjectMeta: api.ObjectMeta{ + Name: "123", + Namespace: "ns", + Annotations: map[string]string{ + api.AffinityAnnotationKey: ` + {"nodeAffinity": { + "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [{ + "matchExpressions": [] + }] + }, + }}`, + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + }, } for k, v := range errorCases { if errs := ValidatePod(&v); len(errs) == 0 { @@ -1435,9 +2022,17 @@ func TestValidatePod(t *testing.T) { } func TestValidatePodUpdate(t *testing.T) { - now := unversioned.Now() - grace := int64(30) - grace2 := int64(31) + var ( + activeDeadlineSecondsZero = int64(0) + activeDeadlineSecondsNegative = int64(-30) + activeDeadlineSecondsPositive = int64(30) + activeDeadlineSecondsLarger = int64(31) + + now = unversioned.Now() + grace = int64(30) + grace2 = int64(31) + ) + tests := []struct { a api.Pod b api.Pod @@ -1572,6 +2167,150 @@ func TestValidatePodUpdate(t *testing.T) { true, "image change", }, + { + api.Pod{ + ObjectMeta: api.ObjectMeta{Name: "foo"}, + Spec: api.PodSpec{ + Containers: []api.Container{ + {}, + }, + }, + }, + api.Pod{ + ObjectMeta: api.ObjectMeta{Name: "foo"}, + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Image: "foo:V2", + }, + }, + }, + }, + false, + "image change to empty", + }, + { + api.Pod{ + Spec: api.PodSpec{}, + }, + api.Pod{ + Spec: api.PodSpec{}, + }, + true, + "activeDeadlineSeconds no change, nil", + }, + { + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsPositive, + }, + }, + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsPositive, + }, + }, + true, + "activeDeadlineSeconds no change, set", + }, + { + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsPositive, + }, + }, + api.Pod{}, + true, + "activeDeadlineSeconds change to positive from nil", + }, + { + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsPositive, + }, + }, + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsLarger, + }, + }, + true, + "activeDeadlineSeconds change to smaller positive", + }, + { + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsLarger, + }, + }, + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsPositive, + }, + }, + false, + "activeDeadlineSeconds change to larger positive", + }, + + { + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsNegative, + }, + }, + api.Pod{}, + false, + "activeDeadlineSeconds change to negative from nil", + }, + { + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsNegative, + }, + }, + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsPositive, + }, + }, + false, + "activeDeadlineSeconds change to negative from positive", + }, + { + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsZero, + }, + }, + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsPositive, + }, + }, + true, + "activeDeadlineSeconds change to zero from positive", + }, + { + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsZero, + }, + }, + api.Pod{}, + true, + "activeDeadlineSeconds change to zero from nil", + }, + { + api.Pod{}, + api.Pod{ + Spec: api.PodSpec{ + ActiveDeadlineSeconds: &activeDeadlineSecondsPositive, + }, + }, + false, + "activeDeadlineSeconds change to nil from positive", + }, + { api.Pod{ ObjectMeta: api.ObjectMeta{Name: "foo"}, @@ -1660,11 +2399,11 @@ func TestValidatePodUpdate(t *testing.T) { errs := ValidatePodUpdate(&test.a, &test.b) if test.isValid { if len(errs) != 0 { - t.Errorf("unexpected invalid: %s %v, %v", test.test, test.a, test.b) + t.Errorf("unexpected invalid: %s (%+v)\nA: %+v\nB: %+v", test.test, errs, test.a, test.b) } } else { if len(errs) == 0 { - t.Errorf("unexpected valid: %s %v, %v", test.test, test.a, test.b) + t.Errorf("unexpected valid: %s\nA: %+v\nB: %+v", test.test, test.a, test.b) } } } @@ -1683,7 +2422,7 @@ func makeValidService() api.Service { Selector: map[string]string{"key": "val"}, SessionAffinity: "None", Type: api.ServiceTypeClusterIP, - Ports: []api.ServicePort{{Name: "p", Protocol: "TCP", Port: 8675, TargetPort: util.NewIntOrStringFromInt(8675)}}, + Ports: []api.ServicePort{{Name: "p", Protocol: "TCP", Port: 8675, TargetPort: intstr.FromInt(8675)}}, }, } } @@ -1792,6 +2531,14 @@ func TestValidateService(t *testing.T) { }, numErrs: 1, }, + { + name: "missing ports but headless", + tweakSvc: func(s *api.Service) { + s.Spec.Ports = nil + s.Spec.ClusterIP = api.ClusterIPNone + }, + numErrs: 0, + }, { name: "empty port[0] name", tweakSvc: func(s *api.Service) { @@ -1802,7 +2549,7 @@ func TestValidateService(t *testing.T) { { name: "empty port[1] name", tweakSvc: func(s *api.Service) { - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "", Protocol: "TCP", Port: 12345, TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "", Protocol: "TCP", Port: 12345, TargetPort: intstr.FromInt(12345)}) }, numErrs: 1, }, @@ -1810,7 +2557,7 @@ func TestValidateService(t *testing.T) { name: "empty multi-port port[0] name", tweakSvc: func(s *api.Service) { s.Spec.Ports[0].Name = "" - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "p", Protocol: "TCP", Port: 12345, TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "p", Protocol: "TCP", Port: 12345, TargetPort: intstr.FromInt(12345)}) }, numErrs: 1, }, @@ -1859,7 +2606,34 @@ func TestValidateService(t *testing.T) { { name: "invalid TargetPort int", tweakSvc: func(s *api.Service) { - s.Spec.Ports[0].TargetPort = util.NewIntOrStringFromInt(65536) + s.Spec.Ports[0].TargetPort = intstr.FromInt(65536) + }, + numErrs: 1, + }, + { + name: "valid port headless", + tweakSvc: func(s *api.Service) { + s.Spec.Ports[0].Port = 11722 + s.Spec.Ports[0].TargetPort = intstr.FromInt(11722) + s.Spec.ClusterIP = api.ClusterIPNone + }, + numErrs: 0, + }, + { + name: "invalid port headless", + tweakSvc: func(s *api.Service) { + s.Spec.Ports[0].Port = 11722 + s.Spec.Ports[0].TargetPort = intstr.FromInt(11721) + s.Spec.ClusterIP = api.ClusterIPNone + }, + numErrs: 1, + }, + { + name: "invalid port headless", + tweakSvc: func(s *api.Service) { + s.Spec.Ports[0].Port = 11722 + s.Spec.Ports[0].TargetPort = intstr.FromString("target") + s.Spec.ClusterIP = api.ClusterIPNone }, numErrs: 1, }, @@ -1888,23 +2662,31 @@ func TestValidateService(t *testing.T) { name: "dup port name", tweakSvc: func(s *api.Service) { s.Spec.Ports[0].Name = "p" - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "p", Port: 12345, Protocol: "TCP", TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "p", Port: 12345, Protocol: "TCP", TargetPort: intstr.FromInt(12345)}) }, numErrs: 1, }, { - name: "invalid load balancer protocol 1", + name: "valid load balancer protocol UDP 1", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeLoadBalancer s.Spec.Ports[0].Protocol = "UDP" }, - numErrs: 1, + numErrs: 0, }, { - name: "invalid load balancer protocol 2", + name: "valid load balancer protocol UDP 2", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeLoadBalancer - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "UDP", TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports[0] = api.ServicePort{Name: "q", Port: 12345, Protocol: "UDP", TargetPort: intstr.FromInt(12345)} + }, + numErrs: 0, + }, + { + name: "invalid load balancer with mix protocol", + tweakSvc: func(s *api.Service) { + s.Spec.Type = api.ServiceTypeLoadBalancer + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "UDP", TargetPort: intstr.FromInt(12345)}) }, numErrs: 1, }, @@ -1919,14 +2701,14 @@ func TestValidateService(t *testing.T) { name: "valid 2", tweakSvc: func(s *api.Service) { s.Spec.Ports[0].Protocol = "UDP" - s.Spec.Ports[0].TargetPort = util.NewIntOrStringFromInt(12345) + s.Spec.Ports[0].TargetPort = intstr.FromInt(12345) }, numErrs: 0, }, { name: "valid 3", tweakSvc: func(s *api.Service) { - s.Spec.Ports[0].TargetPort = util.NewIntOrStringFromString("http") + s.Spec.Ports[0].TargetPort = intstr.FromString("http") }, numErrs: 0, }, @@ -1941,7 +2723,7 @@ func TestValidateService(t *testing.T) { name: "valid cluster ip - empty", tweakSvc: func(s *api.Service) { s.Spec.ClusterIP = "" - s.Spec.Ports[0].TargetPort = util.NewIntOrStringFromString("http") + s.Spec.Ports[0].TargetPort = intstr.FromString("http") }, numErrs: 0, }, @@ -1963,7 +2745,7 @@ func TestValidateService(t *testing.T) { name: "valid type loadbalancer 2 ports", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeLoadBalancer - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: intstr.FromInt(12345)}) }, numErrs: 0, }, @@ -1971,7 +2753,7 @@ func TestValidateService(t *testing.T) { name: "valid external load balancer 2 ports", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeLoadBalancer - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: intstr.FromInt(12345)}) }, numErrs: 0, }, @@ -1979,8 +2761,8 @@ func TestValidateService(t *testing.T) { name: "duplicate nodeports", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeNodePort - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 1, Protocol: "TCP", NodePort: 1, TargetPort: util.NewIntOrStringFromInt(1)}) - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "r", Port: 2, Protocol: "TCP", NodePort: 1, TargetPort: util.NewIntOrStringFromInt(2)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 1, Protocol: "TCP", NodePort: 1, TargetPort: intstr.FromInt(1)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "r", Port: 2, Protocol: "TCP", NodePort: 1, TargetPort: intstr.FromInt(2)}) }, numErrs: 1, }, @@ -1988,8 +2770,8 @@ func TestValidateService(t *testing.T) { name: "duplicate nodeports (different protocols)", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeNodePort - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 1, Protocol: "TCP", NodePort: 1, TargetPort: util.NewIntOrStringFromInt(1)}) - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "r", Port: 2, Protocol: "UDP", NodePort: 1, TargetPort: util.NewIntOrStringFromInt(2)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 1, Protocol: "TCP", NodePort: 1, TargetPort: intstr.FromInt(1)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "r", Port: 2, Protocol: "UDP", NodePort: 1, TargetPort: intstr.FromInt(2)}) }, numErrs: 0, }, @@ -2018,7 +2800,7 @@ func TestValidateService(t *testing.T) { name: "valid type loadbalancer 2 ports", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeLoadBalancer - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: intstr.FromInt(12345)}) }, numErrs: 0, }, @@ -2026,7 +2808,7 @@ func TestValidateService(t *testing.T) { name: "valid type loadbalancer with NodePort", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeLoadBalancer - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", NodePort: 12345, TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", NodePort: 12345, TargetPort: intstr.FromInt(12345)}) }, numErrs: 0, }, @@ -2034,7 +2816,7 @@ func TestValidateService(t *testing.T) { name: "valid type=NodePort service with NodePort", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeNodePort - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", NodePort: 12345, TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", NodePort: 12345, TargetPort: intstr.FromInt(12345)}) }, numErrs: 0, }, @@ -2042,7 +2824,7 @@ func TestValidateService(t *testing.T) { name: "valid type=NodePort service without NodePort", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeNodePort - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: intstr.FromInt(12345)}) }, numErrs: 0, }, @@ -2050,7 +2832,7 @@ func TestValidateService(t *testing.T) { name: "valid cluster service without NodePort", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeClusterIP - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: intstr.FromInt(12345)}) }, numErrs: 0, }, @@ -2058,7 +2840,7 @@ func TestValidateService(t *testing.T) { name: "invalid cluster service with NodePort", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeClusterIP - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", NodePort: 12345, TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", NodePort: 12345, TargetPort: intstr.FromInt(12345)}) }, numErrs: 1, }, @@ -2066,8 +2848,8 @@ func TestValidateService(t *testing.T) { name: "invalid public service with duplicate NodePort", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeNodePort - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "p1", Port: 1, Protocol: "TCP", NodePort: 1, TargetPort: util.NewIntOrStringFromInt(1)}) - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "p2", Port: 2, Protocol: "TCP", NodePort: 1, TargetPort: util.NewIntOrStringFromInt(2)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "p1", Port: 1, Protocol: "TCP", NodePort: 1, TargetPort: intstr.FromInt(1)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "p2", Port: 2, Protocol: "TCP", NodePort: 1, TargetPort: intstr.FromInt(2)}) }, numErrs: 1, }, @@ -2075,7 +2857,7 @@ func TestValidateService(t *testing.T) { name: "valid type=LoadBalancer", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeLoadBalancer - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 12345, Protocol: "TCP", TargetPort: intstr.FromInt(12345)}) }, numErrs: 0, }, @@ -2085,7 +2867,7 @@ func TestValidateService(t *testing.T) { name: "invalid port type=LoadBalancer", tweakSvc: func(s *api.Service) { s.Spec.Type = api.ServiceTypeLoadBalancer - s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "kubelet", Port: 10250, Protocol: "TCP", TargetPort: util.NewIntOrStringFromInt(12345)}) + s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "kubelet", Port: 10250, Protocol: "TCP", TargetPort: intstr.FromInt(12345)}) }, numErrs: 1, }, @@ -2096,7 +2878,7 @@ func TestValidateService(t *testing.T) { tc.tweakSvc(&svc) errs := ValidateService(&svc) if len(errs) != tc.numErrs { - t.Errorf("Unexpected error list for case %q: %v", tc.name, utilerrors.NewAggregate(errs)) + t.Errorf("Unexpected error list for case %q: %v", tc.name, errs.ToAggregate()) } } } @@ -2147,7 +2929,7 @@ func TestValidateReplicationControllerStatusUpdate(t *testing.T) { for _, successCase := range successCases { successCase.old.ObjectMeta.ResourceVersion = "1" successCase.update.ObjectMeta.ResourceVersion = "1" - if errs := ValidateReplicationControllerStatusUpdate(&successCase.old, &successCase.update); len(errs) != 0 { + if errs := ValidateReplicationControllerStatusUpdate(&successCase.update, &successCase.old); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } @@ -2177,7 +2959,7 @@ func TestValidateReplicationControllerStatusUpdate(t *testing.T) { }, } for testName, errorCase := range errorCases { - if errs := ValidateReplicationControllerStatusUpdate(&errorCase.old, &errorCase.update); len(errs) == 0 { + if errs := ValidateReplicationControllerStatusUpdate(&errorCase.update, &errorCase.old); len(errs) == 0 { t.Errorf("expected failure: %s", testName) } } @@ -2266,7 +3048,7 @@ func TestValidateReplicationControllerUpdate(t *testing.T) { for _, successCase := range successCases { successCase.old.ObjectMeta.ResourceVersion = "1" successCase.update.ObjectMeta.ResourceVersion = "1" - if errs := ValidateReplicationControllerUpdate(&successCase.old, &successCase.update); len(errs) != 0 { + if errs := ValidateReplicationControllerUpdate(&successCase.update, &successCase.old); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } @@ -2341,7 +3123,7 @@ func TestValidateReplicationControllerUpdate(t *testing.T) { }, } for testName, errorCase := range errorCases { - if errs := ValidateReplicationControllerUpdate(&errorCase.old, &errorCase.update); len(errs) == 0 { + if errs := ValidateReplicationControllerUpdate(&errorCase.update, &errorCase.old); len(errs) == 0 { t.Errorf("expected failure: %s", testName) } } @@ -2548,7 +3330,7 @@ func TestValidateReplicationController(t *testing.T) { t.Errorf("expected failure for %s", k) } for i := range errs { - field := errs[i].(*errors.ValidationError).Field + field := errs[i].Field if !strings.HasPrefix(field, "spec.template.") && field != "metadata.name" && field != "metadata.namespace" && @@ -2664,13 +3446,13 @@ func TestValidateNode(t *testing.T) { t.Errorf("expected failure for %s", k) } for i := range errs { - field := errs[i].(*errors.ValidationError).Field + field := errs[i].Field expectedFields := map[string]bool{ "metadata.name": true, "metadata.labels": true, "metadata.annotations": true, "metadata.namespace": true, - "spec.ExternalID": true, + "spec.externalID": true, } if expectedFields[field] == false { t.Errorf("%s: missing prefix for: %v", k, errs[i]) @@ -2725,6 +3507,36 @@ func TestValidateNodeUpdate(t *testing.T) { Labels: map[string]string{"foo": "baz"}, }, }, true}, + {api.Node{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Spec: api.NodeSpec{ + PodCIDR: "", + }, + }, api.Node{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Spec: api.NodeSpec{ + PodCIDR: "192.168.0.0/16", + }, + }, true}, + {api.Node{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Spec: api.NodeSpec{ + PodCIDR: "192.123.0.0/16", + }, + }, api.Node{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Spec: api.NodeSpec{ + PodCIDR: "192.168.0.0/16", + }, + }, false}, {api.Node{ ObjectMeta: api.ObjectMeta{ Name: "foo", @@ -2851,7 +3663,7 @@ func TestValidateNodeUpdate(t *testing.T) { for i, test := range tests { test.oldNode.ObjectMeta.ResourceVersion = "1" test.node.ObjectMeta.ResourceVersion = "1" - errs := ValidateNodeUpdate(&test.oldNode, &test.node) + errs := ValidateNodeUpdate(&test.node, &test.oldNode) if test.valid && len(errs) > 0 { t.Errorf("%d: Unexpected error: %v", i, errs) t.Logf("%#v vs %#v", test.oldNode.ObjectMeta, test.node.ObjectMeta) @@ -2960,9 +3772,9 @@ func TestValidateServiceUpdate(t *testing.T) { oldSvc := makeValidService() newSvc := makeValidService() tc.tweakSvc(&oldSvc, &newSvc) - errs := ValidateServiceUpdate(&oldSvc, &newSvc) + errs := ValidateServiceUpdate(&newSvc, &oldSvc) if len(errs) != tc.numErrs { - t.Errorf("Unexpected error list for case %q: %v", tc.name, utilerrors.NewAggregate(errs)) + t.Errorf("Unexpected error list for case %q: %v", tc.name, errs.ToAggregate()) } } } @@ -2990,13 +3802,13 @@ func TestValidateResourceNames(t *testing.T) { {"kubernetes.io/will/not/work/", false}, } for k, item := range table { - err := validateResourceName(item.input, "sth") + err := validateResourceName(item.input, field.NewPath("field")) if len(err) != 0 && item.success { t.Errorf("expected no failure for input %q", item.input) } else if len(err) == 0 && !item.success { t.Errorf("expected failure for input %q", item.input) for i := range err { - detail := err[i].(*errors.ValidationError).Detail + detail := err[i].Detail if detail != "" && detail != qualifiedNameErrorMsg { t.Errorf("%d: expected error detail either empty or %s, got %s", k, qualifiedNameErrorMsg, detail) } @@ -3113,7 +3925,7 @@ func TestValidateLimitRange(t *testing.T) { }, }, }}, - "Default is not supported when limit type is Pod", + "may not be specified when `type` is 'Pod'", }, "default-request-limit-type-pod": { api.LimitRange{ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: "foo"}, Spec: api.LimitRangeSpec{ @@ -3126,7 +3938,7 @@ func TestValidateLimitRange(t *testing.T) { }, }, }}, - "DefaultRequest is not supported when limit type is Pod", + "may not be specified when `type` is 'Pod'", }, "min value 100m is greater than max value 10m": { api.LimitRange{ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: "foo"}, Spec: api.LimitRangeSpec{ @@ -3189,7 +4001,7 @@ func TestValidateLimitRange(t *testing.T) { }, }, }}, - "maxLimitRequestRatio 800m is less than 1", + "ratio 800m is less than 1", }, "invalid spec maxLimitRequestRatio greater than max/min": { api.LimitRange{ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: "foo"}, Spec: api.LimitRangeSpec{ @@ -3202,7 +4014,7 @@ func TestValidateLimitRange(t *testing.T) { }, }, }}, - "maxLimitRequestRatio 10 is greater than max/min = 4.000000", + "ratio 10 is greater than max/min = 4.000000", }, } @@ -3212,9 +4024,9 @@ func TestValidateLimitRange(t *testing.T) { t.Errorf("expected failure for %s", k) } for i := range errs { - detail := errs[i].(*errors.ValidationError).Detail + detail := errs[i].Detail if detail != v.D { - t.Errorf("%s: expected error detail either empty or %s, got %s", k, v.D, detail) + t.Errorf("[%s]: expected error detail either empty or %q, got %q", k, v.D, detail) } } } @@ -3317,13 +4129,8 @@ func TestValidateResourceQuota(t *testing.T) { t.Errorf("expected failure for %s", k) } for i := range errs { - field := errs[i].(*errors.ValidationError).Field - detail := errs[i].(*errors.ValidationError).Detail - if field != "metadata.name" && field != "metadata.namespace" && !api.IsStandardResourceName(field) { - t.Errorf("%s: missing prefix for: %v", k, field) - } - if detail != v.D { - t.Errorf("%s: expected error detail either empty or %s, got %s", k, v.D, detail) + if errs[i].Detail != v.D { + t.Errorf("[%s]: expected error detail either empty or %s, got %s", k, v.D, errs[i].Detail) } } } @@ -3683,25 +4490,128 @@ func TestValidateDockerConfigSecret(t *testing.T) { }, } } + validDockerSecret2 := func() api.Secret { + return api.Secret{ + ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "bar"}, + Type: api.SecretTypeDockerConfigJson, + Data: map[string][]byte{ + api.DockerConfigJsonKey: []byte(`{"auths":{"https://index.docker.io/v1/": {"auth": "Y2x1ZWRyb29sZXIwMDAxOnBhc3N3b3Jk","email": "fake@example.com"}}}`), + }, + } + } var ( - missingDockerConfigKey = validDockerSecret() - emptyDockerConfigKey = validDockerSecret() - invalidDockerConfigKey = validDockerSecret() + missingDockerConfigKey = validDockerSecret() + emptyDockerConfigKey = validDockerSecret() + invalidDockerConfigKey = validDockerSecret() + missingDockerConfigKey2 = validDockerSecret2() + emptyDockerConfigKey2 = validDockerSecret2() + invalidDockerConfigKey2 = validDockerSecret2() ) delete(missingDockerConfigKey.Data, api.DockerConfigKey) emptyDockerConfigKey.Data[api.DockerConfigKey] = []byte("") invalidDockerConfigKey.Data[api.DockerConfigKey] = []byte("bad") + delete(missingDockerConfigKey2.Data, api.DockerConfigJsonKey) + emptyDockerConfigKey2.Data[api.DockerConfigJsonKey] = []byte("") + invalidDockerConfigKey2.Data[api.DockerConfigJsonKey] = []byte("bad") tests := map[string]struct { secret api.Secret valid bool }{ - "valid": {validDockerSecret(), true}, - "missing dockercfg": {missingDockerConfigKey, false}, - "empty dockercfg": {emptyDockerConfigKey, false}, - "invalid dockercfg": {invalidDockerConfigKey, false}, + "valid dockercfg": {validDockerSecret(), true}, + "missing dockercfg": {missingDockerConfigKey, false}, + "empty dockercfg": {emptyDockerConfigKey, false}, + "invalid dockercfg": {invalidDockerConfigKey, false}, + "valid config.json": {validDockerSecret2(), true}, + "missing config.json": {missingDockerConfigKey2, false}, + "empty config.json": {emptyDockerConfigKey2, false}, + "invalid config.json": {invalidDockerConfigKey2, false}, + } + + for name, tc := range tests { + errs := ValidateSecret(&tc.secret) + if tc.valid && len(errs) > 0 { + t.Errorf("%v: Unexpected error: %v", name, errs) + } + if !tc.valid && len(errs) == 0 { + t.Errorf("%v: Unexpected non-error", name) + } + } +} + +func TestValidateBasicAuthSecret(t *testing.T) { + validBasicAuthSecret := func() api.Secret { + return api.Secret{ + ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "bar"}, + Type: api.SecretTypeBasicAuth, + Data: map[string][]byte{ + api.BasicAuthUsernameKey: []byte("username"), + api.BasicAuthPasswordKey: []byte("password"), + }, + } + } + + var ( + missingBasicAuthUsernamePasswordKeys = validBasicAuthSecret() + // invalidBasicAuthUsernamePasswordKey = validBasicAuthSecret() + // emptyBasicAuthUsernameKey = validBasicAuthSecret() + // emptyBasicAuthPasswordKey = validBasicAuthSecret() + ) + + delete(missingBasicAuthUsernamePasswordKeys.Data, api.BasicAuthUsernameKey) + delete(missingBasicAuthUsernamePasswordKeys.Data, api.BasicAuthPasswordKey) + + // invalidBasicAuthUsernamePasswordKey.Data[api.BasicAuthUsernameKey] = []byte("bad") + // invalidBasicAuthUsernamePasswordKey.Data[api.BasicAuthPasswordKey] = []byte("bad") + + // emptyBasicAuthUsernameKey.Data[api.BasicAuthUsernameKey] = []byte("") + // emptyBasicAuthPasswordKey.Data[api.BasicAuthPasswordKey] = []byte("") + + tests := map[string]struct { + secret api.Secret + valid bool + }{ + "valid": {validBasicAuthSecret(), true}, + "missing username and password": {missingBasicAuthUsernamePasswordKeys, false}, + // "invalid username and password": {invalidBasicAuthUsernamePasswordKey, false}, + // "empty username": {emptyBasicAuthUsernameKey, false}, + // "empty password": {emptyBasicAuthPasswordKey, false}, + } + + for name, tc := range tests { + errs := ValidateSecret(&tc.secret) + if tc.valid && len(errs) > 0 { + t.Errorf("%v: Unexpected error: %v", name, errs) + } + if !tc.valid && len(errs) == 0 { + t.Errorf("%v: Unexpected non-error", name) + } + } +} + +func TestValidateSSHAuthSecret(t *testing.T) { + validSSHAuthSecret := func() api.Secret { + return api.Secret{ + ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "bar"}, + Type: api.SecretTypeSSHAuth, + Data: map[string][]byte{ + api.SSHAuthPrivateKey: []byte("foo-bar-baz"), + }, + } + } + + missingSSHAuthPrivateKey := validSSHAuthSecret() + + delete(missingSSHAuthPrivateKey.Data, api.SSHAuthPrivateKey) + + tests := map[string]struct { + secret api.Secret + valid bool + }{ + "valid": {validSSHAuthSecret(), true}, + "missing private key": {missingSSHAuthPrivateKey, false}, } for name, tc := range tests { @@ -3752,7 +4662,7 @@ func TestValidateEndpoints(t *testing.T) { errorCases := map[string]struct { endpoints api.Endpoints - errorType fielderrors.ValidationErrorType + errorType field.ErrorType errorDetail string }{ "missing namespace": { @@ -3806,7 +4716,7 @@ func TestValidateEndpoints(t *testing.T) { }, }, errorType: "FieldValueInvalid", - errorDetail: "invalid IPv4 address", + errorDetail: "must be a valid IPv4 address", }, "Multiple ports, one without name": { endpoints: api.Endpoints{ @@ -3831,7 +4741,7 @@ func TestValidateEndpoints(t *testing.T) { }, }, errorType: "FieldValueInvalid", - errorDetail: portRangeErrorMsg, + errorDetail: PortRangeErrorMsg, }, "Invalid protocol": { endpoints: api.Endpoints{ @@ -3856,7 +4766,7 @@ func TestValidateEndpoints(t *testing.T) { }, }, errorType: "FieldValueInvalid", - errorDetail: "invalid IPv4 address", + errorDetail: "must be a valid IPv4 address", }, "Port missing number": { endpoints: api.Endpoints{ @@ -3869,7 +4779,7 @@ func TestValidateEndpoints(t *testing.T) { }, }, errorType: "FieldValueInvalid", - errorDetail: portRangeErrorMsg, + errorDetail: PortRangeErrorMsg, }, "Port missing protocol": { endpoints: api.Endpoints{ @@ -3925,8 +4835,54 @@ func TestValidateEndpoints(t *testing.T) { } for k, v := range errorCases { - if errs := ValidateEndpoints(&v.endpoints); len(errs) == 0 || errs[0].(*errors.ValidationError).Type != v.errorType || !strings.Contains(errs[0].(*errors.ValidationError).Detail, v.errorDetail) { - t.Errorf("Expected error type %s with detail %s for %s, got %v", v.errorType, v.errorDetail, k, errs) + if errs := ValidateEndpoints(&v.endpoints); len(errs) == 0 || errs[0].Type != v.errorType || !strings.Contains(errs[0].Detail, v.errorDetail) { + t.Errorf("[%s] Expected error type %s with detail %q, got %v", k, v.errorType, v.errorDetail, errs) + } + } +} + +func TestValidateTLSSecret(t *testing.T) { + successCases := map[string]api.Secret{ + "emtpy certificate chain": { + ObjectMeta: api.ObjectMeta{Name: "tls-cert", Namespace: "namespace"}, + Data: map[string][]byte{ + api.TLSCertKey: []byte("public key"), + api.TLSPrivateKeyKey: []byte("private key"), + }, + }, + } + for k, v := range successCases { + if errs := ValidateSecret(&v); len(errs) != 0 { + t.Errorf("Expected success for %s, got %v", k, errs) + } + } + errorCases := map[string]struct { + secrets api.Secret + errorType field.ErrorType + errorDetail string + }{ + "missing public key": { + secrets: api.Secret{ + ObjectMeta: api.ObjectMeta{Name: "tls-cert"}, + Data: map[string][]byte{ + api.TLSCertKey: []byte("public key"), + }, + }, + errorType: "FieldValueRequired", + }, + "missing private key": { + secrets: api.Secret{ + ObjectMeta: api.ObjectMeta{Name: "tls-cert"}, + Data: map[string][]byte{ + api.TLSCertKey: []byte("public key"), + }, + }, + errorType: "FieldValueRequired", + }, + } + for k, v := range errorCases { + if errs := ValidateSecret(&v.secrets); len(errs) == 0 || errs[0].Type != v.errorType || !strings.Contains(errs[0].Detail, v.errorDetail) { + t.Errorf("[%s] Expected error type %s with detail %q, got %v", k, v.errorType, v.errorDetail, errs) } } } @@ -3975,8 +4931,8 @@ func TestValidateSecurityContext(t *testing.T) { "no run as user": {noRunAsUser}, } for k, v := range successCases { - if errs := ValidateSecurityContext(v.sc); len(errs) != 0 { - t.Errorf("Expected success for %s, got %v", k, errs) + if errs := ValidateSecurityContext(v.sc, field.NewPath("field")); len(errs) != 0 { + t.Errorf("[%s] Expected success, got %v", k, errs) } } @@ -3990,23 +4946,23 @@ func TestValidateSecurityContext(t *testing.T) { errorCases := map[string]struct { sc *api.SecurityContext - errorType fielderrors.ValidationErrorType + errorType field.ErrorType errorDetail string }{ "request privileged when capabilities forbids": { sc: privRequestWithGlobalDeny, errorType: "FieldValueForbidden", - errorDetail: "", + errorDetail: "disallowed by policy", }, "negative RunAsUser": { sc: negativeRunAsUser, errorType: "FieldValueInvalid", - errorDetail: "runAsUser cannot be negative", + errorDetail: isNegativeErrorMsg, }, } for k, v := range errorCases { - if errs := ValidateSecurityContext(v.sc); len(errs) == 0 || errs[0].(*errors.ValidationError).Type != v.errorType || errs[0].(*errors.ValidationError).Detail != v.errorDetail { - t.Errorf("Expected error type %s with detail %s for %s, got %v", v.errorType, v.errorDetail, k, errs) + if errs := ValidateSecurityContext(v.sc, field.NewPath("field")); len(errs) == 0 || errs[0].Type != v.errorType || !strings.Contains(errs[0].Detail, v.errorDetail) { + t.Errorf("[%s] Expected error type %q with detail %q, got %v", k, v.errorType, v.errorDetail, errs) } } } @@ -4047,3 +5003,107 @@ func TestValidPodLogOptions(t *testing.T) { } } } + +func TestValidateConfigMap(t *testing.T) { + newConfigMap := func(name, namespace string, data map[string]string) api.ConfigMap { + return api.ConfigMap{ + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + Data: data, + } + } + + var ( + validConfigMap = newConfigMap("validname", "validns", map[string]string{"key": "value"}) + maxKeyLength = newConfigMap("validname", "validns", map[string]string{strings.Repeat("a", 253): "value"}) + + emptyName = newConfigMap("", "validns", nil) + invalidName = newConfigMap("NoUppercaseOrSpecialCharsLike=Equals", "validns", nil) + emptyNs = newConfigMap("validname", "", nil) + invalidNs = newConfigMap("validname", "NoUppercaseOrSpecialCharsLike=Equals", nil) + invalidKey = newConfigMap("validname", "validns", map[string]string{"a..b": "value"}) + leadingDotKey = newConfigMap("validname", "validns", map[string]string{".ab": "value"}) + dotKey = newConfigMap("validname", "validns", map[string]string{".": "value"}) + doubleDotKey = newConfigMap("validname", "validns", map[string]string{"..": "value"}) + overMaxKeyLength = newConfigMap("validname", "validns", map[string]string{strings.Repeat("a", 254): "value"}) + overMaxSize = newConfigMap("validname", "validns", map[string]string{"key": strings.Repeat("a", api.MaxSecretSize+1)}) + ) + + tests := map[string]struct { + cfg api.ConfigMap + isValid bool + }{ + "valid": {validConfigMap, true}, + "max key length": {maxKeyLength, true}, + "leading dot key": {leadingDotKey, true}, + "empty name": {emptyName, false}, + "invalid name": {invalidName, false}, + "invalid key": {invalidKey, false}, + "empty namespace": {emptyNs, false}, + "invalid namespace": {invalidNs, false}, + "dot key": {dotKey, false}, + "double dot key": {doubleDotKey, false}, + "over max key length": {overMaxKeyLength, false}, + "over max size": {overMaxSize, false}, + } + + for name, tc := range tests { + errs := ValidateConfigMap(&tc.cfg) + if tc.isValid && len(errs) > 0 { + t.Errorf("%v: unexpected error: %v", name, errs) + } + if !tc.isValid && len(errs) == 0 { + t.Errorf("%v: unexpected non-error", name) + } + } +} + +func TestValidateConfigMapUpdate(t *testing.T) { + newConfigMap := func(version, name, namespace string, data map[string]string) api.ConfigMap { + return api.ConfigMap{ + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: namespace, + ResourceVersion: version, + }, + Data: data, + } + } + + var ( + validConfigMap = newConfigMap("1", "validname", "validns", map[string]string{"key": "value"}) + noVersion = newConfigMap("", "validname", "validns", map[string]string{"key": "value"}) + ) + + cases := []struct { + name string + newCfg api.ConfigMap + oldCfg api.ConfigMap + isValid bool + }{ + { + name: "valid", + newCfg: validConfigMap, + oldCfg: validConfigMap, + isValid: true, + }, + { + name: "invalid", + newCfg: noVersion, + oldCfg: validConfigMap, + isValid: false, + }, + } + + for _, tc := range cases { + errs := ValidateConfigMapUpdate(&tc.newCfg, &tc.oldCfg) + if tc.isValid && len(errs) > 0 { + t.Errorf("%v: unexpected error: %v", tc.name, errs) + } + if !tc.isValid && len(errs) == 0 { + t.Errorf("%v: unexpected non-error", tc.name) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apimachinery/doc.go b/vendor/k8s.io/kubernetes/pkg/apimachinery/doc.go new file mode 100644 index 000000000..7c5a261b4 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apimachinery/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package apimachinery contains the generic API machinery code that +// is common to both server and clients. +// This package should never import specific API objects. +package apimachinery diff --git a/vendor/k8s.io/kubernetes/pkg/apimachinery/registered/registered.go b/vendor/k8s.io/kubernetes/pkg/apimachinery/registered/registered.go new file mode 100644 index 000000000..6baef8f91 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apimachinery/registered/registered.go @@ -0,0 +1,203 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package to keep track of API Versions that can be registered and are enabled in api.Scheme. +package registered + +import ( + "fmt" + "os" + "sort" + "strings" + + "github.com/golang/glog" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery" +) + +var ( + // registeredGroupVersions stores all API group versions for which RegisterGroup is called. + registeredVersions = map[unversioned.GroupVersion]struct{}{} + + // enabledVersions represents all enabled API versions. It should be a + // subset of registeredVersions. Please call EnableVersions() to add + // enabled versions. + enabledVersions = map[unversioned.GroupVersion]struct{}{} + + // map of group meta for all groups. + groupMetaMap = map[string]*apimachinery.GroupMeta{} + + // envRequestedVersions represents the versions requested via the + // KUBE_API_VERSIONS environment variable. The install package of each group + // checks this list before add their versions to the latest package and + // Scheme. + envRequestedVersions = map[unversioned.GroupVersion]struct{}{} +) + +func init() { + // Env var KUBE_API_VERSIONS is a comma separated list of API versions that + // should be registered in the scheme. + kubeAPIVersions := os.Getenv("KUBE_API_VERSIONS") + if len(kubeAPIVersions) != 0 { + for _, version := range strings.Split(kubeAPIVersions, ",") { + gv, err := unversioned.ParseGroupVersion(version) + if err != nil { + glog.Fatalf("invalid api version: %s in KUBE_API_VERSIONS: %s.", + version, os.Getenv("KUBE_API_VERSIONS")) + } + envRequestedVersions[gv] = struct{}{} + } + } +} + +// RegisterVersions adds the given group versions to the list of registered group versions. +func RegisterVersions(availableVersions []unversioned.GroupVersion) { + for _, v := range availableVersions { + registeredVersions[v] = struct{}{} + } +} + +// RegisterGroup adds the given group to the list of registered groups. +func RegisterGroup(groupMeta apimachinery.GroupMeta) error { + groupName := groupMeta.GroupVersion.Group + if _, found := groupMetaMap[groupName]; found { + return fmt.Errorf("group %v is already registered", groupMetaMap) + } + groupMetaMap[groupName] = &groupMeta + return nil +} + +// EnableVersions adds the versions for the given group to the list of enabled versions. +// Note that the caller should call RegisterGroup before calling this method. +// The caller of this function is responsible to add the versions to scheme and RESTMapper. +func EnableVersions(versions ...unversioned.GroupVersion) error { + var unregisteredVersions []unversioned.GroupVersion + for _, v := range versions { + if _, found := registeredVersions[v]; !found { + unregisteredVersions = append(unregisteredVersions, v) + } + enabledVersions[v] = struct{}{} + } + if len(unregisteredVersions) != 0 { + return fmt.Errorf("Please register versions before enabling them: %v", unregisteredVersions) + } + return nil +} + +// IsAllowedVersion returns if the version is allowed by the KUBE_API_VERSIONS +// environment variable. If the environment variable is empty, then it always +// returns true. +func IsAllowedVersion(v unversioned.GroupVersion) bool { + if len(envRequestedVersions) == 0 { + return true + } + _, found := envRequestedVersions[v] + return found +} + +// IsEnabledVersion returns if a version is enabled. +func IsEnabledVersion(v unversioned.GroupVersion) bool { + _, found := enabledVersions[v] + return found +} + +// EnabledVersions returns all enabled versions. Groups are randomly ordered, but versions within groups +// are priority order from best to worst +func EnabledVersions() []unversioned.GroupVersion { + ret := []unversioned.GroupVersion{} + for _, groupMeta := range groupMetaMap { + ret = append(ret, groupMeta.GroupVersions...) + } + return ret +} + +// EnabledVersionsForGroup returns all enabled versions for a group in order of best to worst +func EnabledVersionsForGroup(group string) []unversioned.GroupVersion { + groupMeta, ok := groupMetaMap[group] + if !ok { + return []unversioned.GroupVersion{} + } + + return append([]unversioned.GroupVersion{}, groupMeta.GroupVersions...) +} + +// Group returns the metadata of a group if the gruop is registered, otherwise +// an erorr is returned. +func Group(group string) (*apimachinery.GroupMeta, error) { + groupMeta, found := groupMetaMap[group] + if !found { + return nil, fmt.Errorf("group %v has not been registered", group) + } + groupMetaCopy := *groupMeta + return &groupMetaCopy, nil +} + +// IsRegistered takes a string and determines if it's one of the registered groups +func IsRegistered(group string) bool { + _, found := groupMetaMap[group] + return found +} + +// TODO: This is an expedient function, because we don't check if a Group is +// supported throughout the code base. We will abandon this function and +// checking the error returned by the Group() function. +func GroupOrDie(group string) *apimachinery.GroupMeta { + groupMeta, found := groupMetaMap[group] + if !found { + if group == "" { + panic("The legacy v1 API is not registered.") + } else { + panic(fmt.Sprintf("Group %s is not registered.", group)) + } + } + groupMetaCopy := *groupMeta + return &groupMetaCopy +} + +// AllPreferredGroupVersions returns the preferred versions of all registered +// groups in the form of "group1/version1,group2/version2,..." +func AllPreferredGroupVersions() string { + if len(groupMetaMap) == 0 { + return "" + } + var defaults []string + for _, groupMeta := range groupMetaMap { + defaults = append(defaults, groupMeta.GroupVersion.String()) + } + sort.Strings(defaults) + return strings.Join(defaults, ",") +} + +// ValidateEnvRequestedVersions returns a list of versions that are requested in +// the KUBE_API_VERSIONS environment variable, but not enabled. +func ValidateEnvRequestedVersions() []unversioned.GroupVersion { + var missingVersions []unversioned.GroupVersion + for v := range envRequestedVersions { + if _, found := enabledVersions[v]; !found { + missingVersions = append(missingVersions, v) + } + } + return missingVersions +} + +// Resets the state. +// Should not be used by anyone else than tests. +func reset() { + registeredVersions = map[unversioned.GroupVersion]struct{}{} + enabledVersions = map[unversioned.GroupVersion]struct{}{} + groupMetaMap = map[string]*apimachinery.GroupMeta{} + +} diff --git a/vendor/k8s.io/kubernetes/pkg/api/latest/latest_test.go b/vendor/k8s.io/kubernetes/pkg/apimachinery/registered/registered_test.go similarity index 57% rename from vendor/k8s.io/kubernetes/pkg/api/latest/latest_test.go rename to vendor/k8s.io/kubernetes/pkg/apimachinery/registered/registered_test.go index 4b3e0c91a..e7466fcc2 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/latest/latest_test.go +++ b/vendor/k8s.io/kubernetes/pkg/apimachinery/registered/registered_test.go @@ -14,46 +14,55 @@ See the License for the specific language governing permissions and limitations under the License. */ -package latest +package registered -import "testing" +import ( + "testing" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery" +) func TestAllPreferredGroupVersions(t *testing.T) { testCases := []struct { - groupMetaMap GroupMetaMap - expect string + groupMetas []apimachinery.GroupMeta + expect string }{ { - groupMetaMap: GroupMetaMap{ - "group1": &GroupMeta{ - GroupVersion: "group1/v1", + groupMetas: []apimachinery.GroupMeta{ + { + GroupVersion: unversioned.GroupVersion{"group1", "v1"}, }, - "group2": &GroupMeta{ - GroupVersion: "group2/v2", + { + GroupVersion: unversioned.GroupVersion{"group2", "v2"}, }, - "": &GroupMeta{ - GroupVersion: "v1", + { + GroupVersion: unversioned.GroupVersion{"", "v1"}, }, }, expect: "group1/v1,group2/v2,v1", }, { - groupMetaMap: GroupMetaMap{ - "": &GroupMeta{ - GroupVersion: "v1", + groupMetas: []apimachinery.GroupMeta{ + { + GroupVersion: unversioned.GroupVersion{"", "v1"}, }, }, expect: "v1", }, { - groupMetaMap: GroupMetaMap{}, - expect: "", + groupMetas: []apimachinery.GroupMeta{}, + expect: "", }, } for _, testCase := range testCases { - output := testCase.groupMetaMap.AllPreferredGroupVersions() + for _, groupMeta := range testCase.groupMetas { + RegisterGroup(groupMeta) + } + output := AllPreferredGroupVersions() if testCase.expect != output { t.Errorf("Error. expect: %s, got: %s", testCase.expect, output) } + reset() } } diff --git a/vendor/k8s.io/kubernetes/pkg/apimachinery/types.go b/vendor/k8s.io/kubernetes/pkg/apimachinery/types.go new file mode 100644 index 000000000..3e86921ce --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apimachinery/types.go @@ -0,0 +1,52 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apimachinery + +import ( + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +// GroupMeta stores the metadata of a group. +type GroupMeta struct { + // GroupVersion represents the preferred version of the group. + GroupVersion unversioned.GroupVersion + + // GroupVersions is Group + all versions in that group. + GroupVersions []unversioned.GroupVersion + + // Codec is the default codec for serializing output that should use + // the preferred version. Use this Codec when writing to + // disk, a data store that is not dynamically versioned, or in tests. + // This codec can decode any object that the schema is aware of. + Codec runtime.Codec + + // SelfLinker can set or get the SelfLink field of all API types. + // TODO: when versioning changes, make this part of each API definition. + // TODO(lavalamp): Combine SelfLinker & ResourceVersioner interfaces, force all uses + // to go through the InterfacesFor method below. + SelfLinker runtime.SelfLinker + + // RESTMapper provides the default mapping between REST paths and the objects declared in api.Scheme and all known + // versions. + RESTMapper meta.RESTMapper + + // InterfacesFor returns the default Codec and ResourceVersioner for a given version + // or an error if the version is not known. + InterfacesFor func(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/deep_copy_generated.go new file mode 100644 index 000000000..034a94d1e --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/deep_copy_generated.go @@ -0,0 +1,29 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh. + +package authorization + +import api "k8s.io/kubernetes/pkg/api" + +func init() { + err := api.Scheme.AddGeneratedDeepCopyFuncs() + if err != nil { + // if one of the deep copy functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/install/install.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/install/install.go new file mode 100644 index 000000000..bf8814dd5 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/install/install.go @@ -0,0 +1,128 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package install installs the experimental API group, making it available as +// an option to all of the API encoding/decoding machinery. +package install + +import ( + "fmt" + + "github.com/golang/glog" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/authorization" + "k8s.io/kubernetes/pkg/apis/authorization/v1beta1" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/sets" +) + +const importPrefix = "k8s.io/kubernetes/pkg/apis/authorization" + +var accessor = meta.NewAccessor() + +// availableVersions lists all known external versions for this group from most preferred to least preferred +var availableVersions = []unversioned.GroupVersion{v1beta1.SchemeGroupVersion} + +func init() { + registered.RegisterVersions(availableVersions) + externalVersions := []unversioned.GroupVersion{} + for _, v := range availableVersions { + if registered.IsAllowedVersion(v) { + externalVersions = append(externalVersions, v) + } + } + if len(externalVersions) == 0 { + glog.V(4).Infof("No version is registered for group %v", authorization.GroupName) + return + } + + if err := registered.EnableVersions(externalVersions...); err != nil { + glog.V(4).Infof("%v", err) + return + } + if err := enableVersions(externalVersions); err != nil { + glog.V(4).Infof("%v", err) + return + } +} + +// TODO: enableVersions should be centralized rather than spread in each API +// group. +// We can combine registered.RegisterVersions, registered.EnableVersions and +// registered.RegisterGroup once we have moved enableVersions there. +func enableVersions(externalVersions []unversioned.GroupVersion) error { + addVersionsToScheme(externalVersions...) + preferredExternalVersion := externalVersions[0] + + groupMeta := apimachinery.GroupMeta{ + GroupVersion: preferredExternalVersion, + GroupVersions: externalVersions, + RESTMapper: newRESTMapper(externalVersions), + SelfLinker: runtime.SelfLinker(accessor), + InterfacesFor: interfacesFor, + } + + if err := registered.RegisterGroup(groupMeta); err != nil { + return err + } + api.RegisterRESTMapper(groupMeta.RESTMapper) + return nil +} + +func addVersionsToScheme(externalVersions ...unversioned.GroupVersion) { + // add the internal version to Scheme + authorization.AddToScheme(api.Scheme) + // add the enabled external versions to Scheme + for _, v := range externalVersions { + if !registered.IsEnabledVersion(v) { + glog.Errorf("Version %s is not enabled, so it will not be added to the Scheme.", v) + continue + } + switch v { + case v1beta1.SchemeGroupVersion: + v1beta1.AddToScheme(api.Scheme) + } + } +} + +func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { + worstToBestGroupVersions := []unversioned.GroupVersion{} + for i := len(externalVersions) - 1; i >= 0; i-- { + worstToBestGroupVersions = append(worstToBestGroupVersions, externalVersions[i]) + } + + rootScoped := sets.NewString("SubjectAccessReview", "SelfSubjectAccessReview") + ignoredKinds := sets.NewString() + return api.NewDefaultRESTMapper(worstToBestGroupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) +} + +func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { + switch version { + case v1beta1.SchemeGroupVersion: + return &meta.VersionInterfaces{ + ObjectConvertor: api.Scheme, + MetadataAccessor: accessor, + }, nil + default: + g, _ := registered.Group(authorization.GroupName) + return nil, fmt.Errorf("unsupported storage version: %s (valid: %v)", version, g.GroupVersions) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/register.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/register.go new file mode 100644 index 000000000..b28652613 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/register.go @@ -0,0 +1,54 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package authorization + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +// GroupName is the group name use in this package +const GroupName = "authorization.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) unversioned.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns back a Group qualified GroupResource +func Resource(resource string) unversioned.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func AddToScheme(scheme *runtime.Scheme) { + addKnownTypes(scheme) +} + +func addKnownTypes(scheme *runtime.Scheme) { + scheme.AddKnownTypes(SchemeGroupVersion, + &SelfSubjectAccessReview{}, + &SubjectAccessReview{}, + &LocalSubjectAccessReview{}, + ) +} + +func (obj *LocalSubjectAccessReview) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *SubjectAccessReview) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *SelfSubjectAccessReview) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/types.generated.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/types.generated.go new file mode 100644 index 000000000..9f00bf014 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/types.generated.go @@ -0,0 +1,2281 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED BY codecgen. +// ************************************************************ + +package authorization + +import ( + "errors" + "fmt" + codec1978 "github.com/ugorji/go/codec" + pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned" + "reflect" + "runtime" +) + +const ( + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- + codecSelferValueTypeArray1234 = 10 + codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 +) + +var ( + codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits()) + codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`) +) + +type codecSelfer1234 struct{} + +func init() { + if codec1978.GenVersion != 5 { + _, file, _, _ := runtime.Caller(0) + err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", + 5, codec1978.GenVersion, file) + panic(err) + } + if false { // reference the types, but skip this branch at build/run time + var v0 pkg1_unversioned.TypeMeta + _ = v0 + } +} + +func (x *SubjectAccessReview) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.Spec + yy4.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Spec + yy6.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy9 := &x.Status + yy9.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Status + yy11.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SubjectAccessReview) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SubjectAccessReview) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "Spec": + if r.TryDecodeAsNil() { + x.Spec = SubjectAccessReviewSpec{} + } else { + yyv4 := &x.Spec + yyv4.CodecDecodeSelf(d) + } + case "Status": + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv5 := &x.Status + yyv5.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SubjectAccessReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = SubjectAccessReviewSpec{} + } else { + yyv9 := &x.Spec + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv10 := &x.Status + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SelfSubjectAccessReview) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.Spec + yy4.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Spec + yy6.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy9 := &x.Status + yy9.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Status + yy11.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SelfSubjectAccessReview) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SelfSubjectAccessReview) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "Spec": + if r.TryDecodeAsNil() { + x.Spec = SelfSubjectAccessReviewSpec{} + } else { + yyv4 := &x.Spec + yyv4.CodecDecodeSelf(d) + } + case "Status": + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv5 := &x.Status + yyv5.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SelfSubjectAccessReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = SelfSubjectAccessReviewSpec{} + } else { + yyv9 := &x.Spec + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv10 := &x.Status + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *LocalSubjectAccessReview) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.Spec + yy4.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Spec + yy6.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy9 := &x.Status + yy9.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Status + yy11.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *LocalSubjectAccessReview) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *LocalSubjectAccessReview) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "Spec": + if r.TryDecodeAsNil() { + x.Spec = SubjectAccessReviewSpec{} + } else { + yyv4 := &x.Spec + yyv4.CodecDecodeSelf(d) + } + case "Status": + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv5 := &x.Status + yyv5.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *LocalSubjectAccessReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = SubjectAccessReviewSpec{} + } else { + yyv9 := &x.Spec + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv10 := &x.Status + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ResourceAttributes) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(7) + } else { + yynn2 = 7 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Namespace")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Verb)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Verb")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Verb)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Group)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Group")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Group)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Version)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Version")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Version)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Resource)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Resource")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Resource)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Subresource)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Subresource")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Subresource)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ResourceAttributes) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ResourceAttributes) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "Namespace": + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + case "Verb": + if r.TryDecodeAsNil() { + x.Verb = "" + } else { + x.Verb = string(r.DecodeString()) + } + case "Group": + if r.TryDecodeAsNil() { + x.Group = "" + } else { + x.Group = string(r.DecodeString()) + } + case "Version": + if r.TryDecodeAsNil() { + x.Version = "" + } else { + x.Version = string(r.DecodeString()) + } + case "Resource": + if r.TryDecodeAsNil() { + x.Resource = "" + } else { + x.Resource = string(r.DecodeString()) + } + case "Subresource": + if r.TryDecodeAsNil() { + x.Subresource = "" + } else { + x.Subresource = string(r.DecodeString()) + } + case "Name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ResourceAttributes) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Verb = "" + } else { + x.Verb = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Group = "" + } else { + x.Group = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Version = "" + } else { + x.Version = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Resource = "" + } else { + x.Resource = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Subresource = "" + } else { + x.Subresource = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + for { + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *NonResourceAttributes) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Path")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Verb)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Verb")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Verb)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NonResourceAttributes) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NonResourceAttributes) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "Path": + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + case "Verb": + if r.TryDecodeAsNil() { + x.Verb = "" + } else { + x.Verb = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NonResourceAttributes) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Verb = "" + } else { + x.Verb = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SubjectAccessReviewSpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 4 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.ResourceAttributes == nil { + r.EncodeNil() + } else { + x.ResourceAttributes.CodecEncodeSelf(e) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("ResourceAttributes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ResourceAttributes == nil { + r.EncodeNil() + } else { + x.ResourceAttributes.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.NonResourceAttributes == nil { + r.EncodeNil() + } else { + x.NonResourceAttributes.CodecEncodeSelf(e) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("NonResourceAttributes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NonResourceAttributes == nil { + r.EncodeNil() + } else { + x.NonResourceAttributes.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.User)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("User")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.User)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Groups == nil { + r.EncodeNil() + } else { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + z.F.EncSliceStringV(x.Groups, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Groups")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Groups == nil { + r.EncodeNil() + } else { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + z.F.EncSliceStringV(x.Groups, false, e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SubjectAccessReviewSpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SubjectAccessReviewSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "ResourceAttributes": + if r.TryDecodeAsNil() { + if x.ResourceAttributes != nil { + x.ResourceAttributes = nil + } + } else { + if x.ResourceAttributes == nil { + x.ResourceAttributes = new(ResourceAttributes) + } + x.ResourceAttributes.CodecDecodeSelf(d) + } + case "NonResourceAttributes": + if r.TryDecodeAsNil() { + if x.NonResourceAttributes != nil { + x.NonResourceAttributes = nil + } + } else { + if x.NonResourceAttributes == nil { + x.NonResourceAttributes = new(NonResourceAttributes) + } + x.NonResourceAttributes.CodecDecodeSelf(d) + } + case "User": + if r.TryDecodeAsNil() { + x.User = "" + } else { + x.User = string(r.DecodeString()) + } + case "Groups": + if r.TryDecodeAsNil() { + x.Groups = nil + } else { + yyv7 := &x.Groups + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + z.F.DecSliceStringX(yyv7, false, d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SubjectAccessReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ResourceAttributes != nil { + x.ResourceAttributes = nil + } + } else { + if x.ResourceAttributes == nil { + x.ResourceAttributes = new(ResourceAttributes) + } + x.ResourceAttributes.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.NonResourceAttributes != nil { + x.NonResourceAttributes = nil + } + } else { + if x.NonResourceAttributes == nil { + x.NonResourceAttributes = new(NonResourceAttributes) + } + x.NonResourceAttributes.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.User = "" + } else { + x.User = string(r.DecodeString()) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Groups = nil + } else { + yyv13 := &x.Groups + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + z.F.DecSliceStringX(yyv13, false, d) + } + } + for { + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SelfSubjectAccessReviewSpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.ResourceAttributes == nil { + r.EncodeNil() + } else { + x.ResourceAttributes.CodecEncodeSelf(e) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("ResourceAttributes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ResourceAttributes == nil { + r.EncodeNil() + } else { + x.ResourceAttributes.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.NonResourceAttributes == nil { + r.EncodeNil() + } else { + x.NonResourceAttributes.CodecEncodeSelf(e) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("NonResourceAttributes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NonResourceAttributes == nil { + r.EncodeNil() + } else { + x.NonResourceAttributes.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SelfSubjectAccessReviewSpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SelfSubjectAccessReviewSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "ResourceAttributes": + if r.TryDecodeAsNil() { + if x.ResourceAttributes != nil { + x.ResourceAttributes = nil + } + } else { + if x.ResourceAttributes == nil { + x.ResourceAttributes = new(ResourceAttributes) + } + x.ResourceAttributes.CodecDecodeSelf(d) + } + case "NonResourceAttributes": + if r.TryDecodeAsNil() { + if x.NonResourceAttributes != nil { + x.NonResourceAttributes = nil + } + } else { + if x.NonResourceAttributes == nil { + x.NonResourceAttributes = new(NonResourceAttributes) + } + x.NonResourceAttributes.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SelfSubjectAccessReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ResourceAttributes != nil { + x.ResourceAttributes = nil + } + } else { + if x.ResourceAttributes == nil { + x.ResourceAttributes = new(ResourceAttributes) + } + x.ResourceAttributes.CodecDecodeSelf(d) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.NonResourceAttributes != nil { + x.NonResourceAttributes = nil + } + } else { + if x.NonResourceAttributes == nil { + x.NonResourceAttributes = new(NonResourceAttributes) + } + x.NonResourceAttributes.CodecDecodeSelf(d) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SubjectAccessReviewStatus) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Allowed)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Allowed")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Allowed)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Reason")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SubjectAccessReviewStatus) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SubjectAccessReviewStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "Allowed": + if r.TryDecodeAsNil() { + x.Allowed = false + } else { + x.Allowed = bool(r.DecodeBool()) + } + case "Reason": + if r.TryDecodeAsNil() { + x.Reason = "" + } else { + x.Reason = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SubjectAccessReviewStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Allowed = false + } else { + x.Allowed = bool(r.DecodeBool()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Reason = "" + } else { + x.Reason = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/types.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/types.go new file mode 100644 index 000000000..5feb0e546 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/types.go @@ -0,0 +1,121 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package authorization + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" +) + +// SubjectAccessReview checks whether or not a user or group can perform an action. Not filling in a +// spec.namespace means "in all namespaces". +type SubjectAccessReview struct { + unversioned.TypeMeta + + // Spec holds information about the request being evaluated + Spec SubjectAccessReviewSpec + + // Status is filled in by the server and indicates whether the request is allowed or not + Status SubjectAccessReviewStatus +} + +// SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a +// spec.namespace means "in all namespaces". Self is a special case, because users should always be able +// to check whether they can perform an action +type SelfSubjectAccessReview struct { + unversioned.TypeMeta + + // Spec holds information about the request being evaluated. + Spec SelfSubjectAccessReviewSpec + + // Status is filled in by the server and indicates whether the request is allowed or not + Status SubjectAccessReviewStatus +} + +// LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. +// Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions +// checking. +type LocalSubjectAccessReview struct { + unversioned.TypeMeta + + // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace + // you made the request against. If empty, it is defaulted. + Spec SubjectAccessReviewSpec + + // Status is filled in by the server and indicates whether the request is allowed or not + Status SubjectAccessReviewStatus +} + +// ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface +type ResourceAttributes struct { + // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces + // "" (empty) is defaulted for LocalSubjectAccessReviews + // "" (empty) is empty for cluster-scoped resources + // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview + Namespace string + // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. + Verb string + // Group is the API Group of the Resource. "*" means all. + Group string + // Version is the API Version of the Resource. "*" means all. + Version string + // Resource is one of the existing resource types. "*" means all. + Resource string + // Subresource is one of the existing resource types. "" means none. + Subresource string + // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. + Name string +} + +// NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface +type NonResourceAttributes struct { + // Path is the URL path of the request + Path string + // Verb is the standard HTTP verb + Verb string +} + +// SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAttributes +// and NonResourceAttributes must be set +type SubjectAccessReviewSpec struct { + // ResourceAttributes describes information for a resource access request + ResourceAttributes *ResourceAttributes + // NonResourceAttributes describes information for a non-resource access request + NonResourceAttributes *NonResourceAttributes + + // User is the user you're testing for. + // If you specify "User" but not "Group", then is it interpreted as "What if User were not a member of any groups + User string + // Groups is the groups you're testing for. + Groups []string +} + +// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAttributes +// and NonResourceAttributes must be set +type SelfSubjectAccessReviewSpec struct { + // ResourceAttributes describes information for a resource access request + ResourceAttributes *ResourceAttributes + // NonResourceAttributes describes information for a non-resource access request + NonResourceAttributes *NonResourceAttributes +} + +// SubjectAccessReviewStatus +type SubjectAccessReviewStatus struct { + // Allowed is required. True if the action would be allowed, false otherwise. + Allowed bool + // Reason is optional. It indicates why a request was allowed or denied. + Reason string +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/conversion.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/conversion.go new file mode 100644 index 000000000..0b45ed5fb --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/conversion.go @@ -0,0 +1,30 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "k8s.io/kubernetes/pkg/runtime" +) + +func addConversionFuncs(scheme *runtime.Scheme) { + // Add non-generated conversion functions + err := scheme.AddConversionFuncs() + if err != nil { + // If one of the conversion functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/conversion_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/conversion_generated.go new file mode 100644 index 000000000..2a0daee20 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/conversion_generated.go @@ -0,0 +1,29 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-conversions.sh + +package v1beta1 + +import api "k8s.io/kubernetes/pkg/api" + +func init() { + err := api.Scheme.AddGeneratedConversionFuncs() + if err != nil { + // If one of the conversion functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/deep_copy_generated.go new file mode 100644 index 000000000..ccf024c8b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/deep_copy_generated.go @@ -0,0 +1,29 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh. + +package v1beta1 + +import api "k8s.io/kubernetes/pkg/api" + +func init() { + err := api.Scheme.AddGeneratedDeepCopyFuncs() + if err != nil { + // if one of the deep copy functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/defaults.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/defaults.go new file mode 100644 index 000000000..340f80755 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/defaults.go @@ -0,0 +1,25 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "k8s.io/kubernetes/pkg/runtime" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) { + scheme.AddDefaultingFuncs() +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/register.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/register.go new file mode 100644 index 000000000..d9e33ed5a --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/register.go @@ -0,0 +1,48 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +// GroupName is the group name use in this package +const GroupName = "authorization.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: "v1beta1"} + +func AddToScheme(scheme *runtime.Scheme) { + // Add the API to Scheme. + addKnownTypes(scheme) + addDefaultingFuncs(scheme) + addConversionFuncs(scheme) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) { + scheme.AddKnownTypes(SchemeGroupVersion, + &SelfSubjectAccessReview{}, + &SubjectAccessReview{}, + &LocalSubjectAccessReview{}, + ) +} + +func (obj *LocalSubjectAccessReview) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *SubjectAccessReview) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *SelfSubjectAccessReview) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types.generated.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types.generated.go new file mode 100644 index 000000000..906fcb577 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types.generated.go @@ -0,0 +1,2414 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED BY codecgen. +// ************************************************************ + +package v1beta1 + +import ( + "errors" + "fmt" + codec1978 "github.com/ugorji/go/codec" + pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned" + "reflect" + "runtime" +) + +const ( + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- + codecSelferValueTypeArray1234 = 10 + codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 +) + +var ( + codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits()) + codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`) +) + +type codecSelfer1234 struct{} + +func init() { + if codec1978.GenVersion != 5 { + _, file, _, _ := runtime.Caller(0) + err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", + 5, codec1978.GenVersion, file) + panic(err) + } + if false { // reference the types, but skip this branch at build/run time + var v0 pkg1_unversioned.TypeMeta + _ = v0 + } +} + +func (x *SubjectAccessReview) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.Spec + yy4.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Spec + yy6.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Status + yy9.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Status + yy11.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SubjectAccessReview) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SubjectAccessReview) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "spec": + if r.TryDecodeAsNil() { + x.Spec = SubjectAccessReviewSpec{} + } else { + yyv4 := &x.Spec + yyv4.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv5 := &x.Status + yyv5.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SubjectAccessReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = SubjectAccessReviewSpec{} + } else { + yyv9 := &x.Spec + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv10 := &x.Status + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SelfSubjectAccessReview) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.Spec + yy4.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Spec + yy6.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Status + yy9.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Status + yy11.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SelfSubjectAccessReview) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SelfSubjectAccessReview) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "spec": + if r.TryDecodeAsNil() { + x.Spec = SelfSubjectAccessReviewSpec{} + } else { + yyv4 := &x.Spec + yyv4.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv5 := &x.Status + yyv5.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SelfSubjectAccessReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = SelfSubjectAccessReviewSpec{} + } else { + yyv9 := &x.Spec + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv10 := &x.Status + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *LocalSubjectAccessReview) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.Spec + yy4.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.Spec + yy6.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Status + yy9.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Status + yy11.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *LocalSubjectAccessReview) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *LocalSubjectAccessReview) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "spec": + if r.TryDecodeAsNil() { + x.Spec = SubjectAccessReviewSpec{} + } else { + yyv4 := &x.Spec + yyv4.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv5 := &x.Status + yyv5.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *LocalSubjectAccessReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = SubjectAccessReviewSpec{} + } else { + yyv9 := &x.Spec + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = SubjectAccessReviewStatus{} + } else { + yyv10 := &x.Status + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ResourceAttributes) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Namespace != "" + yyq2[1] = x.Verb != "" + yyq2[2] = x.Group != "" + yyq2[3] = x.Version != "" + yyq2[4] = x.Resource != "" + yyq2[5] = x.Subresource != "" + yyq2[6] = x.Name != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(7) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("namespace")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Verb)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("verb")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Verb)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Group)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("group")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Group)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Version)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("version")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Version)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Resource)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resource")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Resource)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Subresource)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("subresource")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Subresource)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ResourceAttributes) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ResourceAttributes) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "namespace": + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + case "verb": + if r.TryDecodeAsNil() { + x.Verb = "" + } else { + x.Verb = string(r.DecodeString()) + } + case "group": + if r.TryDecodeAsNil() { + x.Group = "" + } else { + x.Group = string(r.DecodeString()) + } + case "version": + if r.TryDecodeAsNil() { + x.Version = "" + } else { + x.Version = string(r.DecodeString()) + } + case "resource": + if r.TryDecodeAsNil() { + x.Resource = "" + } else { + x.Resource = string(r.DecodeString()) + } + case "subresource": + if r.TryDecodeAsNil() { + x.Subresource = "" + } else { + x.Subresource = string(r.DecodeString()) + } + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ResourceAttributes) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + x.Namespace = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Verb = "" + } else { + x.Verb = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Group = "" + } else { + x.Group = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Version = "" + } else { + x.Version = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Resource = "" + } else { + x.Resource = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Subresource = "" + } else { + x.Subresource = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + for { + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *NonResourceAttributes) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Path != "" + yyq2[1] = x.Verb != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("path")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Path)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Verb)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("verb")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Verb)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *NonResourceAttributes) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *NonResourceAttributes) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "path": + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + case "verb": + if r.TryDecodeAsNil() { + x.Verb = "" + } else { + x.Verb = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *NonResourceAttributes) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Path = "" + } else { + x.Path = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Verb = "" + } else { + x.Verb = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SubjectAccessReviewSpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.ResourceAttributes != nil + yyq2[1] = x.NonResourceAttributes != nil + yyq2[2] = x.User != "" + yyq2[3] = len(x.Groups) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.ResourceAttributes == nil { + r.EncodeNil() + } else { + x.ResourceAttributes.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resourceAttributes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ResourceAttributes == nil { + r.EncodeNil() + } else { + x.ResourceAttributes.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.NonResourceAttributes == nil { + r.EncodeNil() + } else { + x.NonResourceAttributes.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nonResourceAttributes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NonResourceAttributes == nil { + r.EncodeNil() + } else { + x.NonResourceAttributes.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.User)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("user")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.User)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + if x.Groups == nil { + r.EncodeNil() + } else { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + z.F.EncSliceStringV(x.Groups, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("group")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Groups == nil { + r.EncodeNil() + } else { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + z.F.EncSliceStringV(x.Groups, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SubjectAccessReviewSpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SubjectAccessReviewSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "resourceAttributes": + if r.TryDecodeAsNil() { + if x.ResourceAttributes != nil { + x.ResourceAttributes = nil + } + } else { + if x.ResourceAttributes == nil { + x.ResourceAttributes = new(ResourceAttributes) + } + x.ResourceAttributes.CodecDecodeSelf(d) + } + case "nonResourceAttributes": + if r.TryDecodeAsNil() { + if x.NonResourceAttributes != nil { + x.NonResourceAttributes = nil + } + } else { + if x.NonResourceAttributes == nil { + x.NonResourceAttributes = new(NonResourceAttributes) + } + x.NonResourceAttributes.CodecDecodeSelf(d) + } + case "user": + if r.TryDecodeAsNil() { + x.User = "" + } else { + x.User = string(r.DecodeString()) + } + case "group": + if r.TryDecodeAsNil() { + x.Groups = nil + } else { + yyv7 := &x.Groups + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + z.F.DecSliceStringX(yyv7, false, d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SubjectAccessReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ResourceAttributes != nil { + x.ResourceAttributes = nil + } + } else { + if x.ResourceAttributes == nil { + x.ResourceAttributes = new(ResourceAttributes) + } + x.ResourceAttributes.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.NonResourceAttributes != nil { + x.NonResourceAttributes = nil + } + } else { + if x.NonResourceAttributes == nil { + x.NonResourceAttributes = new(NonResourceAttributes) + } + x.NonResourceAttributes.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.User = "" + } else { + x.User = string(r.DecodeString()) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Groups = nil + } else { + yyv13 := &x.Groups + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + z.F.DecSliceStringX(yyv13, false, d) + } + } + for { + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SelfSubjectAccessReviewSpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.ResourceAttributes != nil + yyq2[1] = x.NonResourceAttributes != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.ResourceAttributes == nil { + r.EncodeNil() + } else { + x.ResourceAttributes.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resourceAttributes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ResourceAttributes == nil { + r.EncodeNil() + } else { + x.ResourceAttributes.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.NonResourceAttributes == nil { + r.EncodeNil() + } else { + x.NonResourceAttributes.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nonResourceAttributes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NonResourceAttributes == nil { + r.EncodeNil() + } else { + x.NonResourceAttributes.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SelfSubjectAccessReviewSpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SelfSubjectAccessReviewSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "resourceAttributes": + if r.TryDecodeAsNil() { + if x.ResourceAttributes != nil { + x.ResourceAttributes = nil + } + } else { + if x.ResourceAttributes == nil { + x.ResourceAttributes = new(ResourceAttributes) + } + x.ResourceAttributes.CodecDecodeSelf(d) + } + case "nonResourceAttributes": + if r.TryDecodeAsNil() { + if x.NonResourceAttributes != nil { + x.NonResourceAttributes = nil + } + } else { + if x.NonResourceAttributes == nil { + x.NonResourceAttributes = new(NonResourceAttributes) + } + x.NonResourceAttributes.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SelfSubjectAccessReviewSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ResourceAttributes != nil { + x.ResourceAttributes = nil + } + } else { + if x.ResourceAttributes == nil { + x.ResourceAttributes = new(ResourceAttributes) + } + x.ResourceAttributes.CodecDecodeSelf(d) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.NonResourceAttributes != nil { + x.NonResourceAttributes = nil + } + } else { + if x.NonResourceAttributes == nil { + x.NonResourceAttributes = new(NonResourceAttributes) + } + x.NonResourceAttributes.CodecDecodeSelf(d) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SubjectAccessReviewStatus) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Reason != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Allowed)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("allowed")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Allowed)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("reason")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SubjectAccessReviewStatus) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SubjectAccessReviewStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "allowed": + if r.TryDecodeAsNil() { + x.Allowed = false + } else { + x.Allowed = bool(r.DecodeBool()) + } + case "reason": + if r.TryDecodeAsNil() { + x.Reason = "" + } else { + x.Reason = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SubjectAccessReviewStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Allowed = false + } else { + x.Allowed = bool(r.DecodeBool()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Reason = "" + } else { + x.Reason = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types.go new file mode 100644 index 000000000..0a8cb69a7 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types.go @@ -0,0 +1,120 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" +) + +// SubjectAccessReview checks whether or not a user or group can perform an action. +type SubjectAccessReview struct { + unversioned.TypeMeta `json:",inline"` + + // Spec holds information about the request being evaluated + Spec SubjectAccessReviewSpec `json:"spec"` + + // Status is filled in by the server and indicates whether the request is allowed or not + Status SubjectAccessReviewStatus `json:"status,omitempty"` +} + +// SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a +// spec.namespace means "in all namespaces". Self is a special case, because users should always be able +// to check whether they can perform an action +type SelfSubjectAccessReview struct { + unversioned.TypeMeta `json:",inline"` + + // Spec holds information about the request being evaluated. user and groups must be empty + Spec SelfSubjectAccessReviewSpec `json:"spec"` + + // Status is filled in by the server and indicates whether the request is allowed or not + Status SubjectAccessReviewStatus `json:"status,omitempty"` +} + +// LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. +// Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions +// checking. +type LocalSubjectAccessReview struct { + unversioned.TypeMeta `json:",inline"` + + // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace + // you made the request against. If empty, it is defaulted. + Spec SubjectAccessReviewSpec `json:"spec"` + + // Status is filled in by the server and indicates whether the request is allowed or not + Status SubjectAccessReviewStatus `json:"status,omitempty"` +} + +// ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface +type ResourceAttributes struct { + // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces + // "" (empty) is defaulted for LocalSubjectAccessReviews + // "" (empty) is empty for cluster-scoped resources + // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview + Namespace string `json:"namespace,omitempty"` + // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. + Verb string `json:"verb,omitempty"` + // Group is the API Group of the Resource. "*" means all. + Group string `json:"group,omitempty"` + // Version is the API Version of the Resource. "*" means all. + Version string `json:"version,omitempty"` + // Resource is one of the existing resource types. "*" means all. + Resource string `json:"resource,omitempty"` + // Subresource is one of the existing resource types. "" means none. + Subresource string `json:"subresource,omitempty"` + // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. + Name string `json:"name,omitempty"` +} + +// NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface +type NonResourceAttributes struct { + // Path is the URL path of the request + Path string `json:"path,omitempty"` + // Verb is the standard HTTP verb + Verb string `json:"verb,omitempty"` +} + +// SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes +// and NonResourceAuthorizationAttributes must be set +type SubjectAccessReviewSpec struct { + // ResourceAuthorizationAttributes describes information for a resource access request + ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty"` + // NonResourceAttributes describes information for a non-resource access request + NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty"` + + // User is the user you're testing for. + // If you specify "User" but not "Group", then is it interpreted as "What if User were not a member of any groups + User string `json:"user,omitempty"` + // Groups is the groups you're testing for. + Groups []string `json:"group,omitempty"` +} + +// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes +// and NonResourceAuthorizationAttributes must be set +type SelfSubjectAccessReviewSpec struct { + // ResourceAuthorizationAttributes describes information for a resource access request + ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty"` + // NonResourceAttributes describes information for a non-resource access request + NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty"` +} + +// SubjectAccessReviewStatus +type SubjectAccessReviewStatus struct { + // Allowed is required. True if the action would be allowed, false otherwise. + Allowed bool `json:"allowed"` + // Reason is optional. It indicates why a request was allowed or denied. + Reason string `json:"reason,omitempty"` +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types_swagger_doc_generated.go new file mode 100644 index 000000000..681e962ed --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/v1beta1/types_swagger_doc_generated.go @@ -0,0 +1,117 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +// This file contains a collection of methods that can be used from go-resful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-generated-swagger-docs.sh + +// AUTO-GENERATED FUNCTIONS START HERE +var map_LocalSubjectAccessReview = map[string]string{ + "": "LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking.", + "spec": "Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted.", + "status": "Status is filled in by the server and indicates whether the request is allowed or not", +} + +func (LocalSubjectAccessReview) SwaggerDoc() map[string]string { + return map_LocalSubjectAccessReview +} + +var map_NonResourceAttributes = map[string]string{ + "": "NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface", + "path": "Path is the URL path of the request", + "verb": "Verb is the standard HTTP verb", +} + +func (NonResourceAttributes) SwaggerDoc() map[string]string { + return map_NonResourceAttributes +} + +var map_ResourceAttributes = map[string]string{ + "": "ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface", + "namespace": "Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview", + "verb": "Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", + "group": "Group is the API Group of the Resource. \"*\" means all.", + "version": "Version is the API Version of the Resource. \"*\" means all.", + "resource": "Resource is one of the existing resource types. \"*\" means all.", + "subresource": "Subresource is one of the existing resource types. \"\" means none.", + "name": "Name is the name of the resource being requested for a \"get\" or deleted for a \"delete\". \"\" (empty) means all.", +} + +func (ResourceAttributes) SwaggerDoc() map[string]string { + return map_ResourceAttributes +} + +var map_SelfSubjectAccessReview = map[string]string{ + "": "SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action", + "spec": "Spec holds information about the request being evaluated. user and groups must be empty", + "status": "Status is filled in by the server and indicates whether the request is allowed or not", +} + +func (SelfSubjectAccessReview) SwaggerDoc() map[string]string { + return map_SelfSubjectAccessReview +} + +var map_SelfSubjectAccessReviewSpec = map[string]string{ + "": "SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", + "resourceAttributes": "ResourceAuthorizationAttributes describes information for a resource access request", + "nonResourceAttributes": "NonResourceAttributes describes information for a non-resource access request", +} + +func (SelfSubjectAccessReviewSpec) SwaggerDoc() map[string]string { + return map_SelfSubjectAccessReviewSpec +} + +var map_SubjectAccessReview = map[string]string{ + "": "SubjectAccessReview checks whether or not a user or group can perform an action.", + "spec": "Spec holds information about the request being evaluated", + "status": "Status is filled in by the server and indicates whether the request is allowed or not", +} + +func (SubjectAccessReview) SwaggerDoc() map[string]string { + return map_SubjectAccessReview +} + +var map_SubjectAccessReviewSpec = map[string]string{ + "": "SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", + "resourceAttributes": "ResourceAuthorizationAttributes describes information for a resource access request", + "nonResourceAttributes": "NonResourceAttributes describes information for a non-resource access request", + "user": "User is the user you're testing for. If you specify \"User\" but not \"Group\", then is it interpreted as \"What if User were not a member of any groups", + "group": "Groups is the groups you're testing for.", +} + +func (SubjectAccessReviewSpec) SwaggerDoc() map[string]string { + return map_SubjectAccessReviewSpec +} + +var map_SubjectAccessReviewStatus = map[string]string{ + "": "SubjectAccessReviewStatus", + "allowed": "Allowed is required. True if the action would be allowed, false otherwise.", + "reason": "Reason is optional. It indicates why a request was allowed or denied.", +} + +func (SubjectAccessReviewStatus) SwaggerDoc() map[string]string { + return map_SubjectAccessReviewStatus +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/validation/validation.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/validation/validation.go new file mode 100644 index 000000000..11a548f41 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/validation/validation.go @@ -0,0 +1,64 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + authorizationapi "k8s.io/kubernetes/pkg/apis/authorization" + "k8s.io/kubernetes/pkg/util/validation/field" +) + +func ValidateSubjectAccessReviewSpec(spec authorizationapi.SubjectAccessReviewSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if spec.ResourceAttributes != nil && spec.NonResourceAttributes != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("nonResourceAttributes"), spec.NonResourceAttributes, `cannot be specified in combination with resourceAttributes`)) + } + if spec.ResourceAttributes == nil && spec.NonResourceAttributes == nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("resourceAttributes"), spec.NonResourceAttributes, `exactly one of nonResourceAttributes or resourceAttributes must be specified`)) + } + if len(spec.User) == 0 && len(spec.Groups) == 0 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("user"), spec.User, `at least one of user or group must be specified`)) + } + + return allErrs +} + +func ValidateSelfSubjectAccessReviewSpec(spec authorizationapi.SelfSubjectAccessReviewSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if spec.ResourceAttributes != nil && spec.NonResourceAttributes != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("nonResourceAttributes"), spec.NonResourceAttributes, `cannot be specified in combination with resourceAttributes`)) + } + if spec.ResourceAttributes == nil && spec.NonResourceAttributes == nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("resourceAttributes"), spec.NonResourceAttributes, `exactly one of nonResourceAttributes or resourceAttributes must be specified`)) + } + + return allErrs +} + +func ValidateSubjectAccessReview(sar *authorizationapi.SubjectAccessReview) field.ErrorList { + allErrs := ValidateSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec")) + return allErrs +} + +func ValidateSelfSubjectAccessReview(sar *authorizationapi.SelfSubjectAccessReview) field.ErrorList { + allErrs := ValidateSelfSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec")) + return allErrs +} + +func ValidateLocalSubjectAccessReview(sar *authorizationapi.LocalSubjectAccessReview) field.ErrorList { + allErrs := ValidateSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec")) + return allErrs +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/authorization/validation/validation_test.go b/vendor/k8s.io/kubernetes/pkg/apis/authorization/validation/validation_test.go new file mode 100644 index 000000000..c2776c404 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/authorization/validation/validation_test.go @@ -0,0 +1,135 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "strings" + "testing" + + authorizationapi "k8s.io/kubernetes/pkg/apis/authorization" + "k8s.io/kubernetes/pkg/util/validation/field" +) + +func TestValidateSARSpec(t *testing.T) { + successCases := []authorizationapi.SubjectAccessReviewSpec{ + {ResourceAttributes: &authorizationapi.ResourceAttributes{}, User: "me"}, + {NonResourceAttributes: &authorizationapi.NonResourceAttributes{}, Groups: []string{"my-group"}}, + } + for _, successCase := range successCases { + if errs := ValidateSubjectAccessReviewSpec(successCase, field.NewPath("spec")); len(errs) != 0 { + t.Errorf("expected success: %v", errs) + } + } + + errorCases := []struct { + name string + obj authorizationapi.SubjectAccessReviewSpec + msg string + }{ + { + name: "neither request", + obj: authorizationapi.SubjectAccessReviewSpec{User: "me"}, + msg: "exactly one of nonResourceAttributes or resourceAttributes must be specified", + }, + { + name: "both requests", + obj: authorizationapi.SubjectAccessReviewSpec{ + ResourceAttributes: &authorizationapi.ResourceAttributes{}, + NonResourceAttributes: &authorizationapi.NonResourceAttributes{}, + User: "me", + }, + msg: "cannot be specified in combination with resourceAttributes", + }, + { + name: "no subject", + obj: authorizationapi.SubjectAccessReviewSpec{ + ResourceAttributes: &authorizationapi.ResourceAttributes{}, + }, + msg: `spec.user: Invalid value: "": at least one of user or group must be specified`, + }, + } + + for _, c := range errorCases { + errs := ValidateSubjectAccessReviewSpec(c.obj, field.NewPath("spec")) + if len(errs) == 0 { + t.Errorf("%s: expected failure for %q", c.name, c.msg) + } else if !strings.Contains(errs[0].Error(), c.msg) { + t.Errorf("%s: unexpected error: %q, expected: %q", c.name, errs[0], c.msg) + } + + errs = ValidateSubjectAccessReview(&authorizationapi.SubjectAccessReview{Spec: c.obj}) + if len(errs) == 0 { + t.Errorf("%s: expected failure for %q", c.name, c.msg) + } else if !strings.Contains(errs[0].Error(), c.msg) { + t.Errorf("%s: unexpected error: %q, expected: %q", c.name, errs[0], c.msg) + } + errs = ValidateLocalSubjectAccessReview(&authorizationapi.LocalSubjectAccessReview{Spec: c.obj}) + if len(errs) == 0 { + t.Errorf("%s: expected failure for %q", c.name, c.msg) + } else if !strings.Contains(errs[0].Error(), c.msg) { + t.Errorf("%s: unexpected error: %q, expected: %q", c.name, errs[0], c.msg) + } + + } +} + +func TestValidateSelfSAR(t *testing.T) { + successCases := []authorizationapi.SelfSubjectAccessReviewSpec{ + {ResourceAttributes: &authorizationapi.ResourceAttributes{}}, + } + for _, successCase := range successCases { + if errs := ValidateSelfSubjectAccessReviewSpec(successCase, field.NewPath("spec")); len(errs) != 0 { + t.Errorf("expected success: %v", errs) + } + } + + errorCases := []struct { + name string + obj authorizationapi.SelfSubjectAccessReviewSpec + msg string + }{ + { + name: "neither request", + obj: authorizationapi.SelfSubjectAccessReviewSpec{}, + msg: "exactly one of nonResourceAttributes or resourceAttributes must be specified", + }, + { + name: "both requests", + obj: authorizationapi.SelfSubjectAccessReviewSpec{ + ResourceAttributes: &authorizationapi.ResourceAttributes{}, + NonResourceAttributes: &authorizationapi.NonResourceAttributes{}, + }, + msg: "cannot be specified in combination with resourceAttributes", + }, + } + + for _, c := range errorCases { + errs := ValidateSelfSubjectAccessReviewSpec(c.obj, field.NewPath("spec")) + if len(errs) == 0 { + t.Errorf("%s: expected failure for %q", c.name, c.msg) + } else if !strings.Contains(errs[0].Error(), c.msg) { + t.Errorf("%s: unexpected error: %q, expected: %q", c.name, errs[0], c.msg) + } + + errs = ValidateSelfSubjectAccessReview(&authorizationapi.SelfSubjectAccessReview{Spec: c.obj}) + if len(errs) == 0 { + t.Errorf("%s: expected failure for %q", c.name, c.msg) + } else if !strings.Contains(errs[0].Error(), c.msg) { + t.Errorf("%s: unexpected error: %q, expected: %q", c.name, errs[0], c.msg) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/deep_copy_generated.go new file mode 100644 index 000000000..c9a7b31e2 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/deep_copy_generated.go @@ -0,0 +1,29 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh. + +package componentconfig + +import api "k8s.io/kubernetes/pkg/api" + +func init() { + err := api.Scheme.AddGeneratedDeepCopyFuncs() + if err != nil { + // if one of the deep copy functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers.go new file mode 100644 index 000000000..edd9c7975 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers.go @@ -0,0 +1,97 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package componentconfig + +import ( + "fmt" + "net" + + utilnet "k8s.io/kubernetes/pkg/util/net" +) + +// used for validating command line opts +// TODO(mikedanese): remove these when we remove command line flags + +type IPVar struct { + Val *string +} + +func (v IPVar) Set(s string) error { + if net.ParseIP(s) == nil { + return fmt.Errorf("%q is not a valid IP address", s) + } + if v.Val == nil { + // it's okay to panic here since this is programmer error + panic("the string pointer passed into IPVar should not be nil") + } + *v.Val = s + return nil +} + +func (v IPVar) String() string { + if v.Val == nil { + return "" + } + return *v.Val +} + +func (v IPVar) Type() string { + return "ip" +} + +func (m *ProxyMode) Set(s string) error { + *m = ProxyMode(s) + return nil +} + +func (m *ProxyMode) String() string { + if m != nil { + return string(*m) + } + return "" +} + +func (m *ProxyMode) Type() string { + return "ProxyMode" +} + +type PortRangeVar struct { + Val *string +} + +func (v PortRangeVar) Set(s string) error { + if _, err := utilnet.ParsePortRange(s); err != nil { + return fmt.Errorf("%q is not a valid port range: %v", s, err) + } + if v.Val == nil { + // it's okay to panic here since this is programmer error + panic("the string pointer passed into PortRangeVar should not be nil") + } + *v.Val = s + return nil +} + +func (v PortRangeVar) String() string { + if v.Val == nil { + return "" + } + return *v.Val +} + +func (v PortRangeVar) Type() string { + return "port-range" +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers_test.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers_test.go new file mode 100644 index 000000000..7aece8257 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers_test.go @@ -0,0 +1,71 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package componentconfig + +import ( + "strings" + "testing" + + "github.com/spf13/pflag" +) + +func TestIPVar(t *testing.T) { + defaultIP := "0.0.0.0" + cases := []struct { + argc string + expectErr bool + expectVal string + }{ + + { + argc: "blah --ip=1.2.3.4", + expectVal: "1.2.3.4", + }, + { + argc: "blah --ip=1.2.3.4a", + expectErr: true, + expectVal: defaultIP, + }, + } + for _, c := range cases { + fs := pflag.NewFlagSet("blah", pflag.PanicOnError) + ip := defaultIP + fs.Var(IPVar{&ip}, "ip", "the ip") + + var err error + func() { + defer func() { + if r := recover(); r != nil { + err = r.(error) + } + }() + fs.Parse(strings.Split(c.argc, " ")) + }() + + if c.expectErr && err == nil { + t.Errorf("did not observe an expected error") + continue + } + if !c.expectErr && err != nil { + t.Errorf("observed an unexpected error") + continue + } + if c.expectVal != ip { + t.Errorf("unexpected ip: expected %q, saw %q", c.expectVal, ip) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/install/install.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/install/install.go new file mode 100644 index 000000000..ec5554273 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/install/install.go @@ -0,0 +1,129 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package install installs the experimental API group, making it available as +// an option to all of the API encoding/decoding machinery. +package install + +import ( + "fmt" + + "github.com/golang/glog" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/componentconfig" + "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/sets" +) + +const importPrefix = "k8s.io/kubernetes/pkg/apis/componentconfig" + +var accessor = meta.NewAccessor() + +// availableVersions lists all known external versions for this group from most preferred to least preferred +var availableVersions = []unversioned.GroupVersion{v1alpha1.SchemeGroupVersion} + +func init() { + registered.RegisterVersions(availableVersions) + externalVersions := []unversioned.GroupVersion{} + for _, v := range availableVersions { + if registered.IsAllowedVersion(v) { + externalVersions = append(externalVersions, v) + } + } + if len(externalVersions) == 0 { + glog.V(4).Infof("No version is registered for group %v", componentconfig.GroupName) + return + } + + if err := registered.EnableVersions(externalVersions...); err != nil { + glog.V(4).Infof("%v", err) + return + } + if err := enableVersions(externalVersions); err != nil { + glog.V(4).Infof("%v", err) + return + } +} + +// TODO: enableVersions should be centralized rather than spread in each API +// group. +// We can combine registered.RegisterVersions, registered.EnableVersions and +// registered.RegisterGroup once we have moved enableVersions there. +func enableVersions(externalVersions []unversioned.GroupVersion) error { + addVersionsToScheme(externalVersions...) + preferredExternalVersion := externalVersions[0] + + groupMeta := apimachinery.GroupMeta{ + GroupVersion: preferredExternalVersion, + GroupVersions: externalVersions, + RESTMapper: newRESTMapper(externalVersions), + SelfLinker: runtime.SelfLinker(accessor), + InterfacesFor: interfacesFor, + } + + if err := registered.RegisterGroup(groupMeta); err != nil { + return err + } + api.RegisterRESTMapper(groupMeta.RESTMapper) + return nil +} + +func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { + // the list of kinds that are scoped at the root of the api hierarchy + // if a kind is not enumerated here, it is assumed to have a namespace scope + rootScoped := sets.NewString() + + ignoredKinds := sets.NewString() + + return api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) +} + +// interfacesFor returns the default Codec and ResourceVersioner for a given version +// string, or an error if the version is not known. +func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { + switch version { + case v1alpha1.SchemeGroupVersion: + return &meta.VersionInterfaces{ + ObjectConvertor: api.Scheme, + MetadataAccessor: accessor, + }, nil + default: + g, _ := registered.Group(componentconfig.GroupName) + return nil, fmt.Errorf("unsupported storage version: %s (valid: %v)", version, g.GroupVersions) + } +} + +func addVersionsToScheme(externalVersions ...unversioned.GroupVersion) { + // add the internal version to Scheme + componentconfig.AddToScheme(api.Scheme) + // add the enabled external versions to Scheme + for _, v := range externalVersions { + if !registered.IsEnabledVersion(v) { + glog.Errorf("Version %s is not enabled, so it will not be added to the Scheme.", v) + continue + } + switch v { + case v1alpha1.SchemeGroupVersion: + v1alpha1.AddToScheme(api.Scheme) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/install/install_test.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/install/install_test.go new file mode 100644 index 000000000..940e17567 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/install/install_test.go @@ -0,0 +1,89 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package install + +import ( + "encoding/json" + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/componentconfig" + "k8s.io/kubernetes/pkg/runtime" +) + +func TestCodec(t *testing.T) { + daemonSet := componentconfig.KubeProxyConfiguration{} + // We do want to use package registered rather than testapi here, because we + // want to test if the package install and package registered work as expected. + data, err := runtime.Encode(api.Codecs.LegacyCodec(registered.GroupOrDie(componentconfig.GroupName).GroupVersion), &daemonSet) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + other := componentconfig.KubeProxyConfiguration{} + if err := json.Unmarshal(data, &other); err != nil { + t.Fatalf("unexpected error: %v", err) + } + if other.APIVersion != registered.GroupOrDie(componentconfig.GroupName).GroupVersion.String() || other.Kind != "KubeProxyConfiguration" { + t.Errorf("unexpected unmarshalled object %#v", other) + } +} + +func TestInterfacesFor(t *testing.T) { + if _, err := registered.GroupOrDie(componentconfig.GroupName).InterfacesFor(componentconfig.SchemeGroupVersion); err == nil { + t.Fatalf("unexpected non-error: %v", err) + } + for i, version := range registered.GroupOrDie(componentconfig.GroupName).GroupVersions { + if vi, err := registered.GroupOrDie(componentconfig.GroupName).InterfacesFor(version); err != nil || vi == nil { + t.Fatalf("%d: unexpected result: %v", i, err) + } + } +} + +func TestRESTMapper(t *testing.T) { + gv := unversioned.GroupVersion{Group: componentconfig.GroupName, Version: "v1alpha1"} + proxyGVK := gv.WithKind("KubeProxyConfiguration") + + if gvk, err := registered.GroupOrDie(componentconfig.GroupName).RESTMapper.KindFor(gv.WithResource("kubeproxyconfiguration")); err != nil || gvk != proxyGVK { + t.Errorf("unexpected version mapping: %v %v", gvk, err) + } + + if m, err := registered.GroupOrDie(componentconfig.GroupName).RESTMapper.RESTMapping(proxyGVK.GroupKind(), ""); err != nil || m.GroupVersionKind != proxyGVK || m.Resource != "kubeproxyconfigurations" { + t.Errorf("unexpected version mapping: %#v %v", m, err) + } + + for _, version := range registered.GroupOrDie(componentconfig.GroupName).GroupVersions { + mapping, err := registered.GroupOrDie(componentconfig.GroupName).RESTMapper.RESTMapping(proxyGVK.GroupKind(), version.Version) + if err != nil { + t.Errorf("unexpected error: %v", err) + continue + } + + if mapping.Resource != "kubeproxyconfigurations" { + t.Errorf("incorrect resource name: %#v", mapping) + } + if mapping.GroupVersionKind.GroupVersion() != version { + t.Errorf("incorrect groupVersion: %v", mapping) + } + + interfaces, _ := registered.GroupOrDie(componentconfig.GroupName).InterfacesFor(version) + if mapping.ObjectConvertor != interfaces.ObjectConvertor { + t.Errorf("unexpected: %#v, expected: %#v", mapping, interfaces) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/register.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/register.go new file mode 100644 index 000000000..3604129a6 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/register.go @@ -0,0 +1,53 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package componentconfig + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +func AddToScheme(scheme *runtime.Scheme) { + addKnownTypes(scheme) +} + +// GroupName is the group name use in this package +const GroupName = "componentconfig" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) unversioned.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns back a Group qualified GroupResource +func Resource(resource string) unversioned.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) { + // TODO this will get cleaned up with the scheme types are fixed + scheme.AddKnownTypes(SchemeGroupVersion, + &KubeProxyConfiguration{}, + &KubeSchedulerConfiguration{}, + ) +} + +func (obj *KubeProxyConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *KubeSchedulerConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/types.generated.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/types.generated.go new file mode 100644 index 000000000..755fe14a6 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/types.generated.go @@ -0,0 +1,8253 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED BY codecgen. +// ************************************************************ + +package componentconfig + +import ( + "errors" + "fmt" + codec1978 "github.com/ugorji/go/codec" + pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned" + "reflect" + "runtime" + time "time" +) + +const ( + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- + codecSelferValueTypeArray1234 = 10 + codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 +) + +var ( + codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits()) + codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`) +) + +type codecSelfer1234 struct{} + +func init() { + if codec1978.GenVersion != 5 { + _, file, _, _ := runtime.Caller(0) + err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", + 5, codec1978.GenVersion, file) + panic(err) + } + if false { // reference the types, but skip this branch at build/run time + var v0 pkg1_unversioned.TypeMeta + var v1 time.Duration + _, _ = v0, v1 + } +} + +func (x *KubeProxyConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [18]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[16] = x.Kind != "" + yyq2[17] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(18) + } else { + yynn2 = 16 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.BindAddress)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("bindAddress")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.BindAddress)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HealthzBindAddress)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("healthzBindAddress")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HealthzBindAddress)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeInt(int64(x.HealthzPort)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("healthzPort")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeInt(int64(x.HealthzPort)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostnameOverride)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostnameOverride")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostnameOverride)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.IPTablesMasqueradeBit == nil { + r.EncodeNil() + } else { + yy16 := *x.IPTablesMasqueradeBit + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeInt(int64(yy16)) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("iptablesMasqueradeBit")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.IPTablesMasqueradeBit == nil { + r.EncodeNil() + } else { + yy18 := *x.IPTablesMasqueradeBit + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeInt(int64(yy18)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy21 := &x.IPTablesSyncPeriod + yym22 := z.EncBinary() + _ = yym22 + if false { + } else if z.HasExtensions() && z.EncExt(yy21) { + } else if !yym22 && z.IsJSONHandle() { + z.EncJSONMarshal(yy21) + } else { + z.EncFallback(yy21) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("iptablesSyncPeriodSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy23 := &x.IPTablesSyncPeriod + yym24 := z.EncBinary() + _ = yym24 + if false { + } else if z.HasExtensions() && z.EncExt(yy23) { + } else if !yym24 && z.IsJSONHandle() { + z.EncJSONMarshal(yy23) + } else { + z.EncFallback(yy23) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.KubeconfigPath)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeconfigPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym27 := z.EncBinary() + _ = yym27 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.KubeconfigPath)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym29 := z.EncBinary() + _ = yym29 + if false { + } else { + r.EncodeBool(bool(x.MasqueradeAll)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("masqueradeAll")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym30 := z.EncBinary() + _ = yym30 + if false { + } else { + r.EncodeBool(bool(x.MasqueradeAll)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym32 := z.EncBinary() + _ = yym32 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Master)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("master")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym33 := z.EncBinary() + _ = yym33 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Master)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.OOMScoreAdj == nil { + r.EncodeNil() + } else { + yy35 := *x.OOMScoreAdj + yym36 := z.EncBinary() + _ = yym36 + if false { + } else { + r.EncodeInt(int64(yy35)) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("oomScoreAdj")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.OOMScoreAdj == nil { + r.EncodeNil() + } else { + yy37 := *x.OOMScoreAdj + yym38 := z.EncBinary() + _ = yym38 + if false { + } else { + r.EncodeInt(int64(yy37)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + x.Mode.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("mode")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + x.Mode.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym43 := z.EncBinary() + _ = yym43 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PortRange)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("portRange")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym44 := z.EncBinary() + _ = yym44 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PortRange)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym46 := z.EncBinary() + _ = yym46 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ResourceContainer)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeletCgroups")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym47 := z.EncBinary() + _ = yym47 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ResourceContainer)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy49 := &x.UDPIdleTimeout + yym50 := z.EncBinary() + _ = yym50 + if false { + } else if z.HasExtensions() && z.EncExt(yy49) { + } else if !yym50 && z.IsJSONHandle() { + z.EncJSONMarshal(yy49) + } else { + z.EncFallback(yy49) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("udpTimeoutMilliseconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy51 := &x.UDPIdleTimeout + yym52 := z.EncBinary() + _ = yym52 + if false { + } else if z.HasExtensions() && z.EncExt(yy51) { + } else if !yym52 && z.IsJSONHandle() { + z.EncJSONMarshal(yy51) + } else { + z.EncFallback(yy51) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym54 := z.EncBinary() + _ = yym54 + if false { + } else { + r.EncodeInt(int64(x.ConntrackMax)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("conntrackMax")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym55 := z.EncBinary() + _ = yym55 + if false { + } else { + r.EncodeInt(int64(x.ConntrackMax)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy57 := &x.ConntrackTCPEstablishedTimeout + yym58 := z.EncBinary() + _ = yym58 + if false { + } else if z.HasExtensions() && z.EncExt(yy57) { + } else if !yym58 && z.IsJSONHandle() { + z.EncJSONMarshal(yy57) + } else { + z.EncFallback(yy57) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("conntrackTCPEstablishedTimeout")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy59 := &x.ConntrackTCPEstablishedTimeout + yym60 := z.EncBinary() + _ = yym60 + if false { + } else if z.HasExtensions() && z.EncExt(yy59) { + } else if !yym60 && z.IsJSONHandle() { + z.EncJSONMarshal(yy59) + } else { + z.EncFallback(yy59) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[16] { + yym62 := z.EncBinary() + _ = yym62 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[16] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym63 := z.EncBinary() + _ = yym63 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[17] { + yym65 := z.EncBinary() + _ = yym65 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[17] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym66 := z.EncBinary() + _ = yym66 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *KubeProxyConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *KubeProxyConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "bindAddress": + if r.TryDecodeAsNil() { + x.BindAddress = "" + } else { + x.BindAddress = string(r.DecodeString()) + } + case "healthzBindAddress": + if r.TryDecodeAsNil() { + x.HealthzBindAddress = "" + } else { + x.HealthzBindAddress = string(r.DecodeString()) + } + case "healthzPort": + if r.TryDecodeAsNil() { + x.HealthzPort = 0 + } else { + x.HealthzPort = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "hostnameOverride": + if r.TryDecodeAsNil() { + x.HostnameOverride = "" + } else { + x.HostnameOverride = string(r.DecodeString()) + } + case "iptablesMasqueradeBit": + if r.TryDecodeAsNil() { + if x.IPTablesMasqueradeBit != nil { + x.IPTablesMasqueradeBit = nil + } + } else { + if x.IPTablesMasqueradeBit == nil { + x.IPTablesMasqueradeBit = new(int) + } + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*int)(x.IPTablesMasqueradeBit)) = int(r.DecodeInt(codecSelferBitsize1234)) + } + } + case "iptablesSyncPeriodSeconds": + if r.TryDecodeAsNil() { + x.IPTablesSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv10 := &x.IPTablesSyncPeriod + yym11 := z.DecBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.DecExt(yyv10) { + } else if !yym11 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv10) + } else { + z.DecFallback(yyv10, false) + } + } + case "kubeconfigPath": + if r.TryDecodeAsNil() { + x.KubeconfigPath = "" + } else { + x.KubeconfigPath = string(r.DecodeString()) + } + case "masqueradeAll": + if r.TryDecodeAsNil() { + x.MasqueradeAll = false + } else { + x.MasqueradeAll = bool(r.DecodeBool()) + } + case "master": + if r.TryDecodeAsNil() { + x.Master = "" + } else { + x.Master = string(r.DecodeString()) + } + case "oomScoreAdj": + if r.TryDecodeAsNil() { + if x.OOMScoreAdj != nil { + x.OOMScoreAdj = nil + } + } else { + if x.OOMScoreAdj == nil { + x.OOMScoreAdj = new(int) + } + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*int)(x.OOMScoreAdj)) = int(r.DecodeInt(codecSelferBitsize1234)) + } + } + case "mode": + if r.TryDecodeAsNil() { + x.Mode = "" + } else { + x.Mode = ProxyMode(r.DecodeString()) + } + case "portRange": + if r.TryDecodeAsNil() { + x.PortRange = "" + } else { + x.PortRange = string(r.DecodeString()) + } + case "kubeletCgroups": + if r.TryDecodeAsNil() { + x.ResourceContainer = "" + } else { + x.ResourceContainer = string(r.DecodeString()) + } + case "udpTimeoutMilliseconds": + if r.TryDecodeAsNil() { + x.UDPIdleTimeout = pkg1_unversioned.Duration{} + } else { + yyv20 := &x.UDPIdleTimeout + yym21 := z.DecBinary() + _ = yym21 + if false { + } else if z.HasExtensions() && z.DecExt(yyv20) { + } else if !yym21 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv20) + } else { + z.DecFallback(yyv20, false) + } + } + case "conntrackMax": + if r.TryDecodeAsNil() { + x.ConntrackMax = 0 + } else { + x.ConntrackMax = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "conntrackTCPEstablishedTimeout": + if r.TryDecodeAsNil() { + x.ConntrackTCPEstablishedTimeout = pkg1_unversioned.Duration{} + } else { + yyv23 := &x.ConntrackTCPEstablishedTimeout + yym24 := z.DecBinary() + _ = yym24 + if false { + } else if z.HasExtensions() && z.DecExt(yyv23) { + } else if !yym24 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv23) + } else { + z.DecFallback(yyv23, false) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *KubeProxyConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj27 int + var yyb27 bool + var yyhl27 bool = l >= 0 + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.BindAddress = "" + } else { + x.BindAddress = string(r.DecodeString()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HealthzBindAddress = "" + } else { + x.HealthzBindAddress = string(r.DecodeString()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HealthzPort = 0 + } else { + x.HealthzPort = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostnameOverride = "" + } else { + x.HostnameOverride = string(r.DecodeString()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.IPTablesMasqueradeBit != nil { + x.IPTablesMasqueradeBit = nil + } + } else { + if x.IPTablesMasqueradeBit == nil { + x.IPTablesMasqueradeBit = new(int) + } + yym33 := z.DecBinary() + _ = yym33 + if false { + } else { + *((*int)(x.IPTablesMasqueradeBit)) = int(r.DecodeInt(codecSelferBitsize1234)) + } + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.IPTablesSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv34 := &x.IPTablesSyncPeriod + yym35 := z.DecBinary() + _ = yym35 + if false { + } else if z.HasExtensions() && z.DecExt(yyv34) { + } else if !yym35 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv34) + } else { + z.DecFallback(yyv34, false) + } + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeconfigPath = "" + } else { + x.KubeconfigPath = string(r.DecodeString()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MasqueradeAll = false + } else { + x.MasqueradeAll = bool(r.DecodeBool()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Master = "" + } else { + x.Master = string(r.DecodeString()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.OOMScoreAdj != nil { + x.OOMScoreAdj = nil + } + } else { + if x.OOMScoreAdj == nil { + x.OOMScoreAdj = new(int) + } + yym40 := z.DecBinary() + _ = yym40 + if false { + } else { + *((*int)(x.OOMScoreAdj)) = int(r.DecodeInt(codecSelferBitsize1234)) + } + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Mode = "" + } else { + x.Mode = ProxyMode(r.DecodeString()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PortRange = "" + } else { + x.PortRange = string(r.DecodeString()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ResourceContainer = "" + } else { + x.ResourceContainer = string(r.DecodeString()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.UDPIdleTimeout = pkg1_unversioned.Duration{} + } else { + yyv44 := &x.UDPIdleTimeout + yym45 := z.DecBinary() + _ = yym45 + if false { + } else if z.HasExtensions() && z.DecExt(yyv44) { + } else if !yym45 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv44) + } else { + z.DecFallback(yyv44, false) + } + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConntrackMax = 0 + } else { + x.ConntrackMax = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConntrackTCPEstablishedTimeout = pkg1_unversioned.Duration{} + } else { + yyv47 := &x.ConntrackTCPEstablishedTimeout + yym48 := z.DecBinary() + _ = yym48 + if false { + } else if z.HasExtensions() && z.DecExt(yyv47) { + } else if !yym48 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv47) + } else { + z.DecFallback(yyv47, false) + } + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj27++ + if yyhl27 { + yyb27 = yyj27 > l + } else { + yyb27 = r.CheckBreak() + } + if yyb27 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj27-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x ProxyMode) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x)) + } +} + +func (x *ProxyMode) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() + } +} + +func (x *KubeletConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [76]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[46] = x.CloudProvider != "" + yyq2[47] = x.CloudConfigFile != "" + yyq2[48] = x.KubeletCgroups != "" + yyq2[49] = x.RuntimeCgroups != "" + yyq2[50] = x.SystemCgroups != "" + yyq2[51] = x.CgroupRoot != "" + yyq2[53] = x.RktPath != "" + yyq2[55] = x.RktStage1Image != "" + yyq2[71] = true + yyq2[72] = x.NodeIP != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(76) + } else { + yynn2 = 66 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Config)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("config")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Config)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.SyncFrequency + yym8 := z.EncBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) + } else { + z.EncFallback(yy7) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("syncFrequency")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.SyncFrequency + yym10 := z.EncBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) + } else { + z.EncFallback(yy9) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy12 := &x.FileCheckFrequency + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else if !yym13 && z.IsJSONHandle() { + z.EncJSONMarshal(yy12) + } else { + z.EncFallback(yy12) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fileCheckFrequency")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy14 := &x.FileCheckFrequency + yym15 := z.EncBinary() + _ = yym15 + if false { + } else if z.HasExtensions() && z.EncExt(yy14) { + } else if !yym15 && z.IsJSONHandle() { + z.EncJSONMarshal(yy14) + } else { + z.EncFallback(yy14) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy17 := &x.HTTPCheckFrequency + yym18 := z.EncBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.EncExt(yy17) { + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(yy17) + } else { + z.EncFallback(yy17) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("httpCheckFrequency")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy19 := &x.HTTPCheckFrequency + yym20 := z.EncBinary() + _ = yym20 + if false { + } else if z.HasExtensions() && z.EncExt(yy19) { + } else if !yym20 && z.IsJSONHandle() { + z.EncJSONMarshal(yy19) + } else { + z.EncFallback(yy19) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ManifestURL)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("manifestURL")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ManifestURL)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ManifestURLHeader)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("manifestURLHeader")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ManifestURLHeader)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym28 := z.EncBinary() + _ = yym28 + if false { + } else { + r.EncodeBool(bool(x.EnableServer)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("enableServer")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym29 := z.EncBinary() + _ = yym29 + if false { + } else { + r.EncodeBool(bool(x.EnableServer)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym31 := z.EncBinary() + _ = yym31 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("address")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym32 := z.EncBinary() + _ = yym32 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym34 := z.EncBinary() + _ = yym34 + if false { + } else { + r.EncodeUint(uint64(x.Port)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("port")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym35 := z.EncBinary() + _ = yym35 + if false { + } else { + r.EncodeUint(uint64(x.Port)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym37 := z.EncBinary() + _ = yym37 + if false { + } else { + r.EncodeUint(uint64(x.ReadOnlyPort)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("readOnlyPort")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym38 := z.EncBinary() + _ = yym38 + if false { + } else { + r.EncodeUint(uint64(x.ReadOnlyPort)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym40 := z.EncBinary() + _ = yym40 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.TLSCertFile)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tLSCertFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym41 := z.EncBinary() + _ = yym41 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.TLSCertFile)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym43 := z.EncBinary() + _ = yym43 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.TLSPrivateKeyFile)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tLSPrivateKeyFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym44 := z.EncBinary() + _ = yym44 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.TLSPrivateKeyFile)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym46 := z.EncBinary() + _ = yym46 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CertDirectory)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("certDirectory")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym47 := z.EncBinary() + _ = yym47 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CertDirectory)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym49 := z.EncBinary() + _ = yym49 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostnameOverride)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostnameOverride")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym50 := z.EncBinary() + _ = yym50 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostnameOverride)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym52 := z.EncBinary() + _ = yym52 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PodInfraContainerImage)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("podInfraContainerImage")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym53 := z.EncBinary() + _ = yym53 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PodInfraContainerImage)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym55 := z.EncBinary() + _ = yym55 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.DockerEndpoint)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("dockerEndpoint")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym56 := z.EncBinary() + _ = yym56 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.DockerEndpoint)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym58 := z.EncBinary() + _ = yym58 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RootDirectory)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rootDirectory")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym59 := z.EncBinary() + _ = yym59 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RootDirectory)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym61 := z.EncBinary() + _ = yym61 + if false { + } else { + r.EncodeBool(bool(x.AllowPrivileged)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("allowPrivileged")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym62 := z.EncBinary() + _ = yym62 + if false { + } else { + r.EncodeBool(bool(x.AllowPrivileged)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym64 := z.EncBinary() + _ = yym64 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostNetworkSources)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostNetworkSources")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym65 := z.EncBinary() + _ = yym65 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostNetworkSources)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym67 := z.EncBinary() + _ = yym67 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostPIDSources)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostPIDSources")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym68 := z.EncBinary() + _ = yym68 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostPIDSources)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym70 := z.EncBinary() + _ = yym70 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostIPCSources)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostIPCSources")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym71 := z.EncBinary() + _ = yym71 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HostIPCSources)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym73 := z.EncBinary() + _ = yym73 + if false { + } else { + r.EncodeFloat64(float64(x.RegistryPullQPS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("registryPullQPS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym74 := z.EncBinary() + _ = yym74 + if false { + } else { + r.EncodeFloat64(float64(x.RegistryPullQPS)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym76 := z.EncBinary() + _ = yym76 + if false { + } else { + r.EncodeInt(int64(x.RegistryBurst)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("registryBurst")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym77 := z.EncBinary() + _ = yym77 + if false { + } else { + r.EncodeInt(int64(x.RegistryBurst)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym79 := z.EncBinary() + _ = yym79 + if false { + } else { + r.EncodeFloat32(float32(x.EventRecordQPS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("eventRecordQPS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym80 := z.EncBinary() + _ = yym80 + if false { + } else { + r.EncodeFloat32(float32(x.EventRecordQPS)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym82 := z.EncBinary() + _ = yym82 + if false { + } else { + r.EncodeInt(int64(x.EventBurst)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("eventBurst")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym83 := z.EncBinary() + _ = yym83 + if false { + } else { + r.EncodeInt(int64(x.EventBurst)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym85 := z.EncBinary() + _ = yym85 + if false { + } else { + r.EncodeBool(bool(x.EnableDebuggingHandlers)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("enableDebuggingHandlers")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym86 := z.EncBinary() + _ = yym86 + if false { + } else { + r.EncodeBool(bool(x.EnableDebuggingHandlers)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy88 := &x.MinimumGCAge + yym89 := z.EncBinary() + _ = yym89 + if false { + } else if z.HasExtensions() && z.EncExt(yy88) { + } else if !yym89 && z.IsJSONHandle() { + z.EncJSONMarshal(yy88) + } else { + z.EncFallback(yy88) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("minimumGCAge")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy90 := &x.MinimumGCAge + yym91 := z.EncBinary() + _ = yym91 + if false { + } else if z.HasExtensions() && z.EncExt(yy90) { + } else if !yym91 && z.IsJSONHandle() { + z.EncJSONMarshal(yy90) + } else { + z.EncFallback(yy90) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym93 := z.EncBinary() + _ = yym93 + if false { + } else { + r.EncodeInt(int64(x.MaxPerPodContainerCount)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("maxPerPodContainerCount")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym94 := z.EncBinary() + _ = yym94 + if false { + } else { + r.EncodeInt(int64(x.MaxPerPodContainerCount)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym96 := z.EncBinary() + _ = yym96 + if false { + } else { + r.EncodeInt(int64(x.MaxContainerCount)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("maxContainerCount")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym97 := z.EncBinary() + _ = yym97 + if false { + } else { + r.EncodeInt(int64(x.MaxContainerCount)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym99 := z.EncBinary() + _ = yym99 + if false { + } else { + r.EncodeUint(uint64(x.CAdvisorPort)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cAdvisorPort")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym100 := z.EncBinary() + _ = yym100 + if false { + } else { + r.EncodeUint(uint64(x.CAdvisorPort)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym102 := z.EncBinary() + _ = yym102 + if false { + } else { + r.EncodeInt(int64(x.HealthzPort)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("healthzPort")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym103 := z.EncBinary() + _ = yym103 + if false { + } else { + r.EncodeInt(int64(x.HealthzPort)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym105 := z.EncBinary() + _ = yym105 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HealthzBindAddress)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("healthzBindAddress")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym106 := z.EncBinary() + _ = yym106 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.HealthzBindAddress)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym108 := z.EncBinary() + _ = yym108 + if false { + } else { + r.EncodeInt(int64(x.OOMScoreAdj)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("oomScoreAdj")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym109 := z.EncBinary() + _ = yym109 + if false { + } else { + r.EncodeInt(int64(x.OOMScoreAdj)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym111 := z.EncBinary() + _ = yym111 + if false { + } else { + r.EncodeBool(bool(x.RegisterNode)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("registerNode")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym112 := z.EncBinary() + _ = yym112 + if false { + } else { + r.EncodeBool(bool(x.RegisterNode)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym114 := z.EncBinary() + _ = yym114 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ClusterDomain)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("clusterDomain")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym115 := z.EncBinary() + _ = yym115 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ClusterDomain)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym117 := z.EncBinary() + _ = yym117 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.MasterServiceNamespace)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("masterServiceNamespace")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym118 := z.EncBinary() + _ = yym118 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.MasterServiceNamespace)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym120 := z.EncBinary() + _ = yym120 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ClusterDNS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("clusterDNS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym121 := z.EncBinary() + _ = yym121 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ClusterDNS)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy123 := &x.StreamingConnectionIdleTimeout + yym124 := z.EncBinary() + _ = yym124 + if false { + } else if z.HasExtensions() && z.EncExt(yy123) { + } else if !yym124 && z.IsJSONHandle() { + z.EncJSONMarshal(yy123) + } else { + z.EncFallback(yy123) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("streamingConnectionIdleTimeout")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy125 := &x.StreamingConnectionIdleTimeout + yym126 := z.EncBinary() + _ = yym126 + if false { + } else if z.HasExtensions() && z.EncExt(yy125) { + } else if !yym126 && z.IsJSONHandle() { + z.EncJSONMarshal(yy125) + } else { + z.EncFallback(yy125) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy128 := &x.NodeStatusUpdateFrequency + yym129 := z.EncBinary() + _ = yym129 + if false { + } else if z.HasExtensions() && z.EncExt(yy128) { + } else if !yym129 && z.IsJSONHandle() { + z.EncJSONMarshal(yy128) + } else { + z.EncFallback(yy128) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeStatusUpdateFrequency")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy130 := &x.NodeStatusUpdateFrequency + yym131 := z.EncBinary() + _ = yym131 + if false { + } else if z.HasExtensions() && z.EncExt(yy130) { + } else if !yym131 && z.IsJSONHandle() { + z.EncJSONMarshal(yy130) + } else { + z.EncFallback(yy130) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym133 := z.EncBinary() + _ = yym133 + if false { + } else { + r.EncodeInt(int64(x.ImageGCHighThresholdPercent)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("imageGCHighThresholdPercent")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym134 := z.EncBinary() + _ = yym134 + if false { + } else { + r.EncodeInt(int64(x.ImageGCHighThresholdPercent)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym136 := z.EncBinary() + _ = yym136 + if false { + } else { + r.EncodeInt(int64(x.ImageGCLowThresholdPercent)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("imageGCLowThresholdPercent")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym137 := z.EncBinary() + _ = yym137 + if false { + } else { + r.EncodeInt(int64(x.ImageGCLowThresholdPercent)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym139 := z.EncBinary() + _ = yym139 + if false { + } else { + r.EncodeInt(int64(x.LowDiskSpaceThresholdMB)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("lowDiskSpaceThresholdMB")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym140 := z.EncBinary() + _ = yym140 + if false { + } else { + r.EncodeInt(int64(x.LowDiskSpaceThresholdMB)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy142 := &x.VolumeStatsAggPeriod + yym143 := z.EncBinary() + _ = yym143 + if false { + } else if z.HasExtensions() && z.EncExt(yy142) { + } else if !yym143 && z.IsJSONHandle() { + z.EncJSONMarshal(yy142) + } else { + z.EncFallback(yy142) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("VolumeStatsAggPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy144 := &x.VolumeStatsAggPeriod + yym145 := z.EncBinary() + _ = yym145 + if false { + } else if z.HasExtensions() && z.EncExt(yy144) { + } else if !yym145 && z.IsJSONHandle() { + z.EncJSONMarshal(yy144) + } else { + z.EncFallback(yy144) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym147 := z.EncBinary() + _ = yym147 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.NetworkPluginName)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("networkPluginName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym148 := z.EncBinary() + _ = yym148 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.NetworkPluginName)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym150 := z.EncBinary() + _ = yym150 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.NetworkPluginDir)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("networkPluginDir")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym151 := z.EncBinary() + _ = yym151 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.NetworkPluginDir)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym153 := z.EncBinary() + _ = yym153 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.VolumePluginDir)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("volumePluginDir")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym154 := z.EncBinary() + _ = yym154 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.VolumePluginDir)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[46] { + yym156 := z.EncBinary() + _ = yym156 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CloudProvider)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[46] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cloudProvider")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym157 := z.EncBinary() + _ = yym157 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CloudProvider)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[47] { + yym159 := z.EncBinary() + _ = yym159 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CloudConfigFile)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[47] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cloudConfigFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym160 := z.EncBinary() + _ = yym160 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CloudConfigFile)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[48] { + yym162 := z.EncBinary() + _ = yym162 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.KubeletCgroups)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[48] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeletCgroups")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym163 := z.EncBinary() + _ = yym163 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.KubeletCgroups)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[49] { + yym165 := z.EncBinary() + _ = yym165 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RuntimeCgroups)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[49] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("runtimeCgroups")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym166 := z.EncBinary() + _ = yym166 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RuntimeCgroups)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[50] { + yym168 := z.EncBinary() + _ = yym168 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SystemCgroups)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[50] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("systemContainer")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym169 := z.EncBinary() + _ = yym169 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SystemCgroups)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[51] { + yym171 := z.EncBinary() + _ = yym171 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CgroupRoot)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[51] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cgroupRoot")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym172 := z.EncBinary() + _ = yym172 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CgroupRoot)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym174 := z.EncBinary() + _ = yym174 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ContainerRuntime)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("containerRuntime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym175 := z.EncBinary() + _ = yym175 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ContainerRuntime)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[53] { + yym177 := z.EncBinary() + _ = yym177 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RktPath)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[53] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rktPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym178 := z.EncBinary() + _ = yym178 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RktPath)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym180 := z.EncBinary() + _ = yym180 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.LockFilePath)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("lockFilePath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym181 := z.EncBinary() + _ = yym181 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.LockFilePath)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[55] { + yym183 := z.EncBinary() + _ = yym183 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RktStage1Image)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[55] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rktStage1Image")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym184 := z.EncBinary() + _ = yym184 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RktStage1Image)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym186 := z.EncBinary() + _ = yym186 + if false { + } else { + r.EncodeBool(bool(x.ConfigureCBR0)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("configureCbr0")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym187 := z.EncBinary() + _ = yym187 + if false { + } else { + r.EncodeBool(bool(x.ConfigureCBR0)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym189 := z.EncBinary() + _ = yym189 + if false { + } else { + r.EncodeBool(bool(x.HairpinMode)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("configureHairpinMode")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym190 := z.EncBinary() + _ = yym190 + if false { + } else { + r.EncodeBool(bool(x.HairpinMode)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym192 := z.EncBinary() + _ = yym192 + if false { + } else { + r.EncodeInt(int64(x.MaxPods)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("maxPods")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym193 := z.EncBinary() + _ = yym193 + if false { + } else { + r.EncodeInt(int64(x.MaxPods)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym195 := z.EncBinary() + _ = yym195 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.DockerExecHandlerName)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("dockerExecHandlerName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym196 := z.EncBinary() + _ = yym196 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.DockerExecHandlerName)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym198 := z.EncBinary() + _ = yym198 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PodCIDR)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("podCIDR")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym199 := z.EncBinary() + _ = yym199 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PodCIDR)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym201 := z.EncBinary() + _ = yym201 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ResolverConfig)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resolvConf")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym202 := z.EncBinary() + _ = yym202 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ResolverConfig)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym204 := z.EncBinary() + _ = yym204 + if false { + } else { + r.EncodeBool(bool(x.CPUCFSQuota)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cpuCFSQuota")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym205 := z.EncBinary() + _ = yym205 + if false { + } else { + r.EncodeBool(bool(x.CPUCFSQuota)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym207 := z.EncBinary() + _ = yym207 + if false { + } else { + r.EncodeBool(bool(x.Containerized)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("containerized")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym208 := z.EncBinary() + _ = yym208 + if false { + } else { + r.EncodeBool(bool(x.Containerized)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym210 := z.EncBinary() + _ = yym210 + if false { + } else { + r.EncodeUint(uint64(x.MaxOpenFiles)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("maxOpenFiles")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym211 := z.EncBinary() + _ = yym211 + if false { + } else { + r.EncodeUint(uint64(x.MaxOpenFiles)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym213 := z.EncBinary() + _ = yym213 + if false { + } else { + r.EncodeBool(bool(x.ReconcileCIDR)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("reconcileCIDR")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym214 := z.EncBinary() + _ = yym214 + if false { + } else { + r.EncodeBool(bool(x.ReconcileCIDR)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym216 := z.EncBinary() + _ = yym216 + if false { + } else { + r.EncodeBool(bool(x.RegisterSchedulable)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("registerSchedulable")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym217 := z.EncBinary() + _ = yym217 + if false { + } else { + r.EncodeBool(bool(x.RegisterSchedulable)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym219 := z.EncBinary() + _ = yym219 + if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIQPS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym220 := z.EncBinary() + _ = yym220 + if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym222 := z.EncBinary() + _ = yym222 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIBurst")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym223 := z.EncBinary() + _ = yym223 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym225 := z.EncBinary() + _ = yym225 + if false { + } else { + r.EncodeBool(bool(x.SerializeImagePulls)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("serializeImagePulls")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym226 := z.EncBinary() + _ = yym226 + if false { + } else { + r.EncodeBool(bool(x.SerializeImagePulls)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym228 := z.EncBinary() + _ = yym228 + if false { + } else { + r.EncodeBool(bool(x.ExperimentalFlannelOverlay)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("experimentalFlannelOverlay")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym229 := z.EncBinary() + _ = yym229 + if false { + } else { + r.EncodeBool(bool(x.ExperimentalFlannelOverlay)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[71] { + yy231 := &x.OutOfDiskTransitionFrequency + yym232 := z.EncBinary() + _ = yym232 + if false { + } else if z.HasExtensions() && z.EncExt(yy231) { + } else if !yym232 && z.IsJSONHandle() { + z.EncJSONMarshal(yy231) + } else { + z.EncFallback(yy231) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[71] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("outOfDiskTransitionFrequency")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy233 := &x.OutOfDiskTransitionFrequency + yym234 := z.EncBinary() + _ = yym234 + if false { + } else if z.HasExtensions() && z.EncExt(yy233) { + } else if !yym234 && z.IsJSONHandle() { + z.EncJSONMarshal(yy233) + } else { + z.EncFallback(yy233) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[72] { + yym236 := z.EncBinary() + _ = yym236 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.NodeIP)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[72] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeIP")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym237 := z.EncBinary() + _ = yym237 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.NodeIP)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.NodeLabels == nil { + r.EncodeNil() + } else { + yym239 := z.EncBinary() + _ = yym239 + if false { + } else { + z.F.EncMapStringStringV(x.NodeLabels, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeLabels")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NodeLabels == nil { + r.EncodeNil() + } else { + yym240 := z.EncBinary() + _ = yym240 + if false { + } else { + z.F.EncMapStringStringV(x.NodeLabels, false, e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym242 := z.EncBinary() + _ = yym242 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.NonMasqueradeCIDR)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nonMasqueradeCIDR")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym243 := z.EncBinary() + _ = yym243 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.NonMasqueradeCIDR)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym245 := z.EncBinary() + _ = yym245 + if false { + } else { + r.EncodeBool(bool(x.EnableCustomMetrics)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("enableCustomMetrics")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym246 := z.EncBinary() + _ = yym246 + if false { + } else { + r.EncodeBool(bool(x.EnableCustomMetrics)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *KubeletConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *KubeletConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "config": + if r.TryDecodeAsNil() { + x.Config = "" + } else { + x.Config = string(r.DecodeString()) + } + case "syncFrequency": + if r.TryDecodeAsNil() { + x.SyncFrequency = pkg1_unversioned.Duration{} + } else { + yyv5 := &x.SyncFrequency + yym6 := z.DecBinary() + _ = yym6 + if false { + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) + } else { + z.DecFallback(yyv5, false) + } + } + case "fileCheckFrequency": + if r.TryDecodeAsNil() { + x.FileCheckFrequency = pkg1_unversioned.Duration{} + } else { + yyv7 := &x.FileCheckFrequency + yym8 := z.DecBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.DecExt(yyv7) { + } else if !yym8 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv7) + } else { + z.DecFallback(yyv7, false) + } + } + case "httpCheckFrequency": + if r.TryDecodeAsNil() { + x.HTTPCheckFrequency = pkg1_unversioned.Duration{} + } else { + yyv9 := &x.HTTPCheckFrequency + yym10 := z.DecBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) + } else { + z.DecFallback(yyv9, false) + } + } + case "manifestURL": + if r.TryDecodeAsNil() { + x.ManifestURL = "" + } else { + x.ManifestURL = string(r.DecodeString()) + } + case "manifestURLHeader": + if r.TryDecodeAsNil() { + x.ManifestURLHeader = "" + } else { + x.ManifestURLHeader = string(r.DecodeString()) + } + case "enableServer": + if r.TryDecodeAsNil() { + x.EnableServer = false + } else { + x.EnableServer = bool(r.DecodeBool()) + } + case "address": + if r.TryDecodeAsNil() { + x.Address = "" + } else { + x.Address = string(r.DecodeString()) + } + case "port": + if r.TryDecodeAsNil() { + x.Port = 0 + } else { + x.Port = uint(r.DecodeUint(codecSelferBitsize1234)) + } + case "readOnlyPort": + if r.TryDecodeAsNil() { + x.ReadOnlyPort = 0 + } else { + x.ReadOnlyPort = uint(r.DecodeUint(codecSelferBitsize1234)) + } + case "tLSCertFile": + if r.TryDecodeAsNil() { + x.TLSCertFile = "" + } else { + x.TLSCertFile = string(r.DecodeString()) + } + case "tLSPrivateKeyFile": + if r.TryDecodeAsNil() { + x.TLSPrivateKeyFile = "" + } else { + x.TLSPrivateKeyFile = string(r.DecodeString()) + } + case "certDirectory": + if r.TryDecodeAsNil() { + x.CertDirectory = "" + } else { + x.CertDirectory = string(r.DecodeString()) + } + case "hostnameOverride": + if r.TryDecodeAsNil() { + x.HostnameOverride = "" + } else { + x.HostnameOverride = string(r.DecodeString()) + } + case "podInfraContainerImage": + if r.TryDecodeAsNil() { + x.PodInfraContainerImage = "" + } else { + x.PodInfraContainerImage = string(r.DecodeString()) + } + case "dockerEndpoint": + if r.TryDecodeAsNil() { + x.DockerEndpoint = "" + } else { + x.DockerEndpoint = string(r.DecodeString()) + } + case "rootDirectory": + if r.TryDecodeAsNil() { + x.RootDirectory = "" + } else { + x.RootDirectory = string(r.DecodeString()) + } + case "allowPrivileged": + if r.TryDecodeAsNil() { + x.AllowPrivileged = false + } else { + x.AllowPrivileged = bool(r.DecodeBool()) + } + case "hostNetworkSources": + if r.TryDecodeAsNil() { + x.HostNetworkSources = "" + } else { + x.HostNetworkSources = string(r.DecodeString()) + } + case "hostPIDSources": + if r.TryDecodeAsNil() { + x.HostPIDSources = "" + } else { + x.HostPIDSources = string(r.DecodeString()) + } + case "hostIPCSources": + if r.TryDecodeAsNil() { + x.HostIPCSources = "" + } else { + x.HostIPCSources = string(r.DecodeString()) + } + case "registryPullQPS": + if r.TryDecodeAsNil() { + x.RegistryPullQPS = 0 + } else { + x.RegistryPullQPS = float64(r.DecodeFloat(false)) + } + case "registryBurst": + if r.TryDecodeAsNil() { + x.RegistryBurst = 0 + } else { + x.RegistryBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "eventRecordQPS": + if r.TryDecodeAsNil() { + x.EventRecordQPS = 0 + } else { + x.EventRecordQPS = float32(r.DecodeFloat(true)) + } + case "eventBurst": + if r.TryDecodeAsNil() { + x.EventBurst = 0 + } else { + x.EventBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "enableDebuggingHandlers": + if r.TryDecodeAsNil() { + x.EnableDebuggingHandlers = false + } else { + x.EnableDebuggingHandlers = bool(r.DecodeBool()) + } + case "minimumGCAge": + if r.TryDecodeAsNil() { + x.MinimumGCAge = pkg1_unversioned.Duration{} + } else { + yyv33 := &x.MinimumGCAge + yym34 := z.DecBinary() + _ = yym34 + if false { + } else if z.HasExtensions() && z.DecExt(yyv33) { + } else if !yym34 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv33) + } else { + z.DecFallback(yyv33, false) + } + } + case "maxPerPodContainerCount": + if r.TryDecodeAsNil() { + x.MaxPerPodContainerCount = 0 + } else { + x.MaxPerPodContainerCount = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "maxContainerCount": + if r.TryDecodeAsNil() { + x.MaxContainerCount = 0 + } else { + x.MaxContainerCount = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "cAdvisorPort": + if r.TryDecodeAsNil() { + x.CAdvisorPort = 0 + } else { + x.CAdvisorPort = uint(r.DecodeUint(codecSelferBitsize1234)) + } + case "healthzPort": + if r.TryDecodeAsNil() { + x.HealthzPort = 0 + } else { + x.HealthzPort = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "healthzBindAddress": + if r.TryDecodeAsNil() { + x.HealthzBindAddress = "" + } else { + x.HealthzBindAddress = string(r.DecodeString()) + } + case "oomScoreAdj": + if r.TryDecodeAsNil() { + x.OOMScoreAdj = 0 + } else { + x.OOMScoreAdj = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "registerNode": + if r.TryDecodeAsNil() { + x.RegisterNode = false + } else { + x.RegisterNode = bool(r.DecodeBool()) + } + case "clusterDomain": + if r.TryDecodeAsNil() { + x.ClusterDomain = "" + } else { + x.ClusterDomain = string(r.DecodeString()) + } + case "masterServiceNamespace": + if r.TryDecodeAsNil() { + x.MasterServiceNamespace = "" + } else { + x.MasterServiceNamespace = string(r.DecodeString()) + } + case "clusterDNS": + if r.TryDecodeAsNil() { + x.ClusterDNS = "" + } else { + x.ClusterDNS = string(r.DecodeString()) + } + case "streamingConnectionIdleTimeout": + if r.TryDecodeAsNil() { + x.StreamingConnectionIdleTimeout = pkg1_unversioned.Duration{} + } else { + yyv45 := &x.StreamingConnectionIdleTimeout + yym46 := z.DecBinary() + _ = yym46 + if false { + } else if z.HasExtensions() && z.DecExt(yyv45) { + } else if !yym46 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv45) + } else { + z.DecFallback(yyv45, false) + } + } + case "nodeStatusUpdateFrequency": + if r.TryDecodeAsNil() { + x.NodeStatusUpdateFrequency = pkg1_unversioned.Duration{} + } else { + yyv47 := &x.NodeStatusUpdateFrequency + yym48 := z.DecBinary() + _ = yym48 + if false { + } else if z.HasExtensions() && z.DecExt(yyv47) { + } else if !yym48 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv47) + } else { + z.DecFallback(yyv47, false) + } + } + case "imageGCHighThresholdPercent": + if r.TryDecodeAsNil() { + x.ImageGCHighThresholdPercent = 0 + } else { + x.ImageGCHighThresholdPercent = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "imageGCLowThresholdPercent": + if r.TryDecodeAsNil() { + x.ImageGCLowThresholdPercent = 0 + } else { + x.ImageGCLowThresholdPercent = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "lowDiskSpaceThresholdMB": + if r.TryDecodeAsNil() { + x.LowDiskSpaceThresholdMB = 0 + } else { + x.LowDiskSpaceThresholdMB = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "VolumeStatsAggPeriod": + if r.TryDecodeAsNil() { + x.VolumeStatsAggPeriod = pkg1_unversioned.Duration{} + } else { + yyv52 := &x.VolumeStatsAggPeriod + yym53 := z.DecBinary() + _ = yym53 + if false { + } else if z.HasExtensions() && z.DecExt(yyv52) { + } else if !yym53 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv52) + } else { + z.DecFallback(yyv52, false) + } + } + case "networkPluginName": + if r.TryDecodeAsNil() { + x.NetworkPluginName = "" + } else { + x.NetworkPluginName = string(r.DecodeString()) + } + case "networkPluginDir": + if r.TryDecodeAsNil() { + x.NetworkPluginDir = "" + } else { + x.NetworkPluginDir = string(r.DecodeString()) + } + case "volumePluginDir": + if r.TryDecodeAsNil() { + x.VolumePluginDir = "" + } else { + x.VolumePluginDir = string(r.DecodeString()) + } + case "cloudProvider": + if r.TryDecodeAsNil() { + x.CloudProvider = "" + } else { + x.CloudProvider = string(r.DecodeString()) + } + case "cloudConfigFile": + if r.TryDecodeAsNil() { + x.CloudConfigFile = "" + } else { + x.CloudConfigFile = string(r.DecodeString()) + } + case "kubeletCgroups": + if r.TryDecodeAsNil() { + x.KubeletCgroups = "" + } else { + x.KubeletCgroups = string(r.DecodeString()) + } + case "runtimeCgroups": + if r.TryDecodeAsNil() { + x.RuntimeCgroups = "" + } else { + x.RuntimeCgroups = string(r.DecodeString()) + } + case "systemContainer": + if r.TryDecodeAsNil() { + x.SystemCgroups = "" + } else { + x.SystemCgroups = string(r.DecodeString()) + } + case "cgroupRoot": + if r.TryDecodeAsNil() { + x.CgroupRoot = "" + } else { + x.CgroupRoot = string(r.DecodeString()) + } + case "containerRuntime": + if r.TryDecodeAsNil() { + x.ContainerRuntime = "" + } else { + x.ContainerRuntime = string(r.DecodeString()) + } + case "rktPath": + if r.TryDecodeAsNil() { + x.RktPath = "" + } else { + x.RktPath = string(r.DecodeString()) + } + case "lockFilePath": + if r.TryDecodeAsNil() { + x.LockFilePath = "" + } else { + x.LockFilePath = string(r.DecodeString()) + } + case "rktStage1Image": + if r.TryDecodeAsNil() { + x.RktStage1Image = "" + } else { + x.RktStage1Image = string(r.DecodeString()) + } + case "configureCbr0": + if r.TryDecodeAsNil() { + x.ConfigureCBR0 = false + } else { + x.ConfigureCBR0 = bool(r.DecodeBool()) + } + case "configureHairpinMode": + if r.TryDecodeAsNil() { + x.HairpinMode = false + } else { + x.HairpinMode = bool(r.DecodeBool()) + } + case "maxPods": + if r.TryDecodeAsNil() { + x.MaxPods = 0 + } else { + x.MaxPods = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "dockerExecHandlerName": + if r.TryDecodeAsNil() { + x.DockerExecHandlerName = "" + } else { + x.DockerExecHandlerName = string(r.DecodeString()) + } + case "podCIDR": + if r.TryDecodeAsNil() { + x.PodCIDR = "" + } else { + x.PodCIDR = string(r.DecodeString()) + } + case "resolvConf": + if r.TryDecodeAsNil() { + x.ResolverConfig = "" + } else { + x.ResolverConfig = string(r.DecodeString()) + } + case "cpuCFSQuota": + if r.TryDecodeAsNil() { + x.CPUCFSQuota = false + } else { + x.CPUCFSQuota = bool(r.DecodeBool()) + } + case "containerized": + if r.TryDecodeAsNil() { + x.Containerized = false + } else { + x.Containerized = bool(r.DecodeBool()) + } + case "maxOpenFiles": + if r.TryDecodeAsNil() { + x.MaxOpenFiles = 0 + } else { + x.MaxOpenFiles = uint64(r.DecodeUint(64)) + } + case "reconcileCIDR": + if r.TryDecodeAsNil() { + x.ReconcileCIDR = false + } else { + x.ReconcileCIDR = bool(r.DecodeBool()) + } + case "registerSchedulable": + if r.TryDecodeAsNil() { + x.RegisterSchedulable = false + } else { + x.RegisterSchedulable = bool(r.DecodeBool()) + } + case "kubeAPIQPS": + if r.TryDecodeAsNil() { + x.KubeAPIQPS = 0 + } else { + x.KubeAPIQPS = float32(r.DecodeFloat(true)) + } + case "kubeAPIBurst": + if r.TryDecodeAsNil() { + x.KubeAPIBurst = 0 + } else { + x.KubeAPIBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "serializeImagePulls": + if r.TryDecodeAsNil() { + x.SerializeImagePulls = false + } else { + x.SerializeImagePulls = bool(r.DecodeBool()) + } + case "experimentalFlannelOverlay": + if r.TryDecodeAsNil() { + x.ExperimentalFlannelOverlay = false + } else { + x.ExperimentalFlannelOverlay = bool(r.DecodeBool()) + } + case "outOfDiskTransitionFrequency": + if r.TryDecodeAsNil() { + x.OutOfDiskTransitionFrequency = pkg1_unversioned.Duration{} + } else { + yyv82 := &x.OutOfDiskTransitionFrequency + yym83 := z.DecBinary() + _ = yym83 + if false { + } else if z.HasExtensions() && z.DecExt(yyv82) { + } else if !yym83 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv82) + } else { + z.DecFallback(yyv82, false) + } + } + case "nodeIP": + if r.TryDecodeAsNil() { + x.NodeIP = "" + } else { + x.NodeIP = string(r.DecodeString()) + } + case "nodeLabels": + if r.TryDecodeAsNil() { + x.NodeLabels = nil + } else { + yyv85 := &x.NodeLabels + yym86 := z.DecBinary() + _ = yym86 + if false { + } else { + z.F.DecMapStringStringX(yyv85, false, d) + } + } + case "nonMasqueradeCIDR": + if r.TryDecodeAsNil() { + x.NonMasqueradeCIDR = "" + } else { + x.NonMasqueradeCIDR = string(r.DecodeString()) + } + case "enableCustomMetrics": + if r.TryDecodeAsNil() { + x.EnableCustomMetrics = false + } else { + x.EnableCustomMetrics = bool(r.DecodeBool()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *KubeletConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj89 int + var yyb89 bool + var yyhl89 bool = l >= 0 + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Config = "" + } else { + x.Config = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SyncFrequency = pkg1_unversioned.Duration{} + } else { + yyv91 := &x.SyncFrequency + yym92 := z.DecBinary() + _ = yym92 + if false { + } else if z.HasExtensions() && z.DecExt(yyv91) { + } else if !yym92 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv91) + } else { + z.DecFallback(yyv91, false) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.FileCheckFrequency = pkg1_unversioned.Duration{} + } else { + yyv93 := &x.FileCheckFrequency + yym94 := z.DecBinary() + _ = yym94 + if false { + } else if z.HasExtensions() && z.DecExt(yyv93) { + } else if !yym94 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv93) + } else { + z.DecFallback(yyv93, false) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HTTPCheckFrequency = pkg1_unversioned.Duration{} + } else { + yyv95 := &x.HTTPCheckFrequency + yym96 := z.DecBinary() + _ = yym96 + if false { + } else if z.HasExtensions() && z.DecExt(yyv95) { + } else if !yym96 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv95) + } else { + z.DecFallback(yyv95, false) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ManifestURL = "" + } else { + x.ManifestURL = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ManifestURLHeader = "" + } else { + x.ManifestURLHeader = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.EnableServer = false + } else { + x.EnableServer = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Address = "" + } else { + x.Address = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Port = 0 + } else { + x.Port = uint(r.DecodeUint(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ReadOnlyPort = 0 + } else { + x.ReadOnlyPort = uint(r.DecodeUint(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TLSCertFile = "" + } else { + x.TLSCertFile = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TLSPrivateKeyFile = "" + } else { + x.TLSPrivateKeyFile = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CertDirectory = "" + } else { + x.CertDirectory = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostnameOverride = "" + } else { + x.HostnameOverride = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PodInfraContainerImage = "" + } else { + x.PodInfraContainerImage = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.DockerEndpoint = "" + } else { + x.DockerEndpoint = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RootDirectory = "" + } else { + x.RootDirectory = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.AllowPrivileged = false + } else { + x.AllowPrivileged = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostNetworkSources = "" + } else { + x.HostNetworkSources = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostPIDSources = "" + } else { + x.HostPIDSources = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostIPCSources = "" + } else { + x.HostIPCSources = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RegistryPullQPS = 0 + } else { + x.RegistryPullQPS = float64(r.DecodeFloat(false)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RegistryBurst = 0 + } else { + x.RegistryBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.EventRecordQPS = 0 + } else { + x.EventRecordQPS = float32(r.DecodeFloat(true)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.EventBurst = 0 + } else { + x.EventBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.EnableDebuggingHandlers = false + } else { + x.EnableDebuggingHandlers = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MinimumGCAge = pkg1_unversioned.Duration{} + } else { + yyv119 := &x.MinimumGCAge + yym120 := z.DecBinary() + _ = yym120 + if false { + } else if z.HasExtensions() && z.DecExt(yyv119) { + } else if !yym120 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv119) + } else { + z.DecFallback(yyv119, false) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MaxPerPodContainerCount = 0 + } else { + x.MaxPerPodContainerCount = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MaxContainerCount = 0 + } else { + x.MaxContainerCount = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CAdvisorPort = 0 + } else { + x.CAdvisorPort = uint(r.DecodeUint(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HealthzPort = 0 + } else { + x.HealthzPort = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HealthzBindAddress = "" + } else { + x.HealthzBindAddress = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.OOMScoreAdj = 0 + } else { + x.OOMScoreAdj = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RegisterNode = false + } else { + x.RegisterNode = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ClusterDomain = "" + } else { + x.ClusterDomain = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MasterServiceNamespace = "" + } else { + x.MasterServiceNamespace = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ClusterDNS = "" + } else { + x.ClusterDNS = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.StreamingConnectionIdleTimeout = pkg1_unversioned.Duration{} + } else { + yyv131 := &x.StreamingConnectionIdleTimeout + yym132 := z.DecBinary() + _ = yym132 + if false { + } else if z.HasExtensions() && z.DecExt(yyv131) { + } else if !yym132 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv131) + } else { + z.DecFallback(yyv131, false) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NodeStatusUpdateFrequency = pkg1_unversioned.Duration{} + } else { + yyv133 := &x.NodeStatusUpdateFrequency + yym134 := z.DecBinary() + _ = yym134 + if false { + } else if z.HasExtensions() && z.DecExt(yyv133) { + } else if !yym134 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv133) + } else { + z.DecFallback(yyv133, false) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ImageGCHighThresholdPercent = 0 + } else { + x.ImageGCHighThresholdPercent = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ImageGCLowThresholdPercent = 0 + } else { + x.ImageGCLowThresholdPercent = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LowDiskSpaceThresholdMB = 0 + } else { + x.LowDiskSpaceThresholdMB = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.VolumeStatsAggPeriod = pkg1_unversioned.Duration{} + } else { + yyv138 := &x.VolumeStatsAggPeriod + yym139 := z.DecBinary() + _ = yym139 + if false { + } else if z.HasExtensions() && z.DecExt(yyv138) { + } else if !yym139 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv138) + } else { + z.DecFallback(yyv138, false) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NetworkPluginName = "" + } else { + x.NetworkPluginName = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NetworkPluginDir = "" + } else { + x.NetworkPluginDir = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.VolumePluginDir = "" + } else { + x.VolumePluginDir = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CloudProvider = "" + } else { + x.CloudProvider = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CloudConfigFile = "" + } else { + x.CloudConfigFile = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeletCgroups = "" + } else { + x.KubeletCgroups = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RuntimeCgroups = "" + } else { + x.RuntimeCgroups = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SystemCgroups = "" + } else { + x.SystemCgroups = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CgroupRoot = "" + } else { + x.CgroupRoot = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ContainerRuntime = "" + } else { + x.ContainerRuntime = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RktPath = "" + } else { + x.RktPath = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LockFilePath = "" + } else { + x.LockFilePath = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RktStage1Image = "" + } else { + x.RktStage1Image = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConfigureCBR0 = false + } else { + x.ConfigureCBR0 = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HairpinMode = false + } else { + x.HairpinMode = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MaxPods = 0 + } else { + x.MaxPods = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.DockerExecHandlerName = "" + } else { + x.DockerExecHandlerName = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PodCIDR = "" + } else { + x.PodCIDR = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ResolverConfig = "" + } else { + x.ResolverConfig = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CPUCFSQuota = false + } else { + x.CPUCFSQuota = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Containerized = false + } else { + x.Containerized = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MaxOpenFiles = 0 + } else { + x.MaxOpenFiles = uint64(r.DecodeUint(64)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ReconcileCIDR = false + } else { + x.ReconcileCIDR = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RegisterSchedulable = false + } else { + x.RegisterSchedulable = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeAPIQPS = 0 + } else { + x.KubeAPIQPS = float32(r.DecodeFloat(true)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeAPIBurst = 0 + } else { + x.KubeAPIBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SerializeImagePulls = false + } else { + x.SerializeImagePulls = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ExperimentalFlannelOverlay = false + } else { + x.ExperimentalFlannelOverlay = bool(r.DecodeBool()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.OutOfDiskTransitionFrequency = pkg1_unversioned.Duration{} + } else { + yyv168 := &x.OutOfDiskTransitionFrequency + yym169 := z.DecBinary() + _ = yym169 + if false { + } else if z.HasExtensions() && z.DecExt(yyv168) { + } else if !yym169 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv168) + } else { + z.DecFallback(yyv168, false) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NodeIP = "" + } else { + x.NodeIP = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NodeLabels = nil + } else { + yyv171 := &x.NodeLabels + yym172 := z.DecBinary() + _ = yym172 + if false { + } else { + z.F.DecMapStringStringX(yyv171, false, d) + } + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NonMasqueradeCIDR = "" + } else { + x.NonMasqueradeCIDR = string(r.DecodeString()) + } + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.EnableCustomMetrics = false + } else { + x.EnableCustomMetrics = bool(r.DecodeBool()) + } + for { + yyj89++ + if yyhl89 { + yyb89 = yyj89 > l + } else { + yyb89 = r.CheckBreak() + } + if yyb89 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj89-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *KubeSchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [11]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[9] = x.Kind != "" + yyq2[10] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(11) + } else { + yynn2 = 9 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Port)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("port")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Port)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("address")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.AlgorithmProvider)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("algorithmProvider")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.AlgorithmProvider)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PolicyConfigFile)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("policyConfigFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PolicyConfigFile)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeBool(bool(x.EnableProfiling)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("enableProfiling")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeBool(bool(x.EnableProfiling)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIQPS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIBurst")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SchedulerName)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("schedulerName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SchedulerName)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy28 := &x.LeaderElection + yy28.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("leaderElection")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy30 := &x.LeaderElection + yy30.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[9] { + yym33 := z.EncBinary() + _ = yym33 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[9] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym34 := z.EncBinary() + _ = yym34 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[10] { + yym36 := z.EncBinary() + _ = yym36 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[10] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym37 := z.EncBinary() + _ = yym37 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *KubeSchedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *KubeSchedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "port": + if r.TryDecodeAsNil() { + x.Port = 0 + } else { + x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "address": + if r.TryDecodeAsNil() { + x.Address = "" + } else { + x.Address = string(r.DecodeString()) + } + case "algorithmProvider": + if r.TryDecodeAsNil() { + x.AlgorithmProvider = "" + } else { + x.AlgorithmProvider = string(r.DecodeString()) + } + case "policyConfigFile": + if r.TryDecodeAsNil() { + x.PolicyConfigFile = "" + } else { + x.PolicyConfigFile = string(r.DecodeString()) + } + case "enableProfiling": + if r.TryDecodeAsNil() { + x.EnableProfiling = false + } else { + x.EnableProfiling = bool(r.DecodeBool()) + } + case "kubeAPIQPS": + if r.TryDecodeAsNil() { + x.KubeAPIQPS = 0 + } else { + x.KubeAPIQPS = float32(r.DecodeFloat(true)) + } + case "kubeAPIBurst": + if r.TryDecodeAsNil() { + x.KubeAPIBurst = 0 + } else { + x.KubeAPIBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "schedulerName": + if r.TryDecodeAsNil() { + x.SchedulerName = "" + } else { + x.SchedulerName = string(r.DecodeString()) + } + case "leaderElection": + if r.TryDecodeAsNil() { + x.LeaderElection = LeaderElectionConfiguration{} + } else { + yyv12 := &x.LeaderElection + yyv12.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *KubeSchedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj15 int + var yyb15 bool + var yyhl15 bool = l >= 0 + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Port = 0 + } else { + x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Address = "" + } else { + x.Address = string(r.DecodeString()) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.AlgorithmProvider = "" + } else { + x.AlgorithmProvider = string(r.DecodeString()) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PolicyConfigFile = "" + } else { + x.PolicyConfigFile = string(r.DecodeString()) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.EnableProfiling = false + } else { + x.EnableProfiling = bool(r.DecodeBool()) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeAPIQPS = 0 + } else { + x.KubeAPIQPS = float32(r.DecodeFloat(true)) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeAPIBurst = 0 + } else { + x.KubeAPIBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SchedulerName = "" + } else { + x.SchedulerName = string(r.DecodeString()) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LeaderElection = LeaderElectionConfiguration{} + } else { + yyv24 := &x.LeaderElection + yyv24.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj15-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *LeaderElectionConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 4 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.LeaderElect)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("leaderElect")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.LeaderElect)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.LeaseDuration + yym8 := z.EncBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) + } else { + z.EncFallback(yy7) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("leaseDuration")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.LeaseDuration + yym10 := z.EncBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) + } else { + z.EncFallback(yy9) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy12 := &x.RenewDeadline + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else if !yym13 && z.IsJSONHandle() { + z.EncJSONMarshal(yy12) + } else { + z.EncFallback(yy12) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("renewDeadline")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy14 := &x.RenewDeadline + yym15 := z.EncBinary() + _ = yym15 + if false { + } else if z.HasExtensions() && z.EncExt(yy14) { + } else if !yym15 && z.IsJSONHandle() { + z.EncJSONMarshal(yy14) + } else { + z.EncFallback(yy14) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy17 := &x.RetryPeriod + yym18 := z.EncBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.EncExt(yy17) { + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(yy17) + } else { + z.EncFallback(yy17) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("retryPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy19 := &x.RetryPeriod + yym20 := z.EncBinary() + _ = yym20 + if false { + } else if z.HasExtensions() && z.EncExt(yy19) { + } else if !yym20 && z.IsJSONHandle() { + z.EncJSONMarshal(yy19) + } else { + z.EncFallback(yy19) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *LeaderElectionConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *LeaderElectionConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "leaderElect": + if r.TryDecodeAsNil() { + x.LeaderElect = false + } else { + x.LeaderElect = bool(r.DecodeBool()) + } + case "leaseDuration": + if r.TryDecodeAsNil() { + x.LeaseDuration = pkg1_unversioned.Duration{} + } else { + yyv5 := &x.LeaseDuration + yym6 := z.DecBinary() + _ = yym6 + if false { + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) + } else { + z.DecFallback(yyv5, false) + } + } + case "renewDeadline": + if r.TryDecodeAsNil() { + x.RenewDeadline = pkg1_unversioned.Duration{} + } else { + yyv7 := &x.RenewDeadline + yym8 := z.DecBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.DecExt(yyv7) { + } else if !yym8 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv7) + } else { + z.DecFallback(yyv7, false) + } + } + case "retryPeriod": + if r.TryDecodeAsNil() { + x.RetryPeriod = pkg1_unversioned.Duration{} + } else { + yyv9 := &x.RetryPeriod + yym10 := z.DecBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) + } else { + z.DecFallback(yyv9, false) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *LeaderElectionConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LeaderElect = false + } else { + x.LeaderElect = bool(r.DecodeBool()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LeaseDuration = pkg1_unversioned.Duration{} + } else { + yyv13 := &x.LeaseDuration + yym14 := z.DecBinary() + _ = yym14 + if false { + } else if z.HasExtensions() && z.DecExt(yyv13) { + } else if !yym14 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv13) + } else { + z.DecFallback(yyv13, false) + } + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RenewDeadline = pkg1_unversioned.Duration{} + } else { + yyv15 := &x.RenewDeadline + yym16 := z.DecBinary() + _ = yym16 + if false { + } else if z.HasExtensions() && z.DecExt(yyv15) { + } else if !yym16 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv15) + } else { + z.DecFallback(yyv15, false) + } + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RetryPeriod = pkg1_unversioned.Duration{} + } else { + yyv17 := &x.RetryPeriod + yym18 := z.DecBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else if !yym18 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv17) + } else { + z.DecFallback(yyv17, false) + } + } + for { + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *KubeControllerManagerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [40]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[38] = x.Kind != "" + yyq2[39] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(40) + } else { + yynn2 = 38 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Port)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("port")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Port)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("address")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Address)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CloudProvider)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cloudProvider")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CloudProvider)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CloudConfigFile)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("cloudConfigFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.CloudConfigFile)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentEndpointSyncs)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("concurrentEndpointSyncs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentEndpointSyncs)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentRSSyncs)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("concurrentRSSyncs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentRSSyncs)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentRCSyncs)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("concurrentRCSyncs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentRCSyncs)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentResourceQuotaSyncs)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("concurrentResourceQuotaSyncs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentResourceQuotaSyncs)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym28 := z.EncBinary() + _ = yym28 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentDeploymentSyncs)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("concurrentDeploymentSyncs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym29 := z.EncBinary() + _ = yym29 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentDeploymentSyncs)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym31 := z.EncBinary() + _ = yym31 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentDaemonSetSyncs)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("concurrentDaemonSetSyncs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym32 := z.EncBinary() + _ = yym32 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentDaemonSetSyncs)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym34 := z.EncBinary() + _ = yym34 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentJobSyncs)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("concurrentJobSyncs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym35 := z.EncBinary() + _ = yym35 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentJobSyncs)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym37 := z.EncBinary() + _ = yym37 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentNamespaceSyncs)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("concurrentNamespaceSyncs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym38 := z.EncBinary() + _ = yym38 + if false { + } else { + r.EncodeInt(int64(x.ConcurrentNamespaceSyncs)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy40 := &x.ServiceSyncPeriod + yym41 := z.EncBinary() + _ = yym41 + if false { + } else if z.HasExtensions() && z.EncExt(yy40) { + } else if !yym41 && z.IsJSONHandle() { + z.EncJSONMarshal(yy40) + } else { + z.EncFallback(yy40) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("serviceSyncPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy42 := &x.ServiceSyncPeriod + yym43 := z.EncBinary() + _ = yym43 + if false { + } else if z.HasExtensions() && z.EncExt(yy42) { + } else if !yym43 && z.IsJSONHandle() { + z.EncJSONMarshal(yy42) + } else { + z.EncFallback(yy42) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy45 := &x.NodeSyncPeriod + yym46 := z.EncBinary() + _ = yym46 + if false { + } else if z.HasExtensions() && z.EncExt(yy45) { + } else if !yym46 && z.IsJSONHandle() { + z.EncJSONMarshal(yy45) + } else { + z.EncFallback(yy45) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeSyncPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy47 := &x.NodeSyncPeriod + yym48 := z.EncBinary() + _ = yym48 + if false { + } else if z.HasExtensions() && z.EncExt(yy47) { + } else if !yym48 && z.IsJSONHandle() { + z.EncJSONMarshal(yy47) + } else { + z.EncFallback(yy47) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy50 := &x.ResourceQuotaSyncPeriod + yym51 := z.EncBinary() + _ = yym51 + if false { + } else if z.HasExtensions() && z.EncExt(yy50) { + } else if !yym51 && z.IsJSONHandle() { + z.EncJSONMarshal(yy50) + } else { + z.EncFallback(yy50) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resourceQuotaSyncPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy52 := &x.ResourceQuotaSyncPeriod + yym53 := z.EncBinary() + _ = yym53 + if false { + } else if z.HasExtensions() && z.EncExt(yy52) { + } else if !yym53 && z.IsJSONHandle() { + z.EncJSONMarshal(yy52) + } else { + z.EncFallback(yy52) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy55 := &x.NamespaceSyncPeriod + yym56 := z.EncBinary() + _ = yym56 + if false { + } else if z.HasExtensions() && z.EncExt(yy55) { + } else if !yym56 && z.IsJSONHandle() { + z.EncJSONMarshal(yy55) + } else { + z.EncFallback(yy55) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("namespaceSyncPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy57 := &x.NamespaceSyncPeriod + yym58 := z.EncBinary() + _ = yym58 + if false { + } else if z.HasExtensions() && z.EncExt(yy57) { + } else if !yym58 && z.IsJSONHandle() { + z.EncJSONMarshal(yy57) + } else { + z.EncFallback(yy57) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy60 := &x.PVClaimBinderSyncPeriod + yym61 := z.EncBinary() + _ = yym61 + if false { + } else if z.HasExtensions() && z.EncExt(yy60) { + } else if !yym61 && z.IsJSONHandle() { + z.EncJSONMarshal(yy60) + } else { + z.EncFallback(yy60) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("pvClaimBinderSyncPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy62 := &x.PVClaimBinderSyncPeriod + yym63 := z.EncBinary() + _ = yym63 + if false { + } else if z.HasExtensions() && z.EncExt(yy62) { + } else if !yym63 && z.IsJSONHandle() { + z.EncJSONMarshal(yy62) + } else { + z.EncFallback(yy62) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy65 := &x.MinResyncPeriod + yym66 := z.EncBinary() + _ = yym66 + if false { + } else if z.HasExtensions() && z.EncExt(yy65) { + } else if !yym66 && z.IsJSONHandle() { + z.EncJSONMarshal(yy65) + } else { + z.EncFallback(yy65) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("minResyncPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy67 := &x.MinResyncPeriod + yym68 := z.EncBinary() + _ = yym68 + if false { + } else if z.HasExtensions() && z.EncExt(yy67) { + } else if !yym68 && z.IsJSONHandle() { + z.EncJSONMarshal(yy67) + } else { + z.EncFallback(yy67) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym70 := z.EncBinary() + _ = yym70 + if false { + } else { + r.EncodeInt(int64(x.TerminatedPodGCThreshold)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("terminatedPodGCThreshold")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym71 := z.EncBinary() + _ = yym71 + if false { + } else { + r.EncodeInt(int64(x.TerminatedPodGCThreshold)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy73 := &x.HorizontalPodAutoscalerSyncPeriod + yym74 := z.EncBinary() + _ = yym74 + if false { + } else if z.HasExtensions() && z.EncExt(yy73) { + } else if !yym74 && z.IsJSONHandle() { + z.EncJSONMarshal(yy73) + } else { + z.EncFallback(yy73) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("horizontalPodAutoscalerSyncPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy75 := &x.HorizontalPodAutoscalerSyncPeriod + yym76 := z.EncBinary() + _ = yym76 + if false { + } else if z.HasExtensions() && z.EncExt(yy75) { + } else if !yym76 && z.IsJSONHandle() { + z.EncJSONMarshal(yy75) + } else { + z.EncFallback(yy75) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy78 := &x.DeploymentControllerSyncPeriod + yym79 := z.EncBinary() + _ = yym79 + if false { + } else if z.HasExtensions() && z.EncExt(yy78) { + } else if !yym79 && z.IsJSONHandle() { + z.EncJSONMarshal(yy78) + } else { + z.EncFallback(yy78) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("deploymentControllerSyncPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy80 := &x.DeploymentControllerSyncPeriod + yym81 := z.EncBinary() + _ = yym81 + if false { + } else if z.HasExtensions() && z.EncExt(yy80) { + } else if !yym81 && z.IsJSONHandle() { + z.EncJSONMarshal(yy80) + } else { + z.EncFallback(yy80) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy83 := &x.PodEvictionTimeout + yym84 := z.EncBinary() + _ = yym84 + if false { + } else if z.HasExtensions() && z.EncExt(yy83) { + } else if !yym84 && z.IsJSONHandle() { + z.EncJSONMarshal(yy83) + } else { + z.EncFallback(yy83) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("podEvictionTimeout")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy85 := &x.PodEvictionTimeout + yym86 := z.EncBinary() + _ = yym86 + if false { + } else if z.HasExtensions() && z.EncExt(yy85) { + } else if !yym86 && z.IsJSONHandle() { + z.EncJSONMarshal(yy85) + } else { + z.EncFallback(yy85) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym88 := z.EncBinary() + _ = yym88 + if false { + } else { + r.EncodeFloat32(float32(x.DeletingPodsQps)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("deletingPodsQps")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym89 := z.EncBinary() + _ = yym89 + if false { + } else { + r.EncodeFloat32(float32(x.DeletingPodsQps)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym91 := z.EncBinary() + _ = yym91 + if false { + } else { + r.EncodeInt(int64(x.DeletingPodsBurst)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("deletingPodsBurst")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym92 := z.EncBinary() + _ = yym92 + if false { + } else { + r.EncodeInt(int64(x.DeletingPodsBurst)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy94 := &x.NodeMonitorGracePeriod + yym95 := z.EncBinary() + _ = yym95 + if false { + } else if z.HasExtensions() && z.EncExt(yy94) { + } else if !yym95 && z.IsJSONHandle() { + z.EncJSONMarshal(yy94) + } else { + z.EncFallback(yy94) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeMonitorGracePeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy96 := &x.NodeMonitorGracePeriod + yym97 := z.EncBinary() + _ = yym97 + if false { + } else if z.HasExtensions() && z.EncExt(yy96) { + } else if !yym97 && z.IsJSONHandle() { + z.EncJSONMarshal(yy96) + } else { + z.EncFallback(yy96) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym99 := z.EncBinary() + _ = yym99 + if false { + } else { + r.EncodeInt(int64(x.RegisterRetryCount)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("registerRetryCount")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym100 := z.EncBinary() + _ = yym100 + if false { + } else { + r.EncodeInt(int64(x.RegisterRetryCount)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy102 := &x.NodeStartupGracePeriod + yym103 := z.EncBinary() + _ = yym103 + if false { + } else if z.HasExtensions() && z.EncExt(yy102) { + } else if !yym103 && z.IsJSONHandle() { + z.EncJSONMarshal(yy102) + } else { + z.EncFallback(yy102) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeStartupGracePeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy104 := &x.NodeStartupGracePeriod + yym105 := z.EncBinary() + _ = yym105 + if false { + } else if z.HasExtensions() && z.EncExt(yy104) { + } else if !yym105 && z.IsJSONHandle() { + z.EncJSONMarshal(yy104) + } else { + z.EncFallback(yy104) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy107 := &x.NodeMonitorPeriod + yym108 := z.EncBinary() + _ = yym108 + if false { + } else if z.HasExtensions() && z.EncExt(yy107) { + } else if !yym108 && z.IsJSONHandle() { + z.EncJSONMarshal(yy107) + } else { + z.EncFallback(yy107) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nodeMonitorPeriod")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy109 := &x.NodeMonitorPeriod + yym110 := z.EncBinary() + _ = yym110 + if false { + } else if z.HasExtensions() && z.EncExt(yy109) { + } else if !yym110 && z.IsJSONHandle() { + z.EncJSONMarshal(yy109) + } else { + z.EncFallback(yy109) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym112 := z.EncBinary() + _ = yym112 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ServiceAccountKeyFile)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("serviceAccountKeyFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym113 := z.EncBinary() + _ = yym113 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ServiceAccountKeyFile)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym115 := z.EncBinary() + _ = yym115 + if false { + } else { + r.EncodeBool(bool(x.EnableProfiling)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("enableProfiling")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym116 := z.EncBinary() + _ = yym116 + if false { + } else { + r.EncodeBool(bool(x.EnableProfiling)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym118 := z.EncBinary() + _ = yym118 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ClusterName)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("clusterName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym119 := z.EncBinary() + _ = yym119 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ClusterName)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym121 := z.EncBinary() + _ = yym121 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ClusterCIDR)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("clusterCIDR")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym122 := z.EncBinary() + _ = yym122 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ClusterCIDR)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym124 := z.EncBinary() + _ = yym124 + if false { + } else { + r.EncodeBool(bool(x.AllocateNodeCIDRs)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("allocateNodeCIDRs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym125 := z.EncBinary() + _ = yym125 + if false { + } else { + r.EncodeBool(bool(x.AllocateNodeCIDRs)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym127 := z.EncBinary() + _ = yym127 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RootCAFile)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rootCAFile")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym128 := z.EncBinary() + _ = yym128 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RootCAFile)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym130 := z.EncBinary() + _ = yym130 + if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIQPS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym131 := z.EncBinary() + _ = yym131 + if false { + } else { + r.EncodeFloat32(float32(x.KubeAPIQPS)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym133 := z.EncBinary() + _ = yym133 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kubeAPIBurst")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym134 := z.EncBinary() + _ = yym134 + if false { + } else { + r.EncodeInt(int64(x.KubeAPIBurst)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy136 := &x.LeaderElection + yy136.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("leaderElection")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy138 := &x.LeaderElection + yy138.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy141 := &x.VolumeConfiguration + yy141.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("volumeConfiguration")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy143 := &x.VolumeConfiguration + yy143.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[38] { + yym146 := z.EncBinary() + _ = yym146 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[38] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym147 := z.EncBinary() + _ = yym147 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[39] { + yym149 := z.EncBinary() + _ = yym149 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[39] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym150 := z.EncBinary() + _ = yym150 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *KubeControllerManagerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *KubeControllerManagerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "port": + if r.TryDecodeAsNil() { + x.Port = 0 + } else { + x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "address": + if r.TryDecodeAsNil() { + x.Address = "" + } else { + x.Address = string(r.DecodeString()) + } + case "cloudProvider": + if r.TryDecodeAsNil() { + x.CloudProvider = "" + } else { + x.CloudProvider = string(r.DecodeString()) + } + case "cloudConfigFile": + if r.TryDecodeAsNil() { + x.CloudConfigFile = "" + } else { + x.CloudConfigFile = string(r.DecodeString()) + } + case "concurrentEndpointSyncs": + if r.TryDecodeAsNil() { + x.ConcurrentEndpointSyncs = 0 + } else { + x.ConcurrentEndpointSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "concurrentRSSyncs": + if r.TryDecodeAsNil() { + x.ConcurrentRSSyncs = 0 + } else { + x.ConcurrentRSSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "concurrentRCSyncs": + if r.TryDecodeAsNil() { + x.ConcurrentRCSyncs = 0 + } else { + x.ConcurrentRCSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "concurrentResourceQuotaSyncs": + if r.TryDecodeAsNil() { + x.ConcurrentResourceQuotaSyncs = 0 + } else { + x.ConcurrentResourceQuotaSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "concurrentDeploymentSyncs": + if r.TryDecodeAsNil() { + x.ConcurrentDeploymentSyncs = 0 + } else { + x.ConcurrentDeploymentSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "concurrentDaemonSetSyncs": + if r.TryDecodeAsNil() { + x.ConcurrentDaemonSetSyncs = 0 + } else { + x.ConcurrentDaemonSetSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "concurrentJobSyncs": + if r.TryDecodeAsNil() { + x.ConcurrentJobSyncs = 0 + } else { + x.ConcurrentJobSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "concurrentNamespaceSyncs": + if r.TryDecodeAsNil() { + x.ConcurrentNamespaceSyncs = 0 + } else { + x.ConcurrentNamespaceSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "serviceSyncPeriod": + if r.TryDecodeAsNil() { + x.ServiceSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv16 := &x.ServiceSyncPeriod + yym17 := z.DecBinary() + _ = yym17 + if false { + } else if z.HasExtensions() && z.DecExt(yyv16) { + } else if !yym17 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv16) + } else { + z.DecFallback(yyv16, false) + } + } + case "nodeSyncPeriod": + if r.TryDecodeAsNil() { + x.NodeSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv18 := &x.NodeSyncPeriod + yym19 := z.DecBinary() + _ = yym19 + if false { + } else if z.HasExtensions() && z.DecExt(yyv18) { + } else if !yym19 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv18) + } else { + z.DecFallback(yyv18, false) + } + } + case "resourceQuotaSyncPeriod": + if r.TryDecodeAsNil() { + x.ResourceQuotaSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv20 := &x.ResourceQuotaSyncPeriod + yym21 := z.DecBinary() + _ = yym21 + if false { + } else if z.HasExtensions() && z.DecExt(yyv20) { + } else if !yym21 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv20) + } else { + z.DecFallback(yyv20, false) + } + } + case "namespaceSyncPeriod": + if r.TryDecodeAsNil() { + x.NamespaceSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv22 := &x.NamespaceSyncPeriod + yym23 := z.DecBinary() + _ = yym23 + if false { + } else if z.HasExtensions() && z.DecExt(yyv22) { + } else if !yym23 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv22) + } else { + z.DecFallback(yyv22, false) + } + } + case "pvClaimBinderSyncPeriod": + if r.TryDecodeAsNil() { + x.PVClaimBinderSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv24 := &x.PVClaimBinderSyncPeriod + yym25 := z.DecBinary() + _ = yym25 + if false { + } else if z.HasExtensions() && z.DecExt(yyv24) { + } else if !yym25 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv24) + } else { + z.DecFallback(yyv24, false) + } + } + case "minResyncPeriod": + if r.TryDecodeAsNil() { + x.MinResyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv26 := &x.MinResyncPeriod + yym27 := z.DecBinary() + _ = yym27 + if false { + } else if z.HasExtensions() && z.DecExt(yyv26) { + } else if !yym27 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv26) + } else { + z.DecFallback(yyv26, false) + } + } + case "terminatedPodGCThreshold": + if r.TryDecodeAsNil() { + x.TerminatedPodGCThreshold = 0 + } else { + x.TerminatedPodGCThreshold = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "horizontalPodAutoscalerSyncPeriod": + if r.TryDecodeAsNil() { + x.HorizontalPodAutoscalerSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv29 := &x.HorizontalPodAutoscalerSyncPeriod + yym30 := z.DecBinary() + _ = yym30 + if false { + } else if z.HasExtensions() && z.DecExt(yyv29) { + } else if !yym30 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv29) + } else { + z.DecFallback(yyv29, false) + } + } + case "deploymentControllerSyncPeriod": + if r.TryDecodeAsNil() { + x.DeploymentControllerSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv31 := &x.DeploymentControllerSyncPeriod + yym32 := z.DecBinary() + _ = yym32 + if false { + } else if z.HasExtensions() && z.DecExt(yyv31) { + } else if !yym32 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv31) + } else { + z.DecFallback(yyv31, false) + } + } + case "podEvictionTimeout": + if r.TryDecodeAsNil() { + x.PodEvictionTimeout = pkg1_unversioned.Duration{} + } else { + yyv33 := &x.PodEvictionTimeout + yym34 := z.DecBinary() + _ = yym34 + if false { + } else if z.HasExtensions() && z.DecExt(yyv33) { + } else if !yym34 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv33) + } else { + z.DecFallback(yyv33, false) + } + } + case "deletingPodsQps": + if r.TryDecodeAsNil() { + x.DeletingPodsQps = 0 + } else { + x.DeletingPodsQps = float32(r.DecodeFloat(true)) + } + case "deletingPodsBurst": + if r.TryDecodeAsNil() { + x.DeletingPodsBurst = 0 + } else { + x.DeletingPodsBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "nodeMonitorGracePeriod": + if r.TryDecodeAsNil() { + x.NodeMonitorGracePeriod = pkg1_unversioned.Duration{} + } else { + yyv37 := &x.NodeMonitorGracePeriod + yym38 := z.DecBinary() + _ = yym38 + if false { + } else if z.HasExtensions() && z.DecExt(yyv37) { + } else if !yym38 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv37) + } else { + z.DecFallback(yyv37, false) + } + } + case "registerRetryCount": + if r.TryDecodeAsNil() { + x.RegisterRetryCount = 0 + } else { + x.RegisterRetryCount = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "nodeStartupGracePeriod": + if r.TryDecodeAsNil() { + x.NodeStartupGracePeriod = pkg1_unversioned.Duration{} + } else { + yyv40 := &x.NodeStartupGracePeriod + yym41 := z.DecBinary() + _ = yym41 + if false { + } else if z.HasExtensions() && z.DecExt(yyv40) { + } else if !yym41 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv40) + } else { + z.DecFallback(yyv40, false) + } + } + case "nodeMonitorPeriod": + if r.TryDecodeAsNil() { + x.NodeMonitorPeriod = pkg1_unversioned.Duration{} + } else { + yyv42 := &x.NodeMonitorPeriod + yym43 := z.DecBinary() + _ = yym43 + if false { + } else if z.HasExtensions() && z.DecExt(yyv42) { + } else if !yym43 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv42) + } else { + z.DecFallback(yyv42, false) + } + } + case "serviceAccountKeyFile": + if r.TryDecodeAsNil() { + x.ServiceAccountKeyFile = "" + } else { + x.ServiceAccountKeyFile = string(r.DecodeString()) + } + case "enableProfiling": + if r.TryDecodeAsNil() { + x.EnableProfiling = false + } else { + x.EnableProfiling = bool(r.DecodeBool()) + } + case "clusterName": + if r.TryDecodeAsNil() { + x.ClusterName = "" + } else { + x.ClusterName = string(r.DecodeString()) + } + case "clusterCIDR": + if r.TryDecodeAsNil() { + x.ClusterCIDR = "" + } else { + x.ClusterCIDR = string(r.DecodeString()) + } + case "allocateNodeCIDRs": + if r.TryDecodeAsNil() { + x.AllocateNodeCIDRs = false + } else { + x.AllocateNodeCIDRs = bool(r.DecodeBool()) + } + case "rootCAFile": + if r.TryDecodeAsNil() { + x.RootCAFile = "" + } else { + x.RootCAFile = string(r.DecodeString()) + } + case "kubeAPIQPS": + if r.TryDecodeAsNil() { + x.KubeAPIQPS = 0 + } else { + x.KubeAPIQPS = float32(r.DecodeFloat(true)) + } + case "kubeAPIBurst": + if r.TryDecodeAsNil() { + x.KubeAPIBurst = 0 + } else { + x.KubeAPIBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "leaderElection": + if r.TryDecodeAsNil() { + x.LeaderElection = LeaderElectionConfiguration{} + } else { + yyv52 := &x.LeaderElection + yyv52.CodecDecodeSelf(d) + } + case "volumeConfiguration": + if r.TryDecodeAsNil() { + x.VolumeConfiguration = VolumeConfiguration{} + } else { + yyv53 := &x.VolumeConfiguration + yyv53.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *KubeControllerManagerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj56 int + var yyb56 bool + var yyhl56 bool = l >= 0 + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Port = 0 + } else { + x.Port = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Address = "" + } else { + x.Address = string(r.DecodeString()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CloudProvider = "" + } else { + x.CloudProvider = string(r.DecodeString()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CloudConfigFile = "" + } else { + x.CloudConfigFile = string(r.DecodeString()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConcurrentEndpointSyncs = 0 + } else { + x.ConcurrentEndpointSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConcurrentRSSyncs = 0 + } else { + x.ConcurrentRSSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConcurrentRCSyncs = 0 + } else { + x.ConcurrentRCSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConcurrentResourceQuotaSyncs = 0 + } else { + x.ConcurrentResourceQuotaSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConcurrentDeploymentSyncs = 0 + } else { + x.ConcurrentDeploymentSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConcurrentDaemonSetSyncs = 0 + } else { + x.ConcurrentDaemonSetSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConcurrentJobSyncs = 0 + } else { + x.ConcurrentJobSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ConcurrentNamespaceSyncs = 0 + } else { + x.ConcurrentNamespaceSyncs = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ServiceSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv69 := &x.ServiceSyncPeriod + yym70 := z.DecBinary() + _ = yym70 + if false { + } else if z.HasExtensions() && z.DecExt(yyv69) { + } else if !yym70 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv69) + } else { + z.DecFallback(yyv69, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NodeSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv71 := &x.NodeSyncPeriod + yym72 := z.DecBinary() + _ = yym72 + if false { + } else if z.HasExtensions() && z.DecExt(yyv71) { + } else if !yym72 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv71) + } else { + z.DecFallback(yyv71, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ResourceQuotaSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv73 := &x.ResourceQuotaSyncPeriod + yym74 := z.DecBinary() + _ = yym74 + if false { + } else if z.HasExtensions() && z.DecExt(yyv73) { + } else if !yym74 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv73) + } else { + z.DecFallback(yyv73, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NamespaceSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv75 := &x.NamespaceSyncPeriod + yym76 := z.DecBinary() + _ = yym76 + if false { + } else if z.HasExtensions() && z.DecExt(yyv75) { + } else if !yym76 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv75) + } else { + z.DecFallback(yyv75, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PVClaimBinderSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv77 := &x.PVClaimBinderSyncPeriod + yym78 := z.DecBinary() + _ = yym78 + if false { + } else if z.HasExtensions() && z.DecExt(yyv77) { + } else if !yym78 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv77) + } else { + z.DecFallback(yyv77, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MinResyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv79 := &x.MinResyncPeriod + yym80 := z.DecBinary() + _ = yym80 + if false { + } else if z.HasExtensions() && z.DecExt(yyv79) { + } else if !yym80 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv79) + } else { + z.DecFallback(yyv79, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TerminatedPodGCThreshold = 0 + } else { + x.TerminatedPodGCThreshold = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HorizontalPodAutoscalerSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv82 := &x.HorizontalPodAutoscalerSyncPeriod + yym83 := z.DecBinary() + _ = yym83 + if false { + } else if z.HasExtensions() && z.DecExt(yyv82) { + } else if !yym83 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv82) + } else { + z.DecFallback(yyv82, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.DeploymentControllerSyncPeriod = pkg1_unversioned.Duration{} + } else { + yyv84 := &x.DeploymentControllerSyncPeriod + yym85 := z.DecBinary() + _ = yym85 + if false { + } else if z.HasExtensions() && z.DecExt(yyv84) { + } else if !yym85 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv84) + } else { + z.DecFallback(yyv84, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PodEvictionTimeout = pkg1_unversioned.Duration{} + } else { + yyv86 := &x.PodEvictionTimeout + yym87 := z.DecBinary() + _ = yym87 + if false { + } else if z.HasExtensions() && z.DecExt(yyv86) { + } else if !yym87 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv86) + } else { + z.DecFallback(yyv86, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.DeletingPodsQps = 0 + } else { + x.DeletingPodsQps = float32(r.DecodeFloat(true)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.DeletingPodsBurst = 0 + } else { + x.DeletingPodsBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NodeMonitorGracePeriod = pkg1_unversioned.Duration{} + } else { + yyv90 := &x.NodeMonitorGracePeriod + yym91 := z.DecBinary() + _ = yym91 + if false { + } else if z.HasExtensions() && z.DecExt(yyv90) { + } else if !yym91 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv90) + } else { + z.DecFallback(yyv90, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RegisterRetryCount = 0 + } else { + x.RegisterRetryCount = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NodeStartupGracePeriod = pkg1_unversioned.Duration{} + } else { + yyv93 := &x.NodeStartupGracePeriod + yym94 := z.DecBinary() + _ = yym94 + if false { + } else if z.HasExtensions() && z.DecExt(yyv93) { + } else if !yym94 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv93) + } else { + z.DecFallback(yyv93, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NodeMonitorPeriod = pkg1_unversioned.Duration{} + } else { + yyv95 := &x.NodeMonitorPeriod + yym96 := z.DecBinary() + _ = yym96 + if false { + } else if z.HasExtensions() && z.DecExt(yyv95) { + } else if !yym96 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv95) + } else { + z.DecFallback(yyv95, false) + } + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ServiceAccountKeyFile = "" + } else { + x.ServiceAccountKeyFile = string(r.DecodeString()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.EnableProfiling = false + } else { + x.EnableProfiling = bool(r.DecodeBool()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ClusterName = "" + } else { + x.ClusterName = string(r.DecodeString()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ClusterCIDR = "" + } else { + x.ClusterCIDR = string(r.DecodeString()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.AllocateNodeCIDRs = false + } else { + x.AllocateNodeCIDRs = bool(r.DecodeBool()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RootCAFile = "" + } else { + x.RootCAFile = string(r.DecodeString()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeAPIQPS = 0 + } else { + x.KubeAPIQPS = float32(r.DecodeFloat(true)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.KubeAPIBurst = 0 + } else { + x.KubeAPIBurst = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LeaderElection = LeaderElectionConfiguration{} + } else { + yyv105 := &x.LeaderElection + yyv105.CodecDecodeSelf(d) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.VolumeConfiguration = VolumeConfiguration{} + } else { + yyv106 := &x.VolumeConfiguration + yyv106.CodecDecodeSelf(d) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj56++ + if yyhl56 { + yyb56 = yyj56 > l + } else { + yyb56 = r.CheckBreak() + } + if yyb56 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj56-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *VolumeConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.EnableHostPathProvisioning)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("enableHostPathProvisioning")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.EnableHostPathProvisioning)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.PersistentVolumeRecyclerConfiguration + yy7.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("persitentVolumeRecyclerConfiguration")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.PersistentVolumeRecyclerConfiguration + yy9.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *VolumeConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *VolumeConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "enableHostPathProvisioning": + if r.TryDecodeAsNil() { + x.EnableHostPathProvisioning = false + } else { + x.EnableHostPathProvisioning = bool(r.DecodeBool()) + } + case "persitentVolumeRecyclerConfiguration": + if r.TryDecodeAsNil() { + x.PersistentVolumeRecyclerConfiguration = PersistentVolumeRecyclerConfiguration{} + } else { + yyv5 := &x.PersistentVolumeRecyclerConfiguration + yyv5.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *VolumeConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.EnableHostPathProvisioning = false + } else { + x.EnableHostPathProvisioning = bool(r.DecodeBool()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PersistentVolumeRecyclerConfiguration = PersistentVolumeRecyclerConfiguration{} + } else { + yyv8 := &x.PersistentVolumeRecyclerConfiguration + yyv8.CodecDecodeSelf(d) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PersistentVolumeRecyclerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(7) + } else { + yynn2 = 7 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.MaximumRetry)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("maximumRetry")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.MaximumRetry)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(x.MinimumTimeoutNFS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("minimumTimeoutNFS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeInt(int64(x.MinimumTimeoutNFS)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PodTemplateFilePathNFS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("podTemplateFilePathNFS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PodTemplateFilePathNFS)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeInt(int64(x.IncrementTimeoutNFS)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("incrementTimeoutNFS")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeInt(int64(x.IncrementTimeoutNFS)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PodTemplateFilePathHostPath)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("podTemplateFilePathHostPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.PodTemplateFilePathHostPath)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeInt(int64(x.MinimumTimeoutHostPath)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("minimumTimeoutHostPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeInt(int64(x.MinimumTimeoutHostPath)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeInt(int64(x.IncrementTimeoutHostPath)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("incrementTimeoutHostPath")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeInt(int64(x.IncrementTimeoutHostPath)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PersistentVolumeRecyclerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PersistentVolumeRecyclerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "maximumRetry": + if r.TryDecodeAsNil() { + x.MaximumRetry = 0 + } else { + x.MaximumRetry = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "minimumTimeoutNFS": + if r.TryDecodeAsNil() { + x.MinimumTimeoutNFS = 0 + } else { + x.MinimumTimeoutNFS = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "podTemplateFilePathNFS": + if r.TryDecodeAsNil() { + x.PodTemplateFilePathNFS = "" + } else { + x.PodTemplateFilePathNFS = string(r.DecodeString()) + } + case "incrementTimeoutNFS": + if r.TryDecodeAsNil() { + x.IncrementTimeoutNFS = 0 + } else { + x.IncrementTimeoutNFS = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "podTemplateFilePathHostPath": + if r.TryDecodeAsNil() { + x.PodTemplateFilePathHostPath = "" + } else { + x.PodTemplateFilePathHostPath = string(r.DecodeString()) + } + case "minimumTimeoutHostPath": + if r.TryDecodeAsNil() { + x.MinimumTimeoutHostPath = 0 + } else { + x.MinimumTimeoutHostPath = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "incrementTimeoutHostPath": + if r.TryDecodeAsNil() { + x.IncrementTimeoutHostPath = 0 + } else { + x.IncrementTimeoutHostPath = int(r.DecodeInt(codecSelferBitsize1234)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PersistentVolumeRecyclerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj11 int + var yyb11 bool + var yyhl11 bool = l >= 0 + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MaximumRetry = 0 + } else { + x.MaximumRetry = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MinimumTimeoutNFS = 0 + } else { + x.MinimumTimeoutNFS = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PodTemplateFilePathNFS = "" + } else { + x.PodTemplateFilePathNFS = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.IncrementTimeoutNFS = 0 + } else { + x.IncrementTimeoutNFS = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.PodTemplateFilePathHostPath = "" + } else { + x.PodTemplateFilePathHostPath = string(r.DecodeString()) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.MinimumTimeoutHostPath = 0 + } else { + x.MinimumTimeoutHostPath = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.IncrementTimeoutHostPath = 0 + } else { + x.IncrementTimeoutHostPath = int(r.DecodeInt(codecSelferBitsize1234)) + } + for { + yyj11++ + if yyhl11 { + yyb11 = yyj11 > l + } else { + yyb11 = r.CheckBreak() + } + if yyb11 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj11-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/types.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/types.go new file mode 100644 index 000000000..3982ab7a6 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/types.go @@ -0,0 +1,516 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package componentconfig + +import "k8s.io/kubernetes/pkg/api/unversioned" + +type KubeProxyConfiguration struct { + unversioned.TypeMeta + + // bindAddress is the IP address for the proxy server to serve on (set to 0.0.0.0 + // for all interfaces) + BindAddress string `json:"bindAddress"` + // healthzBindAddress is the IP address for the health check server to serve on, + // defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces) + HealthzBindAddress string `json:"healthzBindAddress"` + // healthzPort is the port to bind the health check server. Use 0 to disable. + HealthzPort int `json:"healthzPort"` + // hostnameOverride, if non-empty, will be used as the identity instead of the actual hostname. + HostnameOverride string `json:"hostnameOverride"` + // iptablesMasqueradeBit is the bit of the iptables fwmark space to use for SNAT if using + // the pure iptables proxy mode. Values must be within the range [0, 31]. + IPTablesMasqueradeBit *int `json:"iptablesMasqueradeBit"` + // iptablesSyncPeriod is the period that iptables rules are refreshed (e.g. '5s', '1m', + // '2h22m'). Must be greater than 0. + IPTablesSyncPeriod unversioned.Duration `json:"iptablesSyncPeriodSeconds"` + // kubeconfigPath is the path to the kubeconfig file with authorization information (the + // master location is set by the master flag). + KubeconfigPath string `json:"kubeconfigPath"` + // masqueradeAll tells kube-proxy to SNAT everything if using the pure iptables proxy mode. + MasqueradeAll bool `json:"masqueradeAll"` + // master is the address of the Kubernetes API server (overrides any value in kubeconfig) + Master string `json:"master"` + // oomScoreAdj is the oom-score-adj value for kube-proxy process. Values must be within + // the range [-1000, 1000] + OOMScoreAdj *int `json:"oomScoreAdj"` + // mode specifies which proxy mode to use. + Mode ProxyMode `json:"mode"` + // portRange is the range of host ports (beginPort-endPort, inclusive) that may be consumed + // in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen. + PortRange string `json:"portRange"` + // resourceContainer is the absolute name of the resource-only container to create and run + // the Kube-proxy in (Default: /kube-proxy). + ResourceContainer string `json:"kubeletCgroups"` + // udpIdleTimeout is how long an idle UDP connection will be kept open (e.g. '250ms', '2s'). + // Must be greater than 0. Only applicable for proxyMode=userspace. + UDPIdleTimeout unversioned.Duration `json:"udpTimeoutMilliseconds"` + // conntrackMax is the maximum number of NAT connections to track (0 to leave as-is)") + ConntrackMax int `json:"conntrackMax"` + // conntrackTCPEstablishedTimeout is how long an idle UDP connection will be kept open + // (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxyMode is Userspace + ConntrackTCPEstablishedTimeout unversioned.Duration `json:"conntrackTCPEstablishedTimeout"` +} + +// Currently two modes of proxying are available: 'userspace' (older, stable) or 'iptables' +// (newer, faster). If blank, look at the Node object on the Kubernetes API and respect the +// 'net.experimental.kubernetes.io/proxy-mode' annotation if provided. Otherwise use the +// best-available proxy (currently iptables, but may change in future versions). If the +// iptables proxy is selected, regardless of how, but the system's kernel or iptables +// versions are insufficient, this always falls back to the userspace proxy. +type ProxyMode string + +const ( + ProxyModeUserspace ProxyMode = "userspace" + ProxyModeIPTables ProxyMode = "iptables" +) + +// TODO: curate the ordering and structure of this config object +type KubeletConfiguration struct { + // config is the path to the config file or directory of files + Config string `json:"config"` + // syncFrequency is the max period between synchronizing running + // containers and config + SyncFrequency unversioned.Duration `json:"syncFrequency"` + // fileCheckFrequency is the duration between checking config files for + // new data + FileCheckFrequency unversioned.Duration `json:"fileCheckFrequency"` + // httpCheckFrequency is the duration between checking http for new data + HTTPCheckFrequency unversioned.Duration `json:"httpCheckFrequency"` + // manifestURL is the URL for accessing the container manifest + ManifestURL string `json:"manifestURL"` + // manifestURLHeader is the HTTP header to use when accessing the manifest + // URL, with the key separated from the value with a ':', as in 'key:value' + ManifestURLHeader string `json:"manifestURLHeader"` + // enableServer enables the Kubelet's server + EnableServer bool `json:"enableServer"` + // address is the IP address for the Kubelet to serve on (set to 0.0.0.0 + // for all interfaces) + Address string `json:"address"` + // port is the port for the Kubelet to serve on. + Port uint `json:"port"` + // readOnlyPort is the read-only port for the Kubelet to serve on with + // no authentication/authorization (set to 0 to disable) + ReadOnlyPort uint `json:"readOnlyPort"` + // tLSCertFile is the file containing x509 Certificate for HTTPS. (CA cert, + // if any, concatenated after server cert). If tlsCertFile and + // tlsPrivateKeyFile are not provided, a self-signed certificate + // and key are generated for the public address and saved to the directory + // passed to certDir. + TLSCertFile string `json:"tLSCertFile"` + // tLSPrivateKeyFile is the ile containing x509 private key matching + // tlsCertFile. + TLSPrivateKeyFile string `json:"tLSPrivateKeyFile"` + // certDirectory is the directory where the TLS certs are located (by + // default /var/run/kubernetes). If tlsCertFile and tlsPrivateKeyFile + // are provided, this flag will be ignored. + CertDirectory string `json:"certDirectory"` + // hostnameOverride is the hostname used to identify the kubelet instead + // of the actual hostname. + HostnameOverride string `json:"hostnameOverride"` + // podInfraContainerImage is the image whose network/ipc namespaces + // containers in each pod will use. + PodInfraContainerImage string `json:"podInfraContainerImage"` + // dockerEndpoint is the path to the docker endpoint to communicate with. + DockerEndpoint string `json:"dockerEndpoint"` + // rootDirectory is the directory path to place kubelet files (volume + // mounts,etc). + RootDirectory string `json:"rootDirectory"` + // allowPrivileged enables containers to request privileged mode. + // Defaults to false. + AllowPrivileged bool `json:"allowPrivileged"` + // hostNetworkSources is a comma-separated list of sources from which the + // Kubelet allows pods to use of host network. Defaults to "*". + HostNetworkSources string `json:"hostNetworkSources"` + // hostPIDSources is a comma-separated list of sources from which the + // Kubelet allows pods to use the host pid namespace. Defaults to "*". + HostPIDSources string `json:"hostPIDSources"` + // hostIPCSources is a comma-separated list of sources from which the + // Kubelet allows pods to use the host ipc namespace. Defaults to "*". + HostIPCSources string `json:"hostIPCSources"` + // registryPullQPS is the limit of registry pulls per second. If 0, + // unlimited. Set to 0 for no limit. Defaults to 5.0. + RegistryPullQPS float64 `json:"registryPullQPS"` + // registryBurst is the maximum size of a bursty pulls, temporarily allows + // pulls to burst to this number, while still not exceeding registryQps. + // Only used if registryQps > 0. + RegistryBurst int `json:"registryBurst"` + // eventRecordQPS is the maximum event creations per second. If 0, there + // is no limit enforced. + EventRecordQPS float32 `json:"eventRecordQPS"` + // eventBurst is the maximum size of a bursty event records, temporarily + // allows event records to burst to this number, while still not exceeding + // event-qps. Only used if eventQps > 0 + EventBurst int `json:"eventBurst"` + // enableDebuggingHandlers enables server endpoints for log collection + // and local running of containers and commands + EnableDebuggingHandlers bool `json:"enableDebuggingHandlers"` + // minimumGCAge is the minimum age for a finished container before it is + // garbage collected. + MinimumGCAge unversioned.Duration `json:"minimumGCAge"` + // maxPerPodContainerCount is the maximum number of old instances to + // retain per container. Each container takes up some disk space. + MaxPerPodContainerCount int `json:"maxPerPodContainerCount"` + // maxContainerCount is the maximum number of old instances of containers + // to retain globally. Each container takes up some disk space. + MaxContainerCount int `json:"maxContainerCount"` + // cAdvisorPort is the port of the localhost cAdvisor endpoint + CAdvisorPort uint `json:"cAdvisorPort"` + // healthzPort is the port of the localhost healthz endpoint + HealthzPort int `json:"healthzPort"` + // healthzBindAddress is the IP address for the healthz server to serve + // on. + HealthzBindAddress string `json:"healthzBindAddress"` + // oomScoreAdj is The oom-score-adj value for kubelet process. Values + // must be within the range [-1000, 1000]. + OOMScoreAdj int `json:"oomScoreAdj"` + // registerNode enables automatic registration with the apiserver. + RegisterNode bool `json:"registerNode"` + // clusterDomain is the DNS domain for this cluster. If set, kubelet will + // configure all containers to search this domain in addition to the + // host's search domains. + ClusterDomain string `json:"clusterDomain"` + // masterServiceNamespace is The namespace from which the kubernetes + // master services should be injected into pods. + MasterServiceNamespace string `json:"masterServiceNamespace"` + // clusterDNS is the IP address for a cluster DNS server. If set, kubelet + // will configure all containers to use this for DNS resolution in + // addition to the host's DNS servers + ClusterDNS string `json:"clusterDNS"` + // streamingConnectionIdleTimeout is the maximum time a streaming connection + // can be idle before the connection is automatically closed. + StreamingConnectionIdleTimeout unversioned.Duration `json:"streamingConnectionIdleTimeout"` + // nodeStatusUpdateFrequency is the frequency that kubelet posts node + // status to master. Note: be cautious when changing the constant, it + // must work with nodeMonitorGracePeriod in nodecontroller. + NodeStatusUpdateFrequency unversioned.Duration `json:"nodeStatusUpdateFrequency"` + // imageGCHighThresholdPercent is the percent of disk usage after which + // image garbage collection is always run. + ImageGCHighThresholdPercent int `json:"imageGCHighThresholdPercent"` + // imageGCLowThresholdPercent is the percent of disk usage before which + // image garbage collection is never run. Lowest disk usage to garbage + // collect to. + ImageGCLowThresholdPercent int `json:"imageGCLowThresholdPercent"` + // lowDiskSpaceThresholdMB is the absolute free disk space, in MB, to + // maintain. When disk space falls below this threshold, new pods would + // be rejected. + LowDiskSpaceThresholdMB int `json:"lowDiskSpaceThresholdMB"` + // How frequently to calculate and cache volume disk usage for all pods + VolumeStatsAggPeriod unversioned.Duration `json:volumeStatsAggPeriod` + // networkPluginName is the name of the network plugin to be invoked for + // various events in kubelet/pod lifecycle + NetworkPluginName string `json:"networkPluginName"` + // networkPluginDir is the full path of the directory in which to search + // for network plugins + NetworkPluginDir string `json:"networkPluginDir"` + // volumePluginDir is the full path of the directory in which to search + // for additional third party volume plugins + VolumePluginDir string `json:"volumePluginDir"` + // cloudProvider is the provider for cloud services. + CloudProvider string `json:"cloudProvider,omitempty"` + // cloudConfigFile is the path to the cloud provider configuration file. + CloudConfigFile string `json:"cloudConfigFile,omitempty"` + // KubeletCgroups is the absolute name of cgroups to isolate the kubelet in. + KubeletCgroups string `json:"kubeletCgroups,omitempty"` + // Cgroups that container runtime is expected to be isolated in. + RuntimeCgroups string `json:"runtimeCgroups,omitempty"` + // SystemCgroups is absolute name of cgroups in which to place + // all non-kernel processes that are not already in a container. Empty + // for no container. Rolling back the flag requires a reboot. + SystemCgroups string `json:"systemContainer,omitempty"` + // cgroupRoot is the root cgroup to use for pods. This is handled by the + // container runtime on a best effort basis. + CgroupRoot string `json:"cgroupRoot,omitempty"` + // containerRuntime is the container runtime to use. + ContainerRuntime string `json:"containerRuntime"` + // rktPath is hte path of rkt binary. Leave empty to use the first rkt in + // $PATH. + RktPath string `json:"rktPath,omitempty"` + // lockFilePath is the path that kubelet will use to as a lock file. + // It uses this file as a lock to synchronize with other kubelet processes + // that may be running. + LockFilePath string `json:"lockFilePath"` + // rktStage1Image is the image to use as stage1. Local paths and + // http/https URLs are supported. + RktStage1Image string `json:"rktStage1Image,omitempty"` + // configureCBR0 enables the kublet to configure cbr0 based on + // Node.Spec.PodCIDR. + ConfigureCBR0 bool `json:"configureCbr0"` + // Should the kubelet set the hairpin flag on veth interfaces for containers + // it creates? Setting this flag allows endpoints in a Service to + // loadbalance back to themselves if they should try to access their own + // Service. + HairpinMode bool `json:"configureHairpinMode"` + // maxPods is the number of pods that can run on this Kubelet. + MaxPods int `json:"maxPods"` + // dockerExecHandlerName is the handler to use when executing a command + // in a container. Valid values are 'native' and 'nsenter'. Defaults to + // 'native'. + DockerExecHandlerName string `json:"dockerExecHandlerName"` + // The CIDR to use for pod IP addresses, only used in standalone mode. + // In cluster mode, this is obtained from the master. + PodCIDR string `json:"podCIDR"` + // ResolverConfig is the resolver configuration file used as the basis + // for the container DNS resolution configuration."), [] + ResolverConfig string `json:"resolvConf"` + // cpuCFSQuota is Enable CPU CFS quota enforcement for containers that + // specify CPU limits + CPUCFSQuota bool `json:"cpuCFSQuota"` + // containerized should be set to true if kubelet is running in a container. + Containerized bool `json:"containerized"` + // maxOpenFiles is Number of files that can be opened by Kubelet process. + MaxOpenFiles uint64 `json:"maxOpenFiles"` + // reconcileCIDR is Reconcile node CIDR with the CIDR specified by the + // API server. No-op if register-node or configure-cbr0 is false. + ReconcileCIDR bool `json:"reconcileCIDR"` + // registerSchedulable tells the kubelet to register the node as + // schedulable. No-op if register-node is false. + RegisterSchedulable bool `json:"registerSchedulable"` + // kubeAPIQPS is the QPS to use while talking with kubernetes apiserver + KubeAPIQPS float32 `json:"kubeAPIQPS"` + // kubeAPIBurst is the burst to allow while talking with kubernetes + // apiserver + KubeAPIBurst int `json:"kubeAPIBurst"` + // serializeImagePulls when enabled, tells the Kubelet to pull images one + // at a time. We recommend *not* changing the default value on nodes that + // run docker daemon with version < 1.9 or an Aufs storage backend. + // Issue #10959 has more details. + SerializeImagePulls bool `json:"serializeImagePulls"` + // experimentalFlannelOverlay enables experimental support for starting the + // kubelet with the default overlay network (flannel). Assumes flanneld + // is already running in client mode. + ExperimentalFlannelOverlay bool `json:"experimentalFlannelOverlay"` + // outOfDiskTransitionFrequency is duration for which the kubelet has to + // wait before transitioning out of out-of-disk node condition status. + OutOfDiskTransitionFrequency unversioned.Duration `json:"outOfDiskTransitionFrequency,omitempty"` + // nodeIP is IP address of the node. If set, kubelet will use this IP + // address for the node. + NodeIP string `json:"nodeIP,omitempty"` + // nodeLabels to add when registering the node in the cluster. + NodeLabels map[string]string `json:"nodeLabels"` + // nonMasqueradeCIDR configures masquerading: traffic to IPs outside this range will use IP masquerade. + NonMasqueradeCIDR string `json:"nonMasqueradeCIDR"` + // enable gathering custom metrics. + EnableCustomMetrics bool `json:"enableCustomMetrics"` +} + +type KubeSchedulerConfiguration struct { + unversioned.TypeMeta + + // port is the port that the scheduler's http service runs on. + Port int `json:"port"` + // address is the IP address to serve on. + Address string `json:"address"` + // algorithmProvider is the scheduling algorithm provider to use. + AlgorithmProvider string `json:"algorithmProvider"` + // policyConfigFile is the filepath to the scheduler policy configuration. + PolicyConfigFile string `json:"policyConfigFile"` + // enableProfiling enables profiling via web interface. + EnableProfiling bool `json:"enableProfiling"` + // kubeAPIQPS is the QPS to use while talking with kubernetes apiserver. + KubeAPIQPS float32 `json:"kubeAPIQPS"` + // kubeAPIBurst is the QPS burst to use while talking with kubernetes apiserver. + KubeAPIBurst int `json:"kubeAPIBurst"` + // schedulerName is name of the scheduler, used to select which pods + // will be processed by this scheduler, based on pod's annotation with + // key 'scheduler.alpha.kubernetes.io/name'. + SchedulerName string `json:"schedulerName"` + // leaderElection defines the configuration of leader election client. + LeaderElection LeaderElectionConfiguration `json:"leaderElection"` +} + +// LeaderElectionConfiguration defines the configuration of leader election +// clients for components that can run with leader election enabled. +type LeaderElectionConfiguration struct { + // leaderElect enables a leader election client to gain leadership + // before executing the main loop. Enable this when running replicated + // components for high availability. + LeaderElect bool `json:"leaderElect"` + // leaseDuration is the duration that non-leader candidates will wait + // after observing a leadership renewal until attempting to acquire + // leadership of a led but unrenewed leader slot. This is effectively the + // maximum duration that a leader can be stopped before it is replaced + // by another candidate. This is only applicable if leader election is + // enabled. + LeaseDuration unversioned.Duration `json:"leaseDuration"` + // renewDeadline is the interval between attempts by the acting master to + // renew a leadership slot before it stops leading. This must be less + // than or equal to the lease duration. This is only applicable if leader + // election is enabled. + RenewDeadline unversioned.Duration `json:"renewDeadline"` + // retryPeriod is the duration the clients should wait between attempting + // acquisition and renewal of a leadership. This is only applicable if + // leader election is enabled. + RetryPeriod unversioned.Duration `json:"retryPeriod"` +} + +type KubeControllerManagerConfiguration struct { + unversioned.TypeMeta + + // port is the port that the controller-manager's http service runs on. + Port int `json:"port"` + // address is the IP address to serve on (set to 0.0.0.0 for all interfaces). + Address string `json:"address"` + // cloudProvider is the provider for cloud services. + CloudProvider string `json:"cloudProvider"` + // cloudConfigFile is the path to the cloud provider configuration file. + CloudConfigFile string `json:"cloudConfigFile"` + // concurrentEndpointSyncs is the number of endpoint syncing operations + // that will be done concurrently. Larger number = faster endpoint updating, + // but more CPU (and network) load. + ConcurrentEndpointSyncs int `json:"concurrentEndpointSyncs"` + // concurrentRSSyncs is the number of replica sets that are allowed to sync + // concurrently. Larger number = more reponsive replica management, but more + // CPU (and network) load. + ConcurrentRSSyncs int `json:"concurrentRSSyncs"` + // concurrentRCSyncs is the number of replication controllers that are + // allowed to sync concurrently. Larger number = more reponsive replica + // management, but more CPU (and network) load. + ConcurrentRCSyncs int `json:"concurrentRCSyncs"` + // concurrentResourceQuotaSyncs is the number of resource quotas that are + // allowed to sync concurrently. Larger number = more responsive quota + // management, but more CPU (and network) load. + ConcurrentResourceQuotaSyncs int `json:"concurrentResourceQuotaSyncs"` + // concurrentDeploymentSyncs is the number of deployment objects that are + // allowed to sync concurrently. Larger number = more reponsive deployments, + // but more CPU (and network) load. + ConcurrentDeploymentSyncs int `json:"concurrentDeploymentSyncs"` + // concurrentDaemonSetSyncs is the number of daemonset objects that are + // allowed to sync concurrently. Larger number = more reponsive DaemonSet, + // but more CPU (and network) load. + ConcurrentDaemonSetSyncs int `json:"concurrentDaemonSetSyncs"` + // concurrentJobSyncs is the number of job objects that are + // allowed to sync concurrently. Larger number = more reponsive jobs, + // but more CPU (and network) load. + ConcurrentJobSyncs int `json:"concurrentJobSyncs"` + // concurrentNamespaceSyncs is the number of namespace objects that are + // allowed to sync concurrently. + ConcurrentNamespaceSyncs int `json:"concurrentNamespaceSyncs"` + // serviceSyncPeriod is the period for syncing services with their external + // load balancers. + ServiceSyncPeriod unversioned.Duration `json:"serviceSyncPeriod"` + // nodeSyncPeriod is the period for syncing nodes from cloudprovider. Longer + // periods will result in fewer calls to cloud provider, but may delay addition + // of new nodes to cluster. + NodeSyncPeriod unversioned.Duration `json:"nodeSyncPeriod"` + // resourceQuotaSyncPeriod is the period for syncing quota usage status + // in the system. + ResourceQuotaSyncPeriod unversioned.Duration `json:"resourceQuotaSyncPeriod"` + // namespaceSyncPeriod is the period for syncing namespace life-cycle + // updates. + NamespaceSyncPeriod unversioned.Duration `json:"namespaceSyncPeriod"` + // pvClaimBinderSyncPeriod is the period for syncing persistent volumes + // and persistent volume claims. + PVClaimBinderSyncPeriod unversioned.Duration `json:"pvClaimBinderSyncPeriod"` + // minResyncPeriod is the resync period in reflectors; will be random between + // minResyncPeriod and 2*minResyncPeriod. + MinResyncPeriod unversioned.Duration `json:"minResyncPeriod"` + // terminatedPodGCThreshold is the number of terminated pods that can exist + // before the terminated pod garbage collector starts deleting terminated pods. + // If <= 0, the terminated pod garbage collector is disabled. + TerminatedPodGCThreshold int `json:"terminatedPodGCThreshold"` + // horizontalPodAutoscalerSyncPeriod is the period for syncing the number of + // pods in horizontal pod autoscaler. + HorizontalPodAutoscalerSyncPeriod unversioned.Duration `json:"horizontalPodAutoscalerSyncPeriod"` + // deploymentControllerSyncPeriod is the period for syncing the deployments. + DeploymentControllerSyncPeriod unversioned.Duration `json:"deploymentControllerSyncPeriod"` + // podEvictionTimeout is the grace period for deleting pods on failed nodes. + PodEvictionTimeout unversioned.Duration `json:"podEvictionTimeout"` + // deletingPodsQps is the number of nodes per second on which pods are deleted in + // case of node failure. + DeletingPodsQps float32 `json:"deletingPodsQps"` + // deletingPodsBurst is the number of nodes on which pods are bursty deleted in + // case of node failure. For more details look into RateLimiter. + DeletingPodsBurst int `json:"deletingPodsBurst"` + // nodeMontiorGracePeriod is the amount of time which we allow a running node to be + // unresponsive before marking it unhealty. Must be N times more than kubelet's + // nodeStatusUpdateFrequency, where N means number of retries allowed for kubelet + // to post node status. + NodeMonitorGracePeriod unversioned.Duration `json:"nodeMonitorGracePeriod"` + // registerRetryCount is the number of retries for initial node registration. + // Retry interval equals node-sync-period. + RegisterRetryCount int `json:"registerRetryCount"` + // nodeStartupGracePeriod is the amount of time which we allow starting a node to + // be unresponsive before marking it unhealty. + NodeStartupGracePeriod unversioned.Duration `json:"nodeStartupGracePeriod"` + // nodeMonitorPeriod is the period for syncing NodeStatus in NodeController. + NodeMonitorPeriod unversioned.Duration `json:"nodeMonitorPeriod"` + // serviceAccountKeyFile is the filename containing a PEM-encoded private RSA key + // used to sign service account tokens. + ServiceAccountKeyFile string `json:"serviceAccountKeyFile"` + // enableProfiling enables profiling via web interface host:port/debug/pprof/ + EnableProfiling bool `json:"enableProfiling"` + // clusterName is the instance prefix for the cluster. + ClusterName string `json:"clusterName"` + // clusterCIDR is CIDR Range for Pods in cluster. + ClusterCIDR string `json:"clusterCIDR"` + // allocateNodeCIDRs enables CIDRs for Pods to be allocated and set on the + // cloud provider. + AllocateNodeCIDRs bool `json:"allocateNodeCIDRs"` + // rootCAFile is the root certificate authority will be included in service + // account's token secret. This must be a valid PEM-encoded CA bundle. + RootCAFile string `json:"rootCAFile"` + // kubeAPIQPS is the QPS to use while talking with kubernetes apiserver. + KubeAPIQPS float32 `json:"kubeAPIQPS"` + // kubeAPIBurst is the burst to use while talking with kubernetes apiserver. + KubeAPIBurst int `json:"kubeAPIBurst"` + // leaderElection defines the configuration of leader election client. + LeaderElection LeaderElectionConfiguration `json:"leaderElection"` + // vloumeConfiguration holds configuration for volume related features. + VolumeConfiguration VolumeConfiguration `json:"volumeConfiguration"` +} + +// VolumeConfiguration contains *all* enumerated flags meant to configure all volume +// plugins. From this config, the controller-manager binary will create many instances of +// volume.VolumeConfig, each containing only the configuration needed for that plugin which +// are then passed to the appropriate plugin. The ControllerManager binary is the only part +// of the code which knows what plugins are supported and which flags correspond to each plugin. +type VolumeConfiguration struct { + // enableHostPathProvisioning enables HostPath PV provisioning when running without a + // cloud provider. This allows testing and development of provisioning features. HostPath + // provisioning is not supported in any way, won't work in a multi-node cluster, and + // should not be used for anything other than testing or development. + EnableHostPathProvisioning bool `json:"enableHostPathProvisioning"` + // persistentVolumeRecyclerConfiguration holds configuration for persistent volume plugins. + PersistentVolumeRecyclerConfiguration PersistentVolumeRecyclerConfiguration `json:"persitentVolumeRecyclerConfiguration"` +} + +type PersistentVolumeRecyclerConfiguration struct { + // maximumRetry is number of retries the PV recycler will execute on failure to recycle + // PV. + MaximumRetry int `json:"maximumRetry"` + // minimumTimeoutNFS is the minimum ActiveDeadlineSeconds to use for an NFS Recycler + // pod. + MinimumTimeoutNFS int `json:"minimumTimeoutNFS"` + // podTemplateFilePathNFS is the file path to a pod definition used as a template for + // NFS persistent volume recycling + PodTemplateFilePathNFS string `json:"podTemplateFilePathNFS"` + // incrementTimeoutNFS is the increment of time added per Gi to ActiveDeadlineSeconds + // for an NFS scrubber pod. + IncrementTimeoutNFS int `json:"incrementTimeoutNFS"` + // podTemplateFilePathHostPath is the file path to a pod definition used as a template for + // HostPath persistent volume recycling. This is for development and testing only and + // will not work in a multi-node cluster. + PodTemplateFilePathHostPath string `json:"podTemplateFilePathHostPath"` + // minimumTimeoutHostPath is the minimum ActiveDeadlineSeconds to use for a HostPath + // Recycler pod. This is for development and testing only and will not work in a multi-node + // cluster. + MinimumTimeoutHostPath int `json:"minimumTimeoutHostPath"` + // incrementTimeoutHostPath is the increment of time added per Gi to ActiveDeadlineSeconds + // for a HostPath scrubber pod. This is for development and testing only and will not work + // in a multi-node cluster. + IncrementTimeoutHostPath int `json:"incrementTimeoutHostPath"` +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/conversion_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/conversion_generated.go new file mode 100644 index 000000000..b4bff5c81 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/conversion_generated.go @@ -0,0 +1,234 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-conversions.sh + +package v1alpha1 + +import ( + reflect "reflect" + + api "k8s.io/kubernetes/pkg/api" + componentconfig "k8s.io/kubernetes/pkg/apis/componentconfig" + conversion "k8s.io/kubernetes/pkg/conversion" +) + +func autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguration(in *componentconfig.KubeProxyConfiguration, out *KubeProxyConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*componentconfig.KubeProxyConfiguration))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + out.BindAddress = in.BindAddress + out.HealthzBindAddress = in.HealthzBindAddress + out.HealthzPort = int32(in.HealthzPort) + out.HostnameOverride = in.HostnameOverride + if in.IPTablesMasqueradeBit != nil { + out.IPTablesMasqueradeBit = new(int32) + *out.IPTablesMasqueradeBit = int32(*in.IPTablesMasqueradeBit) + } else { + out.IPTablesMasqueradeBit = nil + } + if err := s.Convert(&in.IPTablesSyncPeriod, &out.IPTablesSyncPeriod, 0); err != nil { + return err + } + out.KubeconfigPath = in.KubeconfigPath + out.MasqueradeAll = in.MasqueradeAll + out.Master = in.Master + if in.OOMScoreAdj != nil { + out.OOMScoreAdj = new(int32) + *out.OOMScoreAdj = int32(*in.OOMScoreAdj) + } else { + out.OOMScoreAdj = nil + } + out.Mode = ProxyMode(in.Mode) + out.PortRange = in.PortRange + out.ResourceContainer = in.ResourceContainer + if err := s.Convert(&in.UDPIdleTimeout, &out.UDPIdleTimeout, 0); err != nil { + return err + } + out.ConntrackMax = int32(in.ConntrackMax) + if err := s.Convert(&in.ConntrackTCPEstablishedTimeout, &out.ConntrackTCPEstablishedTimeout, 0); err != nil { + return err + } + return nil +} + +func Convert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguration(in *componentconfig.KubeProxyConfiguration, out *KubeProxyConfiguration, s conversion.Scope) error { + return autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguration(in, out, s) +} + +func autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *componentconfig.KubeSchedulerConfiguration, out *KubeSchedulerConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*componentconfig.KubeSchedulerConfiguration))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + out.Port = in.Port + out.Address = in.Address + out.AlgorithmProvider = in.AlgorithmProvider + out.PolicyConfigFile = in.PolicyConfigFile + if err := api.Convert_bool_To_bool_ref(&in.EnableProfiling, &out.EnableProfiling, s); err != nil { + return err + } + out.KubeAPIQPS = in.KubeAPIQPS + out.KubeAPIBurst = in.KubeAPIBurst + out.SchedulerName = in.SchedulerName + if err := Convert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { + return err + } + return nil +} + +func Convert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in *componentconfig.KubeSchedulerConfiguration, out *KubeSchedulerConfiguration, s conversion.Scope) error { + return autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration(in, out, s) +} + +func autoConvert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(in *componentconfig.LeaderElectionConfiguration, out *LeaderElectionConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*componentconfig.LeaderElectionConfiguration))(in) + } + if err := api.Convert_bool_To_bool_ref(&in.LeaderElect, &out.LeaderElect, s); err != nil { + return err + } + if err := s.Convert(&in.LeaseDuration, &out.LeaseDuration, 0); err != nil { + return err + } + if err := s.Convert(&in.RenewDeadline, &out.RenewDeadline, 0); err != nil { + return err + } + if err := s.Convert(&in.RetryPeriod, &out.RetryPeriod, 0); err != nil { + return err + } + return nil +} + +func Convert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(in *componentconfig.LeaderElectionConfiguration, out *LeaderElectionConfiguration, s conversion.Scope) error { + return autoConvert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyConfiguration(in *KubeProxyConfiguration, out *componentconfig.KubeProxyConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*KubeProxyConfiguration))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + out.BindAddress = in.BindAddress + out.HealthzBindAddress = in.HealthzBindAddress + out.HealthzPort = int(in.HealthzPort) + out.HostnameOverride = in.HostnameOverride + if in.IPTablesMasqueradeBit != nil { + out.IPTablesMasqueradeBit = new(int) + *out.IPTablesMasqueradeBit = int(*in.IPTablesMasqueradeBit) + } else { + out.IPTablesMasqueradeBit = nil + } + if err := s.Convert(&in.IPTablesSyncPeriod, &out.IPTablesSyncPeriod, 0); err != nil { + return err + } + out.KubeconfigPath = in.KubeconfigPath + out.MasqueradeAll = in.MasqueradeAll + out.Master = in.Master + if in.OOMScoreAdj != nil { + out.OOMScoreAdj = new(int) + *out.OOMScoreAdj = int(*in.OOMScoreAdj) + } else { + out.OOMScoreAdj = nil + } + out.Mode = componentconfig.ProxyMode(in.Mode) + out.PortRange = in.PortRange + out.ResourceContainer = in.ResourceContainer + if err := s.Convert(&in.UDPIdleTimeout, &out.UDPIdleTimeout, 0); err != nil { + return err + } + out.ConntrackMax = int(in.ConntrackMax) + if err := s.Convert(&in.ConntrackTCPEstablishedTimeout, &out.ConntrackTCPEstablishedTimeout, 0); err != nil { + return err + } + return nil +} + +func Convert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyConfiguration(in *KubeProxyConfiguration, out *componentconfig.KubeProxyConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in *KubeSchedulerConfiguration, out *componentconfig.KubeSchedulerConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*KubeSchedulerConfiguration))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + out.Port = in.Port + out.Address = in.Address + out.AlgorithmProvider = in.AlgorithmProvider + out.PolicyConfigFile = in.PolicyConfigFile + if err := api.Convert_bool_ref_To_bool(&in.EnableProfiling, &out.EnableProfiling, s); err != nil { + return err + } + out.KubeAPIQPS = in.KubeAPIQPS + out.KubeAPIBurst = in.KubeAPIBurst + out.SchedulerName = in.SchedulerName + if err := Convert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { + return err + } + return nil +} + +func Convert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in *KubeSchedulerConfiguration, out *componentconfig.KubeSchedulerConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(in *LeaderElectionConfiguration, out *componentconfig.LeaderElectionConfiguration, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*LeaderElectionConfiguration))(in) + } + if err := api.Convert_bool_ref_To_bool(&in.LeaderElect, &out.LeaderElect, s); err != nil { + return err + } + if err := s.Convert(&in.LeaseDuration, &out.LeaseDuration, 0); err != nil { + return err + } + if err := s.Convert(&in.RenewDeadline, &out.RenewDeadline, 0); err != nil { + return err + } + if err := s.Convert(&in.RetryPeriod, &out.RetryPeriod, 0); err != nil { + return err + } + return nil +} + +func Convert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(in *LeaderElectionConfiguration, out *componentconfig.LeaderElectionConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(in, out, s) +} + +func init() { + err := api.Scheme.AddGeneratedConversionFuncs( + autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguration, + autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration, + autoConvert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration, + autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyConfiguration, + autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration, + autoConvert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration, + ) + if err != nil { + // If one of the conversion functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/deep_copy_generated.go new file mode 100644 index 000000000..928491342 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/deep_copy_generated.go @@ -0,0 +1,131 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh. + +package v1alpha1 + +import ( + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + conversion "k8s.io/kubernetes/pkg/conversion" +) + +func deepCopy_unversioned_Duration(in unversioned.Duration, out *unversioned.Duration, c *conversion.Cloner) error { + out.Duration = in.Duration + return nil +} + +func deepCopy_unversioned_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error { + out.Kind = in.Kind + out.APIVersion = in.APIVersion + return nil +} + +func deepCopy_v1alpha1_KubeProxyConfiguration(in KubeProxyConfiguration, out *KubeProxyConfiguration, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + out.BindAddress = in.BindAddress + out.HealthzBindAddress = in.HealthzBindAddress + out.HealthzPort = in.HealthzPort + out.HostnameOverride = in.HostnameOverride + if in.IPTablesMasqueradeBit != nil { + out.IPTablesMasqueradeBit = new(int32) + *out.IPTablesMasqueradeBit = *in.IPTablesMasqueradeBit + } else { + out.IPTablesMasqueradeBit = nil + } + if err := deepCopy_unversioned_Duration(in.IPTablesSyncPeriod, &out.IPTablesSyncPeriod, c); err != nil { + return err + } + out.KubeconfigPath = in.KubeconfigPath + out.MasqueradeAll = in.MasqueradeAll + out.Master = in.Master + if in.OOMScoreAdj != nil { + out.OOMScoreAdj = new(int32) + *out.OOMScoreAdj = *in.OOMScoreAdj + } else { + out.OOMScoreAdj = nil + } + out.Mode = in.Mode + out.PortRange = in.PortRange + out.ResourceContainer = in.ResourceContainer + if err := deepCopy_unversioned_Duration(in.UDPIdleTimeout, &out.UDPIdleTimeout, c); err != nil { + return err + } + out.ConntrackMax = in.ConntrackMax + if err := deepCopy_unversioned_Duration(in.ConntrackTCPEstablishedTimeout, &out.ConntrackTCPEstablishedTimeout, c); err != nil { + return err + } + return nil +} + +func deepCopy_v1alpha1_KubeSchedulerConfiguration(in KubeSchedulerConfiguration, out *KubeSchedulerConfiguration, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + out.Port = in.Port + out.Address = in.Address + out.AlgorithmProvider = in.AlgorithmProvider + out.PolicyConfigFile = in.PolicyConfigFile + if in.EnableProfiling != nil { + out.EnableProfiling = new(bool) + *out.EnableProfiling = *in.EnableProfiling + } else { + out.EnableProfiling = nil + } + out.KubeAPIQPS = in.KubeAPIQPS + out.KubeAPIBurst = in.KubeAPIBurst + out.SchedulerName = in.SchedulerName + if err := deepCopy_v1alpha1_LeaderElectionConfiguration(in.LeaderElection, &out.LeaderElection, c); err != nil { + return err + } + return nil +} + +func deepCopy_v1alpha1_LeaderElectionConfiguration(in LeaderElectionConfiguration, out *LeaderElectionConfiguration, c *conversion.Cloner) error { + if in.LeaderElect != nil { + out.LeaderElect = new(bool) + *out.LeaderElect = *in.LeaderElect + } else { + out.LeaderElect = nil + } + if err := deepCopy_unversioned_Duration(in.LeaseDuration, &out.LeaseDuration, c); err != nil { + return err + } + if err := deepCopy_unversioned_Duration(in.RenewDeadline, &out.RenewDeadline, c); err != nil { + return err + } + if err := deepCopy_unversioned_Duration(in.RetryPeriod, &out.RetryPeriod, c); err != nil { + return err + } + return nil +} + +func init() { + err := api.Scheme.AddGeneratedDeepCopyFuncs( + deepCopy_unversioned_Duration, + deepCopy_unversioned_TypeMeta, + deepCopy_v1alpha1_KubeProxyConfiguration, + deepCopy_v1alpha1_KubeSchedulerConfiguration, + deepCopy_v1alpha1_LeaderElectionConfiguration, + ) + if err != nil { + // if one of the deep copy functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/defaults.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/defaults.go new file mode 100644 index 000000000..af35c7d38 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/defaults.go @@ -0,0 +1,99 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "time" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/kubelet/qos" + "k8s.io/kubernetes/pkg/master/ports" + "k8s.io/kubernetes/pkg/runtime" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) { + scheme.AddDefaultingFuncs( + func(obj *KubeProxyConfiguration) { + if obj.BindAddress == "" { + obj.BindAddress = "0.0.0.0" + } + if obj.HealthzPort == 0 { + obj.HealthzPort = 10249 + } + if obj.HealthzBindAddress == "" { + obj.HealthzBindAddress = "127.0.0.1" + } + if obj.OOMScoreAdj == nil { + temp := int32(qos.KubeProxyOOMScoreAdj) + obj.OOMScoreAdj = &temp + } + if obj.ResourceContainer == "" { + obj.ResourceContainer = "/kube-proxy" + } + if obj.IPTablesSyncPeriod.Duration == 0 { + obj.IPTablesSyncPeriod = unversioned.Duration{30 * time.Second} + } + zero := unversioned.Duration{} + if obj.UDPIdleTimeout == zero { + obj.UDPIdleTimeout = unversioned.Duration{250 * time.Millisecond} + } + if obj.ConntrackMax == 0 { + obj.ConntrackMax = 256 * 1024 // 4x default (64k) + } + if obj.IPTablesMasqueradeBit == nil { + temp := int32(14) + obj.IPTablesMasqueradeBit = &temp + } + if obj.ConntrackTCPEstablishedTimeout == zero { + obj.ConntrackTCPEstablishedTimeout = unversioned.Duration{Duration: 24 * time.Hour} // 1 day (1/5 default) + } + }, + func(obj *KubeSchedulerConfiguration) { + if obj.Port == 0 { + obj.Port = ports.SchedulerPort + } + if obj.Address == "" { + obj.Address = "0.0.0.0" + } + if obj.AlgorithmProvider == "" { + obj.AlgorithmProvider = "DefaultProvider" + } + if obj.KubeAPIQPS == 0 { + obj.KubeAPIQPS = 50.0 + } + if obj.KubeAPIBurst == 0 { + obj.KubeAPIBurst = 100 + } + if obj.SchedulerName == "" { + obj.SchedulerName = api.DefaultSchedulerName + } + }, + func(obj *LeaderElectionConfiguration) { + zero := unversioned.Duration{} + if obj.LeaseDuration == zero { + obj.LeaseDuration = unversioned.Duration{15 * time.Second} + } + if obj.RenewDeadline == zero { + obj.RenewDeadline = unversioned.Duration{10 * time.Second} + } + if obj.RetryPeriod == zero { + obj.RetryPeriod = unversioned.Duration{2 * time.Second} + } + }, + ) +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/register.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/register.go new file mode 100644 index 000000000..4510fac92 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/register.go @@ -0,0 +1,43 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +// GroupName is the group name use in this package +const GroupName = "componentconfig" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +func AddToScheme(scheme *runtime.Scheme) { + addKnownTypes(scheme) + addDefaultingFuncs(scheme) +} + +func addKnownTypes(scheme *runtime.Scheme) { + scheme.AddKnownTypes(SchemeGroupVersion, + &KubeProxyConfiguration{}, + &KubeSchedulerConfiguration{}, + ) +} + +func (obj *KubeProxyConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *KubeSchedulerConfiguration) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/types.go b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/types.go new file mode 100644 index 000000000..7210541dd --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/types.go @@ -0,0 +1,129 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import "k8s.io/kubernetes/pkg/api/unversioned" + +type KubeProxyConfiguration struct { + unversioned.TypeMeta + + // bindAddress is the IP address for the proxy server to serve on (set to 0.0.0.0 + // for all interfaces) + BindAddress string `json:"bindAddress"` + // healthzBindAddress is the IP address for the health check server to serve on, + // defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces) + HealthzBindAddress string `json:"healthzBindAddress"` + // healthzPort is the port to bind the health check server. Use 0 to disable. + HealthzPort int32 `json:"healthzPort"` + // hostnameOverride, if non-empty, will be used as the identity instead of the actual hostname. + HostnameOverride string `json:"hostnameOverride"` + // iptablesMasqueradeBit is the bit of the iptables fwmark space to use for SNAT if using + // the pure iptables proxy mode. Values must be within the range [0, 31]. + IPTablesMasqueradeBit *int32 `json:"iptablesMasqueradeBit"` + // iptablesSyncPeriod is the period that iptables rules are refreshed (e.g. '5s', '1m', + // '2h22m'). Must be greater than 0. + IPTablesSyncPeriod unversioned.Duration `json:"iptablesSyncPeriodSeconds"` + // kubeconfigPath is the path to the kubeconfig file with authorization information (the + // master location is set by the master flag). + KubeconfigPath string `json:"kubeconfigPath"` + // masqueradeAll tells kube-proxy to SNAT everything if using the pure iptables proxy mode. + MasqueradeAll bool `json:"masqueradeAll"` + // master is the address of the Kubernetes API server (overrides any value in kubeconfig) + Master string `json:"master"` + // oomScoreAdj is the oom-score-adj value for kube-proxy process. Values must be within + // the range [-1000, 1000] + OOMScoreAdj *int32 `json:"oomScoreAdj"` + // mode specifies which proxy mode to use. + Mode ProxyMode `json:"mode"` + // portRange is the range of host ports (beginPort-endPort, inclusive) that may be consumed + // in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen. + PortRange string `json:"portRange"` + // resourceContainer is the bsolute name of the resource-only container to create and run + // the Kube-proxy in (Default: /kube-proxy). + ResourceContainer string `json:"resourceContainer"` + // udpIdleTimeout is how long an idle UDP connection will be kept open (e.g. '250ms', '2s'). + // Must be greater than 0. Only applicable for proxyMode=userspace. + UDPIdleTimeout unversioned.Duration `json:"udpTimeoutMilliseconds"` + // conntrackMax is the maximum number of NAT connections to track (0 to leave as-is)") + ConntrackMax int32 `json:"conntrackMax"` + // conntrackTCPEstablishedTimeout is how long an idle UDP connection will be kept open + // (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxyMode is Userspace + ConntrackTCPEstablishedTimeout unversioned.Duration `json:"conntrackTCPEstablishedTimeout"` +} + +// Currently two modes of proxying are available: 'userspace' (older, stable) or 'iptables' +// (experimental). If blank, look at the Node object on the Kubernetes API and respect the +// 'net.experimental.kubernetes.io/proxy-mode' annotation if provided. Otherwise use the +// best-available proxy (currently userspace, but may change in future versions). If the +// iptables proxy is selected, regardless of how, but the system's kernel or iptables +// versions are insufficient, this always falls back to the userspace proxy. +type ProxyMode string + +const ( + ProxyModeUserspace ProxyMode = "userspace" + ProxyModeIPTables ProxyMode = "iptables" +) + +type KubeSchedulerConfiguration struct { + unversioned.TypeMeta + + // port is the port that the scheduler's http service runs on. + Port int `json:"port"` + // address is the IP address to serve on. + Address string `json:"address"` + // algorithmProvider is the scheduling algorithm provider to use. + AlgorithmProvider string `json:"algorithmProvider"` + // policyConfigFile is the filepath to the scheduler policy configuration. + PolicyConfigFile string `json:"policyConfigFile"` + // enableProfiling enables profiling via web interface. + EnableProfiling *bool `json:"enableProfiling"` + // kubeAPIQPS is the QPS to use while talking with kubernetes apiserver. + KubeAPIQPS float32 `json:"kubeAPIQPS"` + // kubeAPIBurst is the QPS burst to use while talking with kubernetes apiserver. + KubeAPIBurst int `json:"kubeAPIBurst"` + // schedulerName is name of the scheduler, used to select which pods + // will be processed by this scheduler, based on pod's annotation with + // key 'scheduler.alpha.kubernetes.io/name'. + SchedulerName string `json:"schedulerName"` + // leaderElection defines the configuration of leader election client. + LeaderElection LeaderElectionConfiguration `json:"leaderElection"` +} + +// LeaderElectionConfiguration defines the configuration of leader election +// clients for components that can run with leader election enabled. +type LeaderElectionConfiguration struct { + // leaderElect enables a leader election client to gain leadership + // before executing the main loop. Enable this when running replicated + // components for high availability. + LeaderElect *bool `json:"leaderElect"` + // leaseDuration is the duration that non-leader candidates will wait + // after observing a leadership renewal until attempting to acquire + // leadership of a led but unrenewed leader slot. This is effectively the + // maximum duration that a leader can be stopped before it is replaced + // by another candidate. This is only applicable if leader election is + // enabled. + LeaseDuration unversioned.Duration `json:"leaseDuration"` + // renewDeadline is the interval between attempts by the acting master to + // renew a leadership slot before it stops leading. This must be less + // than or equal to the lease duration. This is only applicable if leader + // election is enabled. + RenewDeadline unversioned.Duration `json:"renewDeadline"` + // retryPeriod is the duration the clients should wait between attempting + // acquisition and renewal of a leadership. This is only applicable if + // leader election is enabled. + RetryPeriod unversioned.Duration `json:"retryPeriod"` +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/deep_copy_generated.go index 4d4f9984e..ff5898cfe 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/deep_copy_generated.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/deep_copy_generated.go @@ -18,1658 +18,10 @@ limitations under the License. package extensions -import ( - time "time" - - api "k8s.io/kubernetes/pkg/api" - resource "k8s.io/kubernetes/pkg/api/resource" - unversioned "k8s.io/kubernetes/pkg/api/unversioned" - conversion "k8s.io/kubernetes/pkg/conversion" - util "k8s.io/kubernetes/pkg/util" - inf "speter.net/go/exp/math/dec/inf" -) - -func deepCopy_api_AWSElasticBlockStoreVolumeSource(in api.AWSElasticBlockStoreVolumeSource, out *api.AWSElasticBlockStoreVolumeSource, c *conversion.Cloner) error { - out.VolumeID = in.VolumeID - out.FSType = in.FSType - out.Partition = in.Partition - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_Capabilities(in api.Capabilities, out *api.Capabilities, c *conversion.Cloner) error { - if in.Add != nil { - out.Add = make([]api.Capability, len(in.Add)) - for i := range in.Add { - out.Add[i] = in.Add[i] - } - } else { - out.Add = nil - } - if in.Drop != nil { - out.Drop = make([]api.Capability, len(in.Drop)) - for i := range in.Drop { - out.Drop[i] = in.Drop[i] - } - } else { - out.Drop = nil - } - return nil -} - -func deepCopy_api_CephFSVolumeSource(in api.CephFSVolumeSource, out *api.CephFSVolumeSource, c *conversion.Cloner) error { - if in.Monitors != nil { - out.Monitors = make([]string, len(in.Monitors)) - for i := range in.Monitors { - out.Monitors[i] = in.Monitors[i] - } - } else { - out.Monitors = nil - } - out.User = in.User - out.SecretFile = in.SecretFile - if in.SecretRef != nil { - out.SecretRef = new(api.LocalObjectReference) - if err := deepCopy_api_LocalObjectReference(*in.SecretRef, out.SecretRef, c); err != nil { - return err - } - } else { - out.SecretRef = nil - } - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_CinderVolumeSource(in api.CinderVolumeSource, out *api.CinderVolumeSource, c *conversion.Cloner) error { - out.VolumeID = in.VolumeID - out.FSType = in.FSType - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_Container(in api.Container, out *api.Container, c *conversion.Cloner) error { - out.Name = in.Name - out.Image = in.Image - if in.Command != nil { - out.Command = make([]string, len(in.Command)) - for i := range in.Command { - out.Command[i] = in.Command[i] - } - } else { - out.Command = nil - } - if in.Args != nil { - out.Args = make([]string, len(in.Args)) - for i := range in.Args { - out.Args[i] = in.Args[i] - } - } else { - out.Args = nil - } - out.WorkingDir = in.WorkingDir - if in.Ports != nil { - out.Ports = make([]api.ContainerPort, len(in.Ports)) - for i := range in.Ports { - if err := deepCopy_api_ContainerPort(in.Ports[i], &out.Ports[i], c); err != nil { - return err - } - } - } else { - out.Ports = nil - } - if in.Env != nil { - out.Env = make([]api.EnvVar, len(in.Env)) - for i := range in.Env { - if err := deepCopy_api_EnvVar(in.Env[i], &out.Env[i], c); err != nil { - return err - } - } - } else { - out.Env = nil - } - if err := deepCopy_api_ResourceRequirements(in.Resources, &out.Resources, c); err != nil { - return err - } - if in.VolumeMounts != nil { - out.VolumeMounts = make([]api.VolumeMount, len(in.VolumeMounts)) - for i := range in.VolumeMounts { - if err := deepCopy_api_VolumeMount(in.VolumeMounts[i], &out.VolumeMounts[i], c); err != nil { - return err - } - } - } else { - out.VolumeMounts = nil - } - if in.LivenessProbe != nil { - out.LivenessProbe = new(api.Probe) - if err := deepCopy_api_Probe(*in.LivenessProbe, out.LivenessProbe, c); err != nil { - return err - } - } else { - out.LivenessProbe = nil - } - if in.ReadinessProbe != nil { - out.ReadinessProbe = new(api.Probe) - if err := deepCopy_api_Probe(*in.ReadinessProbe, out.ReadinessProbe, c); err != nil { - return err - } - } else { - out.ReadinessProbe = nil - } - if in.Lifecycle != nil { - out.Lifecycle = new(api.Lifecycle) - if err := deepCopy_api_Lifecycle(*in.Lifecycle, out.Lifecycle, c); err != nil { - return err - } - } else { - out.Lifecycle = nil - } - out.TerminationMessagePath = in.TerminationMessagePath - out.ImagePullPolicy = in.ImagePullPolicy - if in.SecurityContext != nil { - out.SecurityContext = new(api.SecurityContext) - if err := deepCopy_api_SecurityContext(*in.SecurityContext, out.SecurityContext, c); err != nil { - return err - } - } else { - out.SecurityContext = nil - } - out.Stdin = in.Stdin - out.StdinOnce = in.StdinOnce - out.TTY = in.TTY - return nil -} - -func deepCopy_api_ContainerPort(in api.ContainerPort, out *api.ContainerPort, c *conversion.Cloner) error { - out.Name = in.Name - out.HostPort = in.HostPort - out.ContainerPort = in.ContainerPort - out.Protocol = in.Protocol - out.HostIP = in.HostIP - return nil -} - -func deepCopy_api_DownwardAPIVolumeFile(in api.DownwardAPIVolumeFile, out *api.DownwardAPIVolumeFile, c *conversion.Cloner) error { - out.Path = in.Path - if err := deepCopy_api_ObjectFieldSelector(in.FieldRef, &out.FieldRef, c); err != nil { - return err - } - return nil -} - -func deepCopy_api_DownwardAPIVolumeSource(in api.DownwardAPIVolumeSource, out *api.DownwardAPIVolumeSource, c *conversion.Cloner) error { - if in.Items != nil { - out.Items = make([]api.DownwardAPIVolumeFile, len(in.Items)) - for i := range in.Items { - if err := deepCopy_api_DownwardAPIVolumeFile(in.Items[i], &out.Items[i], c); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -func deepCopy_api_EmptyDirVolumeSource(in api.EmptyDirVolumeSource, out *api.EmptyDirVolumeSource, c *conversion.Cloner) error { - out.Medium = in.Medium - return nil -} - -func deepCopy_api_EnvVar(in api.EnvVar, out *api.EnvVar, c *conversion.Cloner) error { - out.Name = in.Name - out.Value = in.Value - if in.ValueFrom != nil { - out.ValueFrom = new(api.EnvVarSource) - if err := deepCopy_api_EnvVarSource(*in.ValueFrom, out.ValueFrom, c); err != nil { - return err - } - } else { - out.ValueFrom = nil - } - return nil -} - -func deepCopy_api_EnvVarSource(in api.EnvVarSource, out *api.EnvVarSource, c *conversion.Cloner) error { - if in.FieldRef != nil { - out.FieldRef = new(api.ObjectFieldSelector) - if err := deepCopy_api_ObjectFieldSelector(*in.FieldRef, out.FieldRef, c); err != nil { - return err - } - } else { - out.FieldRef = nil - } - return nil -} - -func deepCopy_api_ExecAction(in api.ExecAction, out *api.ExecAction, c *conversion.Cloner) error { - if in.Command != nil { - out.Command = make([]string, len(in.Command)) - for i := range in.Command { - out.Command[i] = in.Command[i] - } - } else { - out.Command = nil - } - return nil -} - -func deepCopy_api_FCVolumeSource(in api.FCVolumeSource, out *api.FCVolumeSource, c *conversion.Cloner) error { - if in.TargetWWNs != nil { - out.TargetWWNs = make([]string, len(in.TargetWWNs)) - for i := range in.TargetWWNs { - out.TargetWWNs[i] = in.TargetWWNs[i] - } - } else { - out.TargetWWNs = nil - } - if in.Lun != nil { - out.Lun = new(int) - *out.Lun = *in.Lun - } else { - out.Lun = nil - } - out.FSType = in.FSType - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_FlockerVolumeSource(in api.FlockerVolumeSource, out *api.FlockerVolumeSource, c *conversion.Cloner) error { - out.DatasetName = in.DatasetName - return nil -} - -func deepCopy_api_GCEPersistentDiskVolumeSource(in api.GCEPersistentDiskVolumeSource, out *api.GCEPersistentDiskVolumeSource, c *conversion.Cloner) error { - out.PDName = in.PDName - out.FSType = in.FSType - out.Partition = in.Partition - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_GitRepoVolumeSource(in api.GitRepoVolumeSource, out *api.GitRepoVolumeSource, c *conversion.Cloner) error { - out.Repository = in.Repository - out.Revision = in.Revision - return nil -} - -func deepCopy_api_GlusterfsVolumeSource(in api.GlusterfsVolumeSource, out *api.GlusterfsVolumeSource, c *conversion.Cloner) error { - out.EndpointsName = in.EndpointsName - out.Path = in.Path - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_HTTPGetAction(in api.HTTPGetAction, out *api.HTTPGetAction, c *conversion.Cloner) error { - out.Path = in.Path - if err := deepCopy_util_IntOrString(in.Port, &out.Port, c); err != nil { - return err - } - out.Host = in.Host - out.Scheme = in.Scheme - return nil -} - -func deepCopy_api_Handler(in api.Handler, out *api.Handler, c *conversion.Cloner) error { - if in.Exec != nil { - out.Exec = new(api.ExecAction) - if err := deepCopy_api_ExecAction(*in.Exec, out.Exec, c); err != nil { - return err - } - } else { - out.Exec = nil - } - if in.HTTPGet != nil { - out.HTTPGet = new(api.HTTPGetAction) - if err := deepCopy_api_HTTPGetAction(*in.HTTPGet, out.HTTPGet, c); err != nil { - return err - } - } else { - out.HTTPGet = nil - } - if in.TCPSocket != nil { - out.TCPSocket = new(api.TCPSocketAction) - if err := deepCopy_api_TCPSocketAction(*in.TCPSocket, out.TCPSocket, c); err != nil { - return err - } - } else { - out.TCPSocket = nil - } - return nil -} - -func deepCopy_api_HostPathVolumeSource(in api.HostPathVolumeSource, out *api.HostPathVolumeSource, c *conversion.Cloner) error { - out.Path = in.Path - return nil -} - -func deepCopy_api_ISCSIVolumeSource(in api.ISCSIVolumeSource, out *api.ISCSIVolumeSource, c *conversion.Cloner) error { - out.TargetPortal = in.TargetPortal - out.IQN = in.IQN - out.Lun = in.Lun - out.FSType = in.FSType - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_Lifecycle(in api.Lifecycle, out *api.Lifecycle, c *conversion.Cloner) error { - if in.PostStart != nil { - out.PostStart = new(api.Handler) - if err := deepCopy_api_Handler(*in.PostStart, out.PostStart, c); err != nil { - return err - } - } else { - out.PostStart = nil - } - if in.PreStop != nil { - out.PreStop = new(api.Handler) - if err := deepCopy_api_Handler(*in.PreStop, out.PreStop, c); err != nil { - return err - } - } else { - out.PreStop = nil - } - return nil -} - -func deepCopy_api_LoadBalancerIngress(in api.LoadBalancerIngress, out *api.LoadBalancerIngress, c *conversion.Cloner) error { - out.IP = in.IP - out.Hostname = in.Hostname - return nil -} - -func deepCopy_api_LoadBalancerStatus(in api.LoadBalancerStatus, out *api.LoadBalancerStatus, c *conversion.Cloner) error { - if in.Ingress != nil { - out.Ingress = make([]api.LoadBalancerIngress, len(in.Ingress)) - for i := range in.Ingress { - if err := deepCopy_api_LoadBalancerIngress(in.Ingress[i], &out.Ingress[i], c); err != nil { - return err - } - } - } else { - out.Ingress = nil - } - return nil -} - -func deepCopy_api_LocalObjectReference(in api.LocalObjectReference, out *api.LocalObjectReference, c *conversion.Cloner) error { - out.Name = in.Name - return nil -} - -func deepCopy_api_NFSVolumeSource(in api.NFSVolumeSource, out *api.NFSVolumeSource, c *conversion.Cloner) error { - out.Server = in.Server - out.Path = in.Path - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_ObjectFieldSelector(in api.ObjectFieldSelector, out *api.ObjectFieldSelector, c *conversion.Cloner) error { - out.APIVersion = in.APIVersion - out.FieldPath = in.FieldPath - return nil -} - -func deepCopy_api_ObjectMeta(in api.ObjectMeta, out *api.ObjectMeta, c *conversion.Cloner) error { - out.Name = in.Name - out.GenerateName = in.GenerateName - out.Namespace = in.Namespace - out.SelfLink = in.SelfLink - out.UID = in.UID - out.ResourceVersion = in.ResourceVersion - out.Generation = in.Generation - if err := deepCopy_unversioned_Time(in.CreationTimestamp, &out.CreationTimestamp, c); err != nil { - return err - } - if in.DeletionTimestamp != nil { - out.DeletionTimestamp = new(unversioned.Time) - if err := deepCopy_unversioned_Time(*in.DeletionTimestamp, out.DeletionTimestamp, c); err != nil { - return err - } - } else { - out.DeletionTimestamp = nil - } - if in.DeletionGracePeriodSeconds != nil { - out.DeletionGracePeriodSeconds = new(int64) - *out.DeletionGracePeriodSeconds = *in.DeletionGracePeriodSeconds - } else { - out.DeletionGracePeriodSeconds = nil - } - if in.Labels != nil { - out.Labels = make(map[string]string) - for key, val := range in.Labels { - out.Labels[key] = val - } - } else { - out.Labels = nil - } - if in.Annotations != nil { - out.Annotations = make(map[string]string) - for key, val := range in.Annotations { - out.Annotations[key] = val - } - } else { - out.Annotations = nil - } - return nil -} - -func deepCopy_api_PersistentVolumeClaimVolumeSource(in api.PersistentVolumeClaimVolumeSource, out *api.PersistentVolumeClaimVolumeSource, c *conversion.Cloner) error { - out.ClaimName = in.ClaimName - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_PodSecurityContext(in api.PodSecurityContext, out *api.PodSecurityContext, c *conversion.Cloner) error { - out.HostNetwork = in.HostNetwork - out.HostPID = in.HostPID - out.HostIPC = in.HostIPC - if in.SupplementalGroups != nil { - out.SupplementalGroups = make([]int64, len(in.SupplementalGroups)) - for i := range in.SupplementalGroups { - out.SupplementalGroups[i] = in.SupplementalGroups[i] - } - } else { - out.SupplementalGroups = nil - } - if in.SELinuxOptions != nil { - out.SELinuxOptions = new(api.SELinuxOptions) - if err := deepCopy_api_SELinuxOptions(*in.SELinuxOptions, out.SELinuxOptions, c); err != nil { - return err - } - } else { - out.SELinuxOptions = nil - } - if in.RunAsUser != nil { - out.RunAsUser = new(int64) - *out.RunAsUser = *in.RunAsUser - } else { - out.RunAsUser = nil - } - if in.RunAsNonRoot != nil { - out.RunAsNonRoot = new(bool) - *out.RunAsNonRoot = *in.RunAsNonRoot - } else { - out.RunAsNonRoot = nil - } - return nil -} - -func deepCopy_api_PodSpec(in api.PodSpec, out *api.PodSpec, c *conversion.Cloner) error { - if in.Volumes != nil { - out.Volumes = make([]api.Volume, len(in.Volumes)) - for i := range in.Volumes { - if err := deepCopy_api_Volume(in.Volumes[i], &out.Volumes[i], c); err != nil { - return err - } - } - } else { - out.Volumes = nil - } - if in.Containers != nil { - out.Containers = make([]api.Container, len(in.Containers)) - for i := range in.Containers { - if err := deepCopy_api_Container(in.Containers[i], &out.Containers[i], c); err != nil { - return err - } - } - } else { - out.Containers = nil - } - out.RestartPolicy = in.RestartPolicy - if in.TerminationGracePeriodSeconds != nil { - out.TerminationGracePeriodSeconds = new(int64) - *out.TerminationGracePeriodSeconds = *in.TerminationGracePeriodSeconds - } else { - out.TerminationGracePeriodSeconds = nil - } - if in.ActiveDeadlineSeconds != nil { - out.ActiveDeadlineSeconds = new(int64) - *out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds - } else { - out.ActiveDeadlineSeconds = nil - } - out.DNSPolicy = in.DNSPolicy - if in.NodeSelector != nil { - out.NodeSelector = make(map[string]string) - for key, val := range in.NodeSelector { - out.NodeSelector[key] = val - } - } else { - out.NodeSelector = nil - } - out.ServiceAccountName = in.ServiceAccountName - out.NodeName = in.NodeName - if in.SecurityContext != nil { - out.SecurityContext = new(api.PodSecurityContext) - if err := deepCopy_api_PodSecurityContext(*in.SecurityContext, out.SecurityContext, c); err != nil { - return err - } - } else { - out.SecurityContext = nil - } - if in.ImagePullSecrets != nil { - out.ImagePullSecrets = make([]api.LocalObjectReference, len(in.ImagePullSecrets)) - for i := range in.ImagePullSecrets { - if err := deepCopy_api_LocalObjectReference(in.ImagePullSecrets[i], &out.ImagePullSecrets[i], c); err != nil { - return err - } - } - } else { - out.ImagePullSecrets = nil - } - return nil -} - -func deepCopy_api_PodTemplateSpec(in api.PodTemplateSpec, out *api.PodTemplateSpec, c *conversion.Cloner) error { - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - if err := deepCopy_api_PodSpec(in.Spec, &out.Spec, c); err != nil { - return err - } - return nil -} - -func deepCopy_api_Probe(in api.Probe, out *api.Probe, c *conversion.Cloner) error { - if err := deepCopy_api_Handler(in.Handler, &out.Handler, c); err != nil { - return err - } - out.InitialDelaySeconds = in.InitialDelaySeconds - out.TimeoutSeconds = in.TimeoutSeconds - return nil -} - -func deepCopy_api_RBDVolumeSource(in api.RBDVolumeSource, out *api.RBDVolumeSource, c *conversion.Cloner) error { - if in.CephMonitors != nil { - out.CephMonitors = make([]string, len(in.CephMonitors)) - for i := range in.CephMonitors { - out.CephMonitors[i] = in.CephMonitors[i] - } - } else { - out.CephMonitors = nil - } - out.RBDImage = in.RBDImage - out.FSType = in.FSType - out.RBDPool = in.RBDPool - out.RadosUser = in.RadosUser - out.Keyring = in.Keyring - if in.SecretRef != nil { - out.SecretRef = new(api.LocalObjectReference) - if err := deepCopy_api_LocalObjectReference(*in.SecretRef, out.SecretRef, c); err != nil { - return err - } - } else { - out.SecretRef = nil - } - out.ReadOnly = in.ReadOnly - return nil -} - -func deepCopy_api_ResourceRequirements(in api.ResourceRequirements, out *api.ResourceRequirements, c *conversion.Cloner) error { - if in.Limits != nil { - out.Limits = make(api.ResourceList) - for key, val := range in.Limits { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { - return err - } - out.Limits[key] = *newVal - } - } else { - out.Limits = nil - } - if in.Requests != nil { - out.Requests = make(api.ResourceList) - for key, val := range in.Requests { - newVal := new(resource.Quantity) - if err := deepCopy_resource_Quantity(val, newVal, c); err != nil { - return err - } - out.Requests[key] = *newVal - } - } else { - out.Requests = nil - } - return nil -} - -func deepCopy_api_SELinuxOptions(in api.SELinuxOptions, out *api.SELinuxOptions, c *conversion.Cloner) error { - out.User = in.User - out.Role = in.Role - out.Type = in.Type - out.Level = in.Level - return nil -} - -func deepCopy_api_SecretVolumeSource(in api.SecretVolumeSource, out *api.SecretVolumeSource, c *conversion.Cloner) error { - out.SecretName = in.SecretName - return nil -} - -func deepCopy_api_SecurityContext(in api.SecurityContext, out *api.SecurityContext, c *conversion.Cloner) error { - if in.Capabilities != nil { - out.Capabilities = new(api.Capabilities) - if err := deepCopy_api_Capabilities(*in.Capabilities, out.Capabilities, c); err != nil { - return err - } - } else { - out.Capabilities = nil - } - if in.Privileged != nil { - out.Privileged = new(bool) - *out.Privileged = *in.Privileged - } else { - out.Privileged = nil - } - if in.SELinuxOptions != nil { - out.SELinuxOptions = new(api.SELinuxOptions) - if err := deepCopy_api_SELinuxOptions(*in.SELinuxOptions, out.SELinuxOptions, c); err != nil { - return err - } - } else { - out.SELinuxOptions = nil - } - if in.RunAsUser != nil { - out.RunAsUser = new(int64) - *out.RunAsUser = *in.RunAsUser - } else { - out.RunAsUser = nil - } - if in.RunAsNonRoot != nil { - out.RunAsNonRoot = new(bool) - *out.RunAsNonRoot = *in.RunAsNonRoot - } else { - out.RunAsNonRoot = nil - } - return nil -} - -func deepCopy_api_TCPSocketAction(in api.TCPSocketAction, out *api.TCPSocketAction, c *conversion.Cloner) error { - if err := deepCopy_util_IntOrString(in.Port, &out.Port, c); err != nil { - return err - } - return nil -} - -func deepCopy_api_Volume(in api.Volume, out *api.Volume, c *conversion.Cloner) error { - out.Name = in.Name - if err := deepCopy_api_VolumeSource(in.VolumeSource, &out.VolumeSource, c); err != nil { - return err - } - return nil -} - -func deepCopy_api_VolumeMount(in api.VolumeMount, out *api.VolumeMount, c *conversion.Cloner) error { - out.Name = in.Name - out.ReadOnly = in.ReadOnly - out.MountPath = in.MountPath - return nil -} - -func deepCopy_api_VolumeSource(in api.VolumeSource, out *api.VolumeSource, c *conversion.Cloner) error { - if in.HostPath != nil { - out.HostPath = new(api.HostPathVolumeSource) - if err := deepCopy_api_HostPathVolumeSource(*in.HostPath, out.HostPath, c); err != nil { - return err - } - } else { - out.HostPath = nil - } - if in.EmptyDir != nil { - out.EmptyDir = new(api.EmptyDirVolumeSource) - if err := deepCopy_api_EmptyDirVolumeSource(*in.EmptyDir, out.EmptyDir, c); err != nil { - return err - } - } else { - out.EmptyDir = nil - } - if in.GCEPersistentDisk != nil { - out.GCEPersistentDisk = new(api.GCEPersistentDiskVolumeSource) - if err := deepCopy_api_GCEPersistentDiskVolumeSource(*in.GCEPersistentDisk, out.GCEPersistentDisk, c); err != nil { - return err - } - } else { - out.GCEPersistentDisk = nil - } - if in.AWSElasticBlockStore != nil { - out.AWSElasticBlockStore = new(api.AWSElasticBlockStoreVolumeSource) - if err := deepCopy_api_AWSElasticBlockStoreVolumeSource(*in.AWSElasticBlockStore, out.AWSElasticBlockStore, c); err != nil { - return err - } - } else { - out.AWSElasticBlockStore = nil - } - if in.GitRepo != nil { - out.GitRepo = new(api.GitRepoVolumeSource) - if err := deepCopy_api_GitRepoVolumeSource(*in.GitRepo, out.GitRepo, c); err != nil { - return err - } - } else { - out.GitRepo = nil - } - if in.Secret != nil { - out.Secret = new(api.SecretVolumeSource) - if err := deepCopy_api_SecretVolumeSource(*in.Secret, out.Secret, c); err != nil { - return err - } - } else { - out.Secret = nil - } - if in.NFS != nil { - out.NFS = new(api.NFSVolumeSource) - if err := deepCopy_api_NFSVolumeSource(*in.NFS, out.NFS, c); err != nil { - return err - } - } else { - out.NFS = nil - } - if in.ISCSI != nil { - out.ISCSI = new(api.ISCSIVolumeSource) - if err := deepCopy_api_ISCSIVolumeSource(*in.ISCSI, out.ISCSI, c); err != nil { - return err - } - } else { - out.ISCSI = nil - } - if in.Glusterfs != nil { - out.Glusterfs = new(api.GlusterfsVolumeSource) - if err := deepCopy_api_GlusterfsVolumeSource(*in.Glusterfs, out.Glusterfs, c); err != nil { - return err - } - } else { - out.Glusterfs = nil - } - if in.PersistentVolumeClaim != nil { - out.PersistentVolumeClaim = new(api.PersistentVolumeClaimVolumeSource) - if err := deepCopy_api_PersistentVolumeClaimVolumeSource(*in.PersistentVolumeClaim, out.PersistentVolumeClaim, c); err != nil { - return err - } - } else { - out.PersistentVolumeClaim = nil - } - if in.RBD != nil { - out.RBD = new(api.RBDVolumeSource) - if err := deepCopy_api_RBDVolumeSource(*in.RBD, out.RBD, c); err != nil { - return err - } - } else { - out.RBD = nil - } - if in.Cinder != nil { - out.Cinder = new(api.CinderVolumeSource) - if err := deepCopy_api_CinderVolumeSource(*in.Cinder, out.Cinder, c); err != nil { - return err - } - } else { - out.Cinder = nil - } - if in.CephFS != nil { - out.CephFS = new(api.CephFSVolumeSource) - if err := deepCopy_api_CephFSVolumeSource(*in.CephFS, out.CephFS, c); err != nil { - return err - } - } else { - out.CephFS = nil - } - if in.Flocker != nil { - out.Flocker = new(api.FlockerVolumeSource) - if err := deepCopy_api_FlockerVolumeSource(*in.Flocker, out.Flocker, c); err != nil { - return err - } - } else { - out.Flocker = nil - } - if in.DownwardAPI != nil { - out.DownwardAPI = new(api.DownwardAPIVolumeSource) - if err := deepCopy_api_DownwardAPIVolumeSource(*in.DownwardAPI, out.DownwardAPI, c); err != nil { - return err - } - } else { - out.DownwardAPI = nil - } - if in.FC != nil { - out.FC = new(api.FCVolumeSource) - if err := deepCopy_api_FCVolumeSource(*in.FC, out.FC, c); err != nil { - return err - } - } else { - out.FC = nil - } - return nil -} - -func deepCopy_resource_Quantity(in resource.Quantity, out *resource.Quantity, c *conversion.Cloner) error { - if in.Amount != nil { - if newVal, err := c.DeepCopy(in.Amount); err != nil { - return err - } else { - out.Amount = newVal.(*inf.Dec) - } - } else { - out.Amount = nil - } - out.Format = in.Format - return nil -} - -func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.ListMeta, c *conversion.Cloner) error { - out.SelfLink = in.SelfLink - out.ResourceVersion = in.ResourceVersion - return nil -} - -func deepCopy_unversioned_Time(in unversioned.Time, out *unversioned.Time, c *conversion.Cloner) error { - if newVal, err := c.DeepCopy(in.Time); err != nil { - return err - } else { - out.Time = newVal.(time.Time) - } - return nil -} - -func deepCopy_unversioned_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error { - out.Kind = in.Kind - out.APIVersion = in.APIVersion - return nil -} - -func deepCopy_extensions_APIVersion(in APIVersion, out *APIVersion, c *conversion.Cloner) error { - out.Name = in.Name - out.APIGroup = in.APIGroup - return nil -} - -func deepCopy_extensions_CPUTargetUtilization(in CPUTargetUtilization, out *CPUTargetUtilization, c *conversion.Cloner) error { - out.TargetPercentage = in.TargetPercentage - return nil -} - -func deepCopy_extensions_ClusterAutoscaler(in ClusterAutoscaler, out *ClusterAutoscaler, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - if err := deepCopy_extensions_ClusterAutoscalerSpec(in.Spec, &out.Spec, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_ClusterAutoscalerList(in ClusterAutoscalerList, out *ClusterAutoscalerList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { - return err - } - if in.Items != nil { - out.Items = make([]ClusterAutoscaler, len(in.Items)) - for i := range in.Items { - if err := deepCopy_extensions_ClusterAutoscaler(in.Items[i], &out.Items[i], c); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -func deepCopy_extensions_ClusterAutoscalerSpec(in ClusterAutoscalerSpec, out *ClusterAutoscalerSpec, c *conversion.Cloner) error { - out.MinNodes = in.MinNodes - out.MaxNodes = in.MaxNodes - if in.TargetUtilization != nil { - out.TargetUtilization = make([]NodeUtilization, len(in.TargetUtilization)) - for i := range in.TargetUtilization { - if err := deepCopy_extensions_NodeUtilization(in.TargetUtilization[i], &out.TargetUtilization[i], c); err != nil { - return err - } - } - } else { - out.TargetUtilization = nil - } - return nil -} - -func deepCopy_extensions_DaemonSet(in DaemonSet, out *DaemonSet, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - if err := deepCopy_extensions_DaemonSetSpec(in.Spec, &out.Spec, c); err != nil { - return err - } - if err := deepCopy_extensions_DaemonSetStatus(in.Status, &out.Status, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_DaemonSetList(in DaemonSetList, out *DaemonSetList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { - return err - } - if in.Items != nil { - out.Items = make([]DaemonSet, len(in.Items)) - for i := range in.Items { - if err := deepCopy_extensions_DaemonSet(in.Items[i], &out.Items[i], c); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -func deepCopy_extensions_DaemonSetSpec(in DaemonSetSpec, out *DaemonSetSpec, c *conversion.Cloner) error { - if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val - } - } else { - out.Selector = nil - } - if in.Template != nil { - out.Template = new(api.PodTemplateSpec) - if err := deepCopy_api_PodTemplateSpec(*in.Template, out.Template, c); err != nil { - return err - } - } else { - out.Template = nil - } - return nil -} - -func deepCopy_extensions_DaemonSetStatus(in DaemonSetStatus, out *DaemonSetStatus, c *conversion.Cloner) error { - out.CurrentNumberScheduled = in.CurrentNumberScheduled - out.NumberMisscheduled = in.NumberMisscheduled - out.DesiredNumberScheduled = in.DesiredNumberScheduled - return nil -} - -func deepCopy_extensions_Deployment(in Deployment, out *Deployment, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - if err := deepCopy_extensions_DeploymentSpec(in.Spec, &out.Spec, c); err != nil { - return err - } - if err := deepCopy_extensions_DeploymentStatus(in.Status, &out.Status, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_DeploymentList(in DeploymentList, out *DeploymentList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { - return err - } - if in.Items != nil { - out.Items = make([]Deployment, len(in.Items)) - for i := range in.Items { - if err := deepCopy_extensions_Deployment(in.Items[i], &out.Items[i], c); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -func deepCopy_extensions_DeploymentSpec(in DeploymentSpec, out *DeploymentSpec, c *conversion.Cloner) error { - out.Replicas = in.Replicas - if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val - } - } else { - out.Selector = nil - } - if in.Template != nil { - out.Template = new(api.PodTemplateSpec) - if err := deepCopy_api_PodTemplateSpec(*in.Template, out.Template, c); err != nil { - return err - } - } else { - out.Template = nil - } - if err := deepCopy_extensions_DeploymentStrategy(in.Strategy, &out.Strategy, c); err != nil { - return err - } - out.UniqueLabelKey = in.UniqueLabelKey - return nil -} - -func deepCopy_extensions_DeploymentStatus(in DeploymentStatus, out *DeploymentStatus, c *conversion.Cloner) error { - out.Replicas = in.Replicas - out.UpdatedReplicas = in.UpdatedReplicas - return nil -} - -func deepCopy_extensions_DeploymentStrategy(in DeploymentStrategy, out *DeploymentStrategy, c *conversion.Cloner) error { - out.Type = in.Type - if in.RollingUpdate != nil { - out.RollingUpdate = new(RollingUpdateDeployment) - if err := deepCopy_extensions_RollingUpdateDeployment(*in.RollingUpdate, out.RollingUpdate, c); err != nil { - return err - } - } else { - out.RollingUpdate = nil - } - return nil -} - -func deepCopy_extensions_HTTPIngressPath(in HTTPIngressPath, out *HTTPIngressPath, c *conversion.Cloner) error { - out.Path = in.Path - if err := deepCopy_extensions_IngressBackend(in.Backend, &out.Backend, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_HTTPIngressRuleValue(in HTTPIngressRuleValue, out *HTTPIngressRuleValue, c *conversion.Cloner) error { - if in.Paths != nil { - out.Paths = make([]HTTPIngressPath, len(in.Paths)) - for i := range in.Paths { - if err := deepCopy_extensions_HTTPIngressPath(in.Paths[i], &out.Paths[i], c); err != nil { - return err - } - } - } else { - out.Paths = nil - } - return nil -} - -func deepCopy_extensions_HorizontalPodAutoscaler(in HorizontalPodAutoscaler, out *HorizontalPodAutoscaler, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - if err := deepCopy_extensions_HorizontalPodAutoscalerSpec(in.Spec, &out.Spec, c); err != nil { - return err - } - if err := deepCopy_extensions_HorizontalPodAutoscalerStatus(in.Status, &out.Status, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_HorizontalPodAutoscalerList(in HorizontalPodAutoscalerList, out *HorizontalPodAutoscalerList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { - return err - } - if in.Items != nil { - out.Items = make([]HorizontalPodAutoscaler, len(in.Items)) - for i := range in.Items { - if err := deepCopy_extensions_HorizontalPodAutoscaler(in.Items[i], &out.Items[i], c); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -func deepCopy_extensions_HorizontalPodAutoscalerSpec(in HorizontalPodAutoscalerSpec, out *HorizontalPodAutoscalerSpec, c *conversion.Cloner) error { - if err := deepCopy_extensions_SubresourceReference(in.ScaleRef, &out.ScaleRef, c); err != nil { - return err - } - if in.MinReplicas != nil { - out.MinReplicas = new(int) - *out.MinReplicas = *in.MinReplicas - } else { - out.MinReplicas = nil - } - out.MaxReplicas = in.MaxReplicas - if in.CPUUtilization != nil { - out.CPUUtilization = new(CPUTargetUtilization) - if err := deepCopy_extensions_CPUTargetUtilization(*in.CPUUtilization, out.CPUUtilization, c); err != nil { - return err - } - } else { - out.CPUUtilization = nil - } - return nil -} - -func deepCopy_extensions_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscalerStatus, out *HorizontalPodAutoscalerStatus, c *conversion.Cloner) error { - if in.ObservedGeneration != nil { - out.ObservedGeneration = new(int64) - *out.ObservedGeneration = *in.ObservedGeneration - } else { - out.ObservedGeneration = nil - } - if in.LastScaleTime != nil { - out.LastScaleTime = new(unversioned.Time) - if err := deepCopy_unversioned_Time(*in.LastScaleTime, out.LastScaleTime, c); err != nil { - return err - } - } else { - out.LastScaleTime = nil - } - out.CurrentReplicas = in.CurrentReplicas - out.DesiredReplicas = in.DesiredReplicas - if in.CurrentCPUUtilizationPercentage != nil { - out.CurrentCPUUtilizationPercentage = new(int) - *out.CurrentCPUUtilizationPercentage = *in.CurrentCPUUtilizationPercentage - } else { - out.CurrentCPUUtilizationPercentage = nil - } - return nil -} - -func deepCopy_extensions_Ingress(in Ingress, out *Ingress, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - if err := deepCopy_extensions_IngressSpec(in.Spec, &out.Spec, c); err != nil { - return err - } - if err := deepCopy_extensions_IngressStatus(in.Status, &out.Status, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_IngressBackend(in IngressBackend, out *IngressBackend, c *conversion.Cloner) error { - out.ServiceName = in.ServiceName - if err := deepCopy_util_IntOrString(in.ServicePort, &out.ServicePort, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_IngressList(in IngressList, out *IngressList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { - return err - } - if in.Items != nil { - out.Items = make([]Ingress, len(in.Items)) - for i := range in.Items { - if err := deepCopy_extensions_Ingress(in.Items[i], &out.Items[i], c); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -func deepCopy_extensions_IngressRule(in IngressRule, out *IngressRule, c *conversion.Cloner) error { - out.Host = in.Host - if err := deepCopy_extensions_IngressRuleValue(in.IngressRuleValue, &out.IngressRuleValue, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_IngressRuleValue(in IngressRuleValue, out *IngressRuleValue, c *conversion.Cloner) error { - if in.HTTP != nil { - out.HTTP = new(HTTPIngressRuleValue) - if err := deepCopy_extensions_HTTPIngressRuleValue(*in.HTTP, out.HTTP, c); err != nil { - return err - } - } else { - out.HTTP = nil - } - return nil -} - -func deepCopy_extensions_IngressSpec(in IngressSpec, out *IngressSpec, c *conversion.Cloner) error { - if in.Backend != nil { - out.Backend = new(IngressBackend) - if err := deepCopy_extensions_IngressBackend(*in.Backend, out.Backend, c); err != nil { - return err - } - } else { - out.Backend = nil - } - if in.Rules != nil { - out.Rules = make([]IngressRule, len(in.Rules)) - for i := range in.Rules { - if err := deepCopy_extensions_IngressRule(in.Rules[i], &out.Rules[i], c); err != nil { - return err - } - } - } else { - out.Rules = nil - } - return nil -} - -func deepCopy_extensions_IngressStatus(in IngressStatus, out *IngressStatus, c *conversion.Cloner) error { - if err := deepCopy_api_LoadBalancerStatus(in.LoadBalancer, &out.LoadBalancer, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_Job(in Job, out *Job, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - if err := deepCopy_extensions_JobSpec(in.Spec, &out.Spec, c); err != nil { - return err - } - if err := deepCopy_extensions_JobStatus(in.Status, &out.Status, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_JobCondition(in JobCondition, out *JobCondition, c *conversion.Cloner) error { - out.Type = in.Type - out.Status = in.Status - if err := deepCopy_unversioned_Time(in.LastProbeTime, &out.LastProbeTime, c); err != nil { - return err - } - if err := deepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil { - return err - } - out.Reason = in.Reason - out.Message = in.Message - return nil -} - -func deepCopy_extensions_JobList(in JobList, out *JobList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { - return err - } - if in.Items != nil { - out.Items = make([]Job, len(in.Items)) - for i := range in.Items { - if err := deepCopy_extensions_Job(in.Items[i], &out.Items[i], c); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -func deepCopy_extensions_JobSpec(in JobSpec, out *JobSpec, c *conversion.Cloner) error { - if in.Parallelism != nil { - out.Parallelism = new(int) - *out.Parallelism = *in.Parallelism - } else { - out.Parallelism = nil - } - if in.Completions != nil { - out.Completions = new(int) - *out.Completions = *in.Completions - } else { - out.Completions = nil - } - if in.Selector != nil { - out.Selector = new(PodSelector) - if err := deepCopy_extensions_PodSelector(*in.Selector, out.Selector, c); err != nil { - return err - } - } else { - out.Selector = nil - } - if err := deepCopy_api_PodTemplateSpec(in.Template, &out.Template, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_JobStatus(in JobStatus, out *JobStatus, c *conversion.Cloner) error { - if in.Conditions != nil { - out.Conditions = make([]JobCondition, len(in.Conditions)) - for i := range in.Conditions { - if err := deepCopy_extensions_JobCondition(in.Conditions[i], &out.Conditions[i], c); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - if in.StartTime != nil { - out.StartTime = new(unversioned.Time) - if err := deepCopy_unversioned_Time(*in.StartTime, out.StartTime, c); err != nil { - return err - } - } else { - out.StartTime = nil - } - if in.CompletionTime != nil { - out.CompletionTime = new(unversioned.Time) - if err := deepCopy_unversioned_Time(*in.CompletionTime, out.CompletionTime, c); err != nil { - return err - } - } else { - out.CompletionTime = nil - } - out.Active = in.Active - out.Succeeded = in.Succeeded - out.Failed = in.Failed - return nil -} - -func deepCopy_extensions_NodeUtilization(in NodeUtilization, out *NodeUtilization, c *conversion.Cloner) error { - out.Resource = in.Resource - out.Value = in.Value - return nil -} - -func deepCopy_extensions_PodSelector(in PodSelector, out *PodSelector, c *conversion.Cloner) error { - if in.MatchLabels != nil { - out.MatchLabels = make(map[string]string) - for key, val := range in.MatchLabels { - out.MatchLabels[key] = val - } - } else { - out.MatchLabels = nil - } - if in.MatchExpressions != nil { - out.MatchExpressions = make([]PodSelectorRequirement, len(in.MatchExpressions)) - for i := range in.MatchExpressions { - if err := deepCopy_extensions_PodSelectorRequirement(in.MatchExpressions[i], &out.MatchExpressions[i], c); err != nil { - return err - } - } - } else { - out.MatchExpressions = nil - } - return nil -} - -func deepCopy_extensions_PodSelectorRequirement(in PodSelectorRequirement, out *PodSelectorRequirement, c *conversion.Cloner) error { - out.Key = in.Key - out.Operator = in.Operator - if in.Values != nil { - out.Values = make([]string, len(in.Values)) - for i := range in.Values { - out.Values[i] = in.Values[i] - } - } else { - out.Values = nil - } - return nil -} - -func deepCopy_extensions_ReplicationControllerDummy(in ReplicationControllerDummy, out *ReplicationControllerDummy, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_RollingUpdateDeployment(in RollingUpdateDeployment, out *RollingUpdateDeployment, c *conversion.Cloner) error { - if err := deepCopy_util_IntOrString(in.MaxUnavailable, &out.MaxUnavailable, c); err != nil { - return err - } - if err := deepCopy_util_IntOrString(in.MaxSurge, &out.MaxSurge, c); err != nil { - return err - } - out.MinReadySeconds = in.MinReadySeconds - return nil -} - -func deepCopy_extensions_Scale(in Scale, out *Scale, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - if err := deepCopy_extensions_ScaleSpec(in.Spec, &out.Spec, c); err != nil { - return err - } - if err := deepCopy_extensions_ScaleStatus(in.Status, &out.Status, c); err != nil { - return err - } - return nil -} - -func deepCopy_extensions_ScaleSpec(in ScaleSpec, out *ScaleSpec, c *conversion.Cloner) error { - out.Replicas = in.Replicas - return nil -} - -func deepCopy_extensions_ScaleStatus(in ScaleStatus, out *ScaleStatus, c *conversion.Cloner) error { - out.Replicas = in.Replicas - if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val - } - } else { - out.Selector = nil - } - return nil -} - -func deepCopy_extensions_SubresourceReference(in SubresourceReference, out *SubresourceReference, c *conversion.Cloner) error { - out.Kind = in.Kind - out.Namespace = in.Namespace - out.Name = in.Name - out.APIVersion = in.APIVersion - out.Subresource = in.Subresource - return nil -} - -func deepCopy_extensions_ThirdPartyResource(in ThirdPartyResource, out *ThirdPartyResource, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - out.Description = in.Description - if in.Versions != nil { - out.Versions = make([]APIVersion, len(in.Versions)) - for i := range in.Versions { - if err := deepCopy_extensions_APIVersion(in.Versions[i], &out.Versions[i], c); err != nil { - return err - } - } - } else { - out.Versions = nil - } - return nil -} - -func deepCopy_extensions_ThirdPartyResourceData(in ThirdPartyResourceData, out *ThirdPartyResourceData, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { - return err - } - if in.Data != nil { - out.Data = make([]uint8, len(in.Data)) - for i := range in.Data { - out.Data[i] = in.Data[i] - } - } else { - out.Data = nil - } - return nil -} - -func deepCopy_extensions_ThirdPartyResourceDataList(in ThirdPartyResourceDataList, out *ThirdPartyResourceDataList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { - return err - } - if in.Items != nil { - out.Items = make([]ThirdPartyResourceData, len(in.Items)) - for i := range in.Items { - if err := deepCopy_extensions_ThirdPartyResourceData(in.Items[i], &out.Items[i], c); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -func deepCopy_extensions_ThirdPartyResourceList(in ThirdPartyResourceList, out *ThirdPartyResourceList, c *conversion.Cloner) error { - if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { - return err - } - if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { - return err - } - if in.Items != nil { - out.Items = make([]ThirdPartyResource, len(in.Items)) - for i := range in.Items { - if err := deepCopy_extensions_ThirdPartyResource(in.Items[i], &out.Items[i], c); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *conversion.Cloner) error { - out.Kind = in.Kind - out.IntVal = in.IntVal - out.StrVal = in.StrVal - return nil -} +import api "k8s.io/kubernetes/pkg/api" func init() { - err := api.Scheme.AddGeneratedDeepCopyFuncs( - deepCopy_api_AWSElasticBlockStoreVolumeSource, - deepCopy_api_Capabilities, - deepCopy_api_CephFSVolumeSource, - deepCopy_api_CinderVolumeSource, - deepCopy_api_Container, - deepCopy_api_ContainerPort, - deepCopy_api_DownwardAPIVolumeFile, - deepCopy_api_DownwardAPIVolumeSource, - deepCopy_api_EmptyDirVolumeSource, - deepCopy_api_EnvVar, - deepCopy_api_EnvVarSource, - deepCopy_api_ExecAction, - deepCopy_api_FCVolumeSource, - deepCopy_api_FlockerVolumeSource, - deepCopy_api_GCEPersistentDiskVolumeSource, - deepCopy_api_GitRepoVolumeSource, - deepCopy_api_GlusterfsVolumeSource, - deepCopy_api_HTTPGetAction, - deepCopy_api_Handler, - deepCopy_api_HostPathVolumeSource, - deepCopy_api_ISCSIVolumeSource, - deepCopy_api_Lifecycle, - deepCopy_api_LoadBalancerIngress, - deepCopy_api_LoadBalancerStatus, - deepCopy_api_LocalObjectReference, - deepCopy_api_NFSVolumeSource, - deepCopy_api_ObjectFieldSelector, - deepCopy_api_ObjectMeta, - deepCopy_api_PersistentVolumeClaimVolumeSource, - deepCopy_api_PodSecurityContext, - deepCopy_api_PodSpec, - deepCopy_api_PodTemplateSpec, - deepCopy_api_Probe, - deepCopy_api_RBDVolumeSource, - deepCopy_api_ResourceRequirements, - deepCopy_api_SELinuxOptions, - deepCopy_api_SecretVolumeSource, - deepCopy_api_SecurityContext, - deepCopy_api_TCPSocketAction, - deepCopy_api_Volume, - deepCopy_api_VolumeMount, - deepCopy_api_VolumeSource, - deepCopy_resource_Quantity, - deepCopy_unversioned_ListMeta, - deepCopy_unversioned_Time, - deepCopy_unversioned_TypeMeta, - deepCopy_extensions_APIVersion, - deepCopy_extensions_CPUTargetUtilization, - deepCopy_extensions_ClusterAutoscaler, - deepCopy_extensions_ClusterAutoscalerList, - deepCopy_extensions_ClusterAutoscalerSpec, - deepCopy_extensions_DaemonSet, - deepCopy_extensions_DaemonSetList, - deepCopy_extensions_DaemonSetSpec, - deepCopy_extensions_DaemonSetStatus, - deepCopy_extensions_Deployment, - deepCopy_extensions_DeploymentList, - deepCopy_extensions_DeploymentSpec, - deepCopy_extensions_DeploymentStatus, - deepCopy_extensions_DeploymentStrategy, - deepCopy_extensions_HTTPIngressPath, - deepCopy_extensions_HTTPIngressRuleValue, - deepCopy_extensions_HorizontalPodAutoscaler, - deepCopy_extensions_HorizontalPodAutoscalerList, - deepCopy_extensions_HorizontalPodAutoscalerSpec, - deepCopy_extensions_HorizontalPodAutoscalerStatus, - deepCopy_extensions_Ingress, - deepCopy_extensions_IngressBackend, - deepCopy_extensions_IngressList, - deepCopy_extensions_IngressRule, - deepCopy_extensions_IngressRuleValue, - deepCopy_extensions_IngressSpec, - deepCopy_extensions_IngressStatus, - deepCopy_extensions_Job, - deepCopy_extensions_JobCondition, - deepCopy_extensions_JobList, - deepCopy_extensions_JobSpec, - deepCopy_extensions_JobStatus, - deepCopy_extensions_NodeUtilization, - deepCopy_extensions_PodSelector, - deepCopy_extensions_PodSelectorRequirement, - deepCopy_extensions_ReplicationControllerDummy, - deepCopy_extensions_RollingUpdateDeployment, - deepCopy_extensions_Scale, - deepCopy_extensions_ScaleSpec, - deepCopy_extensions_ScaleStatus, - deepCopy_extensions_SubresourceReference, - deepCopy_extensions_ThirdPartyResource, - deepCopy_extensions_ThirdPartyResourceData, - deepCopy_extensions_ThirdPartyResourceDataList, - deepCopy_extensions_ThirdPartyResourceList, - deepCopy_util_IntOrString, - ) + err := api.Scheme.AddGeneratedDeepCopyFuncs() if err != nil { // if one of the deep copy functions is malformed, detect it immediately. panic(err) diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/helpers.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/helpers.go index 23e0abba6..c6d79d663 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/helpers.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/helpers.go @@ -16,52 +16,32 @@ limitations under the License. package extensions -import ( - "fmt" +// TODO(madhusudancs): Fix this when Scale group issues are resolved (see issue #18528). +// import ( +// "fmt" - "sort" +// "k8s.io/kubernetes/pkg/api" +// "k8s.io/kubernetes/pkg/api/unversioned" +// ) - "k8s.io/kubernetes/pkg/labels" - "k8s.io/kubernetes/pkg/util/sets" -) - -// PodSelectorAsSelector converts the PodSelector api type into a struct that implements -// labels.Selector -func PodSelectorAsSelector(ps *PodSelector) (labels.Selector, error) { - if ps == nil { - return labels.Nothing(), nil - } - if len(ps.MatchLabels)+len(ps.MatchExpressions) == 0 { - return labels.Everything(), nil - } - selector := labels.LabelSelector{} - for k, v := range ps.MatchLabels { - req, err := labels.NewRequirement(k, labels.InOperator, sets.NewString(v)) - if err != nil { - return nil, err - } - selector = append(selector, *req) - } - for _, expr := range ps.MatchExpressions { - var op labels.Operator - switch expr.Operator { - case PodSelectorOpIn: - op = labels.InOperator - case PodSelectorOpNotIn: - op = labels.NotInOperator - case PodSelectorOpExists: - op = labels.ExistsOperator - case PodSelectorOpDoesNotExist: - op = labels.DoesNotExistOperator - default: - return nil, fmt.Errorf("%q is not a valid pod selector operator", expr.Operator) - } - req, err := labels.NewRequirement(expr.Key, op, sets.NewString(expr.Values...)) - if err != nil { - return nil, err - } - selector = append(selector, *req) - } - sort.Sort(labels.ByKey(selector)) - return selector, nil -} +// // ScaleFromDeployment returns a scale subresource for a deployment. +// func ScaleFromDeployment(deployment *Deployment) (*Scale, error) { +// selector, err := unversioned.LabelSelectorAsSelector(deployment.Spec.Selector) +// if err != nil { +// return nil, fmt.Errorf("invalid label selector: %v", err) +// } +// return &Scale{ +// ObjectMeta: api.ObjectMeta{ +// Name: deployment.Name, +// Namespace: deployment.Namespace, +// CreationTimestamp: deployment.CreationTimestamp, +// }, +// Spec: ScaleSpec{ +// Replicas: deployment.Spec.Replicas, +// }, +// Status: ScaleStatus{ +// Replicas: deployment.Status.Replicas, +// Selector: selector.String(), +// }, +// }, nil +// } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/install/install.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/install/install.go index 100dcfdbf..90d5c5073 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/install/install.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/install/install.go @@ -20,16 +20,15 @@ package install import ( "fmt" - "strings" "github.com/golang/glog" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/latest" "k8s.io/kubernetes/pkg/api/meta" - "k8s.io/kubernetes/pkg/api/registered" - apiutil "k8s.io/kubernetes/pkg/api/util" - _ "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util/sets" @@ -39,54 +38,94 @@ const importPrefix = "k8s.io/kubernetes/pkg/apis/extensions" var accessor = meta.NewAccessor() +// availableVersions lists all known external versions for this group from most preferred to least preferred +var availableVersions = []unversioned.GroupVersion{v1beta1.SchemeGroupVersion} + func init() { - groupMeta, err := latest.RegisterGroup("extensions") - if err != nil { + registered.RegisterVersions(availableVersions) + externalVersions := []unversioned.GroupVersion{} + for _, v := range availableVersions { + if registered.IsAllowedVersion(v) { + externalVersions = append(externalVersions, v) + } + } + if len(externalVersions) == 0 { + glog.V(4).Infof("No version is registered for group %v", extensions.GroupName) + return + } + + if err := registered.EnableVersions(externalVersions...); err != nil { glog.V(4).Infof("%v", err) return } - registeredGroupVersions := registered.GroupVersionsForGroup("extensions") - groupVersion := registeredGroupVersions[0] - *groupMeta = latest.GroupMeta{ - GroupVersion: groupVersion, - Group: apiutil.GetGroup(groupVersion), - Version: apiutil.GetVersion(groupVersion), - Codec: runtime.CodecFor(api.Scheme, groupVersion), + if err := enableVersions(externalVersions); err != nil { + glog.V(4).Infof("%v", err) + return } - var versions []string - var groupVersions []string - for i := len(registeredGroupVersions) - 1; i >= 0; i-- { - versions = append(versions, apiutil.GetVersion(registeredGroupVersions[i])) - groupVersions = append(groupVersions, registeredGroupVersions[i]) +} + +// TODO: enableVersions should be centralized rather than spread in each API +// group. +// We can combine registered.RegisterVersions, registered.EnableVersions and +// registered.RegisterGroup once we have moved enableVersions there. +func enableVersions(externalVersions []unversioned.GroupVersion) error { + addVersionsToScheme(externalVersions...) + preferredExternalVersion := externalVersions[0] + + groupMeta := apimachinery.GroupMeta{ + GroupVersion: preferredExternalVersion, + GroupVersions: externalVersions, + RESTMapper: newRESTMapper(externalVersions), + SelfLinker: runtime.SelfLinker(accessor), + InterfacesFor: interfacesFor, } - groupMeta.Versions = versions - groupMeta.GroupVersions = groupVersions - groupMeta.SelfLinker = runtime.SelfLinker(accessor) + if err := registered.RegisterGroup(groupMeta); err != nil { + return err + } + api.RegisterRESTMapper(groupMeta.RESTMapper) + return nil +} +func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { // the list of kinds that are scoped at the root of the api hierarchy // if a kind is not enumerated here, it is assumed to have a namespace scope - rootScoped := sets.NewString() + rootScoped := sets.NewString( + "PodSecurityPolicy", + ) ignoredKinds := sets.NewString() - groupMeta.RESTMapper = api.NewDefaultRESTMapper("extensions", groupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) - api.RegisterRESTMapper(groupMeta.RESTMapper) - groupMeta.InterfacesFor = interfacesFor + return api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) } -// InterfacesFor returns the default Codec and ResourceVersioner for a given version +// interfacesFor returns the default Codec and ResourceVersioner for a given version // string, or an error if the version is not known. -func interfacesFor(version string) (*meta.VersionInterfaces, error) { +func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { switch version { - case "extensions/v1beta1": + case v1beta1.SchemeGroupVersion: return &meta.VersionInterfaces{ - Codec: v1beta1.Codec, ObjectConvertor: api.Scheme, MetadataAccessor: accessor, }, nil default: - g, _ := latest.Group("extensions") - return nil, fmt.Errorf("unsupported storage version: %s (valid: %s)", version, strings.Join(g.Versions, ", ")) + g, _ := registered.Group(extensions.GroupName) + return nil, fmt.Errorf("unsupported storage version: %s (valid: %v)", version, g.GroupVersions) + } +} + +func addVersionsToScheme(externalVersions ...unversioned.GroupVersion) { + // add the internal version to Scheme + extensions.AddToScheme(api.Scheme) + // add the enabled external versions to Scheme + for _, v := range externalVersions { + if !registered.IsEnabledVersion(v) { + glog.Errorf("Version %s is not enabled, so it will not be added to the Scheme.", v) + continue + } + switch v { + case v1beta1.SchemeGroupVersion: + v1beta1.AddToScheme(api.Scheme) + } } } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/install/install_test.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/install/install_test.go index 97c28a94a..311fad56d 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/install/install_test.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/install/install_test.go @@ -21,9 +21,11 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/latest" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery/registered" "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" + "k8s.io/kubernetes/pkg/runtime" ) func TestResourceVersioner(t *testing.T) { @@ -48,9 +50,9 @@ func TestResourceVersioner(t *testing.T) { func TestCodec(t *testing.T) { daemonSet := extensions.DaemonSet{} - // We do want to use package latest rather than testapi here, because we - // want to test if the package install and package latest work as expected. - data, err := latest.GroupOrDie("extensions").Codec.Encode(&daemonSet) + // We do want to use package registered rather than testapi here, because we + // want to test if the package install and package registered work as expected. + data, err := runtime.Encode(api.Codecs.LegacyCodec(registered.GroupOrDie(extensions.GroupName).GroupVersion), &daemonSet) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -58,33 +60,37 @@ func TestCodec(t *testing.T) { if err := json.Unmarshal(data, &other); err != nil { t.Fatalf("unexpected error: %v", err) } - if other.APIVersion != latest.GroupOrDie("extensions").GroupVersion || other.Kind != "DaemonSet" { + if other.APIVersion != registered.GroupOrDie(extensions.GroupName).GroupVersion.String() || other.Kind != "DaemonSet" { t.Errorf("unexpected unmarshalled object %#v", other) } } func TestInterfacesFor(t *testing.T) { - if _, err := latest.GroupOrDie("extensions").InterfacesFor(""); err == nil { + if _, err := registered.GroupOrDie(extensions.GroupName).InterfacesFor(extensions.SchemeGroupVersion); err == nil { t.Fatalf("unexpected non-error: %v", err) } - for i, groupVersion := range append([]string{latest.GroupOrDie("extensions").GroupVersion}, latest.GroupOrDie("extensions").GroupVersions...) { - if vi, err := latest.GroupOrDie("extensions").InterfacesFor(groupVersion); err != nil || vi == nil { + for i, version := range registered.GroupOrDie(extensions.GroupName).GroupVersions { + if vi, err := registered.GroupOrDie(extensions.GroupName).InterfacesFor(version); err != nil || vi == nil { t.Fatalf("%d: unexpected result: %v", i, err) } } } func TestRESTMapper(t *testing.T) { - if v, k, err := latest.GroupOrDie("extensions").RESTMapper.VersionAndKindForResource("horizontalpodautoscalers"); err != nil || v != "extensions/v1beta1" || k != "HorizontalPodAutoscaler" { - t.Errorf("unexpected version mapping: %s %s %v", v, k, err) + gv := v1beta1.SchemeGroupVersion + hpaGVK := gv.WithKind("HorizontalPodAutoscaler") + daemonSetGVK := gv.WithKind("DaemonSet") + + if gvk, err := registered.GroupOrDie(extensions.GroupName).RESTMapper.KindFor(gv.WithResource("horizontalpodautoscalers")); err != nil || gvk != hpaGVK { + t.Errorf("unexpected version mapping: %v %v", gvk, err) } - if m, err := latest.GroupOrDie("extensions").RESTMapper.RESTMapping("DaemonSet", ""); err != nil || m.APIVersion != "extensions/v1beta1" || m.Resource != "daemonsets" { + if m, err := registered.GroupOrDie(extensions.GroupName).RESTMapper.RESTMapping(daemonSetGVK.GroupKind(), ""); err != nil || m.GroupVersionKind != daemonSetGVK || m.Resource != "daemonsets" { t.Errorf("unexpected version mapping: %#v %v", m, err) } - for _, groupVersion := range latest.GroupOrDie("extensions").GroupVersions { - mapping, err := latest.GroupOrDie("extensions").RESTMapper.RESTMapping("HorizontalPodAutoscaler", groupVersion) + for _, version := range registered.GroupOrDie(extensions.GroupName).GroupVersions { + mapping, err := registered.GroupOrDie(extensions.GroupName).RESTMapper.RESTMapping(hpaGVK.GroupKind(), version.Version) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -92,13 +98,13 @@ func TestRESTMapper(t *testing.T) { if mapping.Resource != "horizontalpodautoscalers" { t.Errorf("incorrect resource name: %#v", mapping) } - if mapping.APIVersion != groupVersion { + if mapping.GroupVersionKind.GroupVersion() != version { t.Errorf("incorrect groupVersion: %v", mapping) } - interfaces, _ := latest.GroupOrDie("extensions").InterfacesFor(groupVersion) - if mapping.Codec != interfaces.Codec { - t.Errorf("unexpected codec: %#v, expected: %#v", mapping, interfaces) + interfaces, _ := registered.GroupOrDie(extensions.GroupName).InterfacesFor(version) + if mapping.ObjectConvertor != interfaces.ObjectConvertor { + t.Errorf("unexpected: %#v, expected: %#v", mapping, interfaces) } rc := &extensions.HorizontalPodAutoscaler{ObjectMeta: api.ObjectMeta{Name: "foo"}} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/register.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/register.go index 535c3c407..db7b93770 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/register.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/register.go @@ -18,20 +18,40 @@ package extensions import ( "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" ) -func init() { - // Register the API. - addKnownTypes() +// GroupName is the group name use in this package +const GroupName = "extensions" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) unversioned.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns back a Group qualified GroupResource +func Resource(resource string) unversioned.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func AddToScheme(scheme *runtime.Scheme) { + // Add the API to Scheme. + addKnownTypes(scheme) } // Adds the list of known types to api.Scheme. -func addKnownTypes() { - api.Scheme.AddKnownTypes("", +func addKnownTypes(scheme *runtime.Scheme) { + // TODO this gets cleaned up when the types are fixed + scheme.AddKnownTypes(SchemeGroupVersion, &ClusterAutoscaler{}, &ClusterAutoscalerList{}, &Deployment{}, &DeploymentList{}, + &DeploymentRollback{}, &HorizontalPodAutoscaler{}, &HorizontalPodAutoscalerList{}, &Job{}, @@ -46,24 +66,35 @@ func addKnownTypes() { &ThirdPartyResourceDataList{}, &Ingress{}, &IngressList{}, + &api.ListOptions{}, + &ReplicaSet{}, + &ReplicaSetList{}, + &api.ExportOptions{}, + &PodSecurityPolicy{}, + &PodSecurityPolicyList{}, ) } -func (*ClusterAutoscaler) IsAnAPIObject() {} -func (*ClusterAutoscalerList) IsAnAPIObject() {} -func (*Deployment) IsAnAPIObject() {} -func (*DeploymentList) IsAnAPIObject() {} -func (*HorizontalPodAutoscaler) IsAnAPIObject() {} -func (*HorizontalPodAutoscalerList) IsAnAPIObject() {} -func (*Job) IsAnAPIObject() {} -func (*JobList) IsAnAPIObject() {} -func (*ReplicationControllerDummy) IsAnAPIObject() {} -func (*Scale) IsAnAPIObject() {} -func (*ThirdPartyResource) IsAnAPIObject() {} -func (*ThirdPartyResourceList) IsAnAPIObject() {} -func (*DaemonSet) IsAnAPIObject() {} -func (*DaemonSetList) IsAnAPIObject() {} -func (*ThirdPartyResourceData) IsAnAPIObject() {} -func (*ThirdPartyResourceDataList) IsAnAPIObject() {} -func (*Ingress) IsAnAPIObject() {} -func (*IngressList) IsAnAPIObject() {} +func (obj *ClusterAutoscaler) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ClusterAutoscalerList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Deployment) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DeploymentList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DeploymentRollback) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *HorizontalPodAutoscaler) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *HorizontalPodAutoscalerList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Job) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *JobList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicationControllerDummy) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Scale) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ThirdPartyResource) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ThirdPartyResourceList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DaemonSet) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DaemonSetList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ThirdPartyResourceData) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ThirdPartyResourceDataList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Ingress) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *IngressList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicaSet) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicaSetList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodSecurityPolicy) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodSecurityPolicyList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.generated.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.generated.go index bf55b0317..fabe00c2f 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.generated.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.generated.go @@ -29,7 +29,7 @@ import ( pkg4_resource "k8s.io/kubernetes/pkg/api/resource" pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned" pkg3_types "k8s.io/kubernetes/pkg/types" - pkg6_util "k8s.io/kubernetes/pkg/util" + pkg6_intstr "k8s.io/kubernetes/pkg/util/intstr" "reflect" "runtime" pkg5_inf "speter.net/go/exp/math/dec/inf" @@ -37,10 +37,18 @@ import ( ) const ( - codecSelferC_UTF81234 = 1 - codecSelferC_RAW1234 = 0 + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- codecSelferValueTypeArray1234 = 10 codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 ) var ( @@ -51,10 +59,10 @@ var ( type codecSelfer1234 struct{} func init() { - if codec1978.GenVersion != 4 { + if codec1978.GenVersion != 5 { _, file, _, _ := runtime.Caller(0) err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", - 4, codec1978.GenVersion, file) + 5, codec1978.GenVersion, file) panic(err) } if false { // reference the types, but skip this branch at build/run time @@ -62,7 +70,7 @@ func init() { var v1 pkg4_resource.Quantity var v2 pkg1_unversioned.TypeMeta var v3 pkg3_types.UID - var v4 pkg6_util.IntOrString + var v4 pkg6_intstr.IntOrString var v5 pkg5_inf.Dec var v6 time.Time _, _, _, _, _, _, _ = v0, v1, v2, v3, v4, v5, v6 @@ -87,18 +95,21 @@ func (x *ScaleSpec) CodecEncodeSelf(e *codec1978.Encoder) { _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false yyq2[0] = x.Replicas != 0 + var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2 int = 0 + yynn2 = 0 for _, b := range yyq2 { if b { yynn2++ } } r.EncodeMapStart(yynn2) + yynn2 = 0 } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[0] { yym4 := z.EncBinary() _ = yym4 @@ -111,7 +122,9 @@ func (x *ScaleSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym5 := z.EncBinary() _ = yym5 if false { @@ -120,8 +133,10 @@ func (x *ScaleSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep2 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -131,24 +146,25 @@ func (x *ScaleSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym6 := z.DecBinary() - _ = yym6 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl7 := r.ReadMapStart() - if yyl7 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl7, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl7 := r.ReadArrayStart() - if yyl7 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl7, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -160,12 +176,12 @@ func (x *ScaleSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys8Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys8Slc - var yyhl8 bool = l >= 0 - for yyj8 := 0; ; yyj8++ { - if yyhl8 { - if yyj8 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -173,9 +189,11 @@ func (x *ScaleSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys8Slc = r.DecodeBytes(yys8Slc, true, true) - yys8 := string(yys8Slc) - switch yys8 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 @@ -183,49 +201,49 @@ func (x *ScaleSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) } default: - z.DecStructFieldNotFound(-1, yys8) - } // end switch yys8 - } // end for yyj8 - if !yyhl8 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ScaleSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj10 int - var yyb10 bool - var yyhl10 bool = l >= 0 - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb10 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb10 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) } for { - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb10 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb10 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj10-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ScaleStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -235,51 +253,57 @@ func (x *ScaleStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym12 := z.EncBinary() - _ = yym12 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep13 := !z.EncBinary() - yy2arr13 := z.EncBasicHandle().StructToArray - var yyq13 [2]bool - _, _, _ = yysep13, yyq13, yy2arr13 - const yyr13 bool = false - yyq13[1] = len(x.Selector) != 0 - if yyr13 || yy2arr13 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = len(x.Selector) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn13 int = 1 - for _, b := range yyq13 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn13++ + yynn2++ } } - r.EncodeMapStart(yynn13) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr13 || yy2arr13 { - yym15 := z.EncBinary() - _ = yym15 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Replicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) - yym16 := z.EncBinary() - _ = yym16 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Replicas)) } } - if yyr13 || yy2arr13 { - if yyq13[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Selector == nil { r.EncodeNil() } else { - yym18 := z.EncBinary() - _ = yym18 + yym7 := z.EncBinary() + _ = yym7 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) @@ -289,13 +313,15 @@ func (x *ScaleStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq13[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym19 := z.EncBinary() - _ = yym19 + yym8 := z.EncBinary() + _ = yym8 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) @@ -303,8 +329,10 @@ func (x *ScaleStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep13 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -314,24 +342,25 @@ func (x *ScaleStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym20 := z.DecBinary() - _ = yym20 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl21 := r.ReadMapStart() - if yyl21 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl21, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl21 := r.ReadArrayStart() - if yyl21 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl21, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -343,12 +372,12 @@ func (x *ScaleStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys22Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys22Slc - var yyhl22 bool = l >= 0 - for yyj22 := 0; ; yyj22++ { - if yyhl22 { - if yyj22 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -356,9 +385,11 @@ func (x *ScaleStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys22Slc = r.DecodeBytes(yys22Slc, true, true) - yys22 := string(yys22Slc) - switch yys22 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 @@ -369,79 +400,80 @@ func (x *ScaleStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv24 := &x.Selector - yym25 := z.DecBinary() - _ = yym25 + yyv5 := &x.Selector + yym6 := z.DecBinary() + _ = yym6 if false { } else { - z.F.DecMapStringStringX(yyv24, false, d) + z.F.DecMapStringStringX(yyv5, false, d) } } default: - z.DecStructFieldNotFound(-1, yys22) - } // end switch yys22 - } // end for yyj22 - if !yyhl22 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ScaleStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj26 int - var yyb26 bool - var yyhl26 bool = l >= 0 - yyj26++ - if yyhl26 { - yyb26 = yyj26 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb26 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb26 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj26++ - if yyhl26 { - yyb26 = yyj26 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb26 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb26 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv28 := &x.Selector - yym29 := z.DecBinary() - _ = yym29 + yyv9 := &x.Selector + yym10 := z.DecBinary() + _ = yym10 if false { } else { - z.F.DecMapStringStringX(yyv28, false, d) + z.F.DecMapStringStringX(yyv9, false, d) } } for { - yyj26++ - if yyhl26 { - yyb26 = yyj26 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb26 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb26 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj26-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Scale) CodecEncodeSelf(e *codec1978.Encoder) { @@ -451,120 +483,139 @@ func (x *Scale) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym30 := z.EncBinary() - _ = yym30 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep31 := !z.EncBinary() - yy2arr31 := z.EncBasicHandle().StructToArray - var yyq31 [5]bool - _, _, _ = yysep31, yyq31, yy2arr31 - const yyr31 bool = false - yyq31[0] = x.Kind != "" - yyq31[1] = x.APIVersion != "" - yyq31[2] = true - yyq31[3] = true - yyq31[4] = true - if yyr31 || yy2arr31 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn31 int = 0 - for _, b := range yyq31 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn31++ + yynn2++ } } - r.EncodeMapStart(yynn31) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr31 || yy2arr31 { - if yyq31[0] { - yym33 := z.EncBinary() - _ = yym33 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq31[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym34 := z.EncBinary() - _ = yym34 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr31 || yy2arr31 { - if yyq31[1] { - yym36 := z.EncBinary() - _ = yym36 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq31[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym37 := z.EncBinary() - _ = yym37 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr31 || yy2arr31 { - if yyq31[2] { - yy39 := &x.ObjectMeta - yy39.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq31[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy40 := &x.ObjectMeta - yy40.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr31 || yy2arr31 { - if yyq31[3] { - yy42 := &x.Spec - yy42.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq31[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy43 := &x.Spec - yy43.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr31 || yy2arr31 { - if yyq31[4] { - yy45 := &x.Status - yy45.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq31[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy46 := &x.Status - yy46.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep31 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -574,24 +625,25 @@ func (x *Scale) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym47 := z.DecBinary() - _ = yym47 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl48 := r.ReadMapStart() - if yyl48 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl48, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl48 := r.ReadArrayStart() - if yyl48 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl48, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -603,12 +655,12 @@ func (x *Scale) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys49Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys49Slc - var yyhl49 bool = l >= 0 - for yyj49 := 0; ; yyj49++ { - if yyhl49 { - if yyj49 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -616,9 +668,32 @@ func (x *Scale) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys49Slc = r.DecodeBytes(yys49Slc, true, true) - yys49 := string(yys49Slc) - switch yys49 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ScaleSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ScaleStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -631,134 +706,117 @@ func (x *Scale) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv52 := &x.ObjectMeta - yyv52.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ScaleSpec{} - } else { - yyv53 := &x.Spec - yyv53.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = ScaleStatus{} - } else { - yyv54 := &x.Status - yyv54.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys49) - } // end switch yys49 - } // end for yyj49 - if !yyhl49 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Scale) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj55 int - var yyb55 bool - var yyhl55 bool = l >= 0 - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb55 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb55 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ScaleSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ScaleStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb55 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb55 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l - } else { - yyb55 = r.CheckBreak() - } - if yyb55 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv58 := &x.ObjectMeta - yyv58.CodecDecodeSelf(d) - } - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l - } else { - yyb55 = r.CheckBreak() - } - if yyb55 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ScaleSpec{} - } else { - yyv59 := &x.Spec - yyv59.CodecDecodeSelf(d) - } - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l - } else { - yyb55 = r.CheckBreak() - } - if yyb55 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = ScaleStatus{} - } else { - yyv60 := &x.Status - yyv60.CodecDecodeSelf(d) - } for { - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb55 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb55 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj55-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationControllerDummy) CodecEncodeSelf(e *codec1978.Encoder) { @@ -768,33 +826,36 @@ func (x *ReplicationControllerDummy) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym61 := z.EncBinary() - _ = yym61 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep62 := !z.EncBinary() - yy2arr62 := z.EncBasicHandle().StructToArray - var yyq62 [2]bool - _, _, _ = yysep62, yyq62, yy2arr62 - const yyr62 bool = false - yyq62[0] = x.Kind != "" - yyq62[1] = x.APIVersion != "" - if yyr62 || yy2arr62 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn62 int = 0 - for _, b := range yyq62 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn62++ + yynn2++ } } - r.EncodeMapStart(yynn62) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr62 || yy2arr62 { - if yyq62[0] { - yym64 := z.EncBinary() - _ = yym64 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) @@ -803,20 +864,23 @@ func (x *ReplicationControllerDummy) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq62[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym65 := z.EncBinary() - _ = yym65 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) } } } - if yyr62 || yy2arr62 { - if yyq62[1] { - yym67 := z.EncBinary() - _ = yym67 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) @@ -825,18 +889,22 @@ func (x *ReplicationControllerDummy) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq62[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym68 := z.EncBinary() - _ = yym68 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) } } } - if yysep62 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -846,24 +914,25 @@ func (x *ReplicationControllerDummy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym69 := z.DecBinary() - _ = yym69 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl70 := r.ReadMapStart() - if yyl70 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl70, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl70 := r.ReadArrayStart() - if yyl70 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl70, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -875,12 +944,12 @@ func (x *ReplicationControllerDummy) codecDecodeSelfFromMap(l int, d *codec1978. var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys71Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys71Slc - var yyhl71 bool = l >= 0 - for yyj71 := 0; ; yyj71++ { - if yyhl71 { - if yyj71 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -888,9 +957,11 @@ func (x *ReplicationControllerDummy) codecDecodeSelfFromMap(l int, d *codec1978. break } } - yys71Slc = r.DecodeBytes(yys71Slc, true, true) - yys71 := string(yys71Slc) - switch yys71 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -904,64 +975,65 @@ func (x *ReplicationControllerDummy) codecDecodeSelfFromMap(l int, d *codec1978. x.APIVersion = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys71) - } // end switch yys71 - } // end for yyj71 - if !yyhl71 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationControllerDummy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj74 int - var yyb74 bool - var yyhl74 bool = l >= 0 - yyj74++ - if yyhl74 { - yyb74 = yyj74 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb74 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb74 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj74++ - if yyhl74 { - yyb74 = yyj74 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb74 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb74 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } for { - yyj74++ - if yyhl74 { - yyb74 = yyj74 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb74 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb74 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj74-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { @@ -971,36 +1043,38 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym77 := z.EncBinary() - _ = yym77 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep78 := !z.EncBinary() - yy2arr78 := z.EncBasicHandle().StructToArray - var yyq78 [5]bool - _, _, _ = yysep78, yyq78, yy2arr78 - const yyr78 bool = false - yyq78[0] = x.Kind != "" - yyq78[1] = x.Namespace != "" - yyq78[2] = x.Name != "" - yyq78[3] = x.APIVersion != "" - yyq78[4] = x.Subresource != "" - if yyr78 || yy2arr78 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.Name != "" + yyq2[2] = x.APIVersion != "" + yyq2[3] = x.Subresource != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) } else { - var yynn78 int = 0 - for _, b := range yyq78 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn78++ + yynn2++ } } - r.EncodeMapStart(yynn78) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr78 || yy2arr78 { - if yyq78[0] { - yym80 := z.EncBinary() - _ = yym80 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) @@ -1009,42 +1083,23 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq78[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym81 := z.EncBinary() - _ = yym81 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) } } } - if yyr78 || yy2arr78 { - if yyq78[1] { - yym83 := z.EncBinary() - _ = yym83 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq78[1] { - r.EncodeString(codecSelferC_UTF81234, string("namespace")) - yym84 := z.EncBinary() - _ = yym84 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) - } - } - } - if yyr78 || yy2arr78 { - if yyq78[2] { - yym86 := z.EncBinary() - _ = yym86 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -1053,20 +1108,23 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq78[2] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym87 := z.EncBinary() - _ = yym87 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr78 || yy2arr78 { - if yyq78[3] { - yym89 := z.EncBinary() - _ = yym89 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) @@ -1075,20 +1133,23 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq78[3] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym90 := z.EncBinary() - _ = yym90 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) } } } - if yyr78 || yy2arr78 { - if yyq78[4] { - yym92 := z.EncBinary() - _ = yym92 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Subresource)) @@ -1097,18 +1158,22 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq78[4] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("subresource")) - yym93 := z.EncBinary() - _ = yym93 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Subresource)) } } } - if yysep78 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1118,24 +1183,25 @@ func (x *SubresourceReference) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym94 := z.DecBinary() - _ = yym94 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl95 := r.ReadMapStart() - if yyl95 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl95, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl95 := r.ReadArrayStart() - if yyl95 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl95, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1147,12 +1213,12 @@ func (x *SubresourceReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys96Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys96Slc - var yyhl96 bool = l >= 0 - for yyj96 := 0; ; yyj96++ { - if yyhl96 { - if yyj96 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1160,21 +1226,17 @@ func (x *SubresourceReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys96Slc = r.DecodeBytes(yys96Slc, true, true) - yys96 := string(yys96Slc) - switch yys96 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - case "namespace": - if r.TryDecodeAsNil() { - x.Namespace = "" - } else { - x.Namespace = string(r.DecodeString()) - } case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -1194,109 +1256,97 @@ func (x *SubresourceReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode x.Subresource = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys96) - } // end switch yys96 - } // end for yyj96 - if !yyhl96 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SubresourceReference) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj102 int - var yyb102 bool - var yyhl102 bool = l >= 0 - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Namespace = "" - } else { - x.Namespace = string(r.DecodeString()) - } - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l - } else { - yyb102 = r.CheckBreak() - } - if yyb102 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Subresource = "" } else { x.Subresource = string(r.DecodeString()) } for { - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj102-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *CPUTargetUtilization) CodecEncodeSelf(e *codec1978.Encoder) { @@ -1306,45 +1356,52 @@ func (x *CPUTargetUtilization) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym108 := z.EncBinary() - _ = yym108 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep109 := !z.EncBinary() - yy2arr109 := z.EncBasicHandle().StructToArray - var yyq109 [1]bool - _, _, _ = yysep109, yyq109, yy2arr109 - const yyr109 bool = false - if yyr109 || yy2arr109 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn109 int = 1 - for _, b := range yyq109 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn109++ + yynn2++ } } - r.EncodeMapStart(yynn109) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr109 || yy2arr109 { - yym111 := z.EncBinary() - _ = yym111 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.TargetPercentage)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("targetPercentage")) - yym112 := z.EncBinary() - _ = yym112 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.TargetPercentage)) } } - if yysep109 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1354,24 +1411,25 @@ func (x *CPUTargetUtilization) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym113 := z.DecBinary() - _ = yym113 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl114 := r.ReadMapStart() - if yyl114 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl114, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl114 := r.ReadArrayStart() - if yyl114 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl114, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1383,12 +1441,12 @@ func (x *CPUTargetUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys115Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys115Slc - var yyhl115 bool = l >= 0 - for yyj115 := 0; ; yyj115++ { - if yyhl115 { - if yyj115 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1396,9 +1454,11 @@ func (x *CPUTargetUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys115Slc = r.DecodeBytes(yys115Slc, true, true) - yys115 := string(yys115Slc) - switch yys115 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "targetPercentage": if r.TryDecodeAsNil() { x.TargetPercentage = 0 @@ -1406,49 +1466,871 @@ func (x *CPUTargetUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decode x.TargetPercentage = int(r.DecodeInt(codecSelferBitsize1234)) } default: - z.DecStructFieldNotFound(-1, yys115) - } // end switch yys115 - } // end for yyj115 - if !yyhl115 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *CPUTargetUtilization) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj117 int - var yyb117 bool - var yyhl117 bool = l >= 0 - yyj117++ - if yyhl117 { - yyb117 = yyj117 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb117 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb117 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TargetPercentage = 0 } else { x.TargetPercentage = int(r.DecodeInt(codecSelferBitsize1234)) } for { - yyj117++ - if yyhl117 { - yyb117 = yyj117 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb117 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb117 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj117-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *CustomMetricTarget) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.TargetValue + yym8 := z.EncBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) + } else { + z.EncFallback(yy7) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("value")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.TargetValue + yym10 := z.EncBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) + } else { + z.EncFallback(yy9) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *CustomMetricTarget) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *CustomMetricTarget) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + case "value": + if r.TryDecodeAsNil() { + x.TargetValue = pkg4_resource.Quantity{} + } else { + yyv5 := &x.TargetValue + yym6 := z.DecBinary() + _ = yym6 + if false { + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) + } else { + z.DecFallback(yyv5, false) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *CustomMetricTarget) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TargetValue = pkg4_resource.Quantity{} + } else { + yyv9 := &x.TargetValue + yym10 := z.DecBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) + } else { + z.DecFallback(yyv9, false) + } + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *CustomMetricTargetList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceCustomMetricTarget(([]CustomMetricTarget)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceCustomMetricTarget(([]CustomMetricTarget)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *CustomMetricTargetList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *CustomMetricTargetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv4 := &x.Items + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceCustomMetricTarget((*[]CustomMetricTarget)(yyv4), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *CustomMetricTargetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv7 := &x.Items + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceCustomMetricTarget((*[]CustomMetricTarget)(yyv7), d) + } + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *CustomMetricCurrentStatus) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.CurrentValue + yym8 := z.EncBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) + } else { + z.EncFallback(yy7) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("value")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.CurrentValue + yym10 := z.EncBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) + } else { + z.EncFallback(yy9) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *CustomMetricCurrentStatus) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *CustomMetricCurrentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + case "value": + if r.TryDecodeAsNil() { + x.CurrentValue = pkg4_resource.Quantity{} + } else { + yyv5 := &x.CurrentValue + yym6 := z.DecBinary() + _ = yym6 + if false { + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) + } else { + z.DecFallback(yyv5, false) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *CustomMetricCurrentStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CurrentValue = pkg4_resource.Quantity{} + } else { + yyv9 := &x.CurrentValue + yym10 := z.DecBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) + } else { + z.DecFallback(yyv9, false) + } + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *CustomMetricCurrentStatusList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceCustomMetricCurrentStatus(([]CustomMetricCurrentStatus)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceCustomMetricCurrentStatus(([]CustomMetricCurrentStatus)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *CustomMetricCurrentStatusList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *CustomMetricCurrentStatusList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv4 := &x.Items + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceCustomMetricCurrentStatus((*[]CustomMetricCurrentStatus)(yyv4), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *CustomMetricCurrentStatusList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv7 := &x.Items + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceCustomMetricCurrentStatus((*[]CustomMetricCurrentStatus)(yyv7), d) + } + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HorizontalPodAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -1458,87 +2340,99 @@ func (x *HorizontalPodAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym119 := z.EncBinary() - _ = yym119 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep120 := !z.EncBinary() - yy2arr120 := z.EncBasicHandle().StructToArray - var yyq120 [4]bool - _, _, _ = yysep120, yyq120, yy2arr120 - const yyr120 bool = false - yyq120[1] = x.MinReplicas != nil - yyq120[3] = x.CPUUtilization != nil - if yyr120 || yy2arr120 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.MinReplicas != nil + yyq2[3] = x.CPUUtilization != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn120 int = 2 - for _, b := range yyq120 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn120++ + yynn2++ } } - r.EncodeMapStart(yynn120) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr120 || yy2arr120 { - yy122 := &x.ScaleRef - yy122.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.ScaleRef + yy4.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("scaleRef")) - yy123 := &x.ScaleRef - yy123.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ScaleRef + yy6.CodecEncodeSelf(e) } - if yyr120 || yy2arr120 { - if yyq120[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.MinReplicas == nil { r.EncodeNil() } else { - yy125 := *x.MinReplicas - yym126 := z.EncBinary() - _ = yym126 + yy9 := *x.MinReplicas + yym10 := z.EncBinary() + _ = yym10 if false { } else { - r.EncodeInt(int64(yy125)) + r.EncodeInt(int64(yy9)) } } } else { r.EncodeNil() } } else { - if yyq120[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("minReplicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.MinReplicas == nil { r.EncodeNil() } else { - yy127 := *x.MinReplicas - yym128 := z.EncBinary() - _ = yym128 + yy11 := *x.MinReplicas + yym12 := z.EncBinary() + _ = yym12 if false { } else { - r.EncodeInt(int64(yy127)) + r.EncodeInt(int64(yy11)) } } } } - if yyr120 || yy2arr120 { - yym130 := z.EncBinary() - _ = yym130 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeInt(int64(x.MaxReplicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxReplicas")) - yym131 := z.EncBinary() - _ = yym131 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeInt(int64(x.MaxReplicas)) } } - if yyr120 || yy2arr120 { - if yyq120[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.CPUUtilization == nil { r.EncodeNil() } else { @@ -1548,8 +2442,10 @@ func (x *HorizontalPodAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq120[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cpuUtilization")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CPUUtilization == nil { r.EncodeNil() } else { @@ -1557,8 +2453,10 @@ func (x *HorizontalPodAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep120 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1568,24 +2466,25 @@ func (x *HorizontalPodAutoscalerSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym133 := z.DecBinary() - _ = yym133 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl134 := r.ReadMapStart() - if yyl134 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl134, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl134 := r.ReadArrayStart() - if yyl134 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl134, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1597,12 +2496,12 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys135Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys135Slc - var yyhl135 bool = l >= 0 - for yyj135 := 0; ; yyj135++ { - if yyhl135 { - if yyj135 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1610,15 +2509,17 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978 break } } - yys135Slc = r.DecodeBytes(yys135Slc, true, true) - yys135 := string(yys135Slc) - switch yys135 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "scaleRef": if r.TryDecodeAsNil() { x.ScaleRef = SubresourceReference{} } else { - yyv136 := &x.ScaleRef - yyv136.CodecDecodeSelf(d) + yyv4 := &x.ScaleRef + yyv4.CodecDecodeSelf(d) } case "minReplicas": if r.TryDecodeAsNil() { @@ -1629,8 +2530,8 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978 if x.MinReplicas == nil { x.MinReplicas = new(int) } - yym138 := z.DecBinary() - _ = yym138 + yym6 := z.DecBinary() + _ = yym6 if false { } else { *((*int)(x.MinReplicas)) = int(r.DecodeInt(codecSelferBitsize1234)) @@ -1654,47 +2555,47 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978 x.CPUUtilization.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys135) - } // end switch yys135 - } // end for yyj135 - if !yyhl135 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj141 int - var yyb141 bool - var yyhl141 bool = l >= 0 - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ScaleRef = SubresourceReference{} } else { - yyv142 := &x.ScaleRef - yyv142.CodecDecodeSelf(d) + yyv10 := &x.ScaleRef + yyv10.CodecDecodeSelf(d) } - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.MinReplicas != nil { x.MinReplicas = nil @@ -1703,38 +2604,40 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromArray(l int, d *codec19 if x.MinReplicas == nil { x.MinReplicas = new(int) } - yym144 := z.DecBinary() - _ = yym144 + yym12 := z.DecBinary() + _ = yym12 if false { } else { *((*int)(x.MinReplicas)) = int(r.DecodeInt(codecSelferBitsize1234)) } } - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MaxReplicas = 0 } else { x.MaxReplicas = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CPUUtilization != nil { x.CPUUtilization = nil @@ -1746,18 +2649,19 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromArray(l int, d *codec19 x.CPUUtilization.CodecDecodeSelf(d) } for { - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj141-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HorizontalPodAutoscalerStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -1767,74 +2671,80 @@ func (x *HorizontalPodAutoscalerStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym147 := z.EncBinary() - _ = yym147 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep148 := !z.EncBinary() - yy2arr148 := z.EncBasicHandle().StructToArray - var yyq148 [5]bool - _, _, _ = yysep148, yyq148, yy2arr148 - const yyr148 bool = false - yyq148[0] = x.ObservedGeneration != nil - yyq148[1] = x.LastScaleTime != nil - yyq148[4] = x.CurrentCPUUtilizationPercentage != nil - if yyr148 || yy2arr148 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.ObservedGeneration != nil + yyq2[1] = x.LastScaleTime != nil + yyq2[4] = x.CurrentCPUUtilizationPercentage != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn148 int = 2 - for _, b := range yyq148 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn148++ + yynn2++ } } - r.EncodeMapStart(yynn148) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr148 || yy2arr148 { - if yyq148[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.ObservedGeneration == nil { r.EncodeNil() } else { - yy150 := *x.ObservedGeneration - yym151 := z.EncBinary() - _ = yym151 + yy4 := *x.ObservedGeneration + yym5 := z.EncBinary() + _ = yym5 if false { } else { - r.EncodeInt(int64(yy150)) + r.EncodeInt(int64(yy4)) } } } else { r.EncodeNil() } } else { - if yyq148[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("observedGeneration")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ObservedGeneration == nil { r.EncodeNil() } else { - yy152 := *x.ObservedGeneration - yym153 := z.EncBinary() - _ = yym153 + yy6 := *x.ObservedGeneration + yym7 := z.EncBinary() + _ = yym7 if false { } else { - r.EncodeInt(int64(yy152)) + r.EncodeInt(int64(yy6)) } } } } - if yyr148 || yy2arr148 { - if yyq148[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.LastScaleTime == nil { r.EncodeNil() } else { - yym155 := z.EncBinary() - _ = yym155 + yym9 := z.EncBinary() + _ = yym9 if false { } else if z.HasExtensions() && z.EncExt(x.LastScaleTime) { - } else if yym155 { + } else if yym9 { z.EncBinaryMarshal(x.LastScaleTime) - } else if !yym155 && z.IsJSONHandle() { + } else if !yym9 && z.IsJSONHandle() { z.EncJSONMarshal(x.LastScaleTime) } else { z.EncFallback(x.LastScaleTime) @@ -1844,18 +2754,20 @@ func (x *HorizontalPodAutoscalerStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq148[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastScaleTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.LastScaleTime == nil { r.EncodeNil() } else { - yym156 := z.EncBinary() - _ = yym156 + yym10 := z.EncBinary() + _ = yym10 if false { } else if z.HasExtensions() && z.EncExt(x.LastScaleTime) { - } else if yym156 { + } else if yym10 { z.EncBinaryMarshal(x.LastScaleTime) - } else if !yym156 && z.IsJSONHandle() { + } else if !yym10 && z.IsJSONHandle() { z.EncJSONMarshal(x.LastScaleTime) } else { z.EncFallback(x.LastScaleTime) @@ -1863,72 +2775,83 @@ func (x *HorizontalPodAutoscalerStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr148 || yy2arr148 { - yym158 := z.EncBinary() - _ = yym158 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym12 := z.EncBinary() + _ = yym12 if false { } else { r.EncodeInt(int64(x.CurrentReplicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("currentReplicas")) - yym159 := z.EncBinary() - _ = yym159 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeInt(int64(x.CurrentReplicas)) } } - if yyr148 || yy2arr148 { - yym161 := z.EncBinary() - _ = yym161 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeInt(int64(x.DesiredReplicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("desiredReplicas")) - yym162 := z.EncBinary() - _ = yym162 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeInt(int64(x.DesiredReplicas)) } } - if yyr148 || yy2arr148 { - if yyq148[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.CurrentCPUUtilizationPercentage == nil { r.EncodeNil() } else { - yy164 := *x.CurrentCPUUtilizationPercentage - yym165 := z.EncBinary() - _ = yym165 + yy18 := *x.CurrentCPUUtilizationPercentage + yym19 := z.EncBinary() + _ = yym19 if false { } else { - r.EncodeInt(int64(yy164)) + r.EncodeInt(int64(yy18)) } } } else { r.EncodeNil() } } else { - if yyq148[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("currentCPUUtilizationPercentage")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CurrentCPUUtilizationPercentage == nil { r.EncodeNil() } else { - yy166 := *x.CurrentCPUUtilizationPercentage - yym167 := z.EncBinary() - _ = yym167 + yy20 := *x.CurrentCPUUtilizationPercentage + yym21 := z.EncBinary() + _ = yym21 if false { } else { - r.EncodeInt(int64(yy166)) + r.EncodeInt(int64(yy20)) } } } } - if yysep148 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1938,24 +2861,25 @@ func (x *HorizontalPodAutoscalerStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym168 := z.DecBinary() - _ = yym168 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl169 := r.ReadMapStart() - if yyl169 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl169, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl169 := r.ReadArrayStart() - if yyl169 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl169, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1967,12 +2891,12 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys170Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys170Slc - var yyhl170 bool = l >= 0 - for yyj170 := 0; ; yyj170++ { - if yyhl170 { - if yyj170 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1980,9 +2904,11 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 break } } - yys170Slc = r.DecodeBytes(yys170Slc, true, true) - yys170 := string(yys170Slc) - switch yys170 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "observedGeneration": if r.TryDecodeAsNil() { if x.ObservedGeneration != nil { @@ -1992,8 +2918,8 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 if x.ObservedGeneration == nil { x.ObservedGeneration = new(int64) } - yym172 := z.DecBinary() - _ = yym172 + yym5 := z.DecBinary() + _ = yym5 if false { } else { *((*int64)(x.ObservedGeneration)) = int64(r.DecodeInt(64)) @@ -2008,13 +2934,13 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 if x.LastScaleTime == nil { x.LastScaleTime = new(pkg1_unversioned.Time) } - yym174 := z.DecBinary() - _ = yym174 + yym7 := z.DecBinary() + _ = yym7 if false { } else if z.HasExtensions() && z.DecExt(x.LastScaleTime) { - } else if yym174 { + } else if yym7 { z.DecBinaryUnmarshal(x.LastScaleTime) - } else if !yym174 && z.IsJSONHandle() { + } else if !yym7 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.LastScaleTime) } else { z.DecFallback(x.LastScaleTime, false) @@ -2041,39 +2967,38 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 if x.CurrentCPUUtilizationPercentage == nil { x.CurrentCPUUtilizationPercentage = new(int) } - yym178 := z.DecBinary() - _ = yym178 + yym11 := z.DecBinary() + _ = yym11 if false { } else { *((*int)(x.CurrentCPUUtilizationPercentage)) = int(r.DecodeInt(codecSelferBitsize1234)) } } default: - z.DecStructFieldNotFound(-1, yys170) - } // end switch yys170 - } // end for yyj170 - if !yyhl170 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj179 int - var yyb179 bool - var yyhl179 bool = l >= 0 - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ObservedGeneration != nil { x.ObservedGeneration = nil @@ -2082,23 +3007,24 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromArray(l int, d *codec if x.ObservedGeneration == nil { x.ObservedGeneration = new(int64) } - yym181 := z.DecBinary() - _ = yym181 + yym14 := z.DecBinary() + _ = yym14 if false { } else { *((*int64)(x.ObservedGeneration)) = int64(r.DecodeInt(64)) } } - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.LastScaleTime != nil { x.LastScaleTime = nil @@ -2107,58 +3033,61 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromArray(l int, d *codec if x.LastScaleTime == nil { x.LastScaleTime = new(pkg1_unversioned.Time) } - yym183 := z.DecBinary() - _ = yym183 + yym16 := z.DecBinary() + _ = yym16 if false { } else if z.HasExtensions() && z.DecExt(x.LastScaleTime) { - } else if yym183 { + } else if yym16 { z.DecBinaryUnmarshal(x.LastScaleTime) - } else if !yym183 && z.IsJSONHandle() { + } else if !yym16 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.LastScaleTime) } else { z.DecFallback(x.LastScaleTime, false) } } - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.CurrentReplicas = 0 } else { x.CurrentReplicas = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DesiredReplicas = 0 } else { x.DesiredReplicas = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CurrentCPUUtilizationPercentage != nil { x.CurrentCPUUtilizationPercentage = nil @@ -2167,26 +3096,27 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromArray(l int, d *codec if x.CurrentCPUUtilizationPercentage == nil { x.CurrentCPUUtilizationPercentage = new(int) } - yym187 := z.DecBinary() - _ = yym187 + yym20 := z.DecBinary() + _ = yym20 if false { } else { *((*int)(x.CurrentCPUUtilizationPercentage)) = int(r.DecodeInt(codecSelferBitsize1234)) } } for { - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj179-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HorizontalPodAutoscaler) CodecEncodeSelf(e *codec1978.Encoder) { @@ -2196,120 +3126,139 @@ func (x *HorizontalPodAutoscaler) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym188 := z.EncBinary() - _ = yym188 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep189 := !z.EncBinary() - yy2arr189 := z.EncBasicHandle().StructToArray - var yyq189 [5]bool - _, _, _ = yysep189, yyq189, yy2arr189 - const yyr189 bool = false - yyq189[0] = x.Kind != "" - yyq189[1] = x.APIVersion != "" - yyq189[2] = true - yyq189[3] = true - yyq189[4] = true - if yyr189 || yy2arr189 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn189 int = 0 - for _, b := range yyq189 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn189++ + yynn2++ } } - r.EncodeMapStart(yynn189) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr189 || yy2arr189 { - if yyq189[0] { - yym191 := z.EncBinary() - _ = yym191 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq189[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym192 := z.EncBinary() - _ = yym192 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr189 || yy2arr189 { - if yyq189[1] { - yym194 := z.EncBinary() - _ = yym194 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq189[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym195 := z.EncBinary() - _ = yym195 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr189 || yy2arr189 { - if yyq189[2] { - yy197 := &x.ObjectMeta - yy197.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq189[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy198 := &x.ObjectMeta - yy198.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr189 || yy2arr189 { - if yyq189[3] { - yy200 := &x.Spec - yy200.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq189[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy201 := &x.Spec - yy201.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr189 || yy2arr189 { - if yyq189[4] { - yy203 := &x.Status - yy203.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq189[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy204 := &x.Status - yy204.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep189 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -2319,24 +3268,25 @@ func (x *HorizontalPodAutoscaler) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym205 := z.DecBinary() - _ = yym205 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl206 := r.ReadMapStart() - if yyl206 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl206, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl206 := r.ReadArrayStart() - if yyl206 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl206, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -2348,12 +3298,12 @@ func (x *HorizontalPodAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Dec var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys207Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys207Slc - var yyhl207 bool = l >= 0 - for yyj207 := 0; ; yyj207++ { - if yyhl207 { - if yyj207 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -2361,9 +3311,32 @@ func (x *HorizontalPodAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Dec break } } - yys207Slc = r.DecodeBytes(yys207Slc, true, true) - yys207 := string(yys207Slc) - switch yys207 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = HorizontalPodAutoscalerSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = HorizontalPodAutoscalerStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -2376,134 +3349,117 @@ func (x *HorizontalPodAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Dec } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv210 := &x.ObjectMeta - yyv210.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = HorizontalPodAutoscalerSpec{} - } else { - yyv211 := &x.Spec - yyv211.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = HorizontalPodAutoscalerStatus{} - } else { - yyv212 := &x.Status - yyv212.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys207) - } // end switch yys207 - } // end for yyj207 - if !yyhl207 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HorizontalPodAutoscaler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj213 int - var yyb213 bool - var yyhl213 bool = l >= 0 - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb213 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb213 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = HorizontalPodAutoscalerSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = HorizontalPodAutoscalerStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb213 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb213 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l - } else { - yyb213 = r.CheckBreak() - } - if yyb213 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv216 := &x.ObjectMeta - yyv216.CodecDecodeSelf(d) - } - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l - } else { - yyb213 = r.CheckBreak() - } - if yyb213 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = HorizontalPodAutoscalerSpec{} - } else { - yyv217 := &x.Spec - yyv217.CodecDecodeSelf(d) - } - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l - } else { - yyb213 = r.CheckBreak() - } - if yyb213 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = HorizontalPodAutoscalerStatus{} - } else { - yyv218 := &x.Status - yyv218.CodecDecodeSelf(d) - } for { - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb213 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb213 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj213-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HorizontalPodAutoscalerList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -2513,126 +3469,142 @@ func (x *HorizontalPodAutoscalerList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym219 := z.EncBinary() - _ = yym219 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep220 := !z.EncBinary() - yy2arr220 := z.EncBasicHandle().StructToArray - var yyq220 [4]bool - _, _, _ = yysep220, yyq220, yy2arr220 - const yyr220 bool = false - yyq220[0] = x.Kind != "" - yyq220[1] = x.APIVersion != "" - yyq220[2] = true - if yyr220 || yy2arr220 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn220 int = 1 - for _, b := range yyq220 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn220++ + yynn2++ } } - r.EncodeMapStart(yynn220) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr220 || yy2arr220 { - if yyq220[0] { - yym222 := z.EncBinary() - _ = yym222 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq220[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym223 := z.EncBinary() - _ = yym223 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr220 || yy2arr220 { - if yyq220[1] { - yym225 := z.EncBinary() - _ = yym225 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq220[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym226 := z.EncBinary() - _ = yym226 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr220 || yy2arr220 { - if yyq220[2] { - yy228 := &x.ListMeta - yym229 := z.EncBinary() - _ = yym229 - if false { - } else if z.HasExtensions() && z.EncExt(yy228) { - } else { - z.EncFallback(yy228) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq220[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy230 := &x.ListMeta - yym231 := z.EncBinary() - _ = yym231 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy230) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy230) + z.EncFallback(yy6) } } } - if yyr220 || yy2arr220 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym233 := z.EncBinary() - _ = yym233 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceHorizontalPodAutoscaler(([]HorizontalPodAutoscaler)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym234 := z.EncBinary() - _ = yym234 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceHorizontalPodAutoscaler(([]HorizontalPodAutoscaler)(x.Items), e) } } } - if yysep220 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -2642,24 +3614,25 @@ func (x *HorizontalPodAutoscalerList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym235 := z.DecBinary() - _ = yym235 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl236 := r.ReadMapStart() - if yyl236 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl236, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl236 := r.ReadArrayStart() - if yyl236 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl236, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -2671,12 +3644,12 @@ func (x *HorizontalPodAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys237Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys237Slc - var yyhl237 bool = l >= 0 - for yyj237 := 0; ; yyj237++ { - if yyhl237 { - if yyj237 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -2684,9 +3657,36 @@ func (x *HorizontalPodAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978 break } } - yys237Slc = r.DecodeBytes(yys237Slc, true, true) - yys237 := string(yys237Slc) - switch yys237 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceHorizontalPodAutoscaler((*[]HorizontalPodAutoscaler)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -2699,133 +3699,111 @@ func (x *HorizontalPodAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978 } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv240 := &x.ListMeta - yym241 := z.DecBinary() - _ = yym241 - if false { - } else if z.HasExtensions() && z.DecExt(yyv240) { - } else { - z.DecFallback(yyv240, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv242 := &x.Items - yym243 := z.DecBinary() - _ = yym243 - if false { - } else { - h.decSliceHorizontalPodAutoscaler((*[]HorizontalPodAutoscaler)(yyv242), d) - } - } default: - z.DecStructFieldNotFound(-1, yys237) - } // end switch yys237 - } // end for yyj237 - if !yyhl237 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HorizontalPodAutoscalerList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj244 int - var yyb244 bool - var yyhl244 bool = l >= 0 - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb244 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb244 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceHorizontalPodAutoscaler((*[]HorizontalPodAutoscaler)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb244 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb244 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l - } else { - yyb244 = r.CheckBreak() - } - if yyb244 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv247 := &x.ListMeta - yym248 := z.DecBinary() - _ = yym248 - if false { - } else if z.HasExtensions() && z.DecExt(yyv247) { - } else { - z.DecFallback(yyv247, false) - } - } - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l - } else { - yyb244 = r.CheckBreak() - } - if yyb244 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv249 := &x.Items - yym250 := z.DecBinary() - _ = yym250 - if false { - } else { - h.decSliceHorizontalPodAutoscaler((*[]HorizontalPodAutoscaler)(yyv249), d) - } - } for { - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb244 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb244 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj244-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -2835,94 +3813,56 @@ func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym251 := z.EncBinary() - _ = yym251 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep252 := !z.EncBinary() - yy2arr252 := z.EncBasicHandle().StructToArray - var yyq252 [5]bool - _, _, _ = yysep252, yyq252, yy2arr252 - const yyr252 bool = false - yyq252[0] = x.Kind != "" - yyq252[1] = x.APIVersion != "" - yyq252[2] = true - yyq252[3] = x.Description != "" - yyq252[4] = len(x.Versions) != 0 - if yyr252 || yy2arr252 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = x.Description != "" + yyq2[2] = len(x.Versions) != 0 + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn252 int = 0 - for _, b := range yyq252 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn252++ + yynn2++ } } - r.EncodeMapStart(yynn252) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr252 || yy2arr252 { - if yyq252[0] { - yym254 := z.EncBinary() - _ = yym254 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq252[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym255 := z.EncBinary() - _ = yym255 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr252 || yy2arr252 { - if yyq252[1] { - yym257 := z.EncBinary() - _ = yym257 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq252[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym258 := z.EncBinary() - _ = yym258 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr252 || yy2arr252 { - if yyq252[2] { - yy260 := &x.ObjectMeta - yy260.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq252[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy261 := &x.ObjectMeta - yy261.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr252 || yy2arr252 { - if yyq252[3] { - yym263 := z.EncBinary() - _ = yym263 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym9 := z.EncBinary() + _ = yym9 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Description)) @@ -2931,23 +3871,26 @@ func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq252[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("description")) - yym264 := z.EncBinary() - _ = yym264 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Description)) } } } - if yyr252 || yy2arr252 { - if yyq252[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Versions == nil { r.EncodeNil() } else { - yym266 := z.EncBinary() - _ = yym266 + yym12 := z.EncBinary() + _ = yym12 if false { } else { h.encSliceAPIVersion(([]APIVersion)(x.Versions), e) @@ -2957,13 +3900,15 @@ func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq252[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("versions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Versions == nil { r.EncodeNil() } else { - yym267 := z.EncBinary() - _ = yym267 + yym13 := z.EncBinary() + _ = yym13 if false { } else { h.encSliceAPIVersion(([]APIVersion)(x.Versions), e) @@ -2971,8 +3916,60 @@ func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep252 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -2982,24 +3979,25 @@ func (x *ThirdPartyResource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym268 := z.DecBinary() - _ = yym268 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl269 := r.ReadMapStart() - if yyl269 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl269, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl269 := r.ReadArrayStart() - if yyl269 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl269, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3011,12 +4009,12 @@ func (x *ThirdPartyResource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys270Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys270Slc - var yyhl270 bool = l >= 0 - for yyj270 := 0; ; yyj270++ { - if yyhl270 { - if yyj270 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3024,27 +4022,17 @@ func (x *ThirdPartyResource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys270Slc = r.DecodeBytes(yys270Slc, true, true) - yys270 := string(yys270Slc) - switch yys270 { - case "kind": - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - case "apiVersion": - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "metadata": if r.TryDecodeAsNil() { x.ObjectMeta = pkg2_api.ObjectMeta{} } else { - yyv273 := &x.ObjectMeta - yyv273.CodecDecodeSelf(d) + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) } case "description": if r.TryDecodeAsNil() { @@ -3056,308 +4044,14 @@ func (x *ThirdPartyResource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) if r.TryDecodeAsNil() { x.Versions = nil } else { - yyv275 := &x.Versions - yym276 := z.DecBinary() - _ = yym276 + yyv6 := &x.Versions + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceAPIVersion((*[]APIVersion)(yyv275), d) + h.decSliceAPIVersion((*[]APIVersion)(yyv6), d) } } - default: - z.DecStructFieldNotFound(-1, yys270) - } // end switch yys270 - } // end for yyj270 - if !yyhl270 { - r.ReadEnd() - } -} - -func (x *ThirdPartyResource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj277 int - var yyb277 bool - var yyhl277 bool = l >= 0 - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv280 := &x.ObjectMeta - yyv280.CodecDecodeSelf(d) - } - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Description = "" - } else { - x.Description = string(r.DecodeString()) - } - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Versions = nil - } else { - yyv282 := &x.Versions - yym283 := z.DecBinary() - _ = yym283 - if false { - } else { - h.decSliceAPIVersion((*[]APIVersion)(yyv282), d) - } - } - for { - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - break - } - z.DecStructFieldNotFound(yyj277-1, "") - } - r.ReadEnd() -} - -func (x *ThirdPartyResourceList) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym284 := z.EncBinary() - _ = yym284 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep285 := !z.EncBinary() - yy2arr285 := z.EncBasicHandle().StructToArray - var yyq285 [4]bool - _, _, _ = yysep285, yyq285, yy2arr285 - const yyr285 bool = false - yyq285[0] = x.Kind != "" - yyq285[1] = x.APIVersion != "" - yyq285[2] = true - if yyr285 || yy2arr285 { - r.EncodeArrayStart(4) - } else { - var yynn285 int = 1 - for _, b := range yyq285 { - if b { - yynn285++ - } - } - r.EncodeMapStart(yynn285) - } - if yyr285 || yy2arr285 { - if yyq285[0] { - yym287 := z.EncBinary() - _ = yym287 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq285[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym288 := z.EncBinary() - _ = yym288 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr285 || yy2arr285 { - if yyq285[1] { - yym290 := z.EncBinary() - _ = yym290 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq285[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym291 := z.EncBinary() - _ = yym291 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr285 || yy2arr285 { - if yyq285[2] { - yy293 := &x.ListMeta - yym294 := z.EncBinary() - _ = yym294 - if false { - } else if z.HasExtensions() && z.EncExt(yy293) { - } else { - z.EncFallback(yy293) - } - } else { - r.EncodeNil() - } - } else { - if yyq285[2] { - r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy295 := &x.ListMeta - yym296 := z.EncBinary() - _ = yym296 - if false { - } else if z.HasExtensions() && z.EncExt(yy295) { - } else { - z.EncFallback(yy295) - } - } - } - if yyr285 || yy2arr285 { - if x.Items == nil { - r.EncodeNil() - } else { - yym298 := z.EncBinary() - _ = yym298 - if false { - } else { - h.encSliceThirdPartyResource(([]ThirdPartyResource)(x.Items), e) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("items")) - if x.Items == nil { - r.EncodeNil() - } else { - yym299 := z.EncBinary() - _ = yym299 - if false { - } else { - h.encSliceThirdPartyResource(([]ThirdPartyResource)(x.Items), e) - } - } - } - if yysep285 { - r.EncodeEnd() - } - } - } -} - -func (x *ThirdPartyResourceList) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym300 := z.DecBinary() - _ = yym300 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl301 := r.ReadMapStart() - if yyl301 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl301, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl301 := r.ReadArrayStart() - if yyl301 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl301, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *ThirdPartyResourceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys302Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys302Slc - var yyhl302 bool = l >= 0 - for yyj302 := 0; ; yyj302++ { - if yyhl302 { - if yyj302 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys302Slc = r.DecodeBytes(yys302Slc, true, true) - yys302 := string(yys302Slc) - switch yys302 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -3370,133 +4064,465 @@ func (x *ThirdPartyResourceList) codecDecodeSelfFromMap(l int, d *codec1978.Deco } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ThirdPartyResource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv11 := &x.ObjectMeta + yyv11.CodecDecodeSelf(d) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Description = "" + } else { + x.Description = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Versions = nil + } else { + yyv13 := &x.Versions + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceAPIVersion((*[]APIVersion)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ThirdPartyResourceList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.EncExt(yy4) { + } else { + z.EncFallback(yy4) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(yy6) { + } else { + z.EncFallback(yy6) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + h.encSliceThirdPartyResource(([]ThirdPartyResource)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSliceThirdPartyResource(([]ThirdPartyResource)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ThirdPartyResourceList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ThirdPartyResourceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "metadata": if r.TryDecodeAsNil() { x.ListMeta = pkg1_unversioned.ListMeta{} } else { - yyv305 := &x.ListMeta - yym306 := z.DecBinary() - _ = yym306 + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv305) { + } else if z.HasExtensions() && z.DecExt(yyv4) { } else { - z.DecFallback(yyv305, false) + z.DecFallback(yyv4, false) } } case "items": if r.TryDecodeAsNil() { x.Items = nil } else { - yyv307 := &x.Items - yym308 := z.DecBinary() - _ = yym308 + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceThirdPartyResource((*[]ThirdPartyResource)(yyv307), d) + h.decSliceThirdPartyResource((*[]ThirdPartyResource)(yyv6), d) } } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } default: - z.DecStructFieldNotFound(-1, yys302) - } // end switch yys302 - } // end for yyj302 - if !yyhl302 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ThirdPartyResourceList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj309 int - var yyb309 bool - var yyhl309 bool = l >= 0 - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb309 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb309 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceThirdPartyResource((*[]ThirdPartyResource)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb309 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb309 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l - } else { - yyb309 = r.CheckBreak() - } - if yyb309 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv312 := &x.ListMeta - yym313 := z.DecBinary() - _ = yym313 - if false { - } else if z.HasExtensions() && z.DecExt(yyv312) { - } else { - z.DecFallback(yyv312, false) - } - } - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l - } else { - yyb309 = r.CheckBreak() - } - if yyb309 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv314 := &x.Items - yym315 := z.DecBinary() - _ = yym315 - if false { - } else { - h.decSliceThirdPartyResource((*[]ThirdPartyResource)(yyv314), d) - } - } for { - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb309 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb309 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj309-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *APIVersion) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3506,33 +4532,36 @@ func (x *APIVersion) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym316 := z.EncBinary() - _ = yym316 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep317 := !z.EncBinary() - yy2arr317 := z.EncBasicHandle().StructToArray - var yyq317 [2]bool - _, _, _ = yysep317, yyq317, yy2arr317 - const yyr317 bool = false - yyq317[0] = x.Name != "" - yyq317[1] = x.APIGroup != "" - if yyr317 || yy2arr317 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Name != "" + yyq2[1] = x.APIGroup != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn317 int = 0 - for _, b := range yyq317 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn317++ + yynn2++ } } - r.EncodeMapStart(yynn317) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr317 || yy2arr317 { - if yyq317[0] { - yym319 := z.EncBinary() - _ = yym319 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -3541,20 +4570,23 @@ func (x *APIVersion) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq317[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym320 := z.EncBinary() - _ = yym320 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr317 || yy2arr317 { - if yyq317[1] { - yym322 := z.EncBinary() - _ = yym322 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIGroup)) @@ -3563,18 +4595,22 @@ func (x *APIVersion) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq317[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiGroup")) - yym323 := z.EncBinary() - _ = yym323 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIGroup)) } } } - if yysep317 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -3584,24 +4620,25 @@ func (x *APIVersion) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym324 := z.DecBinary() - _ = yym324 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl325 := r.ReadMapStart() - if yyl325 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl325, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl325 := r.ReadArrayStart() - if yyl325 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl325, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3613,12 +4650,12 @@ func (x *APIVersion) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys326Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys326Slc - var yyhl326 bool = l >= 0 - for yyj326 := 0; ; yyj326++ { - if yyhl326 { - if yyj326 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3626,9 +4663,11 @@ func (x *APIVersion) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys326Slc = r.DecodeBytes(yys326Slc, true, true) - yys326 := string(yys326Slc) - switch yys326 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -3642,64 +4681,65 @@ func (x *APIVersion) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.APIGroup = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys326) - } // end switch yys326 - } // end for yyj326 - if !yyhl326 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *APIVersion) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj329 int - var yyb329 bool - var yyhl329 bool = l >= 0 - yyj329++ - if yyhl329 { - yyb329 = yyj329 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb329 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb329 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj329++ - if yyhl329 { - yyb329 = yyj329 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb329 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb329 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIGroup = "" } else { x.APIGroup = string(r.DecodeString()) } for { - yyj329++ - if yyhl329 { - yyb329 = yyj329 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb329 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb329 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj329-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ThirdPartyResourceData) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3709,96 +4749,58 @@ func (x *ThirdPartyResourceData) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym332 := z.EncBinary() - _ = yym332 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep333 := !z.EncBinary() - yy2arr333 := z.EncBasicHandle().StructToArray - var yyq333 [4]bool - _, _, _ = yysep333, yyq333, yy2arr333 - const yyr333 bool = false - yyq333[0] = x.Kind != "" - yyq333[1] = x.APIVersion != "" - yyq333[2] = true - yyq333[3] = len(x.Data) != 0 - if yyr333 || yy2arr333 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Data) != 0 + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn333 int = 0 - for _, b := range yyq333 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn333++ + yynn2++ } } - r.EncodeMapStart(yynn333) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr333 || yy2arr333 { - if yyq333[0] { - yym335 := z.EncBinary() - _ = yym335 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq333[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym336 := z.EncBinary() - _ = yym336 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr333 || yy2arr333 { - if yyq333[1] { - yym338 := z.EncBinary() - _ = yym338 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq333[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym339 := z.EncBinary() - _ = yym339 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr333 || yy2arr333 { - if yyq333[2] { - yy341 := &x.ObjectMeta - yy341.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq333[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy342 := &x.ObjectMeta - yy342.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr333 || yy2arr333 { - if yyq333[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Data == nil { r.EncodeNil() } else { - yym344 := z.EncBinary() - _ = yym344 + yym9 := z.EncBinary() + _ = yym9 if false { } else { r.EncodeStringBytes(codecSelferC_RAW1234, []byte(x.Data)) @@ -3808,13 +4810,15 @@ func (x *ThirdPartyResourceData) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq333[3] { - r.EncodeString(codecSelferC_UTF81234, string("name")) + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("data")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Data == nil { r.EncodeNil() } else { - yym345 := z.EncBinary() - _ = yym345 + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeStringBytes(codecSelferC_RAW1234, []byte(x.Data)) @@ -3822,8 +4826,60 @@ func (x *ThirdPartyResourceData) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep333 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -3833,24 +4889,25 @@ func (x *ThirdPartyResourceData) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym346 := z.DecBinary() - _ = yym346 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl347 := r.ReadMapStart() - if yyl347 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl347, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl347 := r.ReadArrayStart() - if yyl347 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl347, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3862,12 +4919,12 @@ func (x *ThirdPartyResourceData) codecDecodeSelfFromMap(l int, d *codec1978.Deco var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys348Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys348Slc - var yyhl348 bool = l >= 0 - for yyj348 := 0; ; yyj348++ { - if yyhl348 { - if yyj348 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3875,9 +4932,30 @@ func (x *ThirdPartyResourceData) codecDecodeSelfFromMap(l int, d *codec1978.Deco break } } - yys348Slc = r.DecodeBytes(yys348Slc, true, true) - yys348 := string(yys348Slc) - switch yys348 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "data": + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv5 := &x.Data + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + *yyv5 = r.DecodeBytes(*(*[]byte)(yyv5), false, false) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -3890,121 +4968,105 @@ func (x *ThirdPartyResourceData) codecDecodeSelfFromMap(l int, d *codec1978.Deco } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv351 := &x.ObjectMeta - yyv351.CodecDecodeSelf(d) - } - case "name": - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv352 := &x.Data - yym353 := z.DecBinary() - _ = yym353 - if false { - } else { - *yyv352 = r.DecodeBytes(*(*[]byte)(yyv352), false, false) - } - } default: - z.DecStructFieldNotFound(-1, yys348) - } // end switch yys348 - } // end for yyj348 - if !yyhl348 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ThirdPartyResourceData) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj354 int - var yyb354 bool - var yyhl354 bool = l >= 0 - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb354 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb354 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv11 := &x.Data + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + *yyv11 = r.DecodeBytes(*(*[]byte)(yyv11), false, false) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb354 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb354 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l - } else { - yyb354 = r.CheckBreak() - } - if yyb354 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv357 := &x.ObjectMeta - yyv357.CodecDecodeSelf(d) - } - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l - } else { - yyb354 = r.CheckBreak() - } - if yyb354 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv358 := &x.Data - yym359 := z.DecBinary() - _ = yym359 - if false { - } else { - *yyv358 = r.DecodeBytes(*(*[]byte)(yyv358), false, false) - } - } for { - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb354 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb354 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj354-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Deployment) CodecEncodeSelf(e *codec1978.Encoder) { @@ -4014,120 +5076,139 @@ func (x *Deployment) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym360 := z.EncBinary() - _ = yym360 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep361 := !z.EncBinary() - yy2arr361 := z.EncBasicHandle().StructToArray - var yyq361 [5]bool - _, _, _ = yysep361, yyq361, yy2arr361 - const yyr361 bool = false - yyq361[0] = x.Kind != "" - yyq361[1] = x.APIVersion != "" - yyq361[2] = true - yyq361[3] = true - yyq361[4] = true - if yyr361 || yy2arr361 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn361 int = 0 - for _, b := range yyq361 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn361++ + yynn2++ } } - r.EncodeMapStart(yynn361) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr361 || yy2arr361 { - if yyq361[0] { - yym363 := z.EncBinary() - _ = yym363 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq361[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym364 := z.EncBinary() - _ = yym364 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr361 || yy2arr361 { - if yyq361[1] { - yym366 := z.EncBinary() - _ = yym366 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq361[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym367 := z.EncBinary() - _ = yym367 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr361 || yy2arr361 { - if yyq361[2] { - yy369 := &x.ObjectMeta - yy369.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq361[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy370 := &x.ObjectMeta - yy370.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr361 || yy2arr361 { - if yyq361[3] { - yy372 := &x.Spec - yy372.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq361[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy373 := &x.Spec - yy373.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr361 || yy2arr361 { - if yyq361[4] { - yy375 := &x.Status - yy375.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq361[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy376 := &x.Status - yy376.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep361 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4137,24 +5218,25 @@ func (x *Deployment) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym377 := z.DecBinary() - _ = yym377 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl378 := r.ReadMapStart() - if yyl378 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl378, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl378 := r.ReadArrayStart() - if yyl378 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl378, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4166,12 +5248,12 @@ func (x *Deployment) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys379Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys379Slc - var yyhl379 bool = l >= 0 - for yyj379 := 0; ; yyj379++ { - if yyhl379 { - if yyj379 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4179,9 +5261,32 @@ func (x *Deployment) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys379Slc = r.DecodeBytes(yys379Slc, true, true) - yys379 := string(yys379Slc) - switch yys379 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = DeploymentSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = DeploymentStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -4194,134 +5299,117 @@ func (x *Deployment) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv382 := &x.ObjectMeta - yyv382.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = DeploymentSpec{} - } else { - yyv383 := &x.Spec - yyv383.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = DeploymentStatus{} - } else { - yyv384 := &x.Status - yyv384.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys379) - } // end switch yys379 - } // end for yyj379 - if !yyhl379 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Deployment) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj385 int - var yyb385 bool - var yyhl385 bool = l >= 0 - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb385 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb385 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = DeploymentSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = DeploymentStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb385 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb385 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l - } else { - yyb385 = r.CheckBreak() - } - if yyb385 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv388 := &x.ObjectMeta - yyv388.CodecDecodeSelf(d) - } - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l - } else { - yyb385 = r.CheckBreak() - } - if yyb385 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = DeploymentSpec{} - } else { - yyv389 := &x.Spec - yyv389.CodecDecodeSelf(d) - } - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l - } else { - yyb385 = r.CheckBreak() - } - if yyb385 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = DeploymentStatus{} - } else { - yyv390 := &x.Status - yyv390.CodecDecodeSelf(d) - } for { - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb385 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb385 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj385-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeploymentSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -4331,36 +5419,41 @@ func (x *DeploymentSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym391 := z.EncBinary() - _ = yym391 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep392 := !z.EncBinary() - yy2arr392 := z.EncBasicHandle().StructToArray - var yyq392 [5]bool - _, _, _ = yysep392, yyq392, yy2arr392 - const yyr392 bool = false - yyq392[0] = x.Replicas != 0 - yyq392[1] = len(x.Selector) != 0 - yyq392[2] = x.Template != nil - yyq392[3] = true - yyq392[4] = x.UniqueLabelKey != "" - if yyr392 || yy2arr392 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Replicas != 0 + yyq2[1] = x.Selector != nil + yyq2[3] = true + yyq2[4] = x.MinReadySeconds != 0 + yyq2[5] = x.RevisionHistoryLimit != nil + yyq2[6] = x.Paused != false + yyq2[7] = x.RollbackTo != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(8) } else { - var yynn392 int = 0 - for _, b := range yyq392 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn392++ + yynn2++ } } - r.EncodeMapStart(yynn392) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr392 || yy2arr392 { - if yyq392[0] { - yym394 := z.EncBinary() - _ = yym394 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Replicas)) @@ -4369,104 +5462,193 @@ func (x *DeploymentSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq392[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) - yym395 := z.EncBinary() - _ = yym395 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Replicas)) } } } - if yyr392 || yy2arr392 { - if yyq392[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Selector == nil { r.EncodeNil() } else { - yym397 := z.EncBinary() - _ = yym397 + yym7 := z.EncBinary() + _ = yym7 if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { } else { - z.F.EncMapStringStringV(x.Selector, false, e) + z.EncFallback(x.Selector) } } } else { r.EncodeNil() } } else { - if yyq392[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym398 := z.EncBinary() - _ = yym398 + yym8 := z.EncBinary() + _ = yym8 if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { } else { - z.F.EncMapStringStringV(x.Selector, false, e) + z.EncFallback(x.Selector) } } } } - if yyr392 || yy2arr392 { - if yyq392[2] { - if x.Template == nil { - r.EncodeNil() - } else { - x.Template.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy10 := &x.Template + yy10.CodecEncodeSelf(e) } else { - if yyq392[2] { - r.EncodeString(codecSelferC_UTF81234, string("template")) - if x.Template == nil { - r.EncodeNil() - } else { - x.Template.CodecEncodeSelf(e) - } - } + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("template")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.Template + yy12.CodecEncodeSelf(e) } - if yyr392 || yy2arr392 { - if yyq392[3] { - yy401 := &x.Strategy - yy401.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yy15 := &x.Strategy + yy15.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq392[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("strategy")) - yy402 := &x.Strategy - yy402.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy17 := &x.Strategy + yy17.CodecEncodeSelf(e) } } - if yyr392 || yy2arr392 { - if yyq392[4] { - yym404 := z.EncBinary() - _ = yym404 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym20 := z.EncBinary() + _ = yym20 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.UniqueLabelKey)) + r.EncodeInt(int64(x.MinReadySeconds)) } } else { - r.EncodeString(codecSelferC_UTF81234, "") + r.EncodeInt(0) } } else { - if yyq392[4] { - r.EncodeString(codecSelferC_UTF81234, string("uniqueLabelKey")) - yym405 := z.EncBinary() - _ = yym405 + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("minReadySeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym21 := z.EncBinary() + _ = yym21 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.UniqueLabelKey)) + r.EncodeInt(int64(x.MinReadySeconds)) } } } - if yysep392 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + if x.RevisionHistoryLimit == nil { + r.EncodeNil() + } else { + yy23 := *x.RevisionHistoryLimit + yym24 := z.EncBinary() + _ = yym24 + if false { + } else { + r.EncodeInt(int64(yy23)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("revisionHistoryLimit")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.RevisionHistoryLimit == nil { + r.EncodeNil() + } else { + yy25 := *x.RevisionHistoryLimit + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeInt(int64(yy25)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym28 := z.EncBinary() + _ = yym28 + if false { + } else { + r.EncodeBool(bool(x.Paused)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("paused")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym29 := z.EncBinary() + _ = yym29 + if false { + } else { + r.EncodeBool(bool(x.Paused)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + if x.RollbackTo == nil { + r.EncodeNil() + } else { + x.RollbackTo.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rollbackTo")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.RollbackTo == nil { + r.EncodeNil() + } else { + x.RollbackTo.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4476,24 +5658,25 @@ func (x *DeploymentSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym406 := z.DecBinary() - _ = yym406 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl407 := r.ReadMapStart() - if yyl407 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl407, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl407 := r.ReadArrayStart() - if yyl407 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl407, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4505,12 +5688,12 @@ func (x *DeploymentSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys408Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys408Slc - var yyhl408 bool = l >= 0 - for yyj408 := 0; ; yyj408++ { - if yyhl408 { - if yyj408 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4518,9 +5701,11 @@ func (x *DeploymentSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys408Slc = r.DecodeBytes(yys408Slc, true, true) - yys408 := string(yys408Slc) - switch yys408 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 @@ -4529,156 +5714,788 @@ func (x *DeploymentSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "selector": if r.TryDecodeAsNil() { - x.Selector = nil + if x.Selector != nil { + x.Selector = nil + } } else { - yyv410 := &x.Selector - yym411 := z.DecBinary() - _ = yym411 + if x.Selector == nil { + x.Selector = new(pkg1_unversioned.LabelSelector) + } + yym6 := z.DecBinary() + _ = yym6 if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { } else { - z.F.DecMapStringStringX(yyv410, false, d) + z.DecFallback(x.Selector, false) } } case "template": if r.TryDecodeAsNil() { - if x.Template != nil { - x.Template = nil - } + x.Template = pkg2_api.PodTemplateSpec{} } else { - if x.Template == nil { - x.Template = new(pkg2_api.PodTemplateSpec) - } - x.Template.CodecDecodeSelf(d) + yyv7 := &x.Template + yyv7.CodecDecodeSelf(d) } case "strategy": if r.TryDecodeAsNil() { x.Strategy = DeploymentStrategy{} } else { - yyv413 := &x.Strategy - yyv413.CodecDecodeSelf(d) + yyv8 := &x.Strategy + yyv8.CodecDecodeSelf(d) } - case "uniqueLabelKey": + case "minReadySeconds": if r.TryDecodeAsNil() { - x.UniqueLabelKey = "" + x.MinReadySeconds = 0 } else { - x.UniqueLabelKey = string(r.DecodeString()) + x.MinReadySeconds = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "revisionHistoryLimit": + if r.TryDecodeAsNil() { + if x.RevisionHistoryLimit != nil { + x.RevisionHistoryLimit = nil + } + } else { + if x.RevisionHistoryLimit == nil { + x.RevisionHistoryLimit = new(int) + } + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + *((*int)(x.RevisionHistoryLimit)) = int(r.DecodeInt(codecSelferBitsize1234)) + } + } + case "paused": + if r.TryDecodeAsNil() { + x.Paused = false + } else { + x.Paused = bool(r.DecodeBool()) + } + case "rollbackTo": + if r.TryDecodeAsNil() { + if x.RollbackTo != nil { + x.RollbackTo = nil + } + } else { + if x.RollbackTo == nil { + x.RollbackTo = new(RollbackConfig) + } + x.RollbackTo.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys408) - } // end switch yys408 - } // end for yyj408 - if !yyhl408 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeploymentSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj415 int - var yyb415 bool - var yyhl415 bool = l >= 0 - yyj415++ - if yyhl415 { - yyb415 = yyj415 > l + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb415 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb415 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj415++ - if yyhl415 { - yyb415 = yyj415 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb415 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb415 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Selector = nil + if x.Selector != nil { + x.Selector = nil + } } else { - yyv417 := &x.Selector - yym418 := z.DecBinary() - _ = yym418 + if x.Selector == nil { + x.Selector = new(pkg1_unversioned.LabelSelector) + } + yym17 := z.DecBinary() + _ = yym17 if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { } else { - z.F.DecMapStringStringX(yyv417, false, d) + z.DecFallback(x.Selector, false) } } - yyj415++ - if yyhl415 { - yyb415 = yyj415 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb415 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb415 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - if x.Template != nil { - x.Template = nil - } + x.Template = pkg2_api.PodTemplateSpec{} } else { - if x.Template == nil { - x.Template = new(pkg2_api.PodTemplateSpec) - } - x.Template.CodecDecodeSelf(d) + yyv18 := &x.Template + yyv18.CodecDecodeSelf(d) } - yyj415++ - if yyhl415 { - yyb415 = yyj415 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb415 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb415 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Strategy = DeploymentStrategy{} } else { - yyv420 := &x.Strategy - yyv420.CodecDecodeSelf(d) + yyv19 := &x.Strategy + yyv19.CodecDecodeSelf(d) } - yyj415++ - if yyhl415 { - yyb415 = yyj415 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb415 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb415 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.UniqueLabelKey = "" + x.MinReadySeconds = 0 } else { - x.UniqueLabelKey = string(r.DecodeString()) + x.MinReadySeconds = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.RevisionHistoryLimit != nil { + x.RevisionHistoryLimit = nil + } + } else { + if x.RevisionHistoryLimit == nil { + x.RevisionHistoryLimit = new(int) + } + yym22 := z.DecBinary() + _ = yym22 + if false { + } else { + *((*int)(x.RevisionHistoryLimit)) = int(r.DecodeInt(codecSelferBitsize1234)) + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Paused = false + } else { + x.Paused = bool(r.DecodeBool()) + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.RollbackTo != nil { + x.RollbackTo = nil + } + } else { + if x.RollbackTo == nil { + x.RollbackTo = new(RollbackConfig) + } + x.RollbackTo.CodecDecodeSelf(d) } for { - yyj415++ - if yyhl415 { - yyb415 = yyj415 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb415 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb415 { + if yyb14 { break } - z.DecStructFieldNotFound(yyj415-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj14-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *DeploymentRollback) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = len(x.UpdatedAnnotations) != 0 + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.UpdatedAnnotations == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + z.F.EncMapStringStringV(x.UpdatedAnnotations, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("updatedAnnotations")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.UpdatedAnnotations == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + z.F.EncMapStringStringV(x.UpdatedAnnotations, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy10 := &x.RollbackTo + yy10.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rollbackTo")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.RollbackTo + yy12.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *DeploymentRollback) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *DeploymentRollback) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + case "updatedAnnotations": + if r.TryDecodeAsNil() { + x.UpdatedAnnotations = nil + } else { + yyv5 := &x.UpdatedAnnotations + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + z.F.DecMapStringStringX(yyv5, false, d) + } + } + case "rollbackTo": + if r.TryDecodeAsNil() { + x.RollbackTo = RollbackConfig{} + } else { + yyv7 := &x.RollbackTo + yyv7.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *DeploymentRollback) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.UpdatedAnnotations = nil + } else { + yyv12 := &x.UpdatedAnnotations + yym13 := z.DecBinary() + _ = yym13 + if false { + } else { + z.F.DecMapStringStringX(yyv12, false, d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RollbackTo = RollbackConfig{} + } else { + yyv14 := &x.RollbackTo + yyv14.CodecDecodeSelf(d) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *RollbackConfig) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Revision != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Revision)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("revision")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Revision)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RollbackConfig) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RollbackConfig) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "revision": + if r.TryDecodeAsNil() { + x.Revision = 0 + } else { + x.Revision = int64(r.DecodeInt(64)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RollbackConfig) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l + } else { + yyb5 = r.CheckBreak() + } + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Revision = 0 + } else { + x.Revision = int64(r.DecodeInt(64)) + } + for { + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l + } else { + yyb5 = r.CheckBreak() + } + if yyb5 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeploymentStrategy) CodecEncodeSelf(e *codec1978.Encoder) { @@ -4688,43 +6505,49 @@ func (x *DeploymentStrategy) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym422 := z.EncBinary() - _ = yym422 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep423 := !z.EncBinary() - yy2arr423 := z.EncBasicHandle().StructToArray - var yyq423 [2]bool - _, _, _ = yysep423, yyq423, yy2arr423 - const yyr423 bool = false - yyq423[0] = x.Type != "" - yyq423[1] = x.RollingUpdate != nil - if yyr423 || yy2arr423 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Type != "" + yyq2[1] = x.RollingUpdate != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn423 int = 0 - for _, b := range yyq423 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn423++ + yynn2++ } } - r.EncodeMapStart(yynn423) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr423 || yy2arr423 { - if yyq423[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Type.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq423[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } } - if yyr423 || yy2arr423 { - if yyq423[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.RollingUpdate == nil { r.EncodeNil() } else { @@ -4734,8 +6557,10 @@ func (x *DeploymentStrategy) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq423[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rollingUpdate")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RollingUpdate == nil { r.EncodeNil() } else { @@ -4743,8 +6568,10 @@ func (x *DeploymentStrategy) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep423 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4754,24 +6581,25 @@ func (x *DeploymentStrategy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym426 := z.DecBinary() - _ = yym426 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl427 := r.ReadMapStart() - if yyl427 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl427, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl427 := r.ReadArrayStart() - if yyl427 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl427, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4783,12 +6611,12 @@ func (x *DeploymentStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys428Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys428Slc - var yyhl428 bool = l >= 0 - for yyj428 := 0; ; yyj428++ { - if yyhl428 { - if yyj428 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4796,9 +6624,11 @@ func (x *DeploymentStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys428Slc = r.DecodeBytes(yys428Slc, true, true) - yys428 := string(yys428Slc) - switch yys428 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -4817,46 +6647,46 @@ func (x *DeploymentStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.RollingUpdate.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys428) - } // end switch yys428 - } // end for yyj428 - if !yyhl428 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeploymentStrategy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj431 int - var yyb431 bool - var yyhl431 bool = l >= 0 - yyj431++ - if yyhl431 { - yyb431 = yyj431 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb431 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb431 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = DeploymentStrategyType(r.DecodeString()) } - yyj431++ - if yyhl431 { - yyb431 = yyj431 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb431 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb431 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RollingUpdate != nil { x.RollingUpdate = nil @@ -4868,26 +6698,27 @@ func (x *DeploymentStrategy) codecDecodeSelfFromArray(l int, d *codec1978.Decode x.RollingUpdate.CodecDecodeSelf(d) } for { - yyj431++ - if yyhl431 { - yyb431 = yyj431 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb431 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb431 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj431-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x DeploymentStrategyType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym434 := z.EncBinary() - _ = yym434 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -4899,8 +6730,8 @@ func (x *DeploymentStrategyType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym435 := z.DecBinary() - _ = yym435 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -4915,114 +6746,101 @@ func (x *RollingUpdateDeployment) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym436 := z.EncBinary() - _ = yym436 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep437 := !z.EncBinary() - yy2arr437 := z.EncBasicHandle().StructToArray - var yyq437 [3]bool - _, _, _ = yysep437, yyq437, yy2arr437 - const yyr437 bool = false - yyq437[0] = true - yyq437[1] = true - yyq437[2] = x.MinReadySeconds != 0 - if yyr437 || yy2arr437 { - r.EncodeArrayStart(3) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) } else { - var yynn437 int = 0 - for _, b := range yyq437 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn437++ + yynn2++ } } - r.EncodeMapStart(yynn437) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr437 || yy2arr437 { - if yyq437[0] { - yy439 := &x.MaxUnavailable - yym440 := z.EncBinary() - _ = yym440 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.MaxUnavailable + yym5 := z.EncBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.EncExt(yy439) { - } else if !yym440 && z.IsJSONHandle() { - z.EncJSONMarshal(yy439) + } else if z.HasExtensions() && z.EncExt(yy4) { + } else if !yym5 && z.IsJSONHandle() { + z.EncJSONMarshal(yy4) } else { - z.EncFallback(yy439) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq437[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxUnavailable")) - yy441 := &x.MaxUnavailable - yym442 := z.EncBinary() - _ = yym442 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.MaxUnavailable + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy441) { - } else if !yym442 && z.IsJSONHandle() { - z.EncJSONMarshal(yy441) + } else if z.HasExtensions() && z.EncExt(yy6) { + } else if !yym7 && z.IsJSONHandle() { + z.EncJSONMarshal(yy6) } else { - z.EncFallback(yy441) + z.EncFallback(yy6) } } } - if yyr437 || yy2arr437 { - if yyq437[1] { - yy444 := &x.MaxSurge - yym445 := z.EncBinary() - _ = yym445 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.MaxSurge + yym10 := z.EncBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.EncExt(yy444) { - } else if !yym445 && z.IsJSONHandle() { - z.EncJSONMarshal(yy444) + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) } else { - z.EncFallback(yy444) + z.EncFallback(yy9) } } else { r.EncodeNil() } } else { - if yyq437[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxSurge")) - yy446 := &x.MaxSurge - yym447 := z.EncBinary() - _ = yym447 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.MaxSurge + yym12 := z.EncBinary() + _ = yym12 if false { - } else if z.HasExtensions() && z.EncExt(yy446) { - } else if !yym447 && z.IsJSONHandle() { - z.EncJSONMarshal(yy446) + } else if z.HasExtensions() && z.EncExt(yy11) { + } else if !yym12 && z.IsJSONHandle() { + z.EncJSONMarshal(yy11) } else { - z.EncFallback(yy446) + z.EncFallback(yy11) } } } - if yyr437 || yy2arr437 { - if yyq437[2] { - yym449 := z.EncBinary() - _ = yym449 - if false { - } else { - r.EncodeInt(int64(x.MinReadySeconds)) - } - } else { - r.EncodeInt(0) - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } else { - if yyq437[2] { - r.EncodeString(codecSelferC_UTF81234, string("minReadySeconds")) - yym450 := z.EncBinary() - _ = yym450 - if false { - } else { - r.EncodeInt(int64(x.MinReadySeconds)) - } - } - } - if yysep437 { - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5032,24 +6850,25 @@ func (x *RollingUpdateDeployment) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym451 := z.DecBinary() - _ = yym451 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl452 := r.ReadMapStart() - if yyl452 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl452, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl452 := r.ReadArrayStart() - if yyl452 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl452, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5061,12 +6880,12 @@ func (x *RollingUpdateDeployment) codecDecodeSelfFromMap(l int, d *codec1978.Dec var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys453Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys453Slc - var yyhl453 bool = l >= 0 - for yyj453 := 0; ; yyj453++ { - if yyhl453 { - if yyj453 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5074,137 +6893,119 @@ func (x *RollingUpdateDeployment) codecDecodeSelfFromMap(l int, d *codec1978.Dec break } } - yys453Slc = r.DecodeBytes(yys453Slc, true, true) - yys453 := string(yys453Slc) - switch yys453 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "maxUnavailable": if r.TryDecodeAsNil() { - x.MaxUnavailable = pkg6_util.IntOrString{} + x.MaxUnavailable = pkg6_intstr.IntOrString{} } else { - yyv454 := &x.MaxUnavailable - yym455 := z.DecBinary() - _ = yym455 + yyv4 := &x.MaxUnavailable + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv454) { - } else if !yym455 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv454) + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else if !yym5 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv4) } else { - z.DecFallback(yyv454, false) + z.DecFallback(yyv4, false) } } case "maxSurge": if r.TryDecodeAsNil() { - x.MaxSurge = pkg6_util.IntOrString{} + x.MaxSurge = pkg6_intstr.IntOrString{} } else { - yyv456 := &x.MaxSurge - yym457 := z.DecBinary() - _ = yym457 + yyv6 := &x.MaxSurge + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv456) { - } else if !yym457 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv456) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv456, false) + z.DecFallback(yyv6, false) } } - case "minReadySeconds": - if r.TryDecodeAsNil() { - x.MinReadySeconds = 0 - } else { - x.MinReadySeconds = int(r.DecodeInt(codecSelferBitsize1234)) - } default: - z.DecStructFieldNotFound(-1, yys453) - } // end switch yys453 - } // end for yyj453 - if !yyhl453 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *RollingUpdateDeployment) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj459 int - var yyb459 bool - var yyhl459 bool = l >= 0 - yyj459++ - if yyhl459 { - yyb459 = yyj459 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb459 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb459 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.MaxUnavailable = pkg6_util.IntOrString{} + x.MaxUnavailable = pkg6_intstr.IntOrString{} } else { - yyv460 := &x.MaxUnavailable - yym461 := z.DecBinary() - _ = yym461 + yyv9 := &x.MaxUnavailable + yym10 := z.DecBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.DecExt(yyv460) { - } else if !yym461 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv460) + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) } else { - z.DecFallback(yyv460, false) + z.DecFallback(yyv9, false) } } - yyj459++ - if yyhl459 { - yyb459 = yyj459 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb459 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb459 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.MaxSurge = pkg6_util.IntOrString{} + x.MaxSurge = pkg6_intstr.IntOrString{} } else { - yyv462 := &x.MaxSurge - yym463 := z.DecBinary() - _ = yym463 + yyv11 := &x.MaxSurge + yym12 := z.DecBinary() + _ = yym12 if false { - } else if z.HasExtensions() && z.DecExt(yyv462) { - } else if !yym463 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv462) + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else if !yym12 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv11) } else { - z.DecFallback(yyv462, false) + z.DecFallback(yyv11, false) } } - yyj459++ - if yyhl459 { - yyb459 = yyj459 > l - } else { - yyb459 = r.CheckBreak() - } - if yyb459 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.MinReadySeconds = 0 - } else { - x.MinReadySeconds = int(r.DecodeInt(codecSelferBitsize1234)) - } for { - yyj459++ - if yyhl459 { - yyb459 = yyj459 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb459 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb459 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj459-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeploymentStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5214,33 +7015,38 @@ func (x *DeploymentStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym465 := z.EncBinary() - _ = yym465 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep466 := !z.EncBinary() - yy2arr466 := z.EncBasicHandle().StructToArray - var yyq466 [2]bool - _, _, _ = yysep466, yyq466, yy2arr466 - const yyr466 bool = false - yyq466[0] = x.Replicas != 0 - yyq466[1] = x.UpdatedReplicas != 0 - if yyr466 || yy2arr466 { - r.EncodeArrayStart(2) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Replicas != 0 + yyq2[1] = x.UpdatedReplicas != 0 + yyq2[2] = x.AvailableReplicas != 0 + yyq2[3] = x.UnavailableReplicas != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) } else { - var yynn466 int = 0 - for _, b := range yyq466 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn466++ + yynn2++ } } - r.EncodeMapStart(yynn466) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr466 || yy2arr466 { - if yyq466[0] { - yym468 := z.EncBinary() - _ = yym468 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Replicas)) @@ -5249,20 +7055,23 @@ func (x *DeploymentStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq466[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) - yym469 := z.EncBinary() - _ = yym469 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Replicas)) } } } - if yyr466 || yy2arr466 { - if yyq466[1] { - yym471 := z.EncBinary() - _ = yym471 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.UpdatedReplicas)) @@ -5271,18 +7080,72 @@ func (x *DeploymentStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq466[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("updatedReplicas")) - yym472 := z.EncBinary() - _ = yym472 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.UpdatedReplicas)) } } } - if yysep466 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeInt(int64(x.AvailableReplicas)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("availableReplicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeInt(int64(x.AvailableReplicas)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeInt(int64(x.UnavailableReplicas)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("unavailableReplicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeInt(int64(x.UnavailableReplicas)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5292,24 +7155,25 @@ func (x *DeploymentStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym473 := z.DecBinary() - _ = yym473 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl474 := r.ReadMapStart() - if yyl474 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl474, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl474 := r.ReadArrayStart() - if yyl474 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl474, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5321,12 +7185,12 @@ func (x *DeploymentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys475Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys475Slc - var yyhl475 bool = l >= 0 - for yyj475 := 0; ; yyj475++ { - if yyhl475 { - if yyj475 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5334,9 +7198,11 @@ func (x *DeploymentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys475Slc = r.DecodeBytes(yys475Slc, true, true) - yys475 := string(yys475Slc) - switch yys475 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 @@ -5349,65 +7215,110 @@ func (x *DeploymentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.UpdatedReplicas = int(r.DecodeInt(codecSelferBitsize1234)) } + case "availableReplicas": + if r.TryDecodeAsNil() { + x.AvailableReplicas = 0 + } else { + x.AvailableReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "unavailableReplicas": + if r.TryDecodeAsNil() { + x.UnavailableReplicas = 0 + } else { + x.UnavailableReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + } default: - z.DecStructFieldNotFound(-1, yys475) - } // end switch yys475 - } // end for yyj475 - if !yyhl475 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeploymentStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj478 int - var yyb478 bool - var yyhl478 bool = l >= 0 - yyj478++ - if yyhl478 { - yyb478 = yyj478 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb478 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb478 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj478++ - if yyhl478 { - yyb478 = yyj478 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb478 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb478 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.UpdatedReplicas = 0 } else { x.UpdatedReplicas = int(r.DecodeInt(codecSelferBitsize1234)) } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.AvailableReplicas = 0 + } else { + x.AvailableReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.UnavailableReplicas = 0 + } else { + x.UnavailableReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + } for { - yyj478++ - if yyhl478 { - yyb478 = yyj478 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb478 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb478 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj478-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeploymentList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5417,126 +7328,142 @@ func (x *DeploymentList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym481 := z.EncBinary() - _ = yym481 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep482 := !z.EncBinary() - yy2arr482 := z.EncBasicHandle().StructToArray - var yyq482 [4]bool - _, _, _ = yysep482, yyq482, yy2arr482 - const yyr482 bool = false - yyq482[0] = x.Kind != "" - yyq482[1] = x.APIVersion != "" - yyq482[2] = true - if yyr482 || yy2arr482 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn482 int = 1 - for _, b := range yyq482 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn482++ + yynn2++ } } - r.EncodeMapStart(yynn482) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr482 || yy2arr482 { - if yyq482[0] { - yym484 := z.EncBinary() - _ = yym484 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq482[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym485 := z.EncBinary() - _ = yym485 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr482 || yy2arr482 { - if yyq482[1] { - yym487 := z.EncBinary() - _ = yym487 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq482[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym488 := z.EncBinary() - _ = yym488 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr482 || yy2arr482 { - if yyq482[2] { - yy490 := &x.ListMeta - yym491 := z.EncBinary() - _ = yym491 - if false { - } else if z.HasExtensions() && z.EncExt(yy490) { - } else { - z.EncFallback(yy490) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq482[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy492 := &x.ListMeta - yym493 := z.EncBinary() - _ = yym493 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy492) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy492) + z.EncFallback(yy6) } } } - if yyr482 || yy2arr482 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym495 := z.EncBinary() - _ = yym495 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceDeployment(([]Deployment)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym496 := z.EncBinary() - _ = yym496 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceDeployment(([]Deployment)(x.Items), e) } } } - if yysep482 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5546,24 +7473,25 @@ func (x *DeploymentList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym497 := z.DecBinary() - _ = yym497 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl498 := r.ReadMapStart() - if yyl498 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl498, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl498 := r.ReadArrayStart() - if yyl498 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl498, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5575,12 +7503,12 @@ func (x *DeploymentList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys499Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys499Slc - var yyhl499 bool = l >= 0 - for yyj499 := 0; ; yyj499++ { - if yyhl499 { - if yyj499 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5588,9 +7516,36 @@ func (x *DeploymentList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys499Slc = r.DecodeBytes(yys499Slc, true, true) - yys499 := string(yys499Slc) - switch yys499 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceDeployment((*[]Deployment)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -5603,133 +7558,111 @@ func (x *DeploymentList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv502 := &x.ListMeta - yym503 := z.DecBinary() - _ = yym503 - if false { - } else if z.HasExtensions() && z.DecExt(yyv502) { - } else { - z.DecFallback(yyv502, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv504 := &x.Items - yym505 := z.DecBinary() - _ = yym505 - if false { - } else { - h.decSliceDeployment((*[]Deployment)(yyv504), d) - } - } default: - z.DecStructFieldNotFound(-1, yys499) - } // end switch yys499 - } // end for yyj499 - if !yyhl499 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeploymentList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj506 int - var yyb506 bool - var yyhl506 bool = l >= 0 - yyj506++ - if yyhl506 { - yyb506 = yyj506 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb506 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb506 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceDeployment((*[]Deployment)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj506++ - if yyhl506 { - yyb506 = yyj506 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb506 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb506 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj506++ - if yyhl506 { - yyb506 = yyj506 > l - } else { - yyb506 = r.CheckBreak() - } - if yyb506 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv509 := &x.ListMeta - yym510 := z.DecBinary() - _ = yym510 - if false { - } else if z.HasExtensions() && z.DecExt(yyv509) { - } else { - z.DecFallback(yyv509, false) - } - } - yyj506++ - if yyhl506 { - yyb506 = yyj506 > l - } else { - yyb506 = r.CheckBreak() - } - if yyb506 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv511 := &x.Items - yym512 := z.DecBinary() - _ = yym512 - if false { - } else { - h.decSliceDeployment((*[]Deployment)(yyv511), d) - } - } for { - yyj506++ - if yyhl506 { - yyb506 = yyj506 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb506 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb506 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj506-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonSetSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5739,81 +7672,80 @@ func (x *DaemonSetSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym513 := z.EncBinary() - _ = yym513 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep514 := !z.EncBinary() - yy2arr514 := z.EncBasicHandle().StructToArray - var yyq514 [2]bool - _, _, _ = yysep514, yyq514, yy2arr514 - const yyr514 bool = false - yyq514[0] = len(x.Selector) != 0 - yyq514[1] = x.Template != nil - if yyr514 || yy2arr514 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Selector != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn514 int = 0 - for _, b := range yyq514 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn514++ + yynn2++ } } - r.EncodeMapStart(yynn514) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr514 || yy2arr514 { - if yyq514[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Selector == nil { r.EncodeNil() } else { - yym516 := z.EncBinary() - _ = yym516 + yym4 := z.EncBinary() + _ = yym4 if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { } else { - z.F.EncMapStringStringV(x.Selector, false, e) + z.EncFallback(x.Selector) } } } else { r.EncodeNil() } } else { - if yyq514[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym517 := z.EncBinary() - _ = yym517 + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { } else { - z.F.EncMapStringStringV(x.Selector, false, e) + z.EncFallback(x.Selector) } } } } - if yyr514 || yy2arr514 { - if yyq514[1] { - if x.Template == nil { - r.EncodeNil() - } else { - x.Template.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.Template + yy7.CodecEncodeSelf(e) } else { - if yyq514[1] { - r.EncodeString(codecSelferC_UTF81234, string("template")) - if x.Template == nil { - r.EncodeNil() - } else { - x.Template.CodecEncodeSelf(e) - } - } + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("template")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Template + yy9.CodecEncodeSelf(e) } - if yysep514 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5823,24 +7755,25 @@ func (x *DaemonSetSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym519 := z.DecBinary() - _ = yym519 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl520 := r.ReadMapStart() - if yyl520 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl520, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl520 := r.ReadArrayStart() - if yyl520 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl520, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5852,12 +7785,12 @@ func (x *DaemonSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys521Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys521Slc - var yyhl521 bool = l >= 0 - for yyj521 := 0; ; yyj521++ { - if yyhl521 { - if yyj521 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5865,102 +7798,107 @@ func (x *DaemonSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys521Slc = r.DecodeBytes(yys521Slc, true, true) - yys521 := string(yys521Slc) - switch yys521 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "selector": if r.TryDecodeAsNil() { - x.Selector = nil + if x.Selector != nil { + x.Selector = nil + } } else { - yyv522 := &x.Selector - yym523 := z.DecBinary() - _ = yym523 + if x.Selector == nil { + x.Selector = new(pkg1_unversioned.LabelSelector) + } + yym5 := z.DecBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { } else { - z.F.DecMapStringStringX(yyv522, false, d) + z.DecFallback(x.Selector, false) } } case "template": if r.TryDecodeAsNil() { - if x.Template != nil { - x.Template = nil - } + x.Template = pkg2_api.PodTemplateSpec{} } else { - if x.Template == nil { - x.Template = new(pkg2_api.PodTemplateSpec) - } - x.Template.CodecDecodeSelf(d) + yyv6 := &x.Template + yyv6.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys521) - } // end switch yys521 - } // end for yyj521 - if !yyhl521 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj525 int - var yyb525 bool - var yyhl525 bool = l >= 0 - yyj525++ - if yyhl525 { - yyb525 = yyj525 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb525 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb525 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Selector = nil + if x.Selector != nil { + x.Selector = nil + } } else { - yyv526 := &x.Selector - yym527 := z.DecBinary() - _ = yym527 + if x.Selector == nil { + x.Selector = new(pkg1_unversioned.LabelSelector) + } + yym9 := z.DecBinary() + _ = yym9 if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { } else { - z.F.DecMapStringStringX(yyv526, false, d) + z.DecFallback(x.Selector, false) } } - yyj525++ - if yyhl525 { - yyb525 = yyj525 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb525 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb525 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - if x.Template != nil { - x.Template = nil - } + x.Template = pkg2_api.PodTemplateSpec{} } else { - if x.Template == nil { - x.Template = new(pkg2_api.PodTemplateSpec) - } - x.Template.CodecDecodeSelf(d) + yyv10 := &x.Template + yyv10.CodecDecodeSelf(d) } for { - yyj525++ - if yyhl525 { - yyb525 = yyj525 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb525 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb525 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj525-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonSetStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5970,77 +7908,90 @@ func (x *DaemonSetStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym529 := z.EncBinary() - _ = yym529 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep530 := !z.EncBinary() - yy2arr530 := z.EncBasicHandle().StructToArray - var yyq530 [3]bool - _, _, _ = yysep530, yyq530, yy2arr530 - const yyr530 bool = false - if yyr530 || yy2arr530 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn530 int = 3 - for _, b := range yyq530 { + yynn2 = 3 + for _, b := range yyq2 { if b { - yynn530++ + yynn2++ } } - r.EncodeMapStart(yynn530) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr530 || yy2arr530 { - yym532 := z.EncBinary() - _ = yym532 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.CurrentNumberScheduled)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("currentNumberScheduled")) - yym533 := z.EncBinary() - _ = yym533 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.CurrentNumberScheduled)) } } - if yyr530 || yy2arr530 { - yym535 := z.EncBinary() - _ = yym535 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.NumberMisscheduled)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("numberMisscheduled")) - yym536 := z.EncBinary() - _ = yym536 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.NumberMisscheduled)) } } - if yyr530 || yy2arr530 { - yym538 := z.EncBinary() - _ = yym538 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.DesiredNumberScheduled)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("desiredNumberScheduled")) - yym539 := z.EncBinary() - _ = yym539 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.DesiredNumberScheduled)) } } - if yysep530 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6050,24 +8001,25 @@ func (x *DaemonSetStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym540 := z.DecBinary() - _ = yym540 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl541 := r.ReadMapStart() - if yyl541 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl541, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl541 := r.ReadArrayStart() - if yyl541 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl541, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6079,12 +8031,12 @@ func (x *DaemonSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys542Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys542Slc - var yyhl542 bool = l >= 0 - for yyj542 := 0; ; yyj542++ { - if yyhl542 { - if yyj542 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6092,9 +8044,11 @@ func (x *DaemonSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys542Slc = r.DecodeBytes(yys542Slc, true, true) - yys542 := string(yys542Slc) - switch yys542 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "currentNumberScheduled": if r.TryDecodeAsNil() { x.CurrentNumberScheduled = 0 @@ -6114,79 +8068,81 @@ func (x *DaemonSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.DesiredNumberScheduled = int(r.DecodeInt(codecSelferBitsize1234)) } default: - z.DecStructFieldNotFound(-1, yys542) - } // end switch yys542 - } // end for yyj542 - if !yyhl542 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj546 int - var yyb546 bool - var yyhl546 bool = l >= 0 - yyj546++ - if yyhl546 { - yyb546 = yyj546 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb546 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb546 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.CurrentNumberScheduled = 0 } else { x.CurrentNumberScheduled = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj546++ - if yyhl546 { - yyb546 = yyj546 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb546 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb546 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NumberMisscheduled = 0 } else { x.NumberMisscheduled = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj546++ - if yyhl546 { - yyb546 = yyj546 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb546 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb546 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DesiredNumberScheduled = 0 } else { x.DesiredNumberScheduled = int(r.DecodeInt(codecSelferBitsize1234)) } for { - yyj546++ - if yyhl546 { - yyb546 = yyj546 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb546 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb546 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj546-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonSet) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6196,120 +8152,139 @@ func (x *DaemonSet) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym550 := z.EncBinary() - _ = yym550 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep551 := !z.EncBinary() - yy2arr551 := z.EncBasicHandle().StructToArray - var yyq551 [5]bool - _, _, _ = yysep551, yyq551, yy2arr551 - const yyr551 bool = false - yyq551[0] = x.Kind != "" - yyq551[1] = x.APIVersion != "" - yyq551[2] = true - yyq551[3] = true - yyq551[4] = true - if yyr551 || yy2arr551 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn551 int = 0 - for _, b := range yyq551 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn551++ + yynn2++ } } - r.EncodeMapStart(yynn551) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr551 || yy2arr551 { - if yyq551[0] { - yym553 := z.EncBinary() - _ = yym553 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq551[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym554 := z.EncBinary() - _ = yym554 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr551 || yy2arr551 { - if yyq551[1] { - yym556 := z.EncBinary() - _ = yym556 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq551[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym557 := z.EncBinary() - _ = yym557 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr551 || yy2arr551 { - if yyq551[2] { - yy559 := &x.ObjectMeta - yy559.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq551[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy560 := &x.ObjectMeta - yy560.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr551 || yy2arr551 { - if yyq551[3] { - yy562 := &x.Spec - yy562.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq551[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy563 := &x.Spec - yy563.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr551 || yy2arr551 { - if yyq551[4] { - yy565 := &x.Status - yy565.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq551[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy566 := &x.Status - yy566.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep551 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6319,24 +8294,25 @@ func (x *DaemonSet) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym567 := z.DecBinary() - _ = yym567 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl568 := r.ReadMapStart() - if yyl568 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl568, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl568 := r.ReadArrayStart() - if yyl568 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl568, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6348,12 +8324,12 @@ func (x *DaemonSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys569Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys569Slc - var yyhl569 bool = l >= 0 - for yyj569 := 0; ; yyj569++ { - if yyhl569 { - if yyj569 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6361,9 +8337,32 @@ func (x *DaemonSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys569Slc = r.DecodeBytes(yys569Slc, true, true) - yys569 := string(yys569Slc) - switch yys569 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = DaemonSetSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = DaemonSetStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -6376,134 +8375,117 @@ func (x *DaemonSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv572 := &x.ObjectMeta - yyv572.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = DaemonSetSpec{} - } else { - yyv573 := &x.Spec - yyv573.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = DaemonSetStatus{} - } else { - yyv574 := &x.Status - yyv574.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys569) - } // end switch yys569 - } // end for yyj569 - if !yyhl569 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj575 int - var yyb575 bool - var yyhl575 bool = l >= 0 - yyj575++ - if yyhl575 { - yyb575 = yyj575 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb575 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb575 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = DaemonSetSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = DaemonSetStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj575++ - if yyhl575 { - yyb575 = yyj575 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb575 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb575 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj575++ - if yyhl575 { - yyb575 = yyj575 > l - } else { - yyb575 = r.CheckBreak() - } - if yyb575 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv578 := &x.ObjectMeta - yyv578.CodecDecodeSelf(d) - } - yyj575++ - if yyhl575 { - yyb575 = yyj575 > l - } else { - yyb575 = r.CheckBreak() - } - if yyb575 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = DaemonSetSpec{} - } else { - yyv579 := &x.Spec - yyv579.CodecDecodeSelf(d) - } - yyj575++ - if yyhl575 { - yyb575 = yyj575 > l - } else { - yyb575 = r.CheckBreak() - } - if yyb575 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = DaemonSetStatus{} - } else { - yyv580 := &x.Status - yyv580.CodecDecodeSelf(d) - } for { - yyj575++ - if yyhl575 { - yyb575 = yyj575 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb575 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb575 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj575-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonSetList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6513,126 +8495,142 @@ func (x *DaemonSetList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym581 := z.EncBinary() - _ = yym581 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep582 := !z.EncBinary() - yy2arr582 := z.EncBasicHandle().StructToArray - var yyq582 [4]bool - _, _, _ = yysep582, yyq582, yy2arr582 - const yyr582 bool = false - yyq582[0] = x.Kind != "" - yyq582[1] = x.APIVersion != "" - yyq582[2] = true - if yyr582 || yy2arr582 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn582 int = 1 - for _, b := range yyq582 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn582++ + yynn2++ } } - r.EncodeMapStart(yynn582) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr582 || yy2arr582 { - if yyq582[0] { - yym584 := z.EncBinary() - _ = yym584 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq582[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym585 := z.EncBinary() - _ = yym585 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr582 || yy2arr582 { - if yyq582[1] { - yym587 := z.EncBinary() - _ = yym587 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq582[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym588 := z.EncBinary() - _ = yym588 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr582 || yy2arr582 { - if yyq582[2] { - yy590 := &x.ListMeta - yym591 := z.EncBinary() - _ = yym591 - if false { - } else if z.HasExtensions() && z.EncExt(yy590) { - } else { - z.EncFallback(yy590) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq582[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy592 := &x.ListMeta - yym593 := z.EncBinary() - _ = yym593 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy592) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy592) + z.EncFallback(yy6) } } } - if yyr582 || yy2arr582 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym595 := z.EncBinary() - _ = yym595 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceDaemonSet(([]DaemonSet)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym596 := z.EncBinary() - _ = yym596 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceDaemonSet(([]DaemonSet)(x.Items), e) } } } - if yysep582 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6642,24 +8640,25 @@ func (x *DaemonSetList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym597 := z.DecBinary() - _ = yym597 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl598 := r.ReadMapStart() - if yyl598 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl598, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl598 := r.ReadArrayStart() - if yyl598 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl598, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6671,12 +8670,12 @@ func (x *DaemonSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys599Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys599Slc - var yyhl599 bool = l >= 0 - for yyj599 := 0; ; yyj599++ { - if yyhl599 { - if yyj599 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6684,9 +8683,36 @@ func (x *DaemonSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys599Slc = r.DecodeBytes(yys599Slc, true, true) - yys599 := string(yys599Slc) - switch yys599 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceDaemonSet((*[]DaemonSet)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -6699,133 +8725,111 @@ func (x *DaemonSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv602 := &x.ListMeta - yym603 := z.DecBinary() - _ = yym603 - if false { - } else if z.HasExtensions() && z.DecExt(yyv602) { - } else { - z.DecFallback(yyv602, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv604 := &x.Items - yym605 := z.DecBinary() - _ = yym605 - if false { - } else { - h.decSliceDaemonSet((*[]DaemonSet)(yyv604), d) - } - } default: - z.DecStructFieldNotFound(-1, yys599) - } // end switch yys599 - } // end for yyj599 - if !yyhl599 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj606 int - var yyb606 bool - var yyhl606 bool = l >= 0 - yyj606++ - if yyhl606 { - yyb606 = yyj606 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb606 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb606 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceDaemonSet((*[]DaemonSet)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj606++ - if yyhl606 { - yyb606 = yyj606 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb606 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb606 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj606++ - if yyhl606 { - yyb606 = yyj606 > l - } else { - yyb606 = r.CheckBreak() - } - if yyb606 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv609 := &x.ListMeta - yym610 := z.DecBinary() - _ = yym610 - if false { - } else if z.HasExtensions() && z.DecExt(yyv609) { - } else { - z.DecFallback(yyv609, false) - } - } - yyj606++ - if yyhl606 { - yyb606 = yyj606 > l - } else { - yyb606 = r.CheckBreak() - } - if yyb606 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv611 := &x.Items - yym612 := z.DecBinary() - _ = yym612 - if false { - } else { - h.decSliceDaemonSet((*[]DaemonSet)(yyv611), d) - } - } for { - yyj606++ - if yyhl606 { - yyb606 = yyj606 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb606 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb606 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj606-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ThirdPartyResourceDataList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6835,126 +8839,142 @@ func (x *ThirdPartyResourceDataList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym613 := z.EncBinary() - _ = yym613 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep614 := !z.EncBinary() - yy2arr614 := z.EncBasicHandle().StructToArray - var yyq614 [4]bool - _, _, _ = yysep614, yyq614, yy2arr614 - const yyr614 bool = false - yyq614[0] = x.Kind != "" - yyq614[1] = x.APIVersion != "" - yyq614[2] = true - if yyr614 || yy2arr614 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn614 int = 1 - for _, b := range yyq614 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn614++ + yynn2++ } } - r.EncodeMapStart(yynn614) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr614 || yy2arr614 { - if yyq614[0] { - yym616 := z.EncBinary() - _ = yym616 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq614[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym617 := z.EncBinary() - _ = yym617 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr614 || yy2arr614 { - if yyq614[1] { - yym619 := z.EncBinary() - _ = yym619 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq614[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym620 := z.EncBinary() - _ = yym620 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr614 || yy2arr614 { - if yyq614[2] { - yy622 := &x.ListMeta - yym623 := z.EncBinary() - _ = yym623 - if false { - } else if z.HasExtensions() && z.EncExt(yy622) { - } else { - z.EncFallback(yy622) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq614[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy624 := &x.ListMeta - yym625 := z.EncBinary() - _ = yym625 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy624) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy624) + z.EncFallback(yy6) } } } - if yyr614 || yy2arr614 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym627 := z.EncBinary() - _ = yym627 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceThirdPartyResourceData(([]ThirdPartyResourceData)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym628 := z.EncBinary() - _ = yym628 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceThirdPartyResourceData(([]ThirdPartyResourceData)(x.Items), e) } } } - if yysep614 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6964,24 +8984,25 @@ func (x *ThirdPartyResourceDataList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym629 := z.DecBinary() - _ = yym629 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl630 := r.ReadMapStart() - if yyl630 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl630, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl630 := r.ReadArrayStart() - if yyl630 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl630, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6993,12 +9014,12 @@ func (x *ThirdPartyResourceDataList) codecDecodeSelfFromMap(l int, d *codec1978. var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys631Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys631Slc - var yyhl631 bool = l >= 0 - for yyj631 := 0; ; yyj631++ { - if yyhl631 { - if yyj631 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7006,9 +9027,36 @@ func (x *ThirdPartyResourceDataList) codecDecodeSelfFromMap(l int, d *codec1978. break } } - yys631Slc = r.DecodeBytes(yys631Slc, true, true) - yys631 := string(yys631Slc) - switch yys631 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceThirdPartyResourceData((*[]ThirdPartyResourceData)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -7021,133 +9069,111 @@ func (x *ThirdPartyResourceDataList) codecDecodeSelfFromMap(l int, d *codec1978. } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv634 := &x.ListMeta - yym635 := z.DecBinary() - _ = yym635 - if false { - } else if z.HasExtensions() && z.DecExt(yyv634) { - } else { - z.DecFallback(yyv634, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv636 := &x.Items - yym637 := z.DecBinary() - _ = yym637 - if false { - } else { - h.decSliceThirdPartyResourceData((*[]ThirdPartyResourceData)(yyv636), d) - } - } default: - z.DecStructFieldNotFound(-1, yys631) - } // end switch yys631 - } // end for yyj631 - if !yyhl631 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ThirdPartyResourceDataList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj638 int - var yyb638 bool - var yyhl638 bool = l >= 0 - yyj638++ - if yyhl638 { - yyb638 = yyj638 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb638 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb638 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceThirdPartyResourceData((*[]ThirdPartyResourceData)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj638++ - if yyhl638 { - yyb638 = yyj638 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb638 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb638 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj638++ - if yyhl638 { - yyb638 = yyj638 > l - } else { - yyb638 = r.CheckBreak() - } - if yyb638 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv641 := &x.ListMeta - yym642 := z.DecBinary() - _ = yym642 - if false { - } else if z.HasExtensions() && z.DecExt(yyv641) { - } else { - z.DecFallback(yyv641, false) - } - } - yyj638++ - if yyhl638 { - yyb638 = yyj638 > l - } else { - yyb638 = r.CheckBreak() - } - if yyb638 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv643 := &x.Items - yym644 := z.DecBinary() - _ = yym644 - if false { - } else { - h.decSliceThirdPartyResourceData((*[]ThirdPartyResourceData)(yyv643), d) - } - } for { - yyj638++ - if yyhl638 { - yyb638 = yyj638 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb638 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb638 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj638-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Job) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7157,120 +9183,139 @@ func (x *Job) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym645 := z.EncBinary() - _ = yym645 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep646 := !z.EncBinary() - yy2arr646 := z.EncBasicHandle().StructToArray - var yyq646 [5]bool - _, _, _ = yysep646, yyq646, yy2arr646 - const yyr646 bool = false - yyq646[0] = x.Kind != "" - yyq646[1] = x.APIVersion != "" - yyq646[2] = true - yyq646[3] = true - yyq646[4] = true - if yyr646 || yy2arr646 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn646 int = 0 - for _, b := range yyq646 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn646++ + yynn2++ } } - r.EncodeMapStart(yynn646) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr646 || yy2arr646 { - if yyq646[0] { - yym648 := z.EncBinary() - _ = yym648 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq646[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym649 := z.EncBinary() - _ = yym649 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr646 || yy2arr646 { - if yyq646[1] { - yym651 := z.EncBinary() - _ = yym651 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq646[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym652 := z.EncBinary() - _ = yym652 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr646 || yy2arr646 { - if yyq646[2] { - yy654 := &x.ObjectMeta - yy654.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq646[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy655 := &x.ObjectMeta - yy655.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr646 || yy2arr646 { - if yyq646[3] { - yy657 := &x.Spec - yy657.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq646[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy658 := &x.Spec - yy658.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr646 || yy2arr646 { - if yyq646[4] { - yy660 := &x.Status - yy660.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq646[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy661 := &x.Status - yy661.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep646 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7280,24 +9325,25 @@ func (x *Job) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym662 := z.DecBinary() - _ = yym662 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl663 := r.ReadMapStart() - if yyl663 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl663, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl663 := r.ReadArrayStart() - if yyl663 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl663, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7309,12 +9355,12 @@ func (x *Job) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys664Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys664Slc - var yyhl664 bool = l >= 0 - for yyj664 := 0; ; yyj664++ { - if yyhl664 { - if yyj664 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7322,9 +9368,32 @@ func (x *Job) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys664Slc = r.DecodeBytes(yys664Slc, true, true) - yys664 := string(yys664Slc) - switch yys664 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = JobSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = JobStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -7337,134 +9406,117 @@ func (x *Job) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv667 := &x.ObjectMeta - yyv667.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = JobSpec{} - } else { - yyv668 := &x.Spec - yyv668.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = JobStatus{} - } else { - yyv669 := &x.Status - yyv669.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys664) - } // end switch yys664 - } // end for yyj664 - if !yyhl664 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Job) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj670 int - var yyb670 bool - var yyhl670 bool = l >= 0 - yyj670++ - if yyhl670 { - yyb670 = yyj670 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb670 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb670 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = JobSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = JobStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj670++ - if yyhl670 { - yyb670 = yyj670 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb670 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb670 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj670++ - if yyhl670 { - yyb670 = yyj670 > l - } else { - yyb670 = r.CheckBreak() - } - if yyb670 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv673 := &x.ObjectMeta - yyv673.CodecDecodeSelf(d) - } - yyj670++ - if yyhl670 { - yyb670 = yyj670 > l - } else { - yyb670 = r.CheckBreak() - } - if yyb670 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = JobSpec{} - } else { - yyv674 := &x.Spec - yyv674.CodecDecodeSelf(d) - } - yyj670++ - if yyhl670 { - yyb670 = yyj670 > l - } else { - yyb670 = r.CheckBreak() - } - if yyb670 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = JobStatus{} - } else { - yyv675 := &x.Status - yyv675.CodecDecodeSelf(d) - } for { - yyj670++ - if yyhl670 { - yyb670 = yyj670 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb670 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb670 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj670-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *JobList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7474,126 +9526,142 @@ func (x *JobList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym676 := z.EncBinary() - _ = yym676 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep677 := !z.EncBinary() - yy2arr677 := z.EncBasicHandle().StructToArray - var yyq677 [4]bool - _, _, _ = yysep677, yyq677, yy2arr677 - const yyr677 bool = false - yyq677[0] = x.Kind != "" - yyq677[1] = x.APIVersion != "" - yyq677[2] = true - if yyr677 || yy2arr677 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn677 int = 1 - for _, b := range yyq677 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn677++ + yynn2++ } } - r.EncodeMapStart(yynn677) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr677 || yy2arr677 { - if yyq677[0] { - yym679 := z.EncBinary() - _ = yym679 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq677[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym680 := z.EncBinary() - _ = yym680 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr677 || yy2arr677 { - if yyq677[1] { - yym682 := z.EncBinary() - _ = yym682 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq677[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym683 := z.EncBinary() - _ = yym683 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr677 || yy2arr677 { - if yyq677[2] { - yy685 := &x.ListMeta - yym686 := z.EncBinary() - _ = yym686 - if false { - } else if z.HasExtensions() && z.EncExt(yy685) { - } else { - z.EncFallback(yy685) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq677[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy687 := &x.ListMeta - yym688 := z.EncBinary() - _ = yym688 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy687) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy687) + z.EncFallback(yy6) } } } - if yyr677 || yy2arr677 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym690 := z.EncBinary() - _ = yym690 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceJob(([]Job)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym691 := z.EncBinary() - _ = yym691 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceJob(([]Job)(x.Items), e) } } } - if yysep677 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7603,24 +9671,25 @@ func (x *JobList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym692 := z.DecBinary() - _ = yym692 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl693 := r.ReadMapStart() - if yyl693 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl693, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl693 := r.ReadArrayStart() - if yyl693 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl693, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7632,12 +9701,12 @@ func (x *JobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys694Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys694Slc - var yyhl694 bool = l >= 0 - for yyj694 := 0; ; yyj694++ { - if yyhl694 { - if yyj694 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7645,9 +9714,36 @@ func (x *JobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys694Slc = r.DecodeBytes(yys694Slc, true, true) - yys694 := string(yys694Slc) - switch yys694 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceJob((*[]Job)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -7660,133 +9756,111 @@ func (x *JobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv697 := &x.ListMeta - yym698 := z.DecBinary() - _ = yym698 - if false { - } else if z.HasExtensions() && z.DecExt(yyv697) { - } else { - z.DecFallback(yyv697, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv699 := &x.Items - yym700 := z.DecBinary() - _ = yym700 - if false { - } else { - h.decSliceJob((*[]Job)(yyv699), d) - } - } default: - z.DecStructFieldNotFound(-1, yys694) - } // end switch yys694 - } // end for yyj694 - if !yyhl694 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *JobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj701 int - var yyb701 bool - var yyhl701 bool = l >= 0 - yyj701++ - if yyhl701 { - yyb701 = yyj701 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb701 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb701 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceJob((*[]Job)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj701++ - if yyhl701 { - yyb701 = yyj701 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb701 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb701 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj701++ - if yyhl701 { - yyb701 = yyj701 > l - } else { - yyb701 = r.CheckBreak() - } - if yyb701 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv704 := &x.ListMeta - yym705 := z.DecBinary() - _ = yym705 - if false { - } else if z.HasExtensions() && z.DecExt(yyv704) { - } else { - z.DecFallback(yyv704, false) - } - } - yyj701++ - if yyhl701 { - yyb701 = yyj701 > l - } else { - yyb701 = r.CheckBreak() - } - if yyb701 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv706 := &x.Items - yym707 := z.DecBinary() - _ = yym707 - if false { - } else { - h.decSliceJob((*[]Job)(yyv706), d) - } - } for { - yyj701++ - if yyhl701 { - yyb701 = yyj701 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb701 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb701 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj701-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *JobSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7796,124 +9870,188 @@ func (x *JobSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym708 := z.EncBinary() - _ = yym708 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep709 := !z.EncBinary() - yy2arr709 := z.EncBasicHandle().StructToArray - var yyq709 [4]bool - _, _, _ = yysep709, yyq709, yy2arr709 - const yyr709 bool = false - yyq709[0] = x.Parallelism != nil - yyq709[1] = x.Completions != nil - yyq709[2] = x.Selector != nil - if yyr709 || yy2arr709 { - r.EncodeArrayStart(4) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Parallelism != nil + yyq2[1] = x.Completions != nil + yyq2[2] = x.ActiveDeadlineSeconds != nil + yyq2[3] = x.Selector != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) } else { - var yynn709 int = 1 - for _, b := range yyq709 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn709++ + yynn2++ } } - r.EncodeMapStart(yynn709) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr709 || yy2arr709 { - if yyq709[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Parallelism == nil { r.EncodeNil() } else { - yy711 := *x.Parallelism - yym712 := z.EncBinary() - _ = yym712 + yy4 := *x.Parallelism + yym5 := z.EncBinary() + _ = yym5 if false { } else { - r.EncodeInt(int64(yy711)) + r.EncodeInt(int64(yy4)) } } } else { r.EncodeNil() } } else { - if yyq709[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("parallelism")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Parallelism == nil { r.EncodeNil() } else { - yy713 := *x.Parallelism - yym714 := z.EncBinary() - _ = yym714 + yy6 := *x.Parallelism + yym7 := z.EncBinary() + _ = yym7 if false { } else { - r.EncodeInt(int64(yy713)) + r.EncodeInt(int64(yy6)) } } } } - if yyr709 || yy2arr709 { - if yyq709[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Completions == nil { r.EncodeNil() } else { - yy716 := *x.Completions - yym717 := z.EncBinary() - _ = yym717 + yy9 := *x.Completions + yym10 := z.EncBinary() + _ = yym10 if false { } else { - r.EncodeInt(int64(yy716)) + r.EncodeInt(int64(yy9)) } } } else { r.EncodeNil() } } else { - if yyq709[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("completions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Completions == nil { r.EncodeNil() } else { - yy718 := *x.Completions - yym719 := z.EncBinary() - _ = yym719 + yy11 := *x.Completions + yym12 := z.EncBinary() + _ = yym12 if false { } else { - r.EncodeInt(int64(yy718)) + r.EncodeInt(int64(yy11)) } } } } - if yyr709 || yy2arr709 { - if yyq709[2] { - if x.Selector == nil { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.ActiveDeadlineSeconds == nil { r.EncodeNil() } else { - x.Selector.CodecEncodeSelf(e) + yy14 := *x.ActiveDeadlineSeconds + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeInt(int64(yy14)) + } } } else { r.EncodeNil() } } else { - if yyq709[2] { - r.EncodeString(codecSelferC_UTF81234, string("selector")) - if x.Selector == nil { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("activeDeadlineSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ActiveDeadlineSeconds == nil { r.EncodeNil() } else { - x.Selector.CodecEncodeSelf(e) + yy16 := *x.ActiveDeadlineSeconds + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeInt(int64(yy16)) + } } } } - if yyr709 || yy2arr709 { - yy722 := &x.Template - yy722.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + if x.Selector == nil { + r.EncodeNil() + } else { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { + } else { + z.EncFallback(x.Selector) + } + } + } else { + r.EncodeNil() + } } else { - r.EncodeString(codecSelferC_UTF81234, string("template")) - yy723 := &x.Template - yy723.CodecEncodeSelf(e) + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Selector == nil { + r.EncodeNil() + } else { + yym20 := z.EncBinary() + _ = yym20 + if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { + } else { + z.EncFallback(x.Selector) + } + } + } } - if yysep709 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy22 := &x.Template + yy22.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("template")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy24 := &x.Template + yy24.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7923,24 +10061,25 @@ func (x *JobSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym724 := z.DecBinary() - _ = yym724 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl725 := r.ReadMapStart() - if yyl725 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl725, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl725 := r.ReadArrayStart() - if yyl725 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl725, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7952,12 +10091,12 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys726Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys726Slc - var yyhl726 bool = l >= 0 - for yyj726 := 0; ; yyj726++ { - if yyhl726 { - if yyj726 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7965,9 +10104,11 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys726Slc = r.DecodeBytes(yys726Slc, true, true) - yys726 := string(yys726Slc) - switch yys726 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "parallelism": if r.TryDecodeAsNil() { if x.Parallelism != nil { @@ -7977,8 +10118,8 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.Parallelism == nil { x.Parallelism = new(int) } - yym728 := z.DecBinary() - _ = yym728 + yym5 := z.DecBinary() + _ = yym5 if false { } else { *((*int)(x.Parallelism)) = int(r.DecodeInt(codecSelferBitsize1234)) @@ -7993,13 +10134,29 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.Completions == nil { x.Completions = new(int) } - yym730 := z.DecBinary() - _ = yym730 + yym7 := z.DecBinary() + _ = yym7 if false { } else { *((*int)(x.Completions)) = int(r.DecodeInt(codecSelferBitsize1234)) } } + case "activeDeadlineSeconds": + if r.TryDecodeAsNil() { + if x.ActiveDeadlineSeconds != nil { + x.ActiveDeadlineSeconds = nil + } + } else { + if x.ActiveDeadlineSeconds == nil { + x.ActiveDeadlineSeconds = new(int64) + } + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*int64)(x.ActiveDeadlineSeconds)) = int64(r.DecodeInt(64)) + } + } case "selector": if r.TryDecodeAsNil() { if x.Selector != nil { @@ -8007,43 +10164,48 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } } else { if x.Selector == nil { - x.Selector = new(PodSelector) + x.Selector = new(pkg1_unversioned.LabelSelector) + } + yym11 := z.DecBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { + } else { + z.DecFallback(x.Selector, false) } - x.Selector.CodecDecodeSelf(d) } case "template": if r.TryDecodeAsNil() { x.Template = pkg2_api.PodTemplateSpec{} } else { - yyv732 := &x.Template - yyv732.CodecDecodeSelf(d) + yyv12 := &x.Template + yyv12.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys726) - } // end switch yys726 - } // end for yyj726 - if !yyhl726 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *JobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj733 int - var yyb733 bool - var yyhl733 bool = l >= 0 - yyj733++ - if yyhl733 { - yyb733 = yyj733 > l + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb733 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb733 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Parallelism != nil { x.Parallelism = nil @@ -8052,23 +10214,24 @@ func (x *JobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.Parallelism == nil { x.Parallelism = new(int) } - yym735 := z.DecBinary() - _ = yym735 + yym15 := z.DecBinary() + _ = yym15 if false { } else { *((*int)(x.Parallelism)) = int(r.DecodeInt(codecSelferBitsize1234)) } } - yyj733++ - if yyhl733 { - yyb733 = yyj733 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb733 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb733 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Completions != nil { x.Completions = nil @@ -8077,62 +10240,97 @@ func (x *JobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.Completions == nil { x.Completions = new(int) } - yym737 := z.DecBinary() - _ = yym737 + yym17 := z.DecBinary() + _ = yym17 if false { } else { *((*int)(x.Completions)) = int(r.DecodeInt(codecSelferBitsize1234)) } } - yyj733++ - if yyhl733 { - yyb733 = yyj733 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb733 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb733 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ActiveDeadlineSeconds != nil { + x.ActiveDeadlineSeconds = nil + } + } else { + if x.ActiveDeadlineSeconds == nil { + x.ActiveDeadlineSeconds = new(int64) + } + yym19 := z.DecBinary() + _ = yym19 + if false { + } else { + *((*int64)(x.ActiveDeadlineSeconds)) = int64(r.DecodeInt(64)) + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Selector != nil { x.Selector = nil } } else { if x.Selector == nil { - x.Selector = new(PodSelector) + x.Selector = new(pkg1_unversioned.LabelSelector) + } + yym21 := z.DecBinary() + _ = yym21 + if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { + } else { + z.DecFallback(x.Selector, false) } - x.Selector.CodecDecodeSelf(d) } - yyj733++ - if yyhl733 { - yyb733 = yyj733 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb733 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb733 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Template = pkg2_api.PodTemplateSpec{} } else { - yyv739 := &x.Template - yyv739.CodecDecodeSelf(d) + yyv22 := &x.Template + yyv22.CodecDecodeSelf(d) } for { - yyj733++ - if yyhl733 { - yyb733 = yyj733 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb733 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb733 { + if yyb13 { break } - z.DecStructFieldNotFound(yyj733-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -8142,40 +10340,43 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym740 := z.EncBinary() - _ = yym740 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep741 := !z.EncBinary() - yy2arr741 := z.EncBasicHandle().StructToArray - var yyq741 [6]bool - _, _, _ = yysep741, yyq741, yy2arr741 - const yyr741 bool = false - yyq741[0] = len(x.Conditions) != 0 - yyq741[1] = x.StartTime != nil - yyq741[2] = x.CompletionTime != nil - yyq741[3] = x.Active != 0 - yyq741[4] = x.Succeeded != 0 - yyq741[5] = x.Failed != 0 - if yyr741 || yy2arr741 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Conditions) != 0 + yyq2[1] = x.StartTime != nil + yyq2[2] = x.CompletionTime != nil + yyq2[3] = x.Active != 0 + yyq2[4] = x.Succeeded != 0 + yyq2[5] = x.Failed != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn741 int = 0 - for _, b := range yyq741 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn741++ + yynn2++ } } - r.EncodeMapStart(yynn741) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr741 || yy2arr741 { - if yyq741[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Conditions == nil { r.EncodeNil() } else { - yym743 := z.EncBinary() - _ = yym743 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceJobCondition(([]JobCondition)(x.Conditions), e) @@ -8185,13 +10386,15 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq741[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("conditions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Conditions == nil { r.EncodeNil() } else { - yym744 := z.EncBinary() - _ = yym744 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceJobCondition(([]JobCondition)(x.Conditions), e) @@ -8199,18 +10402,19 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr741 || yy2arr741 { - if yyq741[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.StartTime == nil { r.EncodeNil() } else { - yym746 := z.EncBinary() - _ = yym746 + yym7 := z.EncBinary() + _ = yym7 if false { } else if z.HasExtensions() && z.EncExt(x.StartTime) { - } else if yym746 { + } else if yym7 { z.EncBinaryMarshal(x.StartTime) - } else if !yym746 && z.IsJSONHandle() { + } else if !yym7 && z.IsJSONHandle() { z.EncJSONMarshal(x.StartTime) } else { z.EncFallback(x.StartTime) @@ -8220,18 +10424,20 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq741[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("startTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.StartTime == nil { r.EncodeNil() } else { - yym747 := z.EncBinary() - _ = yym747 + yym8 := z.EncBinary() + _ = yym8 if false { } else if z.HasExtensions() && z.EncExt(x.StartTime) { - } else if yym747 { + } else if yym8 { z.EncBinaryMarshal(x.StartTime) - } else if !yym747 && z.IsJSONHandle() { + } else if !yym8 && z.IsJSONHandle() { z.EncJSONMarshal(x.StartTime) } else { z.EncFallback(x.StartTime) @@ -8239,18 +10445,19 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr741 || yy2arr741 { - if yyq741[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.CompletionTime == nil { r.EncodeNil() } else { - yym749 := z.EncBinary() - _ = yym749 + yym10 := z.EncBinary() + _ = yym10 if false { } else if z.HasExtensions() && z.EncExt(x.CompletionTime) { - } else if yym749 { + } else if yym10 { z.EncBinaryMarshal(x.CompletionTime) - } else if !yym749 && z.IsJSONHandle() { + } else if !yym10 && z.IsJSONHandle() { z.EncJSONMarshal(x.CompletionTime) } else { z.EncFallback(x.CompletionTime) @@ -8260,18 +10467,20 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq741[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("completionTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CompletionTime == nil { r.EncodeNil() } else { - yym750 := z.EncBinary() - _ = yym750 + yym11 := z.EncBinary() + _ = yym11 if false { } else if z.HasExtensions() && z.EncExt(x.CompletionTime) { - } else if yym750 { + } else if yym11 { z.EncBinaryMarshal(x.CompletionTime) - } else if !yym750 && z.IsJSONHandle() { + } else if !yym11 && z.IsJSONHandle() { z.EncJSONMarshal(x.CompletionTime) } else { z.EncFallback(x.CompletionTime) @@ -8279,10 +10488,11 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr741 || yy2arr741 { - if yyq741[3] { - yym752 := z.EncBinary() - _ = yym752 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeInt(int64(x.Active)) @@ -8291,20 +10501,23 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq741[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("active")) - yym753 := z.EncBinary() - _ = yym753 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeInt(int64(x.Active)) } } } - if yyr741 || yy2arr741 { - if yyq741[4] { - yym755 := z.EncBinary() - _ = yym755 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeInt(int64(x.Succeeded)) @@ -8313,20 +10526,23 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq741[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("succeeded")) - yym756 := z.EncBinary() - _ = yym756 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeInt(int64(x.Succeeded)) } } } - if yyr741 || yy2arr741 { - if yyq741[5] { - yym758 := z.EncBinary() - _ = yym758 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeInt(int64(x.Failed)) @@ -8335,18 +10551,22 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq741[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("failed")) - yym759 := z.EncBinary() - _ = yym759 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeInt(int64(x.Failed)) } } } - if yysep741 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8356,24 +10576,25 @@ func (x *JobStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym760 := z.DecBinary() - _ = yym760 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl761 := r.ReadMapStart() - if yyl761 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl761, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl761 := r.ReadArrayStart() - if yyl761 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl761, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8385,12 +10606,12 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys762Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys762Slc - var yyhl762 bool = l >= 0 - for yyj762 := 0; ; yyj762++ { - if yyhl762 { - if yyj762 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8398,19 +10619,21 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys762Slc = r.DecodeBytes(yys762Slc, true, true) - yys762 := string(yys762Slc) - switch yys762 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "conditions": if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv763 := &x.Conditions - yym764 := z.DecBinary() - _ = yym764 + yyv4 := &x.Conditions + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceJobCondition((*[]JobCondition)(yyv763), d) + h.decSliceJobCondition((*[]JobCondition)(yyv4), d) } } case "startTime": @@ -8422,13 +10645,13 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.StartTime == nil { x.StartTime = new(pkg1_unversioned.Time) } - yym766 := z.DecBinary() - _ = yym766 + yym7 := z.DecBinary() + _ = yym7 if false { } else if z.HasExtensions() && z.DecExt(x.StartTime) { - } else if yym766 { + } else if yym7 { z.DecBinaryUnmarshal(x.StartTime) - } else if !yym766 && z.IsJSONHandle() { + } else if !yym7 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.StartTime) } else { z.DecFallback(x.StartTime, false) @@ -8443,13 +10666,13 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.CompletionTime == nil { x.CompletionTime = new(pkg1_unversioned.Time) } - yym768 := z.DecBinary() - _ = yym768 + yym9 := z.DecBinary() + _ = yym9 if false { } else if z.HasExtensions() && z.DecExt(x.CompletionTime) { - } else if yym768 { + } else if yym9 { z.DecBinaryUnmarshal(x.CompletionTime) - } else if !yym768 && z.IsJSONHandle() { + } else if !yym9 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.CompletionTime) } else { z.DecFallback(x.CompletionTime, false) @@ -8474,52 +10697,52 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Failed = int(r.DecodeInt(codecSelferBitsize1234)) } default: - z.DecStructFieldNotFound(-1, yys762) - } // end switch yys762 - } // end for yyj762 - if !yyhl762 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj772 int - var yyb772 bool - var yyhl772 bool = l >= 0 - yyj772++ - if yyhl772 { - yyb772 = yyj772 > l + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb772 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb772 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv773 := &x.Conditions - yym774 := z.DecBinary() - _ = yym774 + yyv14 := &x.Conditions + yym15 := z.DecBinary() + _ = yym15 if false { } else { - h.decSliceJobCondition((*[]JobCondition)(yyv773), d) + h.decSliceJobCondition((*[]JobCondition)(yyv14), d) } } - yyj772++ - if yyhl772 { - yyb772 = yyj772 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb772 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb772 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.StartTime != nil { x.StartTime = nil @@ -8528,28 +10751,29 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.StartTime == nil { x.StartTime = new(pkg1_unversioned.Time) } - yym776 := z.DecBinary() - _ = yym776 + yym17 := z.DecBinary() + _ = yym17 if false { } else if z.HasExtensions() && z.DecExt(x.StartTime) { - } else if yym776 { + } else if yym17 { z.DecBinaryUnmarshal(x.StartTime) - } else if !yym776 && z.IsJSONHandle() { + } else if !yym17 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.StartTime) } else { z.DecFallback(x.StartTime, false) } } - yyj772++ - if yyhl772 { - yyb772 = yyj772 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb772 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb772 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CompletionTime != nil { x.CompletionTime = nil @@ -8558,84 +10782,88 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.CompletionTime == nil { x.CompletionTime = new(pkg1_unversioned.Time) } - yym778 := z.DecBinary() - _ = yym778 + yym19 := z.DecBinary() + _ = yym19 if false { } else if z.HasExtensions() && z.DecExt(x.CompletionTime) { - } else if yym778 { + } else if yym19 { z.DecBinaryUnmarshal(x.CompletionTime) - } else if !yym778 && z.IsJSONHandle() { + } else if !yym19 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.CompletionTime) } else { z.DecFallback(x.CompletionTime, false) } } - yyj772++ - if yyhl772 { - yyb772 = yyj772 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb772 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb772 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Active = 0 } else { x.Active = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj772++ - if yyhl772 { - yyb772 = yyj772 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb772 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb772 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Succeeded = 0 } else { x.Succeeded = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj772++ - if yyhl772 { - yyb772 = yyj772 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb772 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb772 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Failed = 0 } else { x.Failed = int(r.DecodeInt(codecSelferBitsize1234)) } for { - yyj772++ - if yyhl772 { - yyb772 = yyj772 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb772 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb772 { + if yyb13 { break } - z.DecStructFieldNotFound(yyj772-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x JobConditionType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym782 := z.EncBinary() - _ = yym782 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -8647,8 +10875,8 @@ func (x *JobConditionType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym783 := z.DecBinary() - _ = yym783 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -8663,127 +10891,132 @@ func (x *JobCondition) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym784 := z.EncBinary() - _ = yym784 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep785 := !z.EncBinary() - yy2arr785 := z.EncBasicHandle().StructToArray - var yyq785 [6]bool - _, _, _ = yysep785, yyq785, yy2arr785 - const yyr785 bool = false - yyq785[2] = true - yyq785[3] = true - yyq785[4] = x.Reason != "" - yyq785[5] = x.Message != "" - if yyr785 || yy2arr785 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = true + yyq2[3] = true + yyq2[4] = x.Reason != "" + yyq2[5] = x.Message != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn785 int = 2 - for _, b := range yyq785 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn785++ + yynn2++ } } - r.EncodeMapStart(yynn785) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr785 || yy2arr785 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr785 || yy2arr785 { - yym788 := z.EncBinary() - _ = yym788 - if false { - } else if z.HasExtensions() && z.EncExt(x.Status) { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Status)) - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yysf7 := &x.Status + yysf7.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yym789 := z.EncBinary() - _ = yym789 - if false { - } else if z.HasExtensions() && z.EncExt(x.Status) { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Status)) - } + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yysf8 := &x.Status + yysf8.CodecEncodeSelf(e) } - if yyr785 || yy2arr785 { - if yyq785[2] { - yy791 := &x.LastProbeTime - yym792 := z.EncBinary() - _ = yym792 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.LastProbeTime + yym11 := z.EncBinary() + _ = yym11 if false { - } else if z.HasExtensions() && z.EncExt(yy791) { - } else if yym792 { - z.EncBinaryMarshal(yy791) - } else if !yym792 && z.IsJSONHandle() { - z.EncJSONMarshal(yy791) + } else if z.HasExtensions() && z.EncExt(yy10) { + } else if yym11 { + z.EncBinaryMarshal(yy10) + } else if !yym11 && z.IsJSONHandle() { + z.EncJSONMarshal(yy10) } else { - z.EncFallback(yy791) + z.EncFallback(yy10) } } else { r.EncodeNil() } } else { - if yyq785[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastProbeTime")) - yy793 := &x.LastProbeTime - yym794 := z.EncBinary() - _ = yym794 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.LastProbeTime + yym13 := z.EncBinary() + _ = yym13 if false { - } else if z.HasExtensions() && z.EncExt(yy793) { - } else if yym794 { - z.EncBinaryMarshal(yy793) - } else if !yym794 && z.IsJSONHandle() { - z.EncJSONMarshal(yy793) + } else if z.HasExtensions() && z.EncExt(yy12) { + } else if yym13 { + z.EncBinaryMarshal(yy12) + } else if !yym13 && z.IsJSONHandle() { + z.EncJSONMarshal(yy12) } else { - z.EncFallback(yy793) + z.EncFallback(yy12) } } } - if yyr785 || yy2arr785 { - if yyq785[3] { - yy796 := &x.LastTransitionTime - yym797 := z.EncBinary() - _ = yym797 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yy15 := &x.LastTransitionTime + yym16 := z.EncBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.EncExt(yy796) { - } else if yym797 { - z.EncBinaryMarshal(yy796) - } else if !yym797 && z.IsJSONHandle() { - z.EncJSONMarshal(yy796) + } else if z.HasExtensions() && z.EncExt(yy15) { + } else if yym16 { + z.EncBinaryMarshal(yy15) + } else if !yym16 && z.IsJSONHandle() { + z.EncJSONMarshal(yy15) } else { - z.EncFallback(yy796) + z.EncFallback(yy15) } } else { r.EncodeNil() } } else { - if yyq785[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastTransitionTime")) - yy798 := &x.LastTransitionTime - yym799 := z.EncBinary() - _ = yym799 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy17 := &x.LastTransitionTime + yym18 := z.EncBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.EncExt(yy798) { - } else if yym799 { - z.EncBinaryMarshal(yy798) - } else if !yym799 && z.IsJSONHandle() { - z.EncJSONMarshal(yy798) + } else if z.HasExtensions() && z.EncExt(yy17) { + } else if yym18 { + z.EncBinaryMarshal(yy17) + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(yy17) } else { - z.EncFallback(yy798) + z.EncFallback(yy17) } } } - if yyr785 || yy2arr785 { - if yyq785[4] { - yym801 := z.EncBinary() - _ = yym801 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -8792,20 +11025,23 @@ func (x *JobCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq785[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym802 := z.EncBinary() - _ = yym802 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym21 := z.EncBinary() + _ = yym21 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr785 || yy2arr785 { - if yyq785[5] { - yym804 := z.EncBinary() - _ = yym804 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -8814,18 +11050,22 @@ func (x *JobCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq785[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym805 := z.EncBinary() - _ = yym805 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym24 := z.EncBinary() + _ = yym24 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yysep785 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8835,24 +11075,25 @@ func (x *JobCondition) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym806 := z.DecBinary() - _ = yym806 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl807 := r.ReadMapStart() - if yyl807 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl807, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl807 := r.ReadArrayStart() - if yyl807 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl807, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8864,12 +11105,12 @@ func (x *JobCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys808Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys808Slc - var yyhl808 bool = l >= 0 - for yyj808 := 0; ; yyj808++ { - if yyhl808 { - if yyj808 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8877,9 +11118,11 @@ func (x *JobCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys808Slc = r.DecodeBytes(yys808Slc, true, true) - yys808 := string(yys808Slc) - switch yys808 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -8896,34 +11139,34 @@ func (x *JobCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.LastProbeTime = pkg1_unversioned.Time{} } else { - yyv811 := &x.LastProbeTime - yym812 := z.DecBinary() - _ = yym812 + yyv6 := &x.LastProbeTime + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv811) { - } else if yym812 { - z.DecBinaryUnmarshal(yyv811) - } else if !yym812 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv811) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if yym7 { + z.DecBinaryUnmarshal(yyv6) + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv811, false) + z.DecFallback(yyv6, false) } } case "lastTransitionTime": if r.TryDecodeAsNil() { x.LastTransitionTime = pkg1_unversioned.Time{} } else { - yyv813 := &x.LastTransitionTime - yym814 := z.DecBinary() - _ = yym814 + yyv8 := &x.LastTransitionTime + yym9 := z.DecBinary() + _ = yym9 if false { - } else if z.HasExtensions() && z.DecExt(yyv813) { - } else if yym814 { - z.DecBinaryUnmarshal(yyv813) - } else if !yym814 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv813) + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else if yym9 { + z.DecBinaryUnmarshal(yyv8) + } else if !yym9 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv8) } else { - z.DecFallback(yyv813, false) + z.DecFallback(yyv8, false) } } case "reason": @@ -8939,146 +11182,151 @@ func (x *JobCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Message = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys808) - } // end switch yys808 - } // end for yyj808 - if !yyhl808 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *JobCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj817 int - var yyb817 bool - var yyhl817 bool = l >= 0 - yyj817++ - if yyhl817 { - yyb817 = yyj817 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb817 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb817 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = JobConditionType(r.DecodeString()) } - yyj817++ - if yyhl817 { - yyb817 = yyj817 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb817 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb817 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Status = "" } else { x.Status = pkg2_api.ConditionStatus(r.DecodeString()) } - yyj817++ - if yyhl817 { - yyb817 = yyj817 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb817 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb817 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastProbeTime = pkg1_unversioned.Time{} } else { - yyv820 := &x.LastProbeTime - yym821 := z.DecBinary() - _ = yym821 + yyv15 := &x.LastProbeTime + yym16 := z.DecBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.DecExt(yyv820) { - } else if yym821 { - z.DecBinaryUnmarshal(yyv820) - } else if !yym821 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv820) + } else if z.HasExtensions() && z.DecExt(yyv15) { + } else if yym16 { + z.DecBinaryUnmarshal(yyv15) + } else if !yym16 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv15) } else { - z.DecFallback(yyv820, false) + z.DecFallback(yyv15, false) } } - yyj817++ - if yyhl817 { - yyb817 = yyj817 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb817 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb817 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTransitionTime = pkg1_unversioned.Time{} } else { - yyv822 := &x.LastTransitionTime - yym823 := z.DecBinary() - _ = yym823 + yyv17 := &x.LastTransitionTime + yym18 := z.DecBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.DecExt(yyv822) { - } else if yym823 { - z.DecBinaryUnmarshal(yyv822) - } else if !yym823 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv822) + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else if yym18 { + z.DecBinaryUnmarshal(yyv17) + } else if !yym18 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv17) } else { - z.DecFallback(yyv822, false) + z.DecFallback(yyv17, false) } } - yyj817++ - if yyhl817 { - yyb817 = yyj817 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb817 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb817 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj817++ - if yyhl817 { - yyb817 = yyj817 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb817 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb817 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } for { - yyj817++ - if yyhl817 { - yyb817 = yyj817 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb817 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb817 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj817-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Ingress) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9088,120 +11336,139 @@ func (x *Ingress) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym826 := z.EncBinary() - _ = yym826 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep827 := !z.EncBinary() - yy2arr827 := z.EncBasicHandle().StructToArray - var yyq827 [5]bool - _, _, _ = yysep827, yyq827, yy2arr827 - const yyr827 bool = false - yyq827[0] = x.Kind != "" - yyq827[1] = x.APIVersion != "" - yyq827[2] = true - yyq827[3] = true - yyq827[4] = true - if yyr827 || yy2arr827 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn827 int = 0 - for _, b := range yyq827 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn827++ + yynn2++ } } - r.EncodeMapStart(yynn827) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr827 || yy2arr827 { - if yyq827[0] { - yym829 := z.EncBinary() - _ = yym829 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq827[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym830 := z.EncBinary() - _ = yym830 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr827 || yy2arr827 { - if yyq827[1] { - yym832 := z.EncBinary() - _ = yym832 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq827[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym833 := z.EncBinary() - _ = yym833 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr827 || yy2arr827 { - if yyq827[2] { - yy835 := &x.ObjectMeta - yy835.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq827[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy836 := &x.ObjectMeta - yy836.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr827 || yy2arr827 { - if yyq827[3] { - yy838 := &x.Spec - yy838.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq827[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy839 := &x.Spec - yy839.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr827 || yy2arr827 { - if yyq827[4] { - yy841 := &x.Status - yy841.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq827[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy842 := &x.Status - yy842.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep827 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9211,24 +11478,25 @@ func (x *Ingress) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym843 := z.DecBinary() - _ = yym843 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl844 := r.ReadMapStart() - if yyl844 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl844, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl844 := r.ReadArrayStart() - if yyl844 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl844, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9240,12 +11508,12 @@ func (x *Ingress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys845Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys845Slc - var yyhl845 bool = l >= 0 - for yyj845 := 0; ; yyj845++ { - if yyhl845 { - if yyj845 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9253,9 +11521,32 @@ func (x *Ingress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys845Slc = r.DecodeBytes(yys845Slc, true, true) - yys845 := string(yys845Slc) - switch yys845 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = IngressSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = IngressStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -9268,134 +11559,117 @@ func (x *Ingress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv848 := &x.ObjectMeta - yyv848.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = IngressSpec{} - } else { - yyv849 := &x.Spec - yyv849.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = IngressStatus{} - } else { - yyv850 := &x.Status - yyv850.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys845) - } // end switch yys845 - } // end for yyj845 - if !yyhl845 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Ingress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj851 int - var yyb851 bool - var yyhl851 bool = l >= 0 - yyj851++ - if yyhl851 { - yyb851 = yyj851 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb851 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb851 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = IngressSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = IngressStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj851++ - if yyhl851 { - yyb851 = yyj851 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb851 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb851 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj851++ - if yyhl851 { - yyb851 = yyj851 > l - } else { - yyb851 = r.CheckBreak() - } - if yyb851 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv854 := &x.ObjectMeta - yyv854.CodecDecodeSelf(d) - } - yyj851++ - if yyhl851 { - yyb851 = yyj851 > l - } else { - yyb851 = r.CheckBreak() - } - if yyb851 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = IngressSpec{} - } else { - yyv855 := &x.Spec - yyv855.CodecDecodeSelf(d) - } - yyj851++ - if yyhl851 { - yyb851 = yyj851 > l - } else { - yyb851 = r.CheckBreak() - } - if yyb851 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = IngressStatus{} - } else { - yyv856 := &x.Status - yyv856.CodecDecodeSelf(d) - } for { - yyj851++ - if yyhl851 { - yyb851 = yyj851 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb851 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb851 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj851-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9405,126 +11679,142 @@ func (x *IngressList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym857 := z.EncBinary() - _ = yym857 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep858 := !z.EncBinary() - yy2arr858 := z.EncBasicHandle().StructToArray - var yyq858 [4]bool - _, _, _ = yysep858, yyq858, yy2arr858 - const yyr858 bool = false - yyq858[0] = x.Kind != "" - yyq858[1] = x.APIVersion != "" - yyq858[2] = true - if yyr858 || yy2arr858 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn858 int = 1 - for _, b := range yyq858 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn858++ + yynn2++ } } - r.EncodeMapStart(yynn858) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr858 || yy2arr858 { - if yyq858[0] { - yym860 := z.EncBinary() - _ = yym860 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq858[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym861 := z.EncBinary() - _ = yym861 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr858 || yy2arr858 { - if yyq858[1] { - yym863 := z.EncBinary() - _ = yym863 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq858[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym864 := z.EncBinary() - _ = yym864 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr858 || yy2arr858 { - if yyq858[2] { - yy866 := &x.ListMeta - yym867 := z.EncBinary() - _ = yym867 - if false { - } else if z.HasExtensions() && z.EncExt(yy866) { - } else { - z.EncFallback(yy866) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq858[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy868 := &x.ListMeta - yym869 := z.EncBinary() - _ = yym869 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy868) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy868) + z.EncFallback(yy6) } } } - if yyr858 || yy2arr858 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym871 := z.EncBinary() - _ = yym871 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceIngress(([]Ingress)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym872 := z.EncBinary() - _ = yym872 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceIngress(([]Ingress)(x.Items), e) } } } - if yysep858 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9534,24 +11824,25 @@ func (x *IngressList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym873 := z.DecBinary() - _ = yym873 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl874 := r.ReadMapStart() - if yyl874 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl874, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl874 := r.ReadArrayStart() - if yyl874 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl874, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9563,12 +11854,12 @@ func (x *IngressList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys875Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys875Slc - var yyhl875 bool = l >= 0 - for yyj875 := 0; ; yyj875++ { - if yyhl875 { - if yyj875 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9576,9 +11867,36 @@ func (x *IngressList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys875Slc = r.DecodeBytes(yys875Slc, true, true) - yys875 := string(yys875Slc) - switch yys875 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceIngress((*[]Ingress)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -9591,133 +11909,111 @@ func (x *IngressList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv878 := &x.ListMeta - yym879 := z.DecBinary() - _ = yym879 - if false { - } else if z.HasExtensions() && z.DecExt(yyv878) { - } else { - z.DecFallback(yyv878, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv880 := &x.Items - yym881 := z.DecBinary() - _ = yym881 - if false { - } else { - h.decSliceIngress((*[]Ingress)(yyv880), d) - } - } default: - z.DecStructFieldNotFound(-1, yys875) - } // end switch yys875 - } // end for yyj875 - if !yyhl875 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj882 int - var yyb882 bool - var yyhl882 bool = l >= 0 - yyj882++ - if yyhl882 { - yyb882 = yyj882 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb882 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb882 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceIngress((*[]Ingress)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj882++ - if yyhl882 { - yyb882 = yyj882 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb882 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb882 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj882++ - if yyhl882 { - yyb882 = yyj882 > l - } else { - yyb882 = r.CheckBreak() - } - if yyb882 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv885 := &x.ListMeta - yym886 := z.DecBinary() - _ = yym886 - if false { - } else if z.HasExtensions() && z.DecExt(yyv885) { - } else { - z.DecFallback(yyv885, false) - } - } - yyj882++ - if yyhl882 { - yyb882 = yyj882 > l - } else { - yyb882 = r.CheckBreak() - } - if yyb882 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv887 := &x.Items - yym888 := z.DecBinary() - _ = yym888 - if false { - } else { - h.decSliceIngress((*[]Ingress)(yyv887), d) - } - } for { - yyj882++ - if yyhl882 { - yyb882 = yyj882 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb882 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb882 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj882-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9727,31 +12023,35 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym889 := z.EncBinary() - _ = yym889 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep890 := !z.EncBinary() - yy2arr890 := z.EncBasicHandle().StructToArray - var yyq890 [2]bool - _, _, _ = yysep890, yyq890, yy2arr890 - const yyr890 bool = false - yyq890[0] = x.Backend != nil - yyq890[1] = len(x.Rules) != 0 - if yyr890 || yy2arr890 { - r.EncodeArrayStart(2) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Backend != nil + yyq2[1] = len(x.TLS) != 0 + yyq2[2] = len(x.Rules) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) } else { - var yynn890 int = 0 - for _, b := range yyq890 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn890++ + yynn2++ } } - r.EncodeMapStart(yynn890) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr890 || yy2arr890 { - if yyq890[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Backend == nil { r.EncodeNil() } else { @@ -9761,8 +12061,10 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq890[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("backend")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Backend == nil { r.EncodeNil() } else { @@ -9770,13 +12072,47 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr890 || yy2arr890 { - if yyq890[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.TLS == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + h.encSliceIngressTLS(([]IngressTLS)(x.TLS), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tls")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.TLS == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + h.encSliceIngressTLS(([]IngressTLS)(x.TLS), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Rules == nil { r.EncodeNil() } else { - yym893 := z.EncBinary() - _ = yym893 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceIngressRule(([]IngressRule)(x.Rules), e) @@ -9786,13 +12122,15 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq890[1] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rules")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Rules == nil { r.EncodeNil() } else { - yym894 := z.EncBinary() - _ = yym894 + yym11 := z.EncBinary() + _ = yym11 if false { } else { h.encSliceIngressRule(([]IngressRule)(x.Rules), e) @@ -9800,8 +12138,10 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep890 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9811,24 +12151,25 @@ func (x *IngressSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym895 := z.DecBinary() - _ = yym895 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl896 := r.ReadMapStart() - if yyl896 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl896, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl896 := r.ReadArrayStart() - if yyl896 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl896, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9840,12 +12181,12 @@ func (x *IngressSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys897Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys897Slc - var yyhl897 bool = l >= 0 - for yyj897 := 0; ; yyj897++ { - if yyhl897 { - if yyj897 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9853,9 +12194,11 @@ func (x *IngressSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys897Slc = r.DecodeBytes(yys897Slc, true, true) - yys897 := string(yys897Slc) - switch yys897 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "backend": if r.TryDecodeAsNil() { if x.Backend != nil { @@ -9867,44 +12210,55 @@ func (x *IngressSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.Backend.CodecDecodeSelf(d) } + case "tls": + if r.TryDecodeAsNil() { + x.TLS = nil + } else { + yyv5 := &x.TLS + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceIngressTLS((*[]IngressTLS)(yyv5), d) + } + } case "rules": if r.TryDecodeAsNil() { x.Rules = nil } else { - yyv899 := &x.Rules - yym900 := z.DecBinary() - _ = yym900 + yyv7 := &x.Rules + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceIngressRule((*[]IngressRule)(yyv899), d) + h.decSliceIngressRule((*[]IngressRule)(yyv7), d) } } default: - z.DecStructFieldNotFound(-1, yys897) - } // end switch yys897 - } // end for yyj897 - if !yyhl897 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj901 int - var yyb901 bool - var yyhl901 bool = l >= 0 - yyj901++ - if yyhl901 { - yyb901 = yyj901 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb901 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb901 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Backend != nil { x.Backend = nil @@ -9915,40 +12269,301 @@ func (x *IngressSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Backend.CodecDecodeSelf(d) } - yyj901++ - if yyhl901 { - yyb901 = yyj901 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb901 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb901 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TLS = nil + } else { + yyv11 := &x.TLS + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + h.decSliceIngressTLS((*[]IngressTLS)(yyv11), d) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Rules = nil } else { - yyv903 := &x.Rules - yym904 := z.DecBinary() - _ = yym904 + yyv13 := &x.Rules + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceIngressRule((*[]IngressRule)(yyv903), d) + h.decSliceIngressRule((*[]IngressRule)(yyv13), d) } } for { - yyj901++ - if yyhl901 { - yyb901 = yyj901 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb901 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb901 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj901-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *IngressTLS) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Hosts) != 0 + yyq2[1] = x.SecretName != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.Hosts == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + z.F.EncSliceStringV(x.Hosts, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hosts")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Hosts == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + z.F.EncSliceStringV(x.Hosts, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *IngressTLS) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *IngressTLS) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "hosts": + if r.TryDecodeAsNil() { + x.Hosts = nil + } else { + yyv4 := &x.Hosts + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + z.F.DecSliceStringX(yyv4, false, d) + } + } + case "secretName": + if r.TryDecodeAsNil() { + x.SecretName = "" + } else { + x.SecretName = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *IngressTLS) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Hosts = nil + } else { + yyv8 := &x.Hosts + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + z.F.DecSliceStringX(yyv8, false, d) + } + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SecretName = "" + } else { + x.SecretName = string(r.DecodeString()) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9958,44 +12573,51 @@ func (x *IngressStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym905 := z.EncBinary() - _ = yym905 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep906 := !z.EncBinary() - yy2arr906 := z.EncBasicHandle().StructToArray - var yyq906 [1]bool - _, _, _ = yysep906, yyq906, yy2arr906 - const yyr906 bool = false - yyq906[0] = true - if yyr906 || yy2arr906 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn906 int = 0 - for _, b := range yyq906 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn906++ + yynn2++ } } - r.EncodeMapStart(yynn906) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr906 || yy2arr906 { - if yyq906[0] { - yy908 := &x.LoadBalancer - yy908.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.LoadBalancer + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq906[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("loadBalancer")) - yy909 := &x.LoadBalancer - yy909.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.LoadBalancer + yy6.CodecEncodeSelf(e) } } - if yysep906 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10005,24 +12627,25 @@ func (x *IngressStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym910 := z.DecBinary() - _ = yym910 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl911 := r.ReadMapStart() - if yyl911 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl911, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl911 := r.ReadArrayStart() - if yyl911 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl911, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10034,12 +12657,12 @@ func (x *IngressStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys912Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys912Slc - var yyhl912 bool = l >= 0 - for yyj912 := 0; ; yyj912++ { - if yyhl912 { - if yyj912 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10047,61 +12670,63 @@ func (x *IngressStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys912Slc = r.DecodeBytes(yys912Slc, true, true) - yys912 := string(yys912Slc) - switch yys912 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "loadBalancer": if r.TryDecodeAsNil() { x.LoadBalancer = pkg2_api.LoadBalancerStatus{} } else { - yyv913 := &x.LoadBalancer - yyv913.CodecDecodeSelf(d) + yyv4 := &x.LoadBalancer + yyv4.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys912) - } // end switch yys912 - } // end for yyj912 - if !yyhl912 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj914 int - var yyb914 bool - var yyhl914 bool = l >= 0 - yyj914++ - if yyhl914 { - yyb914 = yyj914 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb914 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb914 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LoadBalancer = pkg2_api.LoadBalancerStatus{} } else { - yyv915 := &x.LoadBalancer - yyv915.CodecDecodeSelf(d) + yyv6 := &x.LoadBalancer + yyv6.CodecDecodeSelf(d) } for { - yyj914++ - if yyhl914 { - yyb914 = yyj914 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb914 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb914 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj914-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10111,33 +12736,36 @@ func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym916 := z.EncBinary() - _ = yym916 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep917 := !z.EncBinary() - yy2arr917 := z.EncBasicHandle().StructToArray - var yyq917 [2]bool - _, _, _ = yysep917, yyq917, yy2arr917 - const yyr917 bool = false - yyq917[0] = x.Host != "" - yyq917[1] = x.IngressRuleValue.HTTP != nil && x.HTTP != nil - if yyr917 || yy2arr917 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Host != "" + yyq2[1] = x.IngressRuleValue.HTTP != nil && x.HTTP != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn917 int = 0 - for _, b := range yyq917 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn917++ + yynn2++ } } - r.EncodeMapStart(yynn917) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr917 || yy2arr917 { - if yyq917[0] { - yym919 := z.EncBinary() - _ = yym919 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) @@ -10146,27 +12774,30 @@ func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq917[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("host")) - yym920 := z.EncBinary() - _ = yym920 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) } } } - var yyn921 bool + var yyn6 bool if x.IngressRuleValue.HTTP == nil { - yyn921 = true - goto LABEL921 + yyn6 = true + goto LABEL6 } - LABEL921: - if yyr917 || yy2arr917 { - if yyn921 { + LABEL6: + if yyr2 || yy2arr2 { + if yyn6 { r.EncodeNil() } else { - if yyq917[1] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.HTTP == nil { r.EncodeNil() } else { @@ -10177,9 +12808,11 @@ func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq917[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("http")) - if yyn921 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn6 { r.EncodeNil() } else { if x.HTTP == nil { @@ -10190,8 +12823,10 @@ func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep917 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10201,24 +12836,25 @@ func (x *IngressRule) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym922 := z.DecBinary() - _ = yym922 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl923 := r.ReadMapStart() - if yyl923 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl923, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl923 := r.ReadArrayStart() - if yyl923 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl923, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10230,12 +12866,12 @@ func (x *IngressRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys924Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys924Slc - var yyhl924 bool = l >= 0 - for yyj924 := 0; ; yyj924++ { - if yyhl924 { - if yyj924 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10243,9 +12879,11 @@ func (x *IngressRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys924Slc = r.DecodeBytes(yys924Slc, true, true) - yys924 := string(yys924Slc) - switch yys924 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "host": if r.TryDecodeAsNil() { x.Host = "" @@ -10267,46 +12905,49 @@ func (x *IngressRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.HTTP.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys924) - } // end switch yys924 - } // end for yyj924 - if !yyhl924 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj927 int - var yyb927 bool - var yyhl927 bool = l >= 0 - yyj927++ - if yyhl927 { - yyb927 = yyj927 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb927 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb927 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Host = "" } else { x.Host = string(r.DecodeString()) } - yyj927++ - if yyhl927 { - yyb927 = yyj927 > l - } else { - yyb927 = r.CheckBreak() + if x.IngressRuleValue.HTTP == nil { + x.IngressRuleValue.HTTP = new(HTTPIngressRuleValue) } - if yyb927 { - r.ReadEnd() + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HTTP != nil { x.HTTP = nil @@ -10318,18 +12959,19 @@ func (x *IngressRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.HTTP.CodecDecodeSelf(d) } for { - yyj927++ - if yyhl927 { - yyb927 = yyj927 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb927 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb927 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj927-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10339,30 +12981,33 @@ func (x *IngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym930 := z.EncBinary() - _ = yym930 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep931 := !z.EncBinary() - yy2arr931 := z.EncBasicHandle().StructToArray - var yyq931 [1]bool - _, _, _ = yysep931, yyq931, yy2arr931 - const yyr931 bool = false - yyq931[0] = x.HTTP != nil - if yyr931 || yy2arr931 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.HTTP != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn931 int = 0 - for _, b := range yyq931 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn931++ + yynn2++ } } - r.EncodeMapStart(yynn931) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr931 || yy2arr931 { - if yyq931[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.HTTP == nil { r.EncodeNil() } else { @@ -10372,8 +13017,10 @@ func (x *IngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq931[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("http")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.HTTP == nil { r.EncodeNil() } else { @@ -10381,8 +13028,10 @@ func (x *IngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep931 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10392,24 +13041,25 @@ func (x *IngressRuleValue) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym933 := z.DecBinary() - _ = yym933 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl934 := r.ReadMapStart() - if yyl934 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl934, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl934 := r.ReadArrayStart() - if yyl934 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl934, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10421,12 +13071,12 @@ func (x *IngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys935Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys935Slc - var yyhl935 bool = l >= 0 - for yyj935 := 0; ; yyj935++ { - if yyhl935 { - if yyj935 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10434,9 +13084,11 @@ func (x *IngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys935Slc = r.DecodeBytes(yys935Slc, true, true) - yys935 := string(yys935Slc) - switch yys935 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "http": if r.TryDecodeAsNil() { if x.HTTP != nil { @@ -10449,31 +13101,30 @@ func (x *IngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.HTTP.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys935) - } // end switch yys935 - } // end for yyj935 - if !yyhl935 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressRuleValue) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj937 int - var yyb937 bool - var yyhl937 bool = l >= 0 - yyj937++ - if yyhl937 { - yyb937 = yyj937 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb937 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb937 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HTTP != nil { x.HTTP = nil @@ -10485,18 +13136,19 @@ func (x *IngressRuleValue) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) x.HTTP.CodecDecodeSelf(d) } for { - yyj937++ - if yyhl937 { - yyb937 = yyj937 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb937 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb937 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj937-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HTTPIngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10506,53 +13158,60 @@ func (x *HTTPIngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym939 := z.EncBinary() - _ = yym939 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep940 := !z.EncBinary() - yy2arr940 := z.EncBasicHandle().StructToArray - var yyq940 [1]bool - _, _, _ = yysep940, yyq940, yy2arr940 - const yyr940 bool = false - if yyr940 || yy2arr940 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn940 int = 1 - for _, b := range yyq940 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn940++ + yynn2++ } } - r.EncodeMapStart(yynn940) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr940 || yy2arr940 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Paths == nil { r.EncodeNil() } else { - yym942 := z.EncBinary() - _ = yym942 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceHTTPIngressPath(([]HTTPIngressPath)(x.Paths), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("paths")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Paths == nil { r.EncodeNil() } else { - yym943 := z.EncBinary() - _ = yym943 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceHTTPIngressPath(([]HTTPIngressPath)(x.Paths), e) } } } - if yysep940 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10562,24 +13221,25 @@ func (x *HTTPIngressRuleValue) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym944 := z.DecBinary() - _ = yym944 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl945 := r.ReadMapStart() - if yyl945 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl945, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl945 := r.ReadArrayStart() - if yyl945 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl945, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10591,12 +13251,12 @@ func (x *HTTPIngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys946Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys946Slc - var yyhl946 bool = l >= 0 - for yyj946 := 0; ; yyj946++ { - if yyhl946 { - if yyj946 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10604,71 +13264,73 @@ func (x *HTTPIngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys946Slc = r.DecodeBytes(yys946Slc, true, true) - yys946 := string(yys946Slc) - switch yys946 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "paths": if r.TryDecodeAsNil() { x.Paths = nil } else { - yyv947 := &x.Paths - yym948 := z.DecBinary() - _ = yym948 + yyv4 := &x.Paths + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceHTTPIngressPath((*[]HTTPIngressPath)(yyv947), d) + h.decSliceHTTPIngressPath((*[]HTTPIngressPath)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys946) - } // end switch yys946 - } // end for yyj946 - if !yyhl946 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HTTPIngressRuleValue) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj949 int - var yyb949 bool - var yyhl949 bool = l >= 0 - yyj949++ - if yyhl949 { - yyb949 = yyj949 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb949 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb949 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Paths = nil } else { - yyv950 := &x.Paths - yym951 := z.DecBinary() - _ = yym951 + yyv7 := &x.Paths + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceHTTPIngressPath((*[]HTTPIngressPath)(yyv950), d) + h.decSliceHTTPIngressPath((*[]HTTPIngressPath)(yyv7), d) } } for { - yyj949++ - if yyhl949 { - yyb949 = yyj949 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb949 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb949 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj949-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HTTPIngressPath) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10678,32 +13340,35 @@ func (x *HTTPIngressPath) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym952 := z.EncBinary() - _ = yym952 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep953 := !z.EncBinary() - yy2arr953 := z.EncBasicHandle().StructToArray - var yyq953 [2]bool - _, _, _ = yysep953, yyq953, yy2arr953 - const yyr953 bool = false - yyq953[0] = x.Path != "" - if yyr953 || yy2arr953 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Path != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn953 int = 1 - for _, b := range yyq953 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn953++ + yynn2++ } } - r.EncodeMapStart(yynn953) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr953 || yy2arr953 { - if yyq953[0] { - yym955 := z.EncBinary() - _ = yym955 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) @@ -10712,26 +13377,33 @@ func (x *HTTPIngressPath) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq953[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym956 := z.EncBinary() - _ = yym956 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } } - if yyr953 || yy2arr953 { - yy958 := &x.Backend - yy958.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.Backend + yy7.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("backend")) - yy959 := &x.Backend - yy959.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Backend + yy9.CodecEncodeSelf(e) } - if yysep953 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10741,24 +13413,25 @@ func (x *HTTPIngressPath) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym960 := z.DecBinary() - _ = yym960 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl961 := r.ReadMapStart() - if yyl961 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl961, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl961 := r.ReadArrayStart() - if yyl961 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl961, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10770,12 +13443,12 @@ func (x *HTTPIngressPath) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys962Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys962Slc - var yyhl962 bool = l >= 0 - for yyj962 := 0; ; yyj962++ { - if yyhl962 { - if yyj962 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10783,9 +13456,11 @@ func (x *HTTPIngressPath) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys962Slc = r.DecodeBytes(yys962Slc, true, true) - yys962 := string(yys962Slc) - switch yys962 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "path": if r.TryDecodeAsNil() { x.Path = "" @@ -10796,69 +13471,70 @@ func (x *HTTPIngressPath) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Backend = IngressBackend{} } else { - yyv964 := &x.Backend - yyv964.CodecDecodeSelf(d) + yyv5 := &x.Backend + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys962) - } // end switch yys962 - } // end for yyj962 - if !yyhl962 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HTTPIngressPath) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj965 int - var yyb965 bool - var yyhl965 bool = l >= 0 - yyj965++ - if yyhl965 { - yyb965 = yyj965 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb965 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb965 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj965++ - if yyhl965 { - yyb965 = yyj965 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb965 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb965 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Backend = IngressBackend{} } else { - yyv967 := &x.Backend - yyv967.CodecDecodeSelf(d) + yyv8 := &x.Backend + yyv8.CodecDecodeSelf(d) } for { - yyj965++ - if yyhl965 { - yyb965 = yyj965 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb965 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb965 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj965-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressBackend) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10868,69 +13544,79 @@ func (x *IngressBackend) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym968 := z.EncBinary() - _ = yym968 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep969 := !z.EncBinary() - yy2arr969 := z.EncBasicHandle().StructToArray - var yyq969 [2]bool - _, _, _ = yysep969, yyq969, yy2arr969 - const yyr969 bool = false - if yyr969 || yy2arr969 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn969 int = 2 - for _, b := range yyq969 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn969++ + yynn2++ } } - r.EncodeMapStart(yynn969) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr969 || yy2arr969 { - yym971 := z.EncBinary() - _ = yym971 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ServiceName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("serviceName")) - yym972 := z.EncBinary() - _ = yym972 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ServiceName)) } } - if yyr969 || yy2arr969 { - yy974 := &x.ServicePort - yym975 := z.EncBinary() - _ = yym975 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.ServicePort + yym8 := z.EncBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.EncExt(yy974) { - } else if !yym975 && z.IsJSONHandle() { - z.EncJSONMarshal(yy974) + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) } else { - z.EncFallback(yy974) + z.EncFallback(yy7) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("servicePort")) - yy976 := &x.ServicePort - yym977 := z.EncBinary() - _ = yym977 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.ServicePort + yym10 := z.EncBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.EncExt(yy976) { - } else if !yym977 && z.IsJSONHandle() { - z.EncJSONMarshal(yy976) + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) } else { - z.EncFallback(yy976) + z.EncFallback(yy9) } } - if yysep969 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10940,24 +13626,25 @@ func (x *IngressBackend) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym978 := z.DecBinary() - _ = yym978 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl979 := r.ReadMapStart() - if yyl979 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl979, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl979 := r.ReadArrayStart() - if yyl979 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl979, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10969,12 +13656,12 @@ func (x *IngressBackend) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys980Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys980Slc - var yyhl980 bool = l >= 0 - for yyj980 := 0; ; yyj980++ { - if yyhl980 { - if yyj980 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10982,9 +13669,11 @@ func (x *IngressBackend) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys980Slc = r.DecodeBytes(yys980Slc, true, true) - yys980 := string(yys980Slc) - switch yys980 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "serviceName": if r.TryDecodeAsNil() { x.ServiceName = "" @@ -10993,95 +13682,96 @@ func (x *IngressBackend) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "servicePort": if r.TryDecodeAsNil() { - x.ServicePort = pkg6_util.IntOrString{} + x.ServicePort = pkg6_intstr.IntOrString{} } else { - yyv982 := &x.ServicePort - yym983 := z.DecBinary() - _ = yym983 + yyv5 := &x.ServicePort + yym6 := z.DecBinary() + _ = yym6 if false { - } else if z.HasExtensions() && z.DecExt(yyv982) { - } else if !yym983 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv982) + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) } else { - z.DecFallback(yyv982, false) + z.DecFallback(yyv5, false) } } default: - z.DecStructFieldNotFound(-1, yys980) - } // end switch yys980 - } // end for yyj980 - if !yyhl980 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressBackend) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj984 int - var yyb984 bool - var yyhl984 bool = l >= 0 - yyj984++ - if yyhl984 { - yyb984 = yyj984 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb984 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb984 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ServiceName = "" } else { x.ServiceName = string(r.DecodeString()) } - yyj984++ - if yyhl984 { - yyb984 = yyj984 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb984 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb984 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ServicePort = pkg6_util.IntOrString{} + x.ServicePort = pkg6_intstr.IntOrString{} } else { - yyv986 := &x.ServicePort - yym987 := z.DecBinary() - _ = yym987 + yyv9 := &x.ServicePort + yym10 := z.DecBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.DecExt(yyv986) { - } else if !yym987 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv986) + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) } else { - z.DecFallback(yyv986, false) + z.DecFallback(yyv9, false) } } for { - yyj984++ - if yyhl984 { - yyb984 = yyj984 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb984 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb984 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj984-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x NodeResource) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym988 := z.EncBinary() - _ = yym988 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -11093,8 +13783,8 @@ func (x *NodeResource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym989 := z.DecBinary() - _ = yym989 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -11109,51 +13799,61 @@ func (x *NodeUtilization) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym990 := z.EncBinary() - _ = yym990 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep991 := !z.EncBinary() - yy2arr991 := z.EncBasicHandle().StructToArray - var yyq991 [2]bool - _, _, _ = yysep991, yyq991, yy2arr991 - const yyr991 bool = false - if yyr991 || yy2arr991 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn991 int = 2 - for _, b := range yyq991 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn991++ + yynn2++ } } - r.EncodeMapStart(yynn991) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr991 || yy2arr991 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Resource.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resource")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Resource.CodecEncodeSelf(e) } - if yyr991 || yy2arr991 { - yym994 := z.EncBinary() - _ = yym994 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeFloat64(float64(x.Value)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("value")) - yym995 := z.EncBinary() - _ = yym995 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeFloat64(float64(x.Value)) } } - if yysep991 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11163,24 +13863,25 @@ func (x *NodeUtilization) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym996 := z.DecBinary() - _ = yym996 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl997 := r.ReadMapStart() - if yyl997 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl997, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl997 := r.ReadArrayStart() - if yyl997 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl997, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11192,12 +13893,12 @@ func (x *NodeUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys998Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys998Slc - var yyhl998 bool = l >= 0 - for yyj998 := 0; ; yyj998++ { - if yyhl998 { - if yyj998 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11205,9 +13906,11 @@ func (x *NodeUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys998Slc = r.DecodeBytes(yys998Slc, true, true) - yys998 := string(yys998Slc) - switch yys998 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "resource": if r.TryDecodeAsNil() { x.Resource = "" @@ -11221,64 +13924,65 @@ func (x *NodeUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Value = float64(r.DecodeFloat(false)) } default: - z.DecStructFieldNotFound(-1, yys998) - } // end switch yys998 - } // end for yyj998 - if !yyhl998 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeUtilization) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1001 int - var yyb1001 bool - var yyhl1001 bool = l >= 0 - yyj1001++ - if yyhl1001 { - yyb1001 = yyj1001 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1001 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1001 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Resource = "" } else { x.Resource = NodeResource(r.DecodeString()) } - yyj1001++ - if yyhl1001 { - yyb1001 = yyj1001 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1001 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1001 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Value = 0 } else { x.Value = float64(r.DecodeFloat(false)) } for { - yyj1001++ - if yyhl1001 { - yyb1001 = yyj1001 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1001 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1001 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1001-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ClusterAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11288,85 +13992,98 @@ func (x *ClusterAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1004 := z.EncBinary() - _ = yym1004 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1005 := !z.EncBinary() - yy2arr1005 := z.EncBasicHandle().StructToArray - var yyq1005 [3]bool - _, _, _ = yysep1005, yyq1005, yy2arr1005 - const yyr1005 bool = false - if yyr1005 || yy2arr1005 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1005 int = 3 - for _, b := range yyq1005 { + yynn2 = 3 + for _, b := range yyq2 { if b { - yynn1005++ + yynn2++ } } - r.EncodeMapStart(yynn1005) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1005 || yy2arr1005 { - yym1007 := z.EncBinary() - _ = yym1007 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.MinNodes)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("minNodes")) - yym1008 := z.EncBinary() - _ = yym1008 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.MinNodes)) } } - if yyr1005 || yy2arr1005 { - yym1010 := z.EncBinary() - _ = yym1010 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.MaxNodes)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxNodes")) - yym1011 := z.EncBinary() - _ = yym1011 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.MaxNodes)) } } - if yyr1005 || yy2arr1005 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.TargetUtilization == nil { r.EncodeNil() } else { - yym1013 := z.EncBinary() - _ = yym1013 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceNodeUtilization(([]NodeUtilization)(x.TargetUtilization), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("target")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TargetUtilization == nil { r.EncodeNil() } else { - yym1014 := z.EncBinary() - _ = yym1014 + yym11 := z.EncBinary() + _ = yym11 if false { } else { h.encSliceNodeUtilization(([]NodeUtilization)(x.TargetUtilization), e) } } } - if yysep1005 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11376,24 +14093,25 @@ func (x *ClusterAutoscalerSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1015 := z.DecBinary() - _ = yym1015 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1016 := r.ReadMapStart() - if yyl1016 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1016, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1016 := r.ReadArrayStart() - if yyl1016 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1016, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11405,12 +14123,12 @@ func (x *ClusterAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1017Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1017Slc - var yyhl1017 bool = l >= 0 - for yyj1017 := 0; ; yyj1017++ { - if yyhl1017 { - if yyj1017 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11418,9 +14136,11 @@ func (x *ClusterAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1017Slc = r.DecodeBytes(yys1017Slc, true, true) - yys1017 := string(yys1017Slc) - switch yys1017 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "minNodes": if r.TryDecodeAsNil() { x.MinNodes = 0 @@ -11437,94 +14157,96 @@ func (x *ClusterAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decod if r.TryDecodeAsNil() { x.TargetUtilization = nil } else { - yyv1020 := &x.TargetUtilization - yym1021 := z.DecBinary() - _ = yym1021 + yyv6 := &x.TargetUtilization + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceNodeUtilization((*[]NodeUtilization)(yyv1020), d) + h.decSliceNodeUtilization((*[]NodeUtilization)(yyv6), d) } } default: - z.DecStructFieldNotFound(-1, yys1017) - } // end switch yys1017 - } // end for yyj1017 - if !yyhl1017 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ClusterAutoscalerSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1022 int - var yyb1022 bool - var yyhl1022 bool = l >= 0 - yyj1022++ - if yyhl1022 { - yyb1022 = yyj1022 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1022 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1022 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MinNodes = 0 } else { x.MinNodes = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj1022++ - if yyhl1022 { - yyb1022 = yyj1022 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1022 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1022 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MaxNodes = 0 } else { x.MaxNodes = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj1022++ - if yyhl1022 { - yyb1022 = yyj1022 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1022 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1022 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TargetUtilization = nil } else { - yyv1025 := &x.TargetUtilization - yym1026 := z.DecBinary() - _ = yym1026 + yyv11 := &x.TargetUtilization + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSliceNodeUtilization((*[]NodeUtilization)(yyv1025), d) + h.decSliceNodeUtilization((*[]NodeUtilization)(yyv11), d) } } for { - yyj1022++ - if yyhl1022 { - yyb1022 = yyj1022 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1022 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1022 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1022-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ClusterAutoscaler) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11534,105 +14256,121 @@ func (x *ClusterAutoscaler) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1027 := z.EncBinary() - _ = yym1027 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1028 := !z.EncBinary() - yy2arr1028 := z.EncBasicHandle().StructToArray - var yyq1028 [4]bool - _, _, _ = yysep1028, yyq1028, yy2arr1028 - const yyr1028 bool = false - yyq1028[0] = x.Kind != "" - yyq1028[1] = x.APIVersion != "" - yyq1028[2] = true - yyq1028[3] = true - if yyr1028 || yy2arr1028 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1028 int = 0 - for _, b := range yyq1028 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1028++ + yynn2++ } } - r.EncodeMapStart(yynn1028) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1028 || yy2arr1028 { - if yyq1028[0] { - yym1030 := z.EncBinary() - _ = yym1030 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1028[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1031 := z.EncBinary() - _ = yym1031 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1028 || yy2arr1028 { - if yyq1028[1] { - yym1033 := z.EncBinary() - _ = yym1033 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1028[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1034 := z.EncBinary() - _ = yym1034 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1028 || yy2arr1028 { - if yyq1028[2] { - yy1036 := &x.ObjectMeta - yy1036.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1028[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1037 := &x.ObjectMeta - yy1037.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1028 || yy2arr1028 { - if yyq1028[3] { - yy1039 := &x.Spec - yy1039.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1028[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1040 := &x.Spec - yy1040.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yysep1028 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11642,24 +14380,25 @@ func (x *ClusterAutoscaler) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1041 := z.DecBinary() - _ = yym1041 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1042 := r.ReadMapStart() - if yyl1042 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1042, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1042 := r.ReadArrayStart() - if yyl1042 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1042, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11671,12 +14410,12 @@ func (x *ClusterAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1043Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1043Slc - var yyhl1043 bool = l >= 0 - for yyj1043 := 0; ; yyj1043++ { - if yyhl1043 { - if yyj1043 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11684,9 +14423,25 @@ func (x *ClusterAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys1043Slc = r.DecodeBytes(yys1043Slc, true, true) - yys1043 := string(yys1043Slc) - switch yys1043 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ClusterAutoscalerSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -11699,111 +14454,100 @@ func (x *ClusterAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv1046 := &x.ObjectMeta - yyv1046.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ClusterAutoscalerSpec{} - } else { - yyv1047 := &x.Spec - yyv1047.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1043) - } // end switch yys1043 - } // end for yyj1043 - if !yyhl1043 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ClusterAutoscaler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1048 int - var yyb1048 bool - var yyhl1048 bool = l >= 0 - yyj1048++ - if yyhl1048 { - yyb1048 = yyj1048 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1048 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1048 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ClusterAutoscalerSpec{} + } else { + yyv10 := &x.Spec + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1048++ - if yyhl1048 { - yyb1048 = yyj1048 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1048 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1048 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1048++ - if yyhl1048 { - yyb1048 = yyj1048 > l - } else { - yyb1048 = r.CheckBreak() - } - if yyb1048 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv1051 := &x.ObjectMeta - yyv1051.CodecDecodeSelf(d) - } - yyj1048++ - if yyhl1048 { - yyb1048 = yyj1048 > l - } else { - yyb1048 = r.CheckBreak() - } - if yyb1048 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ClusterAutoscalerSpec{} - } else { - yyv1052 := &x.Spec - yyv1052.CodecDecodeSelf(d) - } for { - yyj1048++ - if yyhl1048 { - yyb1048 = yyj1048 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1048 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1048 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1048-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ClusterAutoscalerList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11813,126 +14557,142 @@ func (x *ClusterAutoscalerList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1053 := z.EncBinary() - _ = yym1053 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1054 := !z.EncBinary() - yy2arr1054 := z.EncBasicHandle().StructToArray - var yyq1054 [4]bool - _, _, _ = yysep1054, yyq1054, yy2arr1054 - const yyr1054 bool = false - yyq1054[0] = x.Kind != "" - yyq1054[1] = x.APIVersion != "" - yyq1054[2] = true - if yyr1054 || yy2arr1054 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1054 int = 1 - for _, b := range yyq1054 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1054++ + yynn2++ } } - r.EncodeMapStart(yynn1054) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1054 || yy2arr1054 { - if yyq1054[0] { - yym1056 := z.EncBinary() - _ = yym1056 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1054[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1057 := z.EncBinary() - _ = yym1057 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1054 || yy2arr1054 { - if yyq1054[1] { - yym1059 := z.EncBinary() - _ = yym1059 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1054[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1060 := z.EncBinary() - _ = yym1060 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1054 || yy2arr1054 { - if yyq1054[2] { - yy1062 := &x.ListMeta - yym1063 := z.EncBinary() - _ = yym1063 - if false { - } else if z.HasExtensions() && z.EncExt(yy1062) { - } else { - z.EncFallback(yy1062) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1054[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1064 := &x.ListMeta - yym1065 := z.EncBinary() - _ = yym1065 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1064) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1064) + z.EncFallback(yy6) } } } - if yyr1054 || yy2arr1054 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1067 := z.EncBinary() - _ = yym1067 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceClusterAutoscaler(([]ClusterAutoscaler)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1068 := z.EncBinary() - _ = yym1068 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceClusterAutoscaler(([]ClusterAutoscaler)(x.Items), e) } } } - if yysep1054 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11942,24 +14702,25 @@ func (x *ClusterAutoscalerList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1069 := z.DecBinary() - _ = yym1069 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1070 := r.ReadMapStart() - if yyl1070 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1070, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1070 := r.ReadArrayStart() - if yyl1070 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1070, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11971,12 +14732,12 @@ func (x *ClusterAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1071Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1071Slc - var yyhl1071 bool = l >= 0 - for yyj1071 := 0; ; yyj1071++ { - if yyhl1071 { - if yyj1071 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11984,9 +14745,36 @@ func (x *ClusterAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1071Slc = r.DecodeBytes(yys1071Slc, true, true) - yys1071 := string(yys1071Slc) - switch yys1071 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceClusterAutoscaler((*[]ClusterAutoscaler)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -11999,488 +14787,941 @@ func (x *ClusterAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978.Decod } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv1074 := &x.ListMeta - yym1075 := z.DecBinary() - _ = yym1075 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1074) { - } else { - z.DecFallback(yyv1074, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1076 := &x.Items - yym1077 := z.DecBinary() - _ = yym1077 - if false { - } else { - h.decSliceClusterAutoscaler((*[]ClusterAutoscaler)(yyv1076), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1071) - } // end switch yys1071 - } // end for yyj1071 - if !yyhl1071 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ClusterAutoscalerList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1078 int - var yyb1078 bool - var yyhl1078 bool = l >= 0 - yyj1078++ - if yyhl1078 { - yyb1078 = yyj1078 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1078 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1078 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceClusterAutoscaler((*[]ClusterAutoscaler)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1078++ - if yyhl1078 { - yyb1078 = yyj1078 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1078 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1078 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1078++ - if yyhl1078 { - yyb1078 = yyj1078 > l - } else { - yyb1078 = r.CheckBreak() + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - if yyb1078 { - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ReplicaSet) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ReplicaSet) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ReplicaSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ReplicaSetSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ReplicaSetStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ReplicaSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ReplicaSetSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ReplicaSetStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ReplicaSetList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.EncExt(yy4) { + } else { + z.EncFallback(yy4) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(yy6) { + } else { + z.EncFallback(yy6) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + h.encSliceReplicaSet(([]ReplicaSet)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSliceReplicaSet(([]ReplicaSet)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ReplicaSetList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ReplicaSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceReplicaSet((*[]ReplicaSet)(yyv6), d) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ReplicaSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ListMeta = pkg1_unversioned.ListMeta{} } else { - yyv1081 := &x.ListMeta - yym1082 := z.DecBinary() - _ = yym1082 + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 if false { - } else if z.HasExtensions() && z.DecExt(yyv1081) { + } else if z.HasExtensions() && z.DecExt(yyv11) { } else { - z.DecFallback(yyv1081, false) + z.DecFallback(yyv11, false) } } - yyj1078++ - if yyhl1078 { - yyb1078 = yyj1078 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1078 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1078 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Items = nil } else { - yyv1083 := &x.Items - yym1084 := z.DecBinary() - _ = yym1084 + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceClusterAutoscaler((*[]ClusterAutoscaler)(yyv1083), d) + h.decSliceReplicaSet((*[]ReplicaSet)(yyv13), d) } } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj1078++ - if yyhl1078 { - yyb1078 = yyj1078 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1078 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1078 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1078-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } -func (x *PodSelector) CodecEncodeSelf(e *codec1978.Encoder) { +func (x *ReplicaSetSpec) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { r.EncodeNil() } else { - yym1085 := z.EncBinary() - _ = yym1085 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1086 := !z.EncBinary() - yy2arr1086 := z.EncBasicHandle().StructToArray - var yyq1086 [2]bool - _, _, _ = yysep1086, yyq1086, yy2arr1086 - const yyr1086 bool = false - yyq1086[0] = len(x.MatchLabels) != 0 - yyq1086[1] = len(x.MatchExpressions) != 0 - if yyr1086 || yy2arr1086 { - r.EncodeArrayStart(2) - } else { - var yynn1086 int = 0 - for _, b := range yyq1086 { - if b { - yynn1086++ - } - } - r.EncodeMapStart(yynn1086) - } - if yyr1086 || yy2arr1086 { - if yyq1086[0] { - if x.MatchLabels == nil { - r.EncodeNil() - } else { - yym1088 := z.EncBinary() - _ = yym1088 - if false { - } else { - z.F.EncMapStringStringV(x.MatchLabels, false, e) - } - } - } else { - r.EncodeNil() - } - } else { - if yyq1086[0] { - r.EncodeString(codecSelferC_UTF81234, string("matchLabels")) - if x.MatchLabels == nil { - r.EncodeNil() - } else { - yym1089 := z.EncBinary() - _ = yym1089 - if false { - } else { - z.F.EncMapStringStringV(x.MatchLabels, false, e) - } - } - } - } - if yyr1086 || yy2arr1086 { - if yyq1086[1] { - if x.MatchExpressions == nil { - r.EncodeNil() - } else { - yym1091 := z.EncBinary() - _ = yym1091 - if false { - } else { - h.encSlicePodSelectorRequirement(([]PodSelectorRequirement)(x.MatchExpressions), e) - } - } - } else { - r.EncodeNil() - } - } else { - if yyq1086[1] { - r.EncodeString(codecSelferC_UTF81234, string("matchExpressions")) - if x.MatchExpressions == nil { - r.EncodeNil() - } else { - yym1092 := z.EncBinary() - _ = yym1092 - if false { - } else { - h.encSlicePodSelectorRequirement(([]PodSelectorRequirement)(x.MatchExpressions), e) - } - } - } - } - if yysep1086 { - r.EncodeEnd() - } - } - } -} - -func (x *PodSelector) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1093 := z.DecBinary() - _ = yym1093 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1094 := r.ReadMapStart() - if yyl1094 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl1094, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1094 := r.ReadArrayStart() - if yyl1094 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl1094, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *PodSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys1095Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1095Slc - var yyhl1095 bool = l >= 0 - for yyj1095 := 0; ; yyj1095++ { - if yyhl1095 { - if yyj1095 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys1095Slc = r.DecodeBytes(yys1095Slc, true, true) - yys1095 := string(yys1095Slc) - switch yys1095 { - case "matchLabels": - if r.TryDecodeAsNil() { - x.MatchLabels = nil - } else { - yyv1096 := &x.MatchLabels - yym1097 := z.DecBinary() - _ = yym1097 - if false { - } else { - z.F.DecMapStringStringX(yyv1096, false, d) - } - } - case "matchExpressions": - if r.TryDecodeAsNil() { - x.MatchExpressions = nil - } else { - yyv1098 := &x.MatchExpressions - yym1099 := z.DecBinary() - _ = yym1099 - if false { - } else { - h.decSlicePodSelectorRequirement((*[]PodSelectorRequirement)(yyv1098), d) - } - } - default: - z.DecStructFieldNotFound(-1, yys1095) - } // end switch yys1095 - } // end for yyj1095 - if !yyhl1095 { - r.ReadEnd() - } -} - -func (x *PodSelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj1100 int - var yyb1100 bool - var yyhl1100 bool = l >= 0 - yyj1100++ - if yyhl1100 { - yyb1100 = yyj1100 > l - } else { - yyb1100 = r.CheckBreak() - } - if yyb1100 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.MatchLabels = nil - } else { - yyv1101 := &x.MatchLabels - yym1102 := z.DecBinary() - _ = yym1102 - if false { - } else { - z.F.DecMapStringStringX(yyv1101, false, d) - } - } - yyj1100++ - if yyhl1100 { - yyb1100 = yyj1100 > l - } else { - yyb1100 = r.CheckBreak() - } - if yyb1100 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.MatchExpressions = nil - } else { - yyv1103 := &x.MatchExpressions - yym1104 := z.DecBinary() - _ = yym1104 - if false { - } else { - h.decSlicePodSelectorRequirement((*[]PodSelectorRequirement)(yyv1103), d) - } - } - for { - yyj1100++ - if yyhl1100 { - yyb1100 = yyj1100 > l - } else { - yyb1100 = r.CheckBreak() - } - if yyb1100 { - break - } - z.DecStructFieldNotFound(yyj1100-1, "") - } - r.ReadEnd() -} - -func (x *PodSelectorRequirement) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1105 := z.EncBinary() - _ = yym1105 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep1106 := !z.EncBinary() - yy2arr1106 := z.EncBasicHandle().StructToArray - var yyq1106 [3]bool - _, _, _ = yysep1106, yyq1106, yy2arr1106 - const yyr1106 bool = false - yyq1106[2] = len(x.Values) != 0 - if yyr1106 || yy2arr1106 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.Selector != nil + yyq2[2] = x.Template != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1106 int = 2 - for _, b := range yyq1106 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1106++ + yynn2++ } } - r.EncodeMapStart(yynn1106) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1106 || yy2arr1106 { - yym1108 := z.EncBinary() - _ = yym1108 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + r.EncodeInt(int64(x.Replicas)) } } else { - r.EncodeString(codecSelferC_UTF81234, string("key")) - yym1109 := z.EncBinary() - _ = yym1109 + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("replicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Key)) + r.EncodeInt(int64(x.Replicas)) } } - if yyr1106 || yy2arr1106 { - x.Operator.CodecEncodeSelf(e) - } else { - r.EncodeString(codecSelferC_UTF81234, string("operator")) - x.Operator.CodecEncodeSelf(e) - } - if yyr1106 || yy2arr1106 { - if yyq1106[2] { - if x.Values == nil { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Selector == nil { r.EncodeNil() } else { - yym1112 := z.EncBinary() - _ = yym1112 + yym7 := z.EncBinary() + _ = yym7 if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { } else { - z.F.EncSliceStringV(x.Values, false, e) + z.EncFallback(x.Selector) } } } else { r.EncodeNil() } } else { - if yyq1106[2] { - r.EncodeString(codecSelferC_UTF81234, string("values")) - if x.Values == nil { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Selector == nil { r.EncodeNil() } else { - yym1113 := z.EncBinary() - _ = yym1113 + yym8 := z.EncBinary() + _ = yym8 if false { + } else if z.HasExtensions() && z.EncExt(x.Selector) { } else { - z.F.EncSliceStringV(x.Values, false, e) + z.EncFallback(x.Selector) } } } } - if yysep1106 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.Template == nil { + r.EncodeNil() + } else { + x.Template.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("template")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Template == nil { + r.EncodeNil() + } else { + x.Template.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } } -func (x *PodSelectorRequirement) CodecDecodeSelf(d *codec1978.Decoder) { +func (x *ReplicaSetSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1114 := z.DecBinary() - _ = yym1114 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1115 := r.ReadMapStart() - if yyl1115 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1115, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1115 := r.ReadArrayStart() - if yyl1115 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1115, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12488,16 +15729,16 @@ func (x *PodSelectorRequirement) CodecDecodeSelf(d *codec1978.Decoder) { } } -func (x *PodSelectorRequirement) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { +func (x *ReplicaSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1116Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1116Slc - var yyhl1116 bool = l >= 0 - for yyj1116 := 0; ; yyj1116++ { - if yyhl1116 { - if yyj1116 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12505,121 +15746,1460 @@ func (x *PodSelectorRequirement) codecDecodeSelfFromMap(l int, d *codec1978.Deco break } } - yys1116Slc = r.DecodeBytes(yys1116Slc, true, true) - yys1116 := string(yys1116Slc) - switch yys1116 { - case "key": + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "replicas": if r.TryDecodeAsNil() { - x.Key = "" + x.Replicas = 0 } else { - x.Key = string(r.DecodeString()) + x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) } - case "operator": + case "selector": if r.TryDecodeAsNil() { - x.Operator = "" + if x.Selector != nil { + x.Selector = nil + } } else { - x.Operator = PodSelectorOperator(r.DecodeString()) - } - case "values": - if r.TryDecodeAsNil() { - x.Values = nil - } else { - yyv1119 := &x.Values - yym1120 := z.DecBinary() - _ = yym1120 + if x.Selector == nil { + x.Selector = new(pkg1_unversioned.LabelSelector) + } + yym6 := z.DecBinary() + _ = yym6 if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { } else { - z.F.DecSliceStringX(yyv1119, false, d) + z.DecFallback(x.Selector, false) } } + case "template": + if r.TryDecodeAsNil() { + if x.Template != nil { + x.Template = nil + } + } else { + if x.Template == nil { + x.Template = new(pkg2_api.PodTemplateSpec) + } + x.Template.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys1116) - } // end switch yys1116 - } // end for yyj1116 - if !yyhl1116 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } -func (x *PodSelectorRequirement) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { +func (x *ReplicaSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1121 int - var yyb1121 bool - var yyhl1121 bool = l >= 0 - yyj1121++ - if yyhl1121 { - yyb1121 = yyj1121 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1121 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1121 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Key = "" + x.Replicas = 0 } else { - x.Key = string(r.DecodeString()) + x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) } - yyj1121++ - if yyhl1121 { - yyb1121 = yyj1121 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1121 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1121 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Operator = "" - } else { - x.Operator = PodSelectorOperator(r.DecodeString()) - } - yyj1121++ - if yyhl1121 { - yyb1121 = yyj1121 > l - } else { - yyb1121 = r.CheckBreak() - } - if yyb1121 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Values = nil - } else { - yyv1124 := &x.Values - yym1125 := z.DecBinary() - _ = yym1125 - if false { - } else { - z.F.DecSliceStringX(yyv1124, false, d) + if x.Selector != nil { + x.Selector = nil } + } else { + if x.Selector == nil { + x.Selector = new(pkg1_unversioned.LabelSelector) + } + yym11 := z.DecBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.DecExt(x.Selector) { + } else { + z.DecFallback(x.Selector, false) + } + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Template != nil { + x.Template = nil + } + } else { + if x.Template == nil { + x.Template = new(pkg2_api.PodTemplateSpec) + } + x.Template.CodecDecodeSelf(d) } for { - yyj1121++ - if yyhl1121 { - yyb1121 = yyj1121 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1121 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1121 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1121-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } -func (x PodSelectorOperator) CodecEncodeSelf(e *codec1978.Encoder) { +func (x *ReplicaSetStatus) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1126 := z.EncBinary() - _ = yym1126 + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.ObservedGeneration != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Replicas)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("replicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Replicas)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(x.ObservedGeneration)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("observedGeneration")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeInt(int64(x.ObservedGeneration)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ReplicaSetStatus) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ReplicaSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "replicas": + if r.TryDecodeAsNil() { + x.Replicas = 0 + } else { + x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "observedGeneration": + if r.TryDecodeAsNil() { + x.ObservedGeneration = 0 + } else { + x.ObservedGeneration = int64(r.DecodeInt(64)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ReplicaSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Replicas = 0 + } else { + x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObservedGeneration = 0 + } else { + x.ObservedGeneration = int64(r.DecodeInt(64)) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodSecurityPolicy) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodSecurityPolicy) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodSecurityPolicy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = PodSecurityPolicySpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodSecurityPolicy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = PodSecurityPolicySpec{} + } else { + yyv10 := &x.Spec + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodSecurityPolicySpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [9]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Privileged != false + yyq2[1] = len(x.Capabilities) != 0 + yyq2[2] = len(x.Volumes) != 0 + yyq2[3] = x.HostNetwork != false + yyq2[4] = len(x.HostPorts) != 0 + yyq2[5] = x.HostPID != false + yyq2[6] = x.HostIPC != false + yyq2[7] = true + yyq2[8] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(9) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Privileged)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("privileged")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Privileged)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Capabilities == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + h.encSliceapi_Capability(([]pkg2_api.Capability)(x.Capabilities), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("capabilities")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Capabilities == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + h.encSliceapi_Capability(([]pkg2_api.Capability)(x.Capabilities), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.Volumes == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSliceFSType(([]FSType)(x.Volumes), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("volumes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Volumes == nil { + r.EncodeNil() + } else { + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + h.encSliceFSType(([]FSType)(x.Volumes), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.HostNetwork)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostNetwork")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.HostNetwork)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.HostPorts == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSliceHostPortRange(([]HostPortRange)(x.HostPorts), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostPorts")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.HostPorts == nil { + r.EncodeNil() + } else { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + h.encSliceHostPortRange(([]HostPortRange)(x.HostPorts), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeBool(bool(x.HostPID)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostPID")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeBool(bool(x.HostPID)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeBool(bool(x.HostIPC)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostIPC")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeBool(bool(x.HostIPC)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yy25 := &x.SELinuxContext + yy25.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("seLinuxContext")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy27 := &x.SELinuxContext + yy27.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + yy30 := &x.RunAsUser + yy30.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("runAsUser")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy32 := &x.RunAsUser + yy32.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodSecurityPolicySpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodSecurityPolicySpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "privileged": + if r.TryDecodeAsNil() { + x.Privileged = false + } else { + x.Privileged = bool(r.DecodeBool()) + } + case "capabilities": + if r.TryDecodeAsNil() { + x.Capabilities = nil + } else { + yyv5 := &x.Capabilities + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceapi_Capability((*[]pkg2_api.Capability)(yyv5), d) + } + } + case "volumes": + if r.TryDecodeAsNil() { + x.Volumes = nil + } else { + yyv7 := &x.Volumes + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceFSType((*[]FSType)(yyv7), d) + } + } + case "hostNetwork": + if r.TryDecodeAsNil() { + x.HostNetwork = false + } else { + x.HostNetwork = bool(r.DecodeBool()) + } + case "hostPorts": + if r.TryDecodeAsNil() { + x.HostPorts = nil + } else { + yyv10 := &x.HostPorts + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSliceHostPortRange((*[]HostPortRange)(yyv10), d) + } + } + case "hostPID": + if r.TryDecodeAsNil() { + x.HostPID = false + } else { + x.HostPID = bool(r.DecodeBool()) + } + case "hostIPC": + if r.TryDecodeAsNil() { + x.HostIPC = false + } else { + x.HostIPC = bool(r.DecodeBool()) + } + case "seLinuxContext": + if r.TryDecodeAsNil() { + x.SELinuxContext = SELinuxContextStrategyOptions{} + } else { + yyv14 := &x.SELinuxContext + yyv14.CodecDecodeSelf(d) + } + case "runAsUser": + if r.TryDecodeAsNil() { + x.RunAsUser = RunAsUserStrategyOptions{} + } else { + yyv15 := &x.RunAsUser + yyv15.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodSecurityPolicySpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj16 int + var yyb16 bool + var yyhl16 bool = l >= 0 + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Privileged = false + } else { + x.Privileged = bool(r.DecodeBool()) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Capabilities = nil + } else { + yyv18 := &x.Capabilities + yym19 := z.DecBinary() + _ = yym19 + if false { + } else { + h.decSliceapi_Capability((*[]pkg2_api.Capability)(yyv18), d) + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Volumes = nil + } else { + yyv20 := &x.Volumes + yym21 := z.DecBinary() + _ = yym21 + if false { + } else { + h.decSliceFSType((*[]FSType)(yyv20), d) + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostNetwork = false + } else { + x.HostNetwork = bool(r.DecodeBool()) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostPorts = nil + } else { + yyv23 := &x.HostPorts + yym24 := z.DecBinary() + _ = yym24 + if false { + } else { + h.decSliceHostPortRange((*[]HostPortRange)(yyv23), d) + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostPID = false + } else { + x.HostPID = bool(r.DecodeBool()) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostIPC = false + } else { + x.HostIPC = bool(r.DecodeBool()) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SELinuxContext = SELinuxContextStrategyOptions{} + } else { + yyv27 := &x.SELinuxContext + yyv27.CodecDecodeSelf(d) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RunAsUser = RunAsUserStrategyOptions{} + } else { + yyv28 := &x.RunAsUser + yyv28.CodecDecodeSelf(d) + } + for { + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj16-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *HostPortRange) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Min)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("min")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Min)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(x.Max)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("max")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeInt(int64(x.Max)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *HostPortRange) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *HostPortRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "min": + if r.TryDecodeAsNil() { + x.Min = 0 + } else { + x.Min = int(r.DecodeInt(codecSelferBitsize1234)) + } + case "max": + if r.TryDecodeAsNil() { + x.Max = 0 + } else { + x.Max = int(r.DecodeInt(codecSelferBitsize1234)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *HostPortRange) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Min = 0 + } else { + x.Min = int(r.DecodeInt(codecSelferBitsize1234)) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Max = 0 + } else { + x.Max = int(r.DecodeInt(codecSelferBitsize1234)) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x FSType) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -12627,12 +17207,12 @@ func (x PodSelectorOperator) CodecEncodeSelf(e *codec1978.Encoder) { } } -func (x *PodSelectorOperator) CodecDecodeSelf(d *codec1978.Decoder) { +func (x *FSType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1127 := z.DecBinary() - _ = yym1127 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -12640,16 +17220,1282 @@ func (x *PodSelectorOperator) CodecDecodeSelf(d *codec1978.Decoder) { } } +func (x *SELinuxContextStrategyOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.SELinuxOptions != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + x.Type.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + x.Type.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.SELinuxOptions == nil { + r.EncodeNil() + } else { + x.SELinuxOptions.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("seLinuxOptions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SELinuxOptions == nil { + r.EncodeNil() + } else { + x.SELinuxOptions.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SELinuxContextStrategyOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SELinuxContextStrategyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "type": + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = SELinuxContextStrategy(r.DecodeString()) + } + case "seLinuxOptions": + if r.TryDecodeAsNil() { + if x.SELinuxOptions != nil { + x.SELinuxOptions = nil + } + } else { + if x.SELinuxOptions == nil { + x.SELinuxOptions = new(pkg2_api.SELinuxOptions) + } + x.SELinuxOptions.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SELinuxContextStrategyOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = SELinuxContextStrategy(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SELinuxOptions != nil { + x.SELinuxOptions = nil + } + } else { + if x.SELinuxOptions == nil { + x.SELinuxOptions = new(pkg2_api.SELinuxOptions) + } + x.SELinuxOptions.CodecDecodeSelf(d) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x SELinuxContextStrategy) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x)) + } +} + +func (x *SELinuxContextStrategy) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() + } +} + +func (x *RunAsUserStrategyOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = len(x.Ranges) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + x.Type.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + x.Type.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Ranges == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + h.encSliceIDRange(([]IDRange)(x.Ranges), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("ranges")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Ranges == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + h.encSliceIDRange(([]IDRange)(x.Ranges), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RunAsUserStrategyOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RunAsUserStrategyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "type": + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = RunAsUserStrategy(r.DecodeString()) + } + case "ranges": + if r.TryDecodeAsNil() { + x.Ranges = nil + } else { + yyv5 := &x.Ranges + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceIDRange((*[]IDRange)(yyv5), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RunAsUserStrategyOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = RunAsUserStrategy(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Ranges = nil + } else { + yyv9 := &x.Ranges + yym10 := z.DecBinary() + _ = yym10 + if false { + } else { + h.decSliceIDRange((*[]IDRange)(yyv9), d) + } + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *IDRange) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Min)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("min")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Min)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(x.Max)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("max")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeInt(int64(x.Max)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *IDRange) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *IDRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "min": + if r.TryDecodeAsNil() { + x.Min = 0 + } else { + x.Min = int64(r.DecodeInt(64)) + } + case "max": + if r.TryDecodeAsNil() { + x.Max = 0 + } else { + x.Max = int64(r.DecodeInt(64)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *IDRange) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Min = 0 + } else { + x.Min = int64(r.DecodeInt(64)) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Max = 0 + } else { + x.Max = int64(r.DecodeInt(64)) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x RunAsUserStrategy) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x)) + } +} + +func (x *RunAsUserStrategy) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() + } +} + +func (x *PodSecurityPolicyList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.EncExt(yy4) { + } else { + z.EncFallback(yy4) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(yy6) { + } else { + z.EncFallback(yy6) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + h.encSlicePodSecurityPolicy(([]PodSecurityPolicy)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSlicePodSecurityPolicy(([]PodSecurityPolicy)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodSecurityPolicyList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodSecurityPolicyList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePodSecurityPolicy((*[]PodSecurityPolicy)(yyv6), d) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodSecurityPolicyList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePodSecurityPolicy((*[]PodSecurityPolicy)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) encSliceCustomMetricTarget(v []CustomMetricTarget, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceCustomMetricTarget(v *[]CustomMetricTarget, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []CustomMetricTarget{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]CustomMetricTarget, yyrl1) + } + } else { + yyv1 = make([]CustomMetricTarget, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricTarget{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, CustomMetricTarget{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricTarget{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, CustomMetricTarget{}) // var yyz1 CustomMetricTarget + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricTarget{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []CustomMetricTarget{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceCustomMetricCurrentStatus(v []CustomMetricCurrentStatus, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceCustomMetricCurrentStatus(v *[]CustomMetricCurrentStatus, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []CustomMetricCurrentStatus{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]CustomMetricCurrentStatus, yyrl1) + } + } else { + yyv1 = make([]CustomMetricCurrentStatus, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricCurrentStatus{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, CustomMetricCurrentStatus{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricCurrentStatus{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, CustomMetricCurrentStatus{}) // var yyz1 CustomMetricCurrentStatus + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricCurrentStatus{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []CustomMetricCurrentStatus{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + func (x codecSelfer1234) encSliceHorizontalPodAutoscaler(v []HorizontalPodAutoscaler, e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1128 := range v { - yy1129 := &yyv1128 - yy1129.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceHorizontalPodAutoscaler(v *[]HorizontalPodAutoscaler, d *codec1978.Decoder) { @@ -12657,75 +18503,86 @@ func (x codecSelfer1234) decSliceHorizontalPodAutoscaler(v *[]HorizontalPodAutos z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1130 := *v - yyh1130, yyl1130 := z.DecSliceHelperStart() - - var yyrr1130, yyrl1130 int - var yyc1130, yyrt1130 bool - _, _, _ = yyc1130, yyrt1130, yyrl1130 - yyrr1130 = yyl1130 - - if yyv1130 == nil { - if yyrl1130, yyrt1130 = z.DecInferLen(yyl1130, z.DecBasicHandle().MaxInitLen, 336); yyrt1130 { - yyrr1130 = yyrl1130 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []HorizontalPodAutoscaler{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1130 = make([]HorizontalPodAutoscaler, yyrl1130) - yyc1130 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1130 == 0 { - if len(yyv1130) != 0 { - yyv1130 = yyv1130[:0] - yyc1130 = true - } - } else if yyl1130 > 0 { - - if yyl1130 > cap(yyv1130) { - yyrl1130, yyrt1130 = z.DecInferLen(yyl1130, z.DecBasicHandle().MaxInitLen, 336) - yyv1130 = make([]HorizontalPodAutoscaler, yyrl1130) - yyc1130 = true - - yyrr1130 = len(yyv1130) - } else if yyl1130 != len(yyv1130) { - yyv1130 = yyv1130[:yyl1130] - yyc1130 = true - } - yyj1130 := 0 - for ; yyj1130 < yyrr1130; yyj1130++ { - if r.TryDecodeAsNil() { - yyv1130[yyj1130] = HorizontalPodAutoscaler{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 320) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]HorizontalPodAutoscaler, yyrl1) + } } else { - yyv1131 := &yyv1130[yyj1130] - yyv1131.CodecDecodeSelf(d) + yyv1 = make([]HorizontalPodAutoscaler, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HorizontalPodAutoscaler{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1130 { - for ; yyj1130 < yyl1130; yyj1130++ { - yyv1130 = append(yyv1130, HorizontalPodAutoscaler{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, HorizontalPodAutoscaler{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1130[yyj1130] = HorizontalPodAutoscaler{} + yyv1[yyj1] = HorizontalPodAutoscaler{} } else { - yyv1132 := &yyv1130[yyj1130] - yyv1132.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1130 := 0; !r.CheckBreak(); yyj1130++ { - if yyj1130 >= len(yyv1130) { - yyv1130 = append(yyv1130, HorizontalPodAutoscaler{}) // var yyz1130 HorizontalPodAutoscaler - yyc1130 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1130 < len(yyv1130) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, HorizontalPodAutoscaler{}) // var yyz1 HorizontalPodAutoscaler + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1130[yyj1130] = HorizontalPodAutoscaler{} + yyv1[yyj1] = HorizontalPodAutoscaler{} } else { - yyv1133 := &yyv1130[yyj1130] - yyv1133.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -12733,12 +18590,18 @@ func (x codecSelfer1234) decSliceHorizontalPodAutoscaler(v *[]HorizontalPodAutos } } - yyh1130.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []HorizontalPodAutoscaler{} + yyc1 = true + } } - if yyc1130 { - *v = yyv1130 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceAPIVersion(v []APIVersion, e *codec1978.Encoder) { @@ -12746,11 +18609,12 @@ func (x codecSelfer1234) encSliceAPIVersion(v []APIVersion, e *codec1978.Encoder z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1134 := range v { - yy1135 := &yyv1134 - yy1135.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceAPIVersion(v *[]APIVersion, d *codec1978.Decoder) { @@ -12758,75 +18622,86 @@ func (x codecSelfer1234) decSliceAPIVersion(v *[]APIVersion, d *codec1978.Decode z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1136 := *v - yyh1136, yyl1136 := z.DecSliceHelperStart() - - var yyrr1136, yyrl1136 int - var yyc1136, yyrt1136 bool - _, _, _ = yyc1136, yyrt1136, yyrl1136 - yyrr1136 = yyl1136 - - if yyv1136 == nil { - if yyrl1136, yyrt1136 = z.DecInferLen(yyl1136, z.DecBasicHandle().MaxInitLen, 32); yyrt1136 { - yyrr1136 = yyrl1136 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []APIVersion{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1136 = make([]APIVersion, yyrl1136) - yyc1136 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1136 == 0 { - if len(yyv1136) != 0 { - yyv1136 = yyv1136[:0] - yyc1136 = true - } - } else if yyl1136 > 0 { - - if yyl1136 > cap(yyv1136) { - yyrl1136, yyrt1136 = z.DecInferLen(yyl1136, z.DecBasicHandle().MaxInitLen, 32) - yyv1136 = make([]APIVersion, yyrl1136) - yyc1136 = true - - yyrr1136 = len(yyv1136) - } else if yyl1136 != len(yyv1136) { - yyv1136 = yyv1136[:yyl1136] - yyc1136 = true - } - yyj1136 := 0 - for ; yyj1136 < yyrr1136; yyj1136++ { - if r.TryDecodeAsNil() { - yyv1136[yyj1136] = APIVersion{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]APIVersion, yyrl1) + } } else { - yyv1137 := &yyv1136[yyj1136] - yyv1137.CodecDecodeSelf(d) + yyv1 = make([]APIVersion, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = APIVersion{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1136 { - for ; yyj1136 < yyl1136; yyj1136++ { - yyv1136 = append(yyv1136, APIVersion{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, APIVersion{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1136[yyj1136] = APIVersion{} + yyv1[yyj1] = APIVersion{} } else { - yyv1138 := &yyv1136[yyj1136] - yyv1138.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1136 := 0; !r.CheckBreak(); yyj1136++ { - if yyj1136 >= len(yyv1136) { - yyv1136 = append(yyv1136, APIVersion{}) // var yyz1136 APIVersion - yyc1136 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1136 < len(yyv1136) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, APIVersion{}) // var yyz1 APIVersion + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1136[yyj1136] = APIVersion{} + yyv1[yyj1] = APIVersion{} } else { - yyv1139 := &yyv1136[yyj1136] - yyv1139.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -12834,12 +18709,18 @@ func (x codecSelfer1234) decSliceAPIVersion(v *[]APIVersion, d *codec1978.Decode } } - yyh1136.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []APIVersion{} + yyc1 = true + } } - if yyc1136 { - *v = yyv1136 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceThirdPartyResource(v []ThirdPartyResource, e *codec1978.Encoder) { @@ -12847,11 +18728,12 @@ func (x codecSelfer1234) encSliceThirdPartyResource(v []ThirdPartyResource, e *c z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1140 := range v { - yy1141 := &yyv1140 - yy1141.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceThirdPartyResource(v *[]ThirdPartyResource, d *codec1978.Decoder) { @@ -12859,75 +18741,86 @@ func (x codecSelfer1234) decSliceThirdPartyResource(v *[]ThirdPartyResource, d * z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1142 := *v - yyh1142, yyl1142 := z.DecSliceHelperStart() - - var yyrr1142, yyrl1142 int - var yyc1142, yyrt1142 bool - _, _, _ = yyc1142, yyrt1142, yyrl1142 - yyrr1142 = yyl1142 - - if yyv1142 == nil { - if yyrl1142, yyrt1142 = z.DecInferLen(yyl1142, z.DecBasicHandle().MaxInitLen, 232); yyrt1142 { - yyrr1142 = yyrl1142 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ThirdPartyResource{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1142 = make([]ThirdPartyResource, yyrl1142) - yyc1142 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1142 == 0 { - if len(yyv1142) != 0 { - yyv1142 = yyv1142[:0] - yyc1142 = true - } - } else if yyl1142 > 0 { - - if yyl1142 > cap(yyv1142) { - yyrl1142, yyrt1142 = z.DecInferLen(yyl1142, z.DecBasicHandle().MaxInitLen, 232) - yyv1142 = make([]ThirdPartyResource, yyrl1142) - yyc1142 = true - - yyrr1142 = len(yyv1142) - } else if yyl1142 != len(yyv1142) { - yyv1142 = yyv1142[:yyl1142] - yyc1142 = true - } - yyj1142 := 0 - for ; yyj1142 < yyrr1142; yyj1142++ { - if r.TryDecodeAsNil() { - yyv1142[yyj1142] = ThirdPartyResource{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 232) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ThirdPartyResource, yyrl1) + } } else { - yyv1143 := &yyv1142[yyj1142] - yyv1143.CodecDecodeSelf(d) + yyv1 = make([]ThirdPartyResource, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ThirdPartyResource{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1142 { - for ; yyj1142 < yyl1142; yyj1142++ { - yyv1142 = append(yyv1142, ThirdPartyResource{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ThirdPartyResource{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1142[yyj1142] = ThirdPartyResource{} + yyv1[yyj1] = ThirdPartyResource{} } else { - yyv1144 := &yyv1142[yyj1142] - yyv1144.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1142 := 0; !r.CheckBreak(); yyj1142++ { - if yyj1142 >= len(yyv1142) { - yyv1142 = append(yyv1142, ThirdPartyResource{}) // var yyz1142 ThirdPartyResource - yyc1142 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1142 < len(yyv1142) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ThirdPartyResource{}) // var yyz1 ThirdPartyResource + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1142[yyj1142] = ThirdPartyResource{} + yyv1[yyj1] = ThirdPartyResource{} } else { - yyv1145 := &yyv1142[yyj1142] - yyv1145.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -12935,12 +18828,18 @@ func (x codecSelfer1234) decSliceThirdPartyResource(v *[]ThirdPartyResource, d * } } - yyh1142.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ThirdPartyResource{} + yyc1 = true + } } - if yyc1142 { - *v = yyv1142 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceDeployment(v []Deployment, e *codec1978.Encoder) { @@ -12948,11 +18847,12 @@ func (x codecSelfer1234) encSliceDeployment(v []Deployment, e *codec1978.Encoder z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1146 := range v { - yy1147 := &yyv1146 - yy1147.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decoder) { @@ -12960,75 +18860,86 @@ func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decode z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1148 := *v - yyh1148, yyl1148 := z.DecSliceHelperStart() - - var yyrr1148, yyrl1148 int - var yyc1148, yyrt1148 bool - _, _, _ = yyc1148, yyrt1148, yyrl1148 - yyrr1148 = yyl1148 - - if yyv1148 == nil { - if yyrl1148, yyrt1148 = z.DecInferLen(yyl1148, z.DecBasicHandle().MaxInitLen, 272); yyrt1148 { - yyrr1148 = yyrl1148 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Deployment{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1148 = make([]Deployment, yyrl1148) - yyc1148 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1148 == 0 { - if len(yyv1148) != 0 { - yyv1148 = yyv1148[:0] - yyc1148 = true - } - } else if yyl1148 > 0 { - - if yyl1148 > cap(yyv1148) { - yyrl1148, yyrt1148 = z.DecInferLen(yyl1148, z.DecBasicHandle().MaxInitLen, 272) - yyv1148 = make([]Deployment, yyrl1148) - yyc1148 = true - - yyrr1148 = len(yyv1148) - } else if yyl1148 != len(yyv1148) { - yyv1148 = yyv1148[:yyl1148] - yyc1148 = true - } - yyj1148 := 0 - for ; yyj1148 < yyrr1148; yyj1148++ { - if r.TryDecodeAsNil() { - yyv1148[yyj1148] = Deployment{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 624) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Deployment, yyrl1) + } } else { - yyv1149 := &yyv1148[yyj1148] - yyv1149.CodecDecodeSelf(d) + yyv1 = make([]Deployment, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Deployment{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1148 { - for ; yyj1148 < yyl1148; yyj1148++ { - yyv1148 = append(yyv1148, Deployment{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Deployment{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1148[yyj1148] = Deployment{} + yyv1[yyj1] = Deployment{} } else { - yyv1150 := &yyv1148[yyj1148] - yyv1150.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1148 := 0; !r.CheckBreak(); yyj1148++ { - if yyj1148 >= len(yyv1148) { - yyv1148 = append(yyv1148, Deployment{}) // var yyz1148 Deployment - yyc1148 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1148 < len(yyv1148) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Deployment{}) // var yyz1 Deployment + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1148[yyj1148] = Deployment{} + yyv1[yyj1] = Deployment{} } else { - yyv1151 := &yyv1148[yyj1148] - yyv1151.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13036,12 +18947,18 @@ func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decode } } - yyh1148.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Deployment{} + yyc1 = true + } } - if yyc1148 { - *v = yyv1148 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceDaemonSet(v []DaemonSet, e *codec1978.Encoder) { @@ -13049,11 +18966,12 @@ func (x codecSelfer1234) encSliceDaemonSet(v []DaemonSet, e *codec1978.Encoder) z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1152 := range v { - yy1153 := &yyv1152 - yy1153.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder) { @@ -13061,75 +18979,86 @@ func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1154 := *v - yyh1154, yyl1154 := z.DecSliceHelperStart() - - var yyrr1154, yyrl1154 int - var yyc1154, yyrt1154 bool - _, _, _ = yyc1154, yyrt1154, yyrl1154 - yyrr1154 = yyl1154 - - if yyv1154 == nil { - if yyrl1154, yyrt1154 = z.DecInferLen(yyl1154, z.DecBasicHandle().MaxInitLen, 232); yyrt1154 { - yyrr1154 = yyrl1154 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []DaemonSet{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1154 = make([]DaemonSet, yyrl1154) - yyc1154 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1154 == 0 { - if len(yyv1154) != 0 { - yyv1154 = yyv1154[:0] - yyc1154 = true - } - } else if yyl1154 > 0 { - - if yyl1154 > cap(yyv1154) { - yyrl1154, yyrt1154 = z.DecInferLen(yyl1154, z.DecBasicHandle().MaxInitLen, 232) - yyv1154 = make([]DaemonSet, yyrl1154) - yyc1154 = true - - yyrr1154 = len(yyv1154) - } else if yyl1154 != len(yyv1154) { - yyv1154 = yyv1154[:yyl1154] - yyc1154 = true - } - yyj1154 := 0 - for ; yyj1154 < yyrr1154; yyj1154++ { - if r.TryDecodeAsNil() { - yyv1154[yyj1154] = DaemonSet{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 552) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]DaemonSet, yyrl1) + } } else { - yyv1155 := &yyv1154[yyj1154] - yyv1155.CodecDecodeSelf(d) + yyv1 = make([]DaemonSet, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = DaemonSet{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1154 { - for ; yyj1154 < yyl1154; yyj1154++ { - yyv1154 = append(yyv1154, DaemonSet{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, DaemonSet{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1154[yyj1154] = DaemonSet{} + yyv1[yyj1] = DaemonSet{} } else { - yyv1156 := &yyv1154[yyj1154] - yyv1156.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1154 := 0; !r.CheckBreak(); yyj1154++ { - if yyj1154 >= len(yyv1154) { - yyv1154 = append(yyv1154, DaemonSet{}) // var yyz1154 DaemonSet - yyc1154 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1154 < len(yyv1154) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, DaemonSet{}) // var yyz1 DaemonSet + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1154[yyj1154] = DaemonSet{} + yyv1[yyj1] = DaemonSet{} } else { - yyv1157 := &yyv1154[yyj1154] - yyv1157.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13137,12 +19066,18 @@ func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder) } } - yyh1154.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []DaemonSet{} + yyc1 = true + } } - if yyc1154 { - *v = yyv1154 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceThirdPartyResourceData(v []ThirdPartyResourceData, e *codec1978.Encoder) { @@ -13150,11 +19085,12 @@ func (x codecSelfer1234) encSliceThirdPartyResourceData(v []ThirdPartyResourceDa z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1158 := range v { - yy1159 := &yyv1158 - yy1159.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceThirdPartyResourceData(v *[]ThirdPartyResourceData, d *codec1978.Decoder) { @@ -13162,75 +19098,86 @@ func (x codecSelfer1234) decSliceThirdPartyResourceData(v *[]ThirdPartyResourceD z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1160 := *v - yyh1160, yyl1160 := z.DecSliceHelperStart() - - var yyrr1160, yyrl1160 int - var yyc1160, yyrt1160 bool - _, _, _ = yyc1160, yyrt1160, yyrl1160 - yyrr1160 = yyl1160 - - if yyv1160 == nil { - if yyrl1160, yyrt1160 = z.DecInferLen(yyl1160, z.DecBasicHandle().MaxInitLen, 216); yyrt1160 { - yyrr1160 = yyrl1160 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ThirdPartyResourceData{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1160 = make([]ThirdPartyResourceData, yyrl1160) - yyc1160 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1160 == 0 { - if len(yyv1160) != 0 { - yyv1160 = yyv1160[:0] - yyc1160 = true - } - } else if yyl1160 > 0 { - - if yyl1160 > cap(yyv1160) { - yyrl1160, yyrt1160 = z.DecInferLen(yyl1160, z.DecBasicHandle().MaxInitLen, 216) - yyv1160 = make([]ThirdPartyResourceData, yyrl1160) - yyc1160 = true - - yyrr1160 = len(yyv1160) - } else if yyl1160 != len(yyv1160) { - yyv1160 = yyv1160[:yyl1160] - yyc1160 = true - } - yyj1160 := 0 - for ; yyj1160 < yyrr1160; yyj1160++ { - if r.TryDecodeAsNil() { - yyv1160[yyj1160] = ThirdPartyResourceData{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ThirdPartyResourceData, yyrl1) + } } else { - yyv1161 := &yyv1160[yyj1160] - yyv1161.CodecDecodeSelf(d) + yyv1 = make([]ThirdPartyResourceData, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ThirdPartyResourceData{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1160 { - for ; yyj1160 < yyl1160; yyj1160++ { - yyv1160 = append(yyv1160, ThirdPartyResourceData{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ThirdPartyResourceData{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1160[yyj1160] = ThirdPartyResourceData{} + yyv1[yyj1] = ThirdPartyResourceData{} } else { - yyv1162 := &yyv1160[yyj1160] - yyv1162.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1160 := 0; !r.CheckBreak(); yyj1160++ { - if yyj1160 >= len(yyv1160) { - yyv1160 = append(yyv1160, ThirdPartyResourceData{}) // var yyz1160 ThirdPartyResourceData - yyc1160 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1160 < len(yyv1160) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ThirdPartyResourceData{}) // var yyz1 ThirdPartyResourceData + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1160[yyj1160] = ThirdPartyResourceData{} + yyv1[yyj1] = ThirdPartyResourceData{} } else { - yyv1163 := &yyv1160[yyj1160] - yyv1163.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13238,12 +19185,18 @@ func (x codecSelfer1234) decSliceThirdPartyResourceData(v *[]ThirdPartyResourceD } } - yyh1160.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ThirdPartyResourceData{} + yyc1 = true + } } - if yyc1160 { - *v = yyv1160 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceJob(v []Job, e *codec1978.Encoder) { @@ -13251,11 +19204,12 @@ func (x codecSelfer1234) encSliceJob(v []Job, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1164 := range v { - yy1165 := &yyv1164 - yy1165.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) { @@ -13263,75 +19217,86 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1166 := *v - yyh1166, yyl1166 := z.DecSliceHelperStart() - - var yyrr1166, yyrl1166 int - var yyc1166, yyrt1166 bool - _, _, _ = yyc1166, yyrt1166, yyrl1166 - yyrr1166 = yyl1166 - - if yyv1166 == nil { - if yyrl1166, yyrt1166 = z.DecInferLen(yyl1166, z.DecBasicHandle().MaxInitLen, 608); yyrt1166 { - yyrr1166 = yyrl1166 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Job{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1166 = make([]Job, yyrl1166) - yyc1166 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1166 == 0 { - if len(yyv1166) != 0 { - yyv1166 = yyv1166[:0] - yyc1166 = true - } - } else if yyl1166 > 0 { - - if yyl1166 > cap(yyv1166) { - yyrl1166, yyrt1166 = z.DecInferLen(yyl1166, z.DecBasicHandle().MaxInitLen, 608) - yyv1166 = make([]Job, yyrl1166) - yyc1166 = true - - yyrr1166 = len(yyv1166) - } else if yyl1166 != len(yyv1166) { - yyv1166 = yyv1166[:yyl1166] - yyc1166 = true - } - yyj1166 := 0 - for ; yyj1166 < yyrr1166; yyj1166++ { - if r.TryDecodeAsNil() { - yyv1166[yyj1166] = Job{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 616) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Job, yyrl1) + } } else { - yyv1167 := &yyv1166[yyj1166] - yyv1167.CodecDecodeSelf(d) + yyv1 = make([]Job, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Job{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1166 { - for ; yyj1166 < yyl1166; yyj1166++ { - yyv1166 = append(yyv1166, Job{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Job{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1166[yyj1166] = Job{} + yyv1[yyj1] = Job{} } else { - yyv1168 := &yyv1166[yyj1166] - yyv1168.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1166 := 0; !r.CheckBreak(); yyj1166++ { - if yyj1166 >= len(yyv1166) { - yyv1166 = append(yyv1166, Job{}) // var yyz1166 Job - yyc1166 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1166 < len(yyv1166) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Job{}) // var yyz1 Job + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1166[yyj1166] = Job{} + yyv1[yyj1] = Job{} } else { - yyv1169 := &yyv1166[yyj1166] - yyv1169.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13339,12 +19304,18 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) { } } - yyh1166.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Job{} + yyc1 = true + } } - if yyc1166 { - *v = yyv1166 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceJobCondition(v []JobCondition, e *codec1978.Encoder) { @@ -13352,11 +19323,12 @@ func (x codecSelfer1234) encSliceJobCondition(v []JobCondition, e *codec1978.Enc z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1170 := range v { - yy1171 := &yyv1170 - yy1171.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceJobCondition(v *[]JobCondition, d *codec1978.Decoder) { @@ -13364,75 +19336,86 @@ func (x codecSelfer1234) decSliceJobCondition(v *[]JobCondition, d *codec1978.De z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1172 := *v - yyh1172, yyl1172 := z.DecSliceHelperStart() - - var yyrr1172, yyrl1172 int - var yyc1172, yyrt1172 bool - _, _, _ = yyc1172, yyrt1172, yyrl1172 - yyrr1172 = yyl1172 - - if yyv1172 == nil { - if yyrl1172, yyrt1172 = z.DecInferLen(yyl1172, z.DecBasicHandle().MaxInitLen, 112); yyrt1172 { - yyrr1172 = yyrl1172 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []JobCondition{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1172 = make([]JobCondition, yyrl1172) - yyc1172 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1172 == 0 { - if len(yyv1172) != 0 { - yyv1172 = yyv1172[:0] - yyc1172 = true - } - } else if yyl1172 > 0 { - - if yyl1172 > cap(yyv1172) { - yyrl1172, yyrt1172 = z.DecInferLen(yyl1172, z.DecBasicHandle().MaxInitLen, 112) - yyv1172 = make([]JobCondition, yyrl1172) - yyc1172 = true - - yyrr1172 = len(yyv1172) - } else if yyl1172 != len(yyv1172) { - yyv1172 = yyv1172[:yyl1172] - yyc1172 = true - } - yyj1172 := 0 - for ; yyj1172 < yyrr1172; yyj1172++ { - if r.TryDecodeAsNil() { - yyv1172[yyj1172] = JobCondition{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 112) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]JobCondition, yyrl1) + } } else { - yyv1173 := &yyv1172[yyj1172] - yyv1173.CodecDecodeSelf(d) + yyv1 = make([]JobCondition, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = JobCondition{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1172 { - for ; yyj1172 < yyl1172; yyj1172++ { - yyv1172 = append(yyv1172, JobCondition{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, JobCondition{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1172[yyj1172] = JobCondition{} + yyv1[yyj1] = JobCondition{} } else { - yyv1174 := &yyv1172[yyj1172] - yyv1174.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1172 := 0; !r.CheckBreak(); yyj1172++ { - if yyj1172 >= len(yyv1172) { - yyv1172 = append(yyv1172, JobCondition{}) // var yyz1172 JobCondition - yyc1172 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1172 < len(yyv1172) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, JobCondition{}) // var yyz1 JobCondition + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1172[yyj1172] = JobCondition{} + yyv1[yyj1] = JobCondition{} } else { - yyv1175 := &yyv1172[yyj1172] - yyv1175.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13440,12 +19423,18 @@ func (x codecSelfer1234) decSliceJobCondition(v *[]JobCondition, d *codec1978.De } } - yyh1172.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []JobCondition{} + yyc1 = true + } } - if yyc1172 { - *v = yyv1172 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceIngress(v []Ingress, e *codec1978.Encoder) { @@ -13453,11 +19442,12 @@ func (x codecSelfer1234) encSliceIngress(v []Ingress, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1176 := range v { - yy1177 := &yyv1176 - yy1177.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceIngress(v *[]Ingress, d *codec1978.Decoder) { @@ -13465,75 +19455,86 @@ func (x codecSelfer1234) decSliceIngress(v *[]Ingress, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1178 := *v - yyh1178, yyl1178 := z.DecSliceHelperStart() - - var yyrr1178, yyrl1178 int - var yyc1178, yyrt1178 bool - _, _, _ = yyc1178, yyrt1178, yyrl1178 - yyrr1178 = yyl1178 - - if yyv1178 == nil { - if yyrl1178, yyrt1178 = z.DecInferLen(yyl1178, z.DecBasicHandle().MaxInitLen, 248); yyrt1178 { - yyrr1178 = yyrl1178 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Ingress{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1178 = make([]Ingress, yyrl1178) - yyc1178 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1178 == 0 { - if len(yyv1178) != 0 { - yyv1178 = yyv1178[:0] - yyc1178 = true - } - } else if yyl1178 > 0 { - - if yyl1178 > cap(yyv1178) { - yyrl1178, yyrt1178 = z.DecInferLen(yyl1178, z.DecBasicHandle().MaxInitLen, 248) - yyv1178 = make([]Ingress, yyrl1178) - yyc1178 = true - - yyrr1178 = len(yyv1178) - } else if yyl1178 != len(yyv1178) { - yyv1178 = yyv1178[:yyl1178] - yyc1178 = true - } - yyj1178 := 0 - for ; yyj1178 < yyrr1178; yyj1178++ { - if r.TryDecodeAsNil() { - yyv1178[yyj1178] = Ingress{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 272) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Ingress, yyrl1) + } } else { - yyv1179 := &yyv1178[yyj1178] - yyv1179.CodecDecodeSelf(d) + yyv1 = make([]Ingress, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Ingress{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1178 { - for ; yyj1178 < yyl1178; yyj1178++ { - yyv1178 = append(yyv1178, Ingress{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Ingress{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1178[yyj1178] = Ingress{} + yyv1[yyj1] = Ingress{} } else { - yyv1180 := &yyv1178[yyj1178] - yyv1180.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1178 := 0; !r.CheckBreak(); yyj1178++ { - if yyj1178 >= len(yyv1178) { - yyv1178 = append(yyv1178, Ingress{}) // var yyz1178 Ingress - yyc1178 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1178 < len(yyv1178) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Ingress{}) // var yyz1 Ingress + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1178[yyj1178] = Ingress{} + yyv1[yyj1] = Ingress{} } else { - yyv1181 := &yyv1178[yyj1178] - yyv1181.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13541,12 +19542,137 @@ func (x codecSelfer1234) decSliceIngress(v *[]Ingress, d *codec1978.Decoder) { } } - yyh1178.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Ingress{} + yyc1 = true + } } - if yyc1178 { - *v = yyv1178 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceIngressTLS(v []IngressTLS, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceIngressTLS(v *[]IngressTLS, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []IngressTLS{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]IngressTLS, yyrl1) + } + } else { + yyv1 = make([]IngressTLS, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IngressTLS{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, IngressTLS{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IngressTLS{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, IngressTLS{}) // var yyz1 IngressTLS + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = IngressTLS{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []IngressTLS{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceIngressRule(v []IngressRule, e *codec1978.Encoder) { @@ -13554,11 +19680,12 @@ func (x codecSelfer1234) encSliceIngressRule(v []IngressRule, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1182 := range v { - yy1183 := &yyv1182 - yy1183.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceIngressRule(v *[]IngressRule, d *codec1978.Decoder) { @@ -13566,75 +19693,86 @@ func (x codecSelfer1234) decSliceIngressRule(v *[]IngressRule, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1184 := *v - yyh1184, yyl1184 := z.DecSliceHelperStart() - - var yyrr1184, yyrl1184 int - var yyc1184, yyrt1184 bool - _, _, _ = yyc1184, yyrt1184, yyrl1184 - yyrr1184 = yyl1184 - - if yyv1184 == nil { - if yyrl1184, yyrt1184 = z.DecInferLen(yyl1184, z.DecBasicHandle().MaxInitLen, 24); yyrt1184 { - yyrr1184 = yyrl1184 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []IngressRule{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1184 = make([]IngressRule, yyrl1184) - yyc1184 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1184 == 0 { - if len(yyv1184) != 0 { - yyv1184 = yyv1184[:0] - yyc1184 = true - } - } else if yyl1184 > 0 { - - if yyl1184 > cap(yyv1184) { - yyrl1184, yyrt1184 = z.DecInferLen(yyl1184, z.DecBasicHandle().MaxInitLen, 24) - yyv1184 = make([]IngressRule, yyrl1184) - yyc1184 = true - - yyrr1184 = len(yyv1184) - } else if yyl1184 != len(yyv1184) { - yyv1184 = yyv1184[:yyl1184] - yyc1184 = true - } - yyj1184 := 0 - for ; yyj1184 < yyrr1184; yyj1184++ { - if r.TryDecodeAsNil() { - yyv1184[yyj1184] = IngressRule{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]IngressRule, yyrl1) + } } else { - yyv1185 := &yyv1184[yyj1184] - yyv1185.CodecDecodeSelf(d) + yyv1 = make([]IngressRule, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IngressRule{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1184 { - for ; yyj1184 < yyl1184; yyj1184++ { - yyv1184 = append(yyv1184, IngressRule{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, IngressRule{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1184[yyj1184] = IngressRule{} + yyv1[yyj1] = IngressRule{} } else { - yyv1186 := &yyv1184[yyj1184] - yyv1186.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1184 := 0; !r.CheckBreak(); yyj1184++ { - if yyj1184 >= len(yyv1184) { - yyv1184 = append(yyv1184, IngressRule{}) // var yyz1184 IngressRule - yyc1184 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1184 < len(yyv1184) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, IngressRule{}) // var yyz1 IngressRule + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1184[yyj1184] = IngressRule{} + yyv1[yyj1] = IngressRule{} } else { - yyv1187 := &yyv1184[yyj1184] - yyv1187.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13642,12 +19780,18 @@ func (x codecSelfer1234) decSliceIngressRule(v *[]IngressRule, d *codec1978.Deco } } - yyh1184.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []IngressRule{} + yyc1 = true + } } - if yyc1184 { - *v = yyv1184 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceHTTPIngressPath(v []HTTPIngressPath, e *codec1978.Encoder) { @@ -13655,11 +19799,12 @@ func (x codecSelfer1234) encSliceHTTPIngressPath(v []HTTPIngressPath, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1188 := range v { - yy1189 := &yyv1188 - yy1189.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceHTTPIngressPath(v *[]HTTPIngressPath, d *codec1978.Decoder) { @@ -13667,75 +19812,86 @@ func (x codecSelfer1234) decSliceHTTPIngressPath(v *[]HTTPIngressPath, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1190 := *v - yyh1190, yyl1190 := z.DecSliceHelperStart() - - var yyrr1190, yyrl1190 int - var yyc1190, yyrt1190 bool - _, _, _ = yyc1190, yyrt1190, yyrl1190 - yyrr1190 = yyl1190 - - if yyv1190 == nil { - if yyrl1190, yyrt1190 = z.DecInferLen(yyl1190, z.DecBasicHandle().MaxInitLen, 64); yyrt1190 { - yyrr1190 = yyrl1190 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []HTTPIngressPath{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1190 = make([]HTTPIngressPath, yyrl1190) - yyc1190 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1190 == 0 { - if len(yyv1190) != 0 { - yyv1190 = yyv1190[:0] - yyc1190 = true - } - } else if yyl1190 > 0 { - - if yyl1190 > cap(yyv1190) { - yyrl1190, yyrt1190 = z.DecInferLen(yyl1190, z.DecBasicHandle().MaxInitLen, 64) - yyv1190 = make([]HTTPIngressPath, yyrl1190) - yyc1190 = true - - yyrr1190 = len(yyv1190) - } else if yyl1190 != len(yyv1190) { - yyv1190 = yyv1190[:yyl1190] - yyc1190 = true - } - yyj1190 := 0 - for ; yyj1190 < yyrr1190; yyj1190++ { - if r.TryDecodeAsNil() { - yyv1190[yyj1190] = HTTPIngressPath{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 64) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]HTTPIngressPath, yyrl1) + } } else { - yyv1191 := &yyv1190[yyj1190] - yyv1191.CodecDecodeSelf(d) + yyv1 = make([]HTTPIngressPath, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HTTPIngressPath{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1190 { - for ; yyj1190 < yyl1190; yyj1190++ { - yyv1190 = append(yyv1190, HTTPIngressPath{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, HTTPIngressPath{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1190[yyj1190] = HTTPIngressPath{} + yyv1[yyj1] = HTTPIngressPath{} } else { - yyv1192 := &yyv1190[yyj1190] - yyv1192.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1190 := 0; !r.CheckBreak(); yyj1190++ { - if yyj1190 >= len(yyv1190) { - yyv1190 = append(yyv1190, HTTPIngressPath{}) // var yyz1190 HTTPIngressPath - yyc1190 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1190 < len(yyv1190) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, HTTPIngressPath{}) // var yyz1 HTTPIngressPath + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1190[yyj1190] = HTTPIngressPath{} + yyv1[yyj1] = HTTPIngressPath{} } else { - yyv1193 := &yyv1190[yyj1190] - yyv1193.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13743,12 +19899,18 @@ func (x codecSelfer1234) decSliceHTTPIngressPath(v *[]HTTPIngressPath, d *codec1 } } - yyh1190.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []HTTPIngressPath{} + yyc1 = true + } } - if yyc1190 { - *v = yyv1190 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceNodeUtilization(v []NodeUtilization, e *codec1978.Encoder) { @@ -13756,11 +19918,12 @@ func (x codecSelfer1234) encSliceNodeUtilization(v []NodeUtilization, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1194 := range v { - yy1195 := &yyv1194 - yy1195.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNodeUtilization(v *[]NodeUtilization, d *codec1978.Decoder) { @@ -13768,75 +19931,86 @@ func (x codecSelfer1234) decSliceNodeUtilization(v *[]NodeUtilization, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1196 := *v - yyh1196, yyl1196 := z.DecSliceHelperStart() - - var yyrr1196, yyrl1196 int - var yyc1196, yyrt1196 bool - _, _, _ = yyc1196, yyrt1196, yyrl1196 - yyrr1196 = yyl1196 - - if yyv1196 == nil { - if yyrl1196, yyrt1196 = z.DecInferLen(yyl1196, z.DecBasicHandle().MaxInitLen, 24); yyrt1196 { - yyrr1196 = yyrl1196 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeUtilization{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1196 = make([]NodeUtilization, yyrl1196) - yyc1196 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1196 == 0 { - if len(yyv1196) != 0 { - yyv1196 = yyv1196[:0] - yyc1196 = true - } - } else if yyl1196 > 0 { - - if yyl1196 > cap(yyv1196) { - yyrl1196, yyrt1196 = z.DecInferLen(yyl1196, z.DecBasicHandle().MaxInitLen, 24) - yyv1196 = make([]NodeUtilization, yyrl1196) - yyc1196 = true - - yyrr1196 = len(yyv1196) - } else if yyl1196 != len(yyv1196) { - yyv1196 = yyv1196[:yyl1196] - yyc1196 = true - } - yyj1196 := 0 - for ; yyj1196 < yyrr1196; yyj1196++ { - if r.TryDecodeAsNil() { - yyv1196[yyj1196] = NodeUtilization{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeUtilization, yyrl1) + } } else { - yyv1197 := &yyv1196[yyj1196] - yyv1197.CodecDecodeSelf(d) + yyv1 = make([]NodeUtilization, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeUtilization{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1196 { - for ; yyj1196 < yyl1196; yyj1196++ { - yyv1196 = append(yyv1196, NodeUtilization{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeUtilization{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1196[yyj1196] = NodeUtilization{} + yyv1[yyj1] = NodeUtilization{} } else { - yyv1198 := &yyv1196[yyj1196] - yyv1198.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1196 := 0; !r.CheckBreak(); yyj1196++ { - if yyj1196 >= len(yyv1196) { - yyv1196 = append(yyv1196, NodeUtilization{}) // var yyz1196 NodeUtilization - yyc1196 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1196 < len(yyv1196) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeUtilization{}) // var yyz1 NodeUtilization + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1196[yyj1196] = NodeUtilization{} + yyv1[yyj1] = NodeUtilization{} } else { - yyv1199 := &yyv1196[yyj1196] - yyv1199.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13844,12 +20018,18 @@ func (x codecSelfer1234) decSliceNodeUtilization(v *[]NodeUtilization, d *codec1 } } - yyh1196.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeUtilization{} + yyc1 = true + } } - if yyc1196 { - *v = yyv1196 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceClusterAutoscaler(v []ClusterAutoscaler, e *codec1978.Encoder) { @@ -13857,11 +20037,12 @@ func (x codecSelfer1234) encSliceClusterAutoscaler(v []ClusterAutoscaler, e *cod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1200 := range v { - yy1201 := &yyv1200 - yy1201.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceClusterAutoscaler(v *[]ClusterAutoscaler, d *codec1978.Decoder) { @@ -13869,75 +20050,86 @@ func (x codecSelfer1234) decSliceClusterAutoscaler(v *[]ClusterAutoscaler, d *co z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1202 := *v - yyh1202, yyl1202 := z.DecSliceHelperStart() - - var yyrr1202, yyrl1202 int - var yyc1202, yyrt1202 bool - _, _, _ = yyc1202, yyrt1202, yyrl1202 - yyrr1202 = yyl1202 - - if yyv1202 == nil { - if yyrl1202, yyrt1202 = z.DecInferLen(yyl1202, z.DecBasicHandle().MaxInitLen, 232); yyrt1202 { - yyrr1202 = yyrl1202 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ClusterAutoscaler{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1202 = make([]ClusterAutoscaler, yyrl1202) - yyc1202 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1202 == 0 { - if len(yyv1202) != 0 { - yyv1202 = yyv1202[:0] - yyc1202 = true - } - } else if yyl1202 > 0 { - - if yyl1202 > cap(yyv1202) { - yyrl1202, yyrt1202 = z.DecInferLen(yyl1202, z.DecBasicHandle().MaxInitLen, 232) - yyv1202 = make([]ClusterAutoscaler, yyrl1202) - yyc1202 = true - - yyrr1202 = len(yyv1202) - } else if yyl1202 != len(yyv1202) { - yyv1202 = yyv1202[:yyl1202] - yyc1202 = true - } - yyj1202 := 0 - for ; yyj1202 < yyrr1202; yyj1202++ { - if r.TryDecodeAsNil() { - yyv1202[yyj1202] = ClusterAutoscaler{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 232) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ClusterAutoscaler, yyrl1) + } } else { - yyv1203 := &yyv1202[yyj1202] - yyv1203.CodecDecodeSelf(d) + yyv1 = make([]ClusterAutoscaler, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ClusterAutoscaler{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1202 { - for ; yyj1202 < yyl1202; yyj1202++ { - yyv1202 = append(yyv1202, ClusterAutoscaler{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ClusterAutoscaler{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1202[yyj1202] = ClusterAutoscaler{} + yyv1[yyj1] = ClusterAutoscaler{} } else { - yyv1204 := &yyv1202[yyj1202] - yyv1204.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1202 := 0; !r.CheckBreak(); yyj1202++ { - if yyj1202 >= len(yyv1202) { - yyv1202 = append(yyv1202, ClusterAutoscaler{}) // var yyz1202 ClusterAutoscaler - yyc1202 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1202 < len(yyv1202) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ClusterAutoscaler{}) // var yyz1 ClusterAutoscaler + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1202[yyj1202] = ClusterAutoscaler{} + yyv1[yyj1] = ClusterAutoscaler{} } else { - yyv1205 := &yyv1202[yyj1202] - yyv1205.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13945,100 +20137,118 @@ func (x codecSelfer1234) decSliceClusterAutoscaler(v *[]ClusterAutoscaler, d *co } } - yyh1202.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ClusterAutoscaler{} + yyc1 = true + } } - if yyc1202 { - *v = yyv1202 + yyh1.End() + if yyc1 { + *v = yyv1 } - } -func (x codecSelfer1234) encSlicePodSelectorRequirement(v []PodSelectorRequirement, e *codec1978.Encoder) { +func (x codecSelfer1234) encSliceReplicaSet(v []ReplicaSet, e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1206 := range v { - yy1207 := &yyv1206 - yy1207.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } -func (x codecSelfer1234) decSlicePodSelectorRequirement(v *[]PodSelectorRequirement, d *codec1978.Decoder) { +func (x codecSelfer1234) decSliceReplicaSet(v *[]ReplicaSet, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1208 := *v - yyh1208, yyl1208 := z.DecSliceHelperStart() - - var yyrr1208, yyrl1208 int - var yyc1208, yyrt1208 bool - _, _, _ = yyc1208, yyrt1208, yyrl1208 - yyrr1208 = yyl1208 - - if yyv1208 == nil { - if yyrl1208, yyrt1208 = z.DecInferLen(yyl1208, z.DecBasicHandle().MaxInitLen, 56); yyrt1208 { - yyrr1208 = yyrl1208 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ReplicaSet{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1208 = make([]PodSelectorRequirement, yyrl1208) - yyc1208 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1208 == 0 { - if len(yyv1208) != 0 { - yyv1208 = yyv1208[:0] - yyc1208 = true - } - } else if yyl1208 > 0 { - - if yyl1208 > cap(yyv1208) { - yyrl1208, yyrt1208 = z.DecInferLen(yyl1208, z.DecBasicHandle().MaxInitLen, 56) - yyv1208 = make([]PodSelectorRequirement, yyrl1208) - yyc1208 = true - - yyrr1208 = len(yyv1208) - } else if yyl1208 != len(yyv1208) { - yyv1208 = yyv1208[:yyl1208] - yyc1208 = true - } - yyj1208 := 0 - for ; yyj1208 < yyrr1208; yyj1208++ { - if r.TryDecodeAsNil() { - yyv1208[yyj1208] = PodSelectorRequirement{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 232) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ReplicaSet, yyrl1) + } } else { - yyv1209 := &yyv1208[yyj1208] - yyv1209.CodecDecodeSelf(d) + yyv1 = make([]ReplicaSet, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ReplicaSet{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1208 { - for ; yyj1208 < yyl1208; yyj1208++ { - yyv1208 = append(yyv1208, PodSelectorRequirement{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ReplicaSet{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1208[yyj1208] = PodSelectorRequirement{} + yyv1[yyj1] = ReplicaSet{} } else { - yyv1210 := &yyv1208[yyj1208] - yyv1210.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1208 := 0; !r.CheckBreak(); yyj1208++ { - if yyj1208 >= len(yyv1208) { - yyv1208 = append(yyv1208, PodSelectorRequirement{}) // var yyz1208 PodSelectorRequirement - yyc1208 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1208 < len(yyv1208) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ReplicaSet{}) // var yyz1 ReplicaSet + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1208[yyj1208] = PodSelectorRequirement{} + yyv1[yyj1] = ReplicaSet{} } else { - yyv1211 := &yyv1208[yyj1208] - yyv1211.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -14046,10 +20256,594 @@ func (x codecSelfer1234) decSlicePodSelectorRequirement(v *[]PodSelectorRequirem } } - yyh1208.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ReplicaSet{} + yyc1 = true + } } - if yyc1208 { - *v = yyv1208 + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceapi_Capability(v []pkg2_api.Capability, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yysf2 := &yyv1 + yysf2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceapi_Capability(v *[]pkg2_api.Capability, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []pkg2_api.Capability{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]pkg2_api.Capability, yyrl1) + } + } else { + yyv1 = make([]pkg2_api.Capability, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = pkg2_api.Capability(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = pkg2_api.Capability(r.DecodeString()) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 pkg2_api.Capability + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = pkg2_api.Capability(r.DecodeString()) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []pkg2_api.Capability{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceFSType(v []FSType, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yyv1.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceFSType(v *[]FSType, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []FSType{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]FSType, yyrl1) + } + } else { + yyv1 = make([]FSType, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FSType(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FSType(r.DecodeString()) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 FSType + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FSType(r.DecodeString()) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []FSType{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceHostPortRange(v []HostPortRange, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceHostPortRange(v *[]HostPortRange, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []HostPortRange{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]HostPortRange, yyrl1) + } + } else { + yyv1 = make([]HostPortRange, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HostPortRange{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, HostPortRange{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HostPortRange{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, HostPortRange{}) // var yyz1 HostPortRange + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = HostPortRange{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []HostPortRange{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceIDRange(v []IDRange, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceIDRange(v *[]IDRange, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []IDRange{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]IDRange, yyrl1) + } + } else { + yyv1 = make([]IDRange, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IDRange{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, IDRange{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IDRange{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, IDRange{}) // var yyz1 IDRange + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = IDRange{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []IDRange{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSlicePodSecurityPolicy(v []PodSecurityPolicy, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSlicePodSecurityPolicy(v *[]PodSecurityPolicy, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PodSecurityPolicy{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 352) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PodSecurityPolicy, yyrl1) + } + } else { + yyv1 = make([]PodSecurityPolicy, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodSecurityPolicy{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PodSecurityPolicy{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodSecurityPolicy{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PodSecurityPolicy{}) // var yyz1 PodSecurityPolicy + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodSecurityPolicy{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PodSecurityPolicy{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 } - } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.go index dfcf44998..4bfbef8d0 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.go @@ -30,8 +30,9 @@ package extensions import ( "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/unversioned" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) // describes the attributes of a scale subresource @@ -49,6 +50,8 @@ type ScaleStatus struct { Selector map[string]string `json:"selector,omitempty"` } +// +genclient=true,noMethods=true + // represents a scaling request for a resource. type Scale struct { unversioned.TypeMeta `json:",inline"` @@ -71,8 +74,6 @@ type ReplicationControllerDummy struct { type SubresourceReference struct { // Kind of the referent; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds" Kind string `json:"kind,omitempty"` - // Namespace of the referent; More info: http://releases.k8s.io/HEAD/docs/user-guide/namespaces.md - Namespace string `json:"namespace,omitempty"` // Name of the referent; More info: http://releases.k8s.io/HEAD/docs/user-guide/identifiers.md#names Name string `json:"name,omitempty"` // API version of the referent @@ -87,6 +88,29 @@ type CPUTargetUtilization struct { TargetPercentage int `json:"targetPercentage"` } +// Alpha-level support for Custom Metrics in HPA (as annotations). +type CustomMetricTarget struct { + // Custom Metric name. + Name string `json:"name"` + // Custom Metric value (average). + TargetValue resource.Quantity `json:"value"` +} + +type CustomMetricTargetList struct { + Items []CustomMetricTarget `json:"items"` +} + +type CustomMetricCurrentStatus struct { + // Custom Metric name. + Name string `json:"name"` + // Custom Metric value (average). + CurrentValue resource.Quantity `json:"value"` +} + +type CustomMetricCurrentStatusList struct { + Items []CustomMetricCurrentStatus `json:"items"` +} + // specification of a horizontal pod autoscaler. type HorizontalPodAutoscalerSpec struct { // reference to Scale subresource; horizontal pod autoscaler will learn the current resource consumption from its status, @@ -121,6 +145,8 @@ type HorizontalPodAutoscalerStatus struct { CurrentCPUUtilizationPercentage *int `json:"currentCPUUtilizationPercentage,omitempty"` } +// +genclient=true + // configuration of a horizontal pod autoscaler. type HorizontalPodAutoscaler struct { unversioned.TypeMeta `json:",inline"` @@ -142,6 +168,8 @@ type HorizontalPodAutoscalerList struct { Items []HorizontalPodAutoscaler `json:"items"` } +// +genclient=true + // A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource // types to the API. It consists of one or more Versions of the api. type ThirdPartyResource struct { @@ -184,9 +212,11 @@ type ThirdPartyResourceData struct { api.ObjectMeta `json:"metadata,omitempty"` // Data is the raw JSON data for this data. - Data []byte `json:"name,omitempty"` + Data []byte `json:"data,omitempty"` } +// +genclient=true + type Deployment struct { unversioned.TypeMeta `json:",inline"` api.ObjectMeta `json:"metadata,omitempty"` @@ -203,27 +233,55 @@ type DeploymentSpec struct { // zero and not specified. Defaults to 1. Replicas int `json:"replicas,omitempty"` - // Label selector for pods. Existing ReplicationControllers whose pods are + // Label selector for pods. Existing ReplicaSets whose pods are // selected by this will be the ones affected by this deployment. - Selector map[string]string `json:"selector,omitempty"` + Selector *unversioned.LabelSelector `json:"selector,omitempty"` // Template describes the pods that will be created. - Template *api.PodTemplateSpec `json:"template,omitempty"` + Template api.PodTemplateSpec `json:"template"` // The deployment strategy to use to replace existing pods with new ones. Strategy DeploymentStrategy `json:"strategy,omitempty"` - // Key of the selector that is added to existing RCs (and label key that is - // added to its pods) to prevent the existing RCs to select new pods (and old - // pods being selected by new RC). - // Users can set this to an empty string to indicate that the system should - // not add any selector and label. If unspecified, system uses - // "deployment.kubernetes.io/podTemplateHash". - // Value of this key is hash of DeploymentSpec.PodTemplateSpec. - // No label is added if this is set to empty string. - UniqueLabelKey string `json:"uniqueLabelKey,omitempty"` + // Minimum number of seconds for which a newly created pod should be ready + // without any of its container crashing, for it to be considered available. + // Defaults to 0 (pod will be considered available as soon as it is ready) + MinReadySeconds int `json:"minReadySeconds,omitempty"` + + // The number of old ReplicaSets to retain to allow rollback. + // This is a pointer to distinguish between explicit zero and not specified. + RevisionHistoryLimit *int `json:"revisionHistoryLimit,omitempty"` + + // Indicates that the deployment is paused and will not be processed by the + // deployment controller. + Paused bool `json:"paused,omitempty"` + // The config this deployment is rolling back to. Will be cleared after rollback is done. + RollbackTo *RollbackConfig `json:"rollbackTo,omitempty"` } +// DeploymentRollback stores the information required to rollback a deployment. +type DeploymentRollback struct { + unversioned.TypeMeta `json:",inline"` + // Required: This must match the Name of a deployment. + Name string `json:"name"` + // The annotations to be updated to a deployment + UpdatedAnnotations map[string]string `json:"updatedAnnotations,omitempty"` + // The config of this deployment rollback. + RollbackTo RollbackConfig `json:"rollbackTo"` +} + +type RollbackConfig struct { + // The revision to rollback to. If set to 0, rollbck to the last revision. + Revision int64 `json:"revision,omitempty"` +} + +const ( + // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added + // to existing RCs (and label key that is added to its pods) to prevent the existing RCs + // to select new pods (and old pods being select by new RC). + DefaultDeploymentUniqueLabelKey string = "pod-template-hash" +) + type DeploymentStrategy struct { // Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. Type DeploymentStrategyType `json:"type,omitempty"` @@ -258,7 +316,7 @@ type RollingUpdateDeployment struct { // can be scaled down further, followed by scaling up the new RC, ensuring // that at least 70% of original number of pods are available at all times // during the update. - MaxUnavailable util.IntOrString `json:"maxUnavailable,omitempty"` + MaxUnavailable intstr.IntOrString `json:"maxUnavailable,omitempty"` // The maximum number of pods that can be scheduled above the original number of // pods. @@ -270,12 +328,7 @@ type RollingUpdateDeployment struct { // immediately when the rolling update starts. Once old pods have been killed, // new RC can be scaled up further, ensuring that total number of pods running // at any time during the update is atmost 130% of original pods. - MaxSurge util.IntOrString `json:"maxSurge,omitempty"` - - // Minimum number of seconds for which a newly created pod should be ready - // without any of its container crashing, for it to be considered available. - // Defaults to 0 (pod will be considered available as soon as it is ready) - MinReadySeconds int `json:"minReadySeconds,omitempty"` + MaxSurge intstr.IntOrString `json:"maxSurge,omitempty"` } type DeploymentStatus struct { @@ -284,6 +337,12 @@ type DeploymentStatus struct { // Total number of non-terminated pods targeted by this deployment that have the desired template spec. UpdatedReplicas int `json:"updatedReplicas,omitempty"` + + // Total number of available pods (ready for at least minReadySeconds) targeted by this deployment. + AvailableReplicas int `json:"availableReplicas,omitempty"` + + // Total number of unavailable pods targeted by this deployment. + UnavailableReplicas int `json:"unavailableReplicas,omitempty"` } type DeploymentList struct { @@ -294,22 +353,90 @@ type DeploymentList struct { Items []Deployment `json:"items"` } +// TODO(madhusudancs): Uncomment while implementing DaemonSet updates. +/* Commenting out for v1.2. We are planning to bring these types back with a more robust DaemonSet update implementation in v1.3, hence not deleting but just commenting the types out. +type DaemonSetUpdateStrategy struct { + // Type of daemon set update. Only "RollingUpdate" is supported at this time. Default is RollingUpdate. + Type DaemonSetUpdateStrategyType `json:"type,omitempty"` + + // Rolling update config params. Present only if DaemonSetUpdateStrategy = + // RollingUpdate. + //--- + // TODO: Update this to follow our convention for oneOf, whatever we decide it + // to be. Same as DeploymentStrategy.RollingUpdate. + RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty"` +} + +type DaemonSetUpdateStrategyType string + +const ( + // Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other. + RollingUpdateDaemonSetStrategyType DaemonSetUpdateStrategyType = "RollingUpdate" +) + +// Spec to control the desired behavior of daemon set rolling update. +type RollingUpdateDaemonSet struct { + // The maximum number of DaemonSet pods that can be unavailable during the + // update. Value can be an absolute number (ex: 5) or a percentage of total + // number of DaemonSet pods at the start of the update (ex: 10%). Absolute + // number is calculated from percentage by rounding up. + // This cannot be 0. + // Default value is 1. + // Example: when this is set to 30%, 30% of the currently running DaemonSet + // pods can be stopped for an update at any given time. The update starts + // by stopping at most 30% of the currently running DaemonSet pods and then + // brings up new DaemonSet pods in their place. Once the new pods are ready, + // it then proceeds onto other DaemonSet pods, thus ensuring that at least + // 70% of original number of DaemonSet pods are available at all times + // during the update. + MaxUnavailable intstr.IntOrString `json:"maxUnavailable,omitempty"` + + // Minimum number of seconds for which a newly created DaemonSet pod should + // be ready without any of its container crashing, for it to be considered + // available. Defaults to 0 (pod will be considered available as soon as it + // is ready). + MinReadySeconds int `json:"minReadySeconds,omitempty"` +} +*/ + // DaemonSetSpec is the specification of a daemon set. type DaemonSetSpec struct { // Selector is a label query over pods that are managed by the daemon set. // Must match in order to be controlled. // If empty, defaulted to labels on Pod template. // More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors - Selector map[string]string `json:"selector,omitempty"` + Selector *unversioned.LabelSelector `json:"selector,omitempty"` // Template is the object that describes the pod that will be created. // The DaemonSet will create exactly one copy of this pod on every node // that matches the template's node selector (or on every node if no node // selector is specified). // More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#pod-template - Template *api.PodTemplateSpec `json:"template,omitempty"` + Template api.PodTemplateSpec `json:"template"` + + // TODO(madhusudancs): Uncomment while implementing DaemonSet updates. + /* Commenting out for v1.2. We are planning to bring these fields back with a more robust DaemonSet update implementation in v1.3, hence not deleting but just commenting these fields out. + // Update strategy to replace existing DaemonSet pods with new pods. + UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy,omitempty"` + + // Label key that is added to DaemonSet pods to distinguish between old and + // new pod templates during DaemonSet update. + // Users can set this to an empty string to indicate that the system should + // not add any label. If unspecified, system uses + // DefaultDaemonSetUniqueLabelKey("daemonset.kubernetes.io/podTemplateHash"). + // Value of this key is hash of DaemonSetSpec.PodTemplateSpec. + // No label is added if this is set to empty string. + UniqueLabelKey string `json:"uniqueLabelKey,omitempty"` + */ } +const ( + // DefaultDaemonSetUniqueLabelKey is the default key of the labels that is added + // to daemon set pods to distinguish between old and new pod templates during + // DaemonSet update. See DaemonSetSpec's UniqueLabelKey field for more information. + DefaultDaemonSetUniqueLabelKey string = "daemonset.kubernetes.io/podTemplateHash" +) + // DaemonSetStatus represents the current status of a daemon set. type DaemonSetStatus struct { // CurrentNumberScheduled is the number of nodes that are running at least 1 @@ -325,6 +452,8 @@ type DaemonSetStatus struct { DesiredNumberScheduled int `json:"desiredNumberScheduled"` } +// +genclient=true + // DaemonSet represents the configuration of a daemon set. type DaemonSet struct { unversioned.TypeMeta `json:",inline"` @@ -364,6 +493,8 @@ type ThirdPartyResourceDataList struct { Items []ThirdPartyResourceData `json:"items"` } +// +genclient=true + // Job represents the configuration of a single job. type Job struct { unversioned.TypeMeta `json:",inline"` @@ -401,11 +532,15 @@ type JobSpec struct { Parallelism *int `json:"parallelism,omitempty"` // Completions specifies the desired number of successfully finished pods the - // job should be run with. Defaults to 1. + // job should be run with. When unset, any pod exiting signals the job to complete. Completions *int `json:"completions,omitempty"` + // Optional duration in seconds relative to the startTime that the job may be active + // before the system tries to terminate it; value must be positive integer + ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"` + // Selector is a label query over pods that should match the pod count. - Selector *PodSelector `json:"selector,omitempty"` + Selector *unversioned.LabelSelector `json:"selector,omitempty"` // Template is the object that describes the pod that will be created when // executing a job. @@ -444,11 +579,13 @@ type JobConditionType string const ( // JobComplete means the job has completed its execution. JobComplete JobConditionType = "Complete" + // JobFailed means the job has failed its execution. + JobFailed JobConditionType = "Failed" ) // JobCondition describes current state of a job. type JobCondition struct { - // Type of job condition, currently only Complete. + // Type of job condition, Complete or Failed. Type JobConditionType `json:"type"` // Status of the condition, one of True, False, Unknown. Status api.ConditionStatus `json:"status"` @@ -462,6 +599,8 @@ type JobCondition struct { Message string `json:"message,omitempty"` } +// +genclient=true + // Ingress is a collection of rules that allow inbound connections to reach the // endpoints defined by a backend. An Ingress can be configured to give services // externally-reachable urls, load balance traffic, terminate SSL, offer name @@ -499,12 +638,35 @@ type IngressSpec struct { // is optional to allow the loadbalancer controller or defaulting logic to // specify a global default. Backend *IngressBackend `json:"backend,omitempty"` + + // TLS is the TLS configuration. Currently the Ingress only supports a single TLS + // port, 443, and assumes TLS termination. If multiple members of this + // list specify different hosts, they will be multiplexed on the same + // port according to the hostname specified through the SNI TLS extension. + TLS []IngressTLS `json:"tls,omitempty"` + // A list of host rules used to configure the Ingress. If unspecified, or // no rule matches, all traffic is sent to the default backend. Rules []IngressRule `json:"rules,omitempty"` // TODO: Add the ability to specify load-balancer IP through claims } +// IngressTLS describes the transport layer security associated with an Ingress. +type IngressTLS struct { + // Hosts are a list of hosts included in the TLS certificate. The values in + // this list must match the name/s used in the tlsSecret. Defaults to the + // wildcard host setting for the loadbalancer controller fulfilling this + // Ingress, if left unspecified. + Hosts []string `json:"hosts,omitempty"` + // SecretName is the name of the secret used to terminate SSL traffic on 443. + // Field is left optional to allow SSL routing based on SNI hostname alone. + // If the SNI host in a listener conflicts with the "Host" header field used + // by an IngressRule, the SNI host is used for termination and value of the + // Host header is used for routing. + SecretName string `json:"secretName,omitempty"` + // TODO: Consider specifying different modes of termination, protocols etc. +} + // IngressStatus describe the current state of the Ingress. type IngressStatus struct { // LoadBalancer contains the current status of the load-balancer. @@ -585,7 +747,7 @@ type IngressBackend struct { ServiceName string `json:"serviceName"` // Specifies the port of the referenced service. - ServicePort util.IntOrString `json:"servicePort"` + ServicePort intstr.IntOrString `json:"servicePort"` } type NodeResource string @@ -649,39 +811,172 @@ type ClusterAutoscalerList struct { Items []ClusterAutoscaler `json:"items"` } -// A pod selector is a label query over a set of pods. The result of matchLabels and -// matchExpressions are ANDed. An empty pod selector matches all objects. A null -// pod selector matches no objects. -type PodSelector struct { - // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - // map is equivalent to an element of matchExpressions, whose key field is "key", the - // operator is "In", and the values array contains only "value". The requirements are ANDed. - MatchLabels map[string]string `json:"matchLabels,omitempty"` - // matchExpressions is a list of pod selector requirements. The requirements are ANDed. - MatchExpressions []PodSelectorRequirement `json:"matchExpressions,omitempty"` +// +genclient=true + +// ReplicaSet represents the configuration of a replica set. +type ReplicaSet struct { + unversioned.TypeMeta `json:",inline"` + api.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired behavior of this ReplicaSet. + Spec ReplicaSetSpec `json:"spec,omitempty"` + + // Status is the current status of this ReplicaSet. This data may be + // out of date by some window of time. + Status ReplicaSetStatus `json:"status,omitempty"` } -// A pod selector requirement is a selector that contains values, a key, and an operator that -// relates the key and values. -type PodSelectorRequirement struct { - // key is the label key that the selector applies to. - Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key"` - // operator represents a key's relationship to a set of values. - // Valid operators ard In, NotIn, Exists and DoesNotExist. - Operator PodSelectorOperator `json:"operator"` - // values is an array of string values. If the operator is In or NotIn, - // the values array must be non-empty. If the operator is Exists or DoesNotExist, - // the values array must be empty. This array is replaced during a strategic - // merge patch. - Values []string `json:"values,omitempty"` +// ReplicaSetList is a collection of ReplicaSets. +type ReplicaSetList struct { + unversioned.TypeMeta `json:",inline"` + unversioned.ListMeta `json:"metadata,omitempty"` + + Items []ReplicaSet `json:"items"` } -// A pod selector operator is the set of operators that can be used in a selector requirement. -type PodSelectorOperator string +// ReplicaSetSpec is the specification of a ReplicaSet. +// As the internal representation of a ReplicaSet, it must have +// a Template set. +type ReplicaSetSpec struct { + // Replicas is the number of desired replicas. + Replicas int `json:"replicas"` + + // Selector is a label query over pods that should match the replica count. + // Must match in order to be controlled. + // If empty, defaulted to labels on pod template. + // More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors + Selector *unversioned.LabelSelector `json:"selector,omitempty"` + + // Template is the object that describes the pod that will be created if + // insufficient replicas are detected. + Template *api.PodTemplateSpec `json:"template,omitempty"` +} + +// ReplicaSetStatus represents the current status of a ReplicaSet. +type ReplicaSetStatus struct { + // Replicas is the number of actual replicas. + Replicas int `json:"replicas"` + + // ObservedGeneration is the most recent generation observed by the controller. + ObservedGeneration int64 `json:"observedGeneration,omitempty"` +} + +// PodSecurityPolicy governs the ability to make requests that affect the SecurityContext +// that will be applied to a pod and container. +type PodSecurityPolicy struct { + unversioned.TypeMeta `json:",inline"` + api.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the policy enforced. + Spec PodSecurityPolicySpec `json:"spec,omitempty"` +} + +// PodSecurityPolicySpec defines the policy enforced. +type PodSecurityPolicySpec struct { + // Privileged determines if a pod can request to be run as privileged. + Privileged bool `json:"privileged,omitempty"` + // Capabilities is a list of capabilities that can be added. + Capabilities []api.Capability `json:"capabilities,omitempty"` + // Volumes is a white list of allowed volume plugins. Empty indicates that all plugins + // may be used. + Volumes []FSType `json:"volumes,omitempty"` + // HostNetwork determines if the policy allows the use of HostNetwork in the pod spec. + HostNetwork bool `json:"hostNetwork,omitempty"` + // HostPorts determines which host port ranges are allowed to be exposed. + HostPorts []HostPortRange `json:"hostPorts,omitempty"` + // HostPID determines if the policy allows the use of HostPID in the pod spec. + HostPID bool `json:"hostPID,omitempty"` + // HostIPC determines if the policy allows the use of HostIPC in the pod spec. + HostIPC bool `json:"hostIPC,omitempty"` + // SELinuxContext is the strategy that will dictate the allowable labels that may be set. + SELinuxContext SELinuxContextStrategyOptions `json:"seLinuxContext,omitempty"` + // RunAsUser is the strategy that will dictate the allowable RunAsUser values that may be set. + RunAsUser RunAsUserStrategyOptions `json:"runAsUser,omitempty"` +} + +// HostPortRange defines a range of host ports that will be enabled by a policy +// for pods to use. It requires both the start and end to be defined. +type HostPortRange struct { + // Min is the start of the range, inclusive. + Min int `json:"min"` + // Max is the end of the range, inclusive. + Max int `json:"max"` +} + +// FSType gives strong typing to different file systems that are used by volumes. +type FSType string + +var ( + HostPath FSType = "hostPath" + EmptyDir FSType = "emptyDir" + GCEPersistentDisk FSType = "gcePersistentDisk" + AWSElasticBlockStore FSType = "awsElasticBlockStore" + GitRepo FSType = "gitRepo" + Secret FSType = "secret" + NFS FSType = "nfs" + ISCSI FSType = "iscsi" + Glusterfs FSType = "glusterfs" + PersistentVolumeClaim FSType = "persistentVolumeClaim" + RBD FSType = "rbd" + Cinder FSType = "cinder" + CephFS FSType = "cephFS" + DownwardAPI FSType = "downwardAPI" + FC FSType = "fc" +) + +// SELinuxContextStrategyOptions defines the strategy type and any options used to create the strategy. +type SELinuxContextStrategyOptions struct { + // Type is the strategy that will dictate the allowable labels that may be set. + Type SELinuxContextStrategy `json:"type"` + // seLinuxOptions required to run as; required for MustRunAs + // More info: http://releases.k8s.io/HEAD/docs/design/security_context.md#security-context + SELinuxOptions *api.SELinuxOptions `json:"seLinuxOptions,omitempty"` +} + +// SELinuxContextStrategyType denotes strategy types for generating SELinux options for a +// SecurityContext. +type SELinuxContextStrategy string const ( - PodSelectorOpIn PodSelectorOperator = "In" - PodSelectorOpNotIn PodSelectorOperator = "NotIn" - PodSelectorOpExists PodSelectorOperator = "Exists" - PodSelectorOpDoesNotExist PodSelectorOperator = "DoesNotExist" + // container must have SELinux labels of X applied. + SELinuxStrategyMustRunAs SELinuxContextStrategy = "MustRunAs" + // container may make requests for any SELinux context labels. + SELinuxStrategyRunAsAny SELinuxContextStrategy = "RunAsAny" ) + +// RunAsUserStrategyOptions defines the strategy type and any options used to create the strategy. +type RunAsUserStrategyOptions struct { + // Type is the strategy that will dictate the allowable RunAsUser values that may be set. + Type RunAsUserStrategy `json:"type"` + // Ranges are the allowed ranges of uids that may be used. + Ranges []IDRange `json:"ranges,omitempty"` +} + +// IDRange provides a min/max of an allowed range of IDs. +type IDRange struct { + // Min is the start of the range, inclusive. + Min int64 `json:"min"` + // Max is the end of the range, inclusive. + Max int64 `json:"max"` +} + +// RunAsUserStrategyType denotes strategy types for generating RunAsUser values for a +// SecurityContext. +type RunAsUserStrategy string + +const ( + // container must run as a particular uid. + RunAsUserStrategyMustRunAs RunAsUserStrategy = "MustRunAs" + // container must run as a non-root uid + RunAsUserStrategyMustRunAsNonRoot RunAsUserStrategy = "MustRunAsNonRoot" + // container may make requests for any uid. + RunAsUserStrategyRunAsAny RunAsUserStrategy = "RunAsAny" +) + +// PodSecurityPolicyList is a list of PodSecurityPolicy objects. +type PodSecurityPolicyList struct { + unversioned.TypeMeta `json:",inline"` + unversioned.ListMeta `json:"metadata,omitempty"` + + Items []PodSecurityPolicy `json:"items"` +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/conversion.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/conversion.go index dadee4a22..595091e02 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/conversion.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/conversion.go @@ -17,258 +17,160 @@ limitations under the License. package v1beta1 import ( + "fmt" "reflect" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" v1 "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/conversion" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/intstr" ) -func addConversionFuncs() { +func addConversionFuncs(scheme *runtime.Scheme) { // Add non-generated conversion functions - err := api.Scheme.AddConversionFuncs( - convert_api_PodSpec_To_v1_PodSpec, - convert_v1_PodSpec_To_api_PodSpec, - convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec, - convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec, - convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy, - convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy, - convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment, - convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment, + err := scheme.AddConversionFuncs( + Convert_api_PodSpec_To_v1_PodSpec, + Convert_v1_PodSpec_To_api_PodSpec, + Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec, + Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec, + Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy, + Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy, + Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment, + Convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment, + Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec, + Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec, ) if err != nil { // If one of the conversion functions is malformed, detect it immediately. panic(err) } + + // Add field label conversions for kinds having selectable nothing but ObjectMeta fields. + for _, kind := range []string{"DaemonSet", "Deployment", "Ingress"} { + err = api.Scheme.AddFieldLabelConversionFunc("extensions/v1beta1", kind, + func(label, value string) (string, string, error) { + switch label { + case "metadata.name", "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("field label %q not supported for %q", label, kind) + } + }) + if err != nil { + // If one of the conversion functions is malformed, detect it immediately. + panic(err) + } + } + + err = api.Scheme.AddFieldLabelConversionFunc("extensions/v1beta1", "Job", + func(label, value string) (string, string, error) { + switch label { + case "metadata.name", "metadata.namespace", "status.successful": + return label, value, nil + default: + return "", "", fmt.Errorf("field label not supported: %s", label) + } + }) + if err != nil { + // If one of the conversion functions is malformed, detect it immediately. + panic(err) + } } // The following two PodSpec conversions functions where copied from pkg/api/conversion.go // for the generated functions to work properly. // This should be fixed: https://github.com/kubernetes/kubernetes/issues/12977 -func convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *v1.PodSpec, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*api.PodSpec))(in) - } - if in.Volumes != nil { - out.Volumes = make([]v1.Volume, len(in.Volumes)) - for i := range in.Volumes { - if err := convert_api_Volume_To_v1_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { - return err - } - } - } else { - out.Volumes = nil - } - if in.Containers != nil { - out.Containers = make([]v1.Container, len(in.Containers)) - for i := range in.Containers { - if err := convert_api_Container_To_v1_Container(&in.Containers[i], &out.Containers[i], s); err != nil { - return err - } - } - } else { - out.Containers = nil - } - out.RestartPolicy = v1.RestartPolicy(in.RestartPolicy) - if in.TerminationGracePeriodSeconds != nil { - out.TerminationGracePeriodSeconds = new(int64) - *out.TerminationGracePeriodSeconds = *in.TerminationGracePeriodSeconds - } else { - out.TerminationGracePeriodSeconds = nil - } - if in.ActiveDeadlineSeconds != nil { - out.ActiveDeadlineSeconds = new(int64) - *out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds - } else { - out.ActiveDeadlineSeconds = nil - } - out.DNSPolicy = v1.DNSPolicy(in.DNSPolicy) - if in.NodeSelector != nil { - out.NodeSelector = make(map[string]string) - for key, val := range in.NodeSelector { - out.NodeSelector[key] = val - } - } else { - out.NodeSelector = nil - } - out.ServiceAccountName = in.ServiceAccountName - // DeprecatedServiceAccount is an alias for ServiceAccountName. - out.DeprecatedServiceAccount = in.ServiceAccountName - out.NodeName = in.NodeName - if in.SecurityContext != nil { - out.SecurityContext = new(v1.PodSecurityContext) - if err := convert_api_PodSecurityContext_To_v1_PodSecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { - return err - } - - out.HostNetwork = in.SecurityContext.HostNetwork - out.HostPID = in.SecurityContext.HostPID - out.HostIPC = in.SecurityContext.HostIPC - } - if in.ImagePullSecrets != nil { - out.ImagePullSecrets = make([]v1.LocalObjectReference, len(in.ImagePullSecrets)) - for i := range in.ImagePullSecrets { - if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { - return err - } - } - } else { - out.ImagePullSecrets = nil - } - return nil +func Convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *v1.PodSpec, s conversion.Scope) error { + return v1.Convert_api_PodSpec_To_v1_PodSpec(in, out, s) } -func convert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*v1.PodSpec))(in) - } - if in.Volumes != nil { - out.Volumes = make([]api.Volume, len(in.Volumes)) - for i := range in.Volumes { - if err := convert_v1_Volume_To_api_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { - return err - } - } - } else { - out.Volumes = nil - } - if in.Containers != nil { - out.Containers = make([]api.Container, len(in.Containers)) - for i := range in.Containers { - if err := convert_v1_Container_To_api_Container(&in.Containers[i], &out.Containers[i], s); err != nil { - return err - } - } - } else { - out.Containers = nil - } - out.RestartPolicy = api.RestartPolicy(in.RestartPolicy) - if in.TerminationGracePeriodSeconds != nil { - out.TerminationGracePeriodSeconds = new(int64) - *out.TerminationGracePeriodSeconds = *in.TerminationGracePeriodSeconds - } else { - out.TerminationGracePeriodSeconds = nil - } - if in.ActiveDeadlineSeconds != nil { - out.ActiveDeadlineSeconds = new(int64) - *out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds - } else { - out.ActiveDeadlineSeconds = nil - } - out.DNSPolicy = api.DNSPolicy(in.DNSPolicy) - if in.NodeSelector != nil { - out.NodeSelector = make(map[string]string) - for key, val := range in.NodeSelector { - out.NodeSelector[key] = val - } - } else { - out.NodeSelector = nil - } - // We support DeprecatedServiceAccount as an alias for ServiceAccountName. - // If both are specified, ServiceAccountName (the new field) wins. - out.ServiceAccountName = in.ServiceAccountName - if in.ServiceAccountName == "" { - out.ServiceAccountName = in.DeprecatedServiceAccount - } - out.NodeName = in.NodeName - - if in.SecurityContext != nil { - out.SecurityContext = new(api.PodSecurityContext) - if err := convert_v1_PodSecurityContext_To_api_PodSecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { - return err - } - } - if out.SecurityContext == nil { - out.SecurityContext = new(api.PodSecurityContext) - } - out.SecurityContext.HostNetwork = in.HostNetwork - out.SecurityContext.HostPID = in.HostPID - out.SecurityContext.HostIPC = in.HostIPC - if in.ImagePullSecrets != nil { - out.ImagePullSecrets = make([]api.LocalObjectReference, len(in.ImagePullSecrets)) - for i := range in.ImagePullSecrets { - if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { - return err - } - } - } else { - out.ImagePullSecrets = nil - } - return nil +func Convert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s conversion.Scope) error { + return v1.Convert_v1_PodSpec_To_api_PodSpec(in, out, s) } -func convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions.DeploymentSpec, out *DeploymentSpec, s conversion.Scope) error { +func Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions.DeploymentSpec, out *DeploymentSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DeploymentSpec))(in) } - out.Replicas = new(int) - *out.Replicas = in.Replicas + out.Replicas = new(int32) + *out.Replicas = int32(in.Replicas) if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + out.Selector = new(LabelSelector) + if err := Convert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil { + return err } } else { out.Selector = nil } - if in.Template != nil { - out.Template = new(v1.PodTemplateSpec) - if err := convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil { - return err - } - } else { - out.Template = nil - } - if err := convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { + if err := v1.Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { return err } - out.UniqueLabelKey = new(string) - *out.UniqueLabelKey = in.UniqueLabelKey + if err := Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { + return err + } + if in.RevisionHistoryLimit != nil { + out.RevisionHistoryLimit = new(int32) + *out.RevisionHistoryLimit = int32(*in.RevisionHistoryLimit) + } + out.MinReadySeconds = int32(in.MinReadySeconds) + out.Paused = in.Paused + if in.RollbackTo != nil { + out.RollbackTo = new(RollbackConfig) + out.RollbackTo.Revision = int64(in.RollbackTo.Revision) + } else { + out.RollbackTo = nil + } return nil } -func convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentSpec, out *extensions.DeploymentSpec, s conversion.Scope) error { +func Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentSpec, out *extensions.DeploymentSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DeploymentSpec))(in) } if in.Replicas != nil { - out.Replicas = *in.Replicas + out.Replicas = int(*in.Replicas) } + if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + out.Selector = new(unversioned.LabelSelector) + if err := Convert_v1beta1_LabelSelector_To_unversioned_LabelSelector(in.Selector, out.Selector, s); err != nil { + return err } } else { out.Selector = nil } - if in.Template != nil { - out.Template = new(api.PodTemplateSpec) - if err := convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil { - return err - } - } else { - out.Template = nil - } - if err := convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { + if err := v1.Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { return err } - if in.UniqueLabelKey != nil { - out.UniqueLabelKey = *in.UniqueLabelKey + if err := Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { + return err + } + if in.RevisionHistoryLimit != nil { + out.RevisionHistoryLimit = new(int) + *out.RevisionHistoryLimit = int(*in.RevisionHistoryLimit) + } + out.MinReadySeconds = int(in.MinReadySeconds) + out.Paused = in.Paused + if in.RollbackTo != nil { + out.RollbackTo = new(extensions.RollbackConfig) + out.RollbackTo.Revision = in.RollbackTo.Revision + } else { + out.RollbackTo = nil } return nil } -func convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(in *extensions.DeploymentStrategy, out *DeploymentStrategy, s conversion.Scope) error { +func Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(in *extensions.DeploymentStrategy, out *DeploymentStrategy, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DeploymentStrategy))(in) } out.Type = DeploymentStrategyType(in.Type) if in.RollingUpdate != nil { out.RollingUpdate = new(RollingUpdateDeployment) - if err := convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in.RollingUpdate, out.RollingUpdate, s); err != nil { + if err := Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in.RollingUpdate, out.RollingUpdate, s); err != nil { return err } } else { @@ -277,14 +179,14 @@ func convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(in *ext return nil } -func convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(in *DeploymentStrategy, out *extensions.DeploymentStrategy, s conversion.Scope) error { +func Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(in *DeploymentStrategy, out *extensions.DeploymentStrategy, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DeploymentStrategy))(in) } out.Type = extensions.DeploymentStrategyType(in.Type) if in.RollingUpdate != nil { out.RollingUpdate = new(extensions.RollingUpdateDeployment) - if err := convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment(in.RollingUpdate, out.RollingUpdate, s); err != nil { + if err := Convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment(in.RollingUpdate, out.RollingUpdate, s); err != nil { return err } } else { @@ -293,27 +195,26 @@ func convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(in *Dep return nil } -func convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in *extensions.RollingUpdateDeployment, out *RollingUpdateDeployment, s conversion.Scope) error { +func Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in *extensions.RollingUpdateDeployment, out *RollingUpdateDeployment, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.RollingUpdateDeployment))(in) } if out.MaxUnavailable == nil { - out.MaxUnavailable = &util.IntOrString{} + out.MaxUnavailable = &intstr.IntOrString{} } if err := s.Convert(&in.MaxUnavailable, out.MaxUnavailable, 0); err != nil { return err } if out.MaxSurge == nil { - out.MaxSurge = &util.IntOrString{} + out.MaxSurge = &intstr.IntOrString{} } if err := s.Convert(&in.MaxSurge, out.MaxSurge, 0); err != nil { return err } - out.MinReadySeconds = in.MinReadySeconds return nil } -func convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment(in *RollingUpdateDeployment, out *extensions.RollingUpdateDeployment, s conversion.Scope) error { +func Convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment(in *RollingUpdateDeployment, out *extensions.RollingUpdateDeployment, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*RollingUpdateDeployment))(in) } @@ -323,64 +224,56 @@ func convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployme if err := s.Convert(in.MaxSurge, &out.MaxSurge, 0); err != nil { return err } - out.MinReadySeconds = in.MinReadySeconds return nil } -func convert_api_PodSecurityContext_To_v1_PodSecurityContext(in *api.PodSecurityContext, out *v1.PodSecurityContext, s conversion.Scope) error { +func Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec(in *extensions.ReplicaSetSpec, out *ReplicaSetSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*api.PodSecurityContext))(in) + defaulting.(func(*extensions.ReplicaSetSpec))(in) } - - out.SupplementalGroups = in.SupplementalGroups - if in.SELinuxOptions != nil { - out.SELinuxOptions = new(v1.SELinuxOptions) - if err := convert_api_SELinuxOptions_To_v1_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + out.Replicas = new(int32) + *out.Replicas = int32(in.Replicas) + if in.Selector != nil { + out.Selector = new(LabelSelector) + if err := Convert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil { return err } } else { - out.SELinuxOptions = nil + out.Selector = nil } - if in.RunAsUser != nil { - out.RunAsUser = new(int64) - *out.RunAsUser = *in.RunAsUser - } else { - out.RunAsUser = nil - } - if in.RunAsNonRoot != nil { - out.RunAsNonRoot = new(bool) - *out.RunAsNonRoot = *in.RunAsNonRoot - } else { - out.RunAsNonRoot = nil - } - return nil -} - -func convert_v1_PodSecurityContext_To_api_PodSecurityContext(in *v1.PodSecurityContext, out *api.PodSecurityContext, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*v1.PodSecurityContext))(in) - } - - out.SupplementalGroups = in.SupplementalGroups - if in.SELinuxOptions != nil { - out.SELinuxOptions = new(api.SELinuxOptions) - if err := convert_v1_SELinuxOptions_To_api_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + if in.Template != nil { + out.Template = new(v1.PodTemplateSpec) + if err := v1.Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil { return err } } else { - out.SELinuxOptions = nil - } - if in.RunAsUser != nil { - out.RunAsUser = new(int64) - *out.RunAsUser = *in.RunAsUser - } else { - out.RunAsUser = nil - } - if in.RunAsNonRoot != nil { - out.RunAsNonRoot = new(bool) - *out.RunAsNonRoot = *in.RunAsNonRoot - } else { - out.RunAsNonRoot = nil + out.Template = nil + } + return nil +} + +func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetSpec, out *extensions.ReplicaSetSpec, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ReplicaSetSpec))(in) + } + if in.Replicas != nil { + out.Replicas = int(*in.Replicas) + } + if in.Selector != nil { + out.Selector = new(unversioned.LabelSelector) + if err := Convert_v1beta1_LabelSelector_To_unversioned_LabelSelector(in.Selector, out.Selector, s); err != nil { + return err + } + } else { + out.Selector = nil + } + if in.Template != nil { + out.Template = new(api.PodTemplateSpec) + if err := v1.Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil { + return err + } + } else { + out.Template = nil } return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/conversion_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/conversion_generated.go index 9543babfa..f1c50ad2a 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/conversion_generated.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/conversion_generated.go @@ -23,27 +23,42 @@ import ( api "k8s.io/kubernetes/pkg/api" resource "k8s.io/kubernetes/pkg/api/resource" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" v1 "k8s.io/kubernetes/pkg/api/v1" extensions "k8s.io/kubernetes/pkg/apis/extensions" conversion "k8s.io/kubernetes/pkg/conversion" ) -func autoconvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *api.AWSElasticBlockStoreVolumeSource, out *v1.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { +func autoConvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *api.AWSElasticBlockStoreVolumeSource, out *v1.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.AWSElasticBlockStoreVolumeSource))(in) } out.VolumeID = in.VolumeID out.FSType = in.FSType - out.Partition = in.Partition + out.Partition = int32(in.Partition) out.ReadOnly = in.ReadOnly return nil } -func convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *api.AWSElasticBlockStoreVolumeSource, out *v1.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { - return autoconvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in, out, s) +func Convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *api.AWSElasticBlockStoreVolumeSource, out *v1.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { + return autoConvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in, out, s) } -func autoconvert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out *v1.Capabilities, s conversion.Scope) error { +func autoConvert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource(in *api.AzureFileVolumeSource, out *v1.AzureFileVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.AzureFileVolumeSource))(in) + } + out.SecretName = in.SecretName + out.ShareName = in.ShareName + out.ReadOnly = in.ReadOnly + return nil +} + +func Convert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource(in *api.AzureFileVolumeSource, out *v1.AzureFileVolumeSource, s conversion.Scope) error { + return autoConvert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource(in, out, s) +} + +func autoConvert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out *v1.Capabilities, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Capabilities))(in) } @@ -66,11 +81,11 @@ func autoconvert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out * return nil } -func convert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out *v1.Capabilities, s conversion.Scope) error { - return autoconvert_api_Capabilities_To_v1_Capabilities(in, out, s) +func Convert_api_Capabilities_To_v1_Capabilities(in *api.Capabilities, out *v1.Capabilities, s conversion.Scope) error { + return autoConvert_api_Capabilities_To_v1_Capabilities(in, out, s) } -func autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSVolumeSource, out *v1.CephFSVolumeSource, s conversion.Scope) error { +func autoConvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSVolumeSource, out *v1.CephFSVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.CephFSVolumeSource))(in) } @@ -82,11 +97,13 @@ func autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSV } else { out.Monitors = nil } + out.Path = in.Path out.User = in.User out.SecretFile = in.SecretFile + // unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference if in.SecretRef != nil { out.SecretRef = new(v1.LocalObjectReference) - if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { return err } } else { @@ -96,11 +113,11 @@ func autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSV return nil } -func convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSVolumeSource, out *v1.CephFSVolumeSource, s conversion.Scope) error { - return autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in, out, s) +func Convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSVolumeSource, out *v1.CephFSVolumeSource, s conversion.Scope) error { + return autoConvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in, out, s) } -func autoconvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderVolumeSource, out *v1.CinderVolumeSource, s conversion.Scope) error { +func autoConvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderVolumeSource, out *v1.CinderVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.CinderVolumeSource))(in) } @@ -110,11 +127,50 @@ func autoconvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderV return nil } -func convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderVolumeSource, out *v1.CinderVolumeSource, s conversion.Scope) error { - return autoconvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in, out, s) +func Convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in *api.CinderVolumeSource, out *v1.CinderVolumeSource, s conversion.Scope) error { + return autoConvert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in, out, s) } -func autoconvert_api_Container_To_v1_Container(in *api.Container, out *v1.Container, s conversion.Scope) error { +func autoConvert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector(in *api.ConfigMapKeySelector, out *v1.ConfigMapKeySelector, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.ConfigMapKeySelector))(in) + } + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func Convert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector(in *api.ConfigMapKeySelector, out *v1.ConfigMapKeySelector, s conversion.Scope) error { + return autoConvert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector(in, out, s) +} + +func autoConvert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in *api.ConfigMapVolumeSource, out *v1.ConfigMapVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.ConfigMapVolumeSource))(in) + } + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]v1.KeyToPath, len(in.Items)) + for i := range in.Items { + if err := Convert_api_KeyToPath_To_v1_KeyToPath(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in *api.ConfigMapVolumeSource, out *v1.ConfigMapVolumeSource, s conversion.Scope) error { + return autoConvert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in, out, s) +} + +func autoConvert_api_Container_To_v1_Container(in *api.Container, out *v1.Container, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Container))(in) } @@ -140,7 +196,7 @@ func autoconvert_api_Container_To_v1_Container(in *api.Container, out *v1.Contai if in.Ports != nil { out.Ports = make([]v1.ContainerPort, len(in.Ports)) for i := range in.Ports { - if err := convert_api_ContainerPort_To_v1_ContainerPort(&in.Ports[i], &out.Ports[i], s); err != nil { + if err := Convert_api_ContainerPort_To_v1_ContainerPort(&in.Ports[i], &out.Ports[i], s); err != nil { return err } } @@ -150,45 +206,48 @@ func autoconvert_api_Container_To_v1_Container(in *api.Container, out *v1.Contai if in.Env != nil { out.Env = make([]v1.EnvVar, len(in.Env)) for i := range in.Env { - if err := convert_api_EnvVar_To_v1_EnvVar(&in.Env[i], &out.Env[i], s); err != nil { + if err := Convert_api_EnvVar_To_v1_EnvVar(&in.Env[i], &out.Env[i], s); err != nil { return err } } } else { out.Env = nil } - if err := convert_api_ResourceRequirements_To_v1_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { + if err := Convert_api_ResourceRequirements_To_v1_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { return err } if in.VolumeMounts != nil { out.VolumeMounts = make([]v1.VolumeMount, len(in.VolumeMounts)) for i := range in.VolumeMounts { - if err := convert_api_VolumeMount_To_v1_VolumeMount(&in.VolumeMounts[i], &out.VolumeMounts[i], s); err != nil { + if err := Convert_api_VolumeMount_To_v1_VolumeMount(&in.VolumeMounts[i], &out.VolumeMounts[i], s); err != nil { return err } } } else { out.VolumeMounts = nil } + // unable to generate simple pointer conversion for api.Probe -> v1.Probe if in.LivenessProbe != nil { out.LivenessProbe = new(v1.Probe) - if err := convert_api_Probe_To_v1_Probe(in.LivenessProbe, out.LivenessProbe, s); err != nil { + if err := Convert_api_Probe_To_v1_Probe(in.LivenessProbe, out.LivenessProbe, s); err != nil { return err } } else { out.LivenessProbe = nil } + // unable to generate simple pointer conversion for api.Probe -> v1.Probe if in.ReadinessProbe != nil { out.ReadinessProbe = new(v1.Probe) - if err := convert_api_Probe_To_v1_Probe(in.ReadinessProbe, out.ReadinessProbe, s); err != nil { + if err := Convert_api_Probe_To_v1_Probe(in.ReadinessProbe, out.ReadinessProbe, s); err != nil { return err } } else { out.ReadinessProbe = nil } + // unable to generate simple pointer conversion for api.Lifecycle -> v1.Lifecycle if in.Lifecycle != nil { out.Lifecycle = new(v1.Lifecycle) - if err := convert_api_Lifecycle_To_v1_Lifecycle(in.Lifecycle, out.Lifecycle, s); err != nil { + if err := Convert_api_Lifecycle_To_v1_Lifecycle(in.Lifecycle, out.Lifecycle, s); err != nil { return err } } else { @@ -196,9 +255,10 @@ func autoconvert_api_Container_To_v1_Container(in *api.Container, out *v1.Contai } out.TerminationMessagePath = in.TerminationMessagePath out.ImagePullPolicy = v1.PullPolicy(in.ImagePullPolicy) + // unable to generate simple pointer conversion for api.SecurityContext -> v1.SecurityContext if in.SecurityContext != nil { out.SecurityContext = new(v1.SecurityContext) - if err := convert_api_SecurityContext_To_v1_SecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { + if err := Convert_api_SecurityContext_To_v1_SecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { return err } } else { @@ -210,49 +270,49 @@ func autoconvert_api_Container_To_v1_Container(in *api.Container, out *v1.Contai return nil } -func convert_api_Container_To_v1_Container(in *api.Container, out *v1.Container, s conversion.Scope) error { - return autoconvert_api_Container_To_v1_Container(in, out, s) +func Convert_api_Container_To_v1_Container(in *api.Container, out *v1.Container, s conversion.Scope) error { + return autoConvert_api_Container_To_v1_Container(in, out, s) } -func autoconvert_api_ContainerPort_To_v1_ContainerPort(in *api.ContainerPort, out *v1.ContainerPort, s conversion.Scope) error { +func autoConvert_api_ContainerPort_To_v1_ContainerPort(in *api.ContainerPort, out *v1.ContainerPort, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ContainerPort))(in) } out.Name = in.Name - out.HostPort = in.HostPort - out.ContainerPort = in.ContainerPort + out.HostPort = int32(in.HostPort) + out.ContainerPort = int32(in.ContainerPort) out.Protocol = v1.Protocol(in.Protocol) out.HostIP = in.HostIP return nil } -func convert_api_ContainerPort_To_v1_ContainerPort(in *api.ContainerPort, out *v1.ContainerPort, s conversion.Scope) error { - return autoconvert_api_ContainerPort_To_v1_ContainerPort(in, out, s) +func Convert_api_ContainerPort_To_v1_ContainerPort(in *api.ContainerPort, out *v1.ContainerPort, s conversion.Scope) error { + return autoConvert_api_ContainerPort_To_v1_ContainerPort(in, out, s) } -func autoconvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in *api.DownwardAPIVolumeFile, out *v1.DownwardAPIVolumeFile, s conversion.Scope) error { +func autoConvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in *api.DownwardAPIVolumeFile, out *v1.DownwardAPIVolumeFile, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.DownwardAPIVolumeFile))(in) } out.Path = in.Path - if err := convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(&in.FieldRef, &out.FieldRef, s); err != nil { + if err := Convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(&in.FieldRef, &out.FieldRef, s); err != nil { return err } return nil } -func convert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in *api.DownwardAPIVolumeFile, out *v1.DownwardAPIVolumeFile, s conversion.Scope) error { - return autoconvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in, out, s) +func Convert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in *api.DownwardAPIVolumeFile, out *v1.DownwardAPIVolumeFile, s conversion.Scope) error { + return autoConvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(in, out, s) } -func autoconvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *api.DownwardAPIVolumeSource, out *v1.DownwardAPIVolumeSource, s conversion.Scope) error { +func autoConvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *api.DownwardAPIVolumeSource, out *v1.DownwardAPIVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.DownwardAPIVolumeSource))(in) } if in.Items != nil { out.Items = make([]v1.DownwardAPIVolumeFile, len(in.Items)) for i := range in.Items { - if err := convert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -262,11 +322,11 @@ func autoconvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *a return nil } -func convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *api.DownwardAPIVolumeSource, out *v1.DownwardAPIVolumeSource, s conversion.Scope) error { - return autoconvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in, out, s) +func Convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in *api.DownwardAPIVolumeSource, out *v1.DownwardAPIVolumeSource, s conversion.Scope) error { + return autoConvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in, out, s) } -func autoconvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.EmptyDirVolumeSource, out *v1.EmptyDirVolumeSource, s conversion.Scope) error { +func autoConvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.EmptyDirVolumeSource, out *v1.EmptyDirVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EmptyDirVolumeSource))(in) } @@ -274,19 +334,20 @@ func autoconvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.Emp return nil } -func convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.EmptyDirVolumeSource, out *v1.EmptyDirVolumeSource, s conversion.Scope) error { - return autoconvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in, out, s) +func Convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *api.EmptyDirVolumeSource, out *v1.EmptyDirVolumeSource, s conversion.Scope) error { + return autoConvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in, out, s) } -func autoconvert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *v1.EnvVar, s conversion.Scope) error { +func autoConvert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *v1.EnvVar, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EnvVar))(in) } out.Name = in.Name out.Value = in.Value + // unable to generate simple pointer conversion for api.EnvVarSource -> v1.EnvVarSource if in.ValueFrom != nil { out.ValueFrom = new(v1.EnvVarSource) - if err := convert_api_EnvVarSource_To_v1_EnvVarSource(in.ValueFrom, out.ValueFrom, s); err != nil { + if err := Convert_api_EnvVarSource_To_v1_EnvVarSource(in.ValueFrom, out.ValueFrom, s); err != nil { return err } } else { @@ -295,30 +356,49 @@ func autoconvert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *v1.EnvVar, s conve return nil } -func convert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *v1.EnvVar, s conversion.Scope) error { - return autoconvert_api_EnvVar_To_v1_EnvVar(in, out, s) +func Convert_api_EnvVar_To_v1_EnvVar(in *api.EnvVar, out *v1.EnvVar, s conversion.Scope) error { + return autoConvert_api_EnvVar_To_v1_EnvVar(in, out, s) } -func autoconvert_api_EnvVarSource_To_v1_EnvVarSource(in *api.EnvVarSource, out *v1.EnvVarSource, s conversion.Scope) error { +func autoConvert_api_EnvVarSource_To_v1_EnvVarSource(in *api.EnvVarSource, out *v1.EnvVarSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.EnvVarSource))(in) } + // unable to generate simple pointer conversion for api.ObjectFieldSelector -> v1.ObjectFieldSelector if in.FieldRef != nil { out.FieldRef = new(v1.ObjectFieldSelector) - if err := convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in.FieldRef, out.FieldRef, s); err != nil { + if err := Convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in.FieldRef, out.FieldRef, s); err != nil { return err } } else { out.FieldRef = nil } + // unable to generate simple pointer conversion for api.ConfigMapKeySelector -> v1.ConfigMapKeySelector + if in.ConfigMapKeyRef != nil { + out.ConfigMapKeyRef = new(v1.ConfigMapKeySelector) + if err := Convert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector(in.ConfigMapKeyRef, out.ConfigMapKeyRef, s); err != nil { + return err + } + } else { + out.ConfigMapKeyRef = nil + } + // unable to generate simple pointer conversion for api.SecretKeySelector -> v1.SecretKeySelector + if in.SecretKeyRef != nil { + out.SecretKeyRef = new(v1.SecretKeySelector) + if err := Convert_api_SecretKeySelector_To_v1_SecretKeySelector(in.SecretKeyRef, out.SecretKeyRef, s); err != nil { + return err + } + } else { + out.SecretKeyRef = nil + } return nil } -func convert_api_EnvVarSource_To_v1_EnvVarSource(in *api.EnvVarSource, out *v1.EnvVarSource, s conversion.Scope) error { - return autoconvert_api_EnvVarSource_To_v1_EnvVarSource(in, out, s) +func Convert_api_EnvVarSource_To_v1_EnvVarSource(in *api.EnvVarSource, out *v1.EnvVarSource, s conversion.Scope) error { + return autoConvert_api_EnvVarSource_To_v1_EnvVarSource(in, out, s) } -func autoconvert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *v1.ExecAction, s conversion.Scope) error { +func autoConvert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *v1.ExecAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ExecAction))(in) } @@ -333,11 +413,11 @@ func autoconvert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *v1.Exe return nil } -func convert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *v1.ExecAction, s conversion.Scope) error { - return autoconvert_api_ExecAction_To_v1_ExecAction(in, out, s) +func Convert_api_ExecAction_To_v1_ExecAction(in *api.ExecAction, out *v1.ExecAction, s conversion.Scope) error { + return autoConvert_api_ExecAction_To_v1_ExecAction(in, out, s) } -func autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out *v1.FCVolumeSource, s conversion.Scope) error { +func autoConvert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out *v1.FCVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.FCVolumeSource))(in) } @@ -350,8 +430,8 @@ func autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out.TargetWWNs = nil } if in.Lun != nil { - out.Lun = new(int) - *out.Lun = *in.Lun + out.Lun = new(int32) + *out.Lun = int32(*in.Lun) } else { out.Lun = nil } @@ -360,11 +440,42 @@ func autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, return nil } -func convert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out *v1.FCVolumeSource, s conversion.Scope) error { - return autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource(in, out, s) +func Convert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out *v1.FCVolumeSource, s conversion.Scope) error { + return autoConvert_api_FCVolumeSource_To_v1_FCVolumeSource(in, out, s) } -func autoconvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.FlockerVolumeSource, out *v1.FlockerVolumeSource, s conversion.Scope) error { +func autoConvert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in *api.FlexVolumeSource, out *v1.FlexVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.FlexVolumeSource))(in) + } + out.Driver = in.Driver + out.FSType = in.FSType + // unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference + if in.SecretRef != nil { + out.SecretRef = new(v1.LocalObjectReference) + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + return err + } + } else { + out.SecretRef = nil + } + out.ReadOnly = in.ReadOnly + if in.Options != nil { + out.Options = make(map[string]string) + for key, val := range in.Options { + out.Options[key] = val + } + } else { + out.Options = nil + } + return nil +} + +func Convert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in *api.FlexVolumeSource, out *v1.FlexVolumeSource, s conversion.Scope) error { + return autoConvert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in, out, s) +} + +func autoConvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.FlockerVolumeSource, out *v1.FlockerVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.FlockerVolumeSource))(in) } @@ -372,39 +483,40 @@ func autoconvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.Flock return nil } -func convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.FlockerVolumeSource, out *v1.FlockerVolumeSource, s conversion.Scope) error { - return autoconvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in, out, s) +func Convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.FlockerVolumeSource, out *v1.FlockerVolumeSource, s conversion.Scope) error { + return autoConvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in, out, s) } -func autoconvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in *api.GCEPersistentDiskVolumeSource, out *v1.GCEPersistentDiskVolumeSource, s conversion.Scope) error { +func autoConvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in *api.GCEPersistentDiskVolumeSource, out *v1.GCEPersistentDiskVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.GCEPersistentDiskVolumeSource))(in) } out.PDName = in.PDName out.FSType = in.FSType - out.Partition = in.Partition + out.Partition = int32(in.Partition) out.ReadOnly = in.ReadOnly return nil } -func convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in *api.GCEPersistentDiskVolumeSource, out *v1.GCEPersistentDiskVolumeSource, s conversion.Scope) error { - return autoconvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in, out, s) +func Convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in *api.GCEPersistentDiskVolumeSource, out *v1.GCEPersistentDiskVolumeSource, s conversion.Scope) error { + return autoConvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in, out, s) } -func autoconvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in *api.GitRepoVolumeSource, out *v1.GitRepoVolumeSource, s conversion.Scope) error { +func autoConvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in *api.GitRepoVolumeSource, out *v1.GitRepoVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.GitRepoVolumeSource))(in) } out.Repository = in.Repository out.Revision = in.Revision + out.Directory = in.Directory return nil } -func convert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in *api.GitRepoVolumeSource, out *v1.GitRepoVolumeSource, s conversion.Scope) error { - return autoconvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in, out, s) +func Convert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in *api.GitRepoVolumeSource, out *v1.GitRepoVolumeSource, s conversion.Scope) error { + return autoConvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in, out, s) } -func autoconvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.GlusterfsVolumeSource, out *v1.GlusterfsVolumeSource, s conversion.Scope) error { +func autoConvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.GlusterfsVolumeSource, out *v1.GlusterfsVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.GlusterfsVolumeSource))(in) } @@ -414,50 +526,76 @@ func autoconvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.G return nil } -func convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.GlusterfsVolumeSource, out *v1.GlusterfsVolumeSource, s conversion.Scope) error { - return autoconvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in, out, s) +func Convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in *api.GlusterfsVolumeSource, out *v1.GlusterfsVolumeSource, s conversion.Scope) error { + return autoConvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in, out, s) } -func autoconvert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, out *v1.HTTPGetAction, s conversion.Scope) error { +func autoConvert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, out *v1.HTTPGetAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.HTTPGetAction))(in) } out.Path = in.Path - if err := s.Convert(&in.Port, &out.Port, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.Port, &out.Port, s); err != nil { return err } out.Host = in.Host out.Scheme = v1.URIScheme(in.Scheme) + if in.HTTPHeaders != nil { + out.HTTPHeaders = make([]v1.HTTPHeader, len(in.HTTPHeaders)) + for i := range in.HTTPHeaders { + if err := Convert_api_HTTPHeader_To_v1_HTTPHeader(&in.HTTPHeaders[i], &out.HTTPHeaders[i], s); err != nil { + return err + } + } + } else { + out.HTTPHeaders = nil + } return nil } -func convert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, out *v1.HTTPGetAction, s conversion.Scope) error { - return autoconvert_api_HTTPGetAction_To_v1_HTTPGetAction(in, out, s) +func Convert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, out *v1.HTTPGetAction, s conversion.Scope) error { + return autoConvert_api_HTTPGetAction_To_v1_HTTPGetAction(in, out, s) } -func autoconvert_api_Handler_To_v1_Handler(in *api.Handler, out *v1.Handler, s conversion.Scope) error { +func autoConvert_api_HTTPHeader_To_v1_HTTPHeader(in *api.HTTPHeader, out *v1.HTTPHeader, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.HTTPHeader))(in) + } + out.Name = in.Name + out.Value = in.Value + return nil +} + +func Convert_api_HTTPHeader_To_v1_HTTPHeader(in *api.HTTPHeader, out *v1.HTTPHeader, s conversion.Scope) error { + return autoConvert_api_HTTPHeader_To_v1_HTTPHeader(in, out, s) +} + +func autoConvert_api_Handler_To_v1_Handler(in *api.Handler, out *v1.Handler, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Handler))(in) } + // unable to generate simple pointer conversion for api.ExecAction -> v1.ExecAction if in.Exec != nil { out.Exec = new(v1.ExecAction) - if err := convert_api_ExecAction_To_v1_ExecAction(in.Exec, out.Exec, s); err != nil { + if err := Convert_api_ExecAction_To_v1_ExecAction(in.Exec, out.Exec, s); err != nil { return err } } else { out.Exec = nil } + // unable to generate simple pointer conversion for api.HTTPGetAction -> v1.HTTPGetAction if in.HTTPGet != nil { out.HTTPGet = new(v1.HTTPGetAction) - if err := convert_api_HTTPGetAction_To_v1_HTTPGetAction(in.HTTPGet, out.HTTPGet, s); err != nil { + if err := Convert_api_HTTPGetAction_To_v1_HTTPGetAction(in.HTTPGet, out.HTTPGet, s); err != nil { return err } } else { out.HTTPGet = nil } + // unable to generate simple pointer conversion for api.TCPSocketAction -> v1.TCPSocketAction if in.TCPSocket != nil { out.TCPSocket = new(v1.TCPSocketAction) - if err := convert_api_TCPSocketAction_To_v1_TCPSocketAction(in.TCPSocket, out.TCPSocket, s); err != nil { + if err := Convert_api_TCPSocketAction_To_v1_TCPSocketAction(in.TCPSocket, out.TCPSocket, s); err != nil { return err } } else { @@ -466,11 +604,11 @@ func autoconvert_api_Handler_To_v1_Handler(in *api.Handler, out *v1.Handler, s c return nil } -func convert_api_Handler_To_v1_Handler(in *api.Handler, out *v1.Handler, s conversion.Scope) error { - return autoconvert_api_Handler_To_v1_Handler(in, out, s) +func Convert_api_Handler_To_v1_Handler(in *api.Handler, out *v1.Handler, s conversion.Scope) error { + return autoConvert_api_Handler_To_v1_Handler(in, out, s) } -func autoconvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.HostPathVolumeSource, out *v1.HostPathVolumeSource, s conversion.Scope) error { +func autoConvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.HostPathVolumeSource, out *v1.HostPathVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.HostPathVolumeSource))(in) } @@ -478,41 +616,57 @@ func autoconvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.Hos return nil } -func convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.HostPathVolumeSource, out *v1.HostPathVolumeSource, s conversion.Scope) error { - return autoconvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in, out, s) +func Convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in *api.HostPathVolumeSource, out *v1.HostPathVolumeSource, s conversion.Scope) error { + return autoConvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in, out, s) } -func autoconvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolumeSource, out *v1.ISCSIVolumeSource, s conversion.Scope) error { +func autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolumeSource, out *v1.ISCSIVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ISCSIVolumeSource))(in) } out.TargetPortal = in.TargetPortal out.IQN = in.IQN - out.Lun = in.Lun + out.Lun = int32(in.Lun) + out.ISCSIInterface = in.ISCSIInterface out.FSType = in.FSType out.ReadOnly = in.ReadOnly return nil } -func convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolumeSource, out *v1.ISCSIVolumeSource, s conversion.Scope) error { - return autoconvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in, out, s) +func Convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolumeSource, out *v1.ISCSIVolumeSource, s conversion.Scope) error { + return autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in, out, s) } -func autoconvert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *v1.Lifecycle, s conversion.Scope) error { +func autoConvert_api_KeyToPath_To_v1_KeyToPath(in *api.KeyToPath, out *v1.KeyToPath, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.KeyToPath))(in) + } + out.Key = in.Key + out.Path = in.Path + return nil +} + +func Convert_api_KeyToPath_To_v1_KeyToPath(in *api.KeyToPath, out *v1.KeyToPath, s conversion.Scope) error { + return autoConvert_api_KeyToPath_To_v1_KeyToPath(in, out, s) +} + +func autoConvert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *v1.Lifecycle, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Lifecycle))(in) } + // unable to generate simple pointer conversion for api.Handler -> v1.Handler if in.PostStart != nil { out.PostStart = new(v1.Handler) - if err := convert_api_Handler_To_v1_Handler(in.PostStart, out.PostStart, s); err != nil { + if err := Convert_api_Handler_To_v1_Handler(in.PostStart, out.PostStart, s); err != nil { return err } } else { out.PostStart = nil } + // unable to generate simple pointer conversion for api.Handler -> v1.Handler if in.PreStop != nil { out.PreStop = new(v1.Handler) - if err := convert_api_Handler_To_v1_Handler(in.PreStop, out.PreStop, s); err != nil { + if err := Convert_api_Handler_To_v1_Handler(in.PreStop, out.PreStop, s); err != nil { return err } } else { @@ -521,11 +675,39 @@ func autoconvert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *v1.Lifecy return nil } -func convert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *v1.Lifecycle, s conversion.Scope) error { - return autoconvert_api_Lifecycle_To_v1_Lifecycle(in, out, s) +func Convert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *v1.Lifecycle, s conversion.Scope) error { + return autoConvert_api_Lifecycle_To_v1_Lifecycle(in, out, s) } -func autoconvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadBalancerIngress, out *v1.LoadBalancerIngress, s conversion.Scope) error { +func autoConvert_api_ListOptions_To_v1beta1_ListOptions(in *api.ListOptions, out *ListOptions, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.ListOptions))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + if err := api.Convert_labels_Selector_To_string(&in.LabelSelector, &out.LabelSelector, s); err != nil { + return err + } + if err := api.Convert_fields_Selector_To_string(&in.FieldSelector, &out.FieldSelector, s); err != nil { + return err + } + out.Watch = in.Watch + out.ResourceVersion = in.ResourceVersion + if in.TimeoutSeconds != nil { + out.TimeoutSeconds = new(int64) + *out.TimeoutSeconds = *in.TimeoutSeconds + } else { + out.TimeoutSeconds = nil + } + return nil +} + +func Convert_api_ListOptions_To_v1beta1_ListOptions(in *api.ListOptions, out *ListOptions, s conversion.Scope) error { + return autoConvert_api_ListOptions_To_v1beta1_ListOptions(in, out, s) +} + +func autoConvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadBalancerIngress, out *v1.LoadBalancerIngress, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.LoadBalancerIngress))(in) } @@ -534,18 +716,18 @@ func autoconvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadB return nil } -func convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadBalancerIngress, out *v1.LoadBalancerIngress, s conversion.Scope) error { - return autoconvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in, out, s) +func Convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadBalancerIngress, out *v1.LoadBalancerIngress, s conversion.Scope) error { + return autoConvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in, out, s) } -func autoconvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBalancerStatus, out *v1.LoadBalancerStatus, s conversion.Scope) error { +func autoConvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBalancerStatus, out *v1.LoadBalancerStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.LoadBalancerStatus))(in) } if in.Ingress != nil { out.Ingress = make([]v1.LoadBalancerIngress, len(in.Ingress)) for i := range in.Ingress { - if err := convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { + if err := Convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { return err } } @@ -555,11 +737,11 @@ func autoconvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBal return nil } -func convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBalancerStatus, out *v1.LoadBalancerStatus, s conversion.Scope) error { - return autoconvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in, out, s) +func Convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBalancerStatus, out *v1.LoadBalancerStatus, s conversion.Scope) error { + return autoConvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in, out, s) } -func autoconvert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalObjectReference, out *v1.LocalObjectReference, s conversion.Scope) error { +func autoConvert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalObjectReference, out *v1.LocalObjectReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.LocalObjectReference))(in) } @@ -567,11 +749,11 @@ func autoconvert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.Loc return nil } -func convert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalObjectReference, out *v1.LocalObjectReference, s conversion.Scope) error { - return autoconvert_api_LocalObjectReference_To_v1_LocalObjectReference(in, out, s) +func Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalObjectReference, out *v1.LocalObjectReference, s conversion.Scope) error { + return autoConvert_api_LocalObjectReference_To_v1_LocalObjectReference(in, out, s) } -func autoconvert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in *api.NFSVolumeSource, out *v1.NFSVolumeSource, s conversion.Scope) error { +func autoConvert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in *api.NFSVolumeSource, out *v1.NFSVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.NFSVolumeSource))(in) } @@ -581,11 +763,11 @@ func autoconvert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in *api.NFSVolumeSour return nil } -func convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in *api.NFSVolumeSource, out *v1.NFSVolumeSource, s conversion.Scope) error { - return autoconvert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in, out, s) +func Convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in *api.NFSVolumeSource, out *v1.NFSVolumeSource, s conversion.Scope) error { + return autoConvert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in, out, s) } -func autoconvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.ObjectFieldSelector, out *v1.ObjectFieldSelector, s conversion.Scope) error { +func autoConvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.ObjectFieldSelector, out *v1.ObjectFieldSelector, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ObjectFieldSelector))(in) } @@ -594,11 +776,11 @@ func autoconvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.Objec return nil } -func convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.ObjectFieldSelector, out *v1.ObjectFieldSelector, s conversion.Scope) error { - return autoconvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in, out, s) +func Convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in *api.ObjectFieldSelector, out *v1.ObjectFieldSelector, s conversion.Scope) error { + return autoConvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector(in, out, s) } -func autoconvert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *v1.ObjectMeta, s conversion.Scope) error { +func autoConvert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *v1.ObjectMeta, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ObjectMeta))(in) } @@ -609,11 +791,13 @@ func autoconvert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *v1.Obj out.UID = in.UID out.ResourceVersion = in.ResourceVersion out.Generation = in.Generation - if err := s.Convert(&in.CreationTimestamp, &out.CreationTimestamp, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.CreationTimestamp, &out.CreationTimestamp, s); err != nil { return err } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.DeletionTimestamp != nil { - if err := s.Convert(&in.DeletionTimestamp, &out.DeletionTimestamp, 0); err != nil { + out.DeletionTimestamp = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.DeletionTimestamp, out.DeletionTimestamp, s); err != nil { return err } } else { @@ -644,11 +828,11 @@ func autoconvert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *v1.Obj return nil } -func convert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *v1.ObjectMeta, s conversion.Scope) error { - return autoconvert_api_ObjectMeta_To_v1_ObjectMeta(in, out, s) +func Convert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *v1.ObjectMeta, s conversion.Scope) error { + return autoConvert_api_ObjectMeta_To_v1_ObjectMeta(in, out, s) } -func autoconvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in *api.PersistentVolumeClaimVolumeSource, out *v1.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { +func autoConvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in *api.PersistentVolumeClaimVolumeSource, out *v1.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PersistentVolumeClaimVolumeSource))(in) } @@ -657,18 +841,18 @@ func autoconvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeCla return nil } -func convert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in *api.PersistentVolumeClaimVolumeSource, out *v1.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { - return autoconvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in, out, s) +func Convert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in *api.PersistentVolumeClaimVolumeSource, out *v1.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { + return autoConvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in, out, s) } -func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *v1.PodSpec, s conversion.Scope) error { +func autoConvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *v1.PodSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodSpec))(in) } if in.Volumes != nil { out.Volumes = make([]v1.Volume, len(in.Volumes)) for i := range in.Volumes { - if err := convert_api_Volume_To_v1_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { + if err := Convert_api_Volume_To_v1_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { return err } } @@ -678,7 +862,7 @@ func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *v1.PodSpec, s c if in.Containers != nil { out.Containers = make([]v1.Container, len(in.Containers)) for i := range in.Containers { - if err := convert_api_Container_To_v1_Container(&in.Containers[i], &out.Containers[i], s); err != nil { + if err := Convert_api_Container_To_v1_Container(&in.Containers[i], &out.Containers[i], s); err != nil { return err } } @@ -709,6 +893,7 @@ func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *v1.PodSpec, s c } out.ServiceAccountName = in.ServiceAccountName out.NodeName = in.NodeName + // unable to generate simple pointer conversion for api.PodSecurityContext -> v1.PodSecurityContext if in.SecurityContext != nil { if err := s.Convert(&in.SecurityContext, &out.SecurityContext, 0); err != nil { return err @@ -719,7 +904,7 @@ func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *v1.PodSpec, s c if in.ImagePullSecrets != nil { out.ImagePullSecrets = make([]v1.LocalObjectReference, len(in.ImagePullSecrets)) for i := range in.ImagePullSecrets { - if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { return err } } @@ -729,40 +914,43 @@ func autoconvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *v1.PodSpec, s c return nil } -func autoconvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSpec, out *v1.PodTemplateSpec, s conversion.Scope) error { +func autoConvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSpec, out *v1.PodTemplateSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.PodTemplateSpec))(in) } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_api_PodSpec_To_v1_PodSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_api_PodSpec_To_v1_PodSpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSpec, out *v1.PodTemplateSpec, s conversion.Scope) error { - return autoconvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in, out, s) +func Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSpec, out *v1.PodTemplateSpec, s conversion.Scope) error { + return autoConvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in, out, s) } -func autoconvert_api_Probe_To_v1_Probe(in *api.Probe, out *v1.Probe, s conversion.Scope) error { +func autoConvert_api_Probe_To_v1_Probe(in *api.Probe, out *v1.Probe, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Probe))(in) } - if err := convert_api_Handler_To_v1_Handler(&in.Handler, &out.Handler, s); err != nil { + if err := Convert_api_Handler_To_v1_Handler(&in.Handler, &out.Handler, s); err != nil { return err } - out.InitialDelaySeconds = in.InitialDelaySeconds - out.TimeoutSeconds = in.TimeoutSeconds + out.InitialDelaySeconds = int32(in.InitialDelaySeconds) + out.TimeoutSeconds = int32(in.TimeoutSeconds) + out.PeriodSeconds = int32(in.PeriodSeconds) + out.SuccessThreshold = int32(in.SuccessThreshold) + out.FailureThreshold = int32(in.FailureThreshold) return nil } -func convert_api_Probe_To_v1_Probe(in *api.Probe, out *v1.Probe, s conversion.Scope) error { - return autoconvert_api_Probe_To_v1_Probe(in, out, s) +func Convert_api_Probe_To_v1_Probe(in *api.Probe, out *v1.Probe, s conversion.Scope) error { + return autoConvert_api_Probe_To_v1_Probe(in, out, s) } -func autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSource, out *v1.RBDVolumeSource, s conversion.Scope) error { +func autoConvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSource, out *v1.RBDVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.RBDVolumeSource))(in) } @@ -779,9 +967,10 @@ func autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSour out.RBDPool = in.RBDPool out.RadosUser = in.RadosUser out.Keyring = in.Keyring + // unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference if in.SecretRef != nil { out.SecretRef = new(v1.LocalObjectReference) - if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { return err } } else { @@ -791,11 +980,11 @@ func autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSour return nil } -func convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSource, out *v1.RBDVolumeSource, s conversion.Scope) error { - return autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in, out, s) +func Convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in *api.RBDVolumeSource, out *v1.RBDVolumeSource, s conversion.Scope) error { + return autoConvert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in, out, s) } -func autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.ResourceRequirements, out *v1.ResourceRequirements, s conversion.Scope) error { +func autoConvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.ResourceRequirements, out *v1.ResourceRequirements, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ResourceRequirements))(in) } @@ -803,7 +992,7 @@ func autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.Res out.Limits = make(v1.ResourceList) for key, val := range in.Limits { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Limits[v1.ResourceName(key)] = newVal @@ -815,7 +1004,7 @@ func autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.Res out.Requests = make(v1.ResourceList) for key, val := range in.Requests { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Requests[v1.ResourceName(key)] = newVal @@ -826,11 +1015,11 @@ func autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.Res return nil } -func convert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.ResourceRequirements, out *v1.ResourceRequirements, s conversion.Scope) error { - return autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements(in, out, s) +func Convert_api_ResourceRequirements_To_v1_ResourceRequirements(in *api.ResourceRequirements, out *v1.ResourceRequirements, s conversion.Scope) error { + return autoConvert_api_ResourceRequirements_To_v1_ResourceRequirements(in, out, s) } -func autoconvert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out *v1.SELinuxOptions, s conversion.Scope) error { +func autoConvert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out *v1.SELinuxOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.SELinuxOptions))(in) } @@ -841,11 +1030,26 @@ func autoconvert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, return nil } -func convert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out *v1.SELinuxOptions, s conversion.Scope) error { - return autoconvert_api_SELinuxOptions_To_v1_SELinuxOptions(in, out, s) +func Convert_api_SELinuxOptions_To_v1_SELinuxOptions(in *api.SELinuxOptions, out *v1.SELinuxOptions, s conversion.Scope) error { + return autoConvert_api_SELinuxOptions_To_v1_SELinuxOptions(in, out, s) } -func autoconvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretVolumeSource, out *v1.SecretVolumeSource, s conversion.Scope) error { +func autoConvert_api_SecretKeySelector_To_v1_SecretKeySelector(in *api.SecretKeySelector, out *v1.SecretKeySelector, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.SecretKeySelector))(in) + } + if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func Convert_api_SecretKeySelector_To_v1_SecretKeySelector(in *api.SecretKeySelector, out *v1.SecretKeySelector, s conversion.Scope) error { + return autoConvert_api_SecretKeySelector_To_v1_SecretKeySelector(in, out, s) +} + +func autoConvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretVolumeSource, out *v1.SecretVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.SecretVolumeSource))(in) } @@ -853,17 +1057,18 @@ func autoconvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretV return nil } -func convert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretVolumeSource, out *v1.SecretVolumeSource, s conversion.Scope) error { - return autoconvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in, out, s) +func Convert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in *api.SecretVolumeSource, out *v1.SecretVolumeSource, s conversion.Scope) error { + return autoConvert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in, out, s) } -func autoconvert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityContext, out *v1.SecurityContext, s conversion.Scope) error { +func autoConvert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityContext, out *v1.SecurityContext, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.SecurityContext))(in) } + // unable to generate simple pointer conversion for api.Capabilities -> v1.Capabilities if in.Capabilities != nil { out.Capabilities = new(v1.Capabilities) - if err := convert_api_Capabilities_To_v1_Capabilities(in.Capabilities, out.Capabilities, s); err != nil { + if err := Convert_api_Capabilities_To_v1_Capabilities(in.Capabilities, out.Capabilities, s); err != nil { return err } } else { @@ -875,9 +1080,10 @@ func autoconvert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityConte } else { out.Privileged = nil } + // unable to generate simple pointer conversion for api.SELinuxOptions -> v1.SELinuxOptions if in.SELinuxOptions != nil { out.SELinuxOptions = new(v1.SELinuxOptions) - if err := convert_api_SELinuxOptions_To_v1_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + if err := Convert_api_SELinuxOptions_To_v1_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { return err } } else { @@ -895,43 +1101,49 @@ func autoconvert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityConte } else { out.RunAsNonRoot = nil } + if in.ReadOnlyRootFilesystem != nil { + out.ReadOnlyRootFilesystem = new(bool) + *out.ReadOnlyRootFilesystem = *in.ReadOnlyRootFilesystem + } else { + out.ReadOnlyRootFilesystem = nil + } return nil } -func convert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityContext, out *v1.SecurityContext, s conversion.Scope) error { - return autoconvert_api_SecurityContext_To_v1_SecurityContext(in, out, s) +func Convert_api_SecurityContext_To_v1_SecurityContext(in *api.SecurityContext, out *v1.SecurityContext, s conversion.Scope) error { + return autoConvert_api_SecurityContext_To_v1_SecurityContext(in, out, s) } -func autoconvert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction, out *v1.TCPSocketAction, s conversion.Scope) error { +func autoConvert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction, out *v1.TCPSocketAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.TCPSocketAction))(in) } - if err := s.Convert(&in.Port, &out.Port, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.Port, &out.Port, s); err != nil { return err } return nil } -func convert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction, out *v1.TCPSocketAction, s conversion.Scope) error { - return autoconvert_api_TCPSocketAction_To_v1_TCPSocketAction(in, out, s) +func Convert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction, out *v1.TCPSocketAction, s conversion.Scope) error { + return autoConvert_api_TCPSocketAction_To_v1_TCPSocketAction(in, out, s) } -func autoconvert_api_Volume_To_v1_Volume(in *api.Volume, out *v1.Volume, s conversion.Scope) error { +func autoConvert_api_Volume_To_v1_Volume(in *api.Volume, out *v1.Volume, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.Volume))(in) } out.Name = in.Name - if err := convert_api_VolumeSource_To_v1_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { + if err := Convert_api_VolumeSource_To_v1_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { return err } return nil } -func convert_api_Volume_To_v1_Volume(in *api.Volume, out *v1.Volume, s conversion.Scope) error { - return autoconvert_api_Volume_To_v1_Volume(in, out, s) +func Convert_api_Volume_To_v1_Volume(in *api.Volume, out *v1.Volume, s conversion.Scope) error { + return autoConvert_api_Volume_To_v1_Volume(in, out, s) } -func autoconvert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *v1.VolumeMount, s conversion.Scope) error { +func autoConvert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *v1.VolumeMount, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.VolumeMount))(in) } @@ -941,165 +1153,272 @@ func autoconvert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *v1. return nil } -func convert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *v1.VolumeMount, s conversion.Scope) error { - return autoconvert_api_VolumeMount_To_v1_VolumeMount(in, out, s) +func Convert_api_VolumeMount_To_v1_VolumeMount(in *api.VolumeMount, out *v1.VolumeMount, s conversion.Scope) error { + return autoConvert_api_VolumeMount_To_v1_VolumeMount(in, out, s) } -func autoconvert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *v1.VolumeSource, s conversion.Scope) error { +func autoConvert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *v1.VolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.VolumeSource))(in) } + // unable to generate simple pointer conversion for api.HostPathVolumeSource -> v1.HostPathVolumeSource if in.HostPath != nil { out.HostPath = new(v1.HostPathVolumeSource) - if err := convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { + if err := Convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { return err } } else { out.HostPath = nil } + // unable to generate simple pointer conversion for api.EmptyDirVolumeSource -> v1.EmptyDirVolumeSource if in.EmptyDir != nil { out.EmptyDir = new(v1.EmptyDirVolumeSource) - if err := convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in.EmptyDir, out.EmptyDir, s); err != nil { + if err := Convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in.EmptyDir, out.EmptyDir, s); err != nil { return err } } else { out.EmptyDir = nil } + // unable to generate simple pointer conversion for api.GCEPersistentDiskVolumeSource -> v1.GCEPersistentDiskVolumeSource if in.GCEPersistentDisk != nil { out.GCEPersistentDisk = new(v1.GCEPersistentDiskVolumeSource) - if err := convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { + if err := Convert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { return err } } else { out.GCEPersistentDisk = nil } + // unable to generate simple pointer conversion for api.AWSElasticBlockStoreVolumeSource -> v1.AWSElasticBlockStoreVolumeSource if in.AWSElasticBlockStore != nil { out.AWSElasticBlockStore = new(v1.AWSElasticBlockStoreVolumeSource) - if err := convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { + if err := Convert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { return err } } else { out.AWSElasticBlockStore = nil } + // unable to generate simple pointer conversion for api.GitRepoVolumeSource -> v1.GitRepoVolumeSource if in.GitRepo != nil { out.GitRepo = new(v1.GitRepoVolumeSource) - if err := convert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in.GitRepo, out.GitRepo, s); err != nil { + if err := Convert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource(in.GitRepo, out.GitRepo, s); err != nil { return err } } else { out.GitRepo = nil } + // unable to generate simple pointer conversion for api.SecretVolumeSource -> v1.SecretVolumeSource if in.Secret != nil { out.Secret = new(v1.SecretVolumeSource) - if err := convert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in.Secret, out.Secret, s); err != nil { + if err := Convert_api_SecretVolumeSource_To_v1_SecretVolumeSource(in.Secret, out.Secret, s); err != nil { return err } } else { out.Secret = nil } + // unable to generate simple pointer conversion for api.NFSVolumeSource -> v1.NFSVolumeSource if in.NFS != nil { out.NFS = new(v1.NFSVolumeSource) - if err := convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { + if err := Convert_api_NFSVolumeSource_To_v1_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { return err } } else { out.NFS = nil } + // unable to generate simple pointer conversion for api.ISCSIVolumeSource -> v1.ISCSIVolumeSource if in.ISCSI != nil { out.ISCSI = new(v1.ISCSIVolumeSource) - if err := convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { + if err := Convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { return err } } else { out.ISCSI = nil } + // unable to generate simple pointer conversion for api.GlusterfsVolumeSource -> v1.GlusterfsVolumeSource if in.Glusterfs != nil { out.Glusterfs = new(v1.GlusterfsVolumeSource) - if err := convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { + if err := Convert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { return err } } else { out.Glusterfs = nil } + // unable to generate simple pointer conversion for api.PersistentVolumeClaimVolumeSource -> v1.PersistentVolumeClaimVolumeSource if in.PersistentVolumeClaim != nil { out.PersistentVolumeClaim = new(v1.PersistentVolumeClaimVolumeSource) - if err := convert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in.PersistentVolumeClaim, out.PersistentVolumeClaim, s); err != nil { + if err := Convert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource(in.PersistentVolumeClaim, out.PersistentVolumeClaim, s); err != nil { return err } } else { out.PersistentVolumeClaim = nil } + // unable to generate simple pointer conversion for api.RBDVolumeSource -> v1.RBDVolumeSource if in.RBD != nil { out.RBD = new(v1.RBDVolumeSource) - if err := convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { + if err := Convert_api_RBDVolumeSource_To_v1_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { return err } } else { out.RBD = nil } + // unable to generate simple pointer conversion for api.FlexVolumeSource -> v1.FlexVolumeSource + if in.FlexVolume != nil { + out.FlexVolume = new(v1.FlexVolumeSource) + if err := Convert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in.FlexVolume, out.FlexVolume, s); err != nil { + return err + } + } else { + out.FlexVolume = nil + } + // unable to generate simple pointer conversion for api.CinderVolumeSource -> v1.CinderVolumeSource if in.Cinder != nil { out.Cinder = new(v1.CinderVolumeSource) - if err := convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { + if err := Convert_api_CinderVolumeSource_To_v1_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { return err } } else { out.Cinder = nil } + // unable to generate simple pointer conversion for api.CephFSVolumeSource -> v1.CephFSVolumeSource if in.CephFS != nil { out.CephFS = new(v1.CephFSVolumeSource) - if err := convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { + if err := Convert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { return err } } else { out.CephFS = nil } + // unable to generate simple pointer conversion for api.FlockerVolumeSource -> v1.FlockerVolumeSource if in.Flocker != nil { out.Flocker = new(v1.FlockerVolumeSource) - if err := convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { + if err := Convert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { return err } } else { out.Flocker = nil } + // unable to generate simple pointer conversion for api.DownwardAPIVolumeSource -> v1.DownwardAPIVolumeSource if in.DownwardAPI != nil { out.DownwardAPI = new(v1.DownwardAPIVolumeSource) - if err := convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { + if err := Convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { return err } } else { out.DownwardAPI = nil } + // unable to generate simple pointer conversion for api.FCVolumeSource -> v1.FCVolumeSource if in.FC != nil { out.FC = new(v1.FCVolumeSource) - if err := convert_api_FCVolumeSource_To_v1_FCVolumeSource(in.FC, out.FC, s); err != nil { + if err := Convert_api_FCVolumeSource_To_v1_FCVolumeSource(in.FC, out.FC, s); err != nil { return err } } else { out.FC = nil } + // unable to generate simple pointer conversion for api.AzureFileVolumeSource -> v1.AzureFileVolumeSource + if in.AzureFile != nil { + out.AzureFile = new(v1.AzureFileVolumeSource) + if err := Convert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource(in.AzureFile, out.AzureFile, s); err != nil { + return err + } + } else { + out.AzureFile = nil + } + // unable to generate simple pointer conversion for api.ConfigMapVolumeSource -> v1.ConfigMapVolumeSource + if in.ConfigMap != nil { + out.ConfigMap = new(v1.ConfigMapVolumeSource) + if err := Convert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource(in.ConfigMap, out.ConfigMap, s); err != nil { + return err + } + } else { + out.ConfigMap = nil + } return nil } -func convert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *v1.VolumeSource, s conversion.Scope) error { - return autoconvert_api_VolumeSource_To_v1_VolumeSource(in, out, s) +func Convert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *v1.VolumeSource, s conversion.Scope) error { + return autoConvert_api_VolumeSource_To_v1_VolumeSource(in, out, s) } -func autoconvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in *v1.AWSElasticBlockStoreVolumeSource, out *api.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { +func autoConvert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in *unversioned.LabelSelector, out *LabelSelector, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*unversioned.LabelSelector))(in) + } + if in.MatchLabels != nil { + out.MatchLabels = make(map[string]string) + for key, val := range in.MatchLabels { + out.MatchLabels[key] = val + } + } else { + out.MatchLabels = nil + } + if in.MatchExpressions != nil { + out.MatchExpressions = make([]LabelSelectorRequirement, len(in.MatchExpressions)) + for i := range in.MatchExpressions { + if err := Convert_unversioned_LabelSelectorRequirement_To_v1beta1_LabelSelectorRequirement(&in.MatchExpressions[i], &out.MatchExpressions[i], s); err != nil { + return err + } + } + } else { + out.MatchExpressions = nil + } + return nil +} + +func Convert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in *unversioned.LabelSelector, out *LabelSelector, s conversion.Scope) error { + return autoConvert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in, out, s) +} + +func autoConvert_unversioned_LabelSelectorRequirement_To_v1beta1_LabelSelectorRequirement(in *unversioned.LabelSelectorRequirement, out *LabelSelectorRequirement, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*unversioned.LabelSelectorRequirement))(in) + } + out.Key = in.Key + out.Operator = LabelSelectorOperator(in.Operator) + if in.Values != nil { + out.Values = make([]string, len(in.Values)) + for i := range in.Values { + out.Values[i] = in.Values[i] + } + } else { + out.Values = nil + } + return nil +} + +func Convert_unversioned_LabelSelectorRequirement_To_v1beta1_LabelSelectorRequirement(in *unversioned.LabelSelectorRequirement, out *LabelSelectorRequirement, s conversion.Scope) error { + return autoConvert_unversioned_LabelSelectorRequirement_To_v1beta1_LabelSelectorRequirement(in, out, s) +} + +func autoConvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in *v1.AWSElasticBlockStoreVolumeSource, out *api.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.AWSElasticBlockStoreVolumeSource))(in) } out.VolumeID = in.VolumeID out.FSType = in.FSType - out.Partition = in.Partition + out.Partition = int(in.Partition) out.ReadOnly = in.ReadOnly return nil } -func convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in *v1.AWSElasticBlockStoreVolumeSource, out *api.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { - return autoconvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in, out, s) +func Convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in *v1.AWSElasticBlockStoreVolumeSource, out *api.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { + return autoConvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in, out, s) } -func autoconvert_v1_Capabilities_To_api_Capabilities(in *v1.Capabilities, out *api.Capabilities, s conversion.Scope) error { +func autoConvert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource(in *v1.AzureFileVolumeSource, out *api.AzureFileVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*v1.AzureFileVolumeSource))(in) + } + out.SecretName = in.SecretName + out.ShareName = in.ShareName + out.ReadOnly = in.ReadOnly + return nil +} + +func Convert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource(in *v1.AzureFileVolumeSource, out *api.AzureFileVolumeSource, s conversion.Scope) error { + return autoConvert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource(in, out, s) +} + +func autoConvert_v1_Capabilities_To_api_Capabilities(in *v1.Capabilities, out *api.Capabilities, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.Capabilities))(in) } @@ -1122,11 +1441,11 @@ func autoconvert_v1_Capabilities_To_api_Capabilities(in *v1.Capabilities, out *a return nil } -func convert_v1_Capabilities_To_api_Capabilities(in *v1.Capabilities, out *api.Capabilities, s conversion.Scope) error { - return autoconvert_v1_Capabilities_To_api_Capabilities(in, out, s) +func Convert_v1_Capabilities_To_api_Capabilities(in *v1.Capabilities, out *api.Capabilities, s conversion.Scope) error { + return autoConvert_v1_Capabilities_To_api_Capabilities(in, out, s) } -func autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *v1.CephFSVolumeSource, out *api.CephFSVolumeSource, s conversion.Scope) error { +func autoConvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *v1.CephFSVolumeSource, out *api.CephFSVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.CephFSVolumeSource))(in) } @@ -1138,11 +1457,13 @@ func autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *v1.CephFSVo } else { out.Monitors = nil } + out.Path = in.Path out.User = in.User out.SecretFile = in.SecretFile + // unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference if in.SecretRef != nil { out.SecretRef = new(api.LocalObjectReference) - if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { return err } } else { @@ -1152,11 +1473,11 @@ func autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *v1.CephFSVo return nil } -func convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *v1.CephFSVolumeSource, out *api.CephFSVolumeSource, s conversion.Scope) error { - return autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in, out, s) +func Convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *v1.CephFSVolumeSource, out *api.CephFSVolumeSource, s conversion.Scope) error { + return autoConvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in, out, s) } -func autoconvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *v1.CinderVolumeSource, out *api.CinderVolumeSource, s conversion.Scope) error { +func autoConvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *v1.CinderVolumeSource, out *api.CinderVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.CinderVolumeSource))(in) } @@ -1166,11 +1487,50 @@ func autoconvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *v1.CinderVo return nil } -func convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *v1.CinderVolumeSource, out *api.CinderVolumeSource, s conversion.Scope) error { - return autoconvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in, out, s) +func Convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in *v1.CinderVolumeSource, out *api.CinderVolumeSource, s conversion.Scope) error { + return autoConvert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in, out, s) } -func autoconvert_v1_Container_To_api_Container(in *v1.Container, out *api.Container, s conversion.Scope) error { +func autoConvert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector(in *v1.ConfigMapKeySelector, out *api.ConfigMapKeySelector, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*v1.ConfigMapKeySelector))(in) + } + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func Convert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector(in *v1.ConfigMapKeySelector, out *api.ConfigMapKeySelector, s conversion.Scope) error { + return autoConvert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector(in, out, s) +} + +func autoConvert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource(in *v1.ConfigMapVolumeSource, out *api.ConfigMapVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*v1.ConfigMapVolumeSource))(in) + } + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]api.KeyToPath, len(in.Items)) + for i := range in.Items { + if err := Convert_v1_KeyToPath_To_api_KeyToPath(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource(in *v1.ConfigMapVolumeSource, out *api.ConfigMapVolumeSource, s conversion.Scope) error { + return autoConvert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource(in, out, s) +} + +func autoConvert_v1_Container_To_api_Container(in *v1.Container, out *api.Container, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.Container))(in) } @@ -1196,7 +1556,7 @@ func autoconvert_v1_Container_To_api_Container(in *v1.Container, out *api.Contai if in.Ports != nil { out.Ports = make([]api.ContainerPort, len(in.Ports)) for i := range in.Ports { - if err := convert_v1_ContainerPort_To_api_ContainerPort(&in.Ports[i], &out.Ports[i], s); err != nil { + if err := Convert_v1_ContainerPort_To_api_ContainerPort(&in.Ports[i], &out.Ports[i], s); err != nil { return err } } @@ -1206,45 +1566,48 @@ func autoconvert_v1_Container_To_api_Container(in *v1.Container, out *api.Contai if in.Env != nil { out.Env = make([]api.EnvVar, len(in.Env)) for i := range in.Env { - if err := convert_v1_EnvVar_To_api_EnvVar(&in.Env[i], &out.Env[i], s); err != nil { + if err := Convert_v1_EnvVar_To_api_EnvVar(&in.Env[i], &out.Env[i], s); err != nil { return err } } } else { out.Env = nil } - if err := convert_v1_ResourceRequirements_To_api_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { + if err := Convert_v1_ResourceRequirements_To_api_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil { return err } if in.VolumeMounts != nil { out.VolumeMounts = make([]api.VolumeMount, len(in.VolumeMounts)) for i := range in.VolumeMounts { - if err := convert_v1_VolumeMount_To_api_VolumeMount(&in.VolumeMounts[i], &out.VolumeMounts[i], s); err != nil { + if err := Convert_v1_VolumeMount_To_api_VolumeMount(&in.VolumeMounts[i], &out.VolumeMounts[i], s); err != nil { return err } } } else { out.VolumeMounts = nil } + // unable to generate simple pointer conversion for v1.Probe -> api.Probe if in.LivenessProbe != nil { out.LivenessProbe = new(api.Probe) - if err := convert_v1_Probe_To_api_Probe(in.LivenessProbe, out.LivenessProbe, s); err != nil { + if err := Convert_v1_Probe_To_api_Probe(in.LivenessProbe, out.LivenessProbe, s); err != nil { return err } } else { out.LivenessProbe = nil } + // unable to generate simple pointer conversion for v1.Probe -> api.Probe if in.ReadinessProbe != nil { out.ReadinessProbe = new(api.Probe) - if err := convert_v1_Probe_To_api_Probe(in.ReadinessProbe, out.ReadinessProbe, s); err != nil { + if err := Convert_v1_Probe_To_api_Probe(in.ReadinessProbe, out.ReadinessProbe, s); err != nil { return err } } else { out.ReadinessProbe = nil } + // unable to generate simple pointer conversion for v1.Lifecycle -> api.Lifecycle if in.Lifecycle != nil { out.Lifecycle = new(api.Lifecycle) - if err := convert_v1_Lifecycle_To_api_Lifecycle(in.Lifecycle, out.Lifecycle, s); err != nil { + if err := Convert_v1_Lifecycle_To_api_Lifecycle(in.Lifecycle, out.Lifecycle, s); err != nil { return err } } else { @@ -1252,9 +1615,10 @@ func autoconvert_v1_Container_To_api_Container(in *v1.Container, out *api.Contai } out.TerminationMessagePath = in.TerminationMessagePath out.ImagePullPolicy = api.PullPolicy(in.ImagePullPolicy) + // unable to generate simple pointer conversion for v1.SecurityContext -> api.SecurityContext if in.SecurityContext != nil { out.SecurityContext = new(api.SecurityContext) - if err := convert_v1_SecurityContext_To_api_SecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { + if err := Convert_v1_SecurityContext_To_api_SecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil { return err } } else { @@ -1266,49 +1630,49 @@ func autoconvert_v1_Container_To_api_Container(in *v1.Container, out *api.Contai return nil } -func convert_v1_Container_To_api_Container(in *v1.Container, out *api.Container, s conversion.Scope) error { - return autoconvert_v1_Container_To_api_Container(in, out, s) +func Convert_v1_Container_To_api_Container(in *v1.Container, out *api.Container, s conversion.Scope) error { + return autoConvert_v1_Container_To_api_Container(in, out, s) } -func autoconvert_v1_ContainerPort_To_api_ContainerPort(in *v1.ContainerPort, out *api.ContainerPort, s conversion.Scope) error { +func autoConvert_v1_ContainerPort_To_api_ContainerPort(in *v1.ContainerPort, out *api.ContainerPort, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.ContainerPort))(in) } out.Name = in.Name - out.HostPort = in.HostPort - out.ContainerPort = in.ContainerPort + out.HostPort = int(in.HostPort) + out.ContainerPort = int(in.ContainerPort) out.Protocol = api.Protocol(in.Protocol) out.HostIP = in.HostIP return nil } -func convert_v1_ContainerPort_To_api_ContainerPort(in *v1.ContainerPort, out *api.ContainerPort, s conversion.Scope) error { - return autoconvert_v1_ContainerPort_To_api_ContainerPort(in, out, s) +func Convert_v1_ContainerPort_To_api_ContainerPort(in *v1.ContainerPort, out *api.ContainerPort, s conversion.Scope) error { + return autoConvert_v1_ContainerPort_To_api_ContainerPort(in, out, s) } -func autoconvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in *v1.DownwardAPIVolumeFile, out *api.DownwardAPIVolumeFile, s conversion.Scope) error { +func autoConvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in *v1.DownwardAPIVolumeFile, out *api.DownwardAPIVolumeFile, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.DownwardAPIVolumeFile))(in) } out.Path = in.Path - if err := convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(&in.FieldRef, &out.FieldRef, s); err != nil { + if err := Convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(&in.FieldRef, &out.FieldRef, s); err != nil { return err } return nil } -func convert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in *v1.DownwardAPIVolumeFile, out *api.DownwardAPIVolumeFile, s conversion.Scope) error { - return autoconvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in, out, s) +func Convert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in *v1.DownwardAPIVolumeFile, out *api.DownwardAPIVolumeFile, s conversion.Scope) error { + return autoConvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(in, out, s) } -func autoconvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *v1.DownwardAPIVolumeSource, out *api.DownwardAPIVolumeSource, s conversion.Scope) error { +func autoConvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *v1.DownwardAPIVolumeSource, out *api.DownwardAPIVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.DownwardAPIVolumeSource))(in) } if in.Items != nil { out.Items = make([]api.DownwardAPIVolumeFile, len(in.Items)) for i := range in.Items { - if err := convert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -1318,11 +1682,11 @@ func autoconvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *v return nil } -func convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *v1.DownwardAPIVolumeSource, out *api.DownwardAPIVolumeSource, s conversion.Scope) error { - return autoconvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in, out, s) +func Convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in *v1.DownwardAPIVolumeSource, out *api.DownwardAPIVolumeSource, s conversion.Scope) error { + return autoConvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in, out, s) } -func autoconvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *v1.EmptyDirVolumeSource, out *api.EmptyDirVolumeSource, s conversion.Scope) error { +func autoConvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *v1.EmptyDirVolumeSource, out *api.EmptyDirVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.EmptyDirVolumeSource))(in) } @@ -1330,19 +1694,20 @@ func autoconvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *v1.Empt return nil } -func convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *v1.EmptyDirVolumeSource, out *api.EmptyDirVolumeSource, s conversion.Scope) error { - return autoconvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in, out, s) +func Convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *v1.EmptyDirVolumeSource, out *api.EmptyDirVolumeSource, s conversion.Scope) error { + return autoConvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in, out, s) } -func autoconvert_v1_EnvVar_To_api_EnvVar(in *v1.EnvVar, out *api.EnvVar, s conversion.Scope) error { +func autoConvert_v1_EnvVar_To_api_EnvVar(in *v1.EnvVar, out *api.EnvVar, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.EnvVar))(in) } out.Name = in.Name out.Value = in.Value + // unable to generate simple pointer conversion for v1.EnvVarSource -> api.EnvVarSource if in.ValueFrom != nil { out.ValueFrom = new(api.EnvVarSource) - if err := convert_v1_EnvVarSource_To_api_EnvVarSource(in.ValueFrom, out.ValueFrom, s); err != nil { + if err := Convert_v1_EnvVarSource_To_api_EnvVarSource(in.ValueFrom, out.ValueFrom, s); err != nil { return err } } else { @@ -1351,30 +1716,49 @@ func autoconvert_v1_EnvVar_To_api_EnvVar(in *v1.EnvVar, out *api.EnvVar, s conve return nil } -func convert_v1_EnvVar_To_api_EnvVar(in *v1.EnvVar, out *api.EnvVar, s conversion.Scope) error { - return autoconvert_v1_EnvVar_To_api_EnvVar(in, out, s) +func Convert_v1_EnvVar_To_api_EnvVar(in *v1.EnvVar, out *api.EnvVar, s conversion.Scope) error { + return autoConvert_v1_EnvVar_To_api_EnvVar(in, out, s) } -func autoconvert_v1_EnvVarSource_To_api_EnvVarSource(in *v1.EnvVarSource, out *api.EnvVarSource, s conversion.Scope) error { +func autoConvert_v1_EnvVarSource_To_api_EnvVarSource(in *v1.EnvVarSource, out *api.EnvVarSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.EnvVarSource))(in) } + // unable to generate simple pointer conversion for v1.ObjectFieldSelector -> api.ObjectFieldSelector if in.FieldRef != nil { out.FieldRef = new(api.ObjectFieldSelector) - if err := convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in.FieldRef, out.FieldRef, s); err != nil { + if err := Convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in.FieldRef, out.FieldRef, s); err != nil { return err } } else { out.FieldRef = nil } + // unable to generate simple pointer conversion for v1.ConfigMapKeySelector -> api.ConfigMapKeySelector + if in.ConfigMapKeyRef != nil { + out.ConfigMapKeyRef = new(api.ConfigMapKeySelector) + if err := Convert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector(in.ConfigMapKeyRef, out.ConfigMapKeyRef, s); err != nil { + return err + } + } else { + out.ConfigMapKeyRef = nil + } + // unable to generate simple pointer conversion for v1.SecretKeySelector -> api.SecretKeySelector + if in.SecretKeyRef != nil { + out.SecretKeyRef = new(api.SecretKeySelector) + if err := Convert_v1_SecretKeySelector_To_api_SecretKeySelector(in.SecretKeyRef, out.SecretKeyRef, s); err != nil { + return err + } + } else { + out.SecretKeyRef = nil + } return nil } -func convert_v1_EnvVarSource_To_api_EnvVarSource(in *v1.EnvVarSource, out *api.EnvVarSource, s conversion.Scope) error { - return autoconvert_v1_EnvVarSource_To_api_EnvVarSource(in, out, s) +func Convert_v1_EnvVarSource_To_api_EnvVarSource(in *v1.EnvVarSource, out *api.EnvVarSource, s conversion.Scope) error { + return autoConvert_v1_EnvVarSource_To_api_EnvVarSource(in, out, s) } -func autoconvert_v1_ExecAction_To_api_ExecAction(in *v1.ExecAction, out *api.ExecAction, s conversion.Scope) error { +func autoConvert_v1_ExecAction_To_api_ExecAction(in *v1.ExecAction, out *api.ExecAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.ExecAction))(in) } @@ -1389,11 +1773,11 @@ func autoconvert_v1_ExecAction_To_api_ExecAction(in *v1.ExecAction, out *api.Exe return nil } -func convert_v1_ExecAction_To_api_ExecAction(in *v1.ExecAction, out *api.ExecAction, s conversion.Scope) error { - return autoconvert_v1_ExecAction_To_api_ExecAction(in, out, s) +func Convert_v1_ExecAction_To_api_ExecAction(in *v1.ExecAction, out *api.ExecAction, s conversion.Scope) error { + return autoConvert_v1_ExecAction_To_api_ExecAction(in, out, s) } -func autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource(in *v1.FCVolumeSource, out *api.FCVolumeSource, s conversion.Scope) error { +func autoConvert_v1_FCVolumeSource_To_api_FCVolumeSource(in *v1.FCVolumeSource, out *api.FCVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.FCVolumeSource))(in) } @@ -1407,7 +1791,7 @@ func autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource(in *v1.FCVolumeSource, } if in.Lun != nil { out.Lun = new(int) - *out.Lun = *in.Lun + *out.Lun = int(*in.Lun) } else { out.Lun = nil } @@ -1416,11 +1800,42 @@ func autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource(in *v1.FCVolumeSource, return nil } -func convert_v1_FCVolumeSource_To_api_FCVolumeSource(in *v1.FCVolumeSource, out *api.FCVolumeSource, s conversion.Scope) error { - return autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource(in, out, s) +func Convert_v1_FCVolumeSource_To_api_FCVolumeSource(in *v1.FCVolumeSource, out *api.FCVolumeSource, s conversion.Scope) error { + return autoConvert_v1_FCVolumeSource_To_api_FCVolumeSource(in, out, s) } -func autoconvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *v1.FlockerVolumeSource, out *api.FlockerVolumeSource, s conversion.Scope) error { +func autoConvert_v1_FlexVolumeSource_To_api_FlexVolumeSource(in *v1.FlexVolumeSource, out *api.FlexVolumeSource, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*v1.FlexVolumeSource))(in) + } + out.Driver = in.Driver + out.FSType = in.FSType + // unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference + if in.SecretRef != nil { + out.SecretRef = new(api.LocalObjectReference) + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + return err + } + } else { + out.SecretRef = nil + } + out.ReadOnly = in.ReadOnly + if in.Options != nil { + out.Options = make(map[string]string) + for key, val := range in.Options { + out.Options[key] = val + } + } else { + out.Options = nil + } + return nil +} + +func Convert_v1_FlexVolumeSource_To_api_FlexVolumeSource(in *v1.FlexVolumeSource, out *api.FlexVolumeSource, s conversion.Scope) error { + return autoConvert_v1_FlexVolumeSource_To_api_FlexVolumeSource(in, out, s) +} + +func autoConvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *v1.FlockerVolumeSource, out *api.FlockerVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.FlockerVolumeSource))(in) } @@ -1428,39 +1843,40 @@ func autoconvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *v1.Flocke return nil } -func convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *v1.FlockerVolumeSource, out *api.FlockerVolumeSource, s conversion.Scope) error { - return autoconvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in, out, s) +func Convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *v1.FlockerVolumeSource, out *api.FlockerVolumeSource, s conversion.Scope) error { + return autoConvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in, out, s) } -func autoconvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in *v1.GCEPersistentDiskVolumeSource, out *api.GCEPersistentDiskVolumeSource, s conversion.Scope) error { +func autoConvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in *v1.GCEPersistentDiskVolumeSource, out *api.GCEPersistentDiskVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.GCEPersistentDiskVolumeSource))(in) } out.PDName = in.PDName out.FSType = in.FSType - out.Partition = in.Partition + out.Partition = int(in.Partition) out.ReadOnly = in.ReadOnly return nil } -func convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in *v1.GCEPersistentDiskVolumeSource, out *api.GCEPersistentDiskVolumeSource, s conversion.Scope) error { - return autoconvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in, out, s) +func Convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in *v1.GCEPersistentDiskVolumeSource, out *api.GCEPersistentDiskVolumeSource, s conversion.Scope) error { + return autoConvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in, out, s) } -func autoconvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in *v1.GitRepoVolumeSource, out *api.GitRepoVolumeSource, s conversion.Scope) error { +func autoConvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in *v1.GitRepoVolumeSource, out *api.GitRepoVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.GitRepoVolumeSource))(in) } out.Repository = in.Repository out.Revision = in.Revision + out.Directory = in.Directory return nil } -func convert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in *v1.GitRepoVolumeSource, out *api.GitRepoVolumeSource, s conversion.Scope) error { - return autoconvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in, out, s) +func Convert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in *v1.GitRepoVolumeSource, out *api.GitRepoVolumeSource, s conversion.Scope) error { + return autoConvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in, out, s) } -func autoconvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *v1.GlusterfsVolumeSource, out *api.GlusterfsVolumeSource, s conversion.Scope) error { +func autoConvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *v1.GlusterfsVolumeSource, out *api.GlusterfsVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.GlusterfsVolumeSource))(in) } @@ -1470,50 +1886,76 @@ func autoconvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *v1.Gl return nil } -func convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *v1.GlusterfsVolumeSource, out *api.GlusterfsVolumeSource, s conversion.Scope) error { - return autoconvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in, out, s) +func Convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in *v1.GlusterfsVolumeSource, out *api.GlusterfsVolumeSource, s conversion.Scope) error { + return autoConvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in, out, s) } -func autoconvert_v1_HTTPGetAction_To_api_HTTPGetAction(in *v1.HTTPGetAction, out *api.HTTPGetAction, s conversion.Scope) error { +func autoConvert_v1_HTTPGetAction_To_api_HTTPGetAction(in *v1.HTTPGetAction, out *api.HTTPGetAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.HTTPGetAction))(in) } out.Path = in.Path - if err := s.Convert(&in.Port, &out.Port, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.Port, &out.Port, s); err != nil { return err } out.Host = in.Host out.Scheme = api.URIScheme(in.Scheme) + if in.HTTPHeaders != nil { + out.HTTPHeaders = make([]api.HTTPHeader, len(in.HTTPHeaders)) + for i := range in.HTTPHeaders { + if err := Convert_v1_HTTPHeader_To_api_HTTPHeader(&in.HTTPHeaders[i], &out.HTTPHeaders[i], s); err != nil { + return err + } + } + } else { + out.HTTPHeaders = nil + } return nil } -func convert_v1_HTTPGetAction_To_api_HTTPGetAction(in *v1.HTTPGetAction, out *api.HTTPGetAction, s conversion.Scope) error { - return autoconvert_v1_HTTPGetAction_To_api_HTTPGetAction(in, out, s) +func Convert_v1_HTTPGetAction_To_api_HTTPGetAction(in *v1.HTTPGetAction, out *api.HTTPGetAction, s conversion.Scope) error { + return autoConvert_v1_HTTPGetAction_To_api_HTTPGetAction(in, out, s) } -func autoconvert_v1_Handler_To_api_Handler(in *v1.Handler, out *api.Handler, s conversion.Scope) error { +func autoConvert_v1_HTTPHeader_To_api_HTTPHeader(in *v1.HTTPHeader, out *api.HTTPHeader, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*v1.HTTPHeader))(in) + } + out.Name = in.Name + out.Value = in.Value + return nil +} + +func Convert_v1_HTTPHeader_To_api_HTTPHeader(in *v1.HTTPHeader, out *api.HTTPHeader, s conversion.Scope) error { + return autoConvert_v1_HTTPHeader_To_api_HTTPHeader(in, out, s) +} + +func autoConvert_v1_Handler_To_api_Handler(in *v1.Handler, out *api.Handler, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.Handler))(in) } + // unable to generate simple pointer conversion for v1.ExecAction -> api.ExecAction if in.Exec != nil { out.Exec = new(api.ExecAction) - if err := convert_v1_ExecAction_To_api_ExecAction(in.Exec, out.Exec, s); err != nil { + if err := Convert_v1_ExecAction_To_api_ExecAction(in.Exec, out.Exec, s); err != nil { return err } } else { out.Exec = nil } + // unable to generate simple pointer conversion for v1.HTTPGetAction -> api.HTTPGetAction if in.HTTPGet != nil { out.HTTPGet = new(api.HTTPGetAction) - if err := convert_v1_HTTPGetAction_To_api_HTTPGetAction(in.HTTPGet, out.HTTPGet, s); err != nil { + if err := Convert_v1_HTTPGetAction_To_api_HTTPGetAction(in.HTTPGet, out.HTTPGet, s); err != nil { return err } } else { out.HTTPGet = nil } + // unable to generate simple pointer conversion for v1.TCPSocketAction -> api.TCPSocketAction if in.TCPSocket != nil { out.TCPSocket = new(api.TCPSocketAction) - if err := convert_v1_TCPSocketAction_To_api_TCPSocketAction(in.TCPSocket, out.TCPSocket, s); err != nil { + if err := Convert_v1_TCPSocketAction_To_api_TCPSocketAction(in.TCPSocket, out.TCPSocket, s); err != nil { return err } } else { @@ -1522,11 +1964,11 @@ func autoconvert_v1_Handler_To_api_Handler(in *v1.Handler, out *api.Handler, s c return nil } -func convert_v1_Handler_To_api_Handler(in *v1.Handler, out *api.Handler, s conversion.Scope) error { - return autoconvert_v1_Handler_To_api_Handler(in, out, s) +func Convert_v1_Handler_To_api_Handler(in *v1.Handler, out *api.Handler, s conversion.Scope) error { + return autoConvert_v1_Handler_To_api_Handler(in, out, s) } -func autoconvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *v1.HostPathVolumeSource, out *api.HostPathVolumeSource, s conversion.Scope) error { +func autoConvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *v1.HostPathVolumeSource, out *api.HostPathVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.HostPathVolumeSource))(in) } @@ -1534,41 +1976,57 @@ func autoconvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *v1.Host return nil } -func convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *v1.HostPathVolumeSource, out *api.HostPathVolumeSource, s conversion.Scope) error { - return autoconvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in, out, s) +func Convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in *v1.HostPathVolumeSource, out *api.HostPathVolumeSource, s conversion.Scope) error { + return autoConvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in, out, s) } -func autoconvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *v1.ISCSIVolumeSource, out *api.ISCSIVolumeSource, s conversion.Scope) error { +func autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *v1.ISCSIVolumeSource, out *api.ISCSIVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.ISCSIVolumeSource))(in) } out.TargetPortal = in.TargetPortal out.IQN = in.IQN - out.Lun = in.Lun + out.Lun = int(in.Lun) + out.ISCSIInterface = in.ISCSIInterface out.FSType = in.FSType out.ReadOnly = in.ReadOnly return nil } -func convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *v1.ISCSIVolumeSource, out *api.ISCSIVolumeSource, s conversion.Scope) error { - return autoconvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in, out, s) +func Convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *v1.ISCSIVolumeSource, out *api.ISCSIVolumeSource, s conversion.Scope) error { + return autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in, out, s) } -func autoconvert_v1_Lifecycle_To_api_Lifecycle(in *v1.Lifecycle, out *api.Lifecycle, s conversion.Scope) error { +func autoConvert_v1_KeyToPath_To_api_KeyToPath(in *v1.KeyToPath, out *api.KeyToPath, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*v1.KeyToPath))(in) + } + out.Key = in.Key + out.Path = in.Path + return nil +} + +func Convert_v1_KeyToPath_To_api_KeyToPath(in *v1.KeyToPath, out *api.KeyToPath, s conversion.Scope) error { + return autoConvert_v1_KeyToPath_To_api_KeyToPath(in, out, s) +} + +func autoConvert_v1_Lifecycle_To_api_Lifecycle(in *v1.Lifecycle, out *api.Lifecycle, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.Lifecycle))(in) } + // unable to generate simple pointer conversion for v1.Handler -> api.Handler if in.PostStart != nil { out.PostStart = new(api.Handler) - if err := convert_v1_Handler_To_api_Handler(in.PostStart, out.PostStart, s); err != nil { + if err := Convert_v1_Handler_To_api_Handler(in.PostStart, out.PostStart, s); err != nil { return err } } else { out.PostStart = nil } + // unable to generate simple pointer conversion for v1.Handler -> api.Handler if in.PreStop != nil { out.PreStop = new(api.Handler) - if err := convert_v1_Handler_To_api_Handler(in.PreStop, out.PreStop, s); err != nil { + if err := Convert_v1_Handler_To_api_Handler(in.PreStop, out.PreStop, s); err != nil { return err } } else { @@ -1577,11 +2035,11 @@ func autoconvert_v1_Lifecycle_To_api_Lifecycle(in *v1.Lifecycle, out *api.Lifecy return nil } -func convert_v1_Lifecycle_To_api_Lifecycle(in *v1.Lifecycle, out *api.Lifecycle, s conversion.Scope) error { - return autoconvert_v1_Lifecycle_To_api_Lifecycle(in, out, s) +func Convert_v1_Lifecycle_To_api_Lifecycle(in *v1.Lifecycle, out *api.Lifecycle, s conversion.Scope) error { + return autoConvert_v1_Lifecycle_To_api_Lifecycle(in, out, s) } -func autoconvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *v1.LoadBalancerIngress, out *api.LoadBalancerIngress, s conversion.Scope) error { +func autoConvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *v1.LoadBalancerIngress, out *api.LoadBalancerIngress, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.LoadBalancerIngress))(in) } @@ -1590,18 +2048,18 @@ func autoconvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *v1.LoadBa return nil } -func convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *v1.LoadBalancerIngress, out *api.LoadBalancerIngress, s conversion.Scope) error { - return autoconvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in, out, s) +func Convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *v1.LoadBalancerIngress, out *api.LoadBalancerIngress, s conversion.Scope) error { + return autoConvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in, out, s) } -func autoconvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *v1.LoadBalancerStatus, out *api.LoadBalancerStatus, s conversion.Scope) error { +func autoConvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *v1.LoadBalancerStatus, out *api.LoadBalancerStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.LoadBalancerStatus))(in) } if in.Ingress != nil { out.Ingress = make([]api.LoadBalancerIngress, len(in.Ingress)) for i := range in.Ingress { - if err := convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { + if err := Convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { return err } } @@ -1611,11 +2069,11 @@ func autoconvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *v1.LoadBala return nil } -func convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *v1.LoadBalancerStatus, out *api.LoadBalancerStatus, s conversion.Scope) error { - return autoconvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in, out, s) +func Convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *v1.LoadBalancerStatus, out *api.LoadBalancerStatus, s conversion.Scope) error { + return autoConvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in, out, s) } -func autoconvert_v1_LocalObjectReference_To_api_LocalObjectReference(in *v1.LocalObjectReference, out *api.LocalObjectReference, s conversion.Scope) error { +func autoConvert_v1_LocalObjectReference_To_api_LocalObjectReference(in *v1.LocalObjectReference, out *api.LocalObjectReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.LocalObjectReference))(in) } @@ -1623,11 +2081,11 @@ func autoconvert_v1_LocalObjectReference_To_api_LocalObjectReference(in *v1.Loca return nil } -func convert_v1_LocalObjectReference_To_api_LocalObjectReference(in *v1.LocalObjectReference, out *api.LocalObjectReference, s conversion.Scope) error { - return autoconvert_v1_LocalObjectReference_To_api_LocalObjectReference(in, out, s) +func Convert_v1_LocalObjectReference_To_api_LocalObjectReference(in *v1.LocalObjectReference, out *api.LocalObjectReference, s conversion.Scope) error { + return autoConvert_v1_LocalObjectReference_To_api_LocalObjectReference(in, out, s) } -func autoconvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *v1.NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error { +func autoConvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *v1.NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.NFSVolumeSource))(in) } @@ -1637,11 +2095,11 @@ func autoconvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *v1.NFSVolumeSourc return nil } -func convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *v1.NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error { - return autoconvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in, out, s) +func Convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *v1.NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error { + return autoConvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in, out, s) } -func autoconvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *v1.ObjectFieldSelector, out *api.ObjectFieldSelector, s conversion.Scope) error { +func autoConvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *v1.ObjectFieldSelector, out *api.ObjectFieldSelector, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.ObjectFieldSelector))(in) } @@ -1650,11 +2108,11 @@ func autoconvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *v1.Object return nil } -func convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *v1.ObjectFieldSelector, out *api.ObjectFieldSelector, s conversion.Scope) error { - return autoconvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in, out, s) +func Convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in *v1.ObjectFieldSelector, out *api.ObjectFieldSelector, s conversion.Scope) error { + return autoConvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector(in, out, s) } -func autoconvert_v1_ObjectMeta_To_api_ObjectMeta(in *v1.ObjectMeta, out *api.ObjectMeta, s conversion.Scope) error { +func autoConvert_v1_ObjectMeta_To_api_ObjectMeta(in *v1.ObjectMeta, out *api.ObjectMeta, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.ObjectMeta))(in) } @@ -1665,11 +2123,13 @@ func autoconvert_v1_ObjectMeta_To_api_ObjectMeta(in *v1.ObjectMeta, out *api.Obj out.UID = in.UID out.ResourceVersion = in.ResourceVersion out.Generation = in.Generation - if err := s.Convert(&in.CreationTimestamp, &out.CreationTimestamp, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.CreationTimestamp, &out.CreationTimestamp, s); err != nil { return err } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.DeletionTimestamp != nil { - if err := s.Convert(&in.DeletionTimestamp, &out.DeletionTimestamp, 0); err != nil { + out.DeletionTimestamp = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.DeletionTimestamp, out.DeletionTimestamp, s); err != nil { return err } } else { @@ -1700,11 +2160,11 @@ func autoconvert_v1_ObjectMeta_To_api_ObjectMeta(in *v1.ObjectMeta, out *api.Obj return nil } -func convert_v1_ObjectMeta_To_api_ObjectMeta(in *v1.ObjectMeta, out *api.ObjectMeta, s conversion.Scope) error { - return autoconvert_v1_ObjectMeta_To_api_ObjectMeta(in, out, s) +func Convert_v1_ObjectMeta_To_api_ObjectMeta(in *v1.ObjectMeta, out *api.ObjectMeta, s conversion.Scope) error { + return autoConvert_v1_ObjectMeta_To_api_ObjectMeta(in, out, s) } -func autoconvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in *v1.PersistentVolumeClaimVolumeSource, out *api.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { +func autoConvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in *v1.PersistentVolumeClaimVolumeSource, out *api.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.PersistentVolumeClaimVolumeSource))(in) } @@ -1713,18 +2173,18 @@ func autoconvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeCla return nil } -func convert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in *v1.PersistentVolumeClaimVolumeSource, out *api.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { - return autoconvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in, out, s) +func Convert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in *v1.PersistentVolumeClaimVolumeSource, out *api.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { + return autoConvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in, out, s) } -func autoconvert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s conversion.Scope) error { +func autoConvert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.PodSpec))(in) } if in.Volumes != nil { out.Volumes = make([]api.Volume, len(in.Volumes)) for i := range in.Volumes { - if err := convert_v1_Volume_To_api_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { + if err := Convert_v1_Volume_To_api_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil { return err } } @@ -1734,7 +2194,7 @@ func autoconvert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s c if in.Containers != nil { out.Containers = make([]api.Container, len(in.Containers)) for i := range in.Containers { - if err := convert_v1_Container_To_api_Container(&in.Containers[i], &out.Containers[i], s); err != nil { + if err := Convert_v1_Container_To_api_Container(&in.Containers[i], &out.Containers[i], s); err != nil { return err } } @@ -1769,6 +2229,7 @@ func autoconvert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s c // in.HostNetwork has no peer in out // in.HostPID has no peer in out // in.HostIPC has no peer in out + // unable to generate simple pointer conversion for v1.PodSecurityContext -> api.PodSecurityContext if in.SecurityContext != nil { if err := s.Convert(&in.SecurityContext, &out.SecurityContext, 0); err != nil { return err @@ -1779,7 +2240,7 @@ func autoconvert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s c if in.ImagePullSecrets != nil { out.ImagePullSecrets = make([]api.LocalObjectReference, len(in.ImagePullSecrets)) for i := range in.ImagePullSecrets { - if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil { return err } } @@ -1789,40 +2250,43 @@ func autoconvert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s c return nil } -func autoconvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *v1.PodTemplateSpec, out *api.PodTemplateSpec, s conversion.Scope) error { +func autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *v1.PodTemplateSpec, out *api.PodTemplateSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.PodTemplateSpec))(in) } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1_PodSpec_To_api_PodSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1_PodSpec_To_api_PodSpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *v1.PodTemplateSpec, out *api.PodTemplateSpec, s conversion.Scope) error { - return autoconvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in, out, s) +func Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *v1.PodTemplateSpec, out *api.PodTemplateSpec, s conversion.Scope) error { + return autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in, out, s) } -func autoconvert_v1_Probe_To_api_Probe(in *v1.Probe, out *api.Probe, s conversion.Scope) error { +func autoConvert_v1_Probe_To_api_Probe(in *v1.Probe, out *api.Probe, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.Probe))(in) } - if err := convert_v1_Handler_To_api_Handler(&in.Handler, &out.Handler, s); err != nil { + if err := Convert_v1_Handler_To_api_Handler(&in.Handler, &out.Handler, s); err != nil { return err } - out.InitialDelaySeconds = in.InitialDelaySeconds - out.TimeoutSeconds = in.TimeoutSeconds + out.InitialDelaySeconds = int(in.InitialDelaySeconds) + out.TimeoutSeconds = int(in.TimeoutSeconds) + out.PeriodSeconds = int(in.PeriodSeconds) + out.SuccessThreshold = int(in.SuccessThreshold) + out.FailureThreshold = int(in.FailureThreshold) return nil } -func convert_v1_Probe_To_api_Probe(in *v1.Probe, out *api.Probe, s conversion.Scope) error { - return autoconvert_v1_Probe_To_api_Probe(in, out, s) +func Convert_v1_Probe_To_api_Probe(in *v1.Probe, out *api.Probe, s conversion.Scope) error { + return autoConvert_v1_Probe_To_api_Probe(in, out, s) } -func autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *v1.RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error { +func autoConvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *v1.RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.RBDVolumeSource))(in) } @@ -1839,9 +2303,10 @@ func autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *v1.RBDVolumeSourc out.RBDPool = in.RBDPool out.RadosUser = in.RadosUser out.Keyring = in.Keyring + // unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference if in.SecretRef != nil { out.SecretRef = new(api.LocalObjectReference) - if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.SecretRef, out.SecretRef, s); err != nil { return err } } else { @@ -1851,11 +2316,11 @@ func autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *v1.RBDVolumeSourc return nil } -func convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *v1.RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error { - return autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in, out, s) +func Convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *v1.RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error { + return autoConvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in, out, s) } -func autoconvert_v1_ResourceRequirements_To_api_ResourceRequirements(in *v1.ResourceRequirements, out *api.ResourceRequirements, s conversion.Scope) error { +func autoConvert_v1_ResourceRequirements_To_api_ResourceRequirements(in *v1.ResourceRequirements, out *api.ResourceRequirements, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.ResourceRequirements))(in) } @@ -1863,7 +2328,7 @@ func autoconvert_v1_ResourceRequirements_To_api_ResourceRequirements(in *v1.Reso out.Limits = make(api.ResourceList) for key, val := range in.Limits { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Limits[api.ResourceName(key)] = newVal @@ -1875,7 +2340,7 @@ func autoconvert_v1_ResourceRequirements_To_api_ResourceRequirements(in *v1.Reso out.Requests = make(api.ResourceList) for key, val := range in.Requests { newVal := resource.Quantity{} - if err := s.Convert(&val, &newVal, 0); err != nil { + if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, &newVal, s); err != nil { return err } out.Requests[api.ResourceName(key)] = newVal @@ -1886,11 +2351,11 @@ func autoconvert_v1_ResourceRequirements_To_api_ResourceRequirements(in *v1.Reso return nil } -func convert_v1_ResourceRequirements_To_api_ResourceRequirements(in *v1.ResourceRequirements, out *api.ResourceRequirements, s conversion.Scope) error { - return autoconvert_v1_ResourceRequirements_To_api_ResourceRequirements(in, out, s) +func Convert_v1_ResourceRequirements_To_api_ResourceRequirements(in *v1.ResourceRequirements, out *api.ResourceRequirements, s conversion.Scope) error { + return autoConvert_v1_ResourceRequirements_To_api_ResourceRequirements(in, out, s) } -func autoconvert_v1_SELinuxOptions_To_api_SELinuxOptions(in *v1.SELinuxOptions, out *api.SELinuxOptions, s conversion.Scope) error { +func autoConvert_v1_SELinuxOptions_To_api_SELinuxOptions(in *v1.SELinuxOptions, out *api.SELinuxOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.SELinuxOptions))(in) } @@ -1901,11 +2366,26 @@ func autoconvert_v1_SELinuxOptions_To_api_SELinuxOptions(in *v1.SELinuxOptions, return nil } -func convert_v1_SELinuxOptions_To_api_SELinuxOptions(in *v1.SELinuxOptions, out *api.SELinuxOptions, s conversion.Scope) error { - return autoconvert_v1_SELinuxOptions_To_api_SELinuxOptions(in, out, s) +func Convert_v1_SELinuxOptions_To_api_SELinuxOptions(in *v1.SELinuxOptions, out *api.SELinuxOptions, s conversion.Scope) error { + return autoConvert_v1_SELinuxOptions_To_api_SELinuxOptions(in, out, s) } -func autoconvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *v1.SecretVolumeSource, out *api.SecretVolumeSource, s conversion.Scope) error { +func autoConvert_v1_SecretKeySelector_To_api_SecretKeySelector(in *v1.SecretKeySelector, out *api.SecretKeySelector, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*v1.SecretKeySelector))(in) + } + if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.LocalObjectReference, &out.LocalObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func Convert_v1_SecretKeySelector_To_api_SecretKeySelector(in *v1.SecretKeySelector, out *api.SecretKeySelector, s conversion.Scope) error { + return autoConvert_v1_SecretKeySelector_To_api_SecretKeySelector(in, out, s) +} + +func autoConvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *v1.SecretVolumeSource, out *api.SecretVolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.SecretVolumeSource))(in) } @@ -1913,17 +2393,18 @@ func autoconvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *v1.SecretVo return nil } -func convert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *v1.SecretVolumeSource, out *api.SecretVolumeSource, s conversion.Scope) error { - return autoconvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in, out, s) +func Convert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in *v1.SecretVolumeSource, out *api.SecretVolumeSource, s conversion.Scope) error { + return autoConvert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in, out, s) } -func autoconvert_v1_SecurityContext_To_api_SecurityContext(in *v1.SecurityContext, out *api.SecurityContext, s conversion.Scope) error { +func autoConvert_v1_SecurityContext_To_api_SecurityContext(in *v1.SecurityContext, out *api.SecurityContext, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.SecurityContext))(in) } + // unable to generate simple pointer conversion for v1.Capabilities -> api.Capabilities if in.Capabilities != nil { out.Capabilities = new(api.Capabilities) - if err := convert_v1_Capabilities_To_api_Capabilities(in.Capabilities, out.Capabilities, s); err != nil { + if err := Convert_v1_Capabilities_To_api_Capabilities(in.Capabilities, out.Capabilities, s); err != nil { return err } } else { @@ -1935,9 +2416,10 @@ func autoconvert_v1_SecurityContext_To_api_SecurityContext(in *v1.SecurityContex } else { out.Privileged = nil } + // unable to generate simple pointer conversion for v1.SELinuxOptions -> api.SELinuxOptions if in.SELinuxOptions != nil { out.SELinuxOptions = new(api.SELinuxOptions) - if err := convert_v1_SELinuxOptions_To_api_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + if err := Convert_v1_SELinuxOptions_To_api_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { return err } } else { @@ -1955,43 +2437,49 @@ func autoconvert_v1_SecurityContext_To_api_SecurityContext(in *v1.SecurityContex } else { out.RunAsNonRoot = nil } + if in.ReadOnlyRootFilesystem != nil { + out.ReadOnlyRootFilesystem = new(bool) + *out.ReadOnlyRootFilesystem = *in.ReadOnlyRootFilesystem + } else { + out.ReadOnlyRootFilesystem = nil + } return nil } -func convert_v1_SecurityContext_To_api_SecurityContext(in *v1.SecurityContext, out *api.SecurityContext, s conversion.Scope) error { - return autoconvert_v1_SecurityContext_To_api_SecurityContext(in, out, s) +func Convert_v1_SecurityContext_To_api_SecurityContext(in *v1.SecurityContext, out *api.SecurityContext, s conversion.Scope) error { + return autoConvert_v1_SecurityContext_To_api_SecurityContext(in, out, s) } -func autoconvert_v1_TCPSocketAction_To_api_TCPSocketAction(in *v1.TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error { +func autoConvert_v1_TCPSocketAction_To_api_TCPSocketAction(in *v1.TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.TCPSocketAction))(in) } - if err := s.Convert(&in.Port, &out.Port, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.Port, &out.Port, s); err != nil { return err } return nil } -func convert_v1_TCPSocketAction_To_api_TCPSocketAction(in *v1.TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error { - return autoconvert_v1_TCPSocketAction_To_api_TCPSocketAction(in, out, s) +func Convert_v1_TCPSocketAction_To_api_TCPSocketAction(in *v1.TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error { + return autoConvert_v1_TCPSocketAction_To_api_TCPSocketAction(in, out, s) } -func autoconvert_v1_Volume_To_api_Volume(in *v1.Volume, out *api.Volume, s conversion.Scope) error { +func autoConvert_v1_Volume_To_api_Volume(in *v1.Volume, out *api.Volume, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.Volume))(in) } out.Name = in.Name - if err := convert_v1_VolumeSource_To_api_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { + if err := Convert_v1_VolumeSource_To_api_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { return err } return nil } -func convert_v1_Volume_To_api_Volume(in *v1.Volume, out *api.Volume, s conversion.Scope) error { - return autoconvert_v1_Volume_To_api_Volume(in, out, s) +func Convert_v1_Volume_To_api_Volume(in *v1.Volume, out *api.Volume, s conversion.Scope) error { + return autoConvert_v1_Volume_To_api_Volume(in, out, s) } -func autoconvert_v1_VolumeMount_To_api_VolumeMount(in *v1.VolumeMount, out *api.VolumeMount, s conversion.Scope) error { +func autoConvert_v1_VolumeMount_To_api_VolumeMount(in *v1.VolumeMount, out *api.VolumeMount, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.VolumeMount))(in) } @@ -2001,150 +2489,193 @@ func autoconvert_v1_VolumeMount_To_api_VolumeMount(in *v1.VolumeMount, out *api. return nil } -func convert_v1_VolumeMount_To_api_VolumeMount(in *v1.VolumeMount, out *api.VolumeMount, s conversion.Scope) error { - return autoconvert_v1_VolumeMount_To_api_VolumeMount(in, out, s) +func Convert_v1_VolumeMount_To_api_VolumeMount(in *v1.VolumeMount, out *api.VolumeMount, s conversion.Scope) error { + return autoConvert_v1_VolumeMount_To_api_VolumeMount(in, out, s) } -func autoconvert_v1_VolumeSource_To_api_VolumeSource(in *v1.VolumeSource, out *api.VolumeSource, s conversion.Scope) error { +func autoConvert_v1_VolumeSource_To_api_VolumeSource(in *v1.VolumeSource, out *api.VolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.VolumeSource))(in) } + // unable to generate simple pointer conversion for v1.HostPathVolumeSource -> api.HostPathVolumeSource if in.HostPath != nil { out.HostPath = new(api.HostPathVolumeSource) - if err := convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { + if err := Convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource(in.HostPath, out.HostPath, s); err != nil { return err } } else { out.HostPath = nil } + // unable to generate simple pointer conversion for v1.EmptyDirVolumeSource -> api.EmptyDirVolumeSource if in.EmptyDir != nil { out.EmptyDir = new(api.EmptyDirVolumeSource) - if err := convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in.EmptyDir, out.EmptyDir, s); err != nil { + if err := Convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in.EmptyDir, out.EmptyDir, s); err != nil { return err } } else { out.EmptyDir = nil } + // unable to generate simple pointer conversion for v1.GCEPersistentDiskVolumeSource -> api.GCEPersistentDiskVolumeSource if in.GCEPersistentDisk != nil { out.GCEPersistentDisk = new(api.GCEPersistentDiskVolumeSource) - if err := convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { + if err := Convert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource(in.GCEPersistentDisk, out.GCEPersistentDisk, s); err != nil { return err } } else { out.GCEPersistentDisk = nil } + // unable to generate simple pointer conversion for v1.AWSElasticBlockStoreVolumeSource -> api.AWSElasticBlockStoreVolumeSource if in.AWSElasticBlockStore != nil { out.AWSElasticBlockStore = new(api.AWSElasticBlockStoreVolumeSource) - if err := convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { + if err := Convert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource(in.AWSElasticBlockStore, out.AWSElasticBlockStore, s); err != nil { return err } } else { out.AWSElasticBlockStore = nil } + // unable to generate simple pointer conversion for v1.GitRepoVolumeSource -> api.GitRepoVolumeSource if in.GitRepo != nil { out.GitRepo = new(api.GitRepoVolumeSource) - if err := convert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in.GitRepo, out.GitRepo, s); err != nil { + if err := Convert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource(in.GitRepo, out.GitRepo, s); err != nil { return err } } else { out.GitRepo = nil } + // unable to generate simple pointer conversion for v1.SecretVolumeSource -> api.SecretVolumeSource if in.Secret != nil { out.Secret = new(api.SecretVolumeSource) - if err := convert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in.Secret, out.Secret, s); err != nil { + if err := Convert_v1_SecretVolumeSource_To_api_SecretVolumeSource(in.Secret, out.Secret, s); err != nil { return err } } else { out.Secret = nil } + // unable to generate simple pointer conversion for v1.NFSVolumeSource -> api.NFSVolumeSource if in.NFS != nil { out.NFS = new(api.NFSVolumeSource) - if err := convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { + if err := Convert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in.NFS, out.NFS, s); err != nil { return err } } else { out.NFS = nil } + // unable to generate simple pointer conversion for v1.ISCSIVolumeSource -> api.ISCSIVolumeSource if in.ISCSI != nil { out.ISCSI = new(api.ISCSIVolumeSource) - if err := convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { + if err := Convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil { return err } } else { out.ISCSI = nil } + // unable to generate simple pointer conversion for v1.GlusterfsVolumeSource -> api.GlusterfsVolumeSource if in.Glusterfs != nil { out.Glusterfs = new(api.GlusterfsVolumeSource) - if err := convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { + if err := Convert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil { return err } } else { out.Glusterfs = nil } + // unable to generate simple pointer conversion for v1.PersistentVolumeClaimVolumeSource -> api.PersistentVolumeClaimVolumeSource if in.PersistentVolumeClaim != nil { out.PersistentVolumeClaim = new(api.PersistentVolumeClaimVolumeSource) - if err := convert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in.PersistentVolumeClaim, out.PersistentVolumeClaim, s); err != nil { + if err := Convert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource(in.PersistentVolumeClaim, out.PersistentVolumeClaim, s); err != nil { return err } } else { out.PersistentVolumeClaim = nil } + // unable to generate simple pointer conversion for v1.RBDVolumeSource -> api.RBDVolumeSource if in.RBD != nil { out.RBD = new(api.RBDVolumeSource) - if err := convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { + if err := Convert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in.RBD, out.RBD, s); err != nil { return err } } else { out.RBD = nil } + // unable to generate simple pointer conversion for v1.FlexVolumeSource -> api.FlexVolumeSource + if in.FlexVolume != nil { + out.FlexVolume = new(api.FlexVolumeSource) + if err := Convert_v1_FlexVolumeSource_To_api_FlexVolumeSource(in.FlexVolume, out.FlexVolume, s); err != nil { + return err + } + } else { + out.FlexVolume = nil + } + // unable to generate simple pointer conversion for v1.CinderVolumeSource -> api.CinderVolumeSource if in.Cinder != nil { out.Cinder = new(api.CinderVolumeSource) - if err := convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { + if err := Convert_v1_CinderVolumeSource_To_api_CinderVolumeSource(in.Cinder, out.Cinder, s); err != nil { return err } } else { out.Cinder = nil } + // unable to generate simple pointer conversion for v1.CephFSVolumeSource -> api.CephFSVolumeSource if in.CephFS != nil { out.CephFS = new(api.CephFSVolumeSource) - if err := convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { + if err := Convert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in.CephFS, out.CephFS, s); err != nil { return err } } else { out.CephFS = nil } + // unable to generate simple pointer conversion for v1.FlockerVolumeSource -> api.FlockerVolumeSource if in.Flocker != nil { out.Flocker = new(api.FlockerVolumeSource) - if err := convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { + if err := Convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in.Flocker, out.Flocker, s); err != nil { return err } } else { out.Flocker = nil } + // unable to generate simple pointer conversion for v1.DownwardAPIVolumeSource -> api.DownwardAPIVolumeSource if in.DownwardAPI != nil { out.DownwardAPI = new(api.DownwardAPIVolumeSource) - if err := convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { + if err := Convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { return err } } else { out.DownwardAPI = nil } + // unable to generate simple pointer conversion for v1.FCVolumeSource -> api.FCVolumeSource if in.FC != nil { out.FC = new(api.FCVolumeSource) - if err := convert_v1_FCVolumeSource_To_api_FCVolumeSource(in.FC, out.FC, s); err != nil { + if err := Convert_v1_FCVolumeSource_To_api_FCVolumeSource(in.FC, out.FC, s); err != nil { return err } } else { out.FC = nil } + // unable to generate simple pointer conversion for v1.AzureFileVolumeSource -> api.AzureFileVolumeSource + if in.AzureFile != nil { + out.AzureFile = new(api.AzureFileVolumeSource) + if err := Convert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource(in.AzureFile, out.AzureFile, s); err != nil { + return err + } + } else { + out.AzureFile = nil + } + // unable to generate simple pointer conversion for v1.ConfigMapVolumeSource -> api.ConfigMapVolumeSource + if in.ConfigMap != nil { + out.ConfigMap = new(api.ConfigMapVolumeSource) + if err := Convert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource(in.ConfigMap, out.ConfigMap, s); err != nil { + return err + } + } else { + out.ConfigMap = nil + } return nil } -func convert_v1_VolumeSource_To_api_VolumeSource(in *v1.VolumeSource, out *api.VolumeSource, s conversion.Scope) error { - return autoconvert_v1_VolumeSource_To_api_VolumeSource(in, out, s) +func Convert_v1_VolumeSource_To_api_VolumeSource(in *v1.VolumeSource, out *api.VolumeSource, s conversion.Scope) error { + return autoConvert_v1_VolumeSource_To_api_VolumeSource(in, out, s) } -func autoconvert_extensions_APIVersion_To_v1beta1_APIVersion(in *extensions.APIVersion, out *APIVersion, s conversion.Scope) error { +func autoConvert_extensions_APIVersion_To_v1beta1_APIVersion(in *extensions.APIVersion, out *APIVersion, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.APIVersion))(in) } @@ -2153,56 +2684,56 @@ func autoconvert_extensions_APIVersion_To_v1beta1_APIVersion(in *extensions.APIV return nil } -func convert_extensions_APIVersion_To_v1beta1_APIVersion(in *extensions.APIVersion, out *APIVersion, s conversion.Scope) error { - return autoconvert_extensions_APIVersion_To_v1beta1_APIVersion(in, out, s) +func Convert_extensions_APIVersion_To_v1beta1_APIVersion(in *extensions.APIVersion, out *APIVersion, s conversion.Scope) error { + return autoConvert_extensions_APIVersion_To_v1beta1_APIVersion(in, out, s) } -func autoconvert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization(in *extensions.CPUTargetUtilization, out *CPUTargetUtilization, s conversion.Scope) error { +func autoConvert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization(in *extensions.CPUTargetUtilization, out *CPUTargetUtilization, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.CPUTargetUtilization))(in) } - out.TargetPercentage = in.TargetPercentage + out.TargetPercentage = int32(in.TargetPercentage) return nil } -func convert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization(in *extensions.CPUTargetUtilization, out *CPUTargetUtilization, s conversion.Scope) error { - return autoconvert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization(in, out, s) +func Convert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization(in *extensions.CPUTargetUtilization, out *CPUTargetUtilization, s conversion.Scope) error { + return autoConvert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization(in, out, s) } -func autoconvert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler(in *extensions.ClusterAutoscaler, out *ClusterAutoscaler, s conversion.Scope) error { +func autoConvert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler(in *extensions.ClusterAutoscaler, out *ClusterAutoscaler, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.ClusterAutoscaler))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler(in *extensions.ClusterAutoscaler, out *ClusterAutoscaler, s conversion.Scope) error { - return autoconvert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler(in, out, s) +func Convert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler(in *extensions.ClusterAutoscaler, out *ClusterAutoscaler, s conversion.Scope) error { + return autoConvert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler(in, out, s) } -func autoconvert_extensions_ClusterAutoscalerList_To_v1beta1_ClusterAutoscalerList(in *extensions.ClusterAutoscalerList, out *ClusterAutoscalerList, s conversion.Scope) error { +func autoConvert_extensions_ClusterAutoscalerList_To_v1beta1_ClusterAutoscalerList(in *extensions.ClusterAutoscalerList, out *ClusterAutoscalerList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.ClusterAutoscalerList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]ClusterAutoscaler, len(in.Items)) for i := range in.Items { - if err := convert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2212,20 +2743,20 @@ func autoconvert_extensions_ClusterAutoscalerList_To_v1beta1_ClusterAutoscalerLi return nil } -func convert_extensions_ClusterAutoscalerList_To_v1beta1_ClusterAutoscalerList(in *extensions.ClusterAutoscalerList, out *ClusterAutoscalerList, s conversion.Scope) error { - return autoconvert_extensions_ClusterAutoscalerList_To_v1beta1_ClusterAutoscalerList(in, out, s) +func Convert_extensions_ClusterAutoscalerList_To_v1beta1_ClusterAutoscalerList(in *extensions.ClusterAutoscalerList, out *ClusterAutoscalerList, s conversion.Scope) error { + return autoConvert_extensions_ClusterAutoscalerList_To_v1beta1_ClusterAutoscalerList(in, out, s) } -func autoconvert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec(in *extensions.ClusterAutoscalerSpec, out *ClusterAutoscalerSpec, s conversion.Scope) error { +func autoConvert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec(in *extensions.ClusterAutoscalerSpec, out *ClusterAutoscalerSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.ClusterAutoscalerSpec))(in) } - out.MinNodes = in.MinNodes - out.MaxNodes = in.MaxNodes + out.MinNodes = int32(in.MinNodes) + out.MaxNodes = int32(in.MaxNodes) if in.TargetUtilization != nil { out.TargetUtilization = make([]NodeUtilization, len(in.TargetUtilization)) for i := range in.TargetUtilization { - if err := convert_extensions_NodeUtilization_To_v1beta1_NodeUtilization(&in.TargetUtilization[i], &out.TargetUtilization[i], s); err != nil { + if err := Convert_extensions_NodeUtilization_To_v1beta1_NodeUtilization(&in.TargetUtilization[i], &out.TargetUtilization[i], s); err != nil { return err } } @@ -2235,47 +2766,47 @@ func autoconvert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSp return nil } -func convert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec(in *extensions.ClusterAutoscalerSpec, out *ClusterAutoscalerSpec, s conversion.Scope) error { - return autoconvert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec(in, out, s) +func Convert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec(in *extensions.ClusterAutoscalerSpec, out *ClusterAutoscalerSpec, s conversion.Scope) error { + return autoConvert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec(in, out, s) } -func autoconvert_extensions_DaemonSet_To_v1beta1_DaemonSet(in *extensions.DaemonSet, out *DaemonSet, s conversion.Scope) error { +func autoConvert_extensions_DaemonSet_To_v1beta1_DaemonSet(in *extensions.DaemonSet, out *DaemonSet, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DaemonSet))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_extensions_DaemonSet_To_v1beta1_DaemonSet(in *extensions.DaemonSet, out *DaemonSet, s conversion.Scope) error { - return autoconvert_extensions_DaemonSet_To_v1beta1_DaemonSet(in, out, s) +func Convert_extensions_DaemonSet_To_v1beta1_DaemonSet(in *extensions.DaemonSet, out *DaemonSet, s conversion.Scope) error { + return autoConvert_extensions_DaemonSet_To_v1beta1_DaemonSet(in, out, s) } -func autoconvert_extensions_DaemonSetList_To_v1beta1_DaemonSetList(in *extensions.DaemonSetList, out *DaemonSetList, s conversion.Scope) error { +func autoConvert_extensions_DaemonSetList_To_v1beta1_DaemonSetList(in *extensions.DaemonSetList, out *DaemonSetList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DaemonSetList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]DaemonSet, len(in.Items)) for i := range in.Items { - if err := convert_extensions_DaemonSet_To_v1beta1_DaemonSet(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_extensions_DaemonSet_To_v1beta1_DaemonSet(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2285,88 +2816,84 @@ func autoconvert_extensions_DaemonSetList_To_v1beta1_DaemonSetList(in *extension return nil } -func convert_extensions_DaemonSetList_To_v1beta1_DaemonSetList(in *extensions.DaemonSetList, out *DaemonSetList, s conversion.Scope) error { - return autoconvert_extensions_DaemonSetList_To_v1beta1_DaemonSetList(in, out, s) +func Convert_extensions_DaemonSetList_To_v1beta1_DaemonSetList(in *extensions.DaemonSetList, out *DaemonSetList, s conversion.Scope) error { + return autoConvert_extensions_DaemonSetList_To_v1beta1_DaemonSetList(in, out, s) } -func autoconvert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec(in *extensions.DaemonSetSpec, out *DaemonSetSpec, s conversion.Scope) error { +func autoConvert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec(in *extensions.DaemonSetSpec, out *DaemonSetSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DaemonSetSpec))(in) } + // unable to generate simple pointer conversion for unversioned.LabelSelector -> v1beta1.LabelSelector if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + out.Selector = new(LabelSelector) + if err := Convert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil { + return err } } else { out.Selector = nil } - if in.Template != nil { - out.Template = new(v1.PodTemplateSpec) - if err := convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil { - return err - } - } else { - out.Template = nil + if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err } return nil } -func convert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec(in *extensions.DaemonSetSpec, out *DaemonSetSpec, s conversion.Scope) error { - return autoconvert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec(in, out, s) +func Convert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec(in *extensions.DaemonSetSpec, out *DaemonSetSpec, s conversion.Scope) error { + return autoConvert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec(in, out, s) } -func autoconvert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(in *extensions.DaemonSetStatus, out *DaemonSetStatus, s conversion.Scope) error { +func autoConvert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(in *extensions.DaemonSetStatus, out *DaemonSetStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DaemonSetStatus))(in) } - out.CurrentNumberScheduled = in.CurrentNumberScheduled - out.NumberMisscheduled = in.NumberMisscheduled - out.DesiredNumberScheduled = in.DesiredNumberScheduled + out.CurrentNumberScheduled = int32(in.CurrentNumberScheduled) + out.NumberMisscheduled = int32(in.NumberMisscheduled) + out.DesiredNumberScheduled = int32(in.DesiredNumberScheduled) return nil } -func convert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(in *extensions.DaemonSetStatus, out *DaemonSetStatus, s conversion.Scope) error { - return autoconvert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(in, out, s) +func Convert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(in *extensions.DaemonSetStatus, out *DaemonSetStatus, s conversion.Scope) error { + return autoConvert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(in, out, s) } -func autoconvert_extensions_Deployment_To_v1beta1_Deployment(in *extensions.Deployment, out *Deployment, s conversion.Scope) error { +func autoConvert_extensions_Deployment_To_v1beta1_Deployment(in *extensions.Deployment, out *Deployment, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.Deployment))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_extensions_Deployment_To_v1beta1_Deployment(in *extensions.Deployment, out *Deployment, s conversion.Scope) error { - return autoconvert_extensions_Deployment_To_v1beta1_Deployment(in, out, s) +func Convert_extensions_Deployment_To_v1beta1_Deployment(in *extensions.Deployment, out *Deployment, s conversion.Scope) error { + return autoConvert_extensions_Deployment_To_v1beta1_Deployment(in, out, s) } -func autoconvert_extensions_DeploymentList_To_v1beta1_DeploymentList(in *extensions.DeploymentList, out *DeploymentList, s conversion.Scope) error { +func autoConvert_extensions_DeploymentList_To_v1beta1_DeploymentList(in *extensions.DeploymentList, out *DeploymentList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DeploymentList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]Deployment, len(in.Items)) for i := range in.Items { - if err := convert_extensions_Deployment_To_v1beta1_Deployment(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_extensions_Deployment_To_v1beta1_Deployment(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2376,63 +2903,102 @@ func autoconvert_extensions_DeploymentList_To_v1beta1_DeploymentList(in *extensi return nil } -func convert_extensions_DeploymentList_To_v1beta1_DeploymentList(in *extensions.DeploymentList, out *DeploymentList, s conversion.Scope) error { - return autoconvert_extensions_DeploymentList_To_v1beta1_DeploymentList(in, out, s) +func Convert_extensions_DeploymentList_To_v1beta1_DeploymentList(in *extensions.DeploymentList, out *DeploymentList, s conversion.Scope) error { + return autoConvert_extensions_DeploymentList_To_v1beta1_DeploymentList(in, out, s) } -func autoconvert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions.DeploymentSpec, out *DeploymentSpec, s conversion.Scope) error { +func autoConvert_extensions_DeploymentRollback_To_v1beta1_DeploymentRollback(in *extensions.DeploymentRollback, out *DeploymentRollback, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.DeploymentRollback))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + out.Name = in.Name + if in.UpdatedAnnotations != nil { + out.UpdatedAnnotations = make(map[string]string) + for key, val := range in.UpdatedAnnotations { + out.UpdatedAnnotations[key] = val + } + } else { + out.UpdatedAnnotations = nil + } + if err := Convert_extensions_RollbackConfig_To_v1beta1_RollbackConfig(&in.RollbackTo, &out.RollbackTo, s); err != nil { + return err + } + return nil +} + +func Convert_extensions_DeploymentRollback_To_v1beta1_DeploymentRollback(in *extensions.DeploymentRollback, out *DeploymentRollback, s conversion.Scope) error { + return autoConvert_extensions_DeploymentRollback_To_v1beta1_DeploymentRollback(in, out, s) +} + +func autoConvert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions.DeploymentSpec, out *DeploymentSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DeploymentSpec))(in) } if err := s.Convert(&in.Replicas, &out.Replicas, 0); err != nil { return err } + // unable to generate simple pointer conversion for unversioned.LabelSelector -> v1beta1.LabelSelector if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + out.Selector = new(LabelSelector) + if err := Convert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil { + return err } } else { out.Selector = nil } - if in.Template != nil { - out.Template = new(v1.PodTemplateSpec) - if err := convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil { + if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + if err := Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { + return err + } + out.MinReadySeconds = int32(in.MinReadySeconds) + if in.RevisionHistoryLimit != nil { + out.RevisionHistoryLimit = new(int32) + *out.RevisionHistoryLimit = int32(*in.RevisionHistoryLimit) + } else { + out.RevisionHistoryLimit = nil + } + out.Paused = in.Paused + // unable to generate simple pointer conversion for extensions.RollbackConfig -> v1beta1.RollbackConfig + if in.RollbackTo != nil { + out.RollbackTo = new(RollbackConfig) + if err := Convert_extensions_RollbackConfig_To_v1beta1_RollbackConfig(in.RollbackTo, out.RollbackTo, s); err != nil { return err } } else { - out.Template = nil - } - if err := convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { - return err - } - if err := s.Convert(&in.UniqueLabelKey, &out.UniqueLabelKey, 0); err != nil { - return err + out.RollbackTo = nil } return nil } -func autoconvert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(in *extensions.DeploymentStatus, out *DeploymentStatus, s conversion.Scope) error { +func autoConvert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(in *extensions.DeploymentStatus, out *DeploymentStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DeploymentStatus))(in) } - out.Replicas = in.Replicas - out.UpdatedReplicas = in.UpdatedReplicas + out.Replicas = int32(in.Replicas) + out.UpdatedReplicas = int32(in.UpdatedReplicas) + out.AvailableReplicas = int32(in.AvailableReplicas) + out.UnavailableReplicas = int32(in.UnavailableReplicas) return nil } -func convert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(in *extensions.DeploymentStatus, out *DeploymentStatus, s conversion.Scope) error { - return autoconvert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(in, out, s) +func Convert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(in *extensions.DeploymentStatus, out *DeploymentStatus, s conversion.Scope) error { + return autoConvert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(in, out, s) } -func autoconvert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(in *extensions.DeploymentStrategy, out *DeploymentStrategy, s conversion.Scope) error { +func autoConvert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(in *extensions.DeploymentStrategy, out *DeploymentStrategy, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.DeploymentStrategy))(in) } out.Type = DeploymentStrategyType(in.Type) + // unable to generate simple pointer conversion for extensions.RollingUpdateDeployment -> v1beta1.RollingUpdateDeployment if in.RollingUpdate != nil { out.RollingUpdate = new(RollingUpdateDeployment) - if err := convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in.RollingUpdate, out.RollingUpdate, s); err != nil { + if err := Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in.RollingUpdate, out.RollingUpdate, s); err != nil { return err } } else { @@ -2441,29 +3007,29 @@ func autoconvert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(in return nil } -func autoconvert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath(in *extensions.HTTPIngressPath, out *HTTPIngressPath, s conversion.Scope) error { +func autoConvert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath(in *extensions.HTTPIngressPath, out *HTTPIngressPath, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.HTTPIngressPath))(in) } out.Path = in.Path - if err := convert_extensions_IngressBackend_To_v1beta1_IngressBackend(&in.Backend, &out.Backend, s); err != nil { + if err := Convert_extensions_IngressBackend_To_v1beta1_IngressBackend(&in.Backend, &out.Backend, s); err != nil { return err } return nil } -func convert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath(in *extensions.HTTPIngressPath, out *HTTPIngressPath, s conversion.Scope) error { - return autoconvert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath(in, out, s) +func Convert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath(in *extensions.HTTPIngressPath, out *HTTPIngressPath, s conversion.Scope) error { + return autoConvert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath(in, out, s) } -func autoconvert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in *extensions.HTTPIngressRuleValue, out *HTTPIngressRuleValue, s conversion.Scope) error { +func autoConvert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in *extensions.HTTPIngressRuleValue, out *HTTPIngressRuleValue, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.HTTPIngressRuleValue))(in) } if in.Paths != nil { out.Paths = make([]HTTPIngressPath, len(in.Paths)) for i := range in.Paths { - if err := convert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath(&in.Paths[i], &out.Paths[i], s); err != nil { + if err := Convert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath(&in.Paths[i], &out.Paths[i], s); err != nil { return err } } @@ -2473,47 +3039,47 @@ func autoconvert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue return nil } -func convert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in *extensions.HTTPIngressRuleValue, out *HTTPIngressRuleValue, s conversion.Scope) error { - return autoconvert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in, out, s) +func Convert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in *extensions.HTTPIngressRuleValue, out *HTTPIngressRuleValue, s conversion.Scope) error { + return autoConvert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in, out, s) } -func autoconvert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler(in *extensions.HorizontalPodAutoscaler, out *HorizontalPodAutoscaler, s conversion.Scope) error { +func autoConvert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler(in *extensions.HorizontalPodAutoscaler, out *HorizontalPodAutoscaler, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.HorizontalPodAutoscaler))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler(in *extensions.HorizontalPodAutoscaler, out *HorizontalPodAutoscaler, s conversion.Scope) error { - return autoconvert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler(in, out, s) +func Convert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler(in *extensions.HorizontalPodAutoscaler, out *HorizontalPodAutoscaler, s conversion.Scope) error { + return autoConvert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler(in, out, s) } -func autoconvert_extensions_HorizontalPodAutoscalerList_To_v1beta1_HorizontalPodAutoscalerList(in *extensions.HorizontalPodAutoscalerList, out *HorizontalPodAutoscalerList, s conversion.Scope) error { +func autoConvert_extensions_HorizontalPodAutoscalerList_To_v1beta1_HorizontalPodAutoscalerList(in *extensions.HorizontalPodAutoscalerList, out *HorizontalPodAutoscalerList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.HorizontalPodAutoscalerList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]HorizontalPodAutoscaler, len(in.Items)) for i := range in.Items { - if err := convert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2523,27 +3089,28 @@ func autoconvert_extensions_HorizontalPodAutoscalerList_To_v1beta1_HorizontalPod return nil } -func convert_extensions_HorizontalPodAutoscalerList_To_v1beta1_HorizontalPodAutoscalerList(in *extensions.HorizontalPodAutoscalerList, out *HorizontalPodAutoscalerList, s conversion.Scope) error { - return autoconvert_extensions_HorizontalPodAutoscalerList_To_v1beta1_HorizontalPodAutoscalerList(in, out, s) +func Convert_extensions_HorizontalPodAutoscalerList_To_v1beta1_HorizontalPodAutoscalerList(in *extensions.HorizontalPodAutoscalerList, out *HorizontalPodAutoscalerList, s conversion.Scope) error { + return autoConvert_extensions_HorizontalPodAutoscalerList_To_v1beta1_HorizontalPodAutoscalerList(in, out, s) } -func autoconvert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec(in *extensions.HorizontalPodAutoscalerSpec, out *HorizontalPodAutoscalerSpec, s conversion.Scope) error { +func autoConvert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec(in *extensions.HorizontalPodAutoscalerSpec, out *HorizontalPodAutoscalerSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.HorizontalPodAutoscalerSpec))(in) } - if err := convert_extensions_SubresourceReference_To_v1beta1_SubresourceReference(&in.ScaleRef, &out.ScaleRef, s); err != nil { + if err := Convert_extensions_SubresourceReference_To_v1beta1_SubresourceReference(&in.ScaleRef, &out.ScaleRef, s); err != nil { return err } if in.MinReplicas != nil { - out.MinReplicas = new(int) - *out.MinReplicas = *in.MinReplicas + out.MinReplicas = new(int32) + *out.MinReplicas = int32(*in.MinReplicas) } else { out.MinReplicas = nil } - out.MaxReplicas = in.MaxReplicas + out.MaxReplicas = int32(in.MaxReplicas) + // unable to generate simple pointer conversion for extensions.CPUTargetUtilization -> v1beta1.CPUTargetUtilization if in.CPUUtilization != nil { out.CPUUtilization = new(CPUTargetUtilization) - if err := convert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization(in.CPUUtilization, out.CPUUtilization, s); err != nil { + if err := Convert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization(in.CPUUtilization, out.CPUUtilization, s); err != nil { return err } } else { @@ -2552,11 +3119,11 @@ func autoconvert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPod return nil } -func convert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec(in *extensions.HorizontalPodAutoscalerSpec, out *HorizontalPodAutoscalerSpec, s conversion.Scope) error { - return autoconvert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec(in, out, s) +func Convert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec(in *extensions.HorizontalPodAutoscalerSpec, out *HorizontalPodAutoscalerSpec, s conversion.Scope) error { + return autoConvert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec(in, out, s) } -func autoconvert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus(in *extensions.HorizontalPodAutoscalerStatus, out *HorizontalPodAutoscalerStatus, s conversion.Scope) error { +func autoConvert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus(in *extensions.HorizontalPodAutoscalerStatus, out *HorizontalPodAutoscalerStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.HorizontalPodAutoscalerStatus))(in) } @@ -2566,80 +3133,108 @@ func autoconvert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalP } else { out.ObservedGeneration = nil } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.LastScaleTime != nil { - if err := s.Convert(&in.LastScaleTime, &out.LastScaleTime, 0); err != nil { + out.LastScaleTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.LastScaleTime, out.LastScaleTime, s); err != nil { return err } } else { out.LastScaleTime = nil } - out.CurrentReplicas = in.CurrentReplicas - out.DesiredReplicas = in.DesiredReplicas + out.CurrentReplicas = int32(in.CurrentReplicas) + out.DesiredReplicas = int32(in.DesiredReplicas) if in.CurrentCPUUtilizationPercentage != nil { - out.CurrentCPUUtilizationPercentage = new(int) - *out.CurrentCPUUtilizationPercentage = *in.CurrentCPUUtilizationPercentage + out.CurrentCPUUtilizationPercentage = new(int32) + *out.CurrentCPUUtilizationPercentage = int32(*in.CurrentCPUUtilizationPercentage) } else { out.CurrentCPUUtilizationPercentage = nil } return nil } -func convert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus(in *extensions.HorizontalPodAutoscalerStatus, out *HorizontalPodAutoscalerStatus, s conversion.Scope) error { - return autoconvert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus(in, out, s) +func Convert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus(in *extensions.HorizontalPodAutoscalerStatus, out *HorizontalPodAutoscalerStatus, s conversion.Scope) error { + return autoConvert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus(in, out, s) } -func autoconvert_extensions_Ingress_To_v1beta1_Ingress(in *extensions.Ingress, out *Ingress, s conversion.Scope) error { +func autoConvert_extensions_HostPortRange_To_v1beta1_HostPortRange(in *extensions.HostPortRange, out *HostPortRange, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.HostPortRange))(in) + } + out.Min = int32(in.Min) + out.Max = int32(in.Max) + return nil +} + +func Convert_extensions_HostPortRange_To_v1beta1_HostPortRange(in *extensions.HostPortRange, out *HostPortRange, s conversion.Scope) error { + return autoConvert_extensions_HostPortRange_To_v1beta1_HostPortRange(in, out, s) +} + +func autoConvert_extensions_IDRange_To_v1beta1_IDRange(in *extensions.IDRange, out *IDRange, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.IDRange))(in) + } + out.Min = in.Min + out.Max = in.Max + return nil +} + +func Convert_extensions_IDRange_To_v1beta1_IDRange(in *extensions.IDRange, out *IDRange, s conversion.Scope) error { + return autoConvert_extensions_IDRange_To_v1beta1_IDRange(in, out, s) +} + +func autoConvert_extensions_Ingress_To_v1beta1_Ingress(in *extensions.Ingress, out *Ingress, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.Ingress))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_extensions_IngressSpec_To_v1beta1_IngressSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_extensions_IngressSpec_To_v1beta1_IngressSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_extensions_IngressStatus_To_v1beta1_IngressStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_extensions_IngressStatus_To_v1beta1_IngressStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_extensions_Ingress_To_v1beta1_Ingress(in *extensions.Ingress, out *Ingress, s conversion.Scope) error { - return autoconvert_extensions_Ingress_To_v1beta1_Ingress(in, out, s) +func Convert_extensions_Ingress_To_v1beta1_Ingress(in *extensions.Ingress, out *Ingress, s conversion.Scope) error { + return autoConvert_extensions_Ingress_To_v1beta1_Ingress(in, out, s) } -func autoconvert_extensions_IngressBackend_To_v1beta1_IngressBackend(in *extensions.IngressBackend, out *IngressBackend, s conversion.Scope) error { +func autoConvert_extensions_IngressBackend_To_v1beta1_IngressBackend(in *extensions.IngressBackend, out *IngressBackend, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.IngressBackend))(in) } out.ServiceName = in.ServiceName - if err := s.Convert(&in.ServicePort, &out.ServicePort, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.ServicePort, &out.ServicePort, s); err != nil { return err } return nil } -func convert_extensions_IngressBackend_To_v1beta1_IngressBackend(in *extensions.IngressBackend, out *IngressBackend, s conversion.Scope) error { - return autoconvert_extensions_IngressBackend_To_v1beta1_IngressBackend(in, out, s) +func Convert_extensions_IngressBackend_To_v1beta1_IngressBackend(in *extensions.IngressBackend, out *IngressBackend, s conversion.Scope) error { + return autoConvert_extensions_IngressBackend_To_v1beta1_IngressBackend(in, out, s) } -func autoconvert_extensions_IngressList_To_v1beta1_IngressList(in *extensions.IngressList, out *IngressList, s conversion.Scope) error { +func autoConvert_extensions_IngressList_To_v1beta1_IngressList(in *extensions.IngressList, out *IngressList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.IngressList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]Ingress, len(in.Items)) for i := range in.Items { - if err := convert_extensions_Ingress_To_v1beta1_Ingress(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_extensions_Ingress_To_v1beta1_Ingress(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2649,32 +3244,33 @@ func autoconvert_extensions_IngressList_To_v1beta1_IngressList(in *extensions.In return nil } -func convert_extensions_IngressList_To_v1beta1_IngressList(in *extensions.IngressList, out *IngressList, s conversion.Scope) error { - return autoconvert_extensions_IngressList_To_v1beta1_IngressList(in, out, s) +func Convert_extensions_IngressList_To_v1beta1_IngressList(in *extensions.IngressList, out *IngressList, s conversion.Scope) error { + return autoConvert_extensions_IngressList_To_v1beta1_IngressList(in, out, s) } -func autoconvert_extensions_IngressRule_To_v1beta1_IngressRule(in *extensions.IngressRule, out *IngressRule, s conversion.Scope) error { +func autoConvert_extensions_IngressRule_To_v1beta1_IngressRule(in *extensions.IngressRule, out *IngressRule, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.IngressRule))(in) } out.Host = in.Host - if err := convert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue(&in.IngressRuleValue, &out.IngressRuleValue, s); err != nil { + if err := Convert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue(&in.IngressRuleValue, &out.IngressRuleValue, s); err != nil { return err } return nil } -func convert_extensions_IngressRule_To_v1beta1_IngressRule(in *extensions.IngressRule, out *IngressRule, s conversion.Scope) error { - return autoconvert_extensions_IngressRule_To_v1beta1_IngressRule(in, out, s) +func Convert_extensions_IngressRule_To_v1beta1_IngressRule(in *extensions.IngressRule, out *IngressRule, s conversion.Scope) error { + return autoConvert_extensions_IngressRule_To_v1beta1_IngressRule(in, out, s) } -func autoconvert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue(in *extensions.IngressRuleValue, out *IngressRuleValue, s conversion.Scope) error { +func autoConvert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue(in *extensions.IngressRuleValue, out *IngressRuleValue, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.IngressRuleValue))(in) } + // unable to generate simple pointer conversion for extensions.HTTPIngressRuleValue -> v1beta1.HTTPIngressRuleValue if in.HTTP != nil { out.HTTP = new(HTTPIngressRuleValue) - if err := convert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in.HTTP, out.HTTP, s); err != nil { + if err := Convert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in.HTTP, out.HTTP, s); err != nil { return err } } else { @@ -2683,26 +3279,37 @@ func autoconvert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue(in *ext return nil } -func convert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue(in *extensions.IngressRuleValue, out *IngressRuleValue, s conversion.Scope) error { - return autoconvert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue(in, out, s) +func Convert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue(in *extensions.IngressRuleValue, out *IngressRuleValue, s conversion.Scope) error { + return autoConvert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue(in, out, s) } -func autoconvert_extensions_IngressSpec_To_v1beta1_IngressSpec(in *extensions.IngressSpec, out *IngressSpec, s conversion.Scope) error { +func autoConvert_extensions_IngressSpec_To_v1beta1_IngressSpec(in *extensions.IngressSpec, out *IngressSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.IngressSpec))(in) } + // unable to generate simple pointer conversion for extensions.IngressBackend -> v1beta1.IngressBackend if in.Backend != nil { out.Backend = new(IngressBackend) - if err := convert_extensions_IngressBackend_To_v1beta1_IngressBackend(in.Backend, out.Backend, s); err != nil { + if err := Convert_extensions_IngressBackend_To_v1beta1_IngressBackend(in.Backend, out.Backend, s); err != nil { return err } } else { out.Backend = nil } + if in.TLS != nil { + out.TLS = make([]IngressTLS, len(in.TLS)) + for i := range in.TLS { + if err := Convert_extensions_IngressTLS_To_v1beta1_IngressTLS(&in.TLS[i], &out.TLS[i], s); err != nil { + return err + } + } + } else { + out.TLS = nil + } if in.Rules != nil { out.Rules = make([]IngressRule, len(in.Rules)) for i := range in.Rules { - if err := convert_extensions_IngressRule_To_v1beta1_IngressRule(&in.Rules[i], &out.Rules[i], s); err != nil { + if err := Convert_extensions_IngressRule_To_v1beta1_IngressRule(&in.Rules[i], &out.Rules[i], s); err != nil { return err } } @@ -2712,57 +3319,77 @@ func autoconvert_extensions_IngressSpec_To_v1beta1_IngressSpec(in *extensions.In return nil } -func convert_extensions_IngressSpec_To_v1beta1_IngressSpec(in *extensions.IngressSpec, out *IngressSpec, s conversion.Scope) error { - return autoconvert_extensions_IngressSpec_To_v1beta1_IngressSpec(in, out, s) +func Convert_extensions_IngressSpec_To_v1beta1_IngressSpec(in *extensions.IngressSpec, out *IngressSpec, s conversion.Scope) error { + return autoConvert_extensions_IngressSpec_To_v1beta1_IngressSpec(in, out, s) } -func autoconvert_extensions_IngressStatus_To_v1beta1_IngressStatus(in *extensions.IngressStatus, out *IngressStatus, s conversion.Scope) error { +func autoConvert_extensions_IngressStatus_To_v1beta1_IngressStatus(in *extensions.IngressStatus, out *IngressStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.IngressStatus))(in) } - if err := convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { + if err := Convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { return err } return nil } -func convert_extensions_IngressStatus_To_v1beta1_IngressStatus(in *extensions.IngressStatus, out *IngressStatus, s conversion.Scope) error { - return autoconvert_extensions_IngressStatus_To_v1beta1_IngressStatus(in, out, s) +func Convert_extensions_IngressStatus_To_v1beta1_IngressStatus(in *extensions.IngressStatus, out *IngressStatus, s conversion.Scope) error { + return autoConvert_extensions_IngressStatus_To_v1beta1_IngressStatus(in, out, s) } -func autoconvert_extensions_Job_To_v1beta1_Job(in *extensions.Job, out *Job, s conversion.Scope) error { +func autoConvert_extensions_IngressTLS_To_v1beta1_IngressTLS(in *extensions.IngressTLS, out *IngressTLS, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.IngressTLS))(in) + } + if in.Hosts != nil { + out.Hosts = make([]string, len(in.Hosts)) + for i := range in.Hosts { + out.Hosts[i] = in.Hosts[i] + } + } else { + out.Hosts = nil + } + out.SecretName = in.SecretName + return nil +} + +func Convert_extensions_IngressTLS_To_v1beta1_IngressTLS(in *extensions.IngressTLS, out *IngressTLS, s conversion.Scope) error { + return autoConvert_extensions_IngressTLS_To_v1beta1_IngressTLS(in, out, s) +} + +func autoConvert_extensions_Job_To_v1beta1_Job(in *extensions.Job, out *Job, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.Job))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_extensions_JobSpec_To_v1beta1_JobSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_extensions_JobSpec_To_v1beta1_JobSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_extensions_JobStatus_To_v1beta1_JobStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_extensions_JobStatus_To_v1beta1_JobStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_extensions_Job_To_v1beta1_Job(in *extensions.Job, out *Job, s conversion.Scope) error { - return autoconvert_extensions_Job_To_v1beta1_Job(in, out, s) +func Convert_extensions_Job_To_v1beta1_Job(in *extensions.Job, out *Job, s conversion.Scope) error { + return autoConvert_extensions_Job_To_v1beta1_Job(in, out, s) } -func autoconvert_extensions_JobCondition_To_v1beta1_JobCondition(in *extensions.JobCondition, out *JobCondition, s conversion.Scope) error { +func autoConvert_extensions_JobCondition_To_v1beta1_JobCondition(in *extensions.JobCondition, out *JobCondition, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.JobCondition))(in) } out.Type = JobConditionType(in.Type) out.Status = v1.ConditionStatus(in.Status) - if err := s.Convert(&in.LastProbeTime, &out.LastProbeTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastProbeTime, &out.LastProbeTime, s); err != nil { return err } - if err := s.Convert(&in.LastTransitionTime, &out.LastTransitionTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastTransitionTime, &out.LastTransitionTime, s); err != nil { return err } out.Reason = in.Reason @@ -2770,24 +3397,24 @@ func autoconvert_extensions_JobCondition_To_v1beta1_JobCondition(in *extensions. return nil } -func convert_extensions_JobCondition_To_v1beta1_JobCondition(in *extensions.JobCondition, out *JobCondition, s conversion.Scope) error { - return autoconvert_extensions_JobCondition_To_v1beta1_JobCondition(in, out, s) +func Convert_extensions_JobCondition_To_v1beta1_JobCondition(in *extensions.JobCondition, out *JobCondition, s conversion.Scope) error { + return autoConvert_extensions_JobCondition_To_v1beta1_JobCondition(in, out, s) } -func autoconvert_extensions_JobList_To_v1beta1_JobList(in *extensions.JobList, out *JobList, s conversion.Scope) error { +func autoConvert_extensions_JobList_To_v1beta1_JobList(in *extensions.JobList, out *JobList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.JobList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]Job, len(in.Items)) for i := range in.Items { - if err := convert_extensions_Job_To_v1beta1_Job(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_extensions_Job_To_v1beta1_Job(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -2797,83 +3424,94 @@ func autoconvert_extensions_JobList_To_v1beta1_JobList(in *extensions.JobList, o return nil } -func convert_extensions_JobList_To_v1beta1_JobList(in *extensions.JobList, out *JobList, s conversion.Scope) error { - return autoconvert_extensions_JobList_To_v1beta1_JobList(in, out, s) +func Convert_extensions_JobList_To_v1beta1_JobList(in *extensions.JobList, out *JobList, s conversion.Scope) error { + return autoConvert_extensions_JobList_To_v1beta1_JobList(in, out, s) } -func autoconvert_extensions_JobSpec_To_v1beta1_JobSpec(in *extensions.JobSpec, out *JobSpec, s conversion.Scope) error { +func autoConvert_extensions_JobSpec_To_v1beta1_JobSpec(in *extensions.JobSpec, out *JobSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.JobSpec))(in) } if in.Parallelism != nil { - out.Parallelism = new(int) - *out.Parallelism = *in.Parallelism + out.Parallelism = new(int32) + *out.Parallelism = int32(*in.Parallelism) } else { out.Parallelism = nil } if in.Completions != nil { - out.Completions = new(int) - *out.Completions = *in.Completions + out.Completions = new(int32) + *out.Completions = int32(*in.Completions) } else { out.Completions = nil } + if in.ActiveDeadlineSeconds != nil { + out.ActiveDeadlineSeconds = new(int64) + *out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds + } else { + out.ActiveDeadlineSeconds = nil + } + // unable to generate simple pointer conversion for unversioned.LabelSelector -> v1beta1.LabelSelector if in.Selector != nil { - out.Selector = new(PodSelector) - if err := convert_extensions_PodSelector_To_v1beta1_PodSelector(in.Selector, out.Selector, s); err != nil { + out.Selector = new(LabelSelector) + if err := Convert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil { return err } } else { out.Selector = nil } - if err := convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { + if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { return err } return nil } -func convert_extensions_JobSpec_To_v1beta1_JobSpec(in *extensions.JobSpec, out *JobSpec, s conversion.Scope) error { - return autoconvert_extensions_JobSpec_To_v1beta1_JobSpec(in, out, s) +func Convert_extensions_JobSpec_To_v1beta1_JobSpec(in *extensions.JobSpec, out *JobSpec, s conversion.Scope) error { + return autoConvert_extensions_JobSpec_To_v1beta1_JobSpec(in, out, s) } -func autoconvert_extensions_JobStatus_To_v1beta1_JobStatus(in *extensions.JobStatus, out *JobStatus, s conversion.Scope) error { +func autoConvert_extensions_JobStatus_To_v1beta1_JobStatus(in *extensions.JobStatus, out *JobStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.JobStatus))(in) } if in.Conditions != nil { out.Conditions = make([]JobCondition, len(in.Conditions)) for i := range in.Conditions { - if err := convert_extensions_JobCondition_To_v1beta1_JobCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { + if err := Convert_extensions_JobCondition_To_v1beta1_JobCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { return err } } } else { out.Conditions = nil } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.StartTime != nil { - if err := s.Convert(&in.StartTime, &out.StartTime, 0); err != nil { + out.StartTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.StartTime, out.StartTime, s); err != nil { return err } } else { out.StartTime = nil } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.CompletionTime != nil { - if err := s.Convert(&in.CompletionTime, &out.CompletionTime, 0); err != nil { + out.CompletionTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.CompletionTime, out.CompletionTime, s); err != nil { return err } } else { out.CompletionTime = nil } - out.Active = in.Active - out.Succeeded = in.Succeeded - out.Failed = in.Failed + out.Active = int32(in.Active) + out.Succeeded = int32(in.Succeeded) + out.Failed = int32(in.Failed) return nil } -func convert_extensions_JobStatus_To_v1beta1_JobStatus(in *extensions.JobStatus, out *JobStatus, s conversion.Scope) error { - return autoconvert_extensions_JobStatus_To_v1beta1_JobStatus(in, out, s) +func Convert_extensions_JobStatus_To_v1beta1_JobStatus(in *extensions.JobStatus, out *JobStatus, s conversion.Scope) error { + return autoConvert_extensions_JobStatus_To_v1beta1_JobStatus(in, out, s) } -func autoconvert_extensions_NodeUtilization_To_v1beta1_NodeUtilization(in *extensions.NodeUtilization, out *NodeUtilization, s conversion.Scope) error { +func autoConvert_extensions_NodeUtilization_To_v1beta1_NodeUtilization(in *extensions.NodeUtilization, out *NodeUtilization, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.NodeUtilization))(in) } @@ -2882,75 +3520,222 @@ func autoconvert_extensions_NodeUtilization_To_v1beta1_NodeUtilization(in *exten return nil } -func convert_extensions_NodeUtilization_To_v1beta1_NodeUtilization(in *extensions.NodeUtilization, out *NodeUtilization, s conversion.Scope) error { - return autoconvert_extensions_NodeUtilization_To_v1beta1_NodeUtilization(in, out, s) +func Convert_extensions_NodeUtilization_To_v1beta1_NodeUtilization(in *extensions.NodeUtilization, out *NodeUtilization, s conversion.Scope) error { + return autoConvert_extensions_NodeUtilization_To_v1beta1_NodeUtilization(in, out, s) } -func autoconvert_extensions_PodSelector_To_v1beta1_PodSelector(in *extensions.PodSelector, out *PodSelector, s conversion.Scope) error { +func autoConvert_extensions_PodSecurityPolicy_To_v1beta1_PodSecurityPolicy(in *extensions.PodSecurityPolicy, out *PodSecurityPolicy, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*extensions.PodSelector))(in) + defaulting.(func(*extensions.PodSecurityPolicy))(in) } - if in.MatchLabels != nil { - out.MatchLabels = make(map[string]string) - for key, val := range in.MatchLabels { - out.MatchLabels[key] = val - } - } else { - out.MatchLabels = nil + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err } - if in.MatchExpressions != nil { - out.MatchExpressions = make([]PodSelectorRequirement, len(in.MatchExpressions)) - for i := range in.MatchExpressions { - if err := convert_extensions_PodSelectorRequirement_To_v1beta1_PodSelectorRequirement(&in.MatchExpressions[i], &out.MatchExpressions[i], s); err != nil { - return err - } - } - } else { - out.MatchExpressions = nil + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err } - return nil -} - -func convert_extensions_PodSelector_To_v1beta1_PodSelector(in *extensions.PodSelector, out *PodSelector, s conversion.Scope) error { - return autoconvert_extensions_PodSelector_To_v1beta1_PodSelector(in, out, s) -} - -func autoconvert_extensions_PodSelectorRequirement_To_v1beta1_PodSelectorRequirement(in *extensions.PodSelectorRequirement, out *PodSelectorRequirement, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*extensions.PodSelectorRequirement))(in) - } - out.Key = in.Key - out.Operator = PodSelectorOperator(in.Operator) - if in.Values != nil { - out.Values = make([]string, len(in.Values)) - for i := range in.Values { - out.Values[i] = in.Values[i] - } - } else { - out.Values = nil - } - return nil -} - -func convert_extensions_PodSelectorRequirement_To_v1beta1_PodSelectorRequirement(in *extensions.PodSelectorRequirement, out *PodSelectorRequirement, s conversion.Scope) error { - return autoconvert_extensions_PodSelectorRequirement_To_v1beta1_PodSelectorRequirement(in, out, s) -} - -func autoconvert_extensions_ReplicationControllerDummy_To_v1beta1_ReplicationControllerDummy(in *extensions.ReplicationControllerDummy, out *ReplicationControllerDummy, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*extensions.ReplicationControllerDummy))(in) - } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := Convert_extensions_PodSecurityPolicySpec_To_v1beta1_PodSecurityPolicySpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_extensions_ReplicationControllerDummy_To_v1beta1_ReplicationControllerDummy(in *extensions.ReplicationControllerDummy, out *ReplicationControllerDummy, s conversion.Scope) error { - return autoconvert_extensions_ReplicationControllerDummy_To_v1beta1_ReplicationControllerDummy(in, out, s) +func Convert_extensions_PodSecurityPolicy_To_v1beta1_PodSecurityPolicy(in *extensions.PodSecurityPolicy, out *PodSecurityPolicy, s conversion.Scope) error { + return autoConvert_extensions_PodSecurityPolicy_To_v1beta1_PodSecurityPolicy(in, out, s) } -func autoconvert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in *extensions.RollingUpdateDeployment, out *RollingUpdateDeployment, s conversion.Scope) error { +func autoConvert_extensions_PodSecurityPolicyList_To_v1beta1_PodSecurityPolicyList(in *extensions.PodSecurityPolicyList, out *PodSecurityPolicyList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.PodSecurityPolicyList))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]PodSecurityPolicy, len(in.Items)) + for i := range in.Items { + if err := Convert_extensions_PodSecurityPolicy_To_v1beta1_PodSecurityPolicy(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_extensions_PodSecurityPolicyList_To_v1beta1_PodSecurityPolicyList(in *extensions.PodSecurityPolicyList, out *PodSecurityPolicyList, s conversion.Scope) error { + return autoConvert_extensions_PodSecurityPolicyList_To_v1beta1_PodSecurityPolicyList(in, out, s) +} + +func autoConvert_extensions_PodSecurityPolicySpec_To_v1beta1_PodSecurityPolicySpec(in *extensions.PodSecurityPolicySpec, out *PodSecurityPolicySpec, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.PodSecurityPolicySpec))(in) + } + out.Privileged = in.Privileged + if in.Capabilities != nil { + out.Capabilities = make([]v1.Capability, len(in.Capabilities)) + for i := range in.Capabilities { + out.Capabilities[i] = v1.Capability(in.Capabilities[i]) + } + } else { + out.Capabilities = nil + } + if in.Volumes != nil { + out.Volumes = make([]FSType, len(in.Volumes)) + for i := range in.Volumes { + out.Volumes[i] = FSType(in.Volumes[i]) + } + } else { + out.Volumes = nil + } + out.HostNetwork = in.HostNetwork + if in.HostPorts != nil { + out.HostPorts = make([]HostPortRange, len(in.HostPorts)) + for i := range in.HostPorts { + if err := Convert_extensions_HostPortRange_To_v1beta1_HostPortRange(&in.HostPorts[i], &out.HostPorts[i], s); err != nil { + return err + } + } + } else { + out.HostPorts = nil + } + out.HostPID = in.HostPID + out.HostIPC = in.HostIPC + if err := Convert_extensions_SELinuxContextStrategyOptions_To_v1beta1_SELinuxContextStrategyOptions(&in.SELinuxContext, &out.SELinuxContext, s); err != nil { + return err + } + if err := Convert_extensions_RunAsUserStrategyOptions_To_v1beta1_RunAsUserStrategyOptions(&in.RunAsUser, &out.RunAsUser, s); err != nil { + return err + } + return nil +} + +func Convert_extensions_PodSecurityPolicySpec_To_v1beta1_PodSecurityPolicySpec(in *extensions.PodSecurityPolicySpec, out *PodSecurityPolicySpec, s conversion.Scope) error { + return autoConvert_extensions_PodSecurityPolicySpec_To_v1beta1_PodSecurityPolicySpec(in, out, s) +} + +func autoConvert_extensions_ReplicaSet_To_v1beta1_ReplicaSet(in *extensions.ReplicaSet, out *ReplicaSet, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.ReplicaSet))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_extensions_ReplicaSetStatus_To_v1beta1_ReplicaSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func Convert_extensions_ReplicaSet_To_v1beta1_ReplicaSet(in *extensions.ReplicaSet, out *ReplicaSet, s conversion.Scope) error { + return autoConvert_extensions_ReplicaSet_To_v1beta1_ReplicaSet(in, out, s) +} + +func autoConvert_extensions_ReplicaSetList_To_v1beta1_ReplicaSetList(in *extensions.ReplicaSetList, out *ReplicaSetList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.ReplicaSetList))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]ReplicaSet, len(in.Items)) + for i := range in.Items { + if err := Convert_extensions_ReplicaSet_To_v1beta1_ReplicaSet(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_extensions_ReplicaSetList_To_v1beta1_ReplicaSetList(in *extensions.ReplicaSetList, out *ReplicaSetList, s conversion.Scope) error { + return autoConvert_extensions_ReplicaSetList_To_v1beta1_ReplicaSetList(in, out, s) +} + +func autoConvert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec(in *extensions.ReplicaSetSpec, out *ReplicaSetSpec, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.ReplicaSetSpec))(in) + } + if err := s.Convert(&in.Replicas, &out.Replicas, 0); err != nil { + return err + } + // unable to generate simple pointer conversion for unversioned.LabelSelector -> v1beta1.LabelSelector + if in.Selector != nil { + out.Selector = new(LabelSelector) + if err := Convert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil { + return err + } + } else { + out.Selector = nil + } + // unable to generate simple pointer conversion for api.PodTemplateSpec -> v1.PodTemplateSpec + if in.Template != nil { + out.Template = new(v1.PodTemplateSpec) + if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil { + return err + } + } else { + out.Template = nil + } + return nil +} + +func autoConvert_extensions_ReplicaSetStatus_To_v1beta1_ReplicaSetStatus(in *extensions.ReplicaSetStatus, out *ReplicaSetStatus, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.ReplicaSetStatus))(in) + } + out.Replicas = int32(in.Replicas) + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +func Convert_extensions_ReplicaSetStatus_To_v1beta1_ReplicaSetStatus(in *extensions.ReplicaSetStatus, out *ReplicaSetStatus, s conversion.Scope) error { + return autoConvert_extensions_ReplicaSetStatus_To_v1beta1_ReplicaSetStatus(in, out, s) +} + +func autoConvert_extensions_ReplicationControllerDummy_To_v1beta1_ReplicationControllerDummy(in *extensions.ReplicationControllerDummy, out *ReplicationControllerDummy, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.ReplicationControllerDummy))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + return nil +} + +func Convert_extensions_ReplicationControllerDummy_To_v1beta1_ReplicationControllerDummy(in *extensions.ReplicationControllerDummy, out *ReplicationControllerDummy, s conversion.Scope) error { + return autoConvert_extensions_ReplicationControllerDummy_To_v1beta1_ReplicationControllerDummy(in, out, s) +} + +func autoConvert_extensions_RollbackConfig_To_v1beta1_RollbackConfig(in *extensions.RollbackConfig, out *RollbackConfig, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.RollbackConfig))(in) + } + out.Revision = in.Revision + return nil +} + +func Convert_extensions_RollbackConfig_To_v1beta1_RollbackConfig(in *extensions.RollbackConfig, out *RollbackConfig, s conversion.Scope) error { + return autoConvert_extensions_RollbackConfig_To_v1beta1_RollbackConfig(in, out, s) +} + +func autoConvert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in *extensions.RollingUpdateDeployment, out *RollingUpdateDeployment, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.RollingUpdateDeployment))(in) } @@ -2960,50 +3745,92 @@ func autoconvert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDepl if err := s.Convert(&in.MaxSurge, &out.MaxSurge, 0); err != nil { return err } - out.MinReadySeconds = in.MinReadySeconds return nil } -func autoconvert_extensions_Scale_To_v1beta1_Scale(in *extensions.Scale, out *Scale, s conversion.Scope) error { +func autoConvert_extensions_RunAsUserStrategyOptions_To_v1beta1_RunAsUserStrategyOptions(in *extensions.RunAsUserStrategyOptions, out *RunAsUserStrategyOptions, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.RunAsUserStrategyOptions))(in) + } + out.Type = RunAsUserStrategy(in.Type) + if in.Ranges != nil { + out.Ranges = make([]IDRange, len(in.Ranges)) + for i := range in.Ranges { + if err := Convert_extensions_IDRange_To_v1beta1_IDRange(&in.Ranges[i], &out.Ranges[i], s); err != nil { + return err + } + } + } else { + out.Ranges = nil + } + return nil +} + +func Convert_extensions_RunAsUserStrategyOptions_To_v1beta1_RunAsUserStrategyOptions(in *extensions.RunAsUserStrategyOptions, out *RunAsUserStrategyOptions, s conversion.Scope) error { + return autoConvert_extensions_RunAsUserStrategyOptions_To_v1beta1_RunAsUserStrategyOptions(in, out, s) +} + +func autoConvert_extensions_SELinuxContextStrategyOptions_To_v1beta1_SELinuxContextStrategyOptions(in *extensions.SELinuxContextStrategyOptions, out *SELinuxContextStrategyOptions, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*extensions.SELinuxContextStrategyOptions))(in) + } + out.Type = SELinuxContextStrategy(in.Type) + // unable to generate simple pointer conversion for api.SELinuxOptions -> v1.SELinuxOptions + if in.SELinuxOptions != nil { + out.SELinuxOptions = new(v1.SELinuxOptions) + if err := Convert_api_SELinuxOptions_To_v1_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + return err + } + } else { + out.SELinuxOptions = nil + } + return nil +} + +func Convert_extensions_SELinuxContextStrategyOptions_To_v1beta1_SELinuxContextStrategyOptions(in *extensions.SELinuxContextStrategyOptions, out *SELinuxContextStrategyOptions, s conversion.Scope) error { + return autoConvert_extensions_SELinuxContextStrategyOptions_To_v1beta1_SELinuxContextStrategyOptions(in, out, s) +} + +func autoConvert_extensions_Scale_To_v1beta1_Scale(in *extensions.Scale, out *Scale, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.Scale))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_extensions_Scale_To_v1beta1_Scale(in *extensions.Scale, out *Scale, s conversion.Scope) error { - return autoconvert_extensions_Scale_To_v1beta1_Scale(in, out, s) +func Convert_extensions_Scale_To_v1beta1_Scale(in *extensions.Scale, out *Scale, s conversion.Scope) error { + return autoConvert_extensions_Scale_To_v1beta1_Scale(in, out, s) } -func autoconvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleSpec, out *ScaleSpec, s conversion.Scope) error { +func autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleSpec, out *ScaleSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.ScaleSpec))(in) } - out.Replicas = in.Replicas + out.Replicas = int32(in.Replicas) return nil } -func convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleSpec, out *ScaleSpec, s conversion.Scope) error { - return autoconvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in, out, s) +func Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleSpec, out *ScaleSpec, s conversion.Scope) error { + return autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in, out, s) } -func autoconvert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *ScaleStatus, s conversion.Scope) error { +func autoConvert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *ScaleStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.ScaleStatus))(in) } - out.Replicas = in.Replicas + out.Replicas = int32(in.Replicas) if in.Selector != nil { out.Selector = make(map[string]string) for key, val := range in.Selector { @@ -3015,41 +3842,40 @@ func autoconvert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.Sc return nil } -func convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *ScaleStatus, s conversion.Scope) error { - return autoconvert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in, out, s) +func Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *ScaleStatus, s conversion.Scope) error { + return autoConvert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in, out, s) } -func autoconvert_extensions_SubresourceReference_To_v1beta1_SubresourceReference(in *extensions.SubresourceReference, out *SubresourceReference, s conversion.Scope) error { +func autoConvert_extensions_SubresourceReference_To_v1beta1_SubresourceReference(in *extensions.SubresourceReference, out *SubresourceReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.SubresourceReference))(in) } out.Kind = in.Kind - out.Namespace = in.Namespace out.Name = in.Name out.APIVersion = in.APIVersion out.Subresource = in.Subresource return nil } -func convert_extensions_SubresourceReference_To_v1beta1_SubresourceReference(in *extensions.SubresourceReference, out *SubresourceReference, s conversion.Scope) error { - return autoconvert_extensions_SubresourceReference_To_v1beta1_SubresourceReference(in, out, s) +func Convert_extensions_SubresourceReference_To_v1beta1_SubresourceReference(in *extensions.SubresourceReference, out *SubresourceReference, s conversion.Scope) error { + return autoConvert_extensions_SubresourceReference_To_v1beta1_SubresourceReference(in, out, s) } -func autoconvert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource(in *extensions.ThirdPartyResource, out *ThirdPartyResource, s conversion.Scope) error { +func autoConvert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource(in *extensions.ThirdPartyResource, out *ThirdPartyResource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.ThirdPartyResource))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } out.Description = in.Description if in.Versions != nil { out.Versions = make([]APIVersion, len(in.Versions)) for i := range in.Versions { - if err := convert_extensions_APIVersion_To_v1beta1_APIVersion(&in.Versions[i], &out.Versions[i], s); err != nil { + if err := Convert_extensions_APIVersion_To_v1beta1_APIVersion(&in.Versions[i], &out.Versions[i], s); err != nil { return err } } @@ -3059,44 +3885,44 @@ func autoconvert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource(in return nil } -func convert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource(in *extensions.ThirdPartyResource, out *ThirdPartyResource, s conversion.Scope) error { - return autoconvert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource(in, out, s) +func Convert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource(in *extensions.ThirdPartyResource, out *ThirdPartyResource, s conversion.Scope) error { + return autoConvert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource(in, out, s) } -func autoconvert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData(in *extensions.ThirdPartyResourceData, out *ThirdPartyResourceData, s conversion.Scope) error { +func autoConvert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData(in *extensions.ThirdPartyResourceData, out *ThirdPartyResourceData, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.ThirdPartyResourceData))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := s.Convert(&in.Data, &out.Data, 0); err != nil { + if err := conversion.ByteSliceCopy(&in.Data, &out.Data, s); err != nil { return err } return nil } -func convert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData(in *extensions.ThirdPartyResourceData, out *ThirdPartyResourceData, s conversion.Scope) error { - return autoconvert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData(in, out, s) +func Convert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData(in *extensions.ThirdPartyResourceData, out *ThirdPartyResourceData, s conversion.Scope) error { + return autoConvert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData(in, out, s) } -func autoconvert_extensions_ThirdPartyResourceDataList_To_v1beta1_ThirdPartyResourceDataList(in *extensions.ThirdPartyResourceDataList, out *ThirdPartyResourceDataList, s conversion.Scope) error { +func autoConvert_extensions_ThirdPartyResourceDataList_To_v1beta1_ThirdPartyResourceDataList(in *extensions.ThirdPartyResourceDataList, out *ThirdPartyResourceDataList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.ThirdPartyResourceDataList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]ThirdPartyResourceData, len(in.Items)) for i := range in.Items { - if err := convert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3106,24 +3932,24 @@ func autoconvert_extensions_ThirdPartyResourceDataList_To_v1beta1_ThirdPartyReso return nil } -func convert_extensions_ThirdPartyResourceDataList_To_v1beta1_ThirdPartyResourceDataList(in *extensions.ThirdPartyResourceDataList, out *ThirdPartyResourceDataList, s conversion.Scope) error { - return autoconvert_extensions_ThirdPartyResourceDataList_To_v1beta1_ThirdPartyResourceDataList(in, out, s) +func Convert_extensions_ThirdPartyResourceDataList_To_v1beta1_ThirdPartyResourceDataList(in *extensions.ThirdPartyResourceDataList, out *ThirdPartyResourceDataList, s conversion.Scope) error { + return autoConvert_extensions_ThirdPartyResourceDataList_To_v1beta1_ThirdPartyResourceDataList(in, out, s) } -func autoconvert_extensions_ThirdPartyResourceList_To_v1beta1_ThirdPartyResourceList(in *extensions.ThirdPartyResourceList, out *ThirdPartyResourceList, s conversion.Scope) error { +func autoConvert_extensions_ThirdPartyResourceList_To_v1beta1_ThirdPartyResourceList(in *extensions.ThirdPartyResourceList, out *ThirdPartyResourceList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*extensions.ThirdPartyResourceList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]ThirdPartyResource, len(in.Items)) for i := range in.Items { - if err := convert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3133,11 +3959,11 @@ func autoconvert_extensions_ThirdPartyResourceList_To_v1beta1_ThirdPartyResource return nil } -func convert_extensions_ThirdPartyResourceList_To_v1beta1_ThirdPartyResourceList(in *extensions.ThirdPartyResourceList, out *ThirdPartyResourceList, s conversion.Scope) error { - return autoconvert_extensions_ThirdPartyResourceList_To_v1beta1_ThirdPartyResourceList(in, out, s) +func Convert_extensions_ThirdPartyResourceList_To_v1beta1_ThirdPartyResourceList(in *extensions.ThirdPartyResourceList, out *ThirdPartyResourceList, s conversion.Scope) error { + return autoConvert_extensions_ThirdPartyResourceList_To_v1beta1_ThirdPartyResourceList(in, out, s) } -func autoconvert_v1beta1_APIVersion_To_extensions_APIVersion(in *APIVersion, out *extensions.APIVersion, s conversion.Scope) error { +func autoConvert_v1beta1_APIVersion_To_extensions_APIVersion(in *APIVersion, out *extensions.APIVersion, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*APIVersion))(in) } @@ -3146,56 +3972,56 @@ func autoconvert_v1beta1_APIVersion_To_extensions_APIVersion(in *APIVersion, out return nil } -func convert_v1beta1_APIVersion_To_extensions_APIVersion(in *APIVersion, out *extensions.APIVersion, s conversion.Scope) error { - return autoconvert_v1beta1_APIVersion_To_extensions_APIVersion(in, out, s) +func Convert_v1beta1_APIVersion_To_extensions_APIVersion(in *APIVersion, out *extensions.APIVersion, s conversion.Scope) error { + return autoConvert_v1beta1_APIVersion_To_extensions_APIVersion(in, out, s) } -func autoconvert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization(in *CPUTargetUtilization, out *extensions.CPUTargetUtilization, s conversion.Scope) error { +func autoConvert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization(in *CPUTargetUtilization, out *extensions.CPUTargetUtilization, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*CPUTargetUtilization))(in) } - out.TargetPercentage = in.TargetPercentage + out.TargetPercentage = int(in.TargetPercentage) return nil } -func convert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization(in *CPUTargetUtilization, out *extensions.CPUTargetUtilization, s conversion.Scope) error { - return autoconvert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization(in, out, s) +func Convert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization(in *CPUTargetUtilization, out *extensions.CPUTargetUtilization, s conversion.Scope) error { + return autoConvert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization(in, out, s) } -func autoconvert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler(in *ClusterAutoscaler, out *extensions.ClusterAutoscaler, s conversion.Scope) error { +func autoConvert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler(in *ClusterAutoscaler, out *extensions.ClusterAutoscaler, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ClusterAutoscaler))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler(in *ClusterAutoscaler, out *extensions.ClusterAutoscaler, s conversion.Scope) error { - return autoconvert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler(in, out, s) +func Convert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler(in *ClusterAutoscaler, out *extensions.ClusterAutoscaler, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler(in, out, s) } -func autoconvert_v1beta1_ClusterAutoscalerList_To_extensions_ClusterAutoscalerList(in *ClusterAutoscalerList, out *extensions.ClusterAutoscalerList, s conversion.Scope) error { +func autoConvert_v1beta1_ClusterAutoscalerList_To_extensions_ClusterAutoscalerList(in *ClusterAutoscalerList, out *extensions.ClusterAutoscalerList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ClusterAutoscalerList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]extensions.ClusterAutoscaler, len(in.Items)) for i := range in.Items { - if err := convert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3205,20 +4031,20 @@ func autoconvert_v1beta1_ClusterAutoscalerList_To_extensions_ClusterAutoscalerLi return nil } -func convert_v1beta1_ClusterAutoscalerList_To_extensions_ClusterAutoscalerList(in *ClusterAutoscalerList, out *extensions.ClusterAutoscalerList, s conversion.Scope) error { - return autoconvert_v1beta1_ClusterAutoscalerList_To_extensions_ClusterAutoscalerList(in, out, s) +func Convert_v1beta1_ClusterAutoscalerList_To_extensions_ClusterAutoscalerList(in *ClusterAutoscalerList, out *extensions.ClusterAutoscalerList, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterAutoscalerList_To_extensions_ClusterAutoscalerList(in, out, s) } -func autoconvert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec(in *ClusterAutoscalerSpec, out *extensions.ClusterAutoscalerSpec, s conversion.Scope) error { +func autoConvert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec(in *ClusterAutoscalerSpec, out *extensions.ClusterAutoscalerSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ClusterAutoscalerSpec))(in) } - out.MinNodes = in.MinNodes - out.MaxNodes = in.MaxNodes + out.MinNodes = int(in.MinNodes) + out.MaxNodes = int(in.MaxNodes) if in.TargetUtilization != nil { out.TargetUtilization = make([]extensions.NodeUtilization, len(in.TargetUtilization)) for i := range in.TargetUtilization { - if err := convert_v1beta1_NodeUtilization_To_extensions_NodeUtilization(&in.TargetUtilization[i], &out.TargetUtilization[i], s); err != nil { + if err := Convert_v1beta1_NodeUtilization_To_extensions_NodeUtilization(&in.TargetUtilization[i], &out.TargetUtilization[i], s); err != nil { return err } } @@ -3228,47 +4054,47 @@ func autoconvert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSp return nil } -func convert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec(in *ClusterAutoscalerSpec, out *extensions.ClusterAutoscalerSpec, s conversion.Scope) error { - return autoconvert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec(in, out, s) +func Convert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec(in *ClusterAutoscalerSpec, out *extensions.ClusterAutoscalerSpec, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec(in, out, s) } -func autoconvert_v1beta1_DaemonSet_To_extensions_DaemonSet(in *DaemonSet, out *extensions.DaemonSet, s conversion.Scope) error { +func autoConvert_v1beta1_DaemonSet_To_extensions_DaemonSet(in *DaemonSet, out *extensions.DaemonSet, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DaemonSet))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1beta1_DaemonSet_To_extensions_DaemonSet(in *DaemonSet, out *extensions.DaemonSet, s conversion.Scope) error { - return autoconvert_v1beta1_DaemonSet_To_extensions_DaemonSet(in, out, s) +func Convert_v1beta1_DaemonSet_To_extensions_DaemonSet(in *DaemonSet, out *extensions.DaemonSet, s conversion.Scope) error { + return autoConvert_v1beta1_DaemonSet_To_extensions_DaemonSet(in, out, s) } -func autoconvert_v1beta1_DaemonSetList_To_extensions_DaemonSetList(in *DaemonSetList, out *extensions.DaemonSetList, s conversion.Scope) error { +func autoConvert_v1beta1_DaemonSetList_To_extensions_DaemonSetList(in *DaemonSetList, out *extensions.DaemonSetList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DaemonSetList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]extensions.DaemonSet, len(in.Items)) for i := range in.Items { - if err := convert_v1beta1_DaemonSet_To_extensions_DaemonSet(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1beta1_DaemonSet_To_extensions_DaemonSet(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3278,88 +4104,84 @@ func autoconvert_v1beta1_DaemonSetList_To_extensions_DaemonSetList(in *DaemonSet return nil } -func convert_v1beta1_DaemonSetList_To_extensions_DaemonSetList(in *DaemonSetList, out *extensions.DaemonSetList, s conversion.Scope) error { - return autoconvert_v1beta1_DaemonSetList_To_extensions_DaemonSetList(in, out, s) +func Convert_v1beta1_DaemonSetList_To_extensions_DaemonSetList(in *DaemonSetList, out *extensions.DaemonSetList, s conversion.Scope) error { + return autoConvert_v1beta1_DaemonSetList_To_extensions_DaemonSetList(in, out, s) } -func autoconvert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec(in *DaemonSetSpec, out *extensions.DaemonSetSpec, s conversion.Scope) error { +func autoConvert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec(in *DaemonSetSpec, out *extensions.DaemonSetSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DaemonSetSpec))(in) } + // unable to generate simple pointer conversion for v1beta1.LabelSelector -> unversioned.LabelSelector if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + out.Selector = new(unversioned.LabelSelector) + if err := Convert_v1beta1_LabelSelector_To_unversioned_LabelSelector(in.Selector, out.Selector, s); err != nil { + return err } } else { out.Selector = nil } - if in.Template != nil { - out.Template = new(api.PodTemplateSpec) - if err := convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil { - return err - } - } else { - out.Template = nil + if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err } return nil } -func convert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec(in *DaemonSetSpec, out *extensions.DaemonSetSpec, s conversion.Scope) error { - return autoconvert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec(in, out, s) +func Convert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec(in *DaemonSetSpec, out *extensions.DaemonSetSpec, s conversion.Scope) error { + return autoConvert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec(in, out, s) } -func autoconvert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(in *DaemonSetStatus, out *extensions.DaemonSetStatus, s conversion.Scope) error { +func autoConvert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(in *DaemonSetStatus, out *extensions.DaemonSetStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DaemonSetStatus))(in) } - out.CurrentNumberScheduled = in.CurrentNumberScheduled - out.NumberMisscheduled = in.NumberMisscheduled - out.DesiredNumberScheduled = in.DesiredNumberScheduled + out.CurrentNumberScheduled = int(in.CurrentNumberScheduled) + out.NumberMisscheduled = int(in.NumberMisscheduled) + out.DesiredNumberScheduled = int(in.DesiredNumberScheduled) return nil } -func convert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(in *DaemonSetStatus, out *extensions.DaemonSetStatus, s conversion.Scope) error { - return autoconvert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(in, out, s) +func Convert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(in *DaemonSetStatus, out *extensions.DaemonSetStatus, s conversion.Scope) error { + return autoConvert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(in, out, s) } -func autoconvert_v1beta1_Deployment_To_extensions_Deployment(in *Deployment, out *extensions.Deployment, s conversion.Scope) error { +func autoConvert_v1beta1_Deployment_To_extensions_Deployment(in *Deployment, out *extensions.Deployment, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Deployment))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1beta1_Deployment_To_extensions_Deployment(in *Deployment, out *extensions.Deployment, s conversion.Scope) error { - return autoconvert_v1beta1_Deployment_To_extensions_Deployment(in, out, s) +func Convert_v1beta1_Deployment_To_extensions_Deployment(in *Deployment, out *extensions.Deployment, s conversion.Scope) error { + return autoConvert_v1beta1_Deployment_To_extensions_Deployment(in, out, s) } -func autoconvert_v1beta1_DeploymentList_To_extensions_DeploymentList(in *DeploymentList, out *extensions.DeploymentList, s conversion.Scope) error { +func autoConvert_v1beta1_DeploymentList_To_extensions_DeploymentList(in *DeploymentList, out *extensions.DeploymentList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DeploymentList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]extensions.Deployment, len(in.Items)) for i := range in.Items { - if err := convert_v1beta1_Deployment_To_extensions_Deployment(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1beta1_Deployment_To_extensions_Deployment(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3369,74 +4191,114 @@ func autoconvert_v1beta1_DeploymentList_To_extensions_DeploymentList(in *Deploym return nil } -func convert_v1beta1_DeploymentList_To_extensions_DeploymentList(in *DeploymentList, out *extensions.DeploymentList, s conversion.Scope) error { - return autoconvert_v1beta1_DeploymentList_To_extensions_DeploymentList(in, out, s) +func Convert_v1beta1_DeploymentList_To_extensions_DeploymentList(in *DeploymentList, out *extensions.DeploymentList, s conversion.Scope) error { + return autoConvert_v1beta1_DeploymentList_To_extensions_DeploymentList(in, out, s) } -func autoconvert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentSpec, out *extensions.DeploymentSpec, s conversion.Scope) error { +func autoConvert_v1beta1_DeploymentRollback_To_extensions_DeploymentRollback(in *DeploymentRollback, out *extensions.DeploymentRollback, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*DeploymentRollback))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + out.Name = in.Name + if in.UpdatedAnnotations != nil { + out.UpdatedAnnotations = make(map[string]string) + for key, val := range in.UpdatedAnnotations { + out.UpdatedAnnotations[key] = val + } + } else { + out.UpdatedAnnotations = nil + } + if err := Convert_v1beta1_RollbackConfig_To_extensions_RollbackConfig(&in.RollbackTo, &out.RollbackTo, s); err != nil { + return err + } + return nil +} + +func Convert_v1beta1_DeploymentRollback_To_extensions_DeploymentRollback(in *DeploymentRollback, out *extensions.DeploymentRollback, s conversion.Scope) error { + return autoConvert_v1beta1_DeploymentRollback_To_extensions_DeploymentRollback(in, out, s) +} + +func autoConvert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentSpec, out *extensions.DeploymentSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DeploymentSpec))(in) } // in.Replicas has no peer in out + // unable to generate simple pointer conversion for v1beta1.LabelSelector -> unversioned.LabelSelector if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + out.Selector = new(unversioned.LabelSelector) + if err := Convert_v1beta1_LabelSelector_To_unversioned_LabelSelector(in.Selector, out.Selector, s); err != nil { + return err } } else { out.Selector = nil } - if in.Template != nil { - out.Template = new(api.PodTemplateSpec) - if err := convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil { + if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + if err := s.Convert(&in.Strategy, &out.Strategy, 0); err != nil { + return err + } + out.MinReadySeconds = int(in.MinReadySeconds) + if in.RevisionHistoryLimit != nil { + out.RevisionHistoryLimit = new(int) + *out.RevisionHistoryLimit = int(*in.RevisionHistoryLimit) + } else { + out.RevisionHistoryLimit = nil + } + out.Paused = in.Paused + // unable to generate simple pointer conversion for v1beta1.RollbackConfig -> extensions.RollbackConfig + if in.RollbackTo != nil { + out.RollbackTo = new(extensions.RollbackConfig) + if err := Convert_v1beta1_RollbackConfig_To_extensions_RollbackConfig(in.RollbackTo, out.RollbackTo, s); err != nil { return err } } else { - out.Template = nil + out.RollbackTo = nil } - if err := convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { - return err - } - // in.UniqueLabelKey has no peer in out return nil } -func autoconvert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(in *DeploymentStatus, out *extensions.DeploymentStatus, s conversion.Scope) error { +func autoConvert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(in *DeploymentStatus, out *extensions.DeploymentStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DeploymentStatus))(in) } - out.Replicas = in.Replicas - out.UpdatedReplicas = in.UpdatedReplicas + out.Replicas = int(in.Replicas) + out.UpdatedReplicas = int(in.UpdatedReplicas) + out.AvailableReplicas = int(in.AvailableReplicas) + out.UnavailableReplicas = int(in.UnavailableReplicas) return nil } -func convert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(in *DeploymentStatus, out *extensions.DeploymentStatus, s conversion.Scope) error { - return autoconvert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(in, out, s) +func Convert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(in *DeploymentStatus, out *extensions.DeploymentStatus, s conversion.Scope) error { + return autoConvert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(in, out, s) } -func autoconvert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath(in *HTTPIngressPath, out *extensions.HTTPIngressPath, s conversion.Scope) error { +func autoConvert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath(in *HTTPIngressPath, out *extensions.HTTPIngressPath, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*HTTPIngressPath))(in) } out.Path = in.Path - if err := convert_v1beta1_IngressBackend_To_extensions_IngressBackend(&in.Backend, &out.Backend, s); err != nil { + if err := Convert_v1beta1_IngressBackend_To_extensions_IngressBackend(&in.Backend, &out.Backend, s); err != nil { return err } return nil } -func convert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath(in *HTTPIngressPath, out *extensions.HTTPIngressPath, s conversion.Scope) error { - return autoconvert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath(in, out, s) +func Convert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath(in *HTTPIngressPath, out *extensions.HTTPIngressPath, s conversion.Scope) error { + return autoConvert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath(in, out, s) } -func autoconvert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue(in *HTTPIngressRuleValue, out *extensions.HTTPIngressRuleValue, s conversion.Scope) error { +func autoConvert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue(in *HTTPIngressRuleValue, out *extensions.HTTPIngressRuleValue, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*HTTPIngressRuleValue))(in) } if in.Paths != nil { out.Paths = make([]extensions.HTTPIngressPath, len(in.Paths)) for i := range in.Paths { - if err := convert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath(&in.Paths[i], &out.Paths[i], s); err != nil { + if err := Convert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath(&in.Paths[i], &out.Paths[i], s); err != nil { return err } } @@ -3446,47 +4308,47 @@ func autoconvert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue return nil } -func convert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue(in *HTTPIngressRuleValue, out *extensions.HTTPIngressRuleValue, s conversion.Scope) error { - return autoconvert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue(in, out, s) +func Convert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue(in *HTTPIngressRuleValue, out *extensions.HTTPIngressRuleValue, s conversion.Scope) error { + return autoConvert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue(in, out, s) } -func autoconvert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler(in *HorizontalPodAutoscaler, out *extensions.HorizontalPodAutoscaler, s conversion.Scope) error { +func autoConvert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler(in *HorizontalPodAutoscaler, out *extensions.HorizontalPodAutoscaler, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*HorizontalPodAutoscaler))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler(in *HorizontalPodAutoscaler, out *extensions.HorizontalPodAutoscaler, s conversion.Scope) error { - return autoconvert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler(in, out, s) +func Convert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler(in *HorizontalPodAutoscaler, out *extensions.HorizontalPodAutoscaler, s conversion.Scope) error { + return autoConvert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler(in, out, s) } -func autoconvert_v1beta1_HorizontalPodAutoscalerList_To_extensions_HorizontalPodAutoscalerList(in *HorizontalPodAutoscalerList, out *extensions.HorizontalPodAutoscalerList, s conversion.Scope) error { +func autoConvert_v1beta1_HorizontalPodAutoscalerList_To_extensions_HorizontalPodAutoscalerList(in *HorizontalPodAutoscalerList, out *extensions.HorizontalPodAutoscalerList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*HorizontalPodAutoscalerList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]extensions.HorizontalPodAutoscaler, len(in.Items)) for i := range in.Items { - if err := convert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3496,27 +4358,28 @@ func autoconvert_v1beta1_HorizontalPodAutoscalerList_To_extensions_HorizontalPod return nil } -func convert_v1beta1_HorizontalPodAutoscalerList_To_extensions_HorizontalPodAutoscalerList(in *HorizontalPodAutoscalerList, out *extensions.HorizontalPodAutoscalerList, s conversion.Scope) error { - return autoconvert_v1beta1_HorizontalPodAutoscalerList_To_extensions_HorizontalPodAutoscalerList(in, out, s) +func Convert_v1beta1_HorizontalPodAutoscalerList_To_extensions_HorizontalPodAutoscalerList(in *HorizontalPodAutoscalerList, out *extensions.HorizontalPodAutoscalerList, s conversion.Scope) error { + return autoConvert_v1beta1_HorizontalPodAutoscalerList_To_extensions_HorizontalPodAutoscalerList(in, out, s) } -func autoconvert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec(in *HorizontalPodAutoscalerSpec, out *extensions.HorizontalPodAutoscalerSpec, s conversion.Scope) error { +func autoConvert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec(in *HorizontalPodAutoscalerSpec, out *extensions.HorizontalPodAutoscalerSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*HorizontalPodAutoscalerSpec))(in) } - if err := convert_v1beta1_SubresourceReference_To_extensions_SubresourceReference(&in.ScaleRef, &out.ScaleRef, s); err != nil { + if err := Convert_v1beta1_SubresourceReference_To_extensions_SubresourceReference(&in.ScaleRef, &out.ScaleRef, s); err != nil { return err } if in.MinReplicas != nil { out.MinReplicas = new(int) - *out.MinReplicas = *in.MinReplicas + *out.MinReplicas = int(*in.MinReplicas) } else { out.MinReplicas = nil } - out.MaxReplicas = in.MaxReplicas + out.MaxReplicas = int(in.MaxReplicas) + // unable to generate simple pointer conversion for v1beta1.CPUTargetUtilization -> extensions.CPUTargetUtilization if in.CPUUtilization != nil { out.CPUUtilization = new(extensions.CPUTargetUtilization) - if err := convert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization(in.CPUUtilization, out.CPUUtilization, s); err != nil { + if err := Convert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization(in.CPUUtilization, out.CPUUtilization, s); err != nil { return err } } else { @@ -3525,11 +4388,11 @@ func autoconvert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPod return nil } -func convert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec(in *HorizontalPodAutoscalerSpec, out *extensions.HorizontalPodAutoscalerSpec, s conversion.Scope) error { - return autoconvert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec(in, out, s) +func Convert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec(in *HorizontalPodAutoscalerSpec, out *extensions.HorizontalPodAutoscalerSpec, s conversion.Scope) error { + return autoConvert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec(in, out, s) } -func autoconvert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus(in *HorizontalPodAutoscalerStatus, out *extensions.HorizontalPodAutoscalerStatus, s conversion.Scope) error { +func autoConvert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus(in *HorizontalPodAutoscalerStatus, out *extensions.HorizontalPodAutoscalerStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*HorizontalPodAutoscalerStatus))(in) } @@ -3539,80 +4402,108 @@ func autoconvert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalP } else { out.ObservedGeneration = nil } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.LastScaleTime != nil { - if err := s.Convert(&in.LastScaleTime, &out.LastScaleTime, 0); err != nil { + out.LastScaleTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.LastScaleTime, out.LastScaleTime, s); err != nil { return err } } else { out.LastScaleTime = nil } - out.CurrentReplicas = in.CurrentReplicas - out.DesiredReplicas = in.DesiredReplicas + out.CurrentReplicas = int(in.CurrentReplicas) + out.DesiredReplicas = int(in.DesiredReplicas) if in.CurrentCPUUtilizationPercentage != nil { out.CurrentCPUUtilizationPercentage = new(int) - *out.CurrentCPUUtilizationPercentage = *in.CurrentCPUUtilizationPercentage + *out.CurrentCPUUtilizationPercentage = int(*in.CurrentCPUUtilizationPercentage) } else { out.CurrentCPUUtilizationPercentage = nil } return nil } -func convert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus(in *HorizontalPodAutoscalerStatus, out *extensions.HorizontalPodAutoscalerStatus, s conversion.Scope) error { - return autoconvert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus(in, out, s) +func Convert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus(in *HorizontalPodAutoscalerStatus, out *extensions.HorizontalPodAutoscalerStatus, s conversion.Scope) error { + return autoConvert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus(in, out, s) } -func autoconvert_v1beta1_Ingress_To_extensions_Ingress(in *Ingress, out *extensions.Ingress, s conversion.Scope) error { +func autoConvert_v1beta1_HostPortRange_To_extensions_HostPortRange(in *HostPortRange, out *extensions.HostPortRange, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*HostPortRange))(in) + } + out.Min = int(in.Min) + out.Max = int(in.Max) + return nil +} + +func Convert_v1beta1_HostPortRange_To_extensions_HostPortRange(in *HostPortRange, out *extensions.HostPortRange, s conversion.Scope) error { + return autoConvert_v1beta1_HostPortRange_To_extensions_HostPortRange(in, out, s) +} + +func autoConvert_v1beta1_IDRange_To_extensions_IDRange(in *IDRange, out *extensions.IDRange, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*IDRange))(in) + } + out.Min = in.Min + out.Max = in.Max + return nil +} + +func Convert_v1beta1_IDRange_To_extensions_IDRange(in *IDRange, out *extensions.IDRange, s conversion.Scope) error { + return autoConvert_v1beta1_IDRange_To_extensions_IDRange(in, out, s) +} + +func autoConvert_v1beta1_Ingress_To_extensions_Ingress(in *Ingress, out *extensions.Ingress, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Ingress))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1beta1_IngressSpec_To_extensions_IngressSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1beta1_IngressSpec_To_extensions_IngressSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1beta1_IngressStatus_To_extensions_IngressStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1beta1_IngressStatus_To_extensions_IngressStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1beta1_Ingress_To_extensions_Ingress(in *Ingress, out *extensions.Ingress, s conversion.Scope) error { - return autoconvert_v1beta1_Ingress_To_extensions_Ingress(in, out, s) +func Convert_v1beta1_Ingress_To_extensions_Ingress(in *Ingress, out *extensions.Ingress, s conversion.Scope) error { + return autoConvert_v1beta1_Ingress_To_extensions_Ingress(in, out, s) } -func autoconvert_v1beta1_IngressBackend_To_extensions_IngressBackend(in *IngressBackend, out *extensions.IngressBackend, s conversion.Scope) error { +func autoConvert_v1beta1_IngressBackend_To_extensions_IngressBackend(in *IngressBackend, out *extensions.IngressBackend, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*IngressBackend))(in) } out.ServiceName = in.ServiceName - if err := s.Convert(&in.ServicePort, &out.ServicePort, 0); err != nil { + if err := api.Convert_intstr_IntOrString_To_intstr_IntOrString(&in.ServicePort, &out.ServicePort, s); err != nil { return err } return nil } -func convert_v1beta1_IngressBackend_To_extensions_IngressBackend(in *IngressBackend, out *extensions.IngressBackend, s conversion.Scope) error { - return autoconvert_v1beta1_IngressBackend_To_extensions_IngressBackend(in, out, s) +func Convert_v1beta1_IngressBackend_To_extensions_IngressBackend(in *IngressBackend, out *extensions.IngressBackend, s conversion.Scope) error { + return autoConvert_v1beta1_IngressBackend_To_extensions_IngressBackend(in, out, s) } -func autoconvert_v1beta1_IngressList_To_extensions_IngressList(in *IngressList, out *extensions.IngressList, s conversion.Scope) error { +func autoConvert_v1beta1_IngressList_To_extensions_IngressList(in *IngressList, out *extensions.IngressList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*IngressList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]extensions.Ingress, len(in.Items)) for i := range in.Items { - if err := convert_v1beta1_Ingress_To_extensions_Ingress(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1beta1_Ingress_To_extensions_Ingress(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3622,32 +4513,33 @@ func autoconvert_v1beta1_IngressList_To_extensions_IngressList(in *IngressList, return nil } -func convert_v1beta1_IngressList_To_extensions_IngressList(in *IngressList, out *extensions.IngressList, s conversion.Scope) error { - return autoconvert_v1beta1_IngressList_To_extensions_IngressList(in, out, s) +func Convert_v1beta1_IngressList_To_extensions_IngressList(in *IngressList, out *extensions.IngressList, s conversion.Scope) error { + return autoConvert_v1beta1_IngressList_To_extensions_IngressList(in, out, s) } -func autoconvert_v1beta1_IngressRule_To_extensions_IngressRule(in *IngressRule, out *extensions.IngressRule, s conversion.Scope) error { +func autoConvert_v1beta1_IngressRule_To_extensions_IngressRule(in *IngressRule, out *extensions.IngressRule, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*IngressRule))(in) } out.Host = in.Host - if err := convert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue(&in.IngressRuleValue, &out.IngressRuleValue, s); err != nil { + if err := Convert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue(&in.IngressRuleValue, &out.IngressRuleValue, s); err != nil { return err } return nil } -func convert_v1beta1_IngressRule_To_extensions_IngressRule(in *IngressRule, out *extensions.IngressRule, s conversion.Scope) error { - return autoconvert_v1beta1_IngressRule_To_extensions_IngressRule(in, out, s) +func Convert_v1beta1_IngressRule_To_extensions_IngressRule(in *IngressRule, out *extensions.IngressRule, s conversion.Scope) error { + return autoConvert_v1beta1_IngressRule_To_extensions_IngressRule(in, out, s) } -func autoconvert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue(in *IngressRuleValue, out *extensions.IngressRuleValue, s conversion.Scope) error { +func autoConvert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue(in *IngressRuleValue, out *extensions.IngressRuleValue, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*IngressRuleValue))(in) } + // unable to generate simple pointer conversion for v1beta1.HTTPIngressRuleValue -> extensions.HTTPIngressRuleValue if in.HTTP != nil { out.HTTP = new(extensions.HTTPIngressRuleValue) - if err := convert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue(in.HTTP, out.HTTP, s); err != nil { + if err := Convert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue(in.HTTP, out.HTTP, s); err != nil { return err } } else { @@ -3656,26 +4548,37 @@ func autoconvert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue(in *Ing return nil } -func convert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue(in *IngressRuleValue, out *extensions.IngressRuleValue, s conversion.Scope) error { - return autoconvert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue(in, out, s) +func Convert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue(in *IngressRuleValue, out *extensions.IngressRuleValue, s conversion.Scope) error { + return autoConvert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue(in, out, s) } -func autoconvert_v1beta1_IngressSpec_To_extensions_IngressSpec(in *IngressSpec, out *extensions.IngressSpec, s conversion.Scope) error { +func autoConvert_v1beta1_IngressSpec_To_extensions_IngressSpec(in *IngressSpec, out *extensions.IngressSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*IngressSpec))(in) } + // unable to generate simple pointer conversion for v1beta1.IngressBackend -> extensions.IngressBackend if in.Backend != nil { out.Backend = new(extensions.IngressBackend) - if err := convert_v1beta1_IngressBackend_To_extensions_IngressBackend(in.Backend, out.Backend, s); err != nil { + if err := Convert_v1beta1_IngressBackend_To_extensions_IngressBackend(in.Backend, out.Backend, s); err != nil { return err } } else { out.Backend = nil } + if in.TLS != nil { + out.TLS = make([]extensions.IngressTLS, len(in.TLS)) + for i := range in.TLS { + if err := Convert_v1beta1_IngressTLS_To_extensions_IngressTLS(&in.TLS[i], &out.TLS[i], s); err != nil { + return err + } + } + } else { + out.TLS = nil + } if in.Rules != nil { out.Rules = make([]extensions.IngressRule, len(in.Rules)) for i := range in.Rules { - if err := convert_v1beta1_IngressRule_To_extensions_IngressRule(&in.Rules[i], &out.Rules[i], s); err != nil { + if err := Convert_v1beta1_IngressRule_To_extensions_IngressRule(&in.Rules[i], &out.Rules[i], s); err != nil { return err } } @@ -3685,57 +4588,77 @@ func autoconvert_v1beta1_IngressSpec_To_extensions_IngressSpec(in *IngressSpec, return nil } -func convert_v1beta1_IngressSpec_To_extensions_IngressSpec(in *IngressSpec, out *extensions.IngressSpec, s conversion.Scope) error { - return autoconvert_v1beta1_IngressSpec_To_extensions_IngressSpec(in, out, s) +func Convert_v1beta1_IngressSpec_To_extensions_IngressSpec(in *IngressSpec, out *extensions.IngressSpec, s conversion.Scope) error { + return autoConvert_v1beta1_IngressSpec_To_extensions_IngressSpec(in, out, s) } -func autoconvert_v1beta1_IngressStatus_To_extensions_IngressStatus(in *IngressStatus, out *extensions.IngressStatus, s conversion.Scope) error { +func autoConvert_v1beta1_IngressStatus_To_extensions_IngressStatus(in *IngressStatus, out *extensions.IngressStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*IngressStatus))(in) } - if err := convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { + if err := Convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { return err } return nil } -func convert_v1beta1_IngressStatus_To_extensions_IngressStatus(in *IngressStatus, out *extensions.IngressStatus, s conversion.Scope) error { - return autoconvert_v1beta1_IngressStatus_To_extensions_IngressStatus(in, out, s) +func Convert_v1beta1_IngressStatus_To_extensions_IngressStatus(in *IngressStatus, out *extensions.IngressStatus, s conversion.Scope) error { + return autoConvert_v1beta1_IngressStatus_To_extensions_IngressStatus(in, out, s) } -func autoconvert_v1beta1_Job_To_extensions_Job(in *Job, out *extensions.Job, s conversion.Scope) error { +func autoConvert_v1beta1_IngressTLS_To_extensions_IngressTLS(in *IngressTLS, out *extensions.IngressTLS, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*IngressTLS))(in) + } + if in.Hosts != nil { + out.Hosts = make([]string, len(in.Hosts)) + for i := range in.Hosts { + out.Hosts[i] = in.Hosts[i] + } + } else { + out.Hosts = nil + } + out.SecretName = in.SecretName + return nil +} + +func Convert_v1beta1_IngressTLS_To_extensions_IngressTLS(in *IngressTLS, out *extensions.IngressTLS, s conversion.Scope) error { + return autoConvert_v1beta1_IngressTLS_To_extensions_IngressTLS(in, out, s) +} + +func autoConvert_v1beta1_Job_To_extensions_Job(in *Job, out *extensions.Job, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Job))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1beta1_JobSpec_To_extensions_JobSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1beta1_JobSpec_To_extensions_JobSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1beta1_JobStatus_To_extensions_JobStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1beta1_JobStatus_To_extensions_JobStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1beta1_Job_To_extensions_Job(in *Job, out *extensions.Job, s conversion.Scope) error { - return autoconvert_v1beta1_Job_To_extensions_Job(in, out, s) +func Convert_v1beta1_Job_To_extensions_Job(in *Job, out *extensions.Job, s conversion.Scope) error { + return autoConvert_v1beta1_Job_To_extensions_Job(in, out, s) } -func autoconvert_v1beta1_JobCondition_To_extensions_JobCondition(in *JobCondition, out *extensions.JobCondition, s conversion.Scope) error { +func autoConvert_v1beta1_JobCondition_To_extensions_JobCondition(in *JobCondition, out *extensions.JobCondition, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*JobCondition))(in) } out.Type = extensions.JobConditionType(in.Type) out.Status = api.ConditionStatus(in.Status) - if err := s.Convert(&in.LastProbeTime, &out.LastProbeTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastProbeTime, &out.LastProbeTime, s); err != nil { return err } - if err := s.Convert(&in.LastTransitionTime, &out.LastTransitionTime, 0); err != nil { + if err := api.Convert_unversioned_Time_To_unversioned_Time(&in.LastTransitionTime, &out.LastTransitionTime, s); err != nil { return err } out.Reason = in.Reason @@ -3743,24 +4666,24 @@ func autoconvert_v1beta1_JobCondition_To_extensions_JobCondition(in *JobConditio return nil } -func convert_v1beta1_JobCondition_To_extensions_JobCondition(in *JobCondition, out *extensions.JobCondition, s conversion.Scope) error { - return autoconvert_v1beta1_JobCondition_To_extensions_JobCondition(in, out, s) +func Convert_v1beta1_JobCondition_To_extensions_JobCondition(in *JobCondition, out *extensions.JobCondition, s conversion.Scope) error { + return autoConvert_v1beta1_JobCondition_To_extensions_JobCondition(in, out, s) } -func autoconvert_v1beta1_JobList_To_extensions_JobList(in *JobList, out *extensions.JobList, s conversion.Scope) error { +func autoConvert_v1beta1_JobList_To_extensions_JobList(in *JobList, out *extensions.JobList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*JobList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]extensions.Job, len(in.Items)) for i := range in.Items { - if err := convert_v1beta1_Job_To_extensions_Job(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1beta1_Job_To_extensions_Job(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -3770,98 +4693,96 @@ func autoconvert_v1beta1_JobList_To_extensions_JobList(in *JobList, out *extensi return nil } -func convert_v1beta1_JobList_To_extensions_JobList(in *JobList, out *extensions.JobList, s conversion.Scope) error { - return autoconvert_v1beta1_JobList_To_extensions_JobList(in, out, s) +func Convert_v1beta1_JobList_To_extensions_JobList(in *JobList, out *extensions.JobList, s conversion.Scope) error { + return autoConvert_v1beta1_JobList_To_extensions_JobList(in, out, s) } -func autoconvert_v1beta1_JobSpec_To_extensions_JobSpec(in *JobSpec, out *extensions.JobSpec, s conversion.Scope) error { +func autoConvert_v1beta1_JobSpec_To_extensions_JobSpec(in *JobSpec, out *extensions.JobSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*JobSpec))(in) } if in.Parallelism != nil { out.Parallelism = new(int) - *out.Parallelism = *in.Parallelism + *out.Parallelism = int(*in.Parallelism) } else { out.Parallelism = nil } if in.Completions != nil { out.Completions = new(int) - *out.Completions = *in.Completions + *out.Completions = int(*in.Completions) } else { out.Completions = nil } + if in.ActiveDeadlineSeconds != nil { + out.ActiveDeadlineSeconds = new(int64) + *out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds + } else { + out.ActiveDeadlineSeconds = nil + } + // unable to generate simple pointer conversion for v1beta1.LabelSelector -> unversioned.LabelSelector if in.Selector != nil { - out.Selector = new(extensions.PodSelector) - if err := convert_v1beta1_PodSelector_To_extensions_PodSelector(in.Selector, out.Selector, s); err != nil { + out.Selector = new(unversioned.LabelSelector) + if err := Convert_v1beta1_LabelSelector_To_unversioned_LabelSelector(in.Selector, out.Selector, s); err != nil { return err } } else { out.Selector = nil } - if err := convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { + if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil { return err } return nil } -func convert_v1beta1_JobSpec_To_extensions_JobSpec(in *JobSpec, out *extensions.JobSpec, s conversion.Scope) error { - return autoconvert_v1beta1_JobSpec_To_extensions_JobSpec(in, out, s) +func Convert_v1beta1_JobSpec_To_extensions_JobSpec(in *JobSpec, out *extensions.JobSpec, s conversion.Scope) error { + return autoConvert_v1beta1_JobSpec_To_extensions_JobSpec(in, out, s) } -func autoconvert_v1beta1_JobStatus_To_extensions_JobStatus(in *JobStatus, out *extensions.JobStatus, s conversion.Scope) error { +func autoConvert_v1beta1_JobStatus_To_extensions_JobStatus(in *JobStatus, out *extensions.JobStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*JobStatus))(in) } if in.Conditions != nil { out.Conditions = make([]extensions.JobCondition, len(in.Conditions)) for i := range in.Conditions { - if err := convert_v1beta1_JobCondition_To_extensions_JobCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { + if err := Convert_v1beta1_JobCondition_To_extensions_JobCondition(&in.Conditions[i], &out.Conditions[i], s); err != nil { return err } } } else { out.Conditions = nil } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.StartTime != nil { - if err := s.Convert(&in.StartTime, &out.StartTime, 0); err != nil { + out.StartTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.StartTime, out.StartTime, s); err != nil { return err } } else { out.StartTime = nil } + // unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time if in.CompletionTime != nil { - if err := s.Convert(&in.CompletionTime, &out.CompletionTime, 0); err != nil { + out.CompletionTime = new(unversioned.Time) + if err := api.Convert_unversioned_Time_To_unversioned_Time(in.CompletionTime, out.CompletionTime, s); err != nil { return err } } else { out.CompletionTime = nil } - out.Active = in.Active - out.Succeeded = in.Succeeded - out.Failed = in.Failed + out.Active = int(in.Active) + out.Succeeded = int(in.Succeeded) + out.Failed = int(in.Failed) return nil } -func convert_v1beta1_JobStatus_To_extensions_JobStatus(in *JobStatus, out *extensions.JobStatus, s conversion.Scope) error { - return autoconvert_v1beta1_JobStatus_To_extensions_JobStatus(in, out, s) +func Convert_v1beta1_JobStatus_To_extensions_JobStatus(in *JobStatus, out *extensions.JobStatus, s conversion.Scope) error { + return autoConvert_v1beta1_JobStatus_To_extensions_JobStatus(in, out, s) } -func autoconvert_v1beta1_NodeUtilization_To_extensions_NodeUtilization(in *NodeUtilization, out *extensions.NodeUtilization, s conversion.Scope) error { +func autoConvert_v1beta1_LabelSelector_To_unversioned_LabelSelector(in *LabelSelector, out *unversioned.LabelSelector, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*NodeUtilization))(in) - } - out.Resource = extensions.NodeResource(in.Resource) - out.Value = in.Value - return nil -} - -func convert_v1beta1_NodeUtilization_To_extensions_NodeUtilization(in *NodeUtilization, out *extensions.NodeUtilization, s conversion.Scope) error { - return autoconvert_v1beta1_NodeUtilization_To_extensions_NodeUtilization(in, out, s) -} - -func autoconvert_v1beta1_PodSelector_To_extensions_PodSelector(in *PodSelector, out *extensions.PodSelector, s conversion.Scope) error { - if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*PodSelector))(in) + defaulting.(func(*LabelSelector))(in) } if in.MatchLabels != nil { out.MatchLabels = make(map[string]string) @@ -3872,9 +4793,9 @@ func autoconvert_v1beta1_PodSelector_To_extensions_PodSelector(in *PodSelector, out.MatchLabels = nil } if in.MatchExpressions != nil { - out.MatchExpressions = make([]extensions.PodSelectorRequirement, len(in.MatchExpressions)) + out.MatchExpressions = make([]unversioned.LabelSelectorRequirement, len(in.MatchExpressions)) for i := range in.MatchExpressions { - if err := convert_v1beta1_PodSelectorRequirement_To_extensions_PodSelectorRequirement(&in.MatchExpressions[i], &out.MatchExpressions[i], s); err != nil { + if err := Convert_v1beta1_LabelSelectorRequirement_To_unversioned_LabelSelectorRequirement(&in.MatchExpressions[i], &out.MatchExpressions[i], s); err != nil { return err } } @@ -3884,16 +4805,16 @@ func autoconvert_v1beta1_PodSelector_To_extensions_PodSelector(in *PodSelector, return nil } -func convert_v1beta1_PodSelector_To_extensions_PodSelector(in *PodSelector, out *extensions.PodSelector, s conversion.Scope) error { - return autoconvert_v1beta1_PodSelector_To_extensions_PodSelector(in, out, s) +func Convert_v1beta1_LabelSelector_To_unversioned_LabelSelector(in *LabelSelector, out *unversioned.LabelSelector, s conversion.Scope) error { + return autoConvert_v1beta1_LabelSelector_To_unversioned_LabelSelector(in, out, s) } -func autoconvert_v1beta1_PodSelectorRequirement_To_extensions_PodSelectorRequirement(in *PodSelectorRequirement, out *extensions.PodSelectorRequirement, s conversion.Scope) error { +func autoConvert_v1beta1_LabelSelectorRequirement_To_unversioned_LabelSelectorRequirement(in *LabelSelectorRequirement, out *unversioned.LabelSelectorRequirement, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*PodSelectorRequirement))(in) + defaulting.(func(*LabelSelectorRequirement))(in) } out.Key = in.Key - out.Operator = extensions.PodSelectorOperator(in.Operator) + out.Operator = unversioned.LabelSelectorOperator(in.Operator) if in.Values != nil { out.Values = make([]string, len(in.Values)) for i := range in.Values { @@ -3905,74 +4826,352 @@ func autoconvert_v1beta1_PodSelectorRequirement_To_extensions_PodSelectorRequire return nil } -func convert_v1beta1_PodSelectorRequirement_To_extensions_PodSelectorRequirement(in *PodSelectorRequirement, out *extensions.PodSelectorRequirement, s conversion.Scope) error { - return autoconvert_v1beta1_PodSelectorRequirement_To_extensions_PodSelectorRequirement(in, out, s) +func Convert_v1beta1_LabelSelectorRequirement_To_unversioned_LabelSelectorRequirement(in *LabelSelectorRequirement, out *unversioned.LabelSelectorRequirement, s conversion.Scope) error { + return autoConvert_v1beta1_LabelSelectorRequirement_To_unversioned_LabelSelectorRequirement(in, out, s) } -func autoconvert_v1beta1_ReplicationControllerDummy_To_extensions_ReplicationControllerDummy(in *ReplicationControllerDummy, out *extensions.ReplicationControllerDummy, s conversion.Scope) error { +func autoConvert_v1beta1_ListOptions_To_api_ListOptions(in *ListOptions, out *api.ListOptions, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { - defaulting.(func(*ReplicationControllerDummy))(in) + defaulting.(func(*ListOptions))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + if err := api.Convert_string_To_labels_Selector(&in.LabelSelector, &out.LabelSelector, s); err != nil { + return err + } + if err := api.Convert_string_To_fields_Selector(&in.FieldSelector, &out.FieldSelector, s); err != nil { + return err + } + out.Watch = in.Watch + out.ResourceVersion = in.ResourceVersion + if in.TimeoutSeconds != nil { + out.TimeoutSeconds = new(int64) + *out.TimeoutSeconds = *in.TimeoutSeconds + } else { + out.TimeoutSeconds = nil + } + return nil +} + +func Convert_v1beta1_ListOptions_To_api_ListOptions(in *ListOptions, out *api.ListOptions, s conversion.Scope) error { + return autoConvert_v1beta1_ListOptions_To_api_ListOptions(in, out, s) +} + +func autoConvert_v1beta1_NodeUtilization_To_extensions_NodeUtilization(in *NodeUtilization, out *extensions.NodeUtilization, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*NodeUtilization))(in) + } + out.Resource = extensions.NodeResource(in.Resource) + out.Value = in.Value + return nil +} + +func Convert_v1beta1_NodeUtilization_To_extensions_NodeUtilization(in *NodeUtilization, out *extensions.NodeUtilization, s conversion.Scope) error { + return autoConvert_v1beta1_NodeUtilization_To_extensions_NodeUtilization(in, out, s) +} + +func autoConvert_v1beta1_PodSecurityPolicy_To_extensions_PodSecurityPolicy(in *PodSecurityPolicy, out *extensions.PodSecurityPolicy, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*PodSecurityPolicy))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_v1beta1_PodSecurityPolicySpec_To_extensions_PodSecurityPolicySpec(&in.Spec, &out.Spec, s); err != nil { return err } return nil } -func convert_v1beta1_ReplicationControllerDummy_To_extensions_ReplicationControllerDummy(in *ReplicationControllerDummy, out *extensions.ReplicationControllerDummy, s conversion.Scope) error { - return autoconvert_v1beta1_ReplicationControllerDummy_To_extensions_ReplicationControllerDummy(in, out, s) +func Convert_v1beta1_PodSecurityPolicy_To_extensions_PodSecurityPolicy(in *PodSecurityPolicy, out *extensions.PodSecurityPolicy, s conversion.Scope) error { + return autoConvert_v1beta1_PodSecurityPolicy_To_extensions_PodSecurityPolicy(in, out, s) } -func autoconvert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment(in *RollingUpdateDeployment, out *extensions.RollingUpdateDeployment, s conversion.Scope) error { +func autoConvert_v1beta1_PodSecurityPolicyList_To_extensions_PodSecurityPolicyList(in *PodSecurityPolicyList, out *extensions.PodSecurityPolicyList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*PodSecurityPolicyList))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]extensions.PodSecurityPolicy, len(in.Items)) + for i := range in.Items { + if err := Convert_v1beta1_PodSecurityPolicy_To_extensions_PodSecurityPolicy(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_v1beta1_PodSecurityPolicyList_To_extensions_PodSecurityPolicyList(in *PodSecurityPolicyList, out *extensions.PodSecurityPolicyList, s conversion.Scope) error { + return autoConvert_v1beta1_PodSecurityPolicyList_To_extensions_PodSecurityPolicyList(in, out, s) +} + +func autoConvert_v1beta1_PodSecurityPolicySpec_To_extensions_PodSecurityPolicySpec(in *PodSecurityPolicySpec, out *extensions.PodSecurityPolicySpec, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*PodSecurityPolicySpec))(in) + } + out.Privileged = in.Privileged + if in.Capabilities != nil { + out.Capabilities = make([]api.Capability, len(in.Capabilities)) + for i := range in.Capabilities { + out.Capabilities[i] = api.Capability(in.Capabilities[i]) + } + } else { + out.Capabilities = nil + } + if in.Volumes != nil { + out.Volumes = make([]extensions.FSType, len(in.Volumes)) + for i := range in.Volumes { + out.Volumes[i] = extensions.FSType(in.Volumes[i]) + } + } else { + out.Volumes = nil + } + out.HostNetwork = in.HostNetwork + if in.HostPorts != nil { + out.HostPorts = make([]extensions.HostPortRange, len(in.HostPorts)) + for i := range in.HostPorts { + if err := Convert_v1beta1_HostPortRange_To_extensions_HostPortRange(&in.HostPorts[i], &out.HostPorts[i], s); err != nil { + return err + } + } + } else { + out.HostPorts = nil + } + out.HostPID = in.HostPID + out.HostIPC = in.HostIPC + if err := Convert_v1beta1_SELinuxContextStrategyOptions_To_extensions_SELinuxContextStrategyOptions(&in.SELinuxContext, &out.SELinuxContext, s); err != nil { + return err + } + if err := Convert_v1beta1_RunAsUserStrategyOptions_To_extensions_RunAsUserStrategyOptions(&in.RunAsUser, &out.RunAsUser, s); err != nil { + return err + } + return nil +} + +func Convert_v1beta1_PodSecurityPolicySpec_To_extensions_PodSecurityPolicySpec(in *PodSecurityPolicySpec, out *extensions.PodSecurityPolicySpec, s conversion.Scope) error { + return autoConvert_v1beta1_PodSecurityPolicySpec_To_extensions_PodSecurityPolicySpec(in, out, s) +} + +func autoConvert_v1beta1_ReplicaSet_To_extensions_ReplicaSet(in *ReplicaSet, out *extensions.ReplicaSet, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ReplicaSet))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta1_ReplicaSetStatus_To_extensions_ReplicaSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func Convert_v1beta1_ReplicaSet_To_extensions_ReplicaSet(in *ReplicaSet, out *extensions.ReplicaSet, s conversion.Scope) error { + return autoConvert_v1beta1_ReplicaSet_To_extensions_ReplicaSet(in, out, s) +} + +func autoConvert_v1beta1_ReplicaSetList_To_extensions_ReplicaSetList(in *ReplicaSetList, out *extensions.ReplicaSetList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ReplicaSetList))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]extensions.ReplicaSet, len(in.Items)) + for i := range in.Items { + if err := Convert_v1beta1_ReplicaSet_To_extensions_ReplicaSet(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_v1beta1_ReplicaSetList_To_extensions_ReplicaSetList(in *ReplicaSetList, out *extensions.ReplicaSetList, s conversion.Scope) error { + return autoConvert_v1beta1_ReplicaSetList_To_extensions_ReplicaSetList(in, out, s) +} + +func autoConvert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetSpec, out *extensions.ReplicaSetSpec, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ReplicaSetSpec))(in) + } + // in.Replicas has no peer in out + // unable to generate simple pointer conversion for v1beta1.LabelSelector -> unversioned.LabelSelector + if in.Selector != nil { + out.Selector = new(unversioned.LabelSelector) + if err := Convert_v1beta1_LabelSelector_To_unversioned_LabelSelector(in.Selector, out.Selector, s); err != nil { + return err + } + } else { + out.Selector = nil + } + // unable to generate simple pointer conversion for v1.PodTemplateSpec -> api.PodTemplateSpec + if in.Template != nil { + out.Template = new(api.PodTemplateSpec) + if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil { + return err + } + } else { + out.Template = nil + } + return nil +} + +func autoConvert_v1beta1_ReplicaSetStatus_To_extensions_ReplicaSetStatus(in *ReplicaSetStatus, out *extensions.ReplicaSetStatus, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ReplicaSetStatus))(in) + } + out.Replicas = int(in.Replicas) + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +func Convert_v1beta1_ReplicaSetStatus_To_extensions_ReplicaSetStatus(in *ReplicaSetStatus, out *extensions.ReplicaSetStatus, s conversion.Scope) error { + return autoConvert_v1beta1_ReplicaSetStatus_To_extensions_ReplicaSetStatus(in, out, s) +} + +func autoConvert_v1beta1_ReplicationControllerDummy_To_extensions_ReplicationControllerDummy(in *ReplicationControllerDummy, out *extensions.ReplicationControllerDummy, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*ReplicationControllerDummy))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + return nil +} + +func Convert_v1beta1_ReplicationControllerDummy_To_extensions_ReplicationControllerDummy(in *ReplicationControllerDummy, out *extensions.ReplicationControllerDummy, s conversion.Scope) error { + return autoConvert_v1beta1_ReplicationControllerDummy_To_extensions_ReplicationControllerDummy(in, out, s) +} + +func autoConvert_v1beta1_RollbackConfig_To_extensions_RollbackConfig(in *RollbackConfig, out *extensions.RollbackConfig, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*RollbackConfig))(in) + } + out.Revision = in.Revision + return nil +} + +func Convert_v1beta1_RollbackConfig_To_extensions_RollbackConfig(in *RollbackConfig, out *extensions.RollbackConfig, s conversion.Scope) error { + return autoConvert_v1beta1_RollbackConfig_To_extensions_RollbackConfig(in, out, s) +} + +func autoConvert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment(in *RollingUpdateDeployment, out *extensions.RollingUpdateDeployment, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*RollingUpdateDeployment))(in) } // in.MaxUnavailable has no peer in out // in.MaxSurge has no peer in out - out.MinReadySeconds = in.MinReadySeconds return nil } -func autoconvert_v1beta1_Scale_To_extensions_Scale(in *Scale, out *extensions.Scale, s conversion.Scope) error { +func autoConvert_v1beta1_RunAsUserStrategyOptions_To_extensions_RunAsUserStrategyOptions(in *RunAsUserStrategyOptions, out *extensions.RunAsUserStrategyOptions, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*RunAsUserStrategyOptions))(in) + } + out.Type = extensions.RunAsUserStrategy(in.Type) + if in.Ranges != nil { + out.Ranges = make([]extensions.IDRange, len(in.Ranges)) + for i := range in.Ranges { + if err := Convert_v1beta1_IDRange_To_extensions_IDRange(&in.Ranges[i], &out.Ranges[i], s); err != nil { + return err + } + } + } else { + out.Ranges = nil + } + return nil +} + +func Convert_v1beta1_RunAsUserStrategyOptions_To_extensions_RunAsUserStrategyOptions(in *RunAsUserStrategyOptions, out *extensions.RunAsUserStrategyOptions, s conversion.Scope) error { + return autoConvert_v1beta1_RunAsUserStrategyOptions_To_extensions_RunAsUserStrategyOptions(in, out, s) +} + +func autoConvert_v1beta1_SELinuxContextStrategyOptions_To_extensions_SELinuxContextStrategyOptions(in *SELinuxContextStrategyOptions, out *extensions.SELinuxContextStrategyOptions, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*SELinuxContextStrategyOptions))(in) + } + out.Type = extensions.SELinuxContextStrategy(in.Type) + // unable to generate simple pointer conversion for v1.SELinuxOptions -> api.SELinuxOptions + if in.SELinuxOptions != nil { + out.SELinuxOptions = new(api.SELinuxOptions) + if err := Convert_v1_SELinuxOptions_To_api_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil { + return err + } + } else { + out.SELinuxOptions = nil + } + return nil +} + +func Convert_v1beta1_SELinuxContextStrategyOptions_To_extensions_SELinuxContextStrategyOptions(in *SELinuxContextStrategyOptions, out *extensions.SELinuxContextStrategyOptions, s conversion.Scope) error { + return autoConvert_v1beta1_SELinuxContextStrategyOptions_To_extensions_SELinuxContextStrategyOptions(in, out, s) +} + +func autoConvert_v1beta1_Scale_To_extensions_Scale(in *Scale, out *extensions.Scale, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Scale))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(&in.Spec, &out.Spec, s); err != nil { + if err := Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(&in.Spec, &out.Spec, s); err != nil { return err } - if err := convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(&in.Status, &out.Status, s); err != nil { + if err := Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(&in.Status, &out.Status, s); err != nil { return err } return nil } -func convert_v1beta1_Scale_To_extensions_Scale(in *Scale, out *extensions.Scale, s conversion.Scope) error { - return autoconvert_v1beta1_Scale_To_extensions_Scale(in, out, s) +func Convert_v1beta1_Scale_To_extensions_Scale(in *Scale, out *extensions.Scale, s conversion.Scope) error { + return autoConvert_v1beta1_Scale_To_extensions_Scale(in, out, s) } -func autoconvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error { +func autoConvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ScaleSpec))(in) } - out.Replicas = in.Replicas + out.Replicas = int(in.Replicas) return nil } -func convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error { - return autoconvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in, out, s) +func Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error { + return autoConvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in, out, s) } -func autoconvert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error { +func autoConvert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ScaleStatus))(in) } - out.Replicas = in.Replicas + out.Replicas = int(in.Replicas) if in.Selector != nil { out.Selector = make(map[string]string) for key, val := range in.Selector { @@ -3984,41 +5183,40 @@ func autoconvert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *ScaleStatus, return nil } -func convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error { - return autoconvert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in, out, s) +func Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error { + return autoConvert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in, out, s) } -func autoconvert_v1beta1_SubresourceReference_To_extensions_SubresourceReference(in *SubresourceReference, out *extensions.SubresourceReference, s conversion.Scope) error { +func autoConvert_v1beta1_SubresourceReference_To_extensions_SubresourceReference(in *SubresourceReference, out *extensions.SubresourceReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*SubresourceReference))(in) } out.Kind = in.Kind - out.Namespace = in.Namespace out.Name = in.Name out.APIVersion = in.APIVersion out.Subresource = in.Subresource return nil } -func convert_v1beta1_SubresourceReference_To_extensions_SubresourceReference(in *SubresourceReference, out *extensions.SubresourceReference, s conversion.Scope) error { - return autoconvert_v1beta1_SubresourceReference_To_extensions_SubresourceReference(in, out, s) +func Convert_v1beta1_SubresourceReference_To_extensions_SubresourceReference(in *SubresourceReference, out *extensions.SubresourceReference, s conversion.Scope) error { + return autoConvert_v1beta1_SubresourceReference_To_extensions_SubresourceReference(in, out, s) } -func autoconvert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource(in *ThirdPartyResource, out *extensions.ThirdPartyResource, s conversion.Scope) error { +func autoConvert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource(in *ThirdPartyResource, out *extensions.ThirdPartyResource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ThirdPartyResource))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } out.Description = in.Description if in.Versions != nil { out.Versions = make([]extensions.APIVersion, len(in.Versions)) for i := range in.Versions { - if err := convert_v1beta1_APIVersion_To_extensions_APIVersion(&in.Versions[i], &out.Versions[i], s); err != nil { + if err := Convert_v1beta1_APIVersion_To_extensions_APIVersion(&in.Versions[i], &out.Versions[i], s); err != nil { return err } } @@ -4028,44 +5226,44 @@ func autoconvert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource(in return nil } -func convert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource(in *ThirdPartyResource, out *extensions.ThirdPartyResource, s conversion.Scope) error { - return autoconvert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource(in, out, s) +func Convert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource(in *ThirdPartyResource, out *extensions.ThirdPartyResource, s conversion.Scope) error { + return autoConvert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource(in, out, s) } -func autoconvert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData(in *ThirdPartyResourceData, out *extensions.ThirdPartyResourceData, s conversion.Scope) error { +func autoConvert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData(in *ThirdPartyResourceData, out *extensions.ThirdPartyResourceData, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ThirdPartyResourceData))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { return err } - if err := s.Convert(&in.Data, &out.Data, 0); err != nil { + if err := conversion.ByteSliceCopy(&in.Data, &out.Data, s); err != nil { return err } return nil } -func convert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData(in *ThirdPartyResourceData, out *extensions.ThirdPartyResourceData, s conversion.Scope) error { - return autoconvert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData(in, out, s) +func Convert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData(in *ThirdPartyResourceData, out *extensions.ThirdPartyResourceData, s conversion.Scope) error { + return autoConvert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData(in, out, s) } -func autoconvert_v1beta1_ThirdPartyResourceDataList_To_extensions_ThirdPartyResourceDataList(in *ThirdPartyResourceDataList, out *extensions.ThirdPartyResourceDataList, s conversion.Scope) error { +func autoConvert_v1beta1_ThirdPartyResourceDataList_To_extensions_ThirdPartyResourceDataList(in *ThirdPartyResourceDataList, out *extensions.ThirdPartyResourceDataList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ThirdPartyResourceDataList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]extensions.ThirdPartyResourceData, len(in.Items)) for i := range in.Items { - if err := convert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -4075,24 +5273,24 @@ func autoconvert_v1beta1_ThirdPartyResourceDataList_To_extensions_ThirdPartyReso return nil } -func convert_v1beta1_ThirdPartyResourceDataList_To_extensions_ThirdPartyResourceDataList(in *ThirdPartyResourceDataList, out *extensions.ThirdPartyResourceDataList, s conversion.Scope) error { - return autoconvert_v1beta1_ThirdPartyResourceDataList_To_extensions_ThirdPartyResourceDataList(in, out, s) +func Convert_v1beta1_ThirdPartyResourceDataList_To_extensions_ThirdPartyResourceDataList(in *ThirdPartyResourceDataList, out *extensions.ThirdPartyResourceDataList, s conversion.Scope) error { + return autoConvert_v1beta1_ThirdPartyResourceDataList_To_extensions_ThirdPartyResourceDataList(in, out, s) } -func autoconvert_v1beta1_ThirdPartyResourceList_To_extensions_ThirdPartyResourceList(in *ThirdPartyResourceList, out *extensions.ThirdPartyResourceList, s conversion.Scope) error { +func autoConvert_v1beta1_ThirdPartyResourceList_To_extensions_ThirdPartyResourceList(in *ThirdPartyResourceList, out *extensions.ThirdPartyResourceList, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ThirdPartyResourceList))(in) } - if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { return err } - if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil { return err } if in.Items != nil { out.Items = make([]extensions.ThirdPartyResource, len(in.Items)) for i := range in.Items { - if err := convert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource(&in.Items[i], &out.Items[i], s); err != nil { + if err := Convert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource(&in.Items[i], &out.Items[i], s); err != nil { return err } } @@ -4102,183 +5300,227 @@ func autoconvert_v1beta1_ThirdPartyResourceList_To_extensions_ThirdPartyResource return nil } -func convert_v1beta1_ThirdPartyResourceList_To_extensions_ThirdPartyResourceList(in *ThirdPartyResourceList, out *extensions.ThirdPartyResourceList, s conversion.Scope) error { - return autoconvert_v1beta1_ThirdPartyResourceList_To_extensions_ThirdPartyResourceList(in, out, s) +func Convert_v1beta1_ThirdPartyResourceList_To_extensions_ThirdPartyResourceList(in *ThirdPartyResourceList, out *extensions.ThirdPartyResourceList, s conversion.Scope) error { + return autoConvert_v1beta1_ThirdPartyResourceList_To_extensions_ThirdPartyResourceList(in, out, s) } func init() { err := api.Scheme.AddGeneratedConversionFuncs( - autoconvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource, - autoconvert_api_Capabilities_To_v1_Capabilities, - autoconvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource, - autoconvert_api_CinderVolumeSource_To_v1_CinderVolumeSource, - autoconvert_api_ContainerPort_To_v1_ContainerPort, - autoconvert_api_Container_To_v1_Container, - autoconvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile, - autoconvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource, - autoconvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource, - autoconvert_api_EnvVarSource_To_v1_EnvVarSource, - autoconvert_api_EnvVar_To_v1_EnvVar, - autoconvert_api_ExecAction_To_v1_ExecAction, - autoconvert_api_FCVolumeSource_To_v1_FCVolumeSource, - autoconvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource, - autoconvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource, - autoconvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource, - autoconvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource, - autoconvert_api_HTTPGetAction_To_v1_HTTPGetAction, - autoconvert_api_Handler_To_v1_Handler, - autoconvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource, - autoconvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource, - autoconvert_api_Lifecycle_To_v1_Lifecycle, - autoconvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress, - autoconvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus, - autoconvert_api_LocalObjectReference_To_v1_LocalObjectReference, - autoconvert_api_NFSVolumeSource_To_v1_NFSVolumeSource, - autoconvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector, - autoconvert_api_ObjectMeta_To_v1_ObjectMeta, - autoconvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource, - autoconvert_api_PodSpec_To_v1_PodSpec, - autoconvert_api_PodTemplateSpec_To_v1_PodTemplateSpec, - autoconvert_api_Probe_To_v1_Probe, - autoconvert_api_RBDVolumeSource_To_v1_RBDVolumeSource, - autoconvert_api_ResourceRequirements_To_v1_ResourceRequirements, - autoconvert_api_SELinuxOptions_To_v1_SELinuxOptions, - autoconvert_api_SecretVolumeSource_To_v1_SecretVolumeSource, - autoconvert_api_SecurityContext_To_v1_SecurityContext, - autoconvert_api_TCPSocketAction_To_v1_TCPSocketAction, - autoconvert_api_VolumeMount_To_v1_VolumeMount, - autoconvert_api_VolumeSource_To_v1_VolumeSource, - autoconvert_api_Volume_To_v1_Volume, - autoconvert_extensions_APIVersion_To_v1beta1_APIVersion, - autoconvert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization, - autoconvert_extensions_ClusterAutoscalerList_To_v1beta1_ClusterAutoscalerList, - autoconvert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec, - autoconvert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler, - autoconvert_extensions_DaemonSetList_To_v1beta1_DaemonSetList, - autoconvert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec, - autoconvert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus, - autoconvert_extensions_DaemonSet_To_v1beta1_DaemonSet, - autoconvert_extensions_DeploymentList_To_v1beta1_DeploymentList, - autoconvert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec, - autoconvert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus, - autoconvert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy, - autoconvert_extensions_Deployment_To_v1beta1_Deployment, - autoconvert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath, - autoconvert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue, - autoconvert_extensions_HorizontalPodAutoscalerList_To_v1beta1_HorizontalPodAutoscalerList, - autoconvert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec, - autoconvert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus, - autoconvert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler, - autoconvert_extensions_IngressBackend_To_v1beta1_IngressBackend, - autoconvert_extensions_IngressList_To_v1beta1_IngressList, - autoconvert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue, - autoconvert_extensions_IngressRule_To_v1beta1_IngressRule, - autoconvert_extensions_IngressSpec_To_v1beta1_IngressSpec, - autoconvert_extensions_IngressStatus_To_v1beta1_IngressStatus, - autoconvert_extensions_Ingress_To_v1beta1_Ingress, - autoconvert_extensions_JobCondition_To_v1beta1_JobCondition, - autoconvert_extensions_JobList_To_v1beta1_JobList, - autoconvert_extensions_JobSpec_To_v1beta1_JobSpec, - autoconvert_extensions_JobStatus_To_v1beta1_JobStatus, - autoconvert_extensions_Job_To_v1beta1_Job, - autoconvert_extensions_NodeUtilization_To_v1beta1_NodeUtilization, - autoconvert_extensions_PodSelectorRequirement_To_v1beta1_PodSelectorRequirement, - autoconvert_extensions_PodSelector_To_v1beta1_PodSelector, - autoconvert_extensions_ReplicationControllerDummy_To_v1beta1_ReplicationControllerDummy, - autoconvert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment, - autoconvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec, - autoconvert_extensions_ScaleStatus_To_v1beta1_ScaleStatus, - autoconvert_extensions_Scale_To_v1beta1_Scale, - autoconvert_extensions_SubresourceReference_To_v1beta1_SubresourceReference, - autoconvert_extensions_ThirdPartyResourceDataList_To_v1beta1_ThirdPartyResourceDataList, - autoconvert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData, - autoconvert_extensions_ThirdPartyResourceList_To_v1beta1_ThirdPartyResourceList, - autoconvert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource, - autoconvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource, - autoconvert_v1_Capabilities_To_api_Capabilities, - autoconvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource, - autoconvert_v1_CinderVolumeSource_To_api_CinderVolumeSource, - autoconvert_v1_ContainerPort_To_api_ContainerPort, - autoconvert_v1_Container_To_api_Container, - autoconvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile, - autoconvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource, - autoconvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource, - autoconvert_v1_EnvVarSource_To_api_EnvVarSource, - autoconvert_v1_EnvVar_To_api_EnvVar, - autoconvert_v1_ExecAction_To_api_ExecAction, - autoconvert_v1_FCVolumeSource_To_api_FCVolumeSource, - autoconvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource, - autoconvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource, - autoconvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource, - autoconvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource, - autoconvert_v1_HTTPGetAction_To_api_HTTPGetAction, - autoconvert_v1_Handler_To_api_Handler, - autoconvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource, - autoconvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource, - autoconvert_v1_Lifecycle_To_api_Lifecycle, - autoconvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress, - autoconvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus, - autoconvert_v1_LocalObjectReference_To_api_LocalObjectReference, - autoconvert_v1_NFSVolumeSource_To_api_NFSVolumeSource, - autoconvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector, - autoconvert_v1_ObjectMeta_To_api_ObjectMeta, - autoconvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource, - autoconvert_v1_PodSpec_To_api_PodSpec, - autoconvert_v1_PodTemplateSpec_To_api_PodTemplateSpec, - autoconvert_v1_Probe_To_api_Probe, - autoconvert_v1_RBDVolumeSource_To_api_RBDVolumeSource, - autoconvert_v1_ResourceRequirements_To_api_ResourceRequirements, - autoconvert_v1_SELinuxOptions_To_api_SELinuxOptions, - autoconvert_v1_SecretVolumeSource_To_api_SecretVolumeSource, - autoconvert_v1_SecurityContext_To_api_SecurityContext, - autoconvert_v1_TCPSocketAction_To_api_TCPSocketAction, - autoconvert_v1_VolumeMount_To_api_VolumeMount, - autoconvert_v1_VolumeSource_To_api_VolumeSource, - autoconvert_v1_Volume_To_api_Volume, - autoconvert_v1beta1_APIVersion_To_extensions_APIVersion, - autoconvert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization, - autoconvert_v1beta1_ClusterAutoscalerList_To_extensions_ClusterAutoscalerList, - autoconvert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec, - autoconvert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler, - autoconvert_v1beta1_DaemonSetList_To_extensions_DaemonSetList, - autoconvert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec, - autoconvert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus, - autoconvert_v1beta1_DaemonSet_To_extensions_DaemonSet, - autoconvert_v1beta1_DeploymentList_To_extensions_DeploymentList, - autoconvert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec, - autoconvert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus, - autoconvert_v1beta1_Deployment_To_extensions_Deployment, - autoconvert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath, - autoconvert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue, - autoconvert_v1beta1_HorizontalPodAutoscalerList_To_extensions_HorizontalPodAutoscalerList, - autoconvert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec, - autoconvert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus, - autoconvert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler, - autoconvert_v1beta1_IngressBackend_To_extensions_IngressBackend, - autoconvert_v1beta1_IngressList_To_extensions_IngressList, - autoconvert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue, - autoconvert_v1beta1_IngressRule_To_extensions_IngressRule, - autoconvert_v1beta1_IngressSpec_To_extensions_IngressSpec, - autoconvert_v1beta1_IngressStatus_To_extensions_IngressStatus, - autoconvert_v1beta1_Ingress_To_extensions_Ingress, - autoconvert_v1beta1_JobCondition_To_extensions_JobCondition, - autoconvert_v1beta1_JobList_To_extensions_JobList, - autoconvert_v1beta1_JobSpec_To_extensions_JobSpec, - autoconvert_v1beta1_JobStatus_To_extensions_JobStatus, - autoconvert_v1beta1_Job_To_extensions_Job, - autoconvert_v1beta1_NodeUtilization_To_extensions_NodeUtilization, - autoconvert_v1beta1_PodSelectorRequirement_To_extensions_PodSelectorRequirement, - autoconvert_v1beta1_PodSelector_To_extensions_PodSelector, - autoconvert_v1beta1_ReplicationControllerDummy_To_extensions_ReplicationControllerDummy, - autoconvert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment, - autoconvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec, - autoconvert_v1beta1_ScaleStatus_To_extensions_ScaleStatus, - autoconvert_v1beta1_Scale_To_extensions_Scale, - autoconvert_v1beta1_SubresourceReference_To_extensions_SubresourceReference, - autoconvert_v1beta1_ThirdPartyResourceDataList_To_extensions_ThirdPartyResourceDataList, - autoconvert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData, - autoconvert_v1beta1_ThirdPartyResourceList_To_extensions_ThirdPartyResourceList, - autoconvert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource, + autoConvert_api_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource, + autoConvert_api_AzureFileVolumeSource_To_v1_AzureFileVolumeSource, + autoConvert_api_Capabilities_To_v1_Capabilities, + autoConvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource, + autoConvert_api_CinderVolumeSource_To_v1_CinderVolumeSource, + autoConvert_api_ConfigMapKeySelector_To_v1_ConfigMapKeySelector, + autoConvert_api_ConfigMapVolumeSource_To_v1_ConfigMapVolumeSource, + autoConvert_api_ContainerPort_To_v1_ContainerPort, + autoConvert_api_Container_To_v1_Container, + autoConvert_api_DownwardAPIVolumeFile_To_v1_DownwardAPIVolumeFile, + autoConvert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource, + autoConvert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource, + autoConvert_api_EnvVarSource_To_v1_EnvVarSource, + autoConvert_api_EnvVar_To_v1_EnvVar, + autoConvert_api_ExecAction_To_v1_ExecAction, + autoConvert_api_FCVolumeSource_To_v1_FCVolumeSource, + autoConvert_api_FlexVolumeSource_To_v1_FlexVolumeSource, + autoConvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource, + autoConvert_api_GCEPersistentDiskVolumeSource_To_v1_GCEPersistentDiskVolumeSource, + autoConvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource, + autoConvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource, + autoConvert_api_HTTPGetAction_To_v1_HTTPGetAction, + autoConvert_api_HTTPHeader_To_v1_HTTPHeader, + autoConvert_api_Handler_To_v1_Handler, + autoConvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource, + autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource, + autoConvert_api_KeyToPath_To_v1_KeyToPath, + autoConvert_api_Lifecycle_To_v1_Lifecycle, + autoConvert_api_ListOptions_To_v1beta1_ListOptions, + autoConvert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress, + autoConvert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus, + autoConvert_api_LocalObjectReference_To_v1_LocalObjectReference, + autoConvert_api_NFSVolumeSource_To_v1_NFSVolumeSource, + autoConvert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector, + autoConvert_api_ObjectMeta_To_v1_ObjectMeta, + autoConvert_api_PersistentVolumeClaimVolumeSource_To_v1_PersistentVolumeClaimVolumeSource, + autoConvert_api_PodSpec_To_v1_PodSpec, + autoConvert_api_PodTemplateSpec_To_v1_PodTemplateSpec, + autoConvert_api_Probe_To_v1_Probe, + autoConvert_api_RBDVolumeSource_To_v1_RBDVolumeSource, + autoConvert_api_ResourceRequirements_To_v1_ResourceRequirements, + autoConvert_api_SELinuxOptions_To_v1_SELinuxOptions, + autoConvert_api_SecretKeySelector_To_v1_SecretKeySelector, + autoConvert_api_SecretVolumeSource_To_v1_SecretVolumeSource, + autoConvert_api_SecurityContext_To_v1_SecurityContext, + autoConvert_api_TCPSocketAction_To_v1_TCPSocketAction, + autoConvert_api_VolumeMount_To_v1_VolumeMount, + autoConvert_api_VolumeSource_To_v1_VolumeSource, + autoConvert_api_Volume_To_v1_Volume, + autoConvert_extensions_APIVersion_To_v1beta1_APIVersion, + autoConvert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization, + autoConvert_extensions_ClusterAutoscalerList_To_v1beta1_ClusterAutoscalerList, + autoConvert_extensions_ClusterAutoscalerSpec_To_v1beta1_ClusterAutoscalerSpec, + autoConvert_extensions_ClusterAutoscaler_To_v1beta1_ClusterAutoscaler, + autoConvert_extensions_DaemonSetList_To_v1beta1_DaemonSetList, + autoConvert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec, + autoConvert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus, + autoConvert_extensions_DaemonSet_To_v1beta1_DaemonSet, + autoConvert_extensions_DeploymentList_To_v1beta1_DeploymentList, + autoConvert_extensions_DeploymentRollback_To_v1beta1_DeploymentRollback, + autoConvert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec, + autoConvert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus, + autoConvert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy, + autoConvert_extensions_Deployment_To_v1beta1_Deployment, + autoConvert_extensions_HTTPIngressPath_To_v1beta1_HTTPIngressPath, + autoConvert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue, + autoConvert_extensions_HorizontalPodAutoscalerList_To_v1beta1_HorizontalPodAutoscalerList, + autoConvert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec, + autoConvert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalPodAutoscalerStatus, + autoConvert_extensions_HorizontalPodAutoscaler_To_v1beta1_HorizontalPodAutoscaler, + autoConvert_extensions_HostPortRange_To_v1beta1_HostPortRange, + autoConvert_extensions_IDRange_To_v1beta1_IDRange, + autoConvert_extensions_IngressBackend_To_v1beta1_IngressBackend, + autoConvert_extensions_IngressList_To_v1beta1_IngressList, + autoConvert_extensions_IngressRuleValue_To_v1beta1_IngressRuleValue, + autoConvert_extensions_IngressRule_To_v1beta1_IngressRule, + autoConvert_extensions_IngressSpec_To_v1beta1_IngressSpec, + autoConvert_extensions_IngressStatus_To_v1beta1_IngressStatus, + autoConvert_extensions_IngressTLS_To_v1beta1_IngressTLS, + autoConvert_extensions_Ingress_To_v1beta1_Ingress, + autoConvert_extensions_JobCondition_To_v1beta1_JobCondition, + autoConvert_extensions_JobList_To_v1beta1_JobList, + autoConvert_extensions_JobSpec_To_v1beta1_JobSpec, + autoConvert_extensions_JobStatus_To_v1beta1_JobStatus, + autoConvert_extensions_Job_To_v1beta1_Job, + autoConvert_extensions_NodeUtilization_To_v1beta1_NodeUtilization, + autoConvert_extensions_PodSecurityPolicyList_To_v1beta1_PodSecurityPolicyList, + autoConvert_extensions_PodSecurityPolicySpec_To_v1beta1_PodSecurityPolicySpec, + autoConvert_extensions_PodSecurityPolicy_To_v1beta1_PodSecurityPolicy, + autoConvert_extensions_ReplicaSetList_To_v1beta1_ReplicaSetList, + autoConvert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec, + autoConvert_extensions_ReplicaSetStatus_To_v1beta1_ReplicaSetStatus, + autoConvert_extensions_ReplicaSet_To_v1beta1_ReplicaSet, + autoConvert_extensions_ReplicationControllerDummy_To_v1beta1_ReplicationControllerDummy, + autoConvert_extensions_RollbackConfig_To_v1beta1_RollbackConfig, + autoConvert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment, + autoConvert_extensions_RunAsUserStrategyOptions_To_v1beta1_RunAsUserStrategyOptions, + autoConvert_extensions_SELinuxContextStrategyOptions_To_v1beta1_SELinuxContextStrategyOptions, + autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec, + autoConvert_extensions_ScaleStatus_To_v1beta1_ScaleStatus, + autoConvert_extensions_Scale_To_v1beta1_Scale, + autoConvert_extensions_SubresourceReference_To_v1beta1_SubresourceReference, + autoConvert_extensions_ThirdPartyResourceDataList_To_v1beta1_ThirdPartyResourceDataList, + autoConvert_extensions_ThirdPartyResourceData_To_v1beta1_ThirdPartyResourceData, + autoConvert_extensions_ThirdPartyResourceList_To_v1beta1_ThirdPartyResourceList, + autoConvert_extensions_ThirdPartyResource_To_v1beta1_ThirdPartyResource, + autoConvert_unversioned_LabelSelectorRequirement_To_v1beta1_LabelSelectorRequirement, + autoConvert_unversioned_LabelSelector_To_v1beta1_LabelSelector, + autoConvert_v1_AWSElasticBlockStoreVolumeSource_To_api_AWSElasticBlockStoreVolumeSource, + autoConvert_v1_AzureFileVolumeSource_To_api_AzureFileVolumeSource, + autoConvert_v1_Capabilities_To_api_Capabilities, + autoConvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource, + autoConvert_v1_CinderVolumeSource_To_api_CinderVolumeSource, + autoConvert_v1_ConfigMapKeySelector_To_api_ConfigMapKeySelector, + autoConvert_v1_ConfigMapVolumeSource_To_api_ConfigMapVolumeSource, + autoConvert_v1_ContainerPort_To_api_ContainerPort, + autoConvert_v1_Container_To_api_Container, + autoConvert_v1_DownwardAPIVolumeFile_To_api_DownwardAPIVolumeFile, + autoConvert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource, + autoConvert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource, + autoConvert_v1_EnvVarSource_To_api_EnvVarSource, + autoConvert_v1_EnvVar_To_api_EnvVar, + autoConvert_v1_ExecAction_To_api_ExecAction, + autoConvert_v1_FCVolumeSource_To_api_FCVolumeSource, + autoConvert_v1_FlexVolumeSource_To_api_FlexVolumeSource, + autoConvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource, + autoConvert_v1_GCEPersistentDiskVolumeSource_To_api_GCEPersistentDiskVolumeSource, + autoConvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource, + autoConvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource, + autoConvert_v1_HTTPGetAction_To_api_HTTPGetAction, + autoConvert_v1_HTTPHeader_To_api_HTTPHeader, + autoConvert_v1_Handler_To_api_Handler, + autoConvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource, + autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource, + autoConvert_v1_KeyToPath_To_api_KeyToPath, + autoConvert_v1_Lifecycle_To_api_Lifecycle, + autoConvert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress, + autoConvert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus, + autoConvert_v1_LocalObjectReference_To_api_LocalObjectReference, + autoConvert_v1_NFSVolumeSource_To_api_NFSVolumeSource, + autoConvert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector, + autoConvert_v1_ObjectMeta_To_api_ObjectMeta, + autoConvert_v1_PersistentVolumeClaimVolumeSource_To_api_PersistentVolumeClaimVolumeSource, + autoConvert_v1_PodSpec_To_api_PodSpec, + autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec, + autoConvert_v1_Probe_To_api_Probe, + autoConvert_v1_RBDVolumeSource_To_api_RBDVolumeSource, + autoConvert_v1_ResourceRequirements_To_api_ResourceRequirements, + autoConvert_v1_SELinuxOptions_To_api_SELinuxOptions, + autoConvert_v1_SecretKeySelector_To_api_SecretKeySelector, + autoConvert_v1_SecretVolumeSource_To_api_SecretVolumeSource, + autoConvert_v1_SecurityContext_To_api_SecurityContext, + autoConvert_v1_TCPSocketAction_To_api_TCPSocketAction, + autoConvert_v1_VolumeMount_To_api_VolumeMount, + autoConvert_v1_VolumeSource_To_api_VolumeSource, + autoConvert_v1_Volume_To_api_Volume, + autoConvert_v1beta1_APIVersion_To_extensions_APIVersion, + autoConvert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization, + autoConvert_v1beta1_ClusterAutoscalerList_To_extensions_ClusterAutoscalerList, + autoConvert_v1beta1_ClusterAutoscalerSpec_To_extensions_ClusterAutoscalerSpec, + autoConvert_v1beta1_ClusterAutoscaler_To_extensions_ClusterAutoscaler, + autoConvert_v1beta1_DaemonSetList_To_extensions_DaemonSetList, + autoConvert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec, + autoConvert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus, + autoConvert_v1beta1_DaemonSet_To_extensions_DaemonSet, + autoConvert_v1beta1_DeploymentList_To_extensions_DeploymentList, + autoConvert_v1beta1_DeploymentRollback_To_extensions_DeploymentRollback, + autoConvert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec, + autoConvert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus, + autoConvert_v1beta1_Deployment_To_extensions_Deployment, + autoConvert_v1beta1_HTTPIngressPath_To_extensions_HTTPIngressPath, + autoConvert_v1beta1_HTTPIngressRuleValue_To_extensions_HTTPIngressRuleValue, + autoConvert_v1beta1_HorizontalPodAutoscalerList_To_extensions_HorizontalPodAutoscalerList, + autoConvert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec, + autoConvert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAutoscalerStatus, + autoConvert_v1beta1_HorizontalPodAutoscaler_To_extensions_HorizontalPodAutoscaler, + autoConvert_v1beta1_HostPortRange_To_extensions_HostPortRange, + autoConvert_v1beta1_IDRange_To_extensions_IDRange, + autoConvert_v1beta1_IngressBackend_To_extensions_IngressBackend, + autoConvert_v1beta1_IngressList_To_extensions_IngressList, + autoConvert_v1beta1_IngressRuleValue_To_extensions_IngressRuleValue, + autoConvert_v1beta1_IngressRule_To_extensions_IngressRule, + autoConvert_v1beta1_IngressSpec_To_extensions_IngressSpec, + autoConvert_v1beta1_IngressStatus_To_extensions_IngressStatus, + autoConvert_v1beta1_IngressTLS_To_extensions_IngressTLS, + autoConvert_v1beta1_Ingress_To_extensions_Ingress, + autoConvert_v1beta1_JobCondition_To_extensions_JobCondition, + autoConvert_v1beta1_JobList_To_extensions_JobList, + autoConvert_v1beta1_JobSpec_To_extensions_JobSpec, + autoConvert_v1beta1_JobStatus_To_extensions_JobStatus, + autoConvert_v1beta1_Job_To_extensions_Job, + autoConvert_v1beta1_LabelSelectorRequirement_To_unversioned_LabelSelectorRequirement, + autoConvert_v1beta1_LabelSelector_To_unversioned_LabelSelector, + autoConvert_v1beta1_ListOptions_To_api_ListOptions, + autoConvert_v1beta1_NodeUtilization_To_extensions_NodeUtilization, + autoConvert_v1beta1_PodSecurityPolicyList_To_extensions_PodSecurityPolicyList, + autoConvert_v1beta1_PodSecurityPolicySpec_To_extensions_PodSecurityPolicySpec, + autoConvert_v1beta1_PodSecurityPolicy_To_extensions_PodSecurityPolicy, + autoConvert_v1beta1_ReplicaSetList_To_extensions_ReplicaSetList, + autoConvert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec, + autoConvert_v1beta1_ReplicaSetStatus_To_extensions_ReplicaSetStatus, + autoConvert_v1beta1_ReplicaSet_To_extensions_ReplicaSet, + autoConvert_v1beta1_ReplicationControllerDummy_To_extensions_ReplicationControllerDummy, + autoConvert_v1beta1_RollbackConfig_To_extensions_RollbackConfig, + autoConvert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment, + autoConvert_v1beta1_RunAsUserStrategyOptions_To_extensions_RunAsUserStrategyOptions, + autoConvert_v1beta1_SELinuxContextStrategyOptions_To_extensions_SELinuxContextStrategyOptions, + autoConvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec, + autoConvert_v1beta1_ScaleStatus_To_extensions_ScaleStatus, + autoConvert_v1beta1_Scale_To_extensions_Scale, + autoConvert_v1beta1_SubresourceReference_To_extensions_SubresourceReference, + autoConvert_v1beta1_ThirdPartyResourceDataList_To_extensions_ThirdPartyResourceDataList, + autoConvert_v1beta1_ThirdPartyResourceData_To_extensions_ThirdPartyResourceData, + autoConvert_v1beta1_ThirdPartyResourceList_To_extensions_ThirdPartyResourceList, + autoConvert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource, ) if err != nil { // If one of the conversion functions is malformed, detect it immediately. diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/deep_copy_generated.go index cea6b29e0..d1ba9f6de 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/deep_copy_generated.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/deep_copy_generated.go @@ -26,7 +26,7 @@ import ( unversioned "k8s.io/kubernetes/pkg/api/unversioned" v1 "k8s.io/kubernetes/pkg/api/v1" conversion "k8s.io/kubernetes/pkg/conversion" - util "k8s.io/kubernetes/pkg/util" + intstr "k8s.io/kubernetes/pkg/util/intstr" inf "speter.net/go/exp/math/dec/inf" ) @@ -73,6 +73,13 @@ func deepCopy_v1_AWSElasticBlockStoreVolumeSource(in v1.AWSElasticBlockStoreVolu return nil } +func deepCopy_v1_AzureFileVolumeSource(in v1.AzureFileVolumeSource, out *v1.AzureFileVolumeSource, c *conversion.Cloner) error { + out.SecretName = in.SecretName + out.ShareName = in.ShareName + out.ReadOnly = in.ReadOnly + return nil +} + func deepCopy_v1_Capabilities(in v1.Capabilities, out *v1.Capabilities, c *conversion.Cloner) error { if in.Add != nil { out.Add = make([]v1.Capability, len(in.Add)) @@ -102,6 +109,7 @@ func deepCopy_v1_CephFSVolumeSource(in v1.CephFSVolumeSource, out *v1.CephFSVolu } else { out.Monitors = nil } + out.Path = in.Path out.User = in.User out.SecretFile = in.SecretFile if in.SecretRef != nil { @@ -123,6 +131,31 @@ func deepCopy_v1_CinderVolumeSource(in v1.CinderVolumeSource, out *v1.CinderVolu return nil } +func deepCopy_v1_ConfigMapKeySelector(in v1.ConfigMapKeySelector, out *v1.ConfigMapKeySelector, c *conversion.Cloner) error { + if err := deepCopy_v1_LocalObjectReference(in.LocalObjectReference, &out.LocalObjectReference, c); err != nil { + return err + } + out.Key = in.Key + return nil +} + +func deepCopy_v1_ConfigMapVolumeSource(in v1.ConfigMapVolumeSource, out *v1.ConfigMapVolumeSource, c *conversion.Cloner) error { + if err := deepCopy_v1_LocalObjectReference(in.LocalObjectReference, &out.LocalObjectReference, c); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]v1.KeyToPath, len(in.Items)) + for i := range in.Items { + if err := deepCopy_v1_KeyToPath(in.Items[i], &out.Items[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + func deepCopy_v1_Container(in v1.Container, out *v1.Container, c *conversion.Cloner) error { out.Name = in.Name out.Image = in.Image @@ -275,6 +308,22 @@ func deepCopy_v1_EnvVarSource(in v1.EnvVarSource, out *v1.EnvVarSource, c *conve } else { out.FieldRef = nil } + if in.ConfigMapKeyRef != nil { + out.ConfigMapKeyRef = new(v1.ConfigMapKeySelector) + if err := deepCopy_v1_ConfigMapKeySelector(*in.ConfigMapKeyRef, out.ConfigMapKeyRef, c); err != nil { + return err + } + } else { + out.ConfigMapKeyRef = nil + } + if in.SecretKeyRef != nil { + out.SecretKeyRef = new(v1.SecretKeySelector) + if err := deepCopy_v1_SecretKeySelector(*in.SecretKeyRef, out.SecretKeyRef, c); err != nil { + return err + } + } else { + out.SecretKeyRef = nil + } return nil } @@ -300,7 +349,7 @@ func deepCopy_v1_FCVolumeSource(in v1.FCVolumeSource, out *v1.FCVolumeSource, c out.TargetWWNs = nil } if in.Lun != nil { - out.Lun = new(int) + out.Lun = new(int32) *out.Lun = *in.Lun } else { out.Lun = nil @@ -310,6 +359,29 @@ func deepCopy_v1_FCVolumeSource(in v1.FCVolumeSource, out *v1.FCVolumeSource, c return nil } +func deepCopy_v1_FlexVolumeSource(in v1.FlexVolumeSource, out *v1.FlexVolumeSource, c *conversion.Cloner) error { + out.Driver = in.Driver + out.FSType = in.FSType + if in.SecretRef != nil { + out.SecretRef = new(v1.LocalObjectReference) + if err := deepCopy_v1_LocalObjectReference(*in.SecretRef, out.SecretRef, c); err != nil { + return err + } + } else { + out.SecretRef = nil + } + out.ReadOnly = in.ReadOnly + if in.Options != nil { + out.Options = make(map[string]string) + for key, val := range in.Options { + out.Options[key] = val + } + } else { + out.Options = nil + } + return nil +} + func deepCopy_v1_FlockerVolumeSource(in v1.FlockerVolumeSource, out *v1.FlockerVolumeSource, c *conversion.Cloner) error { out.DatasetName = in.DatasetName return nil @@ -326,6 +398,7 @@ func deepCopy_v1_GCEPersistentDiskVolumeSource(in v1.GCEPersistentDiskVolumeSour func deepCopy_v1_GitRepoVolumeSource(in v1.GitRepoVolumeSource, out *v1.GitRepoVolumeSource, c *conversion.Cloner) error { out.Repository = in.Repository out.Revision = in.Revision + out.Directory = in.Directory return nil } @@ -338,11 +411,27 @@ func deepCopy_v1_GlusterfsVolumeSource(in v1.GlusterfsVolumeSource, out *v1.Glus func deepCopy_v1_HTTPGetAction(in v1.HTTPGetAction, out *v1.HTTPGetAction, c *conversion.Cloner) error { out.Path = in.Path - if err := deepCopy_util_IntOrString(in.Port, &out.Port, c); err != nil { + if err := deepCopy_intstr_IntOrString(in.Port, &out.Port, c); err != nil { return err } out.Host = in.Host out.Scheme = in.Scheme + if in.HTTPHeaders != nil { + out.HTTPHeaders = make([]v1.HTTPHeader, len(in.HTTPHeaders)) + for i := range in.HTTPHeaders { + if err := deepCopy_v1_HTTPHeader(in.HTTPHeaders[i], &out.HTTPHeaders[i], c); err != nil { + return err + } + } + } else { + out.HTTPHeaders = nil + } + return nil +} + +func deepCopy_v1_HTTPHeader(in v1.HTTPHeader, out *v1.HTTPHeader, c *conversion.Cloner) error { + out.Name = in.Name + out.Value = in.Value return nil } @@ -383,11 +472,18 @@ func deepCopy_v1_ISCSIVolumeSource(in v1.ISCSIVolumeSource, out *v1.ISCSIVolumeS out.TargetPortal = in.TargetPortal out.IQN = in.IQN out.Lun = in.Lun + out.ISCSIInterface = in.ISCSIInterface out.FSType = in.FSType out.ReadOnly = in.ReadOnly return nil } +func deepCopy_v1_KeyToPath(in v1.KeyToPath, out *v1.KeyToPath, c *conversion.Cloner) error { + out.Key = in.Key + out.Path = in.Path + return nil +} + func deepCopy_v1_Lifecycle(in v1.Lifecycle, out *v1.Lifecycle, c *conversion.Cloner) error { if in.PostStart != nil { out.PostStart = new(v1.Handler) @@ -497,14 +593,6 @@ func deepCopy_v1_PersistentVolumeClaimVolumeSource(in v1.PersistentVolumeClaimVo } func deepCopy_v1_PodSecurityContext(in v1.PodSecurityContext, out *v1.PodSecurityContext, c *conversion.Cloner) error { - if in.SupplementalGroups != nil { - out.SupplementalGroups = make([]int64, len(in.SupplementalGroups)) - for i := range in.SupplementalGroups { - out.SupplementalGroups[i] = in.SupplementalGroups[i] - } - } else { - out.SupplementalGroups = nil - } if in.SELinuxOptions != nil { out.SELinuxOptions = new(v1.SELinuxOptions) if err := deepCopy_v1_SELinuxOptions(*in.SELinuxOptions, out.SELinuxOptions, c); err != nil { @@ -525,6 +613,20 @@ func deepCopy_v1_PodSecurityContext(in v1.PodSecurityContext, out *v1.PodSecurit } else { out.RunAsNonRoot = nil } + if in.SupplementalGroups != nil { + out.SupplementalGroups = make([]int64, len(in.SupplementalGroups)) + for i := range in.SupplementalGroups { + out.SupplementalGroups[i] = in.SupplementalGroups[i] + } + } else { + out.SupplementalGroups = nil + } + if in.FSGroup != nil { + out.FSGroup = new(int64) + *out.FSGroup = *in.FSGroup + } else { + out.FSGroup = nil + } return nil } @@ -614,6 +716,9 @@ func deepCopy_v1_Probe(in v1.Probe, out *v1.Probe, c *conversion.Cloner) error { } out.InitialDelaySeconds = in.InitialDelaySeconds out.TimeoutSeconds = in.TimeoutSeconds + out.PeriodSeconds = in.PeriodSeconds + out.SuccessThreshold = in.SuccessThreshold + out.FailureThreshold = in.FailureThreshold return nil } @@ -679,6 +784,14 @@ func deepCopy_v1_SELinuxOptions(in v1.SELinuxOptions, out *v1.SELinuxOptions, c return nil } +func deepCopy_v1_SecretKeySelector(in v1.SecretKeySelector, out *v1.SecretKeySelector, c *conversion.Cloner) error { + if err := deepCopy_v1_LocalObjectReference(in.LocalObjectReference, &out.LocalObjectReference, c); err != nil { + return err + } + out.Key = in.Key + return nil +} + func deepCopy_v1_SecretVolumeSource(in v1.SecretVolumeSource, out *v1.SecretVolumeSource, c *conversion.Cloner) error { out.SecretName = in.SecretName return nil @@ -719,11 +832,17 @@ func deepCopy_v1_SecurityContext(in v1.SecurityContext, out *v1.SecurityContext, } else { out.RunAsNonRoot = nil } + if in.ReadOnlyRootFilesystem != nil { + out.ReadOnlyRootFilesystem = new(bool) + *out.ReadOnlyRootFilesystem = *in.ReadOnlyRootFilesystem + } else { + out.ReadOnlyRootFilesystem = nil + } return nil } func deepCopy_v1_TCPSocketAction(in v1.TCPSocketAction, out *v1.TCPSocketAction, c *conversion.Cloner) error { - if err := deepCopy_util_IntOrString(in.Port, &out.Port, c); err != nil { + if err := deepCopy_intstr_IntOrString(in.Port, &out.Port, c); err != nil { return err } return nil @@ -833,6 +952,14 @@ func deepCopy_v1_VolumeSource(in v1.VolumeSource, out *v1.VolumeSource, c *conve } else { out.RBD = nil } + if in.FlexVolume != nil { + out.FlexVolume = new(v1.FlexVolumeSource) + if err := deepCopy_v1_FlexVolumeSource(*in.FlexVolume, out.FlexVolume, c); err != nil { + return err + } + } else { + out.FlexVolume = nil + } if in.Cinder != nil { out.Cinder = new(v1.CinderVolumeSource) if err := deepCopy_v1_CinderVolumeSource(*in.Cinder, out.Cinder, c); err != nil { @@ -873,6 +1000,22 @@ func deepCopy_v1_VolumeSource(in v1.VolumeSource, out *v1.VolumeSource, c *conve } else { out.FC = nil } + if in.AzureFile != nil { + out.AzureFile = new(v1.AzureFileVolumeSource) + if err := deepCopy_v1_AzureFileVolumeSource(*in.AzureFile, out.AzureFile, c); err != nil { + return err + } + } else { + out.AzureFile = nil + } + if in.ConfigMap != nil { + out.ConfigMap = new(v1.ConfigMapVolumeSource) + if err := deepCopy_v1_ConfigMapVolumeSource(*in.ConfigMap, out.ConfigMap, c); err != nil { + return err + } + } else { + out.ConfigMap = nil + } return nil } @@ -974,20 +1117,15 @@ func deepCopy_v1beta1_DaemonSetList(in DaemonSetList, out *DaemonSetList, c *con func deepCopy_v1beta1_DaemonSetSpec(in DaemonSetSpec, out *DaemonSetSpec, c *conversion.Cloner) error { if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + out.Selector = new(LabelSelector) + if err := deepCopy_v1beta1_LabelSelector(*in.Selector, out.Selector, c); err != nil { + return err } } else { out.Selector = nil } - if in.Template != nil { - out.Template = new(v1.PodTemplateSpec) - if err := deepCopy_v1_PodTemplateSpec(*in.Template, out.Template, c); err != nil { - return err - } - } else { - out.Template = nil + if err := deepCopy_v1_PodTemplateSpec(in.Template, &out.Template, c); err != nil { + return err } return nil } @@ -1035,37 +1173,61 @@ func deepCopy_v1beta1_DeploymentList(in DeploymentList, out *DeploymentList, c * return nil } +func deepCopy_v1beta1_DeploymentRollback(in DeploymentRollback, out *DeploymentRollback, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + out.Name = in.Name + if in.UpdatedAnnotations != nil { + out.UpdatedAnnotations = make(map[string]string) + for key, val := range in.UpdatedAnnotations { + out.UpdatedAnnotations[key] = val + } + } else { + out.UpdatedAnnotations = nil + } + if err := deepCopy_v1beta1_RollbackConfig(in.RollbackTo, &out.RollbackTo, c); err != nil { + return err + } + return nil +} + func deepCopy_v1beta1_DeploymentSpec(in DeploymentSpec, out *DeploymentSpec, c *conversion.Cloner) error { if in.Replicas != nil { - out.Replicas = new(int) + out.Replicas = new(int32) *out.Replicas = *in.Replicas } else { out.Replicas = nil } if in.Selector != nil { - out.Selector = make(map[string]string) - for key, val := range in.Selector { - out.Selector[key] = val + out.Selector = new(LabelSelector) + if err := deepCopy_v1beta1_LabelSelector(*in.Selector, out.Selector, c); err != nil { + return err } } else { out.Selector = nil } - if in.Template != nil { - out.Template = new(v1.PodTemplateSpec) - if err := deepCopy_v1_PodTemplateSpec(*in.Template, out.Template, c); err != nil { - return err - } - } else { - out.Template = nil + if err := deepCopy_v1_PodTemplateSpec(in.Template, &out.Template, c); err != nil { + return err } if err := deepCopy_v1beta1_DeploymentStrategy(in.Strategy, &out.Strategy, c); err != nil { return err } - if in.UniqueLabelKey != nil { - out.UniqueLabelKey = new(string) - *out.UniqueLabelKey = *in.UniqueLabelKey + out.MinReadySeconds = in.MinReadySeconds + if in.RevisionHistoryLimit != nil { + out.RevisionHistoryLimit = new(int32) + *out.RevisionHistoryLimit = *in.RevisionHistoryLimit } else { - out.UniqueLabelKey = nil + out.RevisionHistoryLimit = nil + } + out.Paused = in.Paused + if in.RollbackTo != nil { + out.RollbackTo = new(RollbackConfig) + if err := deepCopy_v1beta1_RollbackConfig(*in.RollbackTo, out.RollbackTo, c); err != nil { + return err + } + } else { + out.RollbackTo = nil } return nil } @@ -1073,6 +1235,8 @@ func deepCopy_v1beta1_DeploymentSpec(in DeploymentSpec, out *DeploymentSpec, c * func deepCopy_v1beta1_DeploymentStatus(in DeploymentStatus, out *DeploymentStatus, c *conversion.Cloner) error { out.Replicas = in.Replicas out.UpdatedReplicas = in.UpdatedReplicas + out.AvailableReplicas = in.AvailableReplicas + out.UnavailableReplicas = in.UnavailableReplicas return nil } @@ -1152,7 +1316,7 @@ func deepCopy_v1beta1_HorizontalPodAutoscalerSpec(in HorizontalPodAutoscalerSpec return err } if in.MinReplicas != nil { - out.MinReplicas = new(int) + out.MinReplicas = new(int32) *out.MinReplicas = *in.MinReplicas } else { out.MinReplicas = nil @@ -1187,7 +1351,7 @@ func deepCopy_v1beta1_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscalerSt out.CurrentReplicas = in.CurrentReplicas out.DesiredReplicas = in.DesiredReplicas if in.CurrentCPUUtilizationPercentage != nil { - out.CurrentCPUUtilizationPercentage = new(int) + out.CurrentCPUUtilizationPercentage = new(int32) *out.CurrentCPUUtilizationPercentage = *in.CurrentCPUUtilizationPercentage } else { out.CurrentCPUUtilizationPercentage = nil @@ -1195,6 +1359,18 @@ func deepCopy_v1beta1_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscalerSt return nil } +func deepCopy_v1beta1_HostPortRange(in HostPortRange, out *HostPortRange, c *conversion.Cloner) error { + out.Min = in.Min + out.Max = in.Max + return nil +} + +func deepCopy_v1beta1_IDRange(in IDRange, out *IDRange, c *conversion.Cloner) error { + out.Min = in.Min + out.Max = in.Max + return nil +} + func deepCopy_v1beta1_Ingress(in Ingress, out *Ingress, c *conversion.Cloner) error { if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err @@ -1213,7 +1389,7 @@ func deepCopy_v1beta1_Ingress(in Ingress, out *Ingress, c *conversion.Cloner) er func deepCopy_v1beta1_IngressBackend(in IngressBackend, out *IngressBackend, c *conversion.Cloner) error { out.ServiceName = in.ServiceName - if err := deepCopy_util_IntOrString(in.ServicePort, &out.ServicePort, c); err != nil { + if err := deepCopy_intstr_IntOrString(in.ServicePort, &out.ServicePort, c); err != nil { return err } return nil @@ -1268,6 +1444,16 @@ func deepCopy_v1beta1_IngressSpec(in IngressSpec, out *IngressSpec, c *conversio } else { out.Backend = nil } + if in.TLS != nil { + out.TLS = make([]IngressTLS, len(in.TLS)) + for i := range in.TLS { + if err := deepCopy_v1beta1_IngressTLS(in.TLS[i], &out.TLS[i], c); err != nil { + return err + } + } + } else { + out.TLS = nil + } if in.Rules != nil { out.Rules = make([]IngressRule, len(in.Rules)) for i := range in.Rules { @@ -1288,6 +1474,19 @@ func deepCopy_v1beta1_IngressStatus(in IngressStatus, out *IngressStatus, c *con return nil } +func deepCopy_v1beta1_IngressTLS(in IngressTLS, out *IngressTLS, c *conversion.Cloner) error { + if in.Hosts != nil { + out.Hosts = make([]string, len(in.Hosts)) + for i := range in.Hosts { + out.Hosts[i] = in.Hosts[i] + } + } else { + out.Hosts = nil + } + out.SecretName = in.SecretName + return nil +} + func deepCopy_v1beta1_Job(in Job, out *Job, c *conversion.Cloner) error { if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err @@ -1340,20 +1539,26 @@ func deepCopy_v1beta1_JobList(in JobList, out *JobList, c *conversion.Cloner) er func deepCopy_v1beta1_JobSpec(in JobSpec, out *JobSpec, c *conversion.Cloner) error { if in.Parallelism != nil { - out.Parallelism = new(int) + out.Parallelism = new(int32) *out.Parallelism = *in.Parallelism } else { out.Parallelism = nil } if in.Completions != nil { - out.Completions = new(int) + out.Completions = new(int32) *out.Completions = *in.Completions } else { out.Completions = nil } + if in.ActiveDeadlineSeconds != nil { + out.ActiveDeadlineSeconds = new(int64) + *out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds + } else { + out.ActiveDeadlineSeconds = nil + } if in.Selector != nil { - out.Selector = new(PodSelector) - if err := deepCopy_v1beta1_PodSelector(*in.Selector, out.Selector, c); err != nil { + out.Selector = new(LabelSelector) + if err := deepCopy_v1beta1_LabelSelector(*in.Selector, out.Selector, c); err != nil { return err } } else { @@ -1398,13 +1603,7 @@ func deepCopy_v1beta1_JobStatus(in JobStatus, out *JobStatus, c *conversion.Clon return nil } -func deepCopy_v1beta1_NodeUtilization(in NodeUtilization, out *NodeUtilization, c *conversion.Cloner) error { - out.Resource = in.Resource - out.Value = in.Value - return nil -} - -func deepCopy_v1beta1_PodSelector(in PodSelector, out *PodSelector, c *conversion.Cloner) error { +func deepCopy_v1beta1_LabelSelector(in LabelSelector, out *LabelSelector, c *conversion.Cloner) error { if in.MatchLabels != nil { out.MatchLabels = make(map[string]string) for key, val := range in.MatchLabels { @@ -1414,9 +1613,9 @@ func deepCopy_v1beta1_PodSelector(in PodSelector, out *PodSelector, c *conversio out.MatchLabels = nil } if in.MatchExpressions != nil { - out.MatchExpressions = make([]PodSelectorRequirement, len(in.MatchExpressions)) + out.MatchExpressions = make([]LabelSelectorRequirement, len(in.MatchExpressions)) for i := range in.MatchExpressions { - if err := deepCopy_v1beta1_PodSelectorRequirement(in.MatchExpressions[i], &out.MatchExpressions[i], c); err != nil { + if err := deepCopy_v1beta1_LabelSelectorRequirement(in.MatchExpressions[i], &out.MatchExpressions[i], c); err != nil { return err } } @@ -1426,7 +1625,7 @@ func deepCopy_v1beta1_PodSelector(in PodSelector, out *PodSelector, c *conversio return nil } -func deepCopy_v1beta1_PodSelectorRequirement(in PodSelectorRequirement, out *PodSelectorRequirement, c *conversion.Cloner) error { +func deepCopy_v1beta1_LabelSelectorRequirement(in LabelSelectorRequirement, out *LabelSelectorRequirement, c *conversion.Cloner) error { out.Key = in.Key out.Operator = in.Operator if in.Values != nil { @@ -1440,6 +1639,170 @@ func deepCopy_v1beta1_PodSelectorRequirement(in PodSelectorRequirement, out *Pod return nil } +func deepCopy_v1beta1_ListOptions(in ListOptions, out *ListOptions, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + out.LabelSelector = in.LabelSelector + out.FieldSelector = in.FieldSelector + out.Watch = in.Watch + out.ResourceVersion = in.ResourceVersion + if in.TimeoutSeconds != nil { + out.TimeoutSeconds = new(int64) + *out.TimeoutSeconds = *in.TimeoutSeconds + } else { + out.TimeoutSeconds = nil + } + return nil +} + +func deepCopy_v1beta1_NodeUtilization(in NodeUtilization, out *NodeUtilization, c *conversion.Cloner) error { + out.Resource = in.Resource + out.Value = in.Value + return nil +} + +func deepCopy_v1beta1_PodSecurityPolicy(in PodSecurityPolicy, out *PodSecurityPolicy, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := deepCopy_v1beta1_PodSecurityPolicySpec(in.Spec, &out.Spec, c); err != nil { + return err + } + return nil +} + +func deepCopy_v1beta1_PodSecurityPolicyList(in PodSecurityPolicyList, out *PodSecurityPolicyList, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]PodSecurityPolicy, len(in.Items)) + for i := range in.Items { + if err := deepCopy_v1beta1_PodSecurityPolicy(in.Items[i], &out.Items[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func deepCopy_v1beta1_PodSecurityPolicySpec(in PodSecurityPolicySpec, out *PodSecurityPolicySpec, c *conversion.Cloner) error { + out.Privileged = in.Privileged + if in.Capabilities != nil { + out.Capabilities = make([]v1.Capability, len(in.Capabilities)) + for i := range in.Capabilities { + out.Capabilities[i] = in.Capabilities[i] + } + } else { + out.Capabilities = nil + } + if in.Volumes != nil { + out.Volumes = make([]FSType, len(in.Volumes)) + for i := range in.Volumes { + out.Volumes[i] = in.Volumes[i] + } + } else { + out.Volumes = nil + } + out.HostNetwork = in.HostNetwork + if in.HostPorts != nil { + out.HostPorts = make([]HostPortRange, len(in.HostPorts)) + for i := range in.HostPorts { + if err := deepCopy_v1beta1_HostPortRange(in.HostPorts[i], &out.HostPorts[i], c); err != nil { + return err + } + } + } else { + out.HostPorts = nil + } + out.HostPID = in.HostPID + out.HostIPC = in.HostIPC + if err := deepCopy_v1beta1_SELinuxContextStrategyOptions(in.SELinuxContext, &out.SELinuxContext, c); err != nil { + return err + } + if err := deepCopy_v1beta1_RunAsUserStrategyOptions(in.RunAsUser, &out.RunAsUser, c); err != nil { + return err + } + return nil +} + +func deepCopy_v1beta1_ReplicaSet(in ReplicaSet, out *ReplicaSet, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := deepCopy_v1beta1_ReplicaSetSpec(in.Spec, &out.Spec, c); err != nil { + return err + } + if err := deepCopy_v1beta1_ReplicaSetStatus(in.Status, &out.Status, c); err != nil { + return err + } + return nil +} + +func deepCopy_v1beta1_ReplicaSetList(in ReplicaSetList, out *ReplicaSetList, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]ReplicaSet, len(in.Items)) + for i := range in.Items { + if err := deepCopy_v1beta1_ReplicaSet(in.Items[i], &out.Items[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func deepCopy_v1beta1_ReplicaSetSpec(in ReplicaSetSpec, out *ReplicaSetSpec, c *conversion.Cloner) error { + if in.Replicas != nil { + out.Replicas = new(int32) + *out.Replicas = *in.Replicas + } else { + out.Replicas = nil + } + if in.Selector != nil { + out.Selector = new(LabelSelector) + if err := deepCopy_v1beta1_LabelSelector(*in.Selector, out.Selector, c); err != nil { + return err + } + } else { + out.Selector = nil + } + if in.Template != nil { + out.Template = new(v1.PodTemplateSpec) + if err := deepCopy_v1_PodTemplateSpec(*in.Template, out.Template, c); err != nil { + return err + } + } else { + out.Template = nil + } + return nil +} + +func deepCopy_v1beta1_ReplicaSetStatus(in ReplicaSetStatus, out *ReplicaSetStatus, c *conversion.Cloner) error { + out.Replicas = in.Replicas + out.ObservedGeneration = in.ObservedGeneration + return nil +} + func deepCopy_v1beta1_ReplicationControllerDummy(in ReplicationControllerDummy, out *ReplicationControllerDummy, c *conversion.Cloner) error { if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err @@ -1447,24 +1810,56 @@ func deepCopy_v1beta1_ReplicationControllerDummy(in ReplicationControllerDummy, return nil } +func deepCopy_v1beta1_RollbackConfig(in RollbackConfig, out *RollbackConfig, c *conversion.Cloner) error { + out.Revision = in.Revision + return nil +} + func deepCopy_v1beta1_RollingUpdateDeployment(in RollingUpdateDeployment, out *RollingUpdateDeployment, c *conversion.Cloner) error { if in.MaxUnavailable != nil { - out.MaxUnavailable = new(util.IntOrString) - if err := deepCopy_util_IntOrString(*in.MaxUnavailable, out.MaxUnavailable, c); err != nil { + out.MaxUnavailable = new(intstr.IntOrString) + if err := deepCopy_intstr_IntOrString(*in.MaxUnavailable, out.MaxUnavailable, c); err != nil { return err } } else { out.MaxUnavailable = nil } if in.MaxSurge != nil { - out.MaxSurge = new(util.IntOrString) - if err := deepCopy_util_IntOrString(*in.MaxSurge, out.MaxSurge, c); err != nil { + out.MaxSurge = new(intstr.IntOrString) + if err := deepCopy_intstr_IntOrString(*in.MaxSurge, out.MaxSurge, c); err != nil { return err } } else { out.MaxSurge = nil } - out.MinReadySeconds = in.MinReadySeconds + return nil +} + +func deepCopy_v1beta1_RunAsUserStrategyOptions(in RunAsUserStrategyOptions, out *RunAsUserStrategyOptions, c *conversion.Cloner) error { + out.Type = in.Type + if in.Ranges != nil { + out.Ranges = make([]IDRange, len(in.Ranges)) + for i := range in.Ranges { + if err := deepCopy_v1beta1_IDRange(in.Ranges[i], &out.Ranges[i], c); err != nil { + return err + } + } + } else { + out.Ranges = nil + } + return nil +} + +func deepCopy_v1beta1_SELinuxContextStrategyOptions(in SELinuxContextStrategyOptions, out *SELinuxContextStrategyOptions, c *conversion.Cloner) error { + out.Type = in.Type + if in.SELinuxOptions != nil { + out.SELinuxOptions = new(v1.SELinuxOptions) + if err := deepCopy_v1_SELinuxOptions(*in.SELinuxOptions, out.SELinuxOptions, c); err != nil { + return err + } + } else { + out.SELinuxOptions = nil + } return nil } @@ -1504,7 +1899,6 @@ func deepCopy_v1beta1_ScaleStatus(in ScaleStatus, out *ScaleStatus, c *conversio func deepCopy_v1beta1_SubresourceReference(in SubresourceReference, out *SubresourceReference, c *conversion.Cloner) error { out.Kind = in.Kind - out.Namespace = in.Namespace out.Name = in.Name out.APIVersion = in.APIVersion out.Subresource = in.Subresource @@ -1590,8 +1984,8 @@ func deepCopy_v1beta1_ThirdPartyResourceList(in ThirdPartyResourceList, out *Thi return nil } -func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *conversion.Cloner) error { - out.Kind = in.Kind +func deepCopy_intstr_IntOrString(in intstr.IntOrString, out *intstr.IntOrString, c *conversion.Cloner) error { + out.Type = in.Type out.IntVal = in.IntVal out.StrVal = in.StrVal return nil @@ -1604,9 +1998,12 @@ func init() { deepCopy_unversioned_Time, deepCopy_unversioned_TypeMeta, deepCopy_v1_AWSElasticBlockStoreVolumeSource, + deepCopy_v1_AzureFileVolumeSource, deepCopy_v1_Capabilities, deepCopy_v1_CephFSVolumeSource, deepCopy_v1_CinderVolumeSource, + deepCopy_v1_ConfigMapKeySelector, + deepCopy_v1_ConfigMapVolumeSource, deepCopy_v1_Container, deepCopy_v1_ContainerPort, deepCopy_v1_DownwardAPIVolumeFile, @@ -1616,14 +2013,17 @@ func init() { deepCopy_v1_EnvVarSource, deepCopy_v1_ExecAction, deepCopy_v1_FCVolumeSource, + deepCopy_v1_FlexVolumeSource, deepCopy_v1_FlockerVolumeSource, deepCopy_v1_GCEPersistentDiskVolumeSource, deepCopy_v1_GitRepoVolumeSource, deepCopy_v1_GlusterfsVolumeSource, deepCopy_v1_HTTPGetAction, + deepCopy_v1_HTTPHeader, deepCopy_v1_Handler, deepCopy_v1_HostPathVolumeSource, deepCopy_v1_ISCSIVolumeSource, + deepCopy_v1_KeyToPath, deepCopy_v1_Lifecycle, deepCopy_v1_LoadBalancerIngress, deepCopy_v1_LoadBalancerStatus, @@ -1639,6 +2039,7 @@ func init() { deepCopy_v1_RBDVolumeSource, deepCopy_v1_ResourceRequirements, deepCopy_v1_SELinuxOptions, + deepCopy_v1_SecretKeySelector, deepCopy_v1_SecretVolumeSource, deepCopy_v1_SecurityContext, deepCopy_v1_TCPSocketAction, @@ -1656,6 +2057,7 @@ func init() { deepCopy_v1beta1_DaemonSetStatus, deepCopy_v1beta1_Deployment, deepCopy_v1beta1_DeploymentList, + deepCopy_v1beta1_DeploymentRollback, deepCopy_v1beta1_DeploymentSpec, deepCopy_v1beta1_DeploymentStatus, deepCopy_v1beta1_DeploymentStrategy, @@ -1665,6 +2067,8 @@ func init() { deepCopy_v1beta1_HorizontalPodAutoscalerList, deepCopy_v1beta1_HorizontalPodAutoscalerSpec, deepCopy_v1beta1_HorizontalPodAutoscalerStatus, + deepCopy_v1beta1_HostPortRange, + deepCopy_v1beta1_IDRange, deepCopy_v1beta1_Ingress, deepCopy_v1beta1_IngressBackend, deepCopy_v1beta1_IngressList, @@ -1672,16 +2076,28 @@ func init() { deepCopy_v1beta1_IngressRuleValue, deepCopy_v1beta1_IngressSpec, deepCopy_v1beta1_IngressStatus, + deepCopy_v1beta1_IngressTLS, deepCopy_v1beta1_Job, deepCopy_v1beta1_JobCondition, deepCopy_v1beta1_JobList, deepCopy_v1beta1_JobSpec, deepCopy_v1beta1_JobStatus, + deepCopy_v1beta1_LabelSelector, + deepCopy_v1beta1_LabelSelectorRequirement, + deepCopy_v1beta1_ListOptions, deepCopy_v1beta1_NodeUtilization, - deepCopy_v1beta1_PodSelector, - deepCopy_v1beta1_PodSelectorRequirement, + deepCopy_v1beta1_PodSecurityPolicy, + deepCopy_v1beta1_PodSecurityPolicyList, + deepCopy_v1beta1_PodSecurityPolicySpec, + deepCopy_v1beta1_ReplicaSet, + deepCopy_v1beta1_ReplicaSetList, + deepCopy_v1beta1_ReplicaSetSpec, + deepCopy_v1beta1_ReplicaSetStatus, deepCopy_v1beta1_ReplicationControllerDummy, + deepCopy_v1beta1_RollbackConfig, deepCopy_v1beta1_RollingUpdateDeployment, + deepCopy_v1beta1_RunAsUserStrategyOptions, + deepCopy_v1beta1_SELinuxContextStrategyOptions, deepCopy_v1beta1_Scale, deepCopy_v1beta1_ScaleSpec, deepCopy_v1beta1_ScaleStatus, @@ -1690,7 +2106,7 @@ func init() { deepCopy_v1beta1_ThirdPartyResourceData, deepCopy_v1beta1_ThirdPartyResourceDataList, deepCopy_v1beta1_ThirdPartyResourceList, - deepCopy_util_IntOrString, + deepCopy_intstr_IntOrString, ) if err != nil { // if one of the deep copy functions is malformed, detect it immediately. diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults.go index 48beebb69..cb197a965 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults.go @@ -17,26 +17,26 @@ limitations under the License. package v1beta1 import ( - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/intstr" ) -func addDefaultingFuncs() { - api.Scheme.AddDefaultingFuncs( +func addDefaultingFuncs(scheme *runtime.Scheme) { + scheme.AddDefaultingFuncs( func(obj *APIVersion) { if len(obj.APIGroup) == 0 { - obj.APIGroup = "extensions" + obj.APIGroup = GroupName } }, func(obj *DaemonSet) { - var labels map[string]string - if obj.Spec.Template != nil { - labels = obj.Spec.Template.Labels - } + labels := obj.Spec.Template.Labels + // TODO: support templates defined elsewhere when we support them in the API if labels != nil { - if len(obj.Spec.Selector) == 0 { - obj.Spec.Selector = labels + if obj.Spec.Selector == nil { + obj.Spec.Selector = &LabelSelector{ + MatchLabels: labels, + } } if len(obj.Labels) == 0 { obj.Labels = labels @@ -45,13 +45,11 @@ func addDefaultingFuncs() { }, func(obj *Deployment) { // Default labels and selector to labels from pod template spec. - var labels map[string]string - if obj.Spec.Template != nil { - labels = obj.Spec.Template.Labels - } + labels := obj.Spec.Template.Labels + if labels != nil { - if len(obj.Spec.Selector) == 0 { - obj.Spec.Selector = labels + if obj.Spec.Selector == nil { + obj.Spec.Selector = &LabelSelector{MatchLabels: labels} } if len(obj.Labels) == 0 { obj.Labels = labels @@ -59,7 +57,7 @@ func addDefaultingFuncs() { } // Set DeploymentSpec.Replicas to 1 if it is not set. if obj.Spec.Replicas == nil { - obj.Spec.Replicas = new(int) + obj.Spec.Replicas = new(int32) *obj.Spec.Replicas = 1 } strategy := &obj.Spec.Strategy @@ -74,26 +72,22 @@ func addDefaultingFuncs() { } if strategy.RollingUpdate.MaxUnavailable == nil { // Set default MaxUnavailable as 1 by default. - maxUnavailable := util.NewIntOrStringFromInt(1) + maxUnavailable := intstr.FromInt(1) strategy.RollingUpdate.MaxUnavailable = &maxUnavailable } if strategy.RollingUpdate.MaxSurge == nil { // Set default MaxSurge as 1 by default. - maxSurge := util.NewIntOrStringFromInt(1) + maxSurge := intstr.FromInt(1) strategy.RollingUpdate.MaxSurge = &maxSurge } } - if obj.Spec.UniqueLabelKey == nil { - obj.Spec.UniqueLabelKey = new(string) - *obj.Spec.UniqueLabelKey = "deployment.kubernetes.io/podTemplateHash" - } }, func(obj *Job) { labels := obj.Spec.Template.Labels // TODO: support templates defined elsewhere when we support them in the API if labels != nil { if obj.Spec.Selector == nil { - obj.Spec.Selector = &PodSelector{ + obj.Spec.Selector = &LabelSelector{ MatchLabels: labels, } } @@ -101,22 +95,48 @@ func addDefaultingFuncs() { obj.Labels = labels } } - if obj.Spec.Completions == nil { - completions := 1 - obj.Spec.Completions = &completions + // For a non-parallel job, you can leave both `.spec.completions` and + // `.spec.parallelism` unset. When both are unset, both are defaulted to 1. + if obj.Spec.Completions == nil && obj.Spec.Parallelism == nil { + obj.Spec.Completions = new(int32) + *obj.Spec.Completions = 1 + obj.Spec.Parallelism = new(int32) + *obj.Spec.Parallelism = 1 } if obj.Spec.Parallelism == nil { - obj.Spec.Parallelism = obj.Spec.Completions + obj.Spec.Parallelism = new(int32) + *obj.Spec.Parallelism = 1 } }, func(obj *HorizontalPodAutoscaler) { if obj.Spec.MinReplicas == nil { - minReplicas := 1 + minReplicas := int32(1) obj.Spec.MinReplicas = &minReplicas } if obj.Spec.CPUUtilization == nil { obj.Spec.CPUUtilization = &CPUTargetUtilization{TargetPercentage: 80} } }, + func(obj *ReplicaSet) { + var labels map[string]string + if obj.Spec.Template != nil { + labels = obj.Spec.Template.Labels + } + // TODO: support templates defined elsewhere when we support them in the API + if labels != nil { + if obj.Spec.Selector == nil { + obj.Spec.Selector = &LabelSelector{ + MatchLabels: labels, + } + } + if len(obj.Labels) == 0 { + obj.Labels = labels + } + } + if obj.Spec.Replicas == nil { + obj.Spec.Replicas = new(int32) + *obj.Spec.Replicas = 1 + } + }, ) } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults_test.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults_test.go index baab80792..85b991980 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults_test.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults_test.go @@ -14,80 +14,148 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta1_test import ( "reflect" "testing" "k8s.io/kubernetes/pkg/api" + _ "k8s.io/kubernetes/pkg/api/install" + "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/v1" + _ "k8s.io/kubernetes/pkg/apis/extensions/install" + . "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) func TestSetDefaultDaemonSet(t *testing.T) { + defaultLabels := map[string]string{"foo": "bar"} + period := int64(v1.DefaultTerminationGracePeriodSeconds) + defaultTemplate := v1.PodTemplateSpec{ + Spec: v1.PodSpec{ + DNSPolicy: v1.DNSClusterFirst, + RestartPolicy: v1.RestartPolicyAlways, + SecurityContext: &v1.PodSecurityContext{}, + TerminationGracePeriodSeconds: &period, + }, + ObjectMeta: v1.ObjectMeta{ + Labels: defaultLabels, + }, + } + templateNoLabel := v1.PodTemplateSpec{ + Spec: v1.PodSpec{ + DNSPolicy: v1.DNSClusterFirst, + RestartPolicy: v1.RestartPolicyAlways, + SecurityContext: &v1.PodSecurityContext{}, + TerminationGracePeriodSeconds: &period, + }, + } tests := []struct { - ds *DaemonSet - expectLabelsChange bool + original *DaemonSet + expected *DaemonSet }{ - { - ds: &DaemonSet{ + { // Labels change/defaulting test. + original: &DaemonSet{ Spec: DaemonSetSpec{ - Template: &v1.PodTemplateSpec{ - ObjectMeta: v1.ObjectMeta{ - Labels: map[string]string{ - "foo": "bar", - }, - }, - }, + Template: defaultTemplate, + }, + }, + expected: &DaemonSet{ + ObjectMeta: v1.ObjectMeta{ + Labels: defaultLabels, + }, + Spec: DaemonSetSpec{ + Selector: &LabelSelector{ + MatchLabels: defaultLabels, + }, + Template: defaultTemplate, }, }, - expectLabelsChange: true, }, - { - ds: &DaemonSet{ + { // Labels change/defaulting test. + original: &DaemonSet{ ObjectMeta: v1.ObjectMeta{ Labels: map[string]string{ "bar": "foo", }, }, Spec: DaemonSetSpec{ - Template: &v1.PodTemplateSpec{ - ObjectMeta: v1.ObjectMeta{ - Labels: map[string]string{ - "foo": "bar", - }, - }, - }, + Template: defaultTemplate, + }, + }, + expected: &DaemonSet{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "bar": "foo", + }, + }, + Spec: DaemonSetSpec{ + Selector: &LabelSelector{ + MatchLabels: defaultLabels, + }, + Template: defaultTemplate, + }, + }, + }, + { // Update strategy. + original: &DaemonSet{}, + expected: &DaemonSet{ + Spec: DaemonSetSpec{ + Template: templateNoLabel, + }, + }, + }, + { // Update strategy. + original: &DaemonSet{ + Spec: DaemonSetSpec{}, + }, + expected: &DaemonSet{ + Spec: DaemonSetSpec{ + Template: templateNoLabel, + }, + }, + }, + { // Custom unique label key. + original: &DaemonSet{ + Spec: DaemonSetSpec{}, + }, + expected: &DaemonSet{ + Spec: DaemonSetSpec{ + Template: templateNoLabel, }, }, - expectLabelsChange: false, }, } - for _, test := range tests { - ds := test.ds - obj2 := roundTrip(t, runtime.Object(ds)) - ds2, ok := obj2.(*DaemonSet) + for i, test := range tests { + original := test.original + expected := test.expected + obj2 := roundTrip(t, runtime.Object(original)) + got, ok := obj2.(*DaemonSet) if !ok { - t.Errorf("unexpected object: %v", ds2) + t.Errorf("(%d) unexpected object: %v", i, got) t.FailNow() } - if test.expectLabelsChange != reflect.DeepEqual(ds2.Labels, ds2.Spec.Template.Labels) { - if test.expectLabelsChange { - t.Errorf("expected: %v, got: %v", ds2.Spec.Template.Labels, ds2.Labels) - } else { - t.Errorf("unexpected equality: %v", ds.Labels) - } + if !reflect.DeepEqual(got.Spec, expected.Spec) { + t.Errorf("(%d) got different than expected\ngot:\n\t%+v\nexpected:\n\t%+v", i, got.Spec, expected.Spec) } } } func TestSetDefaultDeployment(t *testing.T) { - defaultIntOrString := util.NewIntOrStringFromInt(1) - differentIntOrString := util.NewIntOrStringFromInt(5) - deploymentLabelKey := "deployment.kubernetes.io/podTemplateHash" + defaultIntOrString := intstr.FromInt(1) + differentIntOrString := intstr.FromInt(5) + period := int64(v1.DefaultTerminationGracePeriodSeconds) + defaultTemplate := v1.PodTemplateSpec{ + Spec: v1.PodSpec{ + DNSPolicy: v1.DNSClusterFirst, + RestartPolicy: v1.RestartPolicyAlways, + SecurityContext: &v1.PodSecurityContext{}, + TerminationGracePeriodSeconds: &period, + }, + } tests := []struct { original *Deployment expected *Deployment @@ -96,7 +164,7 @@ func TestSetDefaultDeployment(t *testing.T) { original: &Deployment{}, expected: &Deployment{ Spec: DeploymentSpec{ - Replicas: newInt(1), + Replicas: newInt32(1), Strategy: DeploymentStrategy{ Type: RollingUpdateDeploymentStrategyType, RollingUpdate: &RollingUpdateDeployment{ @@ -104,14 +172,14 @@ func TestSetDefaultDeployment(t *testing.T) { MaxUnavailable: &defaultIntOrString, }, }, - UniqueLabelKey: newString(deploymentLabelKey), + Template: defaultTemplate, }, }, }, { original: &Deployment{ Spec: DeploymentSpec{ - Replicas: newInt(5), + Replicas: newInt32(5), Strategy: DeploymentStrategy{ RollingUpdate: &RollingUpdateDeployment{ MaxSurge: &differentIntOrString, @@ -121,7 +189,7 @@ func TestSetDefaultDeployment(t *testing.T) { }, expected: &Deployment{ Spec: DeploymentSpec{ - Replicas: newInt(5), + Replicas: newInt32(5), Strategy: DeploymentStrategy{ Type: RollingUpdateDeploymentStrategyType, RollingUpdate: &RollingUpdateDeployment{ @@ -129,14 +197,14 @@ func TestSetDefaultDeployment(t *testing.T) { MaxUnavailable: &defaultIntOrString, }, }, - UniqueLabelKey: newString(deploymentLabelKey), + Template: defaultTemplate, }, }, }, { original: &Deployment{ Spec: DeploymentSpec{ - Replicas: newInt(5), + Replicas: newInt32(5), Strategy: DeploymentStrategy{ Type: RecreateDeploymentStrategyType, }, @@ -144,31 +212,30 @@ func TestSetDefaultDeployment(t *testing.T) { }, expected: &Deployment{ Spec: DeploymentSpec{ - Replicas: newInt(5), + Replicas: newInt32(5), Strategy: DeploymentStrategy{ Type: RecreateDeploymentStrategyType, }, - UniqueLabelKey: newString(deploymentLabelKey), + Template: defaultTemplate, }, }, }, { original: &Deployment{ Spec: DeploymentSpec{ - Replicas: newInt(5), + Replicas: newInt32(5), Strategy: DeploymentStrategy{ Type: RecreateDeploymentStrategyType, }, - UniqueLabelKey: newString("customDeploymentKey"), }, }, expected: &Deployment{ Spec: DeploymentSpec{ - Replicas: newInt(5), + Replicas: newInt32(5), Strategy: DeploymentStrategy{ Type: RecreateDeploymentStrategyType, }, - UniqueLabelKey: newString("customDeploymentKey"), + Template: defaultTemplate, }, }, }, @@ -184,26 +251,143 @@ func TestSetDefaultDeployment(t *testing.T) { t.FailNow() } if !reflect.DeepEqual(got.Spec, expected.Spec) { - t.Errorf("got different than expected: %v, %v", got, expected) + t.Errorf("got different than expected:\n\t%+v\ngot:\n\t%+v", got.Spec, expected.Spec) } } } -func TestSetDefaultJob(t *testing.T) { +func TestSetDefaultJobParallelismAndCompletions(t *testing.T) { + tests := []struct { + original *Job + expected *Job + }{ + // both unspecified -> sets both to 1 + { + original: &Job{ + Spec: JobSpec{}, + }, + expected: &Job{ + Spec: JobSpec{ + Completions: newInt32(1), + Parallelism: newInt32(1), + }, + }, + }, + // WQ: Parallelism explicitly 0 and completions unset -> no change + { + original: &Job{ + Spec: JobSpec{ + Parallelism: newInt32(0), + }, + }, + expected: &Job{ + Spec: JobSpec{ + Parallelism: newInt32(0), + }, + }, + }, + // WQ: Parallelism explicitly 2 and completions unset -> no change + { + original: &Job{ + Spec: JobSpec{ + Parallelism: newInt32(2), + }, + }, + expected: &Job{ + Spec: JobSpec{ + Parallelism: newInt32(2), + }, + }, + }, + // Completions explicitly 2 and parallelism unset -> parallelism is defaulted + { + original: &Job{ + Spec: JobSpec{ + Completions: newInt32(2), + }, + }, + expected: &Job{ + Spec: JobSpec{ + Completions: newInt32(2), + Parallelism: newInt32(1), + }, + }, + }, + // Both set -> no change + { + original: &Job{ + Spec: JobSpec{ + Completions: newInt32(10), + Parallelism: newInt32(11), + }, + }, + expected: &Job{ + Spec: JobSpec{ + Completions: newInt32(10), + Parallelism: newInt32(11), + }, + }, + }, + // Both set, flipped -> no change + { + original: &Job{ + Spec: JobSpec{ + Completions: newInt32(11), + Parallelism: newInt32(10), + }, + }, + expected: &Job{ + Spec: JobSpec{ + Completions: newInt32(11), + Parallelism: newInt32(10), + }, + }, + }, + } + + for _, tc := range tests { + original := tc.original + expected := tc.expected + obj2 := roundTrip(t, runtime.Object(original)) + got, ok := obj2.(*Job) + if !ok { + t.Errorf("unexpected object: %v", got) + t.FailNow() + } + if (got.Spec.Completions == nil) != (expected.Spec.Completions == nil) { + t.Errorf("got different *completions than expected: %v %v", got.Spec.Completions, expected.Spec.Completions) + } + if got.Spec.Completions != nil && expected.Spec.Completions != nil { + if *got.Spec.Completions != *expected.Spec.Completions { + t.Errorf("got different completions than expected: %d %d", *got.Spec.Completions, *expected.Spec.Completions) + } + } + if (got.Spec.Parallelism == nil) != (expected.Spec.Parallelism == nil) { + t.Errorf("got different *Parallelism than expected: %v %v", got.Spec.Parallelism, expected.Spec.Parallelism) + } + if got.Spec.Parallelism != nil && expected.Spec.Parallelism != nil { + if *got.Spec.Parallelism != *expected.Spec.Parallelism { + t.Errorf("got different parallelism than expected: %d %d", *got.Spec.Parallelism, *expected.Spec.Parallelism) + } + } + } +} + +func TestSetDefaultJobSelector(t *testing.T) { expected := &Job{ Spec: JobSpec{ - Selector: &PodSelector{ + Selector: &LabelSelector{ MatchLabels: map[string]string{"job": "selector"}, }, - Completions: newInt(1), - Parallelism: newInt(1), + Completions: newInt32(1), + Parallelism: newInt32(1), }, } tests := []*Job{ // selector set explicitly, completions and parallelism - default { Spec: JobSpec{ - Selector: &PodSelector{ + Selector: &LabelSelector{ MatchLabels: map[string]string{"job": "selector"}, }, }, @@ -218,28 +402,6 @@ func TestSetDefaultJob(t *testing.T) { }, }, }, - // selector from template labels, completions set explicitly, parallelism - default - { - Spec: JobSpec{ - Completions: newInt(1), - Template: v1.PodTemplateSpec{ - ObjectMeta: v1.ObjectMeta{ - Labels: map[string]string{"job": "selector"}, - }, - }, - }, - }, - // selector from template labels, completions - default, parallelism set explicitly - { - Spec: JobSpec{ - Parallelism: newInt(1), - Template: v1.PodTemplateSpec{ - ObjectMeta: v1.ObjectMeta{ - Labels: map[string]string{"job": "selector"}, - }, - }, - }, - }, } for _, original := range tests { @@ -249,25 +411,232 @@ func TestSetDefaultJob(t *testing.T) { t.Errorf("unexpected object: %v", got) t.FailNow() } - if *got.Spec.Completions != *expected.Spec.Completions { - t.Errorf("got different completions than expected: %d %d", *got.Spec.Completions, *expected.Spec.Completions) - } - if *got.Spec.Parallelism != *expected.Spec.Parallelism { - t.Errorf("got different parallelism than expected: %d %d", *got.Spec.Parallelism, *expected.Spec.Parallelism) - } if !reflect.DeepEqual(got.Spec.Selector, expected.Spec.Selector) { t.Errorf("got different selectors %#v %#v", got.Spec.Selector, expected.Spec.Selector) } } } +func TestSetDefaultReplicaSet(t *testing.T) { + tests := []struct { + rs *ReplicaSet + expectLabels bool + expectSelector bool + }{ + { + rs: &ReplicaSet{ + Spec: ReplicaSetSpec{ + Template: &v1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "foo": "bar", + }, + }, + }, + }, + }, + expectLabels: true, + expectSelector: true, + }, + { + rs: &ReplicaSet{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "bar": "foo", + }, + }, + Spec: ReplicaSetSpec{ + Template: &v1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "foo": "bar", + }, + }, + }, + }, + }, + expectLabels: false, + expectSelector: true, + }, + { + rs: &ReplicaSet{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "bar": "foo", + }, + }, + Spec: ReplicaSetSpec{ + Selector: &LabelSelector{ + MatchLabels: map[string]string{ + "some": "other", + }, + }, + Template: &v1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "foo": "bar", + }, + }, + }, + }, + }, + expectLabels: false, + expectSelector: false, + }, + { + rs: &ReplicaSet{ + Spec: ReplicaSetSpec{ + Selector: &LabelSelector{ + MatchLabels: map[string]string{ + "some": "other", + }, + }, + Template: &v1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "foo": "bar", + }, + }, + }, + }, + }, + expectLabels: true, + expectSelector: false, + }, + } + + for _, test := range tests { + rs := test.rs + obj2 := roundTrip(t, runtime.Object(rs)) + rs2, ok := obj2.(*ReplicaSet) + if !ok { + t.Errorf("unexpected object: %v", rs2) + t.FailNow() + } + if test.expectSelector != reflect.DeepEqual(rs2.Spec.Selector.MatchLabels, rs2.Spec.Template.Labels) { + if test.expectSelector { + t.Errorf("expected: %v, got: %v", rs2.Spec.Template.Labels, rs2.Spec.Selector) + } else { + t.Errorf("unexpected equality: %v", rs.Spec.Selector) + } + } + if test.expectLabels != reflect.DeepEqual(rs2.Labels, rs2.Spec.Template.Labels) { + if test.expectLabels { + t.Errorf("expected: %v, got: %v", rs2.Spec.Template.Labels, rs2.Labels) + } else { + t.Errorf("unexpected equality: %v", rs.Labels) + } + } + } +} + +func TestSetDefaultReplicaSetReplicas(t *testing.T) { + tests := []struct { + rs ReplicaSet + expectReplicas int32 + }{ + { + rs: ReplicaSet{ + Spec: ReplicaSetSpec{ + Template: &v1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "foo": "bar", + }, + }, + }, + }, + }, + expectReplicas: 1, + }, + { + rs: ReplicaSet{ + Spec: ReplicaSetSpec{ + Replicas: newInt32(0), + Template: &v1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "foo": "bar", + }, + }, + }, + }, + }, + expectReplicas: 0, + }, + { + rs: ReplicaSet{ + Spec: ReplicaSetSpec{ + Replicas: newInt32(3), + Template: &v1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "foo": "bar", + }, + }, + }, + }, + }, + expectReplicas: 3, + }, + } + + for _, test := range tests { + rs := &test.rs + obj2 := roundTrip(t, runtime.Object(rs)) + rs2, ok := obj2.(*ReplicaSet) + if !ok { + t.Errorf("unexpected object: %v", rs2) + t.FailNow() + } + if rs2.Spec.Replicas == nil { + t.Errorf("unexpected nil Replicas") + } else if test.expectReplicas != *rs2.Spec.Replicas { + t.Errorf("expected: %d replicas, got: %d", test.expectReplicas, *rs2.Spec.Replicas) + } + } +} + +func TestDefaultRequestIsNotSetForReplicaSet(t *testing.T) { + s := v1.PodSpec{} + s.Containers = []v1.Container{ + { + Resources: v1.ResourceRequirements{ + Limits: v1.ResourceList{ + v1.ResourceCPU: resource.MustParse("100m"), + }, + }, + }, + } + rs := &ReplicaSet{ + Spec: ReplicaSetSpec{ + Replicas: newInt32(3), + Template: &v1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{ + Labels: map[string]string{ + "foo": "bar", + }, + }, + Spec: s, + }, + }, + } + output := roundTrip(t, runtime.Object(rs)) + rs2 := output.(*ReplicaSet) + defaultRequest := rs2.Spec.Template.Spec.Containers[0].Resources.Requests + requestValue := defaultRequest[v1.ResourceCPU] + if requestValue.String() != "0" { + t.Errorf("Expected 0 request value, got: %s", requestValue.String()) + } +} + func roundTrip(t *testing.T, obj runtime.Object) runtime.Object { - data, err := Codec.Encode(obj) + data, err := runtime.Encode(api.Codecs.LegacyCodec(SchemeGroupVersion), obj) if err != nil { t.Errorf("%v\n %#v", err, obj) return nil } - obj2, err := api.Codec.Decode(data) + obj2, err := runtime.Decode(api.Codecs.UniversalDecoder(), data) if err != nil { t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj) return nil @@ -281,8 +650,8 @@ func roundTrip(t *testing.T, obj runtime.Object) runtime.Object { return obj3 } -func newInt(val int) *int { - p := new(int) +func newInt32(val int32) *int32 { + p := new(int32) *p = val return p } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/register.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/register.go index 05c4b09c0..d2750a639 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/register.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/register.go @@ -17,25 +17,31 @@ limitations under the License. package v1beta1 import ( - "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/runtime" ) -var Codec = runtime.CodecFor(api.Scheme, "extensions/v1beta1") +// GroupName is the group name use in this package +const GroupName = "extensions" -func init() { - addKnownTypes() - addDefaultingFuncs() - addConversionFuncs() +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: "v1beta1"} + +func AddToScheme(scheme *runtime.Scheme) { + addKnownTypes(scheme) + addDefaultingFuncs(scheme) + addConversionFuncs(scheme) } // Adds the list of known types to api.Scheme. -func addKnownTypes() { - api.Scheme.AddKnownTypes("extensions/v1beta1", +func addKnownTypes(scheme *runtime.Scheme) { + scheme.AddKnownTypes(SchemeGroupVersion, &ClusterAutoscaler{}, &ClusterAutoscalerList{}, &Deployment{}, &DeploymentList{}, + &DeploymentRollback{}, &HorizontalPodAutoscaler{}, &HorizontalPodAutoscalerList{}, &Job{}, @@ -50,24 +56,36 @@ func addKnownTypes() { &ThirdPartyResourceDataList{}, &Ingress{}, &IngressList{}, + &ListOptions{}, + &v1.DeleteOptions{}, + &ReplicaSet{}, + &ReplicaSetList{}, + &PodSecurityPolicy{}, + &PodSecurityPolicyList{}, ) } -func (*ClusterAutoscaler) IsAnAPIObject() {} -func (*ClusterAutoscalerList) IsAnAPIObject() {} -func (*Deployment) IsAnAPIObject() {} -func (*DeploymentList) IsAnAPIObject() {} -func (*HorizontalPodAutoscaler) IsAnAPIObject() {} -func (*HorizontalPodAutoscalerList) IsAnAPIObject() {} -func (*Job) IsAnAPIObject() {} -func (*JobList) IsAnAPIObject() {} -func (*ReplicationControllerDummy) IsAnAPIObject() {} -func (*Scale) IsAnAPIObject() {} -func (*ThirdPartyResource) IsAnAPIObject() {} -func (*ThirdPartyResourceList) IsAnAPIObject() {} -func (*DaemonSet) IsAnAPIObject() {} -func (*DaemonSetList) IsAnAPIObject() {} -func (*ThirdPartyResourceData) IsAnAPIObject() {} -func (*ThirdPartyResourceDataList) IsAnAPIObject() {} -func (*Ingress) IsAnAPIObject() {} -func (*IngressList) IsAnAPIObject() {} +func (obj *ClusterAutoscaler) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ClusterAutoscalerList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Deployment) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DeploymentList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DeploymentRollback) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *HorizontalPodAutoscaler) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *HorizontalPodAutoscalerList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Job) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *JobList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicationControllerDummy) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Scale) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ThirdPartyResource) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ThirdPartyResourceList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DaemonSet) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *DaemonSetList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ThirdPartyResourceData) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ThirdPartyResourceDataList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Ingress) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *IngressList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ListOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicaSet) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ReplicaSetList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodSecurityPolicy) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *PodSecurityPolicyList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types.generated.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types.generated.go index 498318b5b..1e2b081ec 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types.generated.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types.generated.go @@ -29,7 +29,7 @@ import ( pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned" pkg2_v1 "k8s.io/kubernetes/pkg/api/v1" pkg3_types "k8s.io/kubernetes/pkg/types" - pkg6_util "k8s.io/kubernetes/pkg/util" + pkg6_intstr "k8s.io/kubernetes/pkg/util/intstr" "reflect" "runtime" pkg5_inf "speter.net/go/exp/math/dec/inf" @@ -37,10 +37,18 @@ import ( ) const ( - codecSelferC_UTF81234 = 1 - codecSelferC_RAW1234 = 0 + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- codecSelferValueTypeArray1234 = 10 codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 ) var ( @@ -51,10 +59,10 @@ var ( type codecSelfer1234 struct{} func init() { - if codec1978.GenVersion != 4 { + if codec1978.GenVersion != 5 { _, file, _, _ := runtime.Caller(0) err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", - 4, codec1978.GenVersion, file) + 5, codec1978.GenVersion, file) panic(err) } if false { // reference the types, but skip this branch at build/run time @@ -62,7 +70,7 @@ func init() { var v1 pkg1_unversioned.TypeMeta var v2 pkg2_v1.ObjectMeta var v3 pkg3_types.UID - var v4 pkg6_util.IntOrString + var v4 pkg6_intstr.IntOrString var v5 pkg5_inf.Dec var v6 time.Time _, _, _, _, _, _, _ = v0, v1, v2, v3, v4, v5, v6 @@ -87,18 +95,21 @@ func (x *ScaleSpec) CodecEncodeSelf(e *codec1978.Encoder) { _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false yyq2[0] = x.Replicas != 0 + var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn2 int = 0 + yynn2 = 0 for _, b := range yyq2 { if b { yynn2++ } } r.EncodeMapStart(yynn2) + yynn2 = 0 } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[0] { yym4 := z.EncBinary() _ = yym4 @@ -111,7 +122,9 @@ func (x *ScaleSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym5 := z.EncBinary() _ = yym5 if false { @@ -120,8 +133,10 @@ func (x *ScaleSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep2 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -131,24 +146,25 @@ func (x *ScaleSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym6 := z.DecBinary() - _ = yym6 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl7 := r.ReadMapStart() - if yyl7 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl7, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl7 := r.ReadArrayStart() - if yyl7 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl7, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -160,12 +176,12 @@ func (x *ScaleSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys8Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys8Slc - var yyhl8 bool = l >= 0 - for yyj8 := 0; ; yyj8++ { - if yyhl8 { - if yyj8 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -173,59 +189,61 @@ func (x *ScaleSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys8Slc = r.DecodeBytes(yys8Slc, true, true) - yys8 := string(yys8Slc) - switch yys8 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 } else { - x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.Replicas = int32(r.DecodeInt(32)) } default: - z.DecStructFieldNotFound(-1, yys8) - } // end switch yys8 - } // end for yyj8 - if !yyhl8 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ScaleSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj10 int - var yyb10 bool - var yyhl10 bool = l >= 0 - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb10 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb10 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { - x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.Replicas = int32(r.DecodeInt(32)) } for { - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb10 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb10 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj10-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ScaleStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -235,51 +253,57 @@ func (x *ScaleStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym12 := z.EncBinary() - _ = yym12 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep13 := !z.EncBinary() - yy2arr13 := z.EncBasicHandle().StructToArray - var yyq13 [2]bool - _, _, _ = yysep13, yyq13, yy2arr13 - const yyr13 bool = false - yyq13[1] = len(x.Selector) != 0 - if yyr13 || yy2arr13 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = len(x.Selector) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn13 int = 1 - for _, b := range yyq13 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn13++ + yynn2++ } } - r.EncodeMapStart(yynn13) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr13 || yy2arr13 { - yym15 := z.EncBinary() - _ = yym15 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Replicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) - yym16 := z.EncBinary() - _ = yym16 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Replicas)) } } - if yyr13 || yy2arr13 { - if yyq13[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Selector == nil { r.EncodeNil() } else { - yym18 := z.EncBinary() - _ = yym18 + yym7 := z.EncBinary() + _ = yym7 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) @@ -289,13 +313,15 @@ func (x *ScaleStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq13[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym19 := z.EncBinary() - _ = yym19 + yym8 := z.EncBinary() + _ = yym8 if false { } else { z.F.EncMapStringStringV(x.Selector, false, e) @@ -303,8 +329,10 @@ func (x *ScaleStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep13 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -314,24 +342,25 @@ func (x *ScaleStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym20 := z.DecBinary() - _ = yym20 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl21 := r.ReadMapStart() - if yyl21 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl21, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl21 := r.ReadArrayStart() - if yyl21 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl21, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -343,12 +372,12 @@ func (x *ScaleStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys22Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys22Slc - var yyhl22 bool = l >= 0 - for yyj22 := 0; ; yyj22++ { - if yyhl22 { - if yyj22 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -356,92 +385,95 @@ func (x *ScaleStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys22Slc = r.DecodeBytes(yys22Slc, true, true) - yys22 := string(yys22Slc) - switch yys22 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 } else { - x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.Replicas = int32(r.DecodeInt(32)) } case "selector": if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv24 := &x.Selector - yym25 := z.DecBinary() - _ = yym25 + yyv5 := &x.Selector + yym6 := z.DecBinary() + _ = yym6 if false { } else { - z.F.DecMapStringStringX(yyv24, false, d) + z.F.DecMapStringStringX(yyv5, false, d) } } default: - z.DecStructFieldNotFound(-1, yys22) - } // end switch yys22 - } // end for yyj22 - if !yyhl22 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ScaleStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj26 int - var yyb26 bool - var yyhl26 bool = l >= 0 - yyj26++ - if yyhl26 { - yyb26 = yyj26 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb26 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb26 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { - x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.Replicas = int32(r.DecodeInt(32)) } - yyj26++ - if yyhl26 { - yyb26 = yyj26 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb26 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb26 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Selector = nil } else { - yyv28 := &x.Selector - yym29 := z.DecBinary() - _ = yym29 + yyv9 := &x.Selector + yym10 := z.DecBinary() + _ = yym10 if false { } else { - z.F.DecMapStringStringX(yyv28, false, d) + z.F.DecMapStringStringX(yyv9, false, d) } } for { - yyj26++ - if yyhl26 { - yyb26 = yyj26 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb26 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb26 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj26-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Scale) CodecEncodeSelf(e *codec1978.Encoder) { @@ -451,120 +483,139 @@ func (x *Scale) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym30 := z.EncBinary() - _ = yym30 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep31 := !z.EncBinary() - yy2arr31 := z.EncBasicHandle().StructToArray - var yyq31 [5]bool - _, _, _ = yysep31, yyq31, yy2arr31 - const yyr31 bool = false - yyq31[0] = x.Kind != "" - yyq31[1] = x.APIVersion != "" - yyq31[2] = true - yyq31[3] = true - yyq31[4] = true - if yyr31 || yy2arr31 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn31 int = 0 - for _, b := range yyq31 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn31++ + yynn2++ } } - r.EncodeMapStart(yynn31) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr31 || yy2arr31 { - if yyq31[0] { - yym33 := z.EncBinary() - _ = yym33 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq31[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym34 := z.EncBinary() - _ = yym34 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr31 || yy2arr31 { - if yyq31[1] { - yym36 := z.EncBinary() - _ = yym36 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq31[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym37 := z.EncBinary() - _ = yym37 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr31 || yy2arr31 { - if yyq31[2] { - yy39 := &x.ObjectMeta - yy39.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq31[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy40 := &x.ObjectMeta - yy40.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr31 || yy2arr31 { - if yyq31[3] { - yy42 := &x.Spec - yy42.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq31[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy43 := &x.Spec - yy43.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr31 || yy2arr31 { - if yyq31[4] { - yy45 := &x.Status - yy45.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq31[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy46 := &x.Status - yy46.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep31 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -574,24 +625,25 @@ func (x *Scale) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym47 := z.DecBinary() - _ = yym47 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl48 := r.ReadMapStart() - if yyl48 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl48, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl48 := r.ReadArrayStart() - if yyl48 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl48, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -603,12 +655,12 @@ func (x *Scale) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys49Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys49Slc - var yyhl49 bool = l >= 0 - for yyj49 := 0; ; yyj49++ { - if yyhl49 { - if yyj49 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -616,9 +668,32 @@ func (x *Scale) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys49Slc = r.DecodeBytes(yys49Slc, true, true) - yys49 := string(yys49Slc) - switch yys49 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ScaleSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ScaleStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -631,134 +706,117 @@ func (x *Scale) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv52 := &x.ObjectMeta - yyv52.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ScaleSpec{} - } else { - yyv53 := &x.Spec - yyv53.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = ScaleStatus{} - } else { - yyv54 := &x.Status - yyv54.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys49) - } // end switch yys49 - } // end for yyj49 - if !yyhl49 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Scale) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj55 int - var yyb55 bool - var yyhl55 bool = l >= 0 - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb55 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb55 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ScaleSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ScaleStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb55 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb55 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l - } else { - yyb55 = r.CheckBreak() - } - if yyb55 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv58 := &x.ObjectMeta - yyv58.CodecDecodeSelf(d) - } - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l - } else { - yyb55 = r.CheckBreak() - } - if yyb55 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ScaleSpec{} - } else { - yyv59 := &x.Spec - yyv59.CodecDecodeSelf(d) - } - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l - } else { - yyb55 = r.CheckBreak() - } - if yyb55 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = ScaleStatus{} - } else { - yyv60 := &x.Status - yyv60.CodecDecodeSelf(d) - } for { - yyj55++ - if yyhl55 { - yyb55 = yyj55 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb55 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb55 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj55-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ReplicationControllerDummy) CodecEncodeSelf(e *codec1978.Encoder) { @@ -768,33 +826,36 @@ func (x *ReplicationControllerDummy) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym61 := z.EncBinary() - _ = yym61 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep62 := !z.EncBinary() - yy2arr62 := z.EncBasicHandle().StructToArray - var yyq62 [2]bool - _, _, _ = yysep62, yyq62, yy2arr62 - const yyr62 bool = false - yyq62[0] = x.Kind != "" - yyq62[1] = x.APIVersion != "" - if yyr62 || yy2arr62 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn62 int = 0 - for _, b := range yyq62 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn62++ + yynn2++ } } - r.EncodeMapStart(yynn62) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr62 || yy2arr62 { - if yyq62[0] { - yym64 := z.EncBinary() - _ = yym64 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) @@ -803,20 +864,23 @@ func (x *ReplicationControllerDummy) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq62[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym65 := z.EncBinary() - _ = yym65 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) } } } - if yyr62 || yy2arr62 { - if yyq62[1] { - yym67 := z.EncBinary() - _ = yym67 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) @@ -825,18 +889,22 @@ func (x *ReplicationControllerDummy) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq62[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym68 := z.EncBinary() - _ = yym68 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) } } } - if yysep62 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -846,24 +914,25 @@ func (x *ReplicationControllerDummy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym69 := z.DecBinary() - _ = yym69 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl70 := r.ReadMapStart() - if yyl70 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl70, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl70 := r.ReadArrayStart() - if yyl70 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl70, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -875,12 +944,12 @@ func (x *ReplicationControllerDummy) codecDecodeSelfFromMap(l int, d *codec1978. var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys71Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys71Slc - var yyhl71 bool = l >= 0 - for yyj71 := 0; ; yyj71++ { - if yyhl71 { - if yyj71 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -888,9 +957,11 @@ func (x *ReplicationControllerDummy) codecDecodeSelfFromMap(l int, d *codec1978. break } } - yys71Slc = r.DecodeBytes(yys71Slc, true, true) - yys71 := string(yys71Slc) - switch yys71 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -904,64 +975,65 @@ func (x *ReplicationControllerDummy) codecDecodeSelfFromMap(l int, d *codec1978. x.APIVersion = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys71) - } // end switch yys71 - } // end for yyj71 - if !yyhl71 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ReplicationControllerDummy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj74 int - var yyb74 bool - var yyhl74 bool = l >= 0 - yyj74++ - if yyhl74 { - yyb74 = yyj74 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb74 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb74 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj74++ - if yyhl74 { - yyb74 = yyj74 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb74 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb74 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } for { - yyj74++ - if yyhl74 { - yyb74 = yyj74 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb74 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb74 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj74-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { @@ -971,36 +1043,38 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym77 := z.EncBinary() - _ = yym77 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep78 := !z.EncBinary() - yy2arr78 := z.EncBasicHandle().StructToArray - var yyq78 [5]bool - _, _, _ = yysep78, yyq78, yy2arr78 - const yyr78 bool = false - yyq78[0] = x.Kind != "" - yyq78[1] = x.Namespace != "" - yyq78[2] = x.Name != "" - yyq78[3] = x.APIVersion != "" - yyq78[4] = x.Subresource != "" - if yyr78 || yy2arr78 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.Name != "" + yyq2[2] = x.APIVersion != "" + yyq2[3] = x.Subresource != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) } else { - var yynn78 int = 0 - for _, b := range yyq78 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn78++ + yynn2++ } } - r.EncodeMapStart(yynn78) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr78 || yy2arr78 { - if yyq78[0] { - yym80 := z.EncBinary() - _ = yym80 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) @@ -1009,42 +1083,23 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq78[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym81 := z.EncBinary() - _ = yym81 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) } } } - if yyr78 || yy2arr78 { - if yyq78[1] { - yym83 := z.EncBinary() - _ = yym83 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq78[1] { - r.EncodeString(codecSelferC_UTF81234, string("namespace")) - yym84 := z.EncBinary() - _ = yym84 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) - } - } - } - if yyr78 || yy2arr78 { - if yyq78[2] { - yym86 := z.EncBinary() - _ = yym86 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -1053,20 +1108,23 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq78[2] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym87 := z.EncBinary() - _ = yym87 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr78 || yy2arr78 { - if yyq78[3] { - yym89 := z.EncBinary() - _ = yym89 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) @@ -1075,20 +1133,23 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq78[3] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym90 := z.EncBinary() - _ = yym90 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) } } } - if yyr78 || yy2arr78 { - if yyq78[4] { - yym92 := z.EncBinary() - _ = yym92 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Subresource)) @@ -1097,18 +1158,22 @@ func (x *SubresourceReference) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq78[4] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("subresource")) - yym93 := z.EncBinary() - _ = yym93 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Subresource)) } } } - if yysep78 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1118,24 +1183,25 @@ func (x *SubresourceReference) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym94 := z.DecBinary() - _ = yym94 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl95 := r.ReadMapStart() - if yyl95 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl95, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl95 := r.ReadArrayStart() - if yyl95 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl95, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1147,12 +1213,12 @@ func (x *SubresourceReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys96Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys96Slc - var yyhl96 bool = l >= 0 - for yyj96 := 0; ; yyj96++ { - if yyhl96 { - if yyj96 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1160,21 +1226,17 @@ func (x *SubresourceReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys96Slc = r.DecodeBytes(yys96Slc, true, true) - yys96 := string(yys96Slc) - switch yys96 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - case "namespace": - if r.TryDecodeAsNil() { - x.Namespace = "" - } else { - x.Namespace = string(r.DecodeString()) - } case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -1194,109 +1256,97 @@ func (x *SubresourceReference) codecDecodeSelfFromMap(l int, d *codec1978.Decode x.Subresource = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys96) - } // end switch yys96 - } // end for yyj96 - if !yyhl96 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *SubresourceReference) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj102 int - var yyb102 bool - var yyhl102 bool = l >= 0 - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Namespace = "" - } else { - x.Namespace = string(r.DecodeString()) - } - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l - } else { - yyb102 = r.CheckBreak() - } - if yyb102 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Subresource = "" } else { x.Subresource = string(r.DecodeString()) } for { - yyj102++ - if yyhl102 { - yyb102 = yyj102 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb102 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb102 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj102-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *CPUTargetUtilization) CodecEncodeSelf(e *codec1978.Encoder) { @@ -1306,45 +1356,52 @@ func (x *CPUTargetUtilization) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym108 := z.EncBinary() - _ = yym108 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep109 := !z.EncBinary() - yy2arr109 := z.EncBasicHandle().StructToArray - var yyq109 [1]bool - _, _, _ = yysep109, yyq109, yy2arr109 - const yyr109 bool = false - if yyr109 || yy2arr109 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn109 int = 1 - for _, b := range yyq109 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn109++ + yynn2++ } } - r.EncodeMapStart(yynn109) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr109 || yy2arr109 { - yym111 := z.EncBinary() - _ = yym111 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.TargetPercentage)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("targetPercentage")) - yym112 := z.EncBinary() - _ = yym112 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.TargetPercentage)) } } - if yysep109 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1354,24 +1411,25 @@ func (x *CPUTargetUtilization) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym113 := z.DecBinary() - _ = yym113 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl114 := r.ReadMapStart() - if yyl114 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl114, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl114 := r.ReadArrayStart() - if yyl114 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl114, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1383,12 +1441,12 @@ func (x *CPUTargetUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys115Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys115Slc - var yyhl115 bool = l >= 0 - for yyj115 := 0; ; yyj115++ { - if yyhl115 { - if yyj115 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1396,59 +1454,883 @@ func (x *CPUTargetUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys115Slc = r.DecodeBytes(yys115Slc, true, true) - yys115 := string(yys115Slc) - switch yys115 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "targetPercentage": if r.TryDecodeAsNil() { x.TargetPercentage = 0 } else { - x.TargetPercentage = int(r.DecodeInt(codecSelferBitsize1234)) + x.TargetPercentage = int32(r.DecodeInt(32)) } default: - z.DecStructFieldNotFound(-1, yys115) - } // end switch yys115 - } // end for yyj115 - if !yyhl115 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *CPUTargetUtilization) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj117 int - var yyb117 bool - var yyhl117 bool = l >= 0 - yyj117++ - if yyhl117 { - yyb117 = yyj117 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb117 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb117 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TargetPercentage = 0 } else { - x.TargetPercentage = int(r.DecodeInt(codecSelferBitsize1234)) + x.TargetPercentage = int32(r.DecodeInt(32)) } for { - yyj117++ - if yyhl117 { - yyb117 = yyj117 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb117 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb117 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj117-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *CustomMetricTarget) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.TargetValue + yym8 := z.EncBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) + } else { + z.EncFallback(yy7) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("value")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.TargetValue + yym10 := z.EncBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) + } else { + z.EncFallback(yy9) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *CustomMetricTarget) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *CustomMetricTarget) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + case "value": + if r.TryDecodeAsNil() { + x.TargetValue = pkg4_resource.Quantity{} + } else { + yyv5 := &x.TargetValue + yym6 := z.DecBinary() + _ = yym6 + if false { + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) + } else { + z.DecFallback(yyv5, false) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *CustomMetricTarget) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TargetValue = pkg4_resource.Quantity{} + } else { + yyv9 := &x.TargetValue + yym10 := z.DecBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) + } else { + z.DecFallback(yyv9, false) + } + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *CustomMetricTargetList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceCustomMetricTarget(([]CustomMetricTarget)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceCustomMetricTarget(([]CustomMetricTarget)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *CustomMetricTargetList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *CustomMetricTargetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv4 := &x.Items + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceCustomMetricTarget((*[]CustomMetricTarget)(yyv4), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *CustomMetricTargetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv7 := &x.Items + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceCustomMetricTarget((*[]CustomMetricTarget)(yyv7), d) + } + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *CustomMetricCurrentStatus) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.CurrentValue + yym8 := z.EncBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) + } else { + z.EncFallback(yy7) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("value")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.CurrentValue + yym10 := z.EncBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) + } else { + z.EncFallback(yy9) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *CustomMetricCurrentStatus) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *CustomMetricCurrentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + case "value": + if r.TryDecodeAsNil() { + x.CurrentValue = pkg4_resource.Quantity{} + } else { + yyv5 := &x.CurrentValue + yym6 := z.DecBinary() + _ = yym6 + if false { + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) + } else { + z.DecFallback(yyv5, false) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *CustomMetricCurrentStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.CurrentValue = pkg4_resource.Quantity{} + } else { + yyv9 := &x.CurrentValue + yym10 := z.DecBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) + } else { + z.DecFallback(yyv9, false) + } + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *CustomMetricCurrentStatusList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + h.encSliceCustomMetricCurrentStatus(([]CustomMetricCurrentStatus)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + h.encSliceCustomMetricCurrentStatus(([]CustomMetricCurrentStatus)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *CustomMetricCurrentStatusList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *CustomMetricCurrentStatusList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv4 := &x.Items + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + h.decSliceCustomMetricCurrentStatus((*[]CustomMetricCurrentStatus)(yyv4), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *CustomMetricCurrentStatusList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv7 := &x.Items + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceCustomMetricCurrentStatus((*[]CustomMetricCurrentStatus)(yyv7), d) + } + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HorizontalPodAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -1458,87 +2340,99 @@ func (x *HorizontalPodAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym119 := z.EncBinary() - _ = yym119 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep120 := !z.EncBinary() - yy2arr120 := z.EncBasicHandle().StructToArray - var yyq120 [4]bool - _, _, _ = yysep120, yyq120, yy2arr120 - const yyr120 bool = false - yyq120[1] = x.MinReplicas != nil - yyq120[3] = x.CPUUtilization != nil - if yyr120 || yy2arr120 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.MinReplicas != nil + yyq2[3] = x.CPUUtilization != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn120 int = 2 - for _, b := range yyq120 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn120++ + yynn2++ } } - r.EncodeMapStart(yynn120) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr120 || yy2arr120 { - yy122 := &x.ScaleRef - yy122.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.ScaleRef + yy4.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("scaleRef")) - yy123 := &x.ScaleRef - yy123.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ScaleRef + yy6.CodecEncodeSelf(e) } - if yyr120 || yy2arr120 { - if yyq120[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.MinReplicas == nil { r.EncodeNil() } else { - yy125 := *x.MinReplicas - yym126 := z.EncBinary() - _ = yym126 + yy9 := *x.MinReplicas + yym10 := z.EncBinary() + _ = yym10 if false { } else { - r.EncodeInt(int64(yy125)) + r.EncodeInt(int64(yy9)) } } } else { r.EncodeNil() } } else { - if yyq120[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("minReplicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.MinReplicas == nil { r.EncodeNil() } else { - yy127 := *x.MinReplicas - yym128 := z.EncBinary() - _ = yym128 + yy11 := *x.MinReplicas + yym12 := z.EncBinary() + _ = yym12 if false { } else { - r.EncodeInt(int64(yy127)) + r.EncodeInt(int64(yy11)) } } } } - if yyr120 || yy2arr120 { - yym130 := z.EncBinary() - _ = yym130 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeInt(int64(x.MaxReplicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxReplicas")) - yym131 := z.EncBinary() - _ = yym131 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeInt(int64(x.MaxReplicas)) } } - if yyr120 || yy2arr120 { - if yyq120[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.CPUUtilization == nil { r.EncodeNil() } else { @@ -1548,8 +2442,10 @@ func (x *HorizontalPodAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq120[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("cpuUtilization")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CPUUtilization == nil { r.EncodeNil() } else { @@ -1557,8 +2453,10 @@ func (x *HorizontalPodAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep120 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1568,24 +2466,25 @@ func (x *HorizontalPodAutoscalerSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym133 := z.DecBinary() - _ = yym133 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl134 := r.ReadMapStart() - if yyl134 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl134, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl134 := r.ReadArrayStart() - if yyl134 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl134, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1597,12 +2496,12 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys135Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys135Slc - var yyhl135 bool = l >= 0 - for yyj135 := 0; ; yyj135++ { - if yyhl135 { - if yyj135 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1610,15 +2509,17 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978 break } } - yys135Slc = r.DecodeBytes(yys135Slc, true, true) - yys135 := string(yys135Slc) - switch yys135 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "scaleRef": if r.TryDecodeAsNil() { x.ScaleRef = SubresourceReference{} } else { - yyv136 := &x.ScaleRef - yyv136.CodecDecodeSelf(d) + yyv4 := &x.ScaleRef + yyv4.CodecDecodeSelf(d) } case "minReplicas": if r.TryDecodeAsNil() { @@ -1627,20 +2528,20 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978 } } else { if x.MinReplicas == nil { - x.MinReplicas = new(int) + x.MinReplicas = new(int32) } - yym138 := z.DecBinary() - _ = yym138 + yym6 := z.DecBinary() + _ = yym6 if false { } else { - *((*int)(x.MinReplicas)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.MinReplicas)) = int32(r.DecodeInt(32)) } } case "maxReplicas": if r.TryDecodeAsNil() { x.MaxReplicas = 0 } else { - x.MaxReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.MaxReplicas = int32(r.DecodeInt(32)) } case "cpuUtilization": if r.TryDecodeAsNil() { @@ -1654,87 +2555,89 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978 x.CPUUtilization.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys135) - } // end switch yys135 - } // end for yyj135 - if !yyhl135 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj141 int - var yyb141 bool - var yyhl141 bool = l >= 0 - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ScaleRef = SubresourceReference{} } else { - yyv142 := &x.ScaleRef - yyv142.CodecDecodeSelf(d) + yyv10 := &x.ScaleRef + yyv10.CodecDecodeSelf(d) } - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.MinReplicas != nil { x.MinReplicas = nil } } else { if x.MinReplicas == nil { - x.MinReplicas = new(int) + x.MinReplicas = new(int32) } - yym144 := z.DecBinary() - _ = yym144 + yym12 := z.DecBinary() + _ = yym12 if false { } else { - *((*int)(x.MinReplicas)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.MinReplicas)) = int32(r.DecodeInt(32)) } } - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MaxReplicas = 0 } else { - x.MaxReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.MaxReplicas = int32(r.DecodeInt(32)) } - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CPUUtilization != nil { x.CPUUtilization = nil @@ -1746,18 +2649,19 @@ func (x *HorizontalPodAutoscalerSpec) codecDecodeSelfFromArray(l int, d *codec19 x.CPUUtilization.CodecDecodeSelf(d) } for { - yyj141++ - if yyhl141 { - yyb141 = yyj141 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb141 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb141 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj141-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HorizontalPodAutoscalerStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -1767,74 +2671,80 @@ func (x *HorizontalPodAutoscalerStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym147 := z.EncBinary() - _ = yym147 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep148 := !z.EncBinary() - yy2arr148 := z.EncBasicHandle().StructToArray - var yyq148 [5]bool - _, _, _ = yysep148, yyq148, yy2arr148 - const yyr148 bool = false - yyq148[0] = x.ObservedGeneration != nil - yyq148[1] = x.LastScaleTime != nil - yyq148[4] = x.CurrentCPUUtilizationPercentage != nil - if yyr148 || yy2arr148 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.ObservedGeneration != nil + yyq2[1] = x.LastScaleTime != nil + yyq2[4] = x.CurrentCPUUtilizationPercentage != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn148 int = 2 - for _, b := range yyq148 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn148++ + yynn2++ } } - r.EncodeMapStart(yynn148) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr148 || yy2arr148 { - if yyq148[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.ObservedGeneration == nil { r.EncodeNil() } else { - yy150 := *x.ObservedGeneration - yym151 := z.EncBinary() - _ = yym151 + yy4 := *x.ObservedGeneration + yym5 := z.EncBinary() + _ = yym5 if false { } else { - r.EncodeInt(int64(yy150)) + r.EncodeInt(int64(yy4)) } } } else { r.EncodeNil() } } else { - if yyq148[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("observedGeneration")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ObservedGeneration == nil { r.EncodeNil() } else { - yy152 := *x.ObservedGeneration - yym153 := z.EncBinary() - _ = yym153 + yy6 := *x.ObservedGeneration + yym7 := z.EncBinary() + _ = yym7 if false { } else { - r.EncodeInt(int64(yy152)) + r.EncodeInt(int64(yy6)) } } } } - if yyr148 || yy2arr148 { - if yyq148[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.LastScaleTime == nil { r.EncodeNil() } else { - yym155 := z.EncBinary() - _ = yym155 + yym9 := z.EncBinary() + _ = yym9 if false { } else if z.HasExtensions() && z.EncExt(x.LastScaleTime) { - } else if yym155 { + } else if yym9 { z.EncBinaryMarshal(x.LastScaleTime) - } else if !yym155 && z.IsJSONHandle() { + } else if !yym9 && z.IsJSONHandle() { z.EncJSONMarshal(x.LastScaleTime) } else { z.EncFallback(x.LastScaleTime) @@ -1844,18 +2754,20 @@ func (x *HorizontalPodAutoscalerStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq148[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastScaleTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.LastScaleTime == nil { r.EncodeNil() } else { - yym156 := z.EncBinary() - _ = yym156 + yym10 := z.EncBinary() + _ = yym10 if false { } else if z.HasExtensions() && z.EncExt(x.LastScaleTime) { - } else if yym156 { + } else if yym10 { z.EncBinaryMarshal(x.LastScaleTime) - } else if !yym156 && z.IsJSONHandle() { + } else if !yym10 && z.IsJSONHandle() { z.EncJSONMarshal(x.LastScaleTime) } else { z.EncFallback(x.LastScaleTime) @@ -1863,72 +2775,83 @@ func (x *HorizontalPodAutoscalerStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr148 || yy2arr148 { - yym158 := z.EncBinary() - _ = yym158 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym12 := z.EncBinary() + _ = yym12 if false { } else { r.EncodeInt(int64(x.CurrentReplicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("currentReplicas")) - yym159 := z.EncBinary() - _ = yym159 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeInt(int64(x.CurrentReplicas)) } } - if yyr148 || yy2arr148 { - yym161 := z.EncBinary() - _ = yym161 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym15 := z.EncBinary() + _ = yym15 if false { } else { r.EncodeInt(int64(x.DesiredReplicas)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("desiredReplicas")) - yym162 := z.EncBinary() - _ = yym162 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeInt(int64(x.DesiredReplicas)) } } - if yyr148 || yy2arr148 { - if yyq148[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { if x.CurrentCPUUtilizationPercentage == nil { r.EncodeNil() } else { - yy164 := *x.CurrentCPUUtilizationPercentage - yym165 := z.EncBinary() - _ = yym165 + yy18 := *x.CurrentCPUUtilizationPercentage + yym19 := z.EncBinary() + _ = yym19 if false { } else { - r.EncodeInt(int64(yy164)) + r.EncodeInt(int64(yy18)) } } } else { r.EncodeNil() } } else { - if yyq148[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("currentCPUUtilizationPercentage")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CurrentCPUUtilizationPercentage == nil { r.EncodeNil() } else { - yy166 := *x.CurrentCPUUtilizationPercentage - yym167 := z.EncBinary() - _ = yym167 + yy20 := *x.CurrentCPUUtilizationPercentage + yym21 := z.EncBinary() + _ = yym21 if false { } else { - r.EncodeInt(int64(yy166)) + r.EncodeInt(int64(yy20)) } } } } - if yysep148 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -1938,24 +2861,25 @@ func (x *HorizontalPodAutoscalerStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym168 := z.DecBinary() - _ = yym168 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl169 := r.ReadMapStart() - if yyl169 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl169, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl169 := r.ReadArrayStart() - if yyl169 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl169, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -1967,12 +2891,12 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys170Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys170Slc - var yyhl170 bool = l >= 0 - for yyj170 := 0; ; yyj170++ { - if yyhl170 { - if yyj170 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -1980,9 +2904,11 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 break } } - yys170Slc = r.DecodeBytes(yys170Slc, true, true) - yys170 := string(yys170Slc) - switch yys170 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "observedGeneration": if r.TryDecodeAsNil() { if x.ObservedGeneration != nil { @@ -1992,8 +2918,8 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 if x.ObservedGeneration == nil { x.ObservedGeneration = new(int64) } - yym172 := z.DecBinary() - _ = yym172 + yym5 := z.DecBinary() + _ = yym5 if false { } else { *((*int64)(x.ObservedGeneration)) = int64(r.DecodeInt(64)) @@ -2008,13 +2934,13 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 if x.LastScaleTime == nil { x.LastScaleTime = new(pkg1_unversioned.Time) } - yym174 := z.DecBinary() - _ = yym174 + yym7 := z.DecBinary() + _ = yym7 if false { } else if z.HasExtensions() && z.DecExt(x.LastScaleTime) { - } else if yym174 { + } else if yym7 { z.DecBinaryUnmarshal(x.LastScaleTime) - } else if !yym174 && z.IsJSONHandle() { + } else if !yym7 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.LastScaleTime) } else { z.DecFallback(x.LastScaleTime, false) @@ -2024,13 +2950,13 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 if r.TryDecodeAsNil() { x.CurrentReplicas = 0 } else { - x.CurrentReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.CurrentReplicas = int32(r.DecodeInt(32)) } case "desiredReplicas": if r.TryDecodeAsNil() { x.DesiredReplicas = 0 } else { - x.DesiredReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.DesiredReplicas = int32(r.DecodeInt(32)) } case "currentCPUUtilizationPercentage": if r.TryDecodeAsNil() { @@ -2039,41 +2965,40 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromMap(l int, d *codec19 } } else { if x.CurrentCPUUtilizationPercentage == nil { - x.CurrentCPUUtilizationPercentage = new(int) + x.CurrentCPUUtilizationPercentage = new(int32) } - yym178 := z.DecBinary() - _ = yym178 + yym11 := z.DecBinary() + _ = yym11 if false { } else { - *((*int)(x.CurrentCPUUtilizationPercentage)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.CurrentCPUUtilizationPercentage)) = int32(r.DecodeInt(32)) } } default: - z.DecStructFieldNotFound(-1, yys170) - } // end switch yys170 - } // end for yyj170 - if !yyhl170 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj179 int - var yyb179 bool - var yyhl179 bool = l >= 0 - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.ObservedGeneration != nil { x.ObservedGeneration = nil @@ -2082,23 +3007,24 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromArray(l int, d *codec if x.ObservedGeneration == nil { x.ObservedGeneration = new(int64) } - yym181 := z.DecBinary() - _ = yym181 + yym14 := z.DecBinary() + _ = yym14 if false { } else { *((*int64)(x.ObservedGeneration)) = int64(r.DecodeInt(64)) } } - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.LastScaleTime != nil { x.LastScaleTime = nil @@ -2107,86 +3033,90 @@ func (x *HorizontalPodAutoscalerStatus) codecDecodeSelfFromArray(l int, d *codec if x.LastScaleTime == nil { x.LastScaleTime = new(pkg1_unversioned.Time) } - yym183 := z.DecBinary() - _ = yym183 + yym16 := z.DecBinary() + _ = yym16 if false { } else if z.HasExtensions() && z.DecExt(x.LastScaleTime) { - } else if yym183 { + } else if yym16 { z.DecBinaryUnmarshal(x.LastScaleTime) - } else if !yym183 && z.IsJSONHandle() { + } else if !yym16 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.LastScaleTime) } else { z.DecFallback(x.LastScaleTime, false) } } - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.CurrentReplicas = 0 } else { - x.CurrentReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.CurrentReplicas = int32(r.DecodeInt(32)) } - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DesiredReplicas = 0 } else { - x.DesiredReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.DesiredReplicas = int32(r.DecodeInt(32)) } - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CurrentCPUUtilizationPercentage != nil { x.CurrentCPUUtilizationPercentage = nil } } else { if x.CurrentCPUUtilizationPercentage == nil { - x.CurrentCPUUtilizationPercentage = new(int) + x.CurrentCPUUtilizationPercentage = new(int32) } - yym187 := z.DecBinary() - _ = yym187 + yym20 := z.DecBinary() + _ = yym20 if false { } else { - *((*int)(x.CurrentCPUUtilizationPercentage)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.CurrentCPUUtilizationPercentage)) = int32(r.DecodeInt(32)) } } for { - yyj179++ - if yyhl179 { - yyb179 = yyj179 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb179 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb179 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj179-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HorizontalPodAutoscaler) CodecEncodeSelf(e *codec1978.Encoder) { @@ -2196,120 +3126,139 @@ func (x *HorizontalPodAutoscaler) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym188 := z.EncBinary() - _ = yym188 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep189 := !z.EncBinary() - yy2arr189 := z.EncBasicHandle().StructToArray - var yyq189 [5]bool - _, _, _ = yysep189, yyq189, yy2arr189 - const yyr189 bool = false - yyq189[0] = x.Kind != "" - yyq189[1] = x.APIVersion != "" - yyq189[2] = true - yyq189[3] = true - yyq189[4] = true - if yyr189 || yy2arr189 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn189 int = 0 - for _, b := range yyq189 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn189++ + yynn2++ } } - r.EncodeMapStart(yynn189) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr189 || yy2arr189 { - if yyq189[0] { - yym191 := z.EncBinary() - _ = yym191 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq189[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym192 := z.EncBinary() - _ = yym192 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr189 || yy2arr189 { - if yyq189[1] { - yym194 := z.EncBinary() - _ = yym194 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq189[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym195 := z.EncBinary() - _ = yym195 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr189 || yy2arr189 { - if yyq189[2] { - yy197 := &x.ObjectMeta - yy197.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq189[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy198 := &x.ObjectMeta - yy198.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr189 || yy2arr189 { - if yyq189[3] { - yy200 := &x.Spec - yy200.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq189[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy201 := &x.Spec - yy201.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr189 || yy2arr189 { - if yyq189[4] { - yy203 := &x.Status - yy203.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq189[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy204 := &x.Status - yy204.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep189 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -2319,24 +3268,25 @@ func (x *HorizontalPodAutoscaler) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym205 := z.DecBinary() - _ = yym205 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl206 := r.ReadMapStart() - if yyl206 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl206, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl206 := r.ReadArrayStart() - if yyl206 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl206, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -2348,12 +3298,12 @@ func (x *HorizontalPodAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Dec var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys207Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys207Slc - var yyhl207 bool = l >= 0 - for yyj207 := 0; ; yyj207++ { - if yyhl207 { - if yyj207 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -2361,9 +3311,32 @@ func (x *HorizontalPodAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Dec break } } - yys207Slc = r.DecodeBytes(yys207Slc, true, true) - yys207 := string(yys207Slc) - switch yys207 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = HorizontalPodAutoscalerSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = HorizontalPodAutoscalerStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -2376,134 +3349,117 @@ func (x *HorizontalPodAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Dec } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv210 := &x.ObjectMeta - yyv210.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = HorizontalPodAutoscalerSpec{} - } else { - yyv211 := &x.Spec - yyv211.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = HorizontalPodAutoscalerStatus{} - } else { - yyv212 := &x.Status - yyv212.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys207) - } // end switch yys207 - } // end for yyj207 - if !yyhl207 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HorizontalPodAutoscaler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj213 int - var yyb213 bool - var yyhl213 bool = l >= 0 - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb213 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb213 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = HorizontalPodAutoscalerSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = HorizontalPodAutoscalerStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb213 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb213 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l - } else { - yyb213 = r.CheckBreak() - } - if yyb213 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv216 := &x.ObjectMeta - yyv216.CodecDecodeSelf(d) - } - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l - } else { - yyb213 = r.CheckBreak() - } - if yyb213 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = HorizontalPodAutoscalerSpec{} - } else { - yyv217 := &x.Spec - yyv217.CodecDecodeSelf(d) - } - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l - } else { - yyb213 = r.CheckBreak() - } - if yyb213 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = HorizontalPodAutoscalerStatus{} - } else { - yyv218 := &x.Status - yyv218.CodecDecodeSelf(d) - } for { - yyj213++ - if yyhl213 { - yyb213 = yyj213 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb213 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb213 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj213-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HorizontalPodAutoscalerList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -2513,126 +3469,142 @@ func (x *HorizontalPodAutoscalerList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym219 := z.EncBinary() - _ = yym219 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep220 := !z.EncBinary() - yy2arr220 := z.EncBasicHandle().StructToArray - var yyq220 [4]bool - _, _, _ = yysep220, yyq220, yy2arr220 - const yyr220 bool = false - yyq220[0] = x.Kind != "" - yyq220[1] = x.APIVersion != "" - yyq220[2] = true - if yyr220 || yy2arr220 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn220 int = 1 - for _, b := range yyq220 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn220++ + yynn2++ } } - r.EncodeMapStart(yynn220) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr220 || yy2arr220 { - if yyq220[0] { - yym222 := z.EncBinary() - _ = yym222 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq220[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym223 := z.EncBinary() - _ = yym223 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr220 || yy2arr220 { - if yyq220[1] { - yym225 := z.EncBinary() - _ = yym225 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq220[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym226 := z.EncBinary() - _ = yym226 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr220 || yy2arr220 { - if yyq220[2] { - yy228 := &x.ListMeta - yym229 := z.EncBinary() - _ = yym229 - if false { - } else if z.HasExtensions() && z.EncExt(yy228) { - } else { - z.EncFallback(yy228) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq220[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy230 := &x.ListMeta - yym231 := z.EncBinary() - _ = yym231 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy230) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy230) + z.EncFallback(yy6) } } } - if yyr220 || yy2arr220 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym233 := z.EncBinary() - _ = yym233 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceHorizontalPodAutoscaler(([]HorizontalPodAutoscaler)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym234 := z.EncBinary() - _ = yym234 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceHorizontalPodAutoscaler(([]HorizontalPodAutoscaler)(x.Items), e) } } } - if yysep220 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -2642,24 +3614,25 @@ func (x *HorizontalPodAutoscalerList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym235 := z.DecBinary() - _ = yym235 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl236 := r.ReadMapStart() - if yyl236 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl236, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl236 := r.ReadArrayStart() - if yyl236 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl236, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -2671,12 +3644,12 @@ func (x *HorizontalPodAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978 var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys237Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys237Slc - var yyhl237 bool = l >= 0 - for yyj237 := 0; ; yyj237++ { - if yyhl237 { - if yyj237 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -2684,9 +3657,36 @@ func (x *HorizontalPodAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978 break } } - yys237Slc = r.DecodeBytes(yys237Slc, true, true) - yys237 := string(yys237Slc) - switch yys237 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceHorizontalPodAutoscaler((*[]HorizontalPodAutoscaler)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -2699,133 +3699,111 @@ func (x *HorizontalPodAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978 } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv240 := &x.ListMeta - yym241 := z.DecBinary() - _ = yym241 - if false { - } else if z.HasExtensions() && z.DecExt(yyv240) { - } else { - z.DecFallback(yyv240, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv242 := &x.Items - yym243 := z.DecBinary() - _ = yym243 - if false { - } else { - h.decSliceHorizontalPodAutoscaler((*[]HorizontalPodAutoscaler)(yyv242), d) - } - } default: - z.DecStructFieldNotFound(-1, yys237) - } // end switch yys237 - } // end for yyj237 - if !yyhl237 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HorizontalPodAutoscalerList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj244 int - var yyb244 bool - var yyhl244 bool = l >= 0 - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb244 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb244 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceHorizontalPodAutoscaler((*[]HorizontalPodAutoscaler)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb244 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb244 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l - } else { - yyb244 = r.CheckBreak() - } - if yyb244 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv247 := &x.ListMeta - yym248 := z.DecBinary() - _ = yym248 - if false { - } else if z.HasExtensions() && z.DecExt(yyv247) { - } else { - z.DecFallback(yyv247, false) - } - } - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l - } else { - yyb244 = r.CheckBreak() - } - if yyb244 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv249 := &x.Items - yym250 := z.DecBinary() - _ = yym250 - if false { - } else { - h.decSliceHorizontalPodAutoscaler((*[]HorizontalPodAutoscaler)(yyv249), d) - } - } for { - yyj244++ - if yyhl244 { - yyb244 = yyj244 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb244 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb244 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj244-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { @@ -2835,94 +3813,56 @@ func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym251 := z.EncBinary() - _ = yym251 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep252 := !z.EncBinary() - yy2arr252 := z.EncBasicHandle().StructToArray - var yyq252 [5]bool - _, _, _ = yysep252, yyq252, yy2arr252 - const yyr252 bool = false - yyq252[0] = x.Kind != "" - yyq252[1] = x.APIVersion != "" - yyq252[2] = true - yyq252[3] = x.Description != "" - yyq252[4] = len(x.Versions) != 0 - if yyr252 || yy2arr252 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = x.Description != "" + yyq2[2] = len(x.Versions) != 0 + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn252 int = 0 - for _, b := range yyq252 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn252++ + yynn2++ } } - r.EncodeMapStart(yynn252) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr252 || yy2arr252 { - if yyq252[0] { - yym254 := z.EncBinary() - _ = yym254 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq252[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym255 := z.EncBinary() - _ = yym255 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr252 || yy2arr252 { - if yyq252[1] { - yym257 := z.EncBinary() - _ = yym257 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq252[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym258 := z.EncBinary() - _ = yym258 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr252 || yy2arr252 { - if yyq252[2] { - yy260 := &x.ObjectMeta - yy260.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq252[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy261 := &x.ObjectMeta - yy261.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr252 || yy2arr252 { - if yyq252[3] { - yym263 := z.EncBinary() - _ = yym263 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym9 := z.EncBinary() + _ = yym9 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Description)) @@ -2931,23 +3871,26 @@ func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq252[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("description")) - yym264 := z.EncBinary() - _ = yym264 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Description)) } } } - if yyr252 || yy2arr252 { - if yyq252[4] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Versions == nil { r.EncodeNil() } else { - yym266 := z.EncBinary() - _ = yym266 + yym12 := z.EncBinary() + _ = yym12 if false { } else { h.encSliceAPIVersion(([]APIVersion)(x.Versions), e) @@ -2957,13 +3900,15 @@ func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq252[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("versions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Versions == nil { r.EncodeNil() } else { - yym267 := z.EncBinary() - _ = yym267 + yym13 := z.EncBinary() + _ = yym13 if false { } else { h.encSliceAPIVersion(([]APIVersion)(x.Versions), e) @@ -2971,8 +3916,60 @@ func (x *ThirdPartyResource) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep252 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -2982,24 +3979,25 @@ func (x *ThirdPartyResource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym268 := z.DecBinary() - _ = yym268 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl269 := r.ReadMapStart() - if yyl269 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl269, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl269 := r.ReadArrayStart() - if yyl269 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl269, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3011,12 +4009,12 @@ func (x *ThirdPartyResource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys270Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys270Slc - var yyhl270 bool = l >= 0 - for yyj270 := 0; ; yyj270++ { - if yyhl270 { - if yyj270 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3024,27 +4022,17 @@ func (x *ThirdPartyResource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys270Slc = r.DecodeBytes(yys270Slc, true, true) - yys270 := string(yys270Slc) - switch yys270 { - case "kind": - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - case "apiVersion": - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "metadata": if r.TryDecodeAsNil() { x.ObjectMeta = pkg2_v1.ObjectMeta{} } else { - yyv273 := &x.ObjectMeta - yyv273.CodecDecodeSelf(d) + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) } case "description": if r.TryDecodeAsNil() { @@ -3056,308 +4044,14 @@ func (x *ThirdPartyResource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) if r.TryDecodeAsNil() { x.Versions = nil } else { - yyv275 := &x.Versions - yym276 := z.DecBinary() - _ = yym276 + yyv6 := &x.Versions + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceAPIVersion((*[]APIVersion)(yyv275), d) + h.decSliceAPIVersion((*[]APIVersion)(yyv6), d) } } - default: - z.DecStructFieldNotFound(-1, yys270) - } // end switch yys270 - } // end for yyj270 - if !yyhl270 { - r.ReadEnd() - } -} - -func (x *ThirdPartyResource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj277 int - var yyb277 bool - var yyhl277 bool = l >= 0 - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv280 := &x.ObjectMeta - yyv280.CodecDecodeSelf(d) - } - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Description = "" - } else { - x.Description = string(r.DecodeString()) - } - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Versions = nil - } else { - yyv282 := &x.Versions - yym283 := z.DecBinary() - _ = yym283 - if false { - } else { - h.decSliceAPIVersion((*[]APIVersion)(yyv282), d) - } - } - for { - yyj277++ - if yyhl277 { - yyb277 = yyj277 > l - } else { - yyb277 = r.CheckBreak() - } - if yyb277 { - break - } - z.DecStructFieldNotFound(yyj277-1, "") - } - r.ReadEnd() -} - -func (x *ThirdPartyResourceList) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym284 := z.EncBinary() - _ = yym284 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep285 := !z.EncBinary() - yy2arr285 := z.EncBasicHandle().StructToArray - var yyq285 [4]bool - _, _, _ = yysep285, yyq285, yy2arr285 - const yyr285 bool = false - yyq285[0] = x.Kind != "" - yyq285[1] = x.APIVersion != "" - yyq285[2] = true - if yyr285 || yy2arr285 { - r.EncodeArrayStart(4) - } else { - var yynn285 int = 1 - for _, b := range yyq285 { - if b { - yynn285++ - } - } - r.EncodeMapStart(yynn285) - } - if yyr285 || yy2arr285 { - if yyq285[0] { - yym287 := z.EncBinary() - _ = yym287 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq285[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym288 := z.EncBinary() - _ = yym288 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr285 || yy2arr285 { - if yyq285[1] { - yym290 := z.EncBinary() - _ = yym290 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq285[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym291 := z.EncBinary() - _ = yym291 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr285 || yy2arr285 { - if yyq285[2] { - yy293 := &x.ListMeta - yym294 := z.EncBinary() - _ = yym294 - if false { - } else if z.HasExtensions() && z.EncExt(yy293) { - } else { - z.EncFallback(yy293) - } - } else { - r.EncodeNil() - } - } else { - if yyq285[2] { - r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy295 := &x.ListMeta - yym296 := z.EncBinary() - _ = yym296 - if false { - } else if z.HasExtensions() && z.EncExt(yy295) { - } else { - z.EncFallback(yy295) - } - } - } - if yyr285 || yy2arr285 { - if x.Items == nil { - r.EncodeNil() - } else { - yym298 := z.EncBinary() - _ = yym298 - if false { - } else { - h.encSliceThirdPartyResource(([]ThirdPartyResource)(x.Items), e) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("items")) - if x.Items == nil { - r.EncodeNil() - } else { - yym299 := z.EncBinary() - _ = yym299 - if false { - } else { - h.encSliceThirdPartyResource(([]ThirdPartyResource)(x.Items), e) - } - } - } - if yysep285 { - r.EncodeEnd() - } - } - } -} - -func (x *ThirdPartyResourceList) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym300 := z.DecBinary() - _ = yym300 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl301 := r.ReadMapStart() - if yyl301 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromMap(yyl301, d) - } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl301 := r.ReadArrayStart() - if yyl301 == 0 { - r.ReadEnd() - } else { - x.codecDecodeSelfFromArray(yyl301, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) - } - } -} - -func (x *ThirdPartyResourceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1234 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys302Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys302Slc - var yyhl302 bool = l >= 0 - for yyj302 := 0; ; yyj302++ { - if yyhl302 { - if yyj302 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - yys302Slc = r.DecodeBytes(yys302Slc, true, true) - yys302 := string(yys302Slc) - switch yys302 { case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -3370,133 +4064,465 @@ func (x *ThirdPartyResourceList) codecDecodeSelfFromMap(l int, d *codec1978.Deco } else { x.APIVersion = string(r.DecodeString()) } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ThirdPartyResource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv11 := &x.ObjectMeta + yyv11.CodecDecodeSelf(d) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Description = "" + } else { + x.Description = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Versions = nil + } else { + yyv13 := &x.Versions + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceAPIVersion((*[]APIVersion)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ThirdPartyResourceList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.EncExt(yy4) { + } else { + z.EncFallback(yy4) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(yy6) { + } else { + z.EncFallback(yy6) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + h.encSliceThirdPartyResource(([]ThirdPartyResource)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSliceThirdPartyResource(([]ThirdPartyResource)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ThirdPartyResourceList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ThirdPartyResourceList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "metadata": if r.TryDecodeAsNil() { x.ListMeta = pkg1_unversioned.ListMeta{} } else { - yyv305 := &x.ListMeta - yym306 := z.DecBinary() - _ = yym306 + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 if false { - } else if z.HasExtensions() && z.DecExt(yyv305) { + } else if z.HasExtensions() && z.DecExt(yyv4) { } else { - z.DecFallback(yyv305, false) + z.DecFallback(yyv4, false) } } case "items": if r.TryDecodeAsNil() { x.Items = nil } else { - yyv307 := &x.Items - yym308 := z.DecBinary() - _ = yym308 + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceThirdPartyResource((*[]ThirdPartyResource)(yyv307), d) + h.decSliceThirdPartyResource((*[]ThirdPartyResource)(yyv6), d) } } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } default: - z.DecStructFieldNotFound(-1, yys302) - } // end switch yys302 - } // end for yyj302 - if !yyhl302 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ThirdPartyResourceList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj309 int - var yyb309 bool - var yyhl309 bool = l >= 0 - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb309 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb309 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceThirdPartyResource((*[]ThirdPartyResource)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb309 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb309 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l - } else { - yyb309 = r.CheckBreak() - } - if yyb309 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv312 := &x.ListMeta - yym313 := z.DecBinary() - _ = yym313 - if false { - } else if z.HasExtensions() && z.DecExt(yyv312) { - } else { - z.DecFallback(yyv312, false) - } - } - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l - } else { - yyb309 = r.CheckBreak() - } - if yyb309 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv314 := &x.Items - yym315 := z.DecBinary() - _ = yym315 - if false { - } else { - h.decSliceThirdPartyResource((*[]ThirdPartyResource)(yyv314), d) - } - } for { - yyj309++ - if yyhl309 { - yyb309 = yyj309 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb309 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb309 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj309-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *APIVersion) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3506,33 +4532,36 @@ func (x *APIVersion) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym316 := z.EncBinary() - _ = yym316 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep317 := !z.EncBinary() - yy2arr317 := z.EncBasicHandle().StructToArray - var yyq317 [2]bool - _, _, _ = yysep317, yyq317, yy2arr317 - const yyr317 bool = false - yyq317[0] = x.Name != "" - yyq317[1] = x.APIGroup != "" - if yyr317 || yy2arr317 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Name != "" + yyq2[1] = x.APIGroup != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn317 int = 0 - for _, b := range yyq317 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn317++ + yynn2++ } } - r.EncodeMapStart(yynn317) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr317 || yy2arr317 { - if yyq317[0] { - yym319 := z.EncBinary() - _ = yym319 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) @@ -3541,20 +4570,23 @@ func (x *APIVersion) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq317[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("name")) - yym320 := z.EncBinary() - _ = yym320 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Name)) } } } - if yyr317 || yy2arr317 { - if yyq317[1] { - yym322 := z.EncBinary() - _ = yym322 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIGroup)) @@ -3563,18 +4595,22 @@ func (x *APIVersion) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq317[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiGroup")) - yym323 := z.EncBinary() - _ = yym323 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.APIGroup)) } } } - if yysep317 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -3584,24 +4620,25 @@ func (x *APIVersion) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym324 := z.DecBinary() - _ = yym324 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl325 := r.ReadMapStart() - if yyl325 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl325, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl325 := r.ReadArrayStart() - if yyl325 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl325, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3613,12 +4650,12 @@ func (x *APIVersion) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys326Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys326Slc - var yyhl326 bool = l >= 0 - for yyj326 := 0; ; yyj326++ { - if yyhl326 { - if yyj326 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3626,9 +4663,11 @@ func (x *APIVersion) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys326Slc = r.DecodeBytes(yys326Slc, true, true) - yys326 := string(yys326Slc) - switch yys326 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "name": if r.TryDecodeAsNil() { x.Name = "" @@ -3642,64 +4681,65 @@ func (x *APIVersion) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.APIGroup = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys326) - } // end switch yys326 - } // end for yyj326 - if !yyhl326 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *APIVersion) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj329 int - var yyb329 bool - var yyhl329 bool = l >= 0 - yyj329++ - if yyhl329 { - yyb329 = yyj329 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb329 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb329 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Name = "" } else { x.Name = string(r.DecodeString()) } - yyj329++ - if yyhl329 { - yyb329 = yyj329 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb329 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb329 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIGroup = "" } else { x.APIGroup = string(r.DecodeString()) } for { - yyj329++ - if yyhl329 { - yyb329 = yyj329 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb329 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb329 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj329-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ThirdPartyResourceData) CodecEncodeSelf(e *codec1978.Encoder) { @@ -3709,96 +4749,58 @@ func (x *ThirdPartyResourceData) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym332 := z.EncBinary() - _ = yym332 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep333 := !z.EncBinary() - yy2arr333 := z.EncBasicHandle().StructToArray - var yyq333 [4]bool - _, _, _ = yysep333, yyq333, yy2arr333 - const yyr333 bool = false - yyq333[0] = x.Kind != "" - yyq333[1] = x.APIVersion != "" - yyq333[2] = true - yyq333[3] = len(x.Data) != 0 - if yyr333 || yy2arr333 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = len(x.Data) != 0 + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn333 int = 0 - for _, b := range yyq333 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn333++ + yynn2++ } } - r.EncodeMapStart(yynn333) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr333 || yy2arr333 { - if yyq333[0] { - yym335 := z.EncBinary() - _ = yym335 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq333[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym336 := z.EncBinary() - _ = yym336 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr333 || yy2arr333 { - if yyq333[1] { - yym338 := z.EncBinary() - _ = yym338 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq333[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym339 := z.EncBinary() - _ = yym339 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr333 || yy2arr333 { - if yyq333[2] { - yy341 := &x.ObjectMeta - yy341.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq333[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy342 := &x.ObjectMeta - yy342.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr333 || yy2arr333 { - if yyq333[3] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Data == nil { r.EncodeNil() } else { - yym344 := z.EncBinary() - _ = yym344 + yym9 := z.EncBinary() + _ = yym9 if false { } else { r.EncodeStringBytes(codecSelferC_RAW1234, []byte(x.Data)) @@ -3808,13 +4810,15 @@ func (x *ThirdPartyResourceData) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq333[3] { - r.EncodeString(codecSelferC_UTF81234, string("name")) + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("data")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Data == nil { r.EncodeNil() } else { - yym345 := z.EncBinary() - _ = yym345 + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeStringBytes(codecSelferC_RAW1234, []byte(x.Data)) @@ -3822,8 +4826,60 @@ func (x *ThirdPartyResourceData) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep333 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -3833,24 +4889,25 @@ func (x *ThirdPartyResourceData) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym346 := z.DecBinary() - _ = yym346 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl347 := r.ReadMapStart() - if yyl347 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl347, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl347 := r.ReadArrayStart() - if yyl347 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl347, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -3862,12 +4919,12 @@ func (x *ThirdPartyResourceData) codecDecodeSelfFromMap(l int, d *codec1978.Deco var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys348Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys348Slc - var yyhl348 bool = l >= 0 - for yyj348 := 0; ; yyj348++ { - if yyhl348 { - if yyj348 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -3875,9 +4932,30 @@ func (x *ThirdPartyResourceData) codecDecodeSelfFromMap(l int, d *codec1978.Deco break } } - yys348Slc = r.DecodeBytes(yys348Slc, true, true) - yys348 := string(yys348Slc) - switch yys348 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "data": + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv5 := &x.Data + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + *yyv5 = r.DecodeBytes(*(*[]byte)(yyv5), false, false) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -3890,121 +4968,105 @@ func (x *ThirdPartyResourceData) codecDecodeSelfFromMap(l int, d *codec1978.Deco } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv351 := &x.ObjectMeta - yyv351.CodecDecodeSelf(d) - } - case "name": - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv352 := &x.Data - yym353 := z.DecBinary() - _ = yym353 - if false { - } else { - *yyv352 = r.DecodeBytes(*(*[]byte)(yyv352), false, false) - } - } default: - z.DecStructFieldNotFound(-1, yys348) - } // end switch yys348 - } // end for yyj348 - if !yyhl348 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ThirdPartyResourceData) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj354 int - var yyb354 bool - var yyhl354 bool = l >= 0 - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb354 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb354 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Data = nil + } else { + yyv11 := &x.Data + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + *yyv11 = r.DecodeBytes(*(*[]byte)(yyv11), false, false) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb354 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb354 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l - } else { - yyb354 = r.CheckBreak() - } - if yyb354 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv357 := &x.ObjectMeta - yyv357.CodecDecodeSelf(d) - } - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l - } else { - yyb354 = r.CheckBreak() - } - if yyb354 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Data = nil - } else { - yyv358 := &x.Data - yym359 := z.DecBinary() - _ = yym359 - if false { - } else { - *yyv358 = r.DecodeBytes(*(*[]byte)(yyv358), false, false) - } - } for { - yyj354++ - if yyhl354 { - yyb354 = yyj354 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb354 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb354 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj354-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Deployment) CodecEncodeSelf(e *codec1978.Encoder) { @@ -4014,120 +5076,139 @@ func (x *Deployment) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym360 := z.EncBinary() - _ = yym360 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep361 := !z.EncBinary() - yy2arr361 := z.EncBasicHandle().StructToArray - var yyq361 [5]bool - _, _, _ = yysep361, yyq361, yy2arr361 - const yyr361 bool = false - yyq361[0] = x.Kind != "" - yyq361[1] = x.APIVersion != "" - yyq361[2] = true - yyq361[3] = true - yyq361[4] = true - if yyr361 || yy2arr361 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn361 int = 0 - for _, b := range yyq361 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn361++ + yynn2++ } } - r.EncodeMapStart(yynn361) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr361 || yy2arr361 { - if yyq361[0] { - yym363 := z.EncBinary() - _ = yym363 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq361[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym364 := z.EncBinary() - _ = yym364 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr361 || yy2arr361 { - if yyq361[1] { - yym366 := z.EncBinary() - _ = yym366 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq361[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym367 := z.EncBinary() - _ = yym367 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr361 || yy2arr361 { - if yyq361[2] { - yy369 := &x.ObjectMeta - yy369.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq361[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy370 := &x.ObjectMeta - yy370.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr361 || yy2arr361 { - if yyq361[3] { - yy372 := &x.Spec - yy372.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq361[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy373 := &x.Spec - yy373.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr361 || yy2arr361 { - if yyq361[4] { - yy375 := &x.Status - yy375.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq361[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy376 := &x.Status - yy376.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep361 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4137,24 +5218,25 @@ func (x *Deployment) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym377 := z.DecBinary() - _ = yym377 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl378 := r.ReadMapStart() - if yyl378 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl378, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl378 := r.ReadArrayStart() - if yyl378 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl378, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4166,12 +5248,12 @@ func (x *Deployment) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys379Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys379Slc - var yyhl379 bool = l >= 0 - for yyj379 := 0; ; yyj379++ { - if yyhl379 { - if yyj379 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4179,9 +5261,32 @@ func (x *Deployment) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys379Slc = r.DecodeBytes(yys379Slc, true, true) - yys379 := string(yys379Slc) - switch yys379 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = DeploymentSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = DeploymentStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -4194,134 +5299,117 @@ func (x *Deployment) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv382 := &x.ObjectMeta - yyv382.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = DeploymentSpec{} - } else { - yyv383 := &x.Spec - yyv383.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = DeploymentStatus{} - } else { - yyv384 := &x.Status - yyv384.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys379) - } // end switch yys379 - } // end for yyj379 - if !yyhl379 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Deployment) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj385 int - var yyb385 bool - var yyhl385 bool = l >= 0 - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb385 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb385 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = DeploymentSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = DeploymentStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb385 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb385 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l - } else { - yyb385 = r.CheckBreak() - } - if yyb385 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv388 := &x.ObjectMeta - yyv388.CodecDecodeSelf(d) - } - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l - } else { - yyb385 = r.CheckBreak() - } - if yyb385 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = DeploymentSpec{} - } else { - yyv389 := &x.Spec - yyv389.CodecDecodeSelf(d) - } - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l - } else { - yyb385 = r.CheckBreak() - } - if yyb385 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = DeploymentStatus{} - } else { - yyv390 := &x.Status - yyv390.CodecDecodeSelf(d) - } for { - yyj385++ - if yyhl385 { - yyb385 = yyj385 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb385 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb385 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj385-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeploymentSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -4331,162 +5419,234 @@ func (x *DeploymentSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym391 := z.EncBinary() - _ = yym391 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep392 := !z.EncBinary() - yy2arr392 := z.EncBasicHandle().StructToArray - var yyq392 [5]bool - _, _, _ = yysep392, yyq392, yy2arr392 - const yyr392 bool = false - yyq392[0] = x.Replicas != nil - yyq392[1] = len(x.Selector) != 0 - yyq392[2] = x.Template != nil - yyq392[3] = true - yyq392[4] = x.UniqueLabelKey != nil - if yyr392 || yy2arr392 { - r.EncodeArrayStart(5) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [8]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Replicas != nil + yyq2[1] = x.Selector != nil + yyq2[3] = true + yyq2[4] = x.MinReadySeconds != 0 + yyq2[5] = x.RevisionHistoryLimit != nil + yyq2[6] = x.Paused != false + yyq2[7] = x.RollbackTo != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(8) } else { - var yynn392 int = 0 - for _, b := range yyq392 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn392++ + yynn2++ } } - r.EncodeMapStart(yynn392) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr392 || yy2arr392 { - if yyq392[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Replicas == nil { r.EncodeNil() } else { - yy394 := *x.Replicas - yym395 := z.EncBinary() - _ = yym395 + yy4 := *x.Replicas + yym5 := z.EncBinary() + _ = yym5 if false { } else { - r.EncodeInt(int64(yy394)) + r.EncodeInt(int64(yy4)) } } } else { r.EncodeNil() } } else { - if yyq392[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Replicas == nil { r.EncodeNil() } else { - yy396 := *x.Replicas - yym397 := z.EncBinary() - _ = yym397 + yy6 := *x.Replicas + yym7 := z.EncBinary() + _ = yym7 if false { } else { - r.EncodeInt(int64(yy396)) + r.EncodeInt(int64(yy6)) } } } } - if yyr392 || yy2arr392 { - if yyq392[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Selector == nil { r.EncodeNil() } else { - yym399 := z.EncBinary() - _ = yym399 - if false { - } else { - z.F.EncMapStringStringV(x.Selector, false, e) - } + x.Selector.CodecEncodeSelf(e) } } else { r.EncodeNil() } } else { - if yyq392[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym400 := z.EncBinary() - _ = yym400 - if false { - } else { - z.F.EncMapStringStringV(x.Selector, false, e) - } + x.Selector.CodecEncodeSelf(e) } } } - if yyr392 || yy2arr392 { - if yyq392[2] { - if x.Template == nil { - r.EncodeNil() - } else { - x.Template.CodecEncodeSelf(e) - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy12 := &x.Template + yy12.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("template")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy14 := &x.Template + yy14.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yy17 := &x.Strategy + yy17.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq392[2] { - r.EncodeString(codecSelferC_UTF81234, string("template")) - if x.Template == nil { - r.EncodeNil() - } else { - x.Template.CodecEncodeSelf(e) - } - } - } - if yyr392 || yy2arr392 { - if yyq392[3] { - yy403 := &x.Strategy - yy403.CodecEncodeSelf(e) - } else { - r.EncodeNil() - } - } else { - if yyq392[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("strategy")) - yy404 := &x.Strategy - yy404.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy19 := &x.Strategy + yy19.CodecEncodeSelf(e) } } - if yyr392 || yy2arr392 { - if yyq392[4] { - if x.UniqueLabelKey == nil { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeInt(int64(x.MinReadySeconds)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("minReadySeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeInt(int64(x.MinReadySeconds)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + if x.RevisionHistoryLimit == nil { r.EncodeNil() } else { - yy406 := *x.UniqueLabelKey - yym407 := z.EncBinary() - _ = yym407 + yy25 := *x.RevisionHistoryLimit + yym26 := z.EncBinary() + _ = yym26 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(yy406)) + r.EncodeInt(int64(yy25)) } } } else { r.EncodeNil() } } else { - if yyq392[4] { - r.EncodeString(codecSelferC_UTF81234, string("uniqueLabelKey")) - if x.UniqueLabelKey == nil { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("revisionHistoryLimit")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.RevisionHistoryLimit == nil { r.EncodeNil() } else { - yy408 := *x.UniqueLabelKey - yym409 := z.EncBinary() - _ = yym409 + yy27 := *x.RevisionHistoryLimit + yym28 := z.EncBinary() + _ = yym28 if false { } else { - r.EncodeString(codecSelferC_UTF81234, string(yy408)) + r.EncodeInt(int64(yy27)) } } } } - if yysep392 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym30 := z.EncBinary() + _ = yym30 + if false { + } else { + r.EncodeBool(bool(x.Paused)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("paused")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym31 := z.EncBinary() + _ = yym31 + if false { + } else { + r.EncodeBool(bool(x.Paused)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + if x.RollbackTo == nil { + r.EncodeNil() + } else { + x.RollbackTo.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rollbackTo")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.RollbackTo == nil { + r.EncodeNil() + } else { + x.RollbackTo.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4496,24 +5656,25 @@ func (x *DeploymentSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym410 := z.DecBinary() - _ = yym410 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl411 := r.ReadMapStart() - if yyl411 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl411, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl411 := r.ReadArrayStart() - if yyl411 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl411, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4525,12 +5686,12 @@ func (x *DeploymentSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys412Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys412Slc - var yyhl412 bool = l >= 0 - for yyj412 := 0; ; yyj412++ { - if yyhl412 { - if yyj412 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4538,9 +5699,11 @@ func (x *DeploymentSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys412Slc = r.DecodeBytes(yys412Slc, true, true) - yys412 := string(yys412Slc) - switch yys412 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { if x.Replicas != nil { @@ -4548,197 +5711,797 @@ func (x *DeploymentSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } } else { if x.Replicas == nil { - x.Replicas = new(int) + x.Replicas = new(int32) } - yym414 := z.DecBinary() - _ = yym414 + yym5 := z.DecBinary() + _ = yym5 if false { } else { - *((*int)(x.Replicas)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Replicas)) = int32(r.DecodeInt(32)) } } case "selector": if r.TryDecodeAsNil() { - x.Selector = nil - } else { - yyv415 := &x.Selector - yym416 := z.DecBinary() - _ = yym416 - if false { - } else { - z.F.DecMapStringStringX(yyv415, false, d) + if x.Selector != nil { + x.Selector = nil } + } else { + if x.Selector == nil { + x.Selector = new(LabelSelector) + } + x.Selector.CodecDecodeSelf(d) } case "template": if r.TryDecodeAsNil() { - if x.Template != nil { - x.Template = nil - } + x.Template = pkg2_v1.PodTemplateSpec{} } else { - if x.Template == nil { - x.Template = new(pkg2_v1.PodTemplateSpec) - } - x.Template.CodecDecodeSelf(d) + yyv7 := &x.Template + yyv7.CodecDecodeSelf(d) } case "strategy": if r.TryDecodeAsNil() { x.Strategy = DeploymentStrategy{} } else { - yyv418 := &x.Strategy - yyv418.CodecDecodeSelf(d) + yyv8 := &x.Strategy + yyv8.CodecDecodeSelf(d) } - case "uniqueLabelKey": + case "minReadySeconds": if r.TryDecodeAsNil() { - if x.UniqueLabelKey != nil { - x.UniqueLabelKey = nil + x.MinReadySeconds = 0 + } else { + x.MinReadySeconds = int32(r.DecodeInt(32)) + } + case "revisionHistoryLimit": + if r.TryDecodeAsNil() { + if x.RevisionHistoryLimit != nil { + x.RevisionHistoryLimit = nil } } else { - if x.UniqueLabelKey == nil { - x.UniqueLabelKey = new(string) + if x.RevisionHistoryLimit == nil { + x.RevisionHistoryLimit = new(int32) } - yym420 := z.DecBinary() - _ = yym420 + yym11 := z.DecBinary() + _ = yym11 if false { } else { - *((*string)(x.UniqueLabelKey)) = r.DecodeString() + *((*int32)(x.RevisionHistoryLimit)) = int32(r.DecodeInt(32)) } } + case "paused": + if r.TryDecodeAsNil() { + x.Paused = false + } else { + x.Paused = bool(r.DecodeBool()) + } + case "rollbackTo": + if r.TryDecodeAsNil() { + if x.RollbackTo != nil { + x.RollbackTo = nil + } + } else { + if x.RollbackTo == nil { + x.RollbackTo = new(RollbackConfig) + } + x.RollbackTo.CodecDecodeSelf(d) + } default: - z.DecStructFieldNotFound(-1, yys412) - } // end switch yys412 - } // end for yyj412 - if !yyhl412 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeploymentSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj421 int - var yyb421 bool - var yyhl421 bool = l >= 0 - yyj421++ - if yyhl421 { - yyb421 = yyj421 > l + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb421 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb421 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Replicas != nil { x.Replicas = nil } } else { if x.Replicas == nil { - x.Replicas = new(int) + x.Replicas = new(int32) } - yym423 := z.DecBinary() - _ = yym423 + yym16 := z.DecBinary() + _ = yym16 if false { } else { - *((*int)(x.Replicas)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Replicas)) = int32(r.DecodeInt(32)) } } - yyj421++ - if yyhl421 { - yyb421 = yyj421 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb421 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb421 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Selector = nil - } else { - yyv424 := &x.Selector - yym425 := z.DecBinary() - _ = yym425 - if false { - } else { - z.F.DecMapStringStringX(yyv424, false, d) + if x.Selector != nil { + x.Selector = nil } - } - yyj421++ - if yyhl421 { - yyb421 = yyj421 > l } else { - yyb421 = r.CheckBreak() + if x.Selector == nil { + x.Selector = new(LabelSelector) + } + x.Selector.CodecDecodeSelf(d) } - if yyb421 { - r.ReadEnd() + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - if x.Template != nil { - x.Template = nil - } + x.Template = pkg2_v1.PodTemplateSpec{} } else { - if x.Template == nil { - x.Template = new(pkg2_v1.PodTemplateSpec) - } - x.Template.CodecDecodeSelf(d) + yyv18 := &x.Template + yyv18.CodecDecodeSelf(d) } - yyj421++ - if yyhl421 { - yyb421 = yyj421 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb421 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb421 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Strategy = DeploymentStrategy{} } else { - yyv427 := &x.Strategy - yyv427.CodecDecodeSelf(d) + yyv19 := &x.Strategy + yyv19.CodecDecodeSelf(d) } - yyj421++ - if yyhl421 { - yyb421 = yyj421 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb421 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb421 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - if x.UniqueLabelKey != nil { - x.UniqueLabelKey = nil + x.MinReadySeconds = 0 + } else { + x.MinReadySeconds = int32(r.DecodeInt(32)) + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.RevisionHistoryLimit != nil { + x.RevisionHistoryLimit = nil } } else { - if x.UniqueLabelKey == nil { - x.UniqueLabelKey = new(string) + if x.RevisionHistoryLimit == nil { + x.RevisionHistoryLimit = new(int32) } - yym429 := z.DecBinary() - _ = yym429 + yym22 := z.DecBinary() + _ = yym22 if false { } else { - *((*string)(x.UniqueLabelKey)) = r.DecodeString() + *((*int32)(x.RevisionHistoryLimit)) = int32(r.DecodeInt(32)) } } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Paused = false + } else { + x.Paused = bool(r.DecodeBool()) + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.RollbackTo != nil { + x.RollbackTo = nil + } + } else { + if x.RollbackTo == nil { + x.RollbackTo = new(RollbackConfig) + } + x.RollbackTo.CodecDecodeSelf(d) + } for { - yyj421++ - if yyhl421 { - yyb421 = yyj421 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb421 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb421 { + if yyb14 { break } - z.DecStructFieldNotFound(yyj421-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj14-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *DeploymentRollback) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = len(x.UpdatedAnnotations) != 0 + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.UpdatedAnnotations == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + z.F.EncMapStringStringV(x.UpdatedAnnotations, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("updatedAnnotations")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.UpdatedAnnotations == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + z.F.EncMapStringStringV(x.UpdatedAnnotations, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy10 := &x.RollbackTo + yy10.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rollbackTo")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.RollbackTo + yy12.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *DeploymentRollback) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *DeploymentRollback) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + case "updatedAnnotations": + if r.TryDecodeAsNil() { + x.UpdatedAnnotations = nil + } else { + yyv5 := &x.UpdatedAnnotations + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + z.F.DecMapStringStringX(yyv5, false, d) + } + } + case "rollbackTo": + if r.TryDecodeAsNil() { + x.RollbackTo = RollbackConfig{} + } else { + yyv7 := &x.RollbackTo + yyv7.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *DeploymentRollback) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + x.Name = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.UpdatedAnnotations = nil + } else { + yyv12 := &x.UpdatedAnnotations + yym13 := z.DecBinary() + _ = yym13 + if false { + } else { + z.F.DecMapStringStringX(yyv12, false, d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RollbackTo = RollbackConfig{} + } else { + yyv14 := &x.RollbackTo + yyv14.CodecDecodeSelf(d) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *RollbackConfig) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Revision != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(1) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Revision)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("revision")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Revision)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RollbackConfig) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RollbackConfig) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "revision": + if r.TryDecodeAsNil() { + x.Revision = 0 + } else { + x.Revision = int64(r.DecodeInt(64)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RollbackConfig) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l + } else { + yyb5 = r.CheckBreak() + } + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Revision = 0 + } else { + x.Revision = int64(r.DecodeInt(64)) + } + for { + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l + } else { + yyb5 = r.CheckBreak() + } + if yyb5 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeploymentStrategy) CodecEncodeSelf(e *codec1978.Encoder) { @@ -4748,43 +6511,49 @@ func (x *DeploymentStrategy) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym430 := z.EncBinary() - _ = yym430 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep431 := !z.EncBinary() - yy2arr431 := z.EncBasicHandle().StructToArray - var yyq431 [2]bool - _, _, _ = yysep431, yyq431, yy2arr431 - const yyr431 bool = false - yyq431[0] = x.Type != "" - yyq431[1] = x.RollingUpdate != nil - if yyr431 || yy2arr431 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Type != "" + yyq2[1] = x.RollingUpdate != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn431 int = 0 - for _, b := range yyq431 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn431++ + yynn2++ } } - r.EncodeMapStart(yynn431) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr431 || yy2arr431 { - if yyq431[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { x.Type.CodecEncodeSelf(e) } else { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq431[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } } - if yyr431 || yy2arr431 { - if yyq431[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.RollingUpdate == nil { r.EncodeNil() } else { @@ -4794,8 +6563,10 @@ func (x *DeploymentStrategy) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq431[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rollingUpdate")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.RollingUpdate == nil { r.EncodeNil() } else { @@ -4803,8 +6574,10 @@ func (x *DeploymentStrategy) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep431 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -4814,24 +6587,25 @@ func (x *DeploymentStrategy) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym434 := z.DecBinary() - _ = yym434 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl435 := r.ReadMapStart() - if yyl435 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl435, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl435 := r.ReadArrayStart() - if yyl435 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl435, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -4843,12 +6617,12 @@ func (x *DeploymentStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys436Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys436Slc - var yyhl436 bool = l >= 0 - for yyj436 := 0; ; yyj436++ { - if yyhl436 { - if yyj436 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -4856,9 +6630,11 @@ func (x *DeploymentStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys436Slc = r.DecodeBytes(yys436Slc, true, true) - yys436 := string(yys436Slc) - switch yys436 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -4877,46 +6653,46 @@ func (x *DeploymentStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) x.RollingUpdate.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys436) - } // end switch yys436 - } // end for yyj436 - if !yyhl436 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeploymentStrategy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj439 int - var yyb439 bool - var yyhl439 bool = l >= 0 - yyj439++ - if yyhl439 { - yyb439 = yyj439 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb439 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb439 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = DeploymentStrategyType(r.DecodeString()) } - yyj439++ - if yyhl439 { - yyb439 = yyj439 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb439 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb439 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.RollingUpdate != nil { x.RollingUpdate = nil @@ -4928,26 +6704,27 @@ func (x *DeploymentStrategy) codecDecodeSelfFromArray(l int, d *codec1978.Decode x.RollingUpdate.CodecDecodeSelf(d) } for { - yyj439++ - if yyhl439 { - yyb439 = yyj439 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb439 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb439 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj439-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x DeploymentStrategyType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym442 := z.EncBinary() - _ = yym442 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -4959,8 +6736,8 @@ func (x *DeploymentStrategyType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym443 := z.DecBinary() - _ = yym443 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -4975,40 +6752,42 @@ func (x *RollingUpdateDeployment) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym444 := z.EncBinary() - _ = yym444 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep445 := !z.EncBinary() - yy2arr445 := z.EncBasicHandle().StructToArray - var yyq445 [3]bool - _, _, _ = yysep445, yyq445, yy2arr445 - const yyr445 bool = false - yyq445[0] = x.MaxUnavailable != nil - yyq445[1] = x.MaxSurge != nil - yyq445[2] = x.MinReadySeconds != 0 - if yyr445 || yy2arr445 { - r.EncodeArrayStart(3) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.MaxUnavailable != nil + yyq2[1] = x.MaxSurge != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) } else { - var yynn445 int = 0 - for _, b := range yyq445 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn445++ + yynn2++ } } - r.EncodeMapStart(yynn445) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr445 || yy2arr445 { - if yyq445[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.MaxUnavailable == nil { r.EncodeNil() } else { - yym447 := z.EncBinary() - _ = yym447 + yym4 := z.EncBinary() + _ = yym4 if false { } else if z.HasExtensions() && z.EncExt(x.MaxUnavailable) { - } else if !yym447 && z.IsJSONHandle() { + } else if !yym4 && z.IsJSONHandle() { z.EncJSONMarshal(x.MaxUnavailable) } else { z.EncFallback(x.MaxUnavailable) @@ -5018,16 +6797,18 @@ func (x *RollingUpdateDeployment) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq445[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxUnavailable")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.MaxUnavailable == nil { r.EncodeNil() } else { - yym448 := z.EncBinary() - _ = yym448 + yym5 := z.EncBinary() + _ = yym5 if false { } else if z.HasExtensions() && z.EncExt(x.MaxUnavailable) { - } else if !yym448 && z.IsJSONHandle() { + } else if !yym5 && z.IsJSONHandle() { z.EncJSONMarshal(x.MaxUnavailable) } else { z.EncFallback(x.MaxUnavailable) @@ -5035,16 +6816,17 @@ func (x *RollingUpdateDeployment) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr445 || yy2arr445 { - if yyq445[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.MaxSurge == nil { r.EncodeNil() } else { - yym450 := z.EncBinary() - _ = yym450 + yym7 := z.EncBinary() + _ = yym7 if false { } else if z.HasExtensions() && z.EncExt(x.MaxSurge) { - } else if !yym450 && z.IsJSONHandle() { + } else if !yym7 && z.IsJSONHandle() { z.EncJSONMarshal(x.MaxSurge) } else { z.EncFallback(x.MaxSurge) @@ -5054,16 +6836,18 @@ func (x *RollingUpdateDeployment) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq445[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxSurge")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.MaxSurge == nil { r.EncodeNil() } else { - yym451 := z.EncBinary() - _ = yym451 + yym8 := z.EncBinary() + _ = yym8 if false { } else if z.HasExtensions() && z.EncExt(x.MaxSurge) { - } else if !yym451 && z.IsJSONHandle() { + } else if !yym8 && z.IsJSONHandle() { z.EncJSONMarshal(x.MaxSurge) } else { z.EncFallback(x.MaxSurge) @@ -5071,30 +6855,10 @@ func (x *RollingUpdateDeployment) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr445 || yy2arr445 { - if yyq445[2] { - yym453 := z.EncBinary() - _ = yym453 - if false { - } else { - r.EncodeInt(int64(x.MinReadySeconds)) - } - } else { - r.EncodeInt(0) - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } else { - if yyq445[2] { - r.EncodeString(codecSelferC_UTF81234, string("minReadySeconds")) - yym454 := z.EncBinary() - _ = yym454 - if false { - } else { - r.EncodeInt(int64(x.MinReadySeconds)) - } - } - } - if yysep445 { - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5104,24 +6868,25 @@ func (x *RollingUpdateDeployment) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym455 := z.DecBinary() - _ = yym455 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl456 := r.ReadMapStart() - if yyl456 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl456, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl456 := r.ReadArrayStart() - if yyl456 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl456, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5133,12 +6898,12 @@ func (x *RollingUpdateDeployment) codecDecodeSelfFromMap(l int, d *codec1978.Dec var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys457Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys457Slc - var yyhl457 bool = l >= 0 - for yyj457 := 0; ; yyj457++ { - if yyhl457 { - if yyj457 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5146,9 +6911,11 @@ func (x *RollingUpdateDeployment) codecDecodeSelfFromMap(l int, d *codec1978.Dec break } } - yys457Slc = r.DecodeBytes(yys457Slc, true, true) - yys457 := string(yys457Slc) - switch yys457 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "maxUnavailable": if r.TryDecodeAsNil() { if x.MaxUnavailable != nil { @@ -5156,13 +6923,13 @@ func (x *RollingUpdateDeployment) codecDecodeSelfFromMap(l int, d *codec1978.Dec } } else { if x.MaxUnavailable == nil { - x.MaxUnavailable = new(pkg6_util.IntOrString) + x.MaxUnavailable = new(pkg6_intstr.IntOrString) } - yym459 := z.DecBinary() - _ = yym459 + yym5 := z.DecBinary() + _ = yym5 if false { } else if z.HasExtensions() && z.DecExt(x.MaxUnavailable) { - } else if !yym459 && z.IsJSONHandle() { + } else if !yym5 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.MaxUnavailable) } else { z.DecFallback(x.MaxUnavailable, false) @@ -5175,124 +6942,104 @@ func (x *RollingUpdateDeployment) codecDecodeSelfFromMap(l int, d *codec1978.Dec } } else { if x.MaxSurge == nil { - x.MaxSurge = new(pkg6_util.IntOrString) + x.MaxSurge = new(pkg6_intstr.IntOrString) } - yym461 := z.DecBinary() - _ = yym461 + yym7 := z.DecBinary() + _ = yym7 if false { } else if z.HasExtensions() && z.DecExt(x.MaxSurge) { - } else if !yym461 && z.IsJSONHandle() { + } else if !yym7 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.MaxSurge) } else { z.DecFallback(x.MaxSurge, false) } } - case "minReadySeconds": - if r.TryDecodeAsNil() { - x.MinReadySeconds = 0 - } else { - x.MinReadySeconds = int(r.DecodeInt(codecSelferBitsize1234)) - } default: - z.DecStructFieldNotFound(-1, yys457) - } // end switch yys457 - } // end for yyj457 - if !yyhl457 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *RollingUpdateDeployment) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj463 int - var yyb463 bool - var yyhl463 bool = l >= 0 - yyj463++ - if yyhl463 { - yyb463 = yyj463 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb463 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb463 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.MaxUnavailable != nil { x.MaxUnavailable = nil } } else { if x.MaxUnavailable == nil { - x.MaxUnavailable = new(pkg6_util.IntOrString) + x.MaxUnavailable = new(pkg6_intstr.IntOrString) } - yym465 := z.DecBinary() - _ = yym465 + yym10 := z.DecBinary() + _ = yym10 if false { } else if z.HasExtensions() && z.DecExt(x.MaxUnavailable) { - } else if !yym465 && z.IsJSONHandle() { + } else if !yym10 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.MaxUnavailable) } else { z.DecFallback(x.MaxUnavailable, false) } } - yyj463++ - if yyhl463 { - yyb463 = yyj463 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb463 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb463 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.MaxSurge != nil { x.MaxSurge = nil } } else { if x.MaxSurge == nil { - x.MaxSurge = new(pkg6_util.IntOrString) + x.MaxSurge = new(pkg6_intstr.IntOrString) } - yym467 := z.DecBinary() - _ = yym467 + yym12 := z.DecBinary() + _ = yym12 if false { } else if z.HasExtensions() && z.DecExt(x.MaxSurge) { - } else if !yym467 && z.IsJSONHandle() { + } else if !yym12 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.MaxSurge) } else { z.DecFallback(x.MaxSurge, false) } } - yyj463++ - if yyhl463 { - yyb463 = yyj463 > l - } else { - yyb463 = r.CheckBreak() - } - if yyb463 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.MinReadySeconds = 0 - } else { - x.MinReadySeconds = int(r.DecodeInt(codecSelferBitsize1234)) - } for { - yyj463++ - if yyhl463 { - yyb463 = yyj463 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb463 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb463 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj463-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeploymentStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5302,33 +7049,38 @@ func (x *DeploymentStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym469 := z.EncBinary() - _ = yym469 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep470 := !z.EncBinary() - yy2arr470 := z.EncBasicHandle().StructToArray - var yyq470 [2]bool - _, _, _ = yysep470, yyq470, yy2arr470 - const yyr470 bool = false - yyq470[0] = x.Replicas != 0 - yyq470[1] = x.UpdatedReplicas != 0 - if yyr470 || yy2arr470 { - r.EncodeArrayStart(2) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Replicas != 0 + yyq2[1] = x.UpdatedReplicas != 0 + yyq2[2] = x.AvailableReplicas != 0 + yyq2[3] = x.UnavailableReplicas != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) } else { - var yynn470 int = 0 - for _, b := range yyq470 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn470++ + yynn2++ } } - r.EncodeMapStart(yynn470) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr470 || yy2arr470 { - if yyq470[0] { - yym472 := z.EncBinary() - _ = yym472 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.Replicas)) @@ -5337,20 +7089,23 @@ func (x *DeploymentStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq470[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("replicas")) - yym473 := z.EncBinary() - _ = yym473 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.Replicas)) } } } - if yyr470 || yy2arr470 { - if yyq470[1] { - yym475 := z.EncBinary() - _ = yym475 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.UpdatedReplicas)) @@ -5359,18 +7114,72 @@ func (x *DeploymentStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq470[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("updatedReplicas")) - yym476 := z.EncBinary() - _ = yym476 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.UpdatedReplicas)) } } } - if yysep470 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeInt(int64(x.AvailableReplicas)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("availableReplicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeInt(int64(x.AvailableReplicas)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeInt(int64(x.UnavailableReplicas)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("unavailableReplicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeInt(int64(x.UnavailableReplicas)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5380,24 +7189,25 @@ func (x *DeploymentStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym477 := z.DecBinary() - _ = yym477 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl478 := r.ReadMapStart() - if yyl478 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl478, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl478 := r.ReadArrayStart() - if yyl478 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl478, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5409,12 +7219,12 @@ func (x *DeploymentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys479Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys479Slc - var yyhl479 bool = l >= 0 - for yyj479 := 0; ; yyj479++ { - if yyhl479 { - if yyj479 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5422,80 +7232,127 @@ func (x *DeploymentStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys479Slc = r.DecodeBytes(yys479Slc, true, true) - yys479 := string(yys479Slc) - switch yys479 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "replicas": if r.TryDecodeAsNil() { x.Replicas = 0 } else { - x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.Replicas = int32(r.DecodeInt(32)) } case "updatedReplicas": if r.TryDecodeAsNil() { x.UpdatedReplicas = 0 } else { - x.UpdatedReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.UpdatedReplicas = int32(r.DecodeInt(32)) + } + case "availableReplicas": + if r.TryDecodeAsNil() { + x.AvailableReplicas = 0 + } else { + x.AvailableReplicas = int32(r.DecodeInt(32)) + } + case "unavailableReplicas": + if r.TryDecodeAsNil() { + x.UnavailableReplicas = 0 + } else { + x.UnavailableReplicas = int32(r.DecodeInt(32)) } default: - z.DecStructFieldNotFound(-1, yys479) - } // end switch yys479 - } // end for yyj479 - if !yyhl479 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeploymentStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj482 int - var yyb482 bool - var yyhl482 bool = l >= 0 - yyj482++ - if yyhl482 { - yyb482 = yyj482 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb482 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb482 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Replicas = 0 } else { - x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.Replicas = int32(r.DecodeInt(32)) } - yyj482++ - if yyhl482 { - yyb482 = yyj482 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb482 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb482 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.UpdatedReplicas = 0 } else { - x.UpdatedReplicas = int(r.DecodeInt(codecSelferBitsize1234)) + x.UpdatedReplicas = int32(r.DecodeInt(32)) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.AvailableReplicas = 0 + } else { + x.AvailableReplicas = int32(r.DecodeInt(32)) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.UnavailableReplicas = 0 + } else { + x.UnavailableReplicas = int32(r.DecodeInt(32)) } for { - yyj482++ - if yyhl482 { - yyb482 = yyj482 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb482 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb482 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj482-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DeploymentList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5505,126 +7362,142 @@ func (x *DeploymentList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym485 := z.EncBinary() - _ = yym485 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep486 := !z.EncBinary() - yy2arr486 := z.EncBasicHandle().StructToArray - var yyq486 [4]bool - _, _, _ = yysep486, yyq486, yy2arr486 - const yyr486 bool = false - yyq486[0] = x.Kind != "" - yyq486[1] = x.APIVersion != "" - yyq486[2] = true - if yyr486 || yy2arr486 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn486 int = 1 - for _, b := range yyq486 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn486++ + yynn2++ } } - r.EncodeMapStart(yynn486) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr486 || yy2arr486 { - if yyq486[0] { - yym488 := z.EncBinary() - _ = yym488 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq486[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym489 := z.EncBinary() - _ = yym489 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr486 || yy2arr486 { - if yyq486[1] { - yym491 := z.EncBinary() - _ = yym491 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq486[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym492 := z.EncBinary() - _ = yym492 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr486 || yy2arr486 { - if yyq486[2] { - yy494 := &x.ListMeta - yym495 := z.EncBinary() - _ = yym495 - if false { - } else if z.HasExtensions() && z.EncExt(yy494) { - } else { - z.EncFallback(yy494) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq486[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy496 := &x.ListMeta - yym497 := z.EncBinary() - _ = yym497 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy496) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy496) + z.EncFallback(yy6) } } } - if yyr486 || yy2arr486 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym499 := z.EncBinary() - _ = yym499 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceDeployment(([]Deployment)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym500 := z.EncBinary() - _ = yym500 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceDeployment(([]Deployment)(x.Items), e) } } } - if yysep486 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5634,24 +7507,25 @@ func (x *DeploymentList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym501 := z.DecBinary() - _ = yym501 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl502 := r.ReadMapStart() - if yyl502 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl502, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl502 := r.ReadArrayStart() - if yyl502 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl502, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5663,12 +7537,12 @@ func (x *DeploymentList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys503Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys503Slc - var yyhl503 bool = l >= 0 - for yyj503 := 0; ; yyj503++ { - if yyhl503 { - if yyj503 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5676,9 +7550,36 @@ func (x *DeploymentList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys503Slc = r.DecodeBytes(yys503Slc, true, true) - yys503 := string(yys503Slc) - switch yys503 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceDeployment((*[]Deployment)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -5691,133 +7592,111 @@ func (x *DeploymentList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv506 := &x.ListMeta - yym507 := z.DecBinary() - _ = yym507 - if false { - } else if z.HasExtensions() && z.DecExt(yyv506) { - } else { - z.DecFallback(yyv506, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv508 := &x.Items - yym509 := z.DecBinary() - _ = yym509 - if false { - } else { - h.decSliceDeployment((*[]Deployment)(yyv508), d) - } - } default: - z.DecStructFieldNotFound(-1, yys503) - } // end switch yys503 - } // end for yyj503 - if !yyhl503 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DeploymentList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj510 int - var yyb510 bool - var yyhl510 bool = l >= 0 - yyj510++ - if yyhl510 { - yyb510 = yyj510 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb510 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb510 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceDeployment((*[]Deployment)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj510++ - if yyhl510 { - yyb510 = yyj510 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb510 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb510 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj510++ - if yyhl510 { - yyb510 = yyj510 > l - } else { - yyb510 = r.CheckBreak() - } - if yyb510 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv513 := &x.ListMeta - yym514 := z.DecBinary() - _ = yym514 - if false { - } else if z.HasExtensions() && z.DecExt(yyv513) { - } else { - z.DecFallback(yyv513, false) - } - } - yyj510++ - if yyhl510 { - yyb510 = yyj510 > l - } else { - yyb510 = r.CheckBreak() - } - if yyb510 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv515 := &x.Items - yym516 := z.DecBinary() - _ = yym516 - if false { - } else { - h.decSliceDeployment((*[]Deployment)(yyv515), d) - } - } for { - yyj510++ - if yyhl510 { - yyb510 = yyj510 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb510 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb510 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj510-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonSetSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -5827,81 +7706,68 @@ func (x *DaemonSetSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym517 := z.EncBinary() - _ = yym517 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep518 := !z.EncBinary() - yy2arr518 := z.EncBasicHandle().StructToArray - var yyq518 [2]bool - _, _, _ = yysep518, yyq518, yy2arr518 - const yyr518 bool = false - yyq518[0] = len(x.Selector) != 0 - yyq518[1] = x.Template != nil - if yyr518 || yy2arr518 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Selector != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn518 int = 0 - for _, b := range yyq518 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn518++ + yynn2++ } } - r.EncodeMapStart(yynn518) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr518 || yy2arr518 { - if yyq518[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Selector == nil { r.EncodeNil() } else { - yym520 := z.EncBinary() - _ = yym520 - if false { - } else { - z.F.EncMapStringStringV(x.Selector, false, e) - } + x.Selector.CodecEncodeSelf(e) } } else { r.EncodeNil() } } else { - if yyq518[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { - yym521 := z.EncBinary() - _ = yym521 - if false { - } else { - z.F.EncMapStringStringV(x.Selector, false, e) - } + x.Selector.CodecEncodeSelf(e) } } } - if yyr518 || yy2arr518 { - if yyq518[1] { - if x.Template == nil { - r.EncodeNil() - } else { - x.Template.CodecEncodeSelf(e) - } - } else { - r.EncodeNil() - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.Template + yy7.CodecEncodeSelf(e) } else { - if yyq518[1] { - r.EncodeString(codecSelferC_UTF81234, string("template")) - if x.Template == nil { - r.EncodeNil() - } else { - x.Template.CodecEncodeSelf(e) - } - } + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("template")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Template + yy9.CodecEncodeSelf(e) } - if yysep518 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -5911,24 +7777,25 @@ func (x *DaemonSetSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym523 := z.DecBinary() - _ = yym523 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl524 := r.ReadMapStart() - if yyl524 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl524, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl524 := r.ReadArrayStart() - if yyl524 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl524, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -5940,12 +7807,12 @@ func (x *DaemonSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys525Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys525Slc - var yyhl525 bool = l >= 0 - for yyj525 := 0; ; yyj525++ { - if yyhl525 { - if yyj525 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -5953,102 +7820,95 @@ func (x *DaemonSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys525Slc = r.DecodeBytes(yys525Slc, true, true) - yys525 := string(yys525Slc) - switch yys525 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "selector": if r.TryDecodeAsNil() { - x.Selector = nil - } else { - yyv526 := &x.Selector - yym527 := z.DecBinary() - _ = yym527 - if false { - } else { - z.F.DecMapStringStringX(yyv526, false, d) + if x.Selector != nil { + x.Selector = nil } + } else { + if x.Selector == nil { + x.Selector = new(LabelSelector) + } + x.Selector.CodecDecodeSelf(d) } case "template": if r.TryDecodeAsNil() { - if x.Template != nil { - x.Template = nil - } + x.Template = pkg2_v1.PodTemplateSpec{} } else { - if x.Template == nil { - x.Template = new(pkg2_v1.PodTemplateSpec) - } - x.Template.CodecDecodeSelf(d) + yyv5 := &x.Template + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys525) - } // end switch yys525 - } // end for yyj525 - if !yyhl525 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj529 int - var yyb529 bool - var yyhl529 bool = l >= 0 - yyj529++ - if yyhl529 { - yyb529 = yyj529 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb529 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb529 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Selector = nil - } else { - yyv530 := &x.Selector - yym531 := z.DecBinary() - _ = yym531 - if false { - } else { - z.F.DecMapStringStringX(yyv530, false, d) + if x.Selector != nil { + x.Selector = nil } - } - yyj529++ - if yyhl529 { - yyb529 = yyj529 > l } else { - yyb529 = r.CheckBreak() + if x.Selector == nil { + x.Selector = new(LabelSelector) + } + x.Selector.CodecDecodeSelf(d) } - if yyb529 { - r.ReadEnd() + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - if x.Template != nil { - x.Template = nil - } + x.Template = pkg2_v1.PodTemplateSpec{} } else { - if x.Template == nil { - x.Template = new(pkg2_v1.PodTemplateSpec) - } - x.Template.CodecDecodeSelf(d) + yyv8 := &x.Template + yyv8.CodecDecodeSelf(d) } for { - yyj529++ - if yyhl529 { - yyb529 = yyj529 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb529 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb529 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj529-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonSetStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6058,77 +7918,90 @@ func (x *DaemonSetStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym533 := z.EncBinary() - _ = yym533 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep534 := !z.EncBinary() - yy2arr534 := z.EncBasicHandle().StructToArray - var yyq534 [3]bool - _, _, _ = yysep534, yyq534, yy2arr534 - const yyr534 bool = false - if yyr534 || yy2arr534 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn534 int = 3 - for _, b := range yyq534 { + yynn2 = 3 + for _, b := range yyq2 { if b { - yynn534++ + yynn2++ } } - r.EncodeMapStart(yynn534) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr534 || yy2arr534 { - yym536 := z.EncBinary() - _ = yym536 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.CurrentNumberScheduled)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("currentNumberScheduled")) - yym537 := z.EncBinary() - _ = yym537 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.CurrentNumberScheduled)) } } - if yyr534 || yy2arr534 { - yym539 := z.EncBinary() - _ = yym539 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.NumberMisscheduled)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("numberMisscheduled")) - yym540 := z.EncBinary() - _ = yym540 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.NumberMisscheduled)) } } - if yyr534 || yy2arr534 { - yym542 := z.EncBinary() - _ = yym542 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.DesiredNumberScheduled)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("desiredNumberScheduled")) - yym543 := z.EncBinary() - _ = yym543 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 if false { } else { r.EncodeInt(int64(x.DesiredNumberScheduled)) } } - if yysep534 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6138,24 +8011,25 @@ func (x *DaemonSetStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym544 := z.DecBinary() - _ = yym544 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl545 := r.ReadMapStart() - if yyl545 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl545, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl545 := r.ReadArrayStart() - if yyl545 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl545, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6167,12 +8041,12 @@ func (x *DaemonSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys546Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys546Slc - var yyhl546 bool = l >= 0 - for yyj546 := 0; ; yyj546++ { - if yyhl546 { - if yyj546 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6180,101 +8054,105 @@ func (x *DaemonSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys546Slc = r.DecodeBytes(yys546Slc, true, true) - yys546 := string(yys546Slc) - switch yys546 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "currentNumberScheduled": if r.TryDecodeAsNil() { x.CurrentNumberScheduled = 0 } else { - x.CurrentNumberScheduled = int(r.DecodeInt(codecSelferBitsize1234)) + x.CurrentNumberScheduled = int32(r.DecodeInt(32)) } case "numberMisscheduled": if r.TryDecodeAsNil() { x.NumberMisscheduled = 0 } else { - x.NumberMisscheduled = int(r.DecodeInt(codecSelferBitsize1234)) + x.NumberMisscheduled = int32(r.DecodeInt(32)) } case "desiredNumberScheduled": if r.TryDecodeAsNil() { x.DesiredNumberScheduled = 0 } else { - x.DesiredNumberScheduled = int(r.DecodeInt(codecSelferBitsize1234)) + x.DesiredNumberScheduled = int32(r.DecodeInt(32)) } default: - z.DecStructFieldNotFound(-1, yys546) - } // end switch yys546 - } // end for yyj546 - if !yyhl546 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj550 int - var yyb550 bool - var yyhl550 bool = l >= 0 - yyj550++ - if yyhl550 { - yyb550 = yyj550 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb550 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb550 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.CurrentNumberScheduled = 0 } else { - x.CurrentNumberScheduled = int(r.DecodeInt(codecSelferBitsize1234)) + x.CurrentNumberScheduled = int32(r.DecodeInt(32)) } - yyj550++ - if yyhl550 { - yyb550 = yyj550 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb550 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb550 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.NumberMisscheduled = 0 } else { - x.NumberMisscheduled = int(r.DecodeInt(codecSelferBitsize1234)) + x.NumberMisscheduled = int32(r.DecodeInt(32)) } - yyj550++ - if yyhl550 { - yyb550 = yyj550 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb550 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb550 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.DesiredNumberScheduled = 0 } else { - x.DesiredNumberScheduled = int(r.DecodeInt(codecSelferBitsize1234)) + x.DesiredNumberScheduled = int32(r.DecodeInt(32)) } for { - yyj550++ - if yyhl550 { - yyb550 = yyj550 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb550 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb550 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj550-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonSet) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6284,120 +8162,139 @@ func (x *DaemonSet) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym554 := z.EncBinary() - _ = yym554 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep555 := !z.EncBinary() - yy2arr555 := z.EncBasicHandle().StructToArray - var yyq555 [5]bool - _, _, _ = yysep555, yyq555, yy2arr555 - const yyr555 bool = false - yyq555[0] = x.Kind != "" - yyq555[1] = x.APIVersion != "" - yyq555[2] = true - yyq555[3] = true - yyq555[4] = true - if yyr555 || yy2arr555 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn555 int = 0 - for _, b := range yyq555 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn555++ + yynn2++ } } - r.EncodeMapStart(yynn555) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr555 || yy2arr555 { - if yyq555[0] { - yym557 := z.EncBinary() - _ = yym557 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq555[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym558 := z.EncBinary() - _ = yym558 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr555 || yy2arr555 { - if yyq555[1] { - yym560 := z.EncBinary() - _ = yym560 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq555[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym561 := z.EncBinary() - _ = yym561 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr555 || yy2arr555 { - if yyq555[2] { - yy563 := &x.ObjectMeta - yy563.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq555[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy564 := &x.ObjectMeta - yy564.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr555 || yy2arr555 { - if yyq555[3] { - yy566 := &x.Spec - yy566.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq555[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy567 := &x.Spec - yy567.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr555 || yy2arr555 { - if yyq555[4] { - yy569 := &x.Status - yy569.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq555[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy570 := &x.Status - yy570.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep555 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6407,24 +8304,25 @@ func (x *DaemonSet) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym571 := z.DecBinary() - _ = yym571 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl572 := r.ReadMapStart() - if yyl572 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl572, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl572 := r.ReadArrayStart() - if yyl572 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl572, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6436,12 +8334,12 @@ func (x *DaemonSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys573Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys573Slc - var yyhl573 bool = l >= 0 - for yyj573 := 0; ; yyj573++ { - if yyhl573 { - if yyj573 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6449,9 +8347,32 @@ func (x *DaemonSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys573Slc = r.DecodeBytes(yys573Slc, true, true) - yys573 := string(yys573Slc) - switch yys573 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = DaemonSetSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = DaemonSetStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -6464,134 +8385,117 @@ func (x *DaemonSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv576 := &x.ObjectMeta - yyv576.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = DaemonSetSpec{} - } else { - yyv577 := &x.Spec - yyv577.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = DaemonSetStatus{} - } else { - yyv578 := &x.Status - yyv578.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys573) - } // end switch yys573 - } // end for yyj573 - if !yyhl573 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj579 int - var yyb579 bool - var yyhl579 bool = l >= 0 - yyj579++ - if yyhl579 { - yyb579 = yyj579 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb579 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb579 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = DaemonSetSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = DaemonSetStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj579++ - if yyhl579 { - yyb579 = yyj579 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb579 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb579 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj579++ - if yyhl579 { - yyb579 = yyj579 > l - } else { - yyb579 = r.CheckBreak() - } - if yyb579 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv582 := &x.ObjectMeta - yyv582.CodecDecodeSelf(d) - } - yyj579++ - if yyhl579 { - yyb579 = yyj579 > l - } else { - yyb579 = r.CheckBreak() - } - if yyb579 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = DaemonSetSpec{} - } else { - yyv583 := &x.Spec - yyv583.CodecDecodeSelf(d) - } - yyj579++ - if yyhl579 { - yyb579 = yyj579 > l - } else { - yyb579 = r.CheckBreak() - } - if yyb579 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = DaemonSetStatus{} - } else { - yyv584 := &x.Status - yyv584.CodecDecodeSelf(d) - } for { - yyj579++ - if yyhl579 { - yyb579 = yyj579 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb579 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb579 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj579-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *DaemonSetList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6601,126 +8505,142 @@ func (x *DaemonSetList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym585 := z.EncBinary() - _ = yym585 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep586 := !z.EncBinary() - yy2arr586 := z.EncBasicHandle().StructToArray - var yyq586 [4]bool - _, _, _ = yysep586, yyq586, yy2arr586 - const yyr586 bool = false - yyq586[0] = x.Kind != "" - yyq586[1] = x.APIVersion != "" - yyq586[2] = true - if yyr586 || yy2arr586 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn586 int = 1 - for _, b := range yyq586 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn586++ + yynn2++ } } - r.EncodeMapStart(yynn586) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr586 || yy2arr586 { - if yyq586[0] { - yym588 := z.EncBinary() - _ = yym588 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq586[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym589 := z.EncBinary() - _ = yym589 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr586 || yy2arr586 { - if yyq586[1] { - yym591 := z.EncBinary() - _ = yym591 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq586[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym592 := z.EncBinary() - _ = yym592 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr586 || yy2arr586 { - if yyq586[2] { - yy594 := &x.ListMeta - yym595 := z.EncBinary() - _ = yym595 - if false { - } else if z.HasExtensions() && z.EncExt(yy594) { - } else { - z.EncFallback(yy594) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq586[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy596 := &x.ListMeta - yym597 := z.EncBinary() - _ = yym597 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy596) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy596) + z.EncFallback(yy6) } } } - if yyr586 || yy2arr586 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym599 := z.EncBinary() - _ = yym599 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceDaemonSet(([]DaemonSet)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym600 := z.EncBinary() - _ = yym600 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceDaemonSet(([]DaemonSet)(x.Items), e) } } } - if yysep586 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -6730,24 +8650,25 @@ func (x *DaemonSetList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym601 := z.DecBinary() - _ = yym601 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl602 := r.ReadMapStart() - if yyl602 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl602, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl602 := r.ReadArrayStart() - if yyl602 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl602, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -6759,12 +8680,12 @@ func (x *DaemonSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys603Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys603Slc - var yyhl603 bool = l >= 0 - for yyj603 := 0; ; yyj603++ { - if yyhl603 { - if yyj603 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -6772,9 +8693,36 @@ func (x *DaemonSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys603Slc = r.DecodeBytes(yys603Slc, true, true) - yys603 := string(yys603Slc) - switch yys603 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceDaemonSet((*[]DaemonSet)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -6787,133 +8735,111 @@ func (x *DaemonSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv606 := &x.ListMeta - yym607 := z.DecBinary() - _ = yym607 - if false { - } else if z.HasExtensions() && z.DecExt(yyv606) { - } else { - z.DecFallback(yyv606, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv608 := &x.Items - yym609 := z.DecBinary() - _ = yym609 - if false { - } else { - h.decSliceDaemonSet((*[]DaemonSet)(yyv608), d) - } - } default: - z.DecStructFieldNotFound(-1, yys603) - } // end switch yys603 - } // end for yyj603 - if !yyhl603 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *DaemonSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj610 int - var yyb610 bool - var yyhl610 bool = l >= 0 - yyj610++ - if yyhl610 { - yyb610 = yyj610 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb610 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb610 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceDaemonSet((*[]DaemonSet)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj610++ - if yyhl610 { - yyb610 = yyj610 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb610 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb610 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj610++ - if yyhl610 { - yyb610 = yyj610 > l - } else { - yyb610 = r.CheckBreak() - } - if yyb610 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv613 := &x.ListMeta - yym614 := z.DecBinary() - _ = yym614 - if false { - } else if z.HasExtensions() && z.DecExt(yyv613) { - } else { - z.DecFallback(yyv613, false) - } - } - yyj610++ - if yyhl610 { - yyb610 = yyj610 > l - } else { - yyb610 = r.CheckBreak() - } - if yyb610 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv615 := &x.Items - yym616 := z.DecBinary() - _ = yym616 - if false { - } else { - h.decSliceDaemonSet((*[]DaemonSet)(yyv615), d) - } - } for { - yyj610++ - if yyhl610 { - yyb610 = yyj610 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb610 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb610 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj610-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ThirdPartyResourceDataList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -6923,126 +8849,142 @@ func (x *ThirdPartyResourceDataList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym617 := z.EncBinary() - _ = yym617 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep618 := !z.EncBinary() - yy2arr618 := z.EncBasicHandle().StructToArray - var yyq618 [4]bool - _, _, _ = yysep618, yyq618, yy2arr618 - const yyr618 bool = false - yyq618[0] = x.Kind != "" - yyq618[1] = x.APIVersion != "" - yyq618[2] = true - if yyr618 || yy2arr618 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn618 int = 1 - for _, b := range yyq618 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn618++ + yynn2++ } } - r.EncodeMapStart(yynn618) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr618 || yy2arr618 { - if yyq618[0] { - yym620 := z.EncBinary() - _ = yym620 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq618[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym621 := z.EncBinary() - _ = yym621 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr618 || yy2arr618 { - if yyq618[1] { - yym623 := z.EncBinary() - _ = yym623 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq618[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym624 := z.EncBinary() - _ = yym624 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr618 || yy2arr618 { - if yyq618[2] { - yy626 := &x.ListMeta - yym627 := z.EncBinary() - _ = yym627 - if false { - } else if z.HasExtensions() && z.EncExt(yy626) { - } else { - z.EncFallback(yy626) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq618[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy628 := &x.ListMeta - yym629 := z.EncBinary() - _ = yym629 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy628) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy628) + z.EncFallback(yy6) } } } - if yyr618 || yy2arr618 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym631 := z.EncBinary() - _ = yym631 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceThirdPartyResourceData(([]ThirdPartyResourceData)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym632 := z.EncBinary() - _ = yym632 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceThirdPartyResourceData(([]ThirdPartyResourceData)(x.Items), e) } } } - if yysep618 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7052,24 +8994,25 @@ func (x *ThirdPartyResourceDataList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym633 := z.DecBinary() - _ = yym633 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl634 := r.ReadMapStart() - if yyl634 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl634, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl634 := r.ReadArrayStart() - if yyl634 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl634, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7081,12 +9024,12 @@ func (x *ThirdPartyResourceDataList) codecDecodeSelfFromMap(l int, d *codec1978. var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys635Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys635Slc - var yyhl635 bool = l >= 0 - for yyj635 := 0; ; yyj635++ { - if yyhl635 { - if yyj635 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7094,9 +9037,36 @@ func (x *ThirdPartyResourceDataList) codecDecodeSelfFromMap(l int, d *codec1978. break } } - yys635Slc = r.DecodeBytes(yys635Slc, true, true) - yys635 := string(yys635Slc) - switch yys635 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceThirdPartyResourceData((*[]ThirdPartyResourceData)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -7109,133 +9079,111 @@ func (x *ThirdPartyResourceDataList) codecDecodeSelfFromMap(l int, d *codec1978. } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv638 := &x.ListMeta - yym639 := z.DecBinary() - _ = yym639 - if false { - } else if z.HasExtensions() && z.DecExt(yyv638) { - } else { - z.DecFallback(yyv638, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv640 := &x.Items - yym641 := z.DecBinary() - _ = yym641 - if false { - } else { - h.decSliceThirdPartyResourceData((*[]ThirdPartyResourceData)(yyv640), d) - } - } default: - z.DecStructFieldNotFound(-1, yys635) - } // end switch yys635 - } // end for yyj635 - if !yyhl635 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ThirdPartyResourceDataList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj642 int - var yyb642 bool - var yyhl642 bool = l >= 0 - yyj642++ - if yyhl642 { - yyb642 = yyj642 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb642 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb642 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceThirdPartyResourceData((*[]ThirdPartyResourceData)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj642++ - if yyhl642 { - yyb642 = yyj642 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb642 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb642 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj642++ - if yyhl642 { - yyb642 = yyj642 > l - } else { - yyb642 = r.CheckBreak() - } - if yyb642 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv645 := &x.ListMeta - yym646 := z.DecBinary() - _ = yym646 - if false { - } else if z.HasExtensions() && z.DecExt(yyv645) { - } else { - z.DecFallback(yyv645, false) - } - } - yyj642++ - if yyhl642 { - yyb642 = yyj642 > l - } else { - yyb642 = r.CheckBreak() - } - if yyb642 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv647 := &x.Items - yym648 := z.DecBinary() - _ = yym648 - if false { - } else { - h.decSliceThirdPartyResourceData((*[]ThirdPartyResourceData)(yyv647), d) - } - } for { - yyj642++ - if yyhl642 { - yyb642 = yyj642 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb642 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb642 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj642-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Job) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7245,120 +9193,139 @@ func (x *Job) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym649 := z.EncBinary() - _ = yym649 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep650 := !z.EncBinary() - yy2arr650 := z.EncBasicHandle().StructToArray - var yyq650 [5]bool - _, _, _ = yysep650, yyq650, yy2arr650 - const yyr650 bool = false - yyq650[0] = x.Kind != "" - yyq650[1] = x.APIVersion != "" - yyq650[2] = true - yyq650[3] = true - yyq650[4] = true - if yyr650 || yy2arr650 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn650 int = 0 - for _, b := range yyq650 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn650++ + yynn2++ } } - r.EncodeMapStart(yynn650) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr650 || yy2arr650 { - if yyq650[0] { - yym652 := z.EncBinary() - _ = yym652 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq650[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym653 := z.EncBinary() - _ = yym653 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr650 || yy2arr650 { - if yyq650[1] { - yym655 := z.EncBinary() - _ = yym655 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq650[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym656 := z.EncBinary() - _ = yym656 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr650 || yy2arr650 { - if yyq650[2] { - yy658 := &x.ObjectMeta - yy658.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq650[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy659 := &x.ObjectMeta - yy659.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr650 || yy2arr650 { - if yyq650[3] { - yy661 := &x.Spec - yy661.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq650[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy662 := &x.Spec - yy662.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr650 || yy2arr650 { - if yyq650[4] { - yy664 := &x.Status - yy664.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq650[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy665 := &x.Status - yy665.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep650 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7368,24 +9335,25 @@ func (x *Job) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym666 := z.DecBinary() - _ = yym666 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl667 := r.ReadMapStart() - if yyl667 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl667, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl667 := r.ReadArrayStart() - if yyl667 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl667, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7397,12 +9365,12 @@ func (x *Job) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys668Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys668Slc - var yyhl668 bool = l >= 0 - for yyj668 := 0; ; yyj668++ { - if yyhl668 { - if yyj668 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7410,9 +9378,32 @@ func (x *Job) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys668Slc = r.DecodeBytes(yys668Slc, true, true) - yys668 := string(yys668Slc) - switch yys668 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = JobSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = JobStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -7425,134 +9416,117 @@ func (x *Job) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv671 := &x.ObjectMeta - yyv671.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = JobSpec{} - } else { - yyv672 := &x.Spec - yyv672.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = JobStatus{} - } else { - yyv673 := &x.Status - yyv673.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys668) - } // end switch yys668 - } // end for yyj668 - if !yyhl668 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Job) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj674 int - var yyb674 bool - var yyhl674 bool = l >= 0 - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb674 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb674 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = JobSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = JobStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb674 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb674 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l - } else { - yyb674 = r.CheckBreak() - } - if yyb674 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv677 := &x.ObjectMeta - yyv677.CodecDecodeSelf(d) - } - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l - } else { - yyb674 = r.CheckBreak() - } - if yyb674 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = JobSpec{} - } else { - yyv678 := &x.Spec - yyv678.CodecDecodeSelf(d) - } - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l - } else { - yyb674 = r.CheckBreak() - } - if yyb674 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = JobStatus{} - } else { - yyv679 := &x.Status - yyv679.CodecDecodeSelf(d) - } for { - yyj674++ - if yyhl674 { - yyb674 = yyj674 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb674 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb674 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj674-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *JobList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7562,126 +9536,142 @@ func (x *JobList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym680 := z.EncBinary() - _ = yym680 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep681 := !z.EncBinary() - yy2arr681 := z.EncBasicHandle().StructToArray - var yyq681 [4]bool - _, _, _ = yysep681, yyq681, yy2arr681 - const yyr681 bool = false - yyq681[0] = x.Kind != "" - yyq681[1] = x.APIVersion != "" - yyq681[2] = true - if yyr681 || yy2arr681 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn681 int = 1 - for _, b := range yyq681 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn681++ + yynn2++ } } - r.EncodeMapStart(yynn681) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr681 || yy2arr681 { - if yyq681[0] { - yym683 := z.EncBinary() - _ = yym683 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq681[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym684 := z.EncBinary() - _ = yym684 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr681 || yy2arr681 { - if yyq681[1] { - yym686 := z.EncBinary() - _ = yym686 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq681[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym687 := z.EncBinary() - _ = yym687 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr681 || yy2arr681 { - if yyq681[2] { - yy689 := &x.ListMeta - yym690 := z.EncBinary() - _ = yym690 - if false { - } else if z.HasExtensions() && z.EncExt(yy689) { - } else { - z.EncFallback(yy689) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq681[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy691 := &x.ListMeta - yym692 := z.EncBinary() - _ = yym692 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy691) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy691) + z.EncFallback(yy6) } } } - if yyr681 || yy2arr681 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym694 := z.EncBinary() - _ = yym694 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceJob(([]Job)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym695 := z.EncBinary() - _ = yym695 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceJob(([]Job)(x.Items), e) } } } - if yysep681 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -7691,24 +9681,25 @@ func (x *JobList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym696 := z.DecBinary() - _ = yym696 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl697 := r.ReadMapStart() - if yyl697 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl697, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl697 := r.ReadArrayStart() - if yyl697 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl697, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -7720,12 +9711,12 @@ func (x *JobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys698Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys698Slc - var yyhl698 bool = l >= 0 - for yyj698 := 0; ; yyj698++ { - if yyhl698 { - if yyj698 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -7733,9 +9724,36 @@ func (x *JobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys698Slc = r.DecodeBytes(yys698Slc, true, true) - yys698 := string(yys698Slc) - switch yys698 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceJob((*[]Job)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -7748,133 +9766,111 @@ func (x *JobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv701 := &x.ListMeta - yym702 := z.DecBinary() - _ = yym702 - if false { - } else if z.HasExtensions() && z.DecExt(yyv701) { - } else { - z.DecFallback(yyv701, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv703 := &x.Items - yym704 := z.DecBinary() - _ = yym704 - if false { - } else { - h.decSliceJob((*[]Job)(yyv703), d) - } - } default: - z.DecStructFieldNotFound(-1, yys698) - } // end switch yys698 - } // end for yyj698 - if !yyhl698 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *JobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj705 int - var yyb705 bool - var yyhl705 bool = l >= 0 - yyj705++ - if yyhl705 { - yyb705 = yyj705 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb705 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb705 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceJob((*[]Job)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj705++ - if yyhl705 { - yyb705 = yyj705 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb705 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb705 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj705++ - if yyhl705 { - yyb705 = yyj705 > l - } else { - yyb705 = r.CheckBreak() - } - if yyb705 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv708 := &x.ListMeta - yym709 := z.DecBinary() - _ = yym709 - if false { - } else if z.HasExtensions() && z.DecExt(yyv708) { - } else { - z.DecFallback(yyv708, false) - } - } - yyj705++ - if yyhl705 { - yyb705 = yyj705 > l - } else { - yyb705 = r.CheckBreak() - } - if yyb705 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv710 := &x.Items - yym711 := z.DecBinary() - _ = yym711 - if false { - } else { - h.decSliceJob((*[]Job)(yyv710), d) - } - } for { - yyj705++ - if yyhl705 { - yyb705 = yyj705 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb705 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb705 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj705-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *JobSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -7884,96 +9880,141 @@ func (x *JobSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym712 := z.EncBinary() - _ = yym712 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep713 := !z.EncBinary() - yy2arr713 := z.EncBasicHandle().StructToArray - var yyq713 [4]bool - _, _, _ = yysep713, yyq713, yy2arr713 - const yyr713 bool = false - yyq713[0] = x.Parallelism != nil - yyq713[1] = x.Completions != nil - yyq713[2] = x.Selector != nil - if yyr713 || yy2arr713 { - r.EncodeArrayStart(4) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Parallelism != nil + yyq2[1] = x.Completions != nil + yyq2[2] = x.ActiveDeadlineSeconds != nil + yyq2[3] = x.Selector != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) } else { - var yynn713 int = 1 - for _, b := range yyq713 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn713++ + yynn2++ } } - r.EncodeMapStart(yynn713) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr713 || yy2arr713 { - if yyq713[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Parallelism == nil { r.EncodeNil() } else { - yy715 := *x.Parallelism - yym716 := z.EncBinary() - _ = yym716 + yy4 := *x.Parallelism + yym5 := z.EncBinary() + _ = yym5 if false { } else { - r.EncodeInt(int64(yy715)) + r.EncodeInt(int64(yy4)) } } } else { r.EncodeNil() } } else { - if yyq713[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("parallelism")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Parallelism == nil { r.EncodeNil() } else { - yy717 := *x.Parallelism - yym718 := z.EncBinary() - _ = yym718 + yy6 := *x.Parallelism + yym7 := z.EncBinary() + _ = yym7 if false { } else { - r.EncodeInt(int64(yy717)) + r.EncodeInt(int64(yy6)) } } } } - if yyr713 || yy2arr713 { - if yyq713[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.Completions == nil { r.EncodeNil() } else { - yy720 := *x.Completions - yym721 := z.EncBinary() - _ = yym721 + yy9 := *x.Completions + yym10 := z.EncBinary() + _ = yym10 if false { } else { - r.EncodeInt(int64(yy720)) + r.EncodeInt(int64(yy9)) } } } else { r.EncodeNil() } } else { - if yyq713[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("completions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Completions == nil { r.EncodeNil() } else { - yy722 := *x.Completions - yym723 := z.EncBinary() - _ = yym723 + yy11 := *x.Completions + yym12 := z.EncBinary() + _ = yym12 if false { } else { - r.EncodeInt(int64(yy722)) + r.EncodeInt(int64(yy11)) } } } } - if yyr713 || yy2arr713 { - if yyq713[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.ActiveDeadlineSeconds == nil { + r.EncodeNil() + } else { + yy14 := *x.ActiveDeadlineSeconds + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeInt(int64(yy14)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("activeDeadlineSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ActiveDeadlineSeconds == nil { + r.EncodeNil() + } else { + yy16 := *x.ActiveDeadlineSeconds + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeInt(int64(yy16)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { if x.Selector == nil { r.EncodeNil() } else { @@ -7983,8 +10024,10 @@ func (x *JobSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq713[2] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Selector == nil { r.EncodeNil() } else { @@ -7992,16 +10035,21 @@ func (x *JobSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr713 || yy2arr713 { - yy726 := &x.Template - yy726.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy22 := &x.Template + yy22.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("template")) - yy727 := &x.Template - yy727.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy24 := &x.Template + yy24.CodecEncodeSelf(e) } - if yysep713 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8011,24 +10059,25 @@ func (x *JobSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym728 := z.DecBinary() - _ = yym728 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl729 := r.ReadMapStart() - if yyl729 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl729, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl729 := r.ReadArrayStart() - if yyl729 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl729, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8040,12 +10089,12 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys730Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys730Slc - var yyhl730 bool = l >= 0 - for yyj730 := 0; ; yyj730++ { - if yyhl730 { - if yyj730 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8053,9 +10102,11 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys730Slc = r.DecodeBytes(yys730Slc, true, true) - yys730 := string(yys730Slc) - switch yys730 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "parallelism": if r.TryDecodeAsNil() { if x.Parallelism != nil { @@ -8063,13 +10114,13 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } } else { if x.Parallelism == nil { - x.Parallelism = new(int) + x.Parallelism = new(int32) } - yym732 := z.DecBinary() - _ = yym732 + yym5 := z.DecBinary() + _ = yym5 if false { } else { - *((*int)(x.Parallelism)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Parallelism)) = int32(r.DecodeInt(32)) } } case "completions": @@ -8079,13 +10130,29 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } } else { if x.Completions == nil { - x.Completions = new(int) + x.Completions = new(int32) } - yym734 := z.DecBinary() - _ = yym734 + yym7 := z.DecBinary() + _ = yym7 if false { } else { - *((*int)(x.Completions)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Completions)) = int32(r.DecodeInt(32)) + } + } + case "activeDeadlineSeconds": + if r.TryDecodeAsNil() { + if x.ActiveDeadlineSeconds != nil { + x.ActiveDeadlineSeconds = nil + } + } else { + if x.ActiveDeadlineSeconds == nil { + x.ActiveDeadlineSeconds = new(int64) + } + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*int64)(x.ActiveDeadlineSeconds)) = int64(r.DecodeInt(64)) } } case "selector": @@ -8095,7 +10162,7 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } } else { if x.Selector == nil { - x.Selector = new(PodSelector) + x.Selector = new(LabelSelector) } x.Selector.CodecDecodeSelf(d) } @@ -8103,124 +10170,153 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Template = pkg2_v1.PodTemplateSpec{} } else { - yyv736 := &x.Template - yyv736.CodecDecodeSelf(d) + yyv11 := &x.Template + yyv11.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys730) - } // end switch yys730 - } // end for yyj730 - if !yyhl730 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *JobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj737 int - var yyb737 bool - var yyhl737 bool = l >= 0 - yyj737++ - if yyhl737 { - yyb737 = yyj737 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb737 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb737 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Parallelism != nil { x.Parallelism = nil } } else { if x.Parallelism == nil { - x.Parallelism = new(int) + x.Parallelism = new(int32) } - yym739 := z.DecBinary() - _ = yym739 + yym14 := z.DecBinary() + _ = yym14 if false { } else { - *((*int)(x.Parallelism)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Parallelism)) = int32(r.DecodeInt(32)) } } - yyj737++ - if yyhl737 { - yyb737 = yyj737 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb737 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb737 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Completions != nil { x.Completions = nil } } else { if x.Completions == nil { - x.Completions = new(int) + x.Completions = new(int32) } - yym741 := z.DecBinary() - _ = yym741 + yym16 := z.DecBinary() + _ = yym16 if false { } else { - *((*int)(x.Completions)) = int(r.DecodeInt(codecSelferBitsize1234)) + *((*int32)(x.Completions)) = int32(r.DecodeInt(32)) } } - yyj737++ - if yyhl737 { - yyb737 = yyj737 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb737 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb737 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.ActiveDeadlineSeconds != nil { + x.ActiveDeadlineSeconds = nil + } + } else { + if x.ActiveDeadlineSeconds == nil { + x.ActiveDeadlineSeconds = new(int64) + } + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*int64)(x.ActiveDeadlineSeconds)) = int64(r.DecodeInt(64)) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Selector != nil { x.Selector = nil } } else { if x.Selector == nil { - x.Selector = new(PodSelector) + x.Selector = new(LabelSelector) } x.Selector.CodecDecodeSelf(d) } - yyj737++ - if yyhl737 { - yyb737 = yyj737 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb737 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb737 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Template = pkg2_v1.PodTemplateSpec{} } else { - yyv743 := &x.Template - yyv743.CodecDecodeSelf(d) + yyv20 := &x.Template + yyv20.CodecDecodeSelf(d) } for { - yyj737++ - if yyhl737 { - yyb737 = yyj737 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb737 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb737 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj737-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -8230,40 +10326,43 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym744 := z.EncBinary() - _ = yym744 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep745 := !z.EncBinary() - yy2arr745 := z.EncBasicHandle().StructToArray - var yyq745 [6]bool - _, _, _ = yysep745, yyq745, yy2arr745 - const yyr745 bool = false - yyq745[0] = len(x.Conditions) != 0 - yyq745[1] = x.StartTime != nil - yyq745[2] = x.CompletionTime != nil - yyq745[3] = x.Active != 0 - yyq745[4] = x.Succeeded != 0 - yyq745[5] = x.Failed != 0 - if yyr745 || yy2arr745 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Conditions) != 0 + yyq2[1] = x.StartTime != nil + yyq2[2] = x.CompletionTime != nil + yyq2[3] = x.Active != 0 + yyq2[4] = x.Succeeded != 0 + yyq2[5] = x.Failed != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn745 int = 0 - for _, b := range yyq745 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn745++ + yynn2++ } } - r.EncodeMapStart(yynn745) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr745 || yy2arr745 { - if yyq745[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Conditions == nil { r.EncodeNil() } else { - yym747 := z.EncBinary() - _ = yym747 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceJobCondition(([]JobCondition)(x.Conditions), e) @@ -8273,13 +10372,15 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq745[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("conditions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Conditions == nil { r.EncodeNil() } else { - yym748 := z.EncBinary() - _ = yym748 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceJobCondition(([]JobCondition)(x.Conditions), e) @@ -8287,18 +10388,19 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr745 || yy2arr745 { - if yyq745[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.StartTime == nil { r.EncodeNil() } else { - yym750 := z.EncBinary() - _ = yym750 + yym7 := z.EncBinary() + _ = yym7 if false { } else if z.HasExtensions() && z.EncExt(x.StartTime) { - } else if yym750 { + } else if yym7 { z.EncBinaryMarshal(x.StartTime) - } else if !yym750 && z.IsJSONHandle() { + } else if !yym7 && z.IsJSONHandle() { z.EncJSONMarshal(x.StartTime) } else { z.EncFallback(x.StartTime) @@ -8308,18 +10410,20 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq745[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("startTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.StartTime == nil { r.EncodeNil() } else { - yym751 := z.EncBinary() - _ = yym751 + yym8 := z.EncBinary() + _ = yym8 if false { } else if z.HasExtensions() && z.EncExt(x.StartTime) { - } else if yym751 { + } else if yym8 { z.EncBinaryMarshal(x.StartTime) - } else if !yym751 && z.IsJSONHandle() { + } else if !yym8 && z.IsJSONHandle() { z.EncJSONMarshal(x.StartTime) } else { z.EncFallback(x.StartTime) @@ -8327,18 +10431,19 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr745 || yy2arr745 { - if yyq745[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.CompletionTime == nil { r.EncodeNil() } else { - yym753 := z.EncBinary() - _ = yym753 + yym10 := z.EncBinary() + _ = yym10 if false { } else if z.HasExtensions() && z.EncExt(x.CompletionTime) { - } else if yym753 { + } else if yym10 { z.EncBinaryMarshal(x.CompletionTime) - } else if !yym753 && z.IsJSONHandle() { + } else if !yym10 && z.IsJSONHandle() { z.EncJSONMarshal(x.CompletionTime) } else { z.EncFallback(x.CompletionTime) @@ -8348,18 +10453,20 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq745[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("completionTime")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.CompletionTime == nil { r.EncodeNil() } else { - yym754 := z.EncBinary() - _ = yym754 + yym11 := z.EncBinary() + _ = yym11 if false { } else if z.HasExtensions() && z.EncExt(x.CompletionTime) { - } else if yym754 { + } else if yym11 { z.EncBinaryMarshal(x.CompletionTime) - } else if !yym754 && z.IsJSONHandle() { + } else if !yym11 && z.IsJSONHandle() { z.EncJSONMarshal(x.CompletionTime) } else { z.EncFallback(x.CompletionTime) @@ -8367,10 +10474,11 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr745 || yy2arr745 { - if yyq745[3] { - yym756 := z.EncBinary() - _ = yym756 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 if false { } else { r.EncodeInt(int64(x.Active)) @@ -8379,20 +10487,23 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq745[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("active")) - yym757 := z.EncBinary() - _ = yym757 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 if false { } else { r.EncodeInt(int64(x.Active)) } } } - if yyr745 || yy2arr745 { - if yyq745[4] { - yym759 := z.EncBinary() - _ = yym759 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 if false { } else { r.EncodeInt(int64(x.Succeeded)) @@ -8401,20 +10512,23 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq745[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("succeeded")) - yym760 := z.EncBinary() - _ = yym760 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 if false { } else { r.EncodeInt(int64(x.Succeeded)) } } } - if yyr745 || yy2arr745 { - if yyq745[5] { - yym762 := z.EncBinary() - _ = yym762 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 if false { } else { r.EncodeInt(int64(x.Failed)) @@ -8423,18 +10537,22 @@ func (x *JobStatus) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeInt(0) } } else { - if yyq745[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("failed")) - yym763 := z.EncBinary() - _ = yym763 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeInt(int64(x.Failed)) } } } - if yysep745 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8444,24 +10562,25 @@ func (x *JobStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym764 := z.DecBinary() - _ = yym764 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl765 := r.ReadMapStart() - if yyl765 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl765, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl765 := r.ReadArrayStart() - if yyl765 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl765, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8473,12 +10592,12 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys766Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys766Slc - var yyhl766 bool = l >= 0 - for yyj766 := 0; ; yyj766++ { - if yyhl766 { - if yyj766 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8486,19 +10605,21 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys766Slc = r.DecodeBytes(yys766Slc, true, true) - yys766 := string(yys766Slc) - switch yys766 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "conditions": if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv767 := &x.Conditions - yym768 := z.DecBinary() - _ = yym768 + yyv4 := &x.Conditions + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceJobCondition((*[]JobCondition)(yyv767), d) + h.decSliceJobCondition((*[]JobCondition)(yyv4), d) } } case "startTime": @@ -8510,13 +10631,13 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.StartTime == nil { x.StartTime = new(pkg1_unversioned.Time) } - yym770 := z.DecBinary() - _ = yym770 + yym7 := z.DecBinary() + _ = yym7 if false { } else if z.HasExtensions() && z.DecExt(x.StartTime) { - } else if yym770 { + } else if yym7 { z.DecBinaryUnmarshal(x.StartTime) - } else if !yym770 && z.IsJSONHandle() { + } else if !yym7 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.StartTime) } else { z.DecFallback(x.StartTime, false) @@ -8531,13 +10652,13 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if x.CompletionTime == nil { x.CompletionTime = new(pkg1_unversioned.Time) } - yym772 := z.DecBinary() - _ = yym772 + yym9 := z.DecBinary() + _ = yym9 if false { } else if z.HasExtensions() && z.DecExt(x.CompletionTime) { - } else if yym772 { + } else if yym9 { z.DecBinaryUnmarshal(x.CompletionTime) - } else if !yym772 && z.IsJSONHandle() { + } else if !yym9 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.CompletionTime) } else { z.DecFallback(x.CompletionTime, false) @@ -8547,67 +10668,67 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Active = 0 } else { - x.Active = int(r.DecodeInt(codecSelferBitsize1234)) + x.Active = int32(r.DecodeInt(32)) } case "succeeded": if r.TryDecodeAsNil() { x.Succeeded = 0 } else { - x.Succeeded = int(r.DecodeInt(codecSelferBitsize1234)) + x.Succeeded = int32(r.DecodeInt(32)) } case "failed": if r.TryDecodeAsNil() { x.Failed = 0 } else { - x.Failed = int(r.DecodeInt(codecSelferBitsize1234)) + x.Failed = int32(r.DecodeInt(32)) } default: - z.DecStructFieldNotFound(-1, yys766) - } // end switch yys766 - } // end for yyj766 - if !yyhl766 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj776 int - var yyb776 bool - var yyhl776 bool = l >= 0 - yyj776++ - if yyhl776 { - yyb776 = yyj776 > l + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb776 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb776 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Conditions = nil } else { - yyv777 := &x.Conditions - yym778 := z.DecBinary() - _ = yym778 + yyv14 := &x.Conditions + yym15 := z.DecBinary() + _ = yym15 if false { } else { - h.decSliceJobCondition((*[]JobCondition)(yyv777), d) + h.decSliceJobCondition((*[]JobCondition)(yyv14), d) } } - yyj776++ - if yyhl776 { - yyb776 = yyj776 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb776 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb776 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.StartTime != nil { x.StartTime = nil @@ -8616,28 +10737,29 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.StartTime == nil { x.StartTime = new(pkg1_unversioned.Time) } - yym780 := z.DecBinary() - _ = yym780 + yym17 := z.DecBinary() + _ = yym17 if false { } else if z.HasExtensions() && z.DecExt(x.StartTime) { - } else if yym780 { + } else if yym17 { z.DecBinaryUnmarshal(x.StartTime) - } else if !yym780 && z.IsJSONHandle() { + } else if !yym17 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.StartTime) } else { z.DecFallback(x.StartTime, false) } } - yyj776++ - if yyhl776 { - yyb776 = yyj776 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb776 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb776 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.CompletionTime != nil { x.CompletionTime = nil @@ -8646,84 +10768,88 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if x.CompletionTime == nil { x.CompletionTime = new(pkg1_unversioned.Time) } - yym782 := z.DecBinary() - _ = yym782 + yym19 := z.DecBinary() + _ = yym19 if false { } else if z.HasExtensions() && z.DecExt(x.CompletionTime) { - } else if yym782 { + } else if yym19 { z.DecBinaryUnmarshal(x.CompletionTime) - } else if !yym782 && z.IsJSONHandle() { + } else if !yym19 && z.IsJSONHandle() { z.DecJSONUnmarshal(x.CompletionTime) } else { z.DecFallback(x.CompletionTime, false) } } - yyj776++ - if yyhl776 { - yyb776 = yyj776 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb776 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb776 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Active = 0 } else { - x.Active = int(r.DecodeInt(codecSelferBitsize1234)) + x.Active = int32(r.DecodeInt(32)) } - yyj776++ - if yyhl776 { - yyb776 = yyj776 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb776 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb776 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Succeeded = 0 } else { - x.Succeeded = int(r.DecodeInt(codecSelferBitsize1234)) + x.Succeeded = int32(r.DecodeInt(32)) } - yyj776++ - if yyhl776 { - yyb776 = yyj776 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb776 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb776 { - r.ReadEnd() + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Failed = 0 } else { - x.Failed = int(r.DecodeInt(codecSelferBitsize1234)) + x.Failed = int32(r.DecodeInt(32)) } for { - yyj776++ - if yyhl776 { - yyb776 = yyj776 > l + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l } else { - yyb776 = r.CheckBreak() + yyb13 = r.CheckBreak() } - if yyb776 { + if yyb13 { break } - z.DecStructFieldNotFound(yyj776-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x JobConditionType) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym786 := z.EncBinary() - _ = yym786 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -8735,8 +10861,8 @@ func (x *JobConditionType) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym787 := z.DecBinary() - _ = yym787 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -8751,127 +10877,132 @@ func (x *JobCondition) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym788 := z.EncBinary() - _ = yym788 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep789 := !z.EncBinary() - yy2arr789 := z.EncBasicHandle().StructToArray - var yyq789 [6]bool - _, _, _ = yysep789, yyq789, yy2arr789 - const yyr789 bool = false - yyq789[2] = true - yyq789[3] = true - yyq789[4] = x.Reason != "" - yyq789[5] = x.Message != "" - if yyr789 || yy2arr789 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [6]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = true + yyq2[3] = true + yyq2[4] = x.Reason != "" + yyq2[5] = x.Message != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(6) } else { - var yynn789 int = 2 - for _, b := range yyq789 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn789++ + yynn2++ } } - r.EncodeMapStart(yynn789) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr789 || yy2arr789 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Type.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Type.CodecEncodeSelf(e) } - if yyr789 || yy2arr789 { - yym792 := z.EncBinary() - _ = yym792 - if false { - } else if z.HasExtensions() && z.EncExt(x.Status) { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Status)) - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yysf7 := &x.Status + yysf7.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yym793 := z.EncBinary() - _ = yym793 - if false { - } else if z.HasExtensions() && z.EncExt(x.Status) { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Status)) - } + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yysf8 := &x.Status + yysf8.CodecEncodeSelf(e) } - if yyr789 || yy2arr789 { - if yyq789[2] { - yy795 := &x.LastProbeTime - yym796 := z.EncBinary() - _ = yym796 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.LastProbeTime + yym11 := z.EncBinary() + _ = yym11 if false { - } else if z.HasExtensions() && z.EncExt(yy795) { - } else if yym796 { - z.EncBinaryMarshal(yy795) - } else if !yym796 && z.IsJSONHandle() { - z.EncJSONMarshal(yy795) + } else if z.HasExtensions() && z.EncExt(yy10) { + } else if yym11 { + z.EncBinaryMarshal(yy10) + } else if !yym11 && z.IsJSONHandle() { + z.EncJSONMarshal(yy10) } else { - z.EncFallback(yy795) + z.EncFallback(yy10) } } else { r.EncodeNil() } } else { - if yyq789[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastProbeTime")) - yy797 := &x.LastProbeTime - yym798 := z.EncBinary() - _ = yym798 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.LastProbeTime + yym13 := z.EncBinary() + _ = yym13 if false { - } else if z.HasExtensions() && z.EncExt(yy797) { - } else if yym798 { - z.EncBinaryMarshal(yy797) - } else if !yym798 && z.IsJSONHandle() { - z.EncJSONMarshal(yy797) + } else if z.HasExtensions() && z.EncExt(yy12) { + } else if yym13 { + z.EncBinaryMarshal(yy12) + } else if !yym13 && z.IsJSONHandle() { + z.EncJSONMarshal(yy12) } else { - z.EncFallback(yy797) + z.EncFallback(yy12) } } } - if yyr789 || yy2arr789 { - if yyq789[3] { - yy800 := &x.LastTransitionTime - yym801 := z.EncBinary() - _ = yym801 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yy15 := &x.LastTransitionTime + yym16 := z.EncBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.EncExt(yy800) { - } else if yym801 { - z.EncBinaryMarshal(yy800) - } else if !yym801 && z.IsJSONHandle() { - z.EncJSONMarshal(yy800) + } else if z.HasExtensions() && z.EncExt(yy15) { + } else if yym16 { + z.EncBinaryMarshal(yy15) + } else if !yym16 && z.IsJSONHandle() { + z.EncJSONMarshal(yy15) } else { - z.EncFallback(yy800) + z.EncFallback(yy15) } } else { r.EncodeNil() } } else { - if yyq789[3] { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("lastTransitionTime")) - yy802 := &x.LastTransitionTime - yym803 := z.EncBinary() - _ = yym803 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy17 := &x.LastTransitionTime + yym18 := z.EncBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.EncExt(yy802) { - } else if yym803 { - z.EncBinaryMarshal(yy802) - } else if !yym803 && z.IsJSONHandle() { - z.EncJSONMarshal(yy802) + } else if z.HasExtensions() && z.EncExt(yy17) { + } else if yym18 { + z.EncBinaryMarshal(yy17) + } else if !yym18 && z.IsJSONHandle() { + z.EncJSONMarshal(yy17) } else { - z.EncFallback(yy802) + z.EncFallback(yy17) } } } - if yyr789 || yy2arr789 { - if yyq789[4] { - yym805 := z.EncBinary() - _ = yym805 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym20 := z.EncBinary() + _ = yym20 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) @@ -8880,20 +11011,23 @@ func (x *JobCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq789[4] { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("reason")) - yym806 := z.EncBinary() - _ = yym806 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym21 := z.EncBinary() + _ = yym21 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Reason)) } } } - if yyr789 || yy2arr789 { - if yyq789[5] { - yym808 := z.EncBinary() - _ = yym808 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym23 := z.EncBinary() + _ = yym23 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) @@ -8902,18 +11036,22 @@ func (x *JobCondition) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq789[5] { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("message")) - yym809 := z.EncBinary() - _ = yym809 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym24 := z.EncBinary() + _ = yym24 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Message)) } } } - if yysep789 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -8923,24 +11061,25 @@ func (x *JobCondition) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym810 := z.DecBinary() - _ = yym810 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl811 := r.ReadMapStart() - if yyl811 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl811, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl811 := r.ReadArrayStart() - if yyl811 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl811, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -8952,12 +11091,12 @@ func (x *JobCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys812Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys812Slc - var yyhl812 bool = l >= 0 - for yyj812 := 0; ; yyj812++ { - if yyhl812 { - if yyj812 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -8965,9 +11104,11 @@ func (x *JobCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys812Slc = r.DecodeBytes(yys812Slc, true, true) - yys812 := string(yys812Slc) - switch yys812 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "type": if r.TryDecodeAsNil() { x.Type = "" @@ -8984,34 +11125,34 @@ func (x *JobCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.LastProbeTime = pkg1_unversioned.Time{} } else { - yyv815 := &x.LastProbeTime - yym816 := z.DecBinary() - _ = yym816 + yyv6 := &x.LastProbeTime + yym7 := z.DecBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.DecExt(yyv815) { - } else if yym816 { - z.DecBinaryUnmarshal(yyv815) - } else if !yym816 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv815) + } else if z.HasExtensions() && z.DecExt(yyv6) { + } else if yym7 { + z.DecBinaryUnmarshal(yyv6) + } else if !yym7 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv6) } else { - z.DecFallback(yyv815, false) + z.DecFallback(yyv6, false) } } case "lastTransitionTime": if r.TryDecodeAsNil() { x.LastTransitionTime = pkg1_unversioned.Time{} } else { - yyv817 := &x.LastTransitionTime - yym818 := z.DecBinary() - _ = yym818 + yyv8 := &x.LastTransitionTime + yym9 := z.DecBinary() + _ = yym9 if false { - } else if z.HasExtensions() && z.DecExt(yyv817) { - } else if yym818 { - z.DecBinaryUnmarshal(yyv817) - } else if !yym818 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv817) + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else if yym9 { + z.DecBinaryUnmarshal(yyv8) + } else if !yym9 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv8) } else { - z.DecFallback(yyv817, false) + z.DecFallback(yyv8, false) } } case "reason": @@ -9027,146 +11168,151 @@ func (x *JobCondition) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Message = string(r.DecodeString()) } default: - z.DecStructFieldNotFound(-1, yys812) - } // end switch yys812 - } // end for yyj812 - if !yyhl812 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *JobCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj821 int - var yyb821 bool - var yyhl821 bool = l >= 0 - yyj821++ - if yyhl821 { - yyb821 = yyj821 > l + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb821 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb821 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Type = "" } else { x.Type = JobConditionType(r.DecodeString()) } - yyj821++ - if yyhl821 { - yyb821 = yyj821 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb821 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb821 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Status = "" } else { x.Status = pkg2_v1.ConditionStatus(r.DecodeString()) } - yyj821++ - if yyhl821 { - yyb821 = yyj821 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb821 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb821 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastProbeTime = pkg1_unversioned.Time{} } else { - yyv824 := &x.LastProbeTime - yym825 := z.DecBinary() - _ = yym825 + yyv15 := &x.LastProbeTime + yym16 := z.DecBinary() + _ = yym16 if false { - } else if z.HasExtensions() && z.DecExt(yyv824) { - } else if yym825 { - z.DecBinaryUnmarshal(yyv824) - } else if !yym825 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv824) + } else if z.HasExtensions() && z.DecExt(yyv15) { + } else if yym16 { + z.DecBinaryUnmarshal(yyv15) + } else if !yym16 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv15) } else { - z.DecFallback(yyv824, false) + z.DecFallback(yyv15, false) } } - yyj821++ - if yyhl821 { - yyb821 = yyj821 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb821 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb821 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LastTransitionTime = pkg1_unversioned.Time{} } else { - yyv826 := &x.LastTransitionTime - yym827 := z.DecBinary() - _ = yym827 + yyv17 := &x.LastTransitionTime + yym18 := z.DecBinary() + _ = yym18 if false { - } else if z.HasExtensions() && z.DecExt(yyv826) { - } else if yym827 { - z.DecBinaryUnmarshal(yyv826) - } else if !yym827 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv826) + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else if yym18 { + z.DecBinaryUnmarshal(yyv17) + } else if !yym18 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv17) } else { - z.DecFallback(yyv826, false) + z.DecFallback(yyv17, false) } } - yyj821++ - if yyhl821 { - yyb821 = yyj821 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb821 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb821 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Reason = "" } else { x.Reason = string(r.DecodeString()) } - yyj821++ - if yyhl821 { - yyb821 = yyj821 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb821 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb821 { - r.ReadEnd() + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Message = "" } else { x.Message = string(r.DecodeString()) } for { - yyj821++ - if yyhl821 { - yyb821 = yyj821 > l + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l } else { - yyb821 = r.CheckBreak() + yyb12 = r.CheckBreak() } - if yyb821 { + if yyb12 { break } - z.DecStructFieldNotFound(yyj821-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *Ingress) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9176,120 +11322,139 @@ func (x *Ingress) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym830 := z.EncBinary() - _ = yym830 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep831 := !z.EncBinary() - yy2arr831 := z.EncBasicHandle().StructToArray - var yyq831 [5]bool - _, _, _ = yysep831, yyq831, yy2arr831 - const yyr831 bool = false - yyq831[0] = x.Kind != "" - yyq831[1] = x.APIVersion != "" - yyq831[2] = true - yyq831[3] = true - yyq831[4] = true - if yyr831 || yy2arr831 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(5) } else { - var yynn831 int = 0 - for _, b := range yyq831 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn831++ + yynn2++ } } - r.EncodeMapStart(yynn831) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr831 || yy2arr831 { - if yyq831[0] { - yym833 := z.EncBinary() - _ = yym833 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq831[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym834 := z.EncBinary() - _ = yym834 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr831 || yy2arr831 { - if yyq831[1] { - yym836 := z.EncBinary() - _ = yym836 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq831[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym837 := z.EncBinary() - _ = yym837 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr831 || yy2arr831 { - if yyq831[2] { - yy839 := &x.ObjectMeta - yy839.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq831[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy840 := &x.ObjectMeta - yy840.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr831 || yy2arr831 { - if yyq831[3] { - yy842 := &x.Spec - yy842.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq831[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy843 := &x.Spec - yy843.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yyr831 || yy2arr831 { - if yyq831[4] { - yy845 := &x.Status - yy845.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq831[4] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("status")) - yy846 := &x.Status - yy846.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) } } - if yysep831 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9299,24 +11464,25 @@ func (x *Ingress) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym847 := z.DecBinary() - _ = yym847 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl848 := r.ReadMapStart() - if yyl848 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl848, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl848 := r.ReadArrayStart() - if yyl848 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl848, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9328,12 +11494,12 @@ func (x *Ingress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys849Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys849Slc - var yyhl849 bool = l >= 0 - for yyj849 := 0; ; yyj849++ { - if yyhl849 { - if yyj849 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9341,9 +11507,32 @@ func (x *Ingress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys849Slc = r.DecodeBytes(yys849Slc, true, true) - yys849 := string(yys849Slc) - switch yys849 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = IngressSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = IngressStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -9356,134 +11545,117 @@ func (x *Ingress) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv852 := &x.ObjectMeta - yyv852.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = IngressSpec{} - } else { - yyv853 := &x.Spec - yyv853.CodecDecodeSelf(d) - } - case "status": - if r.TryDecodeAsNil() { - x.Status = IngressStatus{} - } else { - yyv854 := &x.Status - yyv854.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys849) - } // end switch yys849 - } // end for yyj849 - if !yyhl849 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *Ingress) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj855 int - var yyb855 bool - var yyhl855 bool = l >= 0 - yyj855++ - if yyhl855 { - yyb855 = yyj855 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb855 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb855 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = IngressSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = IngressStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj855++ - if yyhl855 { - yyb855 = yyj855 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb855 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb855 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj855++ - if yyhl855 { - yyb855 = yyj855 > l - } else { - yyb855 = r.CheckBreak() - } - if yyb855 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv858 := &x.ObjectMeta - yyv858.CodecDecodeSelf(d) - } - yyj855++ - if yyhl855 { - yyb855 = yyj855 > l - } else { - yyb855 = r.CheckBreak() - } - if yyb855 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = IngressSpec{} - } else { - yyv859 := &x.Spec - yyv859.CodecDecodeSelf(d) - } - yyj855++ - if yyhl855 { - yyb855 = yyj855 > l - } else { - yyb855 = r.CheckBreak() - } - if yyb855 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Status = IngressStatus{} - } else { - yyv860 := &x.Status - yyv860.CodecDecodeSelf(d) - } for { - yyj855++ - if yyhl855 { - yyb855 = yyj855 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb855 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb855 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj855-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9493,126 +11665,142 @@ func (x *IngressList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym861 := z.EncBinary() - _ = yym861 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep862 := !z.EncBinary() - yy2arr862 := z.EncBasicHandle().StructToArray - var yyq862 [4]bool - _, _, _ = yysep862, yyq862, yy2arr862 - const yyr862 bool = false - yyq862[0] = x.Kind != "" - yyq862[1] = x.APIVersion != "" - yyq862[2] = true - if yyr862 || yy2arr862 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn862 int = 1 - for _, b := range yyq862 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn862++ + yynn2++ } } - r.EncodeMapStart(yynn862) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr862 || yy2arr862 { - if yyq862[0] { - yym864 := z.EncBinary() - _ = yym864 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq862[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym865 := z.EncBinary() - _ = yym865 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr862 || yy2arr862 { - if yyq862[1] { - yym867 := z.EncBinary() - _ = yym867 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq862[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym868 := z.EncBinary() - _ = yym868 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr862 || yy2arr862 { - if yyq862[2] { - yy870 := &x.ListMeta - yym871 := z.EncBinary() - _ = yym871 - if false { - } else if z.HasExtensions() && z.EncExt(yy870) { - } else { - z.EncFallback(yy870) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq862[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy872 := &x.ListMeta - yym873 := z.EncBinary() - _ = yym873 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy872) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy872) + z.EncFallback(yy6) } } } - if yyr862 || yy2arr862 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym875 := z.EncBinary() - _ = yym875 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceIngress(([]Ingress)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym876 := z.EncBinary() - _ = yym876 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceIngress(([]Ingress)(x.Items), e) } } } - if yysep862 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9622,24 +11810,25 @@ func (x *IngressList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym877 := z.DecBinary() - _ = yym877 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl878 := r.ReadMapStart() - if yyl878 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl878, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl878 := r.ReadArrayStart() - if yyl878 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl878, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9651,12 +11840,12 @@ func (x *IngressList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys879Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys879Slc - var yyhl879 bool = l >= 0 - for yyj879 := 0; ; yyj879++ { - if yyhl879 { - if yyj879 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9664,9 +11853,36 @@ func (x *IngressList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys879Slc = r.DecodeBytes(yys879Slc, true, true) - yys879 := string(yys879Slc) - switch yys879 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceIngress((*[]Ingress)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -9679,133 +11895,111 @@ func (x *IngressList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv882 := &x.ListMeta - yym883 := z.DecBinary() - _ = yym883 - if false { - } else if z.HasExtensions() && z.DecExt(yyv882) { - } else { - z.DecFallback(yyv882, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv884 := &x.Items - yym885 := z.DecBinary() - _ = yym885 - if false { - } else { - h.decSliceIngress((*[]Ingress)(yyv884), d) - } - } default: - z.DecStructFieldNotFound(-1, yys879) - } // end switch yys879 - } // end for yyj879 - if !yyhl879 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj886 int - var yyb886 bool - var yyhl886 bool = l >= 0 - yyj886++ - if yyhl886 { - yyb886 = yyj886 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb886 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb886 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceIngress((*[]Ingress)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj886++ - if yyhl886 { - yyb886 = yyj886 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb886 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb886 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj886++ - if yyhl886 { - yyb886 = yyj886 > l - } else { - yyb886 = r.CheckBreak() - } - if yyb886 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv889 := &x.ListMeta - yym890 := z.DecBinary() - _ = yym890 - if false { - } else if z.HasExtensions() && z.DecExt(yyv889) { - } else { - z.DecFallback(yyv889, false) - } - } - yyj886++ - if yyhl886 { - yyb886 = yyj886 > l - } else { - yyb886 = r.CheckBreak() - } - if yyb886 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv891 := &x.Items - yym892 := z.DecBinary() - _ = yym892 - if false { - } else { - h.decSliceIngress((*[]Ingress)(yyv891), d) - } - } for { - yyj886++ - if yyhl886 { - yyb886 = yyj886 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb886 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb886 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj886-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -9815,31 +12009,35 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym893 := z.EncBinary() - _ = yym893 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep894 := !z.EncBinary() - yy2arr894 := z.EncBasicHandle().StructToArray - var yyq894 [2]bool - _, _, _ = yysep894, yyq894, yy2arr894 - const yyr894 bool = false - yyq894[0] = x.Backend != nil - yyq894[1] = len(x.Rules) != 0 - if yyr894 || yy2arr894 { - r.EncodeArrayStart(2) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Backend != nil + yyq2[1] = len(x.TLS) != 0 + yyq2[2] = len(x.Rules) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) } else { - var yynn894 int = 0 - for _, b := range yyq894 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn894++ + yynn2++ } } - r.EncodeMapStart(yynn894) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr894 || yy2arr894 { - if yyq894[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.Backend == nil { r.EncodeNil() } else { @@ -9849,8 +12047,10 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq894[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("backend")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Backend == nil { r.EncodeNil() } else { @@ -9858,13 +12058,47 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yyr894 || yy2arr894 { - if yyq894[1] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.TLS == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + h.encSliceIngressTLS(([]IngressTLS)(x.TLS), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("tls")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.TLS == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + h.encSliceIngressTLS(([]IngressTLS)(x.TLS), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Rules == nil { r.EncodeNil() } else { - yym897 := z.EncBinary() - _ = yym897 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceIngressRule(([]IngressRule)(x.Rules), e) @@ -9874,13 +12108,15 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq894[1] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("rules")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Rules == nil { r.EncodeNil() } else { - yym898 := z.EncBinary() - _ = yym898 + yym11 := z.EncBinary() + _ = yym11 if false { } else { h.encSliceIngressRule(([]IngressRule)(x.Rules), e) @@ -9888,8 +12124,10 @@ func (x *IngressSpec) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep894 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -9899,24 +12137,25 @@ func (x *IngressSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym899 := z.DecBinary() - _ = yym899 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl900 := r.ReadMapStart() - if yyl900 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl900, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl900 := r.ReadArrayStart() - if yyl900 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl900, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -9928,12 +12167,12 @@ func (x *IngressSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys901Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys901Slc - var yyhl901 bool = l >= 0 - for yyj901 := 0; ; yyj901++ { - if yyhl901 { - if yyj901 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -9941,9 +12180,11 @@ func (x *IngressSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys901Slc = r.DecodeBytes(yys901Slc, true, true) - yys901 := string(yys901Slc) - switch yys901 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "backend": if r.TryDecodeAsNil() { if x.Backend != nil { @@ -9955,44 +12196,55 @@ func (x *IngressSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } x.Backend.CodecDecodeSelf(d) } + case "tls": + if r.TryDecodeAsNil() { + x.TLS = nil + } else { + yyv5 := &x.TLS + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceIngressTLS((*[]IngressTLS)(yyv5), d) + } + } case "rules": if r.TryDecodeAsNil() { x.Rules = nil } else { - yyv903 := &x.Rules - yym904 := z.DecBinary() - _ = yym904 + yyv7 := &x.Rules + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceIngressRule((*[]IngressRule)(yyv903), d) + h.decSliceIngressRule((*[]IngressRule)(yyv7), d) } } default: - z.DecStructFieldNotFound(-1, yys901) - } // end switch yys901 - } // end for yyj901 - if !yyhl901 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj905 int - var yyb905 bool - var yyhl905 bool = l >= 0 - yyj905++ - if yyhl905 { - yyb905 = yyj905 > l + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb905 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb905 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.Backend != nil { x.Backend = nil @@ -10003,40 +12255,301 @@ func (x *IngressSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Backend.CodecDecodeSelf(d) } - yyj905++ - if yyhl905 { - yyb905 = yyj905 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb905 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb905 { - r.ReadEnd() + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.TLS = nil + } else { + yyv11 := &x.TLS + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + h.decSliceIngressTLS((*[]IngressTLS)(yyv11), d) + } + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Rules = nil } else { - yyv907 := &x.Rules - yym908 := z.DecBinary() - _ = yym908 + yyv13 := &x.Rules + yym14 := z.DecBinary() + _ = yym14 if false { } else { - h.decSliceIngressRule((*[]IngressRule)(yyv907), d) + h.decSliceIngressRule((*[]IngressRule)(yyv13), d) } } for { - yyj905++ - if yyhl905 { - yyb905 = yyj905 > l + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l } else { - yyb905 = r.CheckBreak() + yyb9 = r.CheckBreak() } - if yyb905 { + if yyb9 { break } - z.DecStructFieldNotFound(yyj905-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *IngressTLS) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.Hosts) != 0 + yyq2[1] = x.SecretName != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.Hosts == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + z.F.EncSliceStringV(x.Hosts, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hosts")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Hosts == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + z.F.EncSliceStringV(x.Hosts, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretName")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.SecretName)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *IngressTLS) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *IngressTLS) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "hosts": + if r.TryDecodeAsNil() { + x.Hosts = nil + } else { + yyv4 := &x.Hosts + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + z.F.DecSliceStringX(yyv4, false, d) + } + } + case "secretName": + if r.TryDecodeAsNil() { + x.SecretName = "" + } else { + x.SecretName = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *IngressTLS) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Hosts = nil + } else { + yyv8 := &x.Hosts + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + z.F.DecSliceStringX(yyv8, false, d) + } + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SecretName = "" + } else { + x.SecretName = string(r.DecodeString()) + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressStatus) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10046,44 +12559,51 @@ func (x *IngressStatus) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym909 := z.EncBinary() - _ = yym909 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep910 := !z.EncBinary() - yy2arr910 := z.EncBasicHandle().StructToArray - var yyq910 [1]bool - _, _, _ = yysep910, yyq910, yy2arr910 - const yyr910 bool = false - yyq910[0] = true - if yyr910 || yy2arr910 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn910 int = 0 - for _, b := range yyq910 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn910++ + yynn2++ } } - r.EncodeMapStart(yynn910) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr910 || yy2arr910 { - if yyq910[0] { - yy912 := &x.LoadBalancer - yy912.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.LoadBalancer + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq910[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("loadBalancer")) - yy913 := &x.LoadBalancer - yy913.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.LoadBalancer + yy6.CodecEncodeSelf(e) } } - if yysep910 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10093,24 +12613,25 @@ func (x *IngressStatus) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym914 := z.DecBinary() - _ = yym914 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl915 := r.ReadMapStart() - if yyl915 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl915, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl915 := r.ReadArrayStart() - if yyl915 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl915, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10122,12 +12643,12 @@ func (x *IngressStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys916Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys916Slc - var yyhl916 bool = l >= 0 - for yyj916 := 0; ; yyj916++ { - if yyhl916 { - if yyj916 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10135,61 +12656,63 @@ func (x *IngressStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys916Slc = r.DecodeBytes(yys916Slc, true, true) - yys916 := string(yys916Slc) - switch yys916 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "loadBalancer": if r.TryDecodeAsNil() { x.LoadBalancer = pkg2_v1.LoadBalancerStatus{} } else { - yyv917 := &x.LoadBalancer - yyv917.CodecDecodeSelf(d) + yyv4 := &x.LoadBalancer + yyv4.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys916) - } // end switch yys916 - } // end for yyj916 - if !yyhl916 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj918 int - var yyb918 bool - var yyhl918 bool = l >= 0 - yyj918++ - if yyhl918 { - yyb918 = yyj918 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb918 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb918 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.LoadBalancer = pkg2_v1.LoadBalancerStatus{} } else { - yyv919 := &x.LoadBalancer - yyv919.CodecDecodeSelf(d) + yyv6 := &x.LoadBalancer + yyv6.CodecDecodeSelf(d) } for { - yyj918++ - if yyhl918 { - yyb918 = yyj918 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb918 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb918 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj918-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10199,33 +12722,36 @@ func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym920 := z.EncBinary() - _ = yym920 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep921 := !z.EncBinary() - yy2arr921 := z.EncBasicHandle().StructToArray - var yyq921 [2]bool - _, _, _ = yysep921, yyq921, yy2arr921 - const yyr921 bool = false - yyq921[0] = x.Host != "" - yyq921[1] = x.IngressRuleValue.HTTP != nil && x.HTTP != nil - if yyr921 || yy2arr921 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Host != "" + yyq2[1] = x.IngressRuleValue.HTTP != nil && x.HTTP != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn921 int = 0 - for _, b := range yyq921 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn921++ + yynn2++ } } - r.EncodeMapStart(yynn921) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr921 || yy2arr921 { - if yyq921[0] { - yym923 := z.EncBinary() - _ = yym923 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) @@ -10234,27 +12760,30 @@ func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq921[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("host")) - yym924 := z.EncBinary() - _ = yym924 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Host)) } } } - var yyn925 bool + var yyn6 bool if x.IngressRuleValue.HTTP == nil { - yyn925 = true - goto LABEL925 + yyn6 = true + goto LABEL6 } - LABEL925: - if yyr921 || yy2arr921 { - if yyn925 { + LABEL6: + if yyr2 || yy2arr2 { + if yyn6 { r.EncodeNil() } else { - if yyq921[1] { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { if x.HTTP == nil { r.EncodeNil() } else { @@ -10265,9 +12794,11 @@ func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { } } } else { - if yyq921[1] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("http")) - if yyn925 { + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if yyn6 { r.EncodeNil() } else { if x.HTTP == nil { @@ -10278,8 +12809,10 @@ func (x *IngressRule) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep921 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10289,24 +12822,25 @@ func (x *IngressRule) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym926 := z.DecBinary() - _ = yym926 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl927 := r.ReadMapStart() - if yyl927 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl927, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl927 := r.ReadArrayStart() - if yyl927 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl927, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10318,12 +12852,12 @@ func (x *IngressRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys928Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys928Slc - var yyhl928 bool = l >= 0 - for yyj928 := 0; ; yyj928++ { - if yyhl928 { - if yyj928 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10331,9 +12865,11 @@ func (x *IngressRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys928Slc = r.DecodeBytes(yys928Slc, true, true) - yys928 := string(yys928Slc) - switch yys928 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "host": if r.TryDecodeAsNil() { x.Host = "" @@ -10355,46 +12891,49 @@ func (x *IngressRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.HTTP.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys928) - } // end switch yys928 - } // end for yyj928 - if !yyhl928 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj931 int - var yyb931 bool - var yyhl931 bool = l >= 0 - yyj931++ - if yyhl931 { - yyb931 = yyj931 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb931 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb931 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Host = "" } else { x.Host = string(r.DecodeString()) } - yyj931++ - if yyhl931 { - yyb931 = yyj931 > l - } else { - yyb931 = r.CheckBreak() + if x.IngressRuleValue.HTTP == nil { + x.IngressRuleValue.HTTP = new(HTTPIngressRuleValue) } - if yyb931 { - r.ReadEnd() + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HTTP != nil { x.HTTP = nil @@ -10406,18 +12945,19 @@ func (x *IngressRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { x.HTTP.CodecDecodeSelf(d) } for { - yyj931++ - if yyhl931 { - yyb931 = yyj931 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb931 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb931 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj931-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10427,30 +12967,33 @@ func (x *IngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym934 := z.EncBinary() - _ = yym934 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep935 := !z.EncBinary() - yy2arr935 := z.EncBasicHandle().StructToArray - var yyq935 [1]bool - _, _, _ = yysep935, yyq935, yy2arr935 - const yyr935 bool = false - yyq935[0] = x.HTTP != nil - if yyr935 || yy2arr935 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.HTTP != nil + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn935 int = 0 - for _, b := range yyq935 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn935++ + yynn2++ } } - r.EncodeMapStart(yynn935) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr935 || yy2arr935 { - if yyq935[0] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { if x.HTTP == nil { r.EncodeNil() } else { @@ -10460,8 +13003,10 @@ func (x *IngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq935[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("http")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.HTTP == nil { r.EncodeNil() } else { @@ -10469,8 +13014,10 @@ func (x *IngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep935 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10480,24 +13027,25 @@ func (x *IngressRuleValue) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym937 := z.DecBinary() - _ = yym937 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl938 := r.ReadMapStart() - if yyl938 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl938, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl938 := r.ReadArrayStart() - if yyl938 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl938, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10509,12 +13057,12 @@ func (x *IngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys939Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys939Slc - var yyhl939 bool = l >= 0 - for yyj939 := 0; ; yyj939++ { - if yyhl939 { - if yyj939 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10522,9 +13070,11 @@ func (x *IngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys939Slc = r.DecodeBytes(yys939Slc, true, true) - yys939 := string(yys939Slc) - switch yys939 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "http": if r.TryDecodeAsNil() { if x.HTTP != nil { @@ -10537,31 +13087,30 @@ func (x *IngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.HTTP.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys939) - } // end switch yys939 - } // end for yyj939 - if !yyhl939 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressRuleValue) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj941 int - var yyb941 bool - var yyhl941 bool = l >= 0 - yyj941++ - if yyhl941 { - yyb941 = yyj941 > l + var yyj5 int + var yyb5 bool + var yyhl5 bool = l >= 0 + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb941 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb941 { - r.ReadEnd() + if yyb5 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { if x.HTTP != nil { x.HTTP = nil @@ -10573,18 +13122,19 @@ func (x *IngressRuleValue) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) x.HTTP.CodecDecodeSelf(d) } for { - yyj941++ - if yyhl941 { - yyb941 = yyj941 > l + yyj5++ + if yyhl5 { + yyb5 = yyj5 > l } else { - yyb941 = r.CheckBreak() + yyb5 = r.CheckBreak() } - if yyb941 { + if yyb5 { break } - z.DecStructFieldNotFound(yyj941-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj5-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HTTPIngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10594,53 +13144,60 @@ func (x *HTTPIngressRuleValue) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym943 := z.EncBinary() - _ = yym943 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep944 := !z.EncBinary() - yy2arr944 := z.EncBasicHandle().StructToArray - var yyq944 [1]bool - _, _, _ = yysep944, yyq944, yy2arr944 - const yyr944 bool = false - if yyr944 || yy2arr944 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [1]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(1) } else { - var yynn944 int = 1 - for _, b := range yyq944 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn944++ + yynn2++ } } - r.EncodeMapStart(yynn944) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr944 || yy2arr944 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Paths == nil { r.EncodeNil() } else { - yym946 := z.EncBinary() - _ = yym946 + yym4 := z.EncBinary() + _ = yym4 if false { } else { h.encSliceHTTPIngressPath(([]HTTPIngressPath)(x.Paths), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("paths")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Paths == nil { r.EncodeNil() } else { - yym947 := z.EncBinary() - _ = yym947 + yym5 := z.EncBinary() + _ = yym5 if false { } else { h.encSliceHTTPIngressPath(([]HTTPIngressPath)(x.Paths), e) } } } - if yysep944 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10650,24 +13207,25 @@ func (x *HTTPIngressRuleValue) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym948 := z.DecBinary() - _ = yym948 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl949 := r.ReadMapStart() - if yyl949 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl949, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl949 := r.ReadArrayStart() - if yyl949 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl949, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10679,12 +13237,12 @@ func (x *HTTPIngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decode var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys950Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys950Slc - var yyhl950 bool = l >= 0 - for yyj950 := 0; ; yyj950++ { - if yyhl950 { - if yyj950 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10692,71 +13250,73 @@ func (x *HTTPIngressRuleValue) codecDecodeSelfFromMap(l int, d *codec1978.Decode break } } - yys950Slc = r.DecodeBytes(yys950Slc, true, true) - yys950 := string(yys950Slc) - switch yys950 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "paths": if r.TryDecodeAsNil() { x.Paths = nil } else { - yyv951 := &x.Paths - yym952 := z.DecBinary() - _ = yym952 + yyv4 := &x.Paths + yym5 := z.DecBinary() + _ = yym5 if false { } else { - h.decSliceHTTPIngressPath((*[]HTTPIngressPath)(yyv951), d) + h.decSliceHTTPIngressPath((*[]HTTPIngressPath)(yyv4), d) } } default: - z.DecStructFieldNotFound(-1, yys950) - } // end switch yys950 - } // end for yyj950 - if !yyhl950 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HTTPIngressRuleValue) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj953 int - var yyb953 bool - var yyhl953 bool = l >= 0 - yyj953++ - if yyhl953 { - yyb953 = yyj953 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb953 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb953 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Paths = nil } else { - yyv954 := &x.Paths - yym955 := z.DecBinary() - _ = yym955 + yyv7 := &x.Paths + yym8 := z.DecBinary() + _ = yym8 if false { } else { - h.decSliceHTTPIngressPath((*[]HTTPIngressPath)(yyv954), d) + h.decSliceHTTPIngressPath((*[]HTTPIngressPath)(yyv7), d) } } for { - yyj953++ - if yyhl953 { - yyb953 = yyj953 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb953 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb953 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj953-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *HTTPIngressPath) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10766,32 +13326,35 @@ func (x *HTTPIngressPath) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym956 := z.EncBinary() - _ = yym956 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep957 := !z.EncBinary() - yy2arr957 := z.EncBasicHandle().StructToArray - var yyq957 [2]bool - _, _, _ = yysep957, yyq957, yy2arr957 - const yyr957 bool = false - yyq957[0] = x.Path != "" - if yyr957 || yy2arr957 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Path != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn957 int = 1 - for _, b := range yyq957 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn957++ + yynn2++ } } - r.EncodeMapStart(yynn957) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr957 || yy2arr957 { - if yyq957[0] { - yym959 := z.EncBinary() - _ = yym959 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) @@ -10800,26 +13363,33 @@ func (x *HTTPIngressPath) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeString(codecSelferC_UTF81234, "") } } else { - if yyq957[0] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("path")) - yym960 := z.EncBinary() - _ = yym960 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Path)) } } } - if yyr957 || yy2arr957 { - yy962 := &x.Backend - yy962.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.Backend + yy7.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("backend")) - yy963 := &x.Backend - yy963.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.Backend + yy9.CodecEncodeSelf(e) } - if yysep957 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -10829,24 +13399,25 @@ func (x *HTTPIngressPath) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym964 := z.DecBinary() - _ = yym964 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl965 := r.ReadMapStart() - if yyl965 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl965, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl965 := r.ReadArrayStart() - if yyl965 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl965, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -10858,12 +13429,12 @@ func (x *HTTPIngressPath) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys966Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys966Slc - var yyhl966 bool = l >= 0 - for yyj966 := 0; ; yyj966++ { - if yyhl966 { - if yyj966 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -10871,9 +13442,11 @@ func (x *HTTPIngressPath) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys966Slc = r.DecodeBytes(yys966Slc, true, true) - yys966 := string(yys966Slc) - switch yys966 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "path": if r.TryDecodeAsNil() { x.Path = "" @@ -10884,69 +13457,70 @@ func (x *HTTPIngressPath) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Backend = IngressBackend{} } else { - yyv968 := &x.Backend - yyv968.CodecDecodeSelf(d) + yyv5 := &x.Backend + yyv5.CodecDecodeSelf(d) } default: - z.DecStructFieldNotFound(-1, yys966) - } // end switch yys966 - } // end for yyj966 - if !yyhl966 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *HTTPIngressPath) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj969 int - var yyb969 bool - var yyhl969 bool = l >= 0 - yyj969++ - if yyhl969 { - yyb969 = yyj969 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb969 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb969 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Path = "" } else { x.Path = string(r.DecodeString()) } - yyj969++ - if yyhl969 { - yyb969 = yyj969 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb969 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb969 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Backend = IngressBackend{} } else { - yyv971 := &x.Backend - yyv971.CodecDecodeSelf(d) + yyv8 := &x.Backend + yyv8.CodecDecodeSelf(d) } for { - yyj969++ - if yyhl969 { - yyb969 = yyj969 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb969 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb969 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj969-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *IngressBackend) CodecEncodeSelf(e *codec1978.Encoder) { @@ -10956,69 +13530,79 @@ func (x *IngressBackend) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym972 := z.EncBinary() - _ = yym972 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep973 := !z.EncBinary() - yy2arr973 := z.EncBasicHandle().StructToArray - var yyq973 [2]bool - _, _, _ = yysep973, yyq973, yy2arr973 - const yyr973 bool = false - if yyr973 || yy2arr973 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn973 int = 2 - for _, b := range yyq973 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn973++ + yynn2++ } } - r.EncodeMapStart(yynn973) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr973 || yy2arr973 { - yym975 := z.EncBinary() - _ = yym975 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ServiceName)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("serviceName")) - yym976 := z.EncBinary() - _ = yym976 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.ServiceName)) } } - if yyr973 || yy2arr973 { - yy978 := &x.ServicePort - yym979 := z.EncBinary() - _ = yym979 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy7 := &x.ServicePort + yym8 := z.EncBinary() + _ = yym8 if false { - } else if z.HasExtensions() && z.EncExt(yy978) { - } else if !yym979 && z.IsJSONHandle() { - z.EncJSONMarshal(yy978) + } else if z.HasExtensions() && z.EncExt(yy7) { + } else if !yym8 && z.IsJSONHandle() { + z.EncJSONMarshal(yy7) } else { - z.EncFallback(yy978) + z.EncFallback(yy7) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("servicePort")) - yy980 := &x.ServicePort - yym981 := z.EncBinary() - _ = yym981 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy9 := &x.ServicePort + yym10 := z.EncBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.EncExt(yy980) { - } else if !yym981 && z.IsJSONHandle() { - z.EncJSONMarshal(yy980) + } else if z.HasExtensions() && z.EncExt(yy9) { + } else if !yym10 && z.IsJSONHandle() { + z.EncJSONMarshal(yy9) } else { - z.EncFallback(yy980) + z.EncFallback(yy9) } } - if yysep973 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11028,24 +13612,25 @@ func (x *IngressBackend) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym982 := z.DecBinary() - _ = yym982 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl983 := r.ReadMapStart() - if yyl983 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl983, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl983 := r.ReadArrayStart() - if yyl983 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl983, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11057,12 +13642,12 @@ func (x *IngressBackend) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys984Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys984Slc - var yyhl984 bool = l >= 0 - for yyj984 := 0; ; yyj984++ { - if yyhl984 { - if yyj984 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11070,9 +13655,11 @@ func (x *IngressBackend) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys984Slc = r.DecodeBytes(yys984Slc, true, true) - yys984 := string(yys984Slc) - switch yys984 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "serviceName": if r.TryDecodeAsNil() { x.ServiceName = "" @@ -11081,95 +13668,96 @@ func (x *IngressBackend) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "servicePort": if r.TryDecodeAsNil() { - x.ServicePort = pkg6_util.IntOrString{} + x.ServicePort = pkg6_intstr.IntOrString{} } else { - yyv986 := &x.ServicePort - yym987 := z.DecBinary() - _ = yym987 + yyv5 := &x.ServicePort + yym6 := z.DecBinary() + _ = yym6 if false { - } else if z.HasExtensions() && z.DecExt(yyv986) { - } else if !yym987 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv986) + } else if z.HasExtensions() && z.DecExt(yyv5) { + } else if !yym6 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv5) } else { - z.DecFallback(yyv986, false) + z.DecFallback(yyv5, false) } } default: - z.DecStructFieldNotFound(-1, yys984) - } // end switch yys984 - } // end for yyj984 - if !yyhl984 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *IngressBackend) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj988 int - var yyb988 bool - var yyhl988 bool = l >= 0 - yyj988++ - if yyhl988 { - yyb988 = yyj988 > l + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb988 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb988 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ServiceName = "" } else { x.ServiceName = string(r.DecodeString()) } - yyj988++ - if yyhl988 { - yyb988 = yyj988 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb988 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb988 { - r.ReadEnd() + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ServicePort = pkg6_util.IntOrString{} + x.ServicePort = pkg6_intstr.IntOrString{} } else { - yyv990 := &x.ServicePort - yym991 := z.DecBinary() - _ = yym991 + yyv9 := &x.ServicePort + yym10 := z.DecBinary() + _ = yym10 if false { - } else if z.HasExtensions() && z.DecExt(yyv990) { - } else if !yym991 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv990) + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else if !yym10 && z.IsJSONHandle() { + z.DecJSONUnmarshal(yyv9) } else { - z.DecFallback(yyv990, false) + z.DecFallback(yyv9, false) } } for { - yyj988++ - if yyhl988 { - yyb988 = yyj988 > l + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l } else { - yyb988 = r.CheckBreak() + yyb7 = r.CheckBreak() } - if yyb988 { + if yyb7 { break } - z.DecStructFieldNotFound(yyj988-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x NodeResource) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym992 := z.EncBinary() - _ = yym992 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -11181,8 +13769,8 @@ func (x *NodeResource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym993 := z.DecBinary() - _ = yym993 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -11197,51 +13785,61 @@ func (x *NodeUtilization) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym994 := z.EncBinary() - _ = yym994 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep995 := !z.EncBinary() - yy2arr995 := z.EncBasicHandle().StructToArray - var yyq995 [2]bool - _, _, _ = yysep995, yyq995, yy2arr995 - const yyr995 bool = false - if yyr995 || yy2arr995 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(2) } else { - var yynn995 int = 2 - for _, b := range yyq995 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn995++ + yynn2++ } } - r.EncodeMapStart(yynn995) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr995 || yy2arr995 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Resource.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resource")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Resource.CodecEncodeSelf(e) } - if yyr995 || yy2arr995 { - yym998 := z.EncBinary() - _ = yym998 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeFloat64(float64(x.Value)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("value")) - yym999 := z.EncBinary() - _ = yym999 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeFloat64(float64(x.Value)) } } - if yysep995 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11251,24 +13849,25 @@ func (x *NodeUtilization) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1000 := z.DecBinary() - _ = yym1000 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1001 := r.ReadMapStart() - if yyl1001 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1001, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1001 := r.ReadArrayStart() - if yyl1001 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1001, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11280,12 +13879,12 @@ func (x *NodeUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1002Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1002Slc - var yyhl1002 bool = l >= 0 - for yyj1002 := 0; ; yyj1002++ { - if yyhl1002 { - if yyj1002 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11293,9 +13892,11 @@ func (x *NodeUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1002Slc = r.DecodeBytes(yys1002Slc, true, true) - yys1002 := string(yys1002Slc) - switch yys1002 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "resource": if r.TryDecodeAsNil() { x.Resource = "" @@ -11309,64 +13910,65 @@ func (x *NodeUtilization) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Value = float64(r.DecodeFloat(false)) } default: - z.DecStructFieldNotFound(-1, yys1002) - } // end switch yys1002 - } // end for yyj1002 - if !yyhl1002 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *NodeUtilization) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1005 int - var yyb1005 bool - var yyhl1005 bool = l >= 0 - yyj1005++ - if yyhl1005 { - yyb1005 = yyj1005 > l + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1005 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1005 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Resource = "" } else { x.Resource = NodeResource(r.DecodeString()) } - yyj1005++ - if yyhl1005 { - yyb1005 = yyj1005 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1005 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1005 { - r.ReadEnd() + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Value = 0 } else { x.Value = float64(r.DecodeFloat(false)) } for { - yyj1005++ - if yyhl1005 { - yyb1005 = yyj1005 > l + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l } else { - yyb1005 = r.CheckBreak() + yyb6 = r.CheckBreak() } - if yyb1005 { + if yyb6 { break } - z.DecStructFieldNotFound(yyj1005-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ClusterAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11376,85 +13978,98 @@ func (x *ClusterAutoscalerSpec) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1008 := z.EncBinary() - _ = yym1008 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1009 := !z.EncBinary() - yy2arr1009 := z.EncBasicHandle().StructToArray - var yyq1009 [3]bool - _, _, _ = yysep1009, yyq1009, yy2arr1009 - const yyr1009 bool = false - if yyr1009 || yy2arr1009 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1009 int = 3 - for _, b := range yyq1009 { + yynn2 = 3 + for _, b := range yyq2 { if b { - yynn1009++ + yynn2++ } } - r.EncodeMapStart(yynn1009) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1009 || yy2arr1009 { - yym1011 := z.EncBinary() - _ = yym1011 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeInt(int64(x.MinNodes)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("minNodes")) - yym1012 := z.EncBinary() - _ = yym1012 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeInt(int64(x.MinNodes)) } } - if yyr1009 || yy2arr1009 { - yym1014 := z.EncBinary() - _ = yym1014 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 if false { } else { r.EncodeInt(int64(x.MaxNodes)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("maxNodes")) - yym1015 := z.EncBinary() - _ = yym1015 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 if false { } else { r.EncodeInt(int64(x.MaxNodes)) } } - if yyr1009 || yy2arr1009 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.TargetUtilization == nil { r.EncodeNil() } else { - yym1017 := z.EncBinary() - _ = yym1017 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceNodeUtilization(([]NodeUtilization)(x.TargetUtilization), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("target")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.TargetUtilization == nil { r.EncodeNil() } else { - yym1018 := z.EncBinary() - _ = yym1018 + yym11 := z.EncBinary() + _ = yym11 if false { } else { h.encSliceNodeUtilization(([]NodeUtilization)(x.TargetUtilization), e) } } } - if yysep1009 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11464,24 +14079,25 @@ func (x *ClusterAutoscalerSpec) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1019 := z.DecBinary() - _ = yym1019 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1020 := r.ReadMapStart() - if yyl1020 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1020, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1020 := r.ReadArrayStart() - if yyl1020 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1020, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11493,12 +14109,12 @@ func (x *ClusterAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1021Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1021Slc - var yyhl1021 bool = l >= 0 - for yyj1021 := 0; ; yyj1021++ { - if yyhl1021 { - if yyj1021 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11506,113 +14122,117 @@ func (x *ClusterAutoscalerSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1021Slc = r.DecodeBytes(yys1021Slc, true, true) - yys1021 := string(yys1021Slc) - switch yys1021 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "minNodes": if r.TryDecodeAsNil() { x.MinNodes = 0 } else { - x.MinNodes = int(r.DecodeInt(codecSelferBitsize1234)) + x.MinNodes = int32(r.DecodeInt(32)) } case "maxNodes": if r.TryDecodeAsNil() { x.MaxNodes = 0 } else { - x.MaxNodes = int(r.DecodeInt(codecSelferBitsize1234)) + x.MaxNodes = int32(r.DecodeInt(32)) } case "target": if r.TryDecodeAsNil() { x.TargetUtilization = nil } else { - yyv1024 := &x.TargetUtilization - yym1025 := z.DecBinary() - _ = yym1025 + yyv6 := &x.TargetUtilization + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSliceNodeUtilization((*[]NodeUtilization)(yyv1024), d) + h.decSliceNodeUtilization((*[]NodeUtilization)(yyv6), d) } } default: - z.DecStructFieldNotFound(-1, yys1021) - } // end switch yys1021 - } // end for yyj1021 - if !yyhl1021 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ClusterAutoscalerSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1026 int - var yyb1026 bool - var yyhl1026 bool = l >= 0 - yyj1026++ - if yyhl1026 { - yyb1026 = yyj1026 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1026 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1026 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MinNodes = 0 } else { - x.MinNodes = int(r.DecodeInt(codecSelferBitsize1234)) + x.MinNodes = int32(r.DecodeInt(32)) } - yyj1026++ - if yyhl1026 { - yyb1026 = yyj1026 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1026 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1026 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MaxNodes = 0 } else { - x.MaxNodes = int(r.DecodeInt(codecSelferBitsize1234)) + x.MaxNodes = int32(r.DecodeInt(32)) } - yyj1026++ - if yyhl1026 { - yyb1026 = yyj1026 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1026 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1026 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.TargetUtilization = nil } else { - yyv1029 := &x.TargetUtilization - yym1030 := z.DecBinary() - _ = yym1030 + yyv11 := &x.TargetUtilization + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSliceNodeUtilization((*[]NodeUtilization)(yyv1029), d) + h.decSliceNodeUtilization((*[]NodeUtilization)(yyv11), d) } } for { - yyj1026++ - if yyhl1026 { - yyb1026 = yyj1026 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1026 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1026 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1026-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ClusterAutoscaler) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11622,105 +14242,121 @@ func (x *ClusterAutoscaler) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1031 := z.EncBinary() - _ = yym1031 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1032 := !z.EncBinary() - yy2arr1032 := z.EncBasicHandle().StructToArray - var yyq1032 [4]bool - _, _, _ = yysep1032, yyq1032, yy2arr1032 - const yyr1032 bool = false - yyq1032[0] = x.Kind != "" - yyq1032[1] = x.APIVersion != "" - yyq1032[2] = true - yyq1032[3] = true - if yyr1032 || yy2arr1032 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1032 int = 0 - for _, b := range yyq1032 { + yynn2 = 0 + for _, b := range yyq2 { if b { - yynn1032++ + yynn2++ } } - r.EncodeMapStart(yynn1032) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1032 || yy2arr1032 { - if yyq1032[0] { - yym1034 := z.EncBinary() - _ = yym1034 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1032[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1035 := z.EncBinary() - _ = yym1035 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1032 || yy2arr1032 { - if yyq1032[1] { - yym1037 := z.EncBinary() - _ = yym1037 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1032[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1038 := z.EncBinary() - _ = yym1038 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1032 || yy2arr1032 { - if yyq1032[2] { - yy1040 := &x.ObjectMeta - yy1040.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1032[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1041 := &x.ObjectMeta - yy1041.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } - if yyr1032 || yy2arr1032 { - if yyq1032[3] { - yy1043 := &x.Spec - yy1043.CodecEncodeSelf(e) + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq1032[3] { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("spec")) - yy1044 := &x.Spec - yy1044.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) } } - if yysep1032 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -11730,24 +14366,25 @@ func (x *ClusterAutoscaler) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1045 := z.DecBinary() - _ = yym1045 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1046 := r.ReadMapStart() - if yyl1046 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1046, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1046 := r.ReadArrayStart() - if yyl1046 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1046, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -11759,12 +14396,12 @@ func (x *ClusterAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1047Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1047Slc - var yyhl1047 bool = l >= 0 - for yyj1047 := 0; ; yyj1047++ { - if yyhl1047 { - if yyj1047 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -11772,9 +14409,25 @@ func (x *ClusterAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) break } } - yys1047Slc = r.DecodeBytes(yys1047Slc, true, true) - yys1047 := string(yys1047Slc) - switch yys1047 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ClusterAutoscalerSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -11787,111 +14440,100 @@ func (x *ClusterAutoscaler) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv1050 := &x.ObjectMeta - yyv1050.CodecDecodeSelf(d) - } - case "spec": - if r.TryDecodeAsNil() { - x.Spec = ClusterAutoscalerSpec{} - } else { - yyv1051 := &x.Spec - yyv1051.CodecDecodeSelf(d) - } default: - z.DecStructFieldNotFound(-1, yys1047) - } // end switch yys1047 - } // end for yyj1047 - if !yyhl1047 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ClusterAutoscaler) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1052 int - var yyb1052 bool - var yyhl1052 bool = l >= 0 - yyj1052++ - if yyhl1052 { - yyb1052 = yyj1052 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1052 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1052 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ClusterAutoscalerSpec{} + } else { + yyv10 := &x.Spec + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1052++ - if yyhl1052 { - yyb1052 = yyj1052 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1052 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1052 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1052++ - if yyhl1052 { - yyb1052 = yyj1052 > l - } else { - yyb1052 = r.CheckBreak() - } - if yyb1052 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} - } else { - yyv1055 := &x.ObjectMeta - yyv1055.CodecDecodeSelf(d) - } - yyj1052++ - if yyhl1052 { - yyb1052 = yyj1052 > l - } else { - yyb1052 = r.CheckBreak() - } - if yyb1052 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Spec = ClusterAutoscalerSpec{} - } else { - yyv1056 := &x.Spec - yyv1056.CodecDecodeSelf(d) - } for { - yyj1052++ - if yyhl1052 { - yyb1052 = yyj1052 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1052 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1052 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1052-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } func (x *ClusterAutoscalerList) CodecEncodeSelf(e *codec1978.Encoder) { @@ -11901,126 +14543,142 @@ func (x *ClusterAutoscalerList) CodecEncodeSelf(e *codec1978.Encoder) { if x == nil { r.EncodeNil() } else { - yym1057 := z.EncBinary() - _ = yym1057 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1058 := !z.EncBinary() - yy2arr1058 := z.EncBasicHandle().StructToArray - var yyq1058 [4]bool - _, _, _ = yysep1058, yyq1058, yy2arr1058 - const yyr1058 bool = false - yyq1058[0] = x.Kind != "" - yyq1058[1] = x.APIVersion != "" - yyq1058[2] = true - if yyr1058 || yy2arr1058 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn1058 int = 1 - for _, b := range yyq1058 { + yynn2 = 1 + for _, b := range yyq2 { if b { - yynn1058++ + yynn2++ } } - r.EncodeMapStart(yynn1058) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1058 || yy2arr1058 { - if yyq1058[0] { - yym1060 := z.EncBinary() - _ = yym1060 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 if false { + } else if z.HasExtensions() && z.EncExt(yy4) { } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1058[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym1061 := z.EncBinary() - _ = yym1061 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr1058 || yy2arr1058 { - if yyq1058[1] { - yym1063 := z.EncBinary() - _ = yym1063 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq1058[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym1064 := z.EncBinary() - _ = yym1064 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr1058 || yy2arr1058 { - if yyq1058[2] { - yy1066 := &x.ListMeta - yym1067 := z.EncBinary() - _ = yym1067 - if false { - } else if z.HasExtensions() && z.EncExt(yy1066) { - } else { - z.EncFallback(yy1066) + z.EncFallback(yy4) } } else { r.EncodeNil() } } else { - if yyq1058[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy1068 := &x.ListMeta - yym1069 := z.EncBinary() - _ = yym1069 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 if false { - } else if z.HasExtensions() && z.EncExt(yy1068) { + } else if z.HasExtensions() && z.EncExt(yy6) { } else { - z.EncFallback(yy1068) + z.EncFallback(yy6) } } } - if yyr1058 || yy2arr1058 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Items == nil { r.EncodeNil() } else { - yym1071 := z.EncBinary() - _ = yym1071 + yym9 := z.EncBinary() + _ = yym9 if false { } else { h.encSliceClusterAutoscaler(([]ClusterAutoscaler)(x.Items), e) } } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Items == nil { r.EncodeNil() } else { - yym1072 := z.EncBinary() - _ = yym1072 + yym10 := z.EncBinary() + _ = yym10 if false { } else { h.encSliceClusterAutoscaler(([]ClusterAutoscaler)(x.Items), e) } } } - if yysep1058 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -12030,24 +14688,25 @@ func (x *ClusterAutoscalerList) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1073 := z.DecBinary() - _ = yym1073 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1074 := r.ReadMapStart() - if yyl1074 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1074, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1074 := r.ReadArrayStart() - if yyl1074 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1074, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12059,12 +14718,12 @@ func (x *ClusterAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978.Decod var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1075Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1075Slc - var yyhl1075 bool = l >= 0 - for yyj1075 := 0; ; yyj1075++ { - if yyhl1075 { - if yyj1075 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12072,9 +14731,36 @@ func (x *ClusterAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978.Decod break } } - yys1075Slc = r.DecodeBytes(yys1075Slc, true, true) - yys1075 := string(yys1075Slc) - switch yys1075 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceClusterAutoscaler((*[]ClusterAutoscaler)(yyv6), d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -12087,254 +14773,265 @@ func (x *ClusterAutoscalerList) codecDecodeSelfFromMap(l int, d *codec1978.Decod } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv1078 := &x.ListMeta - yym1079 := z.DecBinary() - _ = yym1079 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1078) { - } else { - z.DecFallback(yyv1078, false) - } - } - case "items": - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1080 := &x.Items - yym1081 := z.DecBinary() - _ = yym1081 - if false { - } else { - h.decSliceClusterAutoscaler((*[]ClusterAutoscaler)(yyv1080), d) - } - } default: - z.DecStructFieldNotFound(-1, yys1075) - } // end switch yys1075 - } // end for yyj1075 - if !yyhl1075 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *ClusterAutoscalerList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1082 int - var yyb1082 bool - var yyhl1082 bool = l >= 0 - yyj1082++ - if yyhl1082 { - yyb1082 = yyj1082 > l + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1082 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1082 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceClusterAutoscaler((*[]ClusterAutoscaler)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Kind = "" } else { x.Kind = string(r.DecodeString()) } - yyj1082++ - if yyhl1082 { - yyb1082 = yyj1082 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1082 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1082 { - r.ReadEnd() + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.APIVersion = "" } else { x.APIVersion = string(r.DecodeString()) } - yyj1082++ - if yyhl1082 { - yyb1082 = yyj1082 > l - } else { - yyb1082 = r.CheckBreak() - } - if yyb1082 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.ListMeta = pkg1_unversioned.ListMeta{} - } else { - yyv1085 := &x.ListMeta - yym1086 := z.DecBinary() - _ = yym1086 - if false { - } else if z.HasExtensions() && z.DecExt(yyv1085) { - } else { - z.DecFallback(yyv1085, false) - } - } - yyj1082++ - if yyhl1082 { - yyb1082 = yyj1082 > l - } else { - yyb1082 = r.CheckBreak() - } - if yyb1082 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Items = nil - } else { - yyv1087 := &x.Items - yym1088 := z.DecBinary() - _ = yym1088 - if false { - } else { - h.decSliceClusterAutoscaler((*[]ClusterAutoscaler)(yyv1087), d) - } - } for { - yyj1082++ - if yyhl1082 { - yyb1082 = yyj1082 > l + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l } else { - yyb1082 = r.CheckBreak() + yyb10 = r.CheckBreak() } - if yyb1082 { + if yyb10 { break } - z.DecStructFieldNotFound(yyj1082-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } -func (x *PodSelector) CodecEncodeSelf(e *codec1978.Encoder) { +func (x *ExportOptions) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { r.EncodeNil() } else { - yym1089 := z.EncBinary() - _ = yym1089 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1090 := !z.EncBinary() - yy2arr1090 := z.EncBasicHandle().StructToArray - var yyq1090 [2]bool - _, _, _ = yysep1090, yyq1090, yy2arr1090 - const yyr1090 bool = false - yyq1090[0] = len(x.MatchLabels) != 0 - yyq1090[1] = len(x.MatchExpressions) != 0 - if yyr1090 || yy2arr1090 { - r.EncodeArrayStart(2) + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) } else { - var yynn1090 int = 0 - for _, b := range yyq1090 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn1090++ + yynn2++ } } - r.EncodeMapStart(yynn1090) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1090 || yy2arr1090 { - if yyq1090[0] { - if x.MatchLabels == nil { - r.EncodeNil() - } else { - yym1092 := z.EncBinary() - _ = yym1092 - if false { - } else { - z.F.EncMapStringStringV(x.MatchLabels, false, e) - } - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { } else { - r.EncodeNil() + r.EncodeBool(bool(x.Export)) } } else { - if yyq1090[0] { - r.EncodeString(codecSelferC_UTF81234, string("matchLabels")) - if x.MatchLabels == nil { - r.EncodeNil() - } else { - yym1093 := z.EncBinary() - _ = yym1093 - if false { - } else { - z.F.EncMapStringStringV(x.MatchLabels, false, e) - } - } + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("export")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Export)) } } - if yyr1090 || yy2arr1090 { - if yyq1090[1] { - if x.MatchExpressions == nil { - r.EncodeNil() - } else { - yym1095 := z.EncBinary() - _ = yym1095 - if false { - } else { - h.encSlicePodSelectorRequirement(([]PodSelectorRequirement)(x.MatchExpressions), e) - } - } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { } else { - r.EncodeNil() + r.EncodeBool(bool(x.Exact)) } } else { - if yyq1090[1] { - r.EncodeString(codecSelferC_UTF81234, string("matchExpressions")) - if x.MatchExpressions == nil { - r.EncodeNil() + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("exact")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Exact)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { } else { - yym1096 := z.EncBinary() - _ = yym1096 - if false { - } else { - h.encSlicePodSelectorRequirement(([]PodSelectorRequirement)(x.MatchExpressions), e) - } + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) } } } - if yysep1090 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } } -func (x *PodSelector) CodecDecodeSelf(d *codec1978.Decoder) { +func (x *ExportOptions) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1097 := z.DecBinary() - _ = yym1097 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1098 := r.ReadMapStart() - if yyl1098 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1098, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1098 := r.ReadArrayStart() - if yyl1098 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1098, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12342,16 +15039,16 @@ func (x *PodSelector) CodecDecodeSelf(d *codec1978.Decoder) { } } -func (x *PodSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { +func (x *ExportOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1099Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1099Slc - var yyhl1099 bool = l >= 0 - for yyj1099 := 0; ; yyj1099++ { - if yyhl1099 { - if yyj1099 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12359,164 +15056,940 @@ func (x *PodSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys1099Slc = r.DecodeBytes(yys1099Slc, true, true) - yys1099 := string(yys1099Slc) - switch yys1099 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "export": + if r.TryDecodeAsNil() { + x.Export = false + } else { + x.Export = bool(r.DecodeBool()) + } + case "exact": + if r.TryDecodeAsNil() { + x.Exact = false + } else { + x.Exact = bool(r.DecodeBool()) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ExportOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Export = false + } else { + x.Export = bool(r.DecodeBool()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Exact = false + } else { + x.Exact = bool(r.DecodeBool()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ListOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [7]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.LabelSelector != "" + yyq2[1] = x.FieldSelector != "" + yyq2[2] = x.Watch != false + yyq2[3] = x.ResourceVersion != "" + yyq2[4] = x.TimeoutSeconds != nil + yyq2[5] = x.Kind != "" + yyq2[6] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(7) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.LabelSelector)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("labelSelector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.LabelSelector)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FieldSelector)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("fieldSelector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.FieldSelector)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Watch)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("watch")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Watch)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resourceVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.ResourceVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.TimeoutSeconds == nil { + r.EncodeNil() + } else { + yy16 := *x.TimeoutSeconds + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeInt(int64(yy16)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("timeoutSeconds")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.TimeoutSeconds == nil { + r.EncodeNil() + } else { + yy18 := *x.TimeoutSeconds + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeInt(int64(yy18)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym21 := z.EncBinary() + _ = yym21 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym24 := z.EncBinary() + _ = yym24 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ListOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ListOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "labelSelector": + if r.TryDecodeAsNil() { + x.LabelSelector = "" + } else { + x.LabelSelector = string(r.DecodeString()) + } + case "fieldSelector": + if r.TryDecodeAsNil() { + x.FieldSelector = "" + } else { + x.FieldSelector = string(r.DecodeString()) + } + case "watch": + if r.TryDecodeAsNil() { + x.Watch = false + } else { + x.Watch = bool(r.DecodeBool()) + } + case "resourceVersion": + if r.TryDecodeAsNil() { + x.ResourceVersion = "" + } else { + x.ResourceVersion = string(r.DecodeString()) + } + case "timeoutSeconds": + if r.TryDecodeAsNil() { + if x.TimeoutSeconds != nil { + x.TimeoutSeconds = nil + } + } else { + if x.TimeoutSeconds == nil { + x.TimeoutSeconds = new(int64) + } + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*int64)(x.TimeoutSeconds)) = int64(r.DecodeInt(64)) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ListOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.LabelSelector = "" + } else { + x.LabelSelector = string(r.DecodeString()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.FieldSelector = "" + } else { + x.FieldSelector = string(r.DecodeString()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Watch = false + } else { + x.Watch = bool(r.DecodeBool()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ResourceVersion = "" + } else { + x.ResourceVersion = string(r.DecodeString()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.TimeoutSeconds != nil { + x.TimeoutSeconds = nil + } + } else { + if x.TimeoutSeconds == nil { + x.TimeoutSeconds = new(int64) + } + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*int64)(x.TimeoutSeconds)) = int64(r.DecodeInt(64)) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *LabelSelector) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = len(x.MatchLabels) != 0 + yyq2[1] = len(x.MatchExpressions) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.MatchLabels == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + z.F.EncMapStringStringV(x.MatchLabels, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("matchLabels")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.MatchLabels == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + z.F.EncMapStringStringV(x.MatchLabels, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.MatchExpressions == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + h.encSliceLabelSelectorRequirement(([]LabelSelectorRequirement)(x.MatchExpressions), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("matchExpressions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.MatchExpressions == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + h.encSliceLabelSelectorRequirement(([]LabelSelectorRequirement)(x.MatchExpressions), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *LabelSelector) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *LabelSelector) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "matchLabels": if r.TryDecodeAsNil() { x.MatchLabels = nil } else { - yyv1100 := &x.MatchLabels - yym1101 := z.DecBinary() - _ = yym1101 + yyv4 := &x.MatchLabels + yym5 := z.DecBinary() + _ = yym5 if false { } else { - z.F.DecMapStringStringX(yyv1100, false, d) + z.F.DecMapStringStringX(yyv4, false, d) } } case "matchExpressions": if r.TryDecodeAsNil() { x.MatchExpressions = nil } else { - yyv1102 := &x.MatchExpressions - yym1103 := z.DecBinary() - _ = yym1103 + yyv6 := &x.MatchExpressions + yym7 := z.DecBinary() + _ = yym7 if false { } else { - h.decSlicePodSelectorRequirement((*[]PodSelectorRequirement)(yyv1102), d) + h.decSliceLabelSelectorRequirement((*[]LabelSelectorRequirement)(yyv6), d) } } default: - z.DecStructFieldNotFound(-1, yys1099) - } // end switch yys1099 - } // end for yyj1099 - if !yyhl1099 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } -func (x *PodSelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { +func (x *LabelSelector) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1104 int - var yyb1104 bool - var yyhl1104 bool = l >= 0 - yyj1104++ - if yyhl1104 { - yyb1104 = yyj1104 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1104 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1104 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MatchLabels = nil } else { - yyv1105 := &x.MatchLabels - yym1106 := z.DecBinary() - _ = yym1106 + yyv9 := &x.MatchLabels + yym10 := z.DecBinary() + _ = yym10 if false { } else { - z.F.DecMapStringStringX(yyv1105, false, d) + z.F.DecMapStringStringX(yyv9, false, d) } } - yyj1104++ - if yyhl1104 { - yyb1104 = yyj1104 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1104 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1104 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.MatchExpressions = nil } else { - yyv1107 := &x.MatchExpressions - yym1108 := z.DecBinary() - _ = yym1108 + yyv11 := &x.MatchExpressions + yym12 := z.DecBinary() + _ = yym12 if false { } else { - h.decSlicePodSelectorRequirement((*[]PodSelectorRequirement)(yyv1107), d) + h.decSliceLabelSelectorRequirement((*[]LabelSelectorRequirement)(yyv11), d) } } for { - yyj1104++ - if yyhl1104 { - yyb1104 = yyj1104 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1104 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1104 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1104-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } -func (x *PodSelectorRequirement) CodecEncodeSelf(e *codec1978.Encoder) { +func (x *LabelSelectorRequirement) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { r.EncodeNil() } else { - yym1109 := z.EncBinary() - _ = yym1109 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { - yysep1110 := !z.EncBinary() - yy2arr1110 := z.EncBasicHandle().StructToArray - var yyq1110 [3]bool - _, _, _ = yysep1110, yyq1110, yy2arr1110 - const yyr1110 bool = false - yyq1110[2] = len(x.Values) != 0 - if yyr1110 || yy2arr1110 { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[2] = len(x.Values) != 0 + var yynn2 int + if yyr2 || yy2arr2 { r.EncodeArrayStart(3) } else { - var yynn1110 int = 2 - for _, b := range yyq1110 { + yynn2 = 2 + for _, b := range yyq2 { if b { - yynn1110++ + yynn2++ } } - r.EncodeMapStart(yynn1110) + r.EncodeMapStart(yynn2) + yynn2 = 0 } - if yyr1110 || yy2arr1110 { - yym1112 := z.EncBinary() - _ = yym1112 + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Key)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("key")) - yym1113 := z.EncBinary() - _ = yym1113 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Key)) } } - if yyr1110 || yy2arr1110 { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) x.Operator.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("operator")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) x.Operator.CodecEncodeSelf(e) } - if yyr1110 || yy2arr1110 { - if yyq1110[2] { + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { if x.Values == nil { r.EncodeNil() } else { - yym1116 := z.EncBinary() - _ = yym1116 + yym10 := z.EncBinary() + _ = yym10 if false { } else { z.F.EncSliceStringV(x.Values, false, e) @@ -12526,13 +15999,15 @@ func (x *PodSelectorRequirement) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq1110[2] { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("values")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Values == nil { r.EncodeNil() } else { - yym1117 := z.EncBinary() - _ = yym1117 + yym11 := z.EncBinary() + _ = yym11 if false { } else { z.F.EncSliceStringV(x.Values, false, e) @@ -12540,35 +16015,38 @@ func (x *PodSelectorRequirement) CodecEncodeSelf(e *codec1978.Encoder) { } } } - if yysep1110 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } } -func (x *PodSelectorRequirement) CodecDecodeSelf(d *codec1978.Decoder) { +func (x *LabelSelectorRequirement) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1118 := z.DecBinary() - _ = yym1118 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl1119 := r.ReadMapStart() - if yyl1119 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl1119, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl1119 := r.ReadArrayStart() - if yyl1119 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl1119, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -12576,16 +16054,16 @@ func (x *PodSelectorRequirement) CodecDecodeSelf(d *codec1978.Decoder) { } } -func (x *PodSelectorRequirement) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { +func (x *LabelSelectorRequirement) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys1120Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys1120Slc - var yyhl1120 bool = l >= 0 - for yyj1120 := 0; ; yyj1120++ { - if yyhl1120 { - if yyj1120 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -12593,9 +16071,11 @@ func (x *PodSelectorRequirement) codecDecodeSelfFromMap(l int, d *codec1978.Deco break } } - yys1120Slc = r.DecodeBytes(yys1120Slc, true, true) - yys1120 := string(yys1120Slc) - switch yys1120 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { case "key": if r.TryDecodeAsNil() { x.Key = "" @@ -12606,108 +16086,110 @@ func (x *PodSelectorRequirement) codecDecodeSelfFromMap(l int, d *codec1978.Deco if r.TryDecodeAsNil() { x.Operator = "" } else { - x.Operator = PodSelectorOperator(r.DecodeString()) + x.Operator = LabelSelectorOperator(r.DecodeString()) } case "values": if r.TryDecodeAsNil() { x.Values = nil } else { - yyv1123 := &x.Values - yym1124 := z.DecBinary() - _ = yym1124 + yyv6 := &x.Values + yym7 := z.DecBinary() + _ = yym7 if false { } else { - z.F.DecSliceStringX(yyv1123, false, d) + z.F.DecSliceStringX(yyv6, false, d) } } default: - z.DecStructFieldNotFound(-1, yys1120) - } // end switch yys1120 - } // end for yyj1120 - if !yyhl1120 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } -func (x *PodSelectorRequirement) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { +func (x *LabelSelectorRequirement) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj1125 int - var yyb1125 bool - var yyhl1125 bool = l >= 0 - yyj1125++ - if yyhl1125 { - yyb1125 = yyj1125 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1125 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1125 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Key = "" } else { x.Key = string(r.DecodeString()) } - yyj1125++ - if yyhl1125 { - yyb1125 = yyj1125 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1125 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1125 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Operator = "" } else { - x.Operator = PodSelectorOperator(r.DecodeString()) + x.Operator = LabelSelectorOperator(r.DecodeString()) } - yyj1125++ - if yyhl1125 { - yyb1125 = yyj1125 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1125 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1125 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Values = nil } else { - yyv1128 := &x.Values - yym1129 := z.DecBinary() - _ = yym1129 + yyv11 := &x.Values + yym12 := z.DecBinary() + _ = yym12 if false { } else { - z.F.DecSliceStringX(yyv1128, false, d) + z.F.DecSliceStringX(yyv11, false, d) } } for { - yyj1125++ - if yyhl1125 { - yyb1125 = yyj1125 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb1125 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb1125 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj1125-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } -func (x PodSelectorOperator) CodecEncodeSelf(e *codec1978.Encoder) { +func (x LabelSelectorOperator) CodecEncodeSelf(e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - yym1130 := z.EncBinary() - _ = yym1130 + yym1 := z.EncBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.EncExt(x) { } else { @@ -12715,12 +16197,12 @@ func (x PodSelectorOperator) CodecEncodeSelf(e *codec1978.Encoder) { } } -func (x *PodSelectorOperator) CodecDecodeSelf(d *codec1978.Decoder) { +func (x *LabelSelectorOperator) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym1131 := z.DecBinary() - _ = yym1131 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { @@ -12728,16 +16210,3621 @@ func (x *PodSelectorOperator) CodecDecodeSelf(d *codec1978.Decoder) { } } +func (x *ReplicaSet) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = true + yyq2[3] = x.Kind != "" + yyq2[4] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy14 := &x.Status + yy14.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("status")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy16 := &x.Status + yy16.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ReplicaSet) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ReplicaSet) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = ReplicaSetSpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "status": + if r.TryDecodeAsNil() { + x.Status = ReplicaSetStatus{} + } else { + yyv6 := &x.Status + yyv6.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ReplicaSet) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj9 int + var yyb9 bool + var yyhl9 bool = l >= 0 + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv10 := &x.ObjectMeta + yyv10.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = ReplicaSetSpec{} + } else { + yyv11 := &x.Spec + yyv11.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Status = ReplicaSetStatus{} + } else { + yyv12 := &x.Status + yyv12.CodecDecodeSelf(d) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj9++ + if yyhl9 { + yyb9 = yyj9 > l + } else { + yyb9 = r.CheckBreak() + } + if yyb9 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj9-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ReplicaSetList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.EncExt(yy4) { + } else { + z.EncFallback(yy4) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(yy6) { + } else { + z.EncFallback(yy6) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + h.encSliceReplicaSet(([]ReplicaSet)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSliceReplicaSet(([]ReplicaSet)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ReplicaSetList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ReplicaSetList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSliceReplicaSet((*[]ReplicaSet)(yyv6), d) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ReplicaSetList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSliceReplicaSet((*[]ReplicaSet)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ReplicaSetSpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Replicas != nil + yyq2[1] = x.Selector != nil + yyq2[2] = x.Template != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + if x.Replicas == nil { + r.EncodeNil() + } else { + yy4 := *x.Replicas + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(yy4)) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("replicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Replicas == nil { + r.EncodeNil() + } else { + yy6 := *x.Replicas + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(yy6)) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Selector == nil { + r.EncodeNil() + } else { + x.Selector.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("selector")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Selector == nil { + r.EncodeNil() + } else { + x.Selector.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.Template == nil { + r.EncodeNil() + } else { + x.Template.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("template")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Template == nil { + r.EncodeNil() + } else { + x.Template.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ReplicaSetSpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ReplicaSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "replicas": + if r.TryDecodeAsNil() { + if x.Replicas != nil { + x.Replicas = nil + } + } else { + if x.Replicas == nil { + x.Replicas = new(int32) + } + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*int32)(x.Replicas)) = int32(r.DecodeInt(32)) + } + } + case "selector": + if r.TryDecodeAsNil() { + if x.Selector != nil { + x.Selector = nil + } + } else { + if x.Selector == nil { + x.Selector = new(LabelSelector) + } + x.Selector.CodecDecodeSelf(d) + } + case "template": + if r.TryDecodeAsNil() { + if x.Template != nil { + x.Template = nil + } + } else { + if x.Template == nil { + x.Template = new(pkg2_v1.PodTemplateSpec) + } + x.Template.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ReplicaSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Replicas != nil { + x.Replicas = nil + } + } else { + if x.Replicas == nil { + x.Replicas = new(int32) + } + yym10 := z.DecBinary() + _ = yym10 + if false { + } else { + *((*int32)(x.Replicas)) = int32(r.DecodeInt(32)) + } + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Selector != nil { + x.Selector = nil + } + } else { + if x.Selector == nil { + x.Selector = new(LabelSelector) + } + x.Selector.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.Template != nil { + x.Template = nil + } + } else { + if x.Template == nil { + x.Template = new(pkg2_v1.PodTemplateSpec) + } + x.Template.CodecDecodeSelf(d) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ReplicaSetStatus) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.ObservedGeneration != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Replicas)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("replicas")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Replicas)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(x.ObservedGeneration)) + } + } else { + r.EncodeInt(0) + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("observedGeneration")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeInt(int64(x.ObservedGeneration)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ReplicaSetStatus) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ReplicaSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "replicas": + if r.TryDecodeAsNil() { + x.Replicas = 0 + } else { + x.Replicas = int32(r.DecodeInt(32)) + } + case "observedGeneration": + if r.TryDecodeAsNil() { + x.ObservedGeneration = 0 + } else { + x.ObservedGeneration = int64(r.DecodeInt(64)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ReplicaSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Replicas = 0 + } else { + x.Replicas = int32(r.DecodeInt(32)) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObservedGeneration = 0 + } else { + x.ObservedGeneration = int64(r.DecodeInt(64)) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodSecurityPolicy) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[1] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yy9 := &x.Spec + yy9.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("spec")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy11 := &x.Spec + yy11.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodSecurityPolicy) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodSecurityPolicy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "spec": + if r.TryDecodeAsNil() { + x.Spec = PodSecurityPolicySpec{} + } else { + yyv5 := &x.Spec + yyv5.CodecDecodeSelf(d) + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodSecurityPolicy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_v1.ObjectMeta{} + } else { + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Spec = PodSecurityPolicySpec{} + } else { + yyv10 := &x.Spec + yyv10.CodecDecodeSelf(d) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *PodSecurityPolicySpec) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [9]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Privileged != false + yyq2[1] = len(x.Capabilities) != 0 + yyq2[2] = len(x.Volumes) != 0 + yyq2[3] = x.HostNetwork != false + yyq2[4] = len(x.HostPorts) != 0 + yyq2[5] = x.HostPID != false + yyq2[6] = x.HostIPC != false + yyq2[7] = true + yyq2[8] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(9) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Privileged)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("privileged")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Privileged)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Capabilities == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + h.encSlicev1_Capability(([]pkg2_v1.Capability)(x.Capabilities), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("capabilities")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Capabilities == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + h.encSlicev1_Capability(([]pkg2_v1.Capability)(x.Capabilities), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.Volumes == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSliceFSType(([]FSType)(x.Volumes), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("volumes")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Volumes == nil { + r.EncodeNil() + } else { + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + h.encSliceFSType(([]FSType)(x.Volumes), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.HostNetwork)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostNetwork")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.HostNetwork)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.HostPorts == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSliceHostPortRange(([]HostPortRange)(x.HostPorts), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostPorts")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.HostPorts == nil { + r.EncodeNil() + } else { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + h.encSliceHostPortRange(([]HostPortRange)(x.HostPorts), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeBool(bool(x.HostPID)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostPID")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeBool(bool(x.HostPID)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeBool(bool(x.HostIPC)) + } + } else { + r.EncodeBool(false) + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("hostIPC")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeBool(bool(x.HostIPC)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[7] { + yy25 := &x.SELinuxContext + yy25.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[7] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("seLinuxContext")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy27 := &x.SELinuxContext + yy27.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[8] { + yy30 := &x.RunAsUser + yy30.CodecEncodeSelf(e) + } else { + r.EncodeNil() + } + } else { + if yyq2[8] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("runAsUser")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy32 := &x.RunAsUser + yy32.CodecEncodeSelf(e) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodSecurityPolicySpec) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodSecurityPolicySpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "privileged": + if r.TryDecodeAsNil() { + x.Privileged = false + } else { + x.Privileged = bool(r.DecodeBool()) + } + case "capabilities": + if r.TryDecodeAsNil() { + x.Capabilities = nil + } else { + yyv5 := &x.Capabilities + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSlicev1_Capability((*[]pkg2_v1.Capability)(yyv5), d) + } + } + case "volumes": + if r.TryDecodeAsNil() { + x.Volumes = nil + } else { + yyv7 := &x.Volumes + yym8 := z.DecBinary() + _ = yym8 + if false { + } else { + h.decSliceFSType((*[]FSType)(yyv7), d) + } + } + case "hostNetwork": + if r.TryDecodeAsNil() { + x.HostNetwork = false + } else { + x.HostNetwork = bool(r.DecodeBool()) + } + case "hostPorts": + if r.TryDecodeAsNil() { + x.HostPorts = nil + } else { + yyv10 := &x.HostPorts + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSliceHostPortRange((*[]HostPortRange)(yyv10), d) + } + } + case "hostPID": + if r.TryDecodeAsNil() { + x.HostPID = false + } else { + x.HostPID = bool(r.DecodeBool()) + } + case "hostIPC": + if r.TryDecodeAsNil() { + x.HostIPC = false + } else { + x.HostIPC = bool(r.DecodeBool()) + } + case "seLinuxContext": + if r.TryDecodeAsNil() { + x.SELinuxContext = SELinuxContextStrategyOptions{} + } else { + yyv14 := &x.SELinuxContext + yyv14.CodecDecodeSelf(d) + } + case "runAsUser": + if r.TryDecodeAsNil() { + x.RunAsUser = RunAsUserStrategyOptions{} + } else { + yyv15 := &x.RunAsUser + yyv15.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodSecurityPolicySpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj16 int + var yyb16 bool + var yyhl16 bool = l >= 0 + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Privileged = false + } else { + x.Privileged = bool(r.DecodeBool()) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Capabilities = nil + } else { + yyv18 := &x.Capabilities + yym19 := z.DecBinary() + _ = yym19 + if false { + } else { + h.decSlicev1_Capability((*[]pkg2_v1.Capability)(yyv18), d) + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Volumes = nil + } else { + yyv20 := &x.Volumes + yym21 := z.DecBinary() + _ = yym21 + if false { + } else { + h.decSliceFSType((*[]FSType)(yyv20), d) + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostNetwork = false + } else { + x.HostNetwork = bool(r.DecodeBool()) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostPorts = nil + } else { + yyv23 := &x.HostPorts + yym24 := z.DecBinary() + _ = yym24 + if false { + } else { + h.decSliceHostPortRange((*[]HostPortRange)(yyv23), d) + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostPID = false + } else { + x.HostPID = bool(r.DecodeBool()) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.HostIPC = false + } else { + x.HostIPC = bool(r.DecodeBool()) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.SELinuxContext = SELinuxContextStrategyOptions{} + } else { + yyv27 := &x.SELinuxContext + yyv27.CodecDecodeSelf(d) + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RunAsUser = RunAsUserStrategyOptions{} + } else { + yyv28 := &x.RunAsUser + yyv28.CodecDecodeSelf(d) + } + for { + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj16-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x FSType) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x)) + } +} + +func (x *FSType) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() + } +} + +func (x *HostPortRange) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Min)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("min")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Min)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(x.Max)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("max")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeInt(int64(x.Max)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *HostPortRange) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *HostPortRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "min": + if r.TryDecodeAsNil() { + x.Min = 0 + } else { + x.Min = int32(r.DecodeInt(32)) + } + case "max": + if r.TryDecodeAsNil() { + x.Max = 0 + } else { + x.Max = int32(r.DecodeInt(32)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *HostPortRange) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Min = 0 + } else { + x.Min = int32(r.DecodeInt(32)) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Max = 0 + } else { + x.Max = int32(r.DecodeInt(32)) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *SELinuxContextStrategyOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.SELinuxOptions != nil + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + x.Type.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + x.Type.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.SELinuxOptions == nil { + r.EncodeNil() + } else { + x.SELinuxOptions.CodecEncodeSelf(e) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("seLinuxOptions")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SELinuxOptions == nil { + r.EncodeNil() + } else { + x.SELinuxOptions.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *SELinuxContextStrategyOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *SELinuxContextStrategyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "type": + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = SELinuxContextStrategy(r.DecodeString()) + } + case "seLinuxOptions": + if r.TryDecodeAsNil() { + if x.SELinuxOptions != nil { + x.SELinuxOptions = nil + } + } else { + if x.SELinuxOptions == nil { + x.SELinuxOptions = new(pkg2_v1.SELinuxOptions) + } + x.SELinuxOptions.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *SELinuxContextStrategyOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = SELinuxContextStrategy(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + if x.SELinuxOptions != nil { + x.SELinuxOptions = nil + } + } else { + if x.SELinuxOptions == nil { + x.SELinuxOptions = new(pkg2_v1.SELinuxOptions) + } + x.SELinuxOptions.CodecDecodeSelf(d) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x SELinuxContextStrategy) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x)) + } +} + +func (x *SELinuxContextStrategy) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() + } +} + +func (x *RunAsUserStrategyOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = len(x.Ranges) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + x.Type.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("type")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + x.Type.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.Ranges == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + h.encSliceIDRange(([]IDRange)(x.Ranges), e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("ranges")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Ranges == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + h.encSliceIDRange(([]IDRange)(x.Ranges), e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RunAsUserStrategyOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RunAsUserStrategyOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "type": + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = RunAsUserStrategy(r.DecodeString()) + } + case "ranges": + if r.TryDecodeAsNil() { + x.Ranges = nil + } else { + yyv5 := &x.Ranges + yym6 := z.DecBinary() + _ = yym6 + if false { + } else { + h.decSliceIDRange((*[]IDRange)(yyv5), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RunAsUserStrategyOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj7 int + var yyb7 bool + var yyhl7 bool = l >= 0 + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Type = "" + } else { + x.Type = RunAsUserStrategy(r.DecodeString()) + } + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Ranges = nil + } else { + yyv9 := &x.Ranges + yym10 := z.DecBinary() + _ = yym10 + if false { + } else { + h.decSliceIDRange((*[]IDRange)(yyv9), d) + } + } + for { + yyj7++ + if yyhl7 { + yyb7 = yyj7 > l + } else { + yyb7 = r.CheckBreak() + } + if yyb7 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj7-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *IDRange) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeInt(int64(x.Min)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("min")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeInt(int64(x.Min)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeInt(int64(x.Max)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("max")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeInt(int64(x.Max)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *IDRange) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *IDRange) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "min": + if r.TryDecodeAsNil() { + x.Min = 0 + } else { + x.Min = int64(r.DecodeInt(64)) + } + case "max": + if r.TryDecodeAsNil() { + x.Max = 0 + } else { + x.Max = int64(r.DecodeInt(64)) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *IDRange) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Min = 0 + } else { + x.Min = int64(r.DecodeInt(64)) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Max = 0 + } else { + x.Max = int64(r.DecodeInt(64)) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x RunAsUserStrategy) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x)) + } +} + +func (x *RunAsUserStrategy) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() + } +} + +func (x *PodSecurityPolicyList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = true + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yy4 := &x.ListMeta + yym5 := z.EncBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.EncExt(yy4) { + } else { + z.EncFallback(yy4) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ListMeta + yym7 := z.EncBinary() + _ = yym7 + if false { + } else if z.HasExtensions() && z.EncExt(yy6) { + } else { + z.EncFallback(yy6) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym9 := z.EncBinary() + _ = yym9 + if false { + } else { + h.encSlicePodSecurityPolicy(([]PodSecurityPolicy)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + h.encSlicePodSecurityPolicy(([]PodSecurityPolicy)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PodSecurityPolicyList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PodSecurityPolicyList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv4 := &x.ListMeta + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + z.DecFallback(yyv4, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv6 := &x.Items + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + h.decSlicePodSecurityPolicy((*[]PodSecurityPolicy)(yyv6), d) + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PodSecurityPolicyList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_unversioned.ListMeta{} + } else { + yyv11 := &x.ListMeta + yym12 := z.DecBinary() + _ = yym12 + if false { + } else if z.HasExtensions() && z.DecExt(yyv11) { + } else { + z.DecFallback(yyv11, false) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv13 := &x.Items + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + h.decSlicePodSecurityPolicy((*[]PodSecurityPolicy)(yyv13), d) + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) encSliceCustomMetricTarget(v []CustomMetricTarget, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceCustomMetricTarget(v *[]CustomMetricTarget, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []CustomMetricTarget{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]CustomMetricTarget, yyrl1) + } + } else { + yyv1 = make([]CustomMetricTarget, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricTarget{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, CustomMetricTarget{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricTarget{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, CustomMetricTarget{}) // var yyz1 CustomMetricTarget + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricTarget{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []CustomMetricTarget{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceCustomMetricCurrentStatus(v []CustomMetricCurrentStatus, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceCustomMetricCurrentStatus(v *[]CustomMetricCurrentStatus, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []CustomMetricCurrentStatus{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]CustomMetricCurrentStatus, yyrl1) + } + } else { + yyv1 = make([]CustomMetricCurrentStatus, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricCurrentStatus{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, CustomMetricCurrentStatus{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricCurrentStatus{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, CustomMetricCurrentStatus{}) // var yyz1 CustomMetricCurrentStatus + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = CustomMetricCurrentStatus{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []CustomMetricCurrentStatus{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + func (x codecSelfer1234) encSliceHorizontalPodAutoscaler(v []HorizontalPodAutoscaler, e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1132 := range v { - yy1133 := &yyv1132 - yy1133.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceHorizontalPodAutoscaler(v *[]HorizontalPodAutoscaler, d *codec1978.Decoder) { @@ -12745,75 +19832,86 @@ func (x codecSelfer1234) decSliceHorizontalPodAutoscaler(v *[]HorizontalPodAutos z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1134 := *v - yyh1134, yyl1134 := z.DecSliceHelperStart() - - var yyrr1134, yyrl1134 int - var yyc1134, yyrt1134 bool - _, _, _ = yyc1134, yyrt1134, yyrl1134 - yyrr1134 = yyl1134 - - if yyv1134 == nil { - if yyrl1134, yyrt1134 = z.DecInferLen(yyl1134, z.DecBasicHandle().MaxInitLen, 336); yyrt1134 { - yyrr1134 = yyrl1134 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []HorizontalPodAutoscaler{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1134 = make([]HorizontalPodAutoscaler, yyrl1134) - yyc1134 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1134 == 0 { - if len(yyv1134) != 0 { - yyv1134 = yyv1134[:0] - yyc1134 = true - } - } else if yyl1134 > 0 { - - if yyl1134 > cap(yyv1134) { - yyrl1134, yyrt1134 = z.DecInferLen(yyl1134, z.DecBasicHandle().MaxInitLen, 336) - yyv1134 = make([]HorizontalPodAutoscaler, yyrl1134) - yyc1134 = true - - yyrr1134 = len(yyv1134) - } else if yyl1134 != len(yyv1134) { - yyv1134 = yyv1134[:yyl1134] - yyc1134 = true - } - yyj1134 := 0 - for ; yyj1134 < yyrr1134; yyj1134++ { - if r.TryDecodeAsNil() { - yyv1134[yyj1134] = HorizontalPodAutoscaler{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 312) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]HorizontalPodAutoscaler, yyrl1) + } } else { - yyv1135 := &yyv1134[yyj1134] - yyv1135.CodecDecodeSelf(d) + yyv1 = make([]HorizontalPodAutoscaler, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HorizontalPodAutoscaler{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1134 { - for ; yyj1134 < yyl1134; yyj1134++ { - yyv1134 = append(yyv1134, HorizontalPodAutoscaler{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, HorizontalPodAutoscaler{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1134[yyj1134] = HorizontalPodAutoscaler{} + yyv1[yyj1] = HorizontalPodAutoscaler{} } else { - yyv1136 := &yyv1134[yyj1134] - yyv1136.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1134 := 0; !r.CheckBreak(); yyj1134++ { - if yyj1134 >= len(yyv1134) { - yyv1134 = append(yyv1134, HorizontalPodAutoscaler{}) // var yyz1134 HorizontalPodAutoscaler - yyc1134 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1134 < len(yyv1134) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, HorizontalPodAutoscaler{}) // var yyz1 HorizontalPodAutoscaler + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1134[yyj1134] = HorizontalPodAutoscaler{} + yyv1[yyj1] = HorizontalPodAutoscaler{} } else { - yyv1137 := &yyv1134[yyj1134] - yyv1137.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -12821,12 +19919,18 @@ func (x codecSelfer1234) decSliceHorizontalPodAutoscaler(v *[]HorizontalPodAutos } } - yyh1134.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []HorizontalPodAutoscaler{} + yyc1 = true + } } - if yyc1134 { - *v = yyv1134 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceAPIVersion(v []APIVersion, e *codec1978.Encoder) { @@ -12834,11 +19938,12 @@ func (x codecSelfer1234) encSliceAPIVersion(v []APIVersion, e *codec1978.Encoder z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1138 := range v { - yy1139 := &yyv1138 - yy1139.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceAPIVersion(v *[]APIVersion, d *codec1978.Decoder) { @@ -12846,75 +19951,86 @@ func (x codecSelfer1234) decSliceAPIVersion(v *[]APIVersion, d *codec1978.Decode z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1140 := *v - yyh1140, yyl1140 := z.DecSliceHelperStart() - - var yyrr1140, yyrl1140 int - var yyc1140, yyrt1140 bool - _, _, _ = yyc1140, yyrt1140, yyrl1140 - yyrr1140 = yyl1140 - - if yyv1140 == nil { - if yyrl1140, yyrt1140 = z.DecInferLen(yyl1140, z.DecBasicHandle().MaxInitLen, 32); yyrt1140 { - yyrr1140 = yyrl1140 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []APIVersion{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1140 = make([]APIVersion, yyrl1140) - yyc1140 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1140 == 0 { - if len(yyv1140) != 0 { - yyv1140 = yyv1140[:0] - yyc1140 = true - } - } else if yyl1140 > 0 { - - if yyl1140 > cap(yyv1140) { - yyrl1140, yyrt1140 = z.DecInferLen(yyl1140, z.DecBasicHandle().MaxInitLen, 32) - yyv1140 = make([]APIVersion, yyrl1140) - yyc1140 = true - - yyrr1140 = len(yyv1140) - } else if yyl1140 != len(yyv1140) { - yyv1140 = yyv1140[:yyl1140] - yyc1140 = true - } - yyj1140 := 0 - for ; yyj1140 < yyrr1140; yyj1140++ { - if r.TryDecodeAsNil() { - yyv1140[yyj1140] = APIVersion{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]APIVersion, yyrl1) + } } else { - yyv1141 := &yyv1140[yyj1140] - yyv1141.CodecDecodeSelf(d) + yyv1 = make([]APIVersion, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = APIVersion{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1140 { - for ; yyj1140 < yyl1140; yyj1140++ { - yyv1140 = append(yyv1140, APIVersion{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, APIVersion{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1140[yyj1140] = APIVersion{} + yyv1[yyj1] = APIVersion{} } else { - yyv1142 := &yyv1140[yyj1140] - yyv1142.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1140 := 0; !r.CheckBreak(); yyj1140++ { - if yyj1140 >= len(yyv1140) { - yyv1140 = append(yyv1140, APIVersion{}) // var yyz1140 APIVersion - yyc1140 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1140 < len(yyv1140) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, APIVersion{}) // var yyz1 APIVersion + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1140[yyj1140] = APIVersion{} + yyv1[yyj1] = APIVersion{} } else { - yyv1143 := &yyv1140[yyj1140] - yyv1143.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -12922,12 +20038,18 @@ func (x codecSelfer1234) decSliceAPIVersion(v *[]APIVersion, d *codec1978.Decode } } - yyh1140.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []APIVersion{} + yyc1 = true + } } - if yyc1140 { - *v = yyv1140 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceThirdPartyResource(v []ThirdPartyResource, e *codec1978.Encoder) { @@ -12935,11 +20057,12 @@ func (x codecSelfer1234) encSliceThirdPartyResource(v []ThirdPartyResource, e *c z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1144 := range v { - yy1145 := &yyv1144 - yy1145.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceThirdPartyResource(v *[]ThirdPartyResource, d *codec1978.Decoder) { @@ -12947,75 +20070,86 @@ func (x codecSelfer1234) decSliceThirdPartyResource(v *[]ThirdPartyResource, d * z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1146 := *v - yyh1146, yyl1146 := z.DecSliceHelperStart() - - var yyrr1146, yyrl1146 int - var yyc1146, yyrt1146 bool - _, _, _ = yyc1146, yyrt1146, yyrl1146 - yyrr1146 = yyl1146 - - if yyv1146 == nil { - if yyrl1146, yyrt1146 = z.DecInferLen(yyl1146, z.DecBasicHandle().MaxInitLen, 232); yyrt1146 { - yyrr1146 = yyrl1146 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ThirdPartyResource{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1146 = make([]ThirdPartyResource, yyrl1146) - yyc1146 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1146 == 0 { - if len(yyv1146) != 0 { - yyv1146 = yyv1146[:0] - yyc1146 = true - } - } else if yyl1146 > 0 { - - if yyl1146 > cap(yyv1146) { - yyrl1146, yyrt1146 = z.DecInferLen(yyl1146, z.DecBasicHandle().MaxInitLen, 232) - yyv1146 = make([]ThirdPartyResource, yyrl1146) - yyc1146 = true - - yyrr1146 = len(yyv1146) - } else if yyl1146 != len(yyv1146) { - yyv1146 = yyv1146[:yyl1146] - yyc1146 = true - } - yyj1146 := 0 - for ; yyj1146 < yyrr1146; yyj1146++ { - if r.TryDecodeAsNil() { - yyv1146[yyj1146] = ThirdPartyResource{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 232) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ThirdPartyResource, yyrl1) + } } else { - yyv1147 := &yyv1146[yyj1146] - yyv1147.CodecDecodeSelf(d) + yyv1 = make([]ThirdPartyResource, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ThirdPartyResource{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1146 { - for ; yyj1146 < yyl1146; yyj1146++ { - yyv1146 = append(yyv1146, ThirdPartyResource{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ThirdPartyResource{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1146[yyj1146] = ThirdPartyResource{} + yyv1[yyj1] = ThirdPartyResource{} } else { - yyv1148 := &yyv1146[yyj1146] - yyv1148.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1146 := 0; !r.CheckBreak(); yyj1146++ { - if yyj1146 >= len(yyv1146) { - yyv1146 = append(yyv1146, ThirdPartyResource{}) // var yyz1146 ThirdPartyResource - yyc1146 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1146 < len(yyv1146) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ThirdPartyResource{}) // var yyz1 ThirdPartyResource + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1146[yyj1146] = ThirdPartyResource{} + yyv1[yyj1] = ThirdPartyResource{} } else { - yyv1149 := &yyv1146[yyj1146] - yyv1149.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13023,12 +20157,18 @@ func (x codecSelfer1234) decSliceThirdPartyResource(v *[]ThirdPartyResource, d * } } - yyh1146.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ThirdPartyResource{} + yyc1 = true + } } - if yyc1146 { - *v = yyv1146 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceDeployment(v []Deployment, e *codec1978.Encoder) { @@ -13036,11 +20176,12 @@ func (x codecSelfer1234) encSliceDeployment(v []Deployment, e *codec1978.Encoder z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1150 := range v { - yy1151 := &yyv1150 - yy1151.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decoder) { @@ -13048,75 +20189,86 @@ func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decode z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1152 := *v - yyh1152, yyl1152 := z.DecSliceHelperStart() - - var yyrr1152, yyrl1152 int - var yyc1152, yyrt1152 bool - _, _, _ = yyc1152, yyrt1152, yyrl1152 - yyrr1152 = yyl1152 - - if yyv1152 == nil { - if yyrl1152, yyrt1152 = z.DecInferLen(yyl1152, z.DecBasicHandle().MaxInitLen, 264); yyrt1152 { - yyrr1152 = yyrl1152 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Deployment{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1152 = make([]Deployment, yyrl1152) - yyc1152 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1152 == 0 { - if len(yyv1152) != 0 { - yyv1152 = yyv1152[:0] - yyc1152 = true - } - } else if yyl1152 > 0 { - - if yyl1152 > cap(yyv1152) { - yyrl1152, yyrt1152 = z.DecInferLen(yyl1152, z.DecBasicHandle().MaxInitLen, 264) - yyv1152 = make([]Deployment, yyrl1152) - yyc1152 = true - - yyrr1152 = len(yyv1152) - } else if yyl1152 != len(yyv1152) { - yyv1152 = yyv1152[:yyl1152] - yyc1152 = true - } - yyj1152 := 0 - for ; yyj1152 < yyrr1152; yyj1152++ { - if r.TryDecodeAsNil() { - yyv1152[yyj1152] = Deployment{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 632) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Deployment, yyrl1) + } } else { - yyv1153 := &yyv1152[yyj1152] - yyv1153.CodecDecodeSelf(d) + yyv1 = make([]Deployment, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Deployment{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1152 { - for ; yyj1152 < yyl1152; yyj1152++ { - yyv1152 = append(yyv1152, Deployment{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Deployment{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1152[yyj1152] = Deployment{} + yyv1[yyj1] = Deployment{} } else { - yyv1154 := &yyv1152[yyj1152] - yyv1154.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1152 := 0; !r.CheckBreak(); yyj1152++ { - if yyj1152 >= len(yyv1152) { - yyv1152 = append(yyv1152, Deployment{}) // var yyz1152 Deployment - yyc1152 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1152 < len(yyv1152) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Deployment{}) // var yyz1 Deployment + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1152[yyj1152] = Deployment{} + yyv1[yyj1] = Deployment{} } else { - yyv1155 := &yyv1152[yyj1152] - yyv1155.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13124,12 +20276,18 @@ func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decode } } - yyh1152.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Deployment{} + yyc1 = true + } } - if yyc1152 { - *v = yyv1152 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceDaemonSet(v []DaemonSet, e *codec1978.Encoder) { @@ -13137,11 +20295,12 @@ func (x codecSelfer1234) encSliceDaemonSet(v []DaemonSet, e *codec1978.Encoder) z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1156 := range v { - yy1157 := &yyv1156 - yy1157.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder) { @@ -13149,75 +20308,86 @@ func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder) z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1158 := *v - yyh1158, yyl1158 := z.DecSliceHelperStart() - - var yyrr1158, yyrl1158 int - var yyc1158, yyrt1158 bool - _, _, _ = yyc1158, yyrt1158, yyrl1158 - yyrr1158 = yyl1158 - - if yyv1158 == nil { - if yyrl1158, yyrt1158 = z.DecInferLen(yyl1158, z.DecBasicHandle().MaxInitLen, 232); yyrt1158 { - yyrr1158 = yyrl1158 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []DaemonSet{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1158 = make([]DaemonSet, yyrl1158) - yyc1158 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1158 == 0 { - if len(yyv1158) != 0 { - yyv1158 = yyv1158[:0] - yyc1158 = true - } - } else if yyl1158 > 0 { - - if yyl1158 > cap(yyv1158) { - yyrl1158, yyrt1158 = z.DecInferLen(yyl1158, z.DecBasicHandle().MaxInitLen, 232) - yyv1158 = make([]DaemonSet, yyrl1158) - yyc1158 = true - - yyrr1158 = len(yyv1158) - } else if yyl1158 != len(yyv1158) { - yyv1158 = yyv1158[:yyl1158] - yyc1158 = true - } - yyj1158 := 0 - for ; yyj1158 < yyrr1158; yyj1158++ { - if r.TryDecodeAsNil() { - yyv1158[yyj1158] = DaemonSet{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 568) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]DaemonSet, yyrl1) + } } else { - yyv1159 := &yyv1158[yyj1158] - yyv1159.CodecDecodeSelf(d) + yyv1 = make([]DaemonSet, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = DaemonSet{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1158 { - for ; yyj1158 < yyl1158; yyj1158++ { - yyv1158 = append(yyv1158, DaemonSet{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, DaemonSet{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1158[yyj1158] = DaemonSet{} + yyv1[yyj1] = DaemonSet{} } else { - yyv1160 := &yyv1158[yyj1158] - yyv1160.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1158 := 0; !r.CheckBreak(); yyj1158++ { - if yyj1158 >= len(yyv1158) { - yyv1158 = append(yyv1158, DaemonSet{}) // var yyz1158 DaemonSet - yyc1158 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1158 < len(yyv1158) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, DaemonSet{}) // var yyz1 DaemonSet + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1158[yyj1158] = DaemonSet{} + yyv1[yyj1] = DaemonSet{} } else { - yyv1161 := &yyv1158[yyj1158] - yyv1161.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13225,12 +20395,18 @@ func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder) } } - yyh1158.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []DaemonSet{} + yyc1 = true + } } - if yyc1158 { - *v = yyv1158 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceThirdPartyResourceData(v []ThirdPartyResourceData, e *codec1978.Encoder) { @@ -13238,11 +20414,12 @@ func (x codecSelfer1234) encSliceThirdPartyResourceData(v []ThirdPartyResourceDa z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1162 := range v { - yy1163 := &yyv1162 - yy1163.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceThirdPartyResourceData(v *[]ThirdPartyResourceData, d *codec1978.Decoder) { @@ -13250,75 +20427,86 @@ func (x codecSelfer1234) decSliceThirdPartyResourceData(v *[]ThirdPartyResourceD z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1164 := *v - yyh1164, yyl1164 := z.DecSliceHelperStart() - - var yyrr1164, yyrl1164 int - var yyc1164, yyrt1164 bool - _, _, _ = yyc1164, yyrt1164, yyrl1164 - yyrr1164 = yyl1164 - - if yyv1164 == nil { - if yyrl1164, yyrt1164 = z.DecInferLen(yyl1164, z.DecBasicHandle().MaxInitLen, 216); yyrt1164 { - yyrr1164 = yyrl1164 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ThirdPartyResourceData{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1164 = make([]ThirdPartyResourceData, yyrl1164) - yyc1164 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1164 == 0 { - if len(yyv1164) != 0 { - yyv1164 = yyv1164[:0] - yyc1164 = true - } - } else if yyl1164 > 0 { - - if yyl1164 > cap(yyv1164) { - yyrl1164, yyrt1164 = z.DecInferLen(yyl1164, z.DecBasicHandle().MaxInitLen, 216) - yyv1164 = make([]ThirdPartyResourceData, yyrl1164) - yyc1164 = true - - yyrr1164 = len(yyv1164) - } else if yyl1164 != len(yyv1164) { - yyv1164 = yyv1164[:yyl1164] - yyc1164 = true - } - yyj1164 := 0 - for ; yyj1164 < yyrr1164; yyj1164++ { - if r.TryDecodeAsNil() { - yyv1164[yyj1164] = ThirdPartyResourceData{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 216) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ThirdPartyResourceData, yyrl1) + } } else { - yyv1165 := &yyv1164[yyj1164] - yyv1165.CodecDecodeSelf(d) + yyv1 = make([]ThirdPartyResourceData, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ThirdPartyResourceData{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1164 { - for ; yyj1164 < yyl1164; yyj1164++ { - yyv1164 = append(yyv1164, ThirdPartyResourceData{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ThirdPartyResourceData{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1164[yyj1164] = ThirdPartyResourceData{} + yyv1[yyj1] = ThirdPartyResourceData{} } else { - yyv1166 := &yyv1164[yyj1164] - yyv1166.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1164 := 0; !r.CheckBreak(); yyj1164++ { - if yyj1164 >= len(yyv1164) { - yyv1164 = append(yyv1164, ThirdPartyResourceData{}) // var yyz1164 ThirdPartyResourceData - yyc1164 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1164 < len(yyv1164) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ThirdPartyResourceData{}) // var yyz1 ThirdPartyResourceData + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1164[yyj1164] = ThirdPartyResourceData{} + yyv1[yyj1] = ThirdPartyResourceData{} } else { - yyv1167 := &yyv1164[yyj1164] - yyv1167.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13326,12 +20514,18 @@ func (x codecSelfer1234) decSliceThirdPartyResourceData(v *[]ThirdPartyResourceD } } - yyh1164.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ThirdPartyResourceData{} + yyc1 = true + } } - if yyc1164 { - *v = yyv1164 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceJob(v []Job, e *codec1978.Encoder) { @@ -13339,11 +20533,12 @@ func (x codecSelfer1234) encSliceJob(v []Job, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1168 := range v { - yy1169 := &yyv1168 - yy1169.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) { @@ -13351,75 +20546,86 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1170 := *v - yyh1170, yyl1170 := z.DecSliceHelperStart() - - var yyrr1170, yyrl1170 int - var yyc1170, yyrt1170 bool - _, _, _ = yyc1170, yyrt1170, yyrl1170 - yyrr1170 = yyl1170 - - if yyv1170 == nil { - if yyrl1170, yyrt1170 = z.DecInferLen(yyl1170, z.DecBasicHandle().MaxInitLen, 632); yyrt1170 { - yyrr1170 = yyrl1170 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Job{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1170 = make([]Job, yyrl1170) - yyc1170 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1170 == 0 { - if len(yyv1170) != 0 { - yyv1170 = yyv1170[:0] - yyc1170 = true - } - } else if yyl1170 > 0 { - - if yyl1170 > cap(yyv1170) { - yyrl1170, yyrt1170 = z.DecInferLen(yyl1170, z.DecBasicHandle().MaxInitLen, 632) - yyv1170 = make([]Job, yyrl1170) - yyc1170 = true - - yyrr1170 = len(yyv1170) - } else if yyl1170 != len(yyv1170) { - yyv1170 = yyv1170[:yyl1170] - yyc1170 = true - } - yyj1170 := 0 - for ; yyj1170 < yyrr1170; yyj1170++ { - if r.TryDecodeAsNil() { - yyv1170[yyj1170] = Job{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 632) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Job, yyrl1) + } } else { - yyv1171 := &yyv1170[yyj1170] - yyv1171.CodecDecodeSelf(d) + yyv1 = make([]Job, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Job{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1170 { - for ; yyj1170 < yyl1170; yyj1170++ { - yyv1170 = append(yyv1170, Job{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Job{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1170[yyj1170] = Job{} + yyv1[yyj1] = Job{} } else { - yyv1172 := &yyv1170[yyj1170] - yyv1172.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1170 := 0; !r.CheckBreak(); yyj1170++ { - if yyj1170 >= len(yyv1170) { - yyv1170 = append(yyv1170, Job{}) // var yyz1170 Job - yyc1170 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1170 < len(yyv1170) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Job{}) // var yyz1 Job + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1170[yyj1170] = Job{} + yyv1[yyj1] = Job{} } else { - yyv1173 := &yyv1170[yyj1170] - yyv1173.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13427,12 +20633,18 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) { } } - yyh1170.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Job{} + yyc1 = true + } } - if yyc1170 { - *v = yyv1170 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceJobCondition(v []JobCondition, e *codec1978.Encoder) { @@ -13440,11 +20652,12 @@ func (x codecSelfer1234) encSliceJobCondition(v []JobCondition, e *codec1978.Enc z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1174 := range v { - yy1175 := &yyv1174 - yy1175.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceJobCondition(v *[]JobCondition, d *codec1978.Decoder) { @@ -13452,75 +20665,86 @@ func (x codecSelfer1234) decSliceJobCondition(v *[]JobCondition, d *codec1978.De z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1176 := *v - yyh1176, yyl1176 := z.DecSliceHelperStart() - - var yyrr1176, yyrl1176 int - var yyc1176, yyrt1176 bool - _, _, _ = yyc1176, yyrt1176, yyrl1176 - yyrr1176 = yyl1176 - - if yyv1176 == nil { - if yyrl1176, yyrt1176 = z.DecInferLen(yyl1176, z.DecBasicHandle().MaxInitLen, 112); yyrt1176 { - yyrr1176 = yyrl1176 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []JobCondition{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1176 = make([]JobCondition, yyrl1176) - yyc1176 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1176 == 0 { - if len(yyv1176) != 0 { - yyv1176 = yyv1176[:0] - yyc1176 = true - } - } else if yyl1176 > 0 { - - if yyl1176 > cap(yyv1176) { - yyrl1176, yyrt1176 = z.DecInferLen(yyl1176, z.DecBasicHandle().MaxInitLen, 112) - yyv1176 = make([]JobCondition, yyrl1176) - yyc1176 = true - - yyrr1176 = len(yyv1176) - } else if yyl1176 != len(yyv1176) { - yyv1176 = yyv1176[:yyl1176] - yyc1176 = true - } - yyj1176 := 0 - for ; yyj1176 < yyrr1176; yyj1176++ { - if r.TryDecodeAsNil() { - yyv1176[yyj1176] = JobCondition{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 112) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]JobCondition, yyrl1) + } } else { - yyv1177 := &yyv1176[yyj1176] - yyv1177.CodecDecodeSelf(d) + yyv1 = make([]JobCondition, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = JobCondition{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1176 { - for ; yyj1176 < yyl1176; yyj1176++ { - yyv1176 = append(yyv1176, JobCondition{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, JobCondition{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1176[yyj1176] = JobCondition{} + yyv1[yyj1] = JobCondition{} } else { - yyv1178 := &yyv1176[yyj1176] - yyv1178.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1176 := 0; !r.CheckBreak(); yyj1176++ { - if yyj1176 >= len(yyv1176) { - yyv1176 = append(yyv1176, JobCondition{}) // var yyz1176 JobCondition - yyc1176 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1176 < len(yyv1176) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, JobCondition{}) // var yyz1 JobCondition + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1176[yyj1176] = JobCondition{} + yyv1[yyj1] = JobCondition{} } else { - yyv1179 := &yyv1176[yyj1176] - yyv1179.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13528,12 +20752,18 @@ func (x codecSelfer1234) decSliceJobCondition(v *[]JobCondition, d *codec1978.De } } - yyh1176.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []JobCondition{} + yyc1 = true + } } - if yyc1176 { - *v = yyv1176 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceIngress(v []Ingress, e *codec1978.Encoder) { @@ -13541,11 +20771,12 @@ func (x codecSelfer1234) encSliceIngress(v []Ingress, e *codec1978.Encoder) { z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1180 := range v { - yy1181 := &yyv1180 - yy1181.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceIngress(v *[]Ingress, d *codec1978.Decoder) { @@ -13553,75 +20784,86 @@ func (x codecSelfer1234) decSliceIngress(v *[]Ingress, d *codec1978.Decoder) { z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1182 := *v - yyh1182, yyl1182 := z.DecSliceHelperStart() - - var yyrr1182, yyrl1182 int - var yyc1182, yyrt1182 bool - _, _, _ = yyc1182, yyrt1182, yyrl1182 - yyrr1182 = yyl1182 - - if yyv1182 == nil { - if yyrl1182, yyrt1182 = z.DecInferLen(yyl1182, z.DecBasicHandle().MaxInitLen, 248); yyrt1182 { - yyrr1182 = yyrl1182 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Ingress{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1182 = make([]Ingress, yyrl1182) - yyc1182 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1182 == 0 { - if len(yyv1182) != 0 { - yyv1182 = yyv1182[:0] - yyc1182 = true - } - } else if yyl1182 > 0 { - - if yyl1182 > cap(yyv1182) { - yyrl1182, yyrt1182 = z.DecInferLen(yyl1182, z.DecBasicHandle().MaxInitLen, 248) - yyv1182 = make([]Ingress, yyrl1182) - yyc1182 = true - - yyrr1182 = len(yyv1182) - } else if yyl1182 != len(yyv1182) { - yyv1182 = yyv1182[:yyl1182] - yyc1182 = true - } - yyj1182 := 0 - for ; yyj1182 < yyrr1182; yyj1182++ { - if r.TryDecodeAsNil() { - yyv1182[yyj1182] = Ingress{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 272) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Ingress, yyrl1) + } } else { - yyv1183 := &yyv1182[yyj1182] - yyv1183.CodecDecodeSelf(d) + yyv1 = make([]Ingress, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Ingress{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1182 { - for ; yyj1182 < yyl1182; yyj1182++ { - yyv1182 = append(yyv1182, Ingress{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Ingress{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1182[yyj1182] = Ingress{} + yyv1[yyj1] = Ingress{} } else { - yyv1184 := &yyv1182[yyj1182] - yyv1184.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1182 := 0; !r.CheckBreak(); yyj1182++ { - if yyj1182 >= len(yyv1182) { - yyv1182 = append(yyv1182, Ingress{}) // var yyz1182 Ingress - yyc1182 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1182 < len(yyv1182) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Ingress{}) // var yyz1 Ingress + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1182[yyj1182] = Ingress{} + yyv1[yyj1] = Ingress{} } else { - yyv1185 := &yyv1182[yyj1182] - yyv1185.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13629,12 +20871,137 @@ func (x codecSelfer1234) decSliceIngress(v *[]Ingress, d *codec1978.Decoder) { } } - yyh1182.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Ingress{} + yyc1 = true + } } - if yyc1182 { - *v = yyv1182 + yyh1.End() + if yyc1 { + *v = yyv1 } +} +func (x codecSelfer1234) encSliceIngressTLS(v []IngressTLS, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceIngressTLS(v *[]IngressTLS, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []IngressTLS{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 40) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]IngressTLS, yyrl1) + } + } else { + yyv1 = make([]IngressTLS, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IngressTLS{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, IngressTLS{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IngressTLS{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, IngressTLS{}) // var yyz1 IngressTLS + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = IngressTLS{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []IngressTLS{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } } func (x codecSelfer1234) encSliceIngressRule(v []IngressRule, e *codec1978.Encoder) { @@ -13642,11 +21009,12 @@ func (x codecSelfer1234) encSliceIngressRule(v []IngressRule, e *codec1978.Encod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1186 := range v { - yy1187 := &yyv1186 - yy1187.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceIngressRule(v *[]IngressRule, d *codec1978.Decoder) { @@ -13654,75 +21022,86 @@ func (x codecSelfer1234) decSliceIngressRule(v *[]IngressRule, d *codec1978.Deco z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1188 := *v - yyh1188, yyl1188 := z.DecSliceHelperStart() - - var yyrr1188, yyrl1188 int - var yyc1188, yyrt1188 bool - _, _, _ = yyc1188, yyrt1188, yyrl1188 - yyrr1188 = yyl1188 - - if yyv1188 == nil { - if yyrl1188, yyrt1188 = z.DecInferLen(yyl1188, z.DecBasicHandle().MaxInitLen, 24); yyrt1188 { - yyrr1188 = yyrl1188 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []IngressRule{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1188 = make([]IngressRule, yyrl1188) - yyc1188 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1188 == 0 { - if len(yyv1188) != 0 { - yyv1188 = yyv1188[:0] - yyc1188 = true - } - } else if yyl1188 > 0 { - - if yyl1188 > cap(yyv1188) { - yyrl1188, yyrt1188 = z.DecInferLen(yyl1188, z.DecBasicHandle().MaxInitLen, 24) - yyv1188 = make([]IngressRule, yyrl1188) - yyc1188 = true - - yyrr1188 = len(yyv1188) - } else if yyl1188 != len(yyv1188) { - yyv1188 = yyv1188[:yyl1188] - yyc1188 = true - } - yyj1188 := 0 - for ; yyj1188 < yyrr1188; yyj1188++ { - if r.TryDecodeAsNil() { - yyv1188[yyj1188] = IngressRule{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]IngressRule, yyrl1) + } } else { - yyv1189 := &yyv1188[yyj1188] - yyv1189.CodecDecodeSelf(d) + yyv1 = make([]IngressRule, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IngressRule{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1188 { - for ; yyj1188 < yyl1188; yyj1188++ { - yyv1188 = append(yyv1188, IngressRule{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, IngressRule{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1188[yyj1188] = IngressRule{} + yyv1[yyj1] = IngressRule{} } else { - yyv1190 := &yyv1188[yyj1188] - yyv1190.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1188 := 0; !r.CheckBreak(); yyj1188++ { - if yyj1188 >= len(yyv1188) { - yyv1188 = append(yyv1188, IngressRule{}) // var yyz1188 IngressRule - yyc1188 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1188 < len(yyv1188) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, IngressRule{}) // var yyz1 IngressRule + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1188[yyj1188] = IngressRule{} + yyv1[yyj1] = IngressRule{} } else { - yyv1191 := &yyv1188[yyj1188] - yyv1191.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13730,12 +21109,18 @@ func (x codecSelfer1234) decSliceIngressRule(v *[]IngressRule, d *codec1978.Deco } } - yyh1188.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []IngressRule{} + yyc1 = true + } } - if yyc1188 { - *v = yyv1188 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceHTTPIngressPath(v []HTTPIngressPath, e *codec1978.Encoder) { @@ -13743,11 +21128,12 @@ func (x codecSelfer1234) encSliceHTTPIngressPath(v []HTTPIngressPath, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1192 := range v { - yy1193 := &yyv1192 - yy1193.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceHTTPIngressPath(v *[]HTTPIngressPath, d *codec1978.Decoder) { @@ -13755,75 +21141,86 @@ func (x codecSelfer1234) decSliceHTTPIngressPath(v *[]HTTPIngressPath, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1194 := *v - yyh1194, yyl1194 := z.DecSliceHelperStart() - - var yyrr1194, yyrl1194 int - var yyc1194, yyrt1194 bool - _, _, _ = yyc1194, yyrt1194, yyrl1194 - yyrr1194 = yyl1194 - - if yyv1194 == nil { - if yyrl1194, yyrt1194 = z.DecInferLen(yyl1194, z.DecBasicHandle().MaxInitLen, 64); yyrt1194 { - yyrr1194 = yyrl1194 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []HTTPIngressPath{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1194 = make([]HTTPIngressPath, yyrl1194) - yyc1194 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1194 == 0 { - if len(yyv1194) != 0 { - yyv1194 = yyv1194[:0] - yyc1194 = true - } - } else if yyl1194 > 0 { - - if yyl1194 > cap(yyv1194) { - yyrl1194, yyrt1194 = z.DecInferLen(yyl1194, z.DecBasicHandle().MaxInitLen, 64) - yyv1194 = make([]HTTPIngressPath, yyrl1194) - yyc1194 = true - - yyrr1194 = len(yyv1194) - } else if yyl1194 != len(yyv1194) { - yyv1194 = yyv1194[:yyl1194] - yyc1194 = true - } - yyj1194 := 0 - for ; yyj1194 < yyrr1194; yyj1194++ { - if r.TryDecodeAsNil() { - yyv1194[yyj1194] = HTTPIngressPath{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 64) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]HTTPIngressPath, yyrl1) + } } else { - yyv1195 := &yyv1194[yyj1194] - yyv1195.CodecDecodeSelf(d) + yyv1 = make([]HTTPIngressPath, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HTTPIngressPath{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1194 { - for ; yyj1194 < yyl1194; yyj1194++ { - yyv1194 = append(yyv1194, HTTPIngressPath{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, HTTPIngressPath{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1194[yyj1194] = HTTPIngressPath{} + yyv1[yyj1] = HTTPIngressPath{} } else { - yyv1196 := &yyv1194[yyj1194] - yyv1196.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1194 := 0; !r.CheckBreak(); yyj1194++ { - if yyj1194 >= len(yyv1194) { - yyv1194 = append(yyv1194, HTTPIngressPath{}) // var yyz1194 HTTPIngressPath - yyc1194 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1194 < len(yyv1194) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, HTTPIngressPath{}) // var yyz1 HTTPIngressPath + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1194[yyj1194] = HTTPIngressPath{} + yyv1[yyj1] = HTTPIngressPath{} } else { - yyv1197 := &yyv1194[yyj1194] - yyv1197.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13831,12 +21228,18 @@ func (x codecSelfer1234) decSliceHTTPIngressPath(v *[]HTTPIngressPath, d *codec1 } } - yyh1194.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []HTTPIngressPath{} + yyc1 = true + } } - if yyc1194 { - *v = yyv1194 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceNodeUtilization(v []NodeUtilization, e *codec1978.Encoder) { @@ -13844,11 +21247,12 @@ func (x codecSelfer1234) encSliceNodeUtilization(v []NodeUtilization, e *codec19 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1198 := range v { - yy1199 := &yyv1198 - yy1199.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceNodeUtilization(v *[]NodeUtilization, d *codec1978.Decoder) { @@ -13856,75 +21260,86 @@ func (x codecSelfer1234) decSliceNodeUtilization(v *[]NodeUtilization, d *codec1 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1200 := *v - yyh1200, yyl1200 := z.DecSliceHelperStart() - - var yyrr1200, yyrl1200 int - var yyc1200, yyrt1200 bool - _, _, _ = yyc1200, yyrt1200, yyrl1200 - yyrr1200 = yyl1200 - - if yyv1200 == nil { - if yyrl1200, yyrt1200 = z.DecInferLen(yyl1200, z.DecBasicHandle().MaxInitLen, 24); yyrt1200 { - yyrr1200 = yyrl1200 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []NodeUtilization{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1200 = make([]NodeUtilization, yyrl1200) - yyc1200 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1200 == 0 { - if len(yyv1200) != 0 { - yyv1200 = yyv1200[:0] - yyc1200 = true - } - } else if yyl1200 > 0 { - - if yyl1200 > cap(yyv1200) { - yyrl1200, yyrt1200 = z.DecInferLen(yyl1200, z.DecBasicHandle().MaxInitLen, 24) - yyv1200 = make([]NodeUtilization, yyrl1200) - yyc1200 = true - - yyrr1200 = len(yyv1200) - } else if yyl1200 != len(yyv1200) { - yyv1200 = yyv1200[:yyl1200] - yyc1200 = true - } - yyj1200 := 0 - for ; yyj1200 < yyrr1200; yyj1200++ { - if r.TryDecodeAsNil() { - yyv1200[yyj1200] = NodeUtilization{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]NodeUtilization, yyrl1) + } } else { - yyv1201 := &yyv1200[yyj1200] - yyv1201.CodecDecodeSelf(d) + yyv1 = make([]NodeUtilization, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = NodeUtilization{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1200 { - for ; yyj1200 < yyl1200; yyj1200++ { - yyv1200 = append(yyv1200, NodeUtilization{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, NodeUtilization{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1200[yyj1200] = NodeUtilization{} + yyv1[yyj1] = NodeUtilization{} } else { - yyv1202 := &yyv1200[yyj1200] - yyv1202.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1200 := 0; !r.CheckBreak(); yyj1200++ { - if yyj1200 >= len(yyv1200) { - yyv1200 = append(yyv1200, NodeUtilization{}) // var yyz1200 NodeUtilization - yyc1200 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1200 < len(yyv1200) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, NodeUtilization{}) // var yyz1 NodeUtilization + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1200[yyj1200] = NodeUtilization{} + yyv1[yyj1] = NodeUtilization{} } else { - yyv1203 := &yyv1200[yyj1200] - yyv1203.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -13932,12 +21347,18 @@ func (x codecSelfer1234) decSliceNodeUtilization(v *[]NodeUtilization, d *codec1 } } - yyh1200.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []NodeUtilization{} + yyc1 = true + } } - if yyc1200 { - *v = yyv1200 + yyh1.End() + if yyc1 { + *v = yyv1 } - } func (x codecSelfer1234) encSliceClusterAutoscaler(v []ClusterAutoscaler, e *codec1978.Encoder) { @@ -13945,11 +21366,12 @@ func (x codecSelfer1234) encSliceClusterAutoscaler(v []ClusterAutoscaler, e *cod z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1204 := range v { - yy1205 := &yyv1204 - yy1205.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } func (x codecSelfer1234) decSliceClusterAutoscaler(v *[]ClusterAutoscaler, d *codec1978.Decoder) { @@ -13957,75 +21379,86 @@ func (x codecSelfer1234) decSliceClusterAutoscaler(v *[]ClusterAutoscaler, d *co z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1206 := *v - yyh1206, yyl1206 := z.DecSliceHelperStart() - - var yyrr1206, yyrl1206 int - var yyc1206, yyrt1206 bool - _, _, _ = yyc1206, yyrt1206, yyrl1206 - yyrr1206 = yyl1206 - - if yyv1206 == nil { - if yyrl1206, yyrt1206 = z.DecInferLen(yyl1206, z.DecBasicHandle().MaxInitLen, 232); yyrt1206 { - yyrr1206 = yyrl1206 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ClusterAutoscaler{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1206 = make([]ClusterAutoscaler, yyrl1206) - yyc1206 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1206 == 0 { - if len(yyv1206) != 0 { - yyv1206 = yyv1206[:0] - yyc1206 = true - } - } else if yyl1206 > 0 { - - if yyl1206 > cap(yyv1206) { - yyrl1206, yyrt1206 = z.DecInferLen(yyl1206, z.DecBasicHandle().MaxInitLen, 232) - yyv1206 = make([]ClusterAutoscaler, yyrl1206) - yyc1206 = true - - yyrr1206 = len(yyv1206) - } else if yyl1206 != len(yyv1206) { - yyv1206 = yyv1206[:yyl1206] - yyc1206 = true - } - yyj1206 := 0 - for ; yyj1206 < yyrr1206; yyj1206++ { - if r.TryDecodeAsNil() { - yyv1206[yyj1206] = ClusterAutoscaler{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 224) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ClusterAutoscaler, yyrl1) + } } else { - yyv1207 := &yyv1206[yyj1206] - yyv1207.CodecDecodeSelf(d) + yyv1 = make([]ClusterAutoscaler, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ClusterAutoscaler{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1206 { - for ; yyj1206 < yyl1206; yyj1206++ { - yyv1206 = append(yyv1206, ClusterAutoscaler{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ClusterAutoscaler{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1206[yyj1206] = ClusterAutoscaler{} + yyv1[yyj1] = ClusterAutoscaler{} } else { - yyv1208 := &yyv1206[yyj1206] - yyv1208.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1206 := 0; !r.CheckBreak(); yyj1206++ { - if yyj1206 >= len(yyv1206) { - yyv1206 = append(yyv1206, ClusterAutoscaler{}) // var yyz1206 ClusterAutoscaler - yyc1206 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1206 < len(yyv1206) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ClusterAutoscaler{}) // var yyz1 ClusterAutoscaler + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1206[yyj1206] = ClusterAutoscaler{} + yyv1[yyj1] = ClusterAutoscaler{} } else { - yyv1209 := &yyv1206[yyj1206] - yyv1209.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -14033,100 +21466,118 @@ func (x codecSelfer1234) decSliceClusterAutoscaler(v *[]ClusterAutoscaler, d *co } } - yyh1206.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ClusterAutoscaler{} + yyc1 = true + } } - if yyc1206 { - *v = yyv1206 + yyh1.End() + if yyc1 { + *v = yyv1 } - } -func (x codecSelfer1234) encSlicePodSelectorRequirement(v []PodSelectorRequirement, e *codec1978.Encoder) { +func (x codecSelfer1234) encSliceLabelSelectorRequirement(v []LabelSelectorRequirement, e *codec1978.Encoder) { var h codecSelfer1234 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.EncodeArrayStart(len(v)) - for _, yyv1210 := range v { - yy1211 := &yyv1210 - yy1211.CodecEncodeSelf(e) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) } - r.EncodeEnd() + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) } -func (x codecSelfer1234) decSlicePodSelectorRequirement(v *[]PodSelectorRequirement, d *codec1978.Decoder) { +func (x codecSelfer1234) decSliceLabelSelectorRequirement(v *[]LabelSelectorRequirement, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yyv1212 := *v - yyh1212, yyl1212 := z.DecSliceHelperStart() - - var yyrr1212, yyrl1212 int - var yyc1212, yyrt1212 bool - _, _, _ = yyc1212, yyrt1212, yyrl1212 - yyrr1212 = yyl1212 - - if yyv1212 == nil { - if yyrl1212, yyrt1212 = z.DecInferLen(yyl1212, z.DecBasicHandle().MaxInitLen, 56); yyrt1212 { - yyrr1212 = yyrl1212 + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []LabelSelectorRequirement{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true } - yyv1212 = make([]PodSelectorRequirement, yyrl1212) - yyc1212 = true - } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { - if yyl1212 == 0 { - if len(yyv1212) != 0 { - yyv1212 = yyv1212[:0] - yyc1212 = true - } - } else if yyl1212 > 0 { - - if yyl1212 > cap(yyv1212) { - yyrl1212, yyrt1212 = z.DecInferLen(yyl1212, z.DecBasicHandle().MaxInitLen, 56) - yyv1212 = make([]PodSelectorRequirement, yyrl1212) - yyc1212 = true - - yyrr1212 = len(yyv1212) - } else if yyl1212 != len(yyv1212) { - yyv1212 = yyv1212[:yyl1212] - yyc1212 = true - } - yyj1212 := 0 - for ; yyj1212 < yyrr1212; yyj1212++ { - if r.TryDecodeAsNil() { - yyv1212[yyj1212] = PodSelectorRequirement{} + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 56) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]LabelSelectorRequirement, yyrl1) + } } else { - yyv1213 := &yyv1212[yyj1212] - yyv1213.CodecDecodeSelf(d) + yyv1 = make([]LabelSelectorRequirement, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = LabelSelectorRequirement{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) } } - if yyrt1212 { - for ; yyj1212 < yyl1212; yyj1212++ { - yyv1212 = append(yyv1212, PodSelectorRequirement{}) + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, LabelSelectorRequirement{}) + yyh1.ElemContainerState(yyj1) if r.TryDecodeAsNil() { - yyv1212[yyj1212] = PodSelectorRequirement{} + yyv1[yyj1] = LabelSelectorRequirement{} } else { - yyv1214 := &yyv1212[yyj1212] - yyv1214.CodecDecodeSelf(d) + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) } } } } else { - for yyj1212 := 0; !r.CheckBreak(); yyj1212++ { - if yyj1212 >= len(yyv1212) { - yyv1212 = append(yyv1212, PodSelectorRequirement{}) // var yyz1212 PodSelectorRequirement - yyc1212 = true - } + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { - if yyj1212 < len(yyv1212) { + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, LabelSelectorRequirement{}) // var yyz1 LabelSelectorRequirement + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { if r.TryDecodeAsNil() { - yyv1212[yyj1212] = PodSelectorRequirement{} + yyv1[yyj1] = LabelSelectorRequirement{} } else { - yyv1215 := &yyv1212[yyj1212] - yyv1215.CodecDecodeSelf(d) + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) } } else { @@ -14134,10 +21585,713 @@ func (x codecSelfer1234) decSlicePodSelectorRequirement(v *[]PodSelectorRequirem } } - yyh1212.End() + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []LabelSelectorRequirement{} + yyc1 = true + } } - if yyc1212 { - *v = yyv1212 + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceReplicaSet(v []ReplicaSet, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceReplicaSet(v *[]ReplicaSet, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ReplicaSet{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 232) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ReplicaSet, yyrl1) + } + } else { + yyv1 = make([]ReplicaSet, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ReplicaSet{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ReplicaSet{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ReplicaSet{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ReplicaSet{}) // var yyz1 ReplicaSet + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = ReplicaSet{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ReplicaSet{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSlicev1_Capability(v []pkg2_v1.Capability, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yysf2 := &yyv1 + yysf2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSlicev1_Capability(v *[]pkg2_v1.Capability, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []pkg2_v1.Capability{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]pkg2_v1.Capability, yyrl1) + } + } else { + yyv1 = make([]pkg2_v1.Capability, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = pkg2_v1.Capability(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = pkg2_v1.Capability(r.DecodeString()) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 pkg2_v1.Capability + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = pkg2_v1.Capability(r.DecodeString()) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []pkg2_v1.Capability{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceFSType(v []FSType, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yyv1.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceFSType(v *[]FSType, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []FSType{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]FSType, yyrl1) + } + } else { + yyv1 = make([]FSType, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FSType(r.DecodeString()) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, "") + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FSType(r.DecodeString()) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, "") // var yyz1 FSType + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = "" + } else { + yyv1[yyj1] = FSType(r.DecodeString()) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []FSType{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceHostPortRange(v []HostPortRange, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceHostPortRange(v *[]HostPortRange, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []HostPortRange{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]HostPortRange, yyrl1) + } + } else { + yyv1 = make([]HostPortRange, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HostPortRange{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, HostPortRange{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = HostPortRange{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, HostPortRange{}) // var yyz1 HostPortRange + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = HostPortRange{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []HostPortRange{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceIDRange(v []IDRange, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceIDRange(v *[]IDRange, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []IDRange{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 16) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]IDRange, yyrl1) + } + } else { + yyv1 = make([]IDRange, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IDRange{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, IDRange{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = IDRange{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, IDRange{}) // var yyz1 IDRange + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = IDRange{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []IDRange{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSlicePodSecurityPolicy(v []PodSecurityPolicy, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSlicePodSecurityPolicy(v *[]PodSecurityPolicy, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PodSecurityPolicy{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 352) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PodSecurityPolicy, yyrl1) + } + } else { + yyv1 = make([]PodSecurityPolicy, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodSecurityPolicy{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PodSecurityPolicy{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodSecurityPolicy{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PodSecurityPolicy{}) // var yyz1 PodSecurityPolicy + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = PodSecurityPolicy{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PodSecurityPolicy{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 } - } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types.go index 7ab25c256..4de157e3c 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types.go @@ -17,26 +17,29 @@ limitations under the License. package v1beta1 import ( + "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/v1" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) // describes the attributes of a scale subresource type ScaleSpec struct { // desired number of instances for the scaled object. - Replicas int `json:"replicas,omitempty"` + Replicas int32 `json:"replicas,omitempty"` } // represents the current status of a scale subresource. type ScaleStatus struct { // actual number of observed instances of the scaled object. - Replicas int `json:"replicas"` + Replicas int32 `json:"replicas"` // label query over pods that should match the replicas count. More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors Selector map[string]string `json:"selector,omitempty"` } +// +genclient=true,noMethods=true + // represents a scaling request for a resource. type Scale struct { unversioned.TypeMeta `json:",inline"` @@ -59,8 +62,6 @@ type ReplicationControllerDummy struct { type SubresourceReference struct { // Kind of the referent; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds" Kind string `json:"kind,omitempty"` - // Namespace of the referent; More info: http://releases.k8s.io/HEAD/docs/user-guide/namespaces.md - Namespace string `json:"namespace,omitempty"` // Name of the referent; More info: http://releases.k8s.io/HEAD/docs/user-guide/identifiers.md#names Name string `json:"name,omitempty"` // API version of the referent @@ -72,7 +73,30 @@ type SubresourceReference struct { type CPUTargetUtilization struct { // fraction of the requested CPU that should be utilized/used, // e.g. 70 means that 70% of the requested CPU should be in use. - TargetPercentage int `json:"targetPercentage"` + TargetPercentage int32 `json:"targetPercentage"` +} + +// Alpha-level support for Custom Metrics in HPA (as annotations). +type CustomMetricTarget struct { + // Custom Metric name. + Name string `json:"name"` + // Custom Metric value (average). + TargetValue resource.Quantity `json:"value"` +} + +type CustomMetricTargetList struct { + Items []CustomMetricTarget `json:"items"` +} + +type CustomMetricCurrentStatus struct { + // Custom Metric name. + Name string `json:"name"` + // Custom Metric value (average). + CurrentValue resource.Quantity `json:"value"` +} + +type CustomMetricCurrentStatusList struct { + Items []CustomMetricCurrentStatus `json:"items"` } // specification of a horizontal pod autoscaler. @@ -81,9 +105,9 @@ type HorizontalPodAutoscalerSpec struct { // and will set the desired number of pods by modifying its spec. ScaleRef SubresourceReference `json:"scaleRef"` // lower limit for the number of pods that can be set by the autoscaler, default 1. - MinReplicas *int `json:"minReplicas,omitempty"` + MinReplicas *int32 `json:"minReplicas,omitempty"` // upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas. - MaxReplicas int `json:"maxReplicas"` + MaxReplicas int32 `json:"maxReplicas"` // target average CPU utilization (represented as a percentage of requested CPU) over all the pods; // if not specified it defaults to the target CPU utilization at 80% of the requested resources. CPUUtilization *CPUTargetUtilization `json:"cpuUtilization,omitempty"` @@ -99,16 +123,18 @@ type HorizontalPodAutoscalerStatus struct { LastScaleTime *unversioned.Time `json:"lastScaleTime,omitempty"` // current number of replicas of pods managed by this autoscaler. - CurrentReplicas int `json:"currentReplicas"` + CurrentReplicas int32 `json:"currentReplicas"` // desired number of replicas of pods managed by this autoscaler. - DesiredReplicas int `json:"desiredReplicas"` + DesiredReplicas int32 `json:"desiredReplicas"` // current average CPU utilization over all pods, represented as a percentage of requested CPU, // e.g. 70 means that an average pod is using now 70% of its requested CPU. - CurrentCPUUtilizationPercentage *int `json:"currentCPUUtilizationPercentage,omitempty"` + CurrentCPUUtilizationPercentage *int32 `json:"currentCPUUtilizationPercentage,omitempty"` } +// +genclient=true + // configuration of a horizontal pod autoscaler. type HorizontalPodAutoscaler struct { unversioned.TypeMeta `json:",inline"` @@ -132,6 +158,8 @@ type HorizontalPodAutoscalerList struct { Items []HorizontalPodAutoscaler `json:"items"` } +// +genclient=true + // A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource // types to the API. It consists of one or more Versions of the api. type ThirdPartyResource struct { @@ -174,10 +202,12 @@ type ThirdPartyResourceData struct { v1.ObjectMeta `json:"metadata,omitempty"` // Data is the raw JSON data for this data. - Data []byte `json:"name,omitempty"` + Data []byte `json:"data,omitempty"` } -// Deployment enables declarative updates for Pods and ReplicationControllers. +// +genclient=true + +// Deployment enables declarative updates for Pods and ReplicaSets. type Deployment struct { unversioned.TypeMeta `json:",inline"` // Standard object metadata. @@ -194,29 +224,57 @@ type Deployment struct { type DeploymentSpec struct { // Number of desired pods. This is a pointer to distinguish between explicit // zero and not specified. Defaults to 1. - Replicas *int `json:"replicas,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` - // Label selector for pods. Existing ReplicationControllers whose pods are + // Label selector for pods. Existing ReplicaSets whose pods are // selected by this will be the ones affected by this deployment. - Selector map[string]string `json:"selector,omitempty"` + Selector *LabelSelector `json:"selector,omitempty"` // Template describes the pods that will be created. - Template *v1.PodTemplateSpec `json:"template,omitempty"` + Template v1.PodTemplateSpec `json:"template"` // The deployment strategy to use to replace existing pods with new ones. Strategy DeploymentStrategy `json:"strategy,omitempty"` - // Key of the selector that is added to existing RCs (and label key that is - // added to its pods) to prevent the existing RCs to select new pods (and old - // pods being selected by new RC). - // Users can set this to an empty string to indicate that the system should - // not add any selector and label. If unspecified, system uses - // "deployment.kubernetes.io/podTemplateHash". - // Value of this key is hash of DeploymentSpec.PodTemplateSpec. - // No label is added if this is set to empty string. - UniqueLabelKey *string `json:"uniqueLabelKey,omitempty"` + // Minimum number of seconds for which a newly created pod should be ready + // without any of its container crashing, for it to be considered available. + // Defaults to 0 (pod will be considered available as soon as it is ready) + MinReadySeconds int32 `json:"minReadySeconds,omitempty"` + + // The number of old ReplicaSets to retain to allow rollback. + // This is a pointer to distinguish between explicit zero and not specified. + RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` + + // Indicates that the deployment is paused and will not be processed by the + // deployment controller. + Paused bool `json:"paused,omitempty"` + // The config this deployment is rolling back to. Will be cleared after rollback is done. + RollbackTo *RollbackConfig `json:"rollbackTo,omitempty"` } +// DeploymentRollback stores the information required to rollback a deployment. +type DeploymentRollback struct { + unversioned.TypeMeta `json:",inline"` + // Required: This must match the Name of a deployment. + Name string `json:"name"` + // The annotations to be updated to a deployment + UpdatedAnnotations map[string]string `json:"updatedAnnotations,omitempty"` + // The config of this deployment rollback. + RollbackTo RollbackConfig `json:"rollbackTo"` +} + +type RollbackConfig struct { + // The revision to rollback to. If set to 0, rollbck to the last revision. + Revision int64 `json:"revision,omitempty"` +} + +const ( + // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added + // to existing RCs (and label key that is added to its pods) to prevent the existing RCs + // to select new pods (and old pods being select by new RC). + DefaultDeploymentUniqueLabelKey string = "pod-template-hash" +) + // DeploymentStrategy describes how to replace existing pods with new ones. type DeploymentStrategy struct { // Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. @@ -252,7 +310,7 @@ type RollingUpdateDeployment struct { // can be scaled down further, followed by scaling up the new RC, ensuring // that the total number of pods available at all times during the update is at // least 70% of desired pods. - MaxUnavailable *util.IntOrString `json:"maxUnavailable,omitempty"` + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` // The maximum number of pods that can be scheduled above the desired number of // pods. @@ -265,21 +323,22 @@ type RollingUpdateDeployment struct { // 130% of desired pods. Once old pods have been killed, // new RC can be scaled up further, ensuring that total number of pods running // at any time during the update is atmost 130% of desired pods. - MaxSurge *util.IntOrString `json:"maxSurge,omitempty"` - - // Minimum number of seconds for which a newly created pod should be ready - // without any of its container crashing, for it to be considered available. - // Defaults to 0 (pod will be considered available as soon as it is ready) - MinReadySeconds int `json:"minReadySeconds,omitempty"` + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"` } // DeploymentStatus is the most recently observed status of the Deployment. type DeploymentStatus struct { // Total number of non-terminated pods targeted by this deployment (their labels match the selector). - Replicas int `json:"replicas,omitempty"` + Replicas int32 `json:"replicas,omitempty"` // Total number of non-terminated pods targeted by this deployment that have the desired template spec. - UpdatedReplicas int `json:"updatedReplicas,omitempty"` + UpdatedReplicas int32 `json:"updatedReplicas,omitempty"` + + // Total number of available pods (ready for at least minReadySeconds) targeted by this deployment. + AvailableReplicas int32 `json:"availableReplicas,omitempty"` + + // Total number of unavailable pods targeted by this deployment. + UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"` } // DeploymentList is a list of Deployments. @@ -292,40 +351,110 @@ type DeploymentList struct { Items []Deployment `json:"items"` } +// TODO(madhusudancs): Uncomment while implementing DaemonSet updates. +/* Commenting out for v1.2. We are planning to bring these types back with a more robust DaemonSet update implementation in v1.3, hence not deleting but just commenting the types out. +type DaemonSetUpdateStrategy struct { + // Type of daemon set update. Only "RollingUpdate" is supported at this time. Default is RollingUpdate. + Type DaemonSetUpdateStrategyType `json:"type,omitempty"` + + // Rolling update config params. Present only if DaemonSetUpdateStrategy = + // RollingUpdate. + //--- + // TODO: Update this to follow our convention for oneOf, whatever we decide it + // to be. Same as DeploymentStrategy.RollingUpdate. + RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty"` +} + +type DaemonSetUpdateStrategyType string + +const ( + // Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other. + RollingUpdateDaemonSetStrategyType DaemonSetUpdateStrategyType = "RollingUpdate" +) + +// Spec to control the desired behavior of daemon set rolling update. +type RollingUpdateDaemonSet struct { + // The maximum number of DaemonSet pods that can be unavailable during the + // update. Value can be an absolute number (ex: 5) or a percentage of total + // number of DaemonSet pods at the start of the update (ex: 10%). Absolute + // number is calculated from percentage by rounding up. + // This cannot be 0. + // Default value is 1. + // Example: when this is set to 30%, 30% of the currently running DaemonSet + // pods can be stopped for an update at any given time. The update starts + // by stopping at most 30% of the currently running DaemonSet pods and then + // brings up new DaemonSet pods in their place. Once the new pods are ready, + // it then proceeds onto other DaemonSet pods, thus ensuring that at least + // 70% of original number of DaemonSet pods are available at all times + // during the update. + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` + + // Minimum number of seconds for which a newly created DaemonSet pod should + // be ready without any of its container crashing, for it to be considered + // available. Defaults to 0 (pod will be considered available as soon as it + // is ready). + MinReadySeconds int32 `json:"minReadySeconds,omitempty"` +} +*/ + // DaemonSetSpec is the specification of a daemon set. type DaemonSetSpec struct { // Selector is a label query over pods that are managed by the daemon set. // Must match in order to be controlled. // If empty, defaulted to labels on Pod template. // More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors - Selector map[string]string `json:"selector,omitempty"` + Selector *LabelSelector `json:"selector,omitempty"` // Template is the object that describes the pod that will be created. // The DaemonSet will create exactly one copy of this pod on every node // that matches the template's node selector (or on every node if no node // selector is specified). // More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#pod-template - Template *v1.PodTemplateSpec `json:"template,omitempty"` + Template v1.PodTemplateSpec `json:"template"` + + // TODO(madhusudancs): Uncomment while implementing DaemonSet updates. + /* Commenting out for v1.2. We are planning to bring these fields back with a more robust DaemonSet update implementation in v1.3, hence not deleting but just commenting these fields out. + // Update strategy to replace existing DaemonSet pods with new pods. + UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy,omitempty"` + + // Label key that is added to DaemonSet pods to distinguish between old and + // new pod templates during DaemonSet update. + // Users can set this to an empty string to indicate that the system should + // not add any label. If unspecified, system uses + // DefaultDaemonSetUniqueLabelKey("daemonset.kubernetes.io/podTemplateHash"). + // Value of this key is hash of DaemonSetSpec.PodTemplateSpec. + // No label is added if this is set to empty string. + UniqueLabelKey *string `json:"uniqueLabelKey,omitempty"` + */ } +const ( + // DefaultDaemonSetUniqueLabelKey is the default key of the labels that is added + // to daemon set pods to distinguish between old and new pod templates during + // DaemonSet update. See DaemonSetSpec's UniqueLabelKey field for more information. + DefaultDaemonSetUniqueLabelKey string = "daemonset.kubernetes.io/podTemplateHash" +) + // DaemonSetStatus represents the current status of a daemon set. type DaemonSetStatus struct { // CurrentNumberScheduled is the number of nodes that are running at least 1 // daemon pod and are supposed to run the daemon pod. // More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md - CurrentNumberScheduled int `json:"currentNumberScheduled"` + CurrentNumberScheduled int32 `json:"currentNumberScheduled"` // NumberMisscheduled is the number of nodes that are running the daemon pod, but are // not supposed to run the daemon pod. // More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md - NumberMisscheduled int `json:"numberMisscheduled"` + NumberMisscheduled int32 `json:"numberMisscheduled"` // DesiredNumberScheduled is the total number of nodes that should be running the daemon // pod (including nodes correctly running the daemon pod). // More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md - DesiredNumberScheduled int `json:"desiredNumberScheduled"` + DesiredNumberScheduled int32 `json:"desiredNumberScheduled"` } +// +genclient=true + // DaemonSet represents the configuration of a daemon set. type DaemonSet struct { unversioned.TypeMeta `json:",inline"` @@ -367,6 +496,8 @@ type ThirdPartyResourceDataList struct { Items []ThirdPartyResourceData `json:"items"` } +// +genclient=true + // Job represents the configuration of a single job. type Job struct { unversioned.TypeMeta `json:",inline"` @@ -402,16 +533,22 @@ type JobSpec struct { // be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), // i.e. when the work left to do is less than max parallelism. // More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md - Parallelism *int `json:"parallelism,omitempty"` + Parallelism *int32 `json:"parallelism,omitempty"` // Completions specifies the desired number of successfully finished pods the - // job should be run with. Defaults to 1. - // More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md - Completions *int `json:"completions,omitempty"` + // job should be run with. Setting to nil means that the success of any + // pod signals the success of all pods, and allows parallelism to have any positive + // value. Setting to 1 means that parallelism is limited to 1 and the success of that + // pod signals the success of the job. + Completions *int32 `json:"completions,omitempty"` + + // Optional duration in seconds relative to the startTime that the job may be active + // before the system tries to terminate it; value must be positive integer + ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"` // Selector is a label query over pods that should match the pod count. // More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors - Selector *PodSelector `json:"selector,omitempty"` + Selector *LabelSelector `json:"selector,omitempty"` // Template is the object that describes the pod that will be created when // executing a job. @@ -437,13 +574,13 @@ type JobStatus struct { CompletionTime *unversioned.Time `json:"completionTime,omitempty"` // Active is the number of actively running pods. - Active int `json:"active,omitempty"` + Active int32 `json:"active,omitempty"` // Succeeded is the number of pods which reached Phase Succeeded. - Succeeded int `json:"succeeded,omitempty"` + Succeeded int32 `json:"succeeded,omitempty"` // Failed is the number of pods which reached Phase Failed. - Failed int `json:"failed,omitempty"` + Failed int32 `json:"failed,omitempty"` } type JobConditionType string @@ -452,11 +589,13 @@ type JobConditionType string const ( // JobComplete means the job has completed its execution. JobComplete JobConditionType = "Complete" + // JobFailed means the job has failed its execution. + JobFailed JobConditionType = "Failed" ) // JobCondition describes current state of a job. type JobCondition struct { - // Type of job condition, currently only Complete. + // Type of job condition, Complete or Failed. Type JobConditionType `json:"type"` // Status of the condition, one of True, False, Unknown. Status v1.ConditionStatus `json:"status"` @@ -470,6 +609,8 @@ type JobCondition struct { Message string `json:"message,omitempty"` } +// +genclient=true + // Ingress is a collection of rules that allow inbound connections to reach the // endpoints defined by a backend. An Ingress can be configured to give services // externally-reachable urls, load balance traffic, terminate SSL, offer name @@ -507,12 +648,35 @@ type IngressSpec struct { // is optional to allow the loadbalancer controller or defaulting logic to // specify a global default. Backend *IngressBackend `json:"backend,omitempty"` + + // TLS configuration. Currently the Ingress only supports a single TLS + // port, 443, and assumes TLS termination. If multiple members of this + // list specify different hosts, they will be multiplexed on the same + // port according to the hostname specified through the SNI TLS extension. + TLS []IngressTLS `json:"tls,omitempty"` + // A list of host rules used to configure the Ingress. If unspecified, or // no rule matches, all traffic is sent to the default backend. Rules []IngressRule `json:"rules,omitempty"` // TODO: Add the ability to specify load-balancer IP through claims } +// IngressTLS describes the transport layer security associated with an Ingress. +type IngressTLS struct { + // Hosts are a list of hosts included in the TLS certificate. The values in + // this list must match the name/s used in the tlsSecret. Defaults to the + // wildcard host setting for the loadbalancer controller fulfilling this + // Ingress, if left unspecified. + Hosts []string `json:"hosts,omitempty"` + // SecretName is the name of the secret used to terminate SSL traffic on 443. + // Field is left optional to allow SSL routing based on SNI hostname alone. + // If the SNI host in a listener conflicts with the "Host" header field used + // by an IngressRule, the SNI host is used for termination and value of the + // Host header is used for routing. + SecretName string `json:"secretName,omitempty"` + // TODO: Consider specifying different modes of termination, protocols etc. +} + // IngressStatus describe the current state of the Ingress. type IngressStatus struct { // LoadBalancer contains the current status of the load-balancer. @@ -593,7 +757,7 @@ type IngressBackend struct { ServiceName string `json:"serviceName"` // Specifies the port of the referenced service. - ServicePort util.IntOrString `json:"servicePort"` + ServicePort intstr.IntOrString `json:"servicePort"` } type NodeResource string @@ -623,10 +787,10 @@ type NodeUtilization struct { // Configuration of the Cluster Autoscaler type ClusterAutoscalerSpec struct { // Minimum number of nodes that the cluster should have. - MinNodes int `json:"minNodes"` + MinNodes int32 `json:"minNodes"` // Maximum number of nodes that the cluster should have. - MaxNodes int `json:"maxNodes"` + MaxNodes int32 `json:"maxNodes"` // Target average utilization of the cluster nodes. New nodes will be added if one of the // targets is exceeded. Cluster size will be decreased if the current utilization is too low @@ -657,26 +821,55 @@ type ClusterAutoscalerList struct { Items []ClusterAutoscaler `json:"items"` } -// A pod selector is a label query over a set of pods. The result of matchLabels and -// matchExpressions are ANDed. An empty pod selector matches all objects. A null -// pod selector matches no objects. -type PodSelector struct { +// ExportOptions is the query options to the standard REST get call. +type ExportOptions struct { + unversioned.TypeMeta `json:",inline"` + // Should this value be exported. Export strips fields that a user can not specify. + Export bool `json:"export"` + // Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace' + Exact bool `json:"exact"` +} + +// ListOptions is the query options to a standard REST list call. +type ListOptions struct { + unversioned.TypeMeta `json:",inline"` + + // A selector to restrict the list of returned objects by their labels. + // Defaults to everything. + LabelSelector string `json:"labelSelector,omitempty"` + // A selector to restrict the list of returned objects by their fields. + // Defaults to everything. + FieldSelector string `json:"fieldSelector,omitempty"` + // Watch for changes to the described resources and return them as a stream of + // add, update, and remove notifications. Specify resourceVersion. + Watch bool `json:"watch,omitempty"` + // When specified with a watch call, shows changes that occur after that particular version of a resource. + // Defaults to changes from the beginning of history. + ResourceVersion string `json:"resourceVersion,omitempty"` + // Timeout for the list/watch call. + TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` +} + +// A label selector is a label query over a set of resources. The result of matchLabels and +// matchExpressions are ANDed. An empty label selector matches all objects. A null +// label selector matches no objects. +type LabelSelector struct { // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels // map is equivalent to an element of matchExpressions, whose key field is "key", the // operator is "In", and the values array contains only "value". The requirements are ANDed. MatchLabels map[string]string `json:"matchLabels,omitempty"` - // matchExpressions is a list of pod selector requirements. The requirements are ANDed. - MatchExpressions []PodSelectorRequirement `json:"matchExpressions,omitempty"` + // matchExpressions is a list of label selector requirements. The requirements are ANDed. + MatchExpressions []LabelSelectorRequirement `json:"matchExpressions,omitempty"` } -// A pod selector requirement is a selector that contains values, a key, and an operator that +// A label selector requirement is a selector that contains values, a key, and an operator that // relates the key and values. -type PodSelectorRequirement struct { +type LabelSelectorRequirement struct { // key is the label key that the selector applies to. Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key"` // operator represents a key's relationship to a set of values. // Valid operators ard In, NotIn, Exists and DoesNotExist. - Operator PodSelectorOperator `json:"operator"` + Operator LabelSelectorOperator `json:"operator"` // values is an array of string values. If the operator is In or NotIn, // the values array must be non-empty. If the operator is Exists or DoesNotExist, // the values array must be empty. This array is replaced during a strategic @@ -684,12 +877,202 @@ type PodSelectorRequirement struct { Values []string `json:"values,omitempty"` } -// A pod selector operator is the set of operators that can be used in a selector requirement. -type PodSelectorOperator string +// A label selector operator is the set of operators that can be used in a selector requirement. +type LabelSelectorOperator string const ( - PodSelectorOpIn PodSelectorOperator = "In" - PodSelectorOpNotIn PodSelectorOperator = "NotIn" - PodSelectorOpExists PodSelectorOperator = "Exists" - PodSelectorOpDoesNotExist PodSelectorOperator = "DoesNotExist" + LabelSelectorOpIn LabelSelectorOperator = "In" + LabelSelectorOpNotIn LabelSelectorOperator = "NotIn" + LabelSelectorOpExists LabelSelectorOperator = "Exists" + LabelSelectorOpDoesNotExist LabelSelectorOperator = "DoesNotExist" ) + +// +genclient=true + +// ReplicaSet represents the configuration of a ReplicaSet. +type ReplicaSet struct { + unversioned.TypeMeta `json:",inline"` + + // If the Labels of a ReplicaSet are empty, they are defaulted to + // be the same as the Pod(s) that the ReplicaSet manages. + // Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + v1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the specification of the desired behavior of the ReplicaSet. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status + Spec ReplicaSetSpec `json:"spec,omitempty"` + + // Status is the most recently observed status of the ReplicaSet. + // This data may be out of date by some window of time. + // Populated by the system. + // Read-only. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status + Status ReplicaSetStatus `json:"status,omitempty"` +} + +// ReplicaSetList is a collection of ReplicaSets. +type ReplicaSetList struct { + unversioned.TypeMeta `json:",inline"` + // Standard list metadata. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds + unversioned.ListMeta `json:"metadata,omitempty"` + + // List of ReplicaSets. + // More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md + Items []ReplicaSet `json:"items"` +} + +// ReplicaSetSpec is the specification of a ReplicaSet. +type ReplicaSetSpec struct { + // Replicas is the number of desired replicas. + // This is a pointer to distinguish between explicit zero and unspecified. + // Defaults to 1. + // More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller + Replicas *int32 `json:"replicas,omitempty"` + + // Selector is a label query over pods that should match the replica count. + // If the selector is empty, it is defaulted to the labels present on the pod template. + // Label keys and values that must match in order to be controlled by this replica set. + // More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors + Selector *LabelSelector `json:"selector,omitempty"` + + // Template is the object that describes the pod that will be created if + // insufficient replicas are detected. + // More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#pod-template + Template *v1.PodTemplateSpec `json:"template,omitempty"` +} + +// ReplicaSetStatus represents the current status of a ReplicaSet. +type ReplicaSetStatus struct { + // Replicas is the most recently oberved number of replicas. + // More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller + Replicas int32 `json:"replicas"` + + // ObservedGeneration reflects the generation of the most recently observed ReplicaSet. + ObservedGeneration int64 `json:"observedGeneration,omitempty"` +} + +// Pod Security Policy governs the ability to make requests that affect the Security Context +// that will be applied to a pod and container. +type PodSecurityPolicy struct { + unversioned.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + v1.ObjectMeta `json:"metadata,omitempty"` + + // spec defines the policy enforced. + Spec PodSecurityPolicySpec `json:"spec,omitempty"` +} + +// Pod Security Policy Spec defines the policy enforced. +type PodSecurityPolicySpec struct { + // privileged determines if a pod can request to be run as privileged. + Privileged bool `json:"privileged,omitempty"` + // capabilities is a list of capabilities that can be added. + Capabilities []v1.Capability `json:"capabilities,omitempty"` + // volumes is a white list of allowed volume plugins. Empty indicates that all plugins + // may be used. + Volumes []FSType `json:"volumes,omitempty"` + // hostNetwork determines if the policy allows the use of HostNetwork in the pod spec. + HostNetwork bool `json:"hostNetwork,omitempty"` + // hostPorts determines which host port ranges are allowed to be exposed. + HostPorts []HostPortRange `json:"hostPorts,omitempty"` + // hostPID determines if the policy allows the use of HostPID in the pod spec. + HostPID bool `json:"hostPID,omitempty"` + // hostIPC determines if the policy allows the use of HostIPC in the pod spec. + HostIPC bool `json:"hostIPC,omitempty"` + // seLinuxContext is the strategy that will dictate the allowable labels that may be set. + SELinuxContext SELinuxContextStrategyOptions `json:"seLinuxContext,omitempty"` + // runAsUser is the strategy that will dictate the allowable RunAsUser values that may be set. + RunAsUser RunAsUserStrategyOptions `json:"runAsUser,omitempty"` +} + +// FS Type gives strong typing to different file systems that are used by volumes. +type FSType string + +var ( + HostPath FSType = "hostPath" + EmptyDir FSType = "emptyDir" + GCEPersistentDisk FSType = "gcePersistentDisk" + AWSElasticBlockStore FSType = "awsElasticBlockStore" + GitRepo FSType = "gitRepo" + Secret FSType = "secret" + NFS FSType = "nfs" + ISCSI FSType = "iscsi" + Glusterfs FSType = "glusterfs" + PersistentVolumeClaim FSType = "persistentVolumeClaim" + RBD FSType = "rbd" + Cinder FSType = "cinder" + CephFS FSType = "cephFS" + DownwardAPI FSType = "downwardAPI" + FC FSType = "fc" +) + +// Host Port Range defines a range of host ports that will be enabled by a policy +// for pods to use. It requires both the start and end to be defined. +type HostPortRange struct { + // min is the start of the range, inclusive. + Min int32 `json:"min"` + // max is the end of the range, inclusive. + Max int32 `json:"max"` +} + +// SELinux Context Strategy Options defines the strategy type and any options used to create the strategy. +type SELinuxContextStrategyOptions struct { + // type is the strategy that will dictate the allowable labels that may be set. + Type SELinuxContextStrategy `json:"type"` + // seLinuxOptions required to run as; required for MustRunAs + // More info: http://releases.k8s.io/HEAD/docs/design/security_context.md#security-context + SELinuxOptions *v1.SELinuxOptions `json:"seLinuxOptions,omitempty"` +} + +// SELinux Context Strategy Type denotes strategy types for generating SELinux options for a +// Security Context. +type SELinuxContextStrategy string + +const ( + // container must have SELinux labels of X applied. + SELinuxStrategyMustRunAs SELinuxContextStrategy = "MustRunAs" + // container may make requests for any SELinux context labels. + SELinuxStrategyRunAsAny SELinuxContextStrategy = "RunAsAny" +) + +// Run A sUser Strategy Options defines the strategy type and any options used to create the strategy. +type RunAsUserStrategyOptions struct { + // type is the strategy that will dictate the allowable RunAsUser values that may be set. + Type RunAsUserStrategy `json:"type"` + // Ranges are the allowed ranges of uids that may be used. + Ranges []IDRange `json:"ranges,omitempty"` +} + +// ID Range provides a min/max of an allowed range of IDs. +type IDRange struct { + // Min is the start of the range, inclusive. + Min int64 `json:"min"` + // Max is the end of the range, inclusive. + Max int64 `json:"max"` +} + +// Run As User Strategy Type denotes strategy types for generating RunAsUser values for a +// Security Context. +type RunAsUserStrategy string + +const ( + // container must run as a particular uid. + RunAsUserStrategyMustRunAs RunAsUserStrategy = "MustRunAs" + // container must run as a non-root uid + RunAsUserStrategyMustRunAsNonRoot RunAsUserStrategy = "MustRunAsNonRoot" + // container may make requests for any uid. + RunAsUserStrategyRunAsAny RunAsUserStrategy = "RunAsAny" +) + +// Pod Security Policy List is a list of PodSecurityPolicy objects. +type PodSecurityPolicyList struct { + unversioned.TypeMeta `json:",inline"` + // Standard list metadata. + // More info: http://docs.k8s.io/api-conventions.md#metadata + unversioned.ListMeta `json:"metadata,omitempty"` + + // Items is a list of schema objects. + Items []PodSecurityPolicy `json:"items"` +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types_swagger_doc_generated.go index 7b26605f0..e6176c293 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/types_swagger_doc_generated.go @@ -74,6 +74,25 @@ func (ClusterAutoscalerSpec) SwaggerDoc() map[string]string { return map_ClusterAutoscalerSpec } +var map_CustomMetricCurrentStatus = map[string]string{ + "name": "Custom Metric name.", + "value": "Custom Metric value (average).", +} + +func (CustomMetricCurrentStatus) SwaggerDoc() map[string]string { + return map_CustomMetricCurrentStatus +} + +var map_CustomMetricTarget = map[string]string{ + "": "Alpha-level support for Custom Metrics in HPA (as annotations).", + "name": "Custom Metric name.", + "value": "Custom Metric value (average).", +} + +func (CustomMetricTarget) SwaggerDoc() map[string]string { + return map_CustomMetricTarget +} + var map_DaemonSet = map[string]string{ "": "DaemonSet represents the configuration of a daemon set.", "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", @@ -117,7 +136,7 @@ func (DaemonSetStatus) SwaggerDoc() map[string]string { } var map_Deployment = map[string]string{ - "": "Deployment enables declarative updates for Pods and ReplicationControllers.", + "": "Deployment enables declarative updates for Pods and ReplicaSets.", "metadata": "Standard object metadata.", "spec": "Specification of the desired behavior of the Deployment.", "status": "Most recently observed status of the Deployment.", @@ -137,13 +156,27 @@ func (DeploymentList) SwaggerDoc() map[string]string { return map_DeploymentList } +var map_DeploymentRollback = map[string]string{ + "": "DeploymentRollback stores the information required to rollback a deployment.", + "name": "Required: This must match the Name of a deployment.", + "updatedAnnotations": "The annotations to be updated to a deployment", + "rollbackTo": "The config of this deployment rollback.", +} + +func (DeploymentRollback) SwaggerDoc() map[string]string { + return map_DeploymentRollback +} + var map_DeploymentSpec = map[string]string{ - "": "DeploymentSpec is the specification of the desired behavior of the Deployment.", - "replicas": "Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.", - "selector": "Label selector for pods. Existing ReplicationControllers whose pods are selected by this will be the ones affected by this deployment.", - "template": "Template describes the pods that will be created.", - "strategy": "The deployment strategy to use to replace existing pods with new ones.", - "uniqueLabelKey": "Key of the selector that is added to existing RCs (and label key that is added to its pods) to prevent the existing RCs to select new pods (and old pods being selected by new RC). Users can set this to an empty string to indicate that the system should not add any selector and label. If unspecified, system uses \"deployment.kubernetes.io/podTemplateHash\". Value of this key is hash of DeploymentSpec.PodTemplateSpec. No label is added if this is set to empty string.", + "": "DeploymentSpec is the specification of the desired behavior of the Deployment.", + "replicas": "Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.", + "selector": "Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment.", + "template": "Template describes the pods that will be created.", + "strategy": "The deployment strategy to use to replace existing pods with new ones.", + "minReadySeconds": "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)", + "revisionHistoryLimit": "The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified.", + "paused": "Indicates that the deployment is paused and will not be processed by the deployment controller.", + "rollbackTo": "The config this deployment is rolling back to. Will be cleared after rollback is done.", } func (DeploymentSpec) SwaggerDoc() map[string]string { @@ -151,9 +184,11 @@ func (DeploymentSpec) SwaggerDoc() map[string]string { } var map_DeploymentStatus = map[string]string{ - "": "DeploymentStatus is the most recently observed status of the Deployment.", - "replicas": "Total number of non-terminated pods targeted by this deployment (their labels match the selector).", - "updatedReplicas": "Total number of non-terminated pods targeted by this deployment that have the desired template spec.", + "": "DeploymentStatus is the most recently observed status of the Deployment.", + "replicas": "Total number of non-terminated pods targeted by this deployment (their labels match the selector).", + "updatedReplicas": "Total number of non-terminated pods targeted by this deployment that have the desired template spec.", + "availableReplicas": "Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.", + "unavailableReplicas": "Total number of unavailable pods targeted by this deployment.", } func (DeploymentStatus) SwaggerDoc() map[string]string { @@ -170,6 +205,16 @@ func (DeploymentStrategy) SwaggerDoc() map[string]string { return map_DeploymentStrategy } +var map_ExportOptions = map[string]string{ + "": "ExportOptions is the query options to the standard REST get call.", + "export": "Should this value be exported. Export strips fields that a user can not specify.", + "exact": "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'", +} + +func (ExportOptions) SwaggerDoc() map[string]string { + return map_ExportOptions +} + var map_HTTPIngressPath = map[string]string{ "": "HTTPIngressPath associates a path regex with a backend. Incoming urls matching the path are forwarded to the backend.", "path": "Path is a extended POSIX regex as defined by IEEE Std 1003.1, (i.e this follows the egrep/unix syntax, not the perl syntax) matched against the path of an incoming request. Currently it can contain characters disallowed from the conventional \"path\" part of a URL as defined by RFC 3986. Paths must begin with a '/'. If unspecified, the path defaults to a catch all sending traffic to the backend.", @@ -235,6 +280,26 @@ func (HorizontalPodAutoscalerStatus) SwaggerDoc() map[string]string { return map_HorizontalPodAutoscalerStatus } +var map_HostPortRange = map[string]string{ + "": "Host Port Range defines a range of host ports that will be enabled by a policy for pods to use. It requires both the start and end to be defined.", + "min": "min is the start of the range, inclusive.", + "max": "max is the end of the range, inclusive.", +} + +func (HostPortRange) SwaggerDoc() map[string]string { + return map_HostPortRange +} + +var map_IDRange = map[string]string{ + "": "ID Range provides a min/max of an allowed range of IDs.", + "min": "Min is the start of the range, inclusive.", + "max": "Max is the end of the range, inclusive.", +} + +func (IDRange) SwaggerDoc() map[string]string { + return map_IDRange +} + var map_Ingress = map[string]string{ "": "Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.", "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", @@ -286,6 +351,7 @@ func (IngressRuleValue) SwaggerDoc() map[string]string { var map_IngressSpec = map[string]string{ "": "IngressSpec describes the Ingress the user wishes to exist.", "backend": "A default backend capable of servicing requests that don't match any rule. At least one of 'backend' or 'rules' must be specified. This field is optional to allow the loadbalancer controller or defaulting logic to specify a global default.", + "tls": "TLS configuration. Currently the Ingress only supports a single TLS port, 443, and assumes TLS termination. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension.", "rules": "A list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend.", } @@ -302,6 +368,16 @@ func (IngressStatus) SwaggerDoc() map[string]string { return map_IngressStatus } +var map_IngressTLS = map[string]string{ + "": "IngressTLS describes the transport layer security associated with an Ingress.", + "hosts": "Hosts are a list of hosts included in the TLS certificate. The values in this list must match the name/s used in the tlsSecret. Defaults to the wildcard host setting for the loadbalancer controller fulfilling this Ingress, if left unspecified.", + "secretName": "SecretName is the name of the secret used to terminate SSL traffic on 443. Field is left optional to allow SSL routing based on SNI hostname alone. If the SNI host in a listener conflicts with the \"Host\" header field used by an IngressRule, the SNI host is used for termination and value of the Host header is used for routing.", +} + +func (IngressTLS) SwaggerDoc() map[string]string { + return map_IngressTLS +} + var map_Job = map[string]string{ "": "Job represents the configuration of a single job.", "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", @@ -315,7 +391,7 @@ func (Job) SwaggerDoc() map[string]string { var map_JobCondition = map[string]string{ "": "JobCondition describes current state of a job.", - "type": "Type of job condition, currently only Complete.", + "type": "Type of job condition, Complete or Failed.", "status": "Status of the condition, one of True, False, Unknown.", "lastProbeTime": "Last time the condition was checked.", "lastTransitionTime": "Last time the condition transit from one status to another.", @@ -338,11 +414,12 @@ func (JobList) SwaggerDoc() map[string]string { } var map_JobSpec = map[string]string{ - "": "JobSpec describes how the job execution will look like.", - "parallelism": "Parallelism specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md", - "completions": "Completions specifies the desired number of successfully finished pods the job should be run with. Defaults to 1. More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md", - "selector": "Selector is a label query over pods that should match the pod count. More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors", - "template": "Template is the object that describes the pod that will be created when executing a job. More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md", + "": "JobSpec describes how the job execution will look like.", + "parallelism": "Parallelism specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md", + "completions": "Completions specifies the desired number of successfully finished pods the job should be run with. Setting to nil means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job.", + "activeDeadlineSeconds": "Optional duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer", + "selector": "Selector is a label query over pods that should match the pod count. More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors", + "template": "Template is the object that describes the pod that will be created when executing a job. More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md", } func (JobSpec) SwaggerDoc() map[string]string { @@ -363,6 +440,40 @@ func (JobStatus) SwaggerDoc() map[string]string { return map_JobStatus } +var map_LabelSelector = map[string]string{ + "": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + "matchLabels": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", + "matchExpressions": "matchExpressions is a list of label selector requirements. The requirements are ANDed.", +} + +func (LabelSelector) SwaggerDoc() map[string]string { + return map_LabelSelector +} + +var map_LabelSelectorRequirement = map[string]string{ + "": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "key": "key is the label key that the selector applies to.", + "operator": "operator represents a key's relationship to a set of values. Valid operators ard In, NotIn, Exists and DoesNotExist.", + "values": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", +} + +func (LabelSelectorRequirement) SwaggerDoc() map[string]string { + return map_LabelSelectorRequirement +} + +var map_ListOptions = map[string]string{ + "": "ListOptions is the query options to a standard REST list call.", + "labelSelector": "A selector to restrict the list of returned objects by their labels. Defaults to everything.", + "fieldSelector": "A selector to restrict the list of returned objects by their fields. Defaults to everything.", + "watch": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.", + "resourceVersion": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.", + "timeoutSeconds": "Timeout for the list/watch call.", +} + +func (ListOptions) SwaggerDoc() map[string]string { + return map_ListOptions +} + var map_NodeUtilization = map[string]string{ "": "NodeUtilization describes what percentage of a particular resource is used on a node.", "value": "The accepted values are from 0 to 1.", @@ -372,25 +483,83 @@ func (NodeUtilization) SwaggerDoc() map[string]string { return map_NodeUtilization } -var map_PodSelector = map[string]string{ - "": "A pod selector is a label query over a set of pods. The result of matchLabels and matchExpressions are ANDed. An empty pod selector matches all objects. A null pod selector matches no objects.", - "matchLabels": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", - "matchExpressions": "matchExpressions is a list of pod selector requirements. The requirements are ANDed.", +var map_PodSecurityPolicy = map[string]string{ + "": "Pod Security Policy governs the ability to make requests that affect the Security Context that will be applied to a pod and container.", + "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", + "spec": "spec defines the policy enforced.", } -func (PodSelector) SwaggerDoc() map[string]string { - return map_PodSelector +func (PodSecurityPolicy) SwaggerDoc() map[string]string { + return map_PodSecurityPolicy } -var map_PodSelectorRequirement = map[string]string{ - "": "A pod selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", - "key": "key is the label key that the selector applies to.", - "operator": "operator represents a key's relationship to a set of values. Valid operators ard In, NotIn, Exists and DoesNotExist.", - "values": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", +var map_PodSecurityPolicyList = map[string]string{ + "": "Pod Security Policy List is a list of PodSecurityPolicy objects.", + "metadata": "Standard list metadata. More info: http://docs.k8s.io/api-conventions.md#metadata", + "items": "Items is a list of schema objects.", } -func (PodSelectorRequirement) SwaggerDoc() map[string]string { - return map_PodSelectorRequirement +func (PodSecurityPolicyList) SwaggerDoc() map[string]string { + return map_PodSecurityPolicyList +} + +var map_PodSecurityPolicySpec = map[string]string{ + "": "Pod Security Policy Spec defines the policy enforced.", + "privileged": "privileged determines if a pod can request to be run as privileged.", + "capabilities": "capabilities is a list of capabilities that can be added.", + "volumes": "volumes is a white list of allowed volume plugins. Empty indicates that all plugins may be used.", + "hostNetwork": "hostNetwork determines if the policy allows the use of HostNetwork in the pod spec.", + "hostPorts": "hostPorts determines which host port ranges are allowed to be exposed.", + "hostPID": "hostPID determines if the policy allows the use of HostPID in the pod spec.", + "hostIPC": "hostIPC determines if the policy allows the use of HostIPC in the pod spec.", + "seLinuxContext": "seLinuxContext is the strategy that will dictate the allowable labels that may be set.", + "runAsUser": "runAsUser is the strategy that will dictate the allowable RunAsUser values that may be set.", +} + +func (PodSecurityPolicySpec) SwaggerDoc() map[string]string { + return map_PodSecurityPolicySpec +} + +var map_ReplicaSet = map[string]string{ + "": "ReplicaSet represents the configuration of a ReplicaSet.", + "metadata": "If the Labels of a ReplicaSet are empty, they are defaulted to be the same as the Pod(s) that the ReplicaSet manages. Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", + "spec": "Spec defines the specification of the desired behavior of the ReplicaSet. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status", + "status": "Status is the most recently observed status of the ReplicaSet. This data may be out of date by some window of time. Populated by the system. Read-only. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status", +} + +func (ReplicaSet) SwaggerDoc() map[string]string { + return map_ReplicaSet +} + +var map_ReplicaSetList = map[string]string{ + "": "ReplicaSetList is a collection of ReplicaSets.", + "metadata": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds", + "items": "List of ReplicaSets. More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md", +} + +func (ReplicaSetList) SwaggerDoc() map[string]string { + return map_ReplicaSetList +} + +var map_ReplicaSetSpec = map[string]string{ + "": "ReplicaSetSpec is the specification of a ReplicaSet.", + "replicas": "Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller", + "selector": "Selector is a label query over pods that should match the replica count. If the selector is empty, it is defaulted to the labels present on the pod template. Label keys and values that must match in order to be controlled by this replica set. More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors", + "template": "Template is the object that describes the pod that will be created if insufficient replicas are detected. More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#pod-template", +} + +func (ReplicaSetSpec) SwaggerDoc() map[string]string { + return map_ReplicaSetSpec +} + +var map_ReplicaSetStatus = map[string]string{ + "": "ReplicaSetStatus represents the current status of a ReplicaSet.", + "replicas": "Replicas is the most recently oberved number of replicas. More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller", + "observedGeneration": "ObservedGeneration reflects the generation of the most recently observed ReplicaSet.", +} + +func (ReplicaSetStatus) SwaggerDoc() map[string]string { + return map_ReplicaSetStatus } var map_ReplicationControllerDummy = map[string]string{ @@ -401,17 +570,44 @@ func (ReplicationControllerDummy) SwaggerDoc() map[string]string { return map_ReplicationControllerDummy } +var map_RollbackConfig = map[string]string{ + "revision": "The revision to rollback to. If set to 0, rollbck to the last revision.", +} + +func (RollbackConfig) SwaggerDoc() map[string]string { + return map_RollbackConfig +} + var map_RollingUpdateDeployment = map[string]string{ - "": "Spec to control the desired behavior of rolling update.", - "maxUnavailable": "The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding up. This can not be 0 if MaxSurge is 0. By default, a fixed value of 1 is used. Example: when this is set to 30%, the old RC can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old RC can be scaled down further, followed by scaling up the new RC, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.", - "maxSurge": "The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. By default, a value of 1 is used. Example: when this is set to 30%, the new RC can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new RC can be scaled up further, ensuring that total number of pods running at any time during the update is atmost 130% of desired pods.", - "minReadySeconds": "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)", + "": "Spec to control the desired behavior of rolling update.", + "maxUnavailable": "The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding up. This can not be 0 if MaxSurge is 0. By default, a fixed value of 1 is used. Example: when this is set to 30%, the old RC can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old RC can be scaled down further, followed by scaling up the new RC, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.", + "maxSurge": "The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. By default, a value of 1 is used. Example: when this is set to 30%, the new RC can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new RC can be scaled up further, ensuring that total number of pods running at any time during the update is atmost 130% of desired pods.", } func (RollingUpdateDeployment) SwaggerDoc() map[string]string { return map_RollingUpdateDeployment } +var map_RunAsUserStrategyOptions = map[string]string{ + "": "Run A sUser Strategy Options defines the strategy type and any options used to create the strategy.", + "type": "type is the strategy that will dictate the allowable RunAsUser values that may be set.", + "ranges": "Ranges are the allowed ranges of uids that may be used.", +} + +func (RunAsUserStrategyOptions) SwaggerDoc() map[string]string { + return map_RunAsUserStrategyOptions +} + +var map_SELinuxContextStrategyOptions = map[string]string{ + "": "SELinux Context Strategy Options defines the strategy type and any options used to create the strategy.", + "type": "type is the strategy that will dictate the allowable labels that may be set.", + "seLinuxOptions": "seLinuxOptions required to run as; required for MustRunAs More info: http://releases.k8s.io/HEAD/docs/design/security_context.md#security-context", +} + +func (SELinuxContextStrategyOptions) SwaggerDoc() map[string]string { + return map_SELinuxContextStrategyOptions +} + var map_Scale = map[string]string{ "": "represents a scaling request for a resource.", "metadata": "Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.", @@ -445,7 +641,6 @@ func (ScaleStatus) SwaggerDoc() map[string]string { var map_SubresourceReference = map[string]string{ "": "SubresourceReference contains enough information to let you inspect or modify the referred subresource.", "kind": "Kind of the referent; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds\"", - "namespace": "Namespace of the referent; More info: http://releases.k8s.io/HEAD/docs/user-guide/namespaces.md", "name": "Name of the referent; More info: http://releases.k8s.io/HEAD/docs/user-guide/identifiers.md#names", "apiVersion": "API version of the referent", "subresource": "Subresource name of the referent", @@ -469,7 +664,7 @@ func (ThirdPartyResource) SwaggerDoc() map[string]string { var map_ThirdPartyResourceData = map[string]string{ "": "An internal object, used for versioned storage in etcd. Not exposed to the end user.", "metadata": "Standard object metadata.", - "name": "Data is the raw JSON data for this data.", + "data": "Data is the raw JSON data for this data.", } func (ThirdPartyResourceData) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go index 44a8f539e..22aaac64e 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/validation/validation.go @@ -17,33 +17,25 @@ limitations under the License. package validation import ( - "fmt" + "encoding/json" "net" "regexp" "strconv" "strings" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" + unversionedvalidation "k8s.io/kubernetes/pkg/api/unversioned/validation" apivalidation "k8s.io/kubernetes/pkg/api/validation" "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/controller/podautoscaler" "k8s.io/kubernetes/pkg/labels" - "k8s.io/kubernetes/pkg/util" - errs "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/intstr" "k8s.io/kubernetes/pkg/util/sets" "k8s.io/kubernetes/pkg/util/validation" - utilvalidation "k8s.io/kubernetes/pkg/util/validation" + "k8s.io/kubernetes/pkg/util/validation/field" ) -const isNegativeErrorMsg string = `must be non-negative` - -// TODO: Expose from apivalidation instead of duplicating. -func intervalErrorMsg(lo, hi int) string { - return fmt.Sprintf(`must be greater than %d and less than %d`, lo, hi) -} - -var portRangeErrorMsg string = intervalErrorMsg(0, 65536) -var portNameErrorMsg string = fmt.Sprintf(`must be an IANA_SVC_NAME (at most 15 characters, matching regex %s, it must contain at least one letter [a-z], and hyphens cannot be adjacent to other hyphens): e.g. "http"`, validation.IdentifierNoHyphensBeginEndFmt) - // ValidateHorizontalPodAutoscaler can be used to check whether the given autoscaler name is valid. // Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed. func ValidateHorizontalPodAutoscalerName(name string, prefix bool) (bool, string) { @@ -51,64 +43,118 @@ func ValidateHorizontalPodAutoscalerName(name string, prefix bool) (bool, string return apivalidation.ValidateReplicationControllerName(name, prefix) } -func validateHorizontalPodAutoscalerSpec(autoscaler extensions.HorizontalPodAutoscalerSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateHorizontalPodAutoscalerSpec(autoscaler extensions.HorizontalPodAutoscalerSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if autoscaler.MinReplicas != nil && *autoscaler.MinReplicas < 1 { - allErrs = append(allErrs, errs.NewFieldInvalid("minReplicas", autoscaler.MinReplicas, `must be bigger or equal to 1`)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("minReplicas"), *autoscaler.MinReplicas, "must be greater than 0")) } if autoscaler.MaxReplicas < 1 { - allErrs = append(allErrs, errs.NewFieldInvalid("maxReplicas", autoscaler.MaxReplicas, `must be bigger or equal to 1`)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("maxReplicas"), autoscaler.MaxReplicas, "must be greater than 0")) } if autoscaler.MinReplicas != nil && autoscaler.MaxReplicas < *autoscaler.MinReplicas { - allErrs = append(allErrs, errs.NewFieldInvalid("maxReplicas", autoscaler.MaxReplicas, `must be bigger or equal to minReplicas`)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("maxReplicas"), autoscaler.MaxReplicas, "must be greater than or equal to `minReplicas`")) } if autoscaler.CPUUtilization != nil && autoscaler.CPUUtilization.TargetPercentage < 1 { - allErrs = append(allErrs, errs.NewFieldInvalid("cpuUtilization.targetPercentage", autoscaler.CPUUtilization.TargetPercentage, `must be bigger or equal to 1`)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("cpuUtilization", "targetPercentage"), autoscaler.CPUUtilization.TargetPercentage, "must be greater than 0")) + } + if refErrs := ValidateSubresourceReference(autoscaler.ScaleRef, fldPath.Child("scaleRef")); len(refErrs) > 0 { + allErrs = append(allErrs, refErrs...) + } else if autoscaler.ScaleRef.Subresource != "scale" { + allErrs = append(allErrs, field.NotSupported(fldPath.Child("scaleRef", "subresource"), autoscaler.ScaleRef.Subresource, []string{"scale"})) } return allErrs } -func ValidateHorizontalPodAutoscaler(autoscaler *extensions.HorizontalPodAutoscaler) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&autoscaler.ObjectMeta, true, ValidateHorizontalPodAutoscalerName).Prefix("metadata")...) - allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(autoscaler.Spec)...) +func ValidateSubresourceReference(ref extensions.SubresourceReference, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if len(ref.Kind) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("kind"), "")) + } else if ok, msg := apivalidation.IsValidPathSegmentName(ref.Kind); !ok { + allErrs = append(allErrs, field.Invalid(fldPath.Child("kind"), ref.Kind, msg)) + } + + if len(ref.Name) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "")) + } else if ok, msg := apivalidation.IsValidPathSegmentName(ref.Name); !ok { + allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), ref.Name, msg)) + } + + if len(ref.Subresource) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("subresource"), "")) + } else if ok, msg := apivalidation.IsValidPathSegmentName(ref.Subresource); !ok { + allErrs = append(allErrs, field.Invalid(fldPath.Child("subresource"), ref.Subresource, msg)) + } return allErrs } -func ValidateHorizontalPodAutoscalerUpdate(newAutoscler, oldAutoscaler *extensions.HorizontalPodAutoscaler) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&newAutoscler.ObjectMeta, &oldAutoscaler.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(newAutoscler.Spec)...) +func validateHorizontalPodAutoscalerAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if annotationValue, found := annotations[podautoscaler.HpaCustomMetricsTargetAnnotationName]; found { + // Try to parse the annotation + var targetList extensions.CustomMetricTargetList + if err := json.Unmarshal([]byte(annotationValue), &targetList); err != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("annotations"), annotations, "failed to parse custom metrics target annotation")) + } else { + if len(targetList.Items) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("annotations", "items"), "custom metrics target must not be empty")) + } + for _, target := range targetList.Items { + if target.Name == "" { + allErrs = append(allErrs, field.Required(fldPath.Child("annotations", "items", "name"), "missing custom metric target name")) + } + if target.TargetValue.MilliValue() <= 0 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("annotations", "items", "value"), target.TargetValue, "custom metric target value must be greater than 0")) + } + } + } + } return allErrs } -func ValidateHorizontalPodAutoscalerStatusUpdate(controller, oldController *extensions.HorizontalPodAutoscaler) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...) +func ValidateHorizontalPodAutoscaler(autoscaler *extensions.HorizontalPodAutoscaler) field.ErrorList { + allErrs := apivalidation.ValidateObjectMeta(&autoscaler.ObjectMeta, true, ValidateHorizontalPodAutoscalerName, field.NewPath("metadata")) + allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(autoscaler.Spec, field.NewPath("spec"))...) + allErrs = append(allErrs, validateHorizontalPodAutoscalerAnnotations(autoscaler.Annotations, field.NewPath("metadata"))...) + return allErrs +} +func ValidateHorizontalPodAutoscalerUpdate(newAutoscaler, oldAutoscaler *extensions.HorizontalPodAutoscaler) field.ErrorList { + allErrs := apivalidation.ValidateObjectMetaUpdate(&newAutoscaler.ObjectMeta, &oldAutoscaler.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, validateHorizontalPodAutoscalerSpec(newAutoscaler.Spec, field.NewPath("spec"))...) + return allErrs +} + +func ValidateHorizontalPodAutoscalerStatusUpdate(controller, oldController *extensions.HorizontalPodAutoscaler) field.ErrorList { + allErrs := apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta, field.NewPath("metadata")) status := controller.Status - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.CurrentReplicas), "currentReplicas")...) - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.DesiredReplicas), "desiredReplicas")...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.CurrentReplicas), field.NewPath("status", "currentReplicas"))...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.DesiredReplicas), field.NewPath("status", "desiredReplicasa"))...) return allErrs } -func ValidateThirdPartyResourceUpdate(old, update *extensions.ThirdPartyResource) errs.ValidationErrorList { - return ValidateThirdPartyResource(update) +func ValidateThirdPartyResourceUpdate(update, old *extensions.ThirdPartyResource) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&update.ObjectMeta, &old.ObjectMeta, field.NewPath("metadata"))...) + allErrs = append(allErrs, ValidateThirdPartyResource(update)...) + return allErrs } -func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if len(obj.Name) == 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("name", obj.Name, "name must be non-empty")) - } +func ValidateThirdPartyResourceName(name string, prefix bool) (bool, string) { + return apivalidation.NameIsDNSSubdomain(name, prefix) +} + +func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, true, ValidateThirdPartyResourceName, field.NewPath("metadata"))...) + versions := sets.String{} for ix := range obj.Versions { version := &obj.Versions[ix] if len(version.Name) == 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("name", version, "name can not be empty")) + allErrs = append(allErrs, field.Invalid(field.NewPath("versions").Index(ix).Child("name"), version, "must not be empty")) } if versions.Has(version.Name) { - allErrs = append(allErrs, errs.NewFieldDuplicate("version", version)) + allErrs = append(allErrs, field.Duplicate(field.NewPath("versions").Index(ix).Child("name"), version)) } versions.Insert(version.Name) } @@ -116,77 +162,52 @@ func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) errs.Validat } // ValidateDaemonSet tests if required fields in the DaemonSet are set. -func ValidateDaemonSet(controller *extensions.DaemonSet) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&controller.ObjectMeta, true, ValidateDaemonSetName).Prefix("metadata")...) - allErrs = append(allErrs, ValidateDaemonSetSpec(&controller.Spec).Prefix("spec")...) +func ValidateDaemonSet(controller *extensions.DaemonSet) field.ErrorList { + allErrs := apivalidation.ValidateObjectMeta(&controller.ObjectMeta, true, ValidateDaemonSetName, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateDaemonSetSpec(&controller.Spec, field.NewPath("spec"))...) return allErrs } // ValidateDaemonSetUpdate tests if required fields in the DaemonSet are set. -func ValidateDaemonSetUpdate(oldController, controller *extensions.DaemonSet) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, ValidateDaemonSetSpec(&controller.Spec).Prefix("spec")...) - allErrs = append(allErrs, ValidateDaemonSetTemplateUpdate(oldController.Spec.Template, controller.Spec.Template).Prefix("spec.template")...) +func ValidateDaemonSetUpdate(controller, oldController *extensions.DaemonSet) field.ErrorList { + allErrs := apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateDaemonSetSpec(&controller.Spec, field.NewPath("spec"))...) return allErrs } // validateDaemonSetStatus validates a DaemonSetStatus -func validateDaemonSetStatus(status *extensions.DaemonSetStatus) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.CurrentNumberScheduled), "currentNumberScheduled")...) - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.NumberMisscheduled), "numberMisscheduled")...) - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.DesiredNumberScheduled), "desiredNumberScheduled")...) +func validateDaemonSetStatus(status *extensions.DaemonSetStatus, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.CurrentNumberScheduled), fldPath.Child("currentNumberScheduled"))...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.NumberMisscheduled), fldPath.Child("numberMisscheduled"))...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.DesiredNumberScheduled), fldPath.Child("desiredNumberScheduled"))...) return allErrs } // ValidateDaemonSetStatus validates tests if required fields in the DaemonSet Status section -func ValidateDaemonSetStatusUpdate(controller, oldController *extensions.DaemonSet) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, validateDaemonSetStatus(&controller.Status)...) - return allErrs -} - -// ValidateDaemonSetTemplateUpdate tests that certain fields in the daemon set's pod template are not updated. -func ValidateDaemonSetTemplateUpdate(oldPodTemplate, podTemplate *api.PodTemplateSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - podSpec := podTemplate.Spec - // podTemplate.Spec is not a pointer, so we can modify NodeSelector and NodeName directly. - podSpec.NodeSelector = oldPodTemplate.Spec.NodeSelector - podSpec.NodeName = oldPodTemplate.Spec.NodeName - // In particular, we do not allow updates to container images at this point. - if !api.Semantic.DeepEqual(oldPodTemplate.Spec, podSpec) { - // TODO: Pinpoint the specific field that causes the invalid error after we have strategic merge diff - allErrs = append(allErrs, errs.NewFieldInvalid("spec", "content of spec is not printed out, please refer to the \"details\"", "may not update fields other than spec.nodeSelector")) - } +func ValidateDaemonSetStatusUpdate(controller, oldController *extensions.DaemonSet) field.ErrorList { + allErrs := apivalidation.ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, validateDaemonSetStatus(&controller.Status, field.NewPath("status"))...) return allErrs } // ValidateDaemonSetSpec tests if required fields in the DaemonSetSpec are set. -func ValidateDaemonSetSpec(spec *extensions.DaemonSetSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateDaemonSetSpec(spec *extensions.DaemonSetSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} - selector := labels.Set(spec.Selector).AsSelector() - if selector.Empty() { - allErrs = append(allErrs, errs.NewFieldRequired("selector")) + allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(spec.Selector, fldPath.Child("selector"))...) + + selector, err := unversioned.LabelSelectorAsSelector(spec.Selector) + if err == nil && !selector.Matches(labels.Set(spec.Template.Labels)) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("template", "metadata", "labels"), spec.Template.Labels, "`selector` does not match template `labels`")) } - if spec.Template == nil { - allErrs = append(allErrs, errs.NewFieldRequired("template")) - } else { - labels := labels.Set(spec.Template.Labels) - if !selector.Matches(labels) { - allErrs = append(allErrs, errs.NewFieldInvalid("template.metadata.labels", spec.Template.Labels, "selector does not match template")) - } - allErrs = append(allErrs, apivalidation.ValidatePodTemplateSpec(spec.Template).Prefix("template")...) - // Daemons typically run on more than one node, so mark Read-Write persistent disks as invalid. - allErrs = append(allErrs, apivalidation.ValidateReadOnlyPersistentDisks(spec.Template.Spec.Volumes).Prefix("template.spec.volumes")...) - // RestartPolicy has already been first-order validated as per ValidatePodTemplateSpec(). - if spec.Template.Spec.RestartPolicy != api.RestartPolicyAlways { - allErrs = append(allErrs, errs.NewFieldValueNotSupported("template.spec.restartPolicy", spec.Template.Spec.RestartPolicy, []string{string(api.RestartPolicyAlways)})) - } + allErrs = append(allErrs, apivalidation.ValidatePodTemplateSpec(&spec.Template, fldPath.Child("template"))...) + // Daemons typically run on more than one node, so mark Read-Write persistent disks as invalid. + allErrs = append(allErrs, apivalidation.ValidateReadOnlyPersistentDisks(spec.Template.Spec.Volumes, fldPath.Child("template", "spec", "volumes"))...) + // RestartPolicy has already been first-order validated as per ValidatePodTemplateSpec(). + if spec.Template.Spec.RestartPolicy != api.RestartPolicyAlways { + allErrs = append(allErrs, field.NotSupported(fldPath.Child("template", "spec", "restartPolicy"), spec.Template.Spec.RestartPolicy, []string{string(api.RestartPolicyAlways)})) } return allErrs } @@ -203,197 +224,224 @@ func ValidateDeploymentName(name string, prefix bool) (bool, string) { return apivalidation.NameIsDNSSubdomain(name, prefix) } -func ValidatePositiveIntOrPercent(intOrPercent util.IntOrString, fieldName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if intOrPercent.Kind == util.IntstrString { +func ValidatePositiveIntOrPercent(intOrPercent intstr.IntOrString, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if intOrPercent.Type == intstr.String { if !validation.IsValidPercent(intOrPercent.StrVal) { - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName, intOrPercent, "value should be int(5) or percentage(5%)")) + allErrs = append(allErrs, field.Invalid(fldPath, intOrPercent, "must be an integer or percentage (e.g '5%')")) } - - } else if intOrPercent.Kind == util.IntstrInt { - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(intOrPercent.IntVal), fieldName)...) + } else if intOrPercent.Type == intstr.Int { + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(intOrPercent.IntValue()), fldPath)...) } return allErrs } -func getPercentValue(intOrStringValue util.IntOrString) (int, bool) { - if intOrStringValue.Kind != util.IntstrString || !validation.IsValidPercent(intOrStringValue.StrVal) { +func getPercentValue(intOrStringValue intstr.IntOrString) (int, bool) { + if intOrStringValue.Type != intstr.String || !validation.IsValidPercent(intOrStringValue.StrVal) { return 0, false } value, _ := strconv.Atoi(intOrStringValue.StrVal[:len(intOrStringValue.StrVal)-1]) return value, true } -func getIntOrPercentValue(intOrStringValue util.IntOrString) int { +func getIntOrPercentValue(intOrStringValue intstr.IntOrString) int { value, isPercent := getPercentValue(intOrStringValue) if isPercent { return value } - return intOrStringValue.IntVal + return intOrStringValue.IntValue() } -func IsNotMoreThan100Percent(intOrStringValue util.IntOrString, fieldName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func IsNotMoreThan100Percent(intOrStringValue intstr.IntOrString, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} value, isPercent := getPercentValue(intOrStringValue) if !isPercent || value <= 100 { return nil } - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName, intOrStringValue, "should not be more than 100%")) + allErrs = append(allErrs, field.Invalid(fldPath, intOrStringValue, "must not be greater than 100%")) return allErrs } -func ValidateRollingUpdateDeployment(rollingUpdate *extensions.RollingUpdateDeployment, fieldName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxUnavailable, fieldName+"maxUnavailable")...) - allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxSurge, fieldName+".maxSurge")...) +func ValidateRollingUpdateDeployment(rollingUpdate *extensions.RollingUpdateDeployment, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxUnavailable, fldPath.Child("maxUnavailable"))...) + allErrs = append(allErrs, ValidatePositiveIntOrPercent(rollingUpdate.MaxSurge, fldPath.Child("maxSurge"))...) if getIntOrPercentValue(rollingUpdate.MaxUnavailable) == 0 && getIntOrPercentValue(rollingUpdate.MaxSurge) == 0 { // Both MaxSurge and MaxUnavailable cannot be zero. - allErrs = append(allErrs, errs.NewFieldInvalid(fieldName+".maxUnavailable", rollingUpdate.MaxUnavailable, "cannot be 0 when maxSurge is 0 as well")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("maxUnavailable"), rollingUpdate.MaxUnavailable, "may not be 0 when `maxSurge` is 0")) } // Validate that MaxUnavailable is not more than 100%. - allErrs = append(allErrs, IsNotMoreThan100Percent(rollingUpdate.MaxUnavailable, fieldName+".maxUnavailable")...) - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(rollingUpdate.MinReadySeconds), fieldName+".minReadySeconds")...) + allErrs = append(allErrs, IsNotMoreThan100Percent(rollingUpdate.MaxUnavailable, fldPath.Child("maxUnavailable"))...) return allErrs } -func ValidateDeploymentStrategy(strategy *extensions.DeploymentStrategy, fieldName string) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateDeploymentStrategy(strategy *extensions.DeploymentStrategy, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if strategy.RollingUpdate == nil { return allErrs } switch strategy.Type { case extensions.RecreateDeploymentStrategyType: - allErrs = append(allErrs, errs.NewFieldForbidden("rollingUpdate", "rollingUpdate should be nil when strategy type is "+extensions.RecreateDeploymentStrategyType)) + allErrs = append(allErrs, field.Forbidden(fldPath.Child("rollingUpdate"), "may not be specified when strategy `type` is '"+string(extensions.RecreateDeploymentStrategyType+"'"))) case extensions.RollingUpdateDeploymentStrategyType: - allErrs = append(allErrs, ValidateRollingUpdateDeployment(strategy.RollingUpdate, "rollingUpdate")...) + allErrs = append(allErrs, ValidateRollingUpdateDeployment(strategy.RollingUpdate, fldPath.Child("rollingUpdate"))...) } return allErrs } +func ValidateRollback(rollback *extensions.RollbackConfig, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + v := rollback.Revision + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(v), fldPath.Child("version"))...) + return allErrs +} + // Validates given deployment spec. -func ValidateDeploymentSpec(spec *extensions.DeploymentSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateNonEmptySelector(spec.Selector, "selector")...) - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(spec.Replicas), "replicas")...) - allErrs = append(allErrs, apivalidation.ValidatePodTemplateSpecForRC(spec.Template, spec.Selector, spec.Replicas, "template")...) - allErrs = append(allErrs, ValidateDeploymentStrategy(&spec.Strategy, "strategy")...) - allErrs = append(allErrs, apivalidation.ValidateLabelName(spec.UniqueLabelKey, "uniqueLabel")...) - return allErrs -} +func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(spec.Replicas), fldPath.Child("replicas"))...) -func ValidateDeploymentUpdate(old, update *extensions.Deployment) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&update.ObjectMeta, &old.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, ValidateDeploymentSpec(&update.Spec).Prefix("spec")...) - return allErrs -} - -func ValidateDeployment(obj *extensions.Deployment) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, true, ValidateDeploymentName).Prefix("metadata")...) - allErrs = append(allErrs, ValidateDeploymentSpec(&obj.Spec).Prefix("spec")...) - return allErrs -} - -func ValidateThirdPartyResourceDataUpdate(old, update *extensions.ThirdPartyResourceData) errs.ValidationErrorList { - return ValidateThirdPartyResourceData(update) -} - -func ValidateThirdPartyResourceData(obj *extensions.ThirdPartyResourceData) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if len(obj.Name) == 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("name", obj.Name, "name must be non-empty")) - } - return allErrs -} - -func ValidateJob(job *extensions.Job) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - // Jobs and rcs have the same name validation - allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&job.ObjectMeta, true, apivalidation.ValidateReplicationControllerName).Prefix("metadata")...) - allErrs = append(allErrs, ValidateJobSpec(&job.Spec).Prefix("spec")...) - return allErrs -} - -func ValidateJobSpec(spec *extensions.JobSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - - if spec.Parallelism != nil && *spec.Parallelism < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("parallelism", spec.Parallelism, isNegativeErrorMsg)) - } - if spec.Completions != nil && *spec.Completions < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("completions", spec.Completions, isNegativeErrorMsg)) - } if spec.Selector == nil { - allErrs = append(allErrs, errs.NewFieldRequired("selector")) + allErrs = append(allErrs, field.Required(fldPath.Child("selector"), "")) } else { - allErrs = append(allErrs, ValidatePodSelector(spec.Selector).Prefix("selector")...) - } - - if selector, err := extensions.PodSelectorAsSelector(spec.Selector); err == nil { - labels := labels.Set(spec.Template.Labels) - if !selector.Matches(labels) { - allErrs = append(allErrs, errs.NewFieldInvalid("template.metadata.labels", spec.Template.Labels, "selector does not match template")) + allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(spec.Selector, fldPath.Child("selector"))...) + if len(spec.Selector.MatchLabels)+len(spec.Selector.MatchExpressions) == 0 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("selector"), spec.Selector, "empty selector is not valid for deployment.")) } } - allErrs = append(allErrs, apivalidation.ValidatePodTemplateSpec(&spec.Template).Prefix("template")...) + selector, err := unversioned.LabelSelectorAsSelector(spec.Selector) + if err != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("selector"), spec.Selector, "invalid label selector.")) + } else { + allErrs = append(allErrs, ValidatePodTemplateSpecForReplicaSet(&spec.Template, selector, spec.Replicas, fldPath.Child("template"))...) + } + + allErrs = append(allErrs, ValidateDeploymentStrategy(&spec.Strategy, fldPath.Child("strategy"))...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(spec.MinReadySeconds), fldPath.Child("minReadySeconds"))...) + if spec.RevisionHistoryLimit != nil { + // zero is a valid RevisionHistoryLimit + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(*spec.RevisionHistoryLimit), fldPath.Child("revisionHistoryLimit"))...) + } + if spec.RollbackTo != nil { + allErrs = append(allErrs, ValidateRollback(spec.RollbackTo, fldPath.Child("rollback"))...) + } + return allErrs +} + +func ValidateDeploymentUpdate(update, old *extensions.Deployment) field.ErrorList { + allErrs := apivalidation.ValidateObjectMetaUpdate(&update.ObjectMeta, &old.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateDeploymentSpec(&update.Spec, field.NewPath("spec"))...) + return allErrs +} + +func ValidateDeployment(obj *extensions.Deployment) field.ErrorList { + allErrs := apivalidation.ValidateObjectMeta(&obj.ObjectMeta, true, ValidateDeploymentName, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateDeploymentSpec(&obj.Spec, field.NewPath("spec"))...) + return allErrs +} + +func ValidateDeploymentRollback(obj *extensions.DeploymentRollback) field.ErrorList { + allErrs := apivalidation.ValidateAnnotations(obj.UpdatedAnnotations, field.NewPath("updatedAnnotations")) + if len(obj.Name) == 0 { + allErrs = append(allErrs, field.Required(field.NewPath("name"), "name is required")) + } + allErrs = append(allErrs, ValidateRollback(&obj.RollbackTo, field.NewPath("rollback"))...) + return allErrs +} + +func ValidateThirdPartyResourceDataUpdate(update, old *extensions.ThirdPartyResourceData) field.ErrorList { + return ValidateThirdPartyResourceData(update) +} + +func ValidateThirdPartyResourceData(obj *extensions.ThirdPartyResourceData) field.ErrorList { + allErrs := field.ErrorList{} + if len(obj.Name) == 0 { + allErrs = append(allErrs, field.Required(field.NewPath("name"), "")) + } + return allErrs +} + +func ValidateJob(job *extensions.Job) field.ErrorList { + // Jobs and rcs have the same name validation + allErrs := apivalidation.ValidateObjectMeta(&job.ObjectMeta, true, apivalidation.ValidateReplicationControllerName, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateJobSpec(&job.Spec, field.NewPath("spec"))...) + return allErrs +} + +func ValidateJobSpec(spec *extensions.JobSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if spec.Parallelism != nil { + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(*spec.Parallelism), fldPath.Child("parallelism"))...) + } + if spec.Completions != nil { + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(*spec.Completions), fldPath.Child("completions"))...) + } + if spec.ActiveDeadlineSeconds != nil { + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(*spec.ActiveDeadlineSeconds), fldPath.Child("activeDeadlineSeconds"))...) + } + if spec.Selector == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("selector"), "")) + } else { + allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(spec.Selector, fldPath.Child("selector"))...) + } + + if selector, err := unversioned.LabelSelectorAsSelector(spec.Selector); err == nil { + labels := labels.Set(spec.Template.Labels) + if !selector.Matches(labels) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("template", "metadata", "labels"), spec.Template.Labels, "`selector` does not match template `labels`")) + } + } + + allErrs = append(allErrs, apivalidation.ValidatePodTemplateSpec(&spec.Template, fldPath.Child("template"))...) if spec.Template.Spec.RestartPolicy != api.RestartPolicyOnFailure && spec.Template.Spec.RestartPolicy != api.RestartPolicyNever { - allErrs = append(allErrs, errs.NewFieldValueNotSupported("template.spec.restartPolicy", + allErrs = append(allErrs, field.NotSupported(fldPath.Child("template", "spec", "restartPolicy"), spec.Template.Spec.RestartPolicy, []string{string(api.RestartPolicyOnFailure), string(api.RestartPolicyNever)})) } return allErrs } -func ValidateJobStatus(status *extensions.JobStatus) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Active), "active")...) - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Succeeded), "succeeded")...) - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Failed), "failed")...) +func ValidateJobStatus(status *extensions.JobStatus, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.Active), fldPath.Child("active"))...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.Succeeded), fldPath.Child("succeeded"))...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(status.Failed), fldPath.Child("failed"))...) return allErrs } -func ValidateJobUpdate(oldJob, job *extensions.Job) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, ValidateJobSpecUpdate(oldJob.Spec, job.Spec).Prefix("spec")...) +func ValidateJobUpdate(job, oldJob *extensions.Job) field.ErrorList { + allErrs := apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateJobSpecUpdate(job.Spec, oldJob.Spec, field.NewPath("spec"))...) return allErrs } -func ValidateJobUpdateStatus(oldJob, job *extensions.Job) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, ValidateJobStatusUpdate(oldJob.Status, job.Status).Prefix("status")...) +func ValidateJobUpdateStatus(job, oldJob *extensions.Job) field.ErrorList { + allErrs := apivalidation.ValidateObjectMetaUpdate(&oldJob.ObjectMeta, &job.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateJobStatusUpdate(job.Status, oldJob.Status)...) return allErrs } -func ValidateJobSpecUpdate(oldSpec, spec extensions.JobSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateJobSpec(&spec)...) - if !api.Semantic.DeepEqual(oldSpec.Completions, spec.Completions) { - allErrs = append(allErrs, errs.NewFieldInvalid("completions", spec.Completions, "field is immutable")) - } - if !api.Semantic.DeepEqual(oldSpec.Selector, spec.Selector) { - allErrs = append(allErrs, errs.NewFieldInvalid("selector", spec.Selector, "field is immutable")) - } - if !api.Semantic.DeepEqual(oldSpec.Template, spec.Template) { - allErrs = append(allErrs, errs.NewFieldInvalid("template", "[omitted]", "field is immutable")) - } +func ValidateJobSpecUpdate(spec, oldSpec extensions.JobSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, ValidateJobSpec(&spec, fldPath)...) + allErrs = append(allErrs, apivalidation.ValidateImmutableField(spec.Completions, oldSpec.Completions, fldPath.Child("completions"))...) + allErrs = append(allErrs, apivalidation.ValidateImmutableField(spec.Selector, oldSpec.Selector, fldPath.Child("selector"))...) + allErrs = append(allErrs, apivalidation.ValidateImmutableField(spec.Template, oldSpec.Template, fldPath.Child("template"))...) return allErrs } -func ValidateJobStatusUpdate(oldStatus, status extensions.JobStatus) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, ValidateJobStatus(&status)...) +func ValidateJobStatusUpdate(status, oldStatus extensions.JobStatus) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, ValidateJobStatus(&status, field.NewPath("status"))...) return allErrs } // ValidateIngress tests if required fields in the Ingress are set. -func ValidateIngress(ingress *extensions.Ingress) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&ingress.ObjectMeta, true, ValidateIngressName).Prefix("metadata")...) - allErrs = append(allErrs, ValidateIngressSpec(&ingress.Spec).Prefix("spec")...) +func ValidateIngress(ingress *extensions.Ingress) field.ErrorList { + allErrs := apivalidation.ValidateObjectMeta(&ingress.ObjectMeta, true, ValidateIngressName, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateIngressSpec(&ingress.Spec, field.NewPath("spec"))...) return allErrs } @@ -402,75 +450,90 @@ func ValidateIngressName(name string, prefix bool) (bool, string) { return apivalidation.NameIsDNSSubdomain(name, prefix) } +func validateIngressTLS(spec *extensions.IngressSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + // Currently the Ingress only supports HTTP(S), so a secretName is required. + // This will not be the case if we support SSL routing at L4 via SNI. + for i, t := range spec.TLS { + if t.SecretName == "" { + allErrs = append(allErrs, field.Required(fldPath.Index(i).Child("secretName"), spec.TLS[i].SecretName)) + } + } + // TODO: Perform a more thorough validation of spec.TLS.Hosts that takes + // the wildcard spec from RFC 6125 into account. + return allErrs +} + // ValidateIngressSpec tests if required fields in the IngressSpec are set. -func ValidateIngressSpec(spec *extensions.IngressSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateIngressSpec(spec *extensions.IngressSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} // TODO: Is a default backend mandatory? if spec.Backend != nil { - allErrs = append(allErrs, validateIngressBackend(spec.Backend).Prefix("backend")...) + allErrs = append(allErrs, validateIngressBackend(spec.Backend, fldPath.Child("backend"))...) } else if len(spec.Rules) == 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("rules", spec.Rules, "Either a default backend or a set of host rules are required for ingress.")) + allErrs = append(allErrs, field.Invalid(fldPath, spec.Rules, "either `backend` or `rules` must be specified")) } if len(spec.Rules) > 0 { - allErrs = append(allErrs, validateIngressRules(spec.Rules).Prefix("rules")...) + allErrs = append(allErrs, validateIngressRules(spec.Rules, fldPath.Child("rules"))...) + } + if len(spec.TLS) > 0 { + allErrs = append(allErrs, validateIngressTLS(spec, fldPath.Child("tls"))...) } return allErrs } // ValidateIngressUpdate tests if required fields in the Ingress are set. -func ValidateIngressUpdate(oldIngress, ingress *extensions.Ingress) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&ingress.ObjectMeta, &oldIngress.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, ValidateIngressSpec(&ingress.Spec).Prefix("spec")...) +func ValidateIngressUpdate(ingress, oldIngress *extensions.Ingress) field.ErrorList { + allErrs := apivalidation.ValidateObjectMetaUpdate(&ingress.ObjectMeta, &oldIngress.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateIngressSpec(&ingress.Spec, field.NewPath("spec"))...) return allErrs } // ValidateIngressStatusUpdate tests if required fields in the Ingress are set when updating status. -func ValidateIngressStatusUpdate(ingress, oldIngress *extensions.Ingress) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&ingress.ObjectMeta, &oldIngress.ObjectMeta).Prefix("metadata")...) - allErrs = append(allErrs, apivalidation.ValidateLoadBalancerStatus(&ingress.Status.LoadBalancer).Prefix("status.loadBalancer")...) +func ValidateIngressStatusUpdate(ingress, oldIngress *extensions.Ingress) field.ErrorList { + allErrs := apivalidation.ValidateObjectMetaUpdate(&ingress.ObjectMeta, &oldIngress.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, apivalidation.ValidateLoadBalancerStatus(&ingress.Status.LoadBalancer, field.NewPath("status", "loadBalancer"))...) return allErrs } -func validateIngressRules(IngressRules []extensions.IngressRule) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateIngressRules(IngressRules []extensions.IngressRule, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if len(IngressRules) == 0 { - return append(allErrs, errs.NewFieldRequired("IngressRules")) + return append(allErrs, field.Required(fldPath, "")) } - for _, ih := range IngressRules { + for i, ih := range IngressRules { if len(ih.Host) > 0 { // TODO: Ports and ips are allowed in the host part of a url // according to RFC 3986, consider allowing them. if valid, errMsg := apivalidation.NameIsDNSSubdomain(ih.Host, false); !valid { - allErrs = append(allErrs, errs.NewFieldInvalid("host", ih.Host, errMsg)) + allErrs = append(allErrs, field.Invalid(fldPath.Index(i).Child("host"), ih.Host, errMsg)) } if isIP := (net.ParseIP(ih.Host) != nil); isIP { - allErrs = append(allErrs, errs.NewFieldInvalid("host", ih.Host, "Host must be a DNS name, not ip address")) + allErrs = append(allErrs, field.Invalid(fldPath.Index(i).Child("host"), ih.Host, "must be a DNS name, not an IP address")) } } - allErrs = append(allErrs, validateIngressRuleValue(&ih.IngressRuleValue).Prefix("ingressRule")...) + allErrs = append(allErrs, validateIngressRuleValue(&ih.IngressRuleValue, fldPath.Index(0))...) } return allErrs } -func validateIngressRuleValue(ingressRule *extensions.IngressRuleValue) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateIngressRuleValue(ingressRule *extensions.IngressRuleValue, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if ingressRule.HTTP != nil { - allErrs = append(allErrs, validateHTTPIngressRuleValue(ingressRule.HTTP).Prefix("http")...) + allErrs = append(allErrs, validateHTTPIngressRuleValue(ingressRule.HTTP, fldPath.Child("http"))...) } return allErrs } -func validateHTTPIngressRuleValue(httpIngressRuleValue *extensions.HTTPIngressRuleValue) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateHTTPIngressRuleValue(httpIngressRuleValue *extensions.HTTPIngressRuleValue, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if len(httpIngressRuleValue.Paths) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("paths")) + allErrs = append(allErrs, field.Required(fldPath.Child("paths"), "")) } - for _, rule := range httpIngressRuleValue.Paths { + for i, rule := range httpIngressRuleValue.Paths { if len(rule.Path) > 0 { if !strings.HasPrefix(rule.Path, "/") { - allErrs = append(allErrs, errs.NewFieldInvalid("path", rule.Path, "path must begin with /")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("paths").Index(i).Child("path"), rule.Path, "must be an absolute path")) } // TODO: More draconian path regex validation. // Path must be a valid regex. This is the basic requirement. @@ -483,100 +546,275 @@ func validateHTTPIngressRuleValue(httpIngressRuleValue *extensions.HTTPIngressRu // the user is confusing url regexes with path regexes. _, err := regexp.CompilePOSIX(rule.Path) if err != nil { - allErrs = append(allErrs, errs.NewFieldInvalid("path", rule.Path, "httpIngressRuleValue.path must be a valid regex.")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("paths").Index(i).Child("path"), rule.Path, "must be a valid regex")) } } - allErrs = append(allErrs, validateIngressBackend(&rule.Backend).Prefix("backend")...) + allErrs = append(allErrs, validateIngressBackend(&rule.Backend, fldPath.Child("backend"))...) } return allErrs } // validateIngressBackend tests if a given backend is valid. -func validateIngressBackend(backend *extensions.IngressBackend) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateIngressBackend(backend *extensions.IngressBackend, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} // All backends must reference a single local service by name, and a single service port by name or number. if len(backend.ServiceName) == 0 { - return append(allErrs, errs.NewFieldRequired("serviceName")) + return append(allErrs, field.Required(fldPath.Child("serviceName"), "")) } else if ok, errMsg := apivalidation.ValidateServiceName(backend.ServiceName, false); !ok { - allErrs = append(allErrs, errs.NewFieldInvalid("serviceName", backend.ServiceName, errMsg)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("serviceName"), backend.ServiceName, errMsg)) } - if backend.ServicePort.Kind == util.IntstrString { - if !utilvalidation.IsDNS1123Label(backend.ServicePort.StrVal) { - allErrs = append(allErrs, errs.NewFieldInvalid("servicePort", backend.ServicePort.StrVal, apivalidation.DNS1123LabelErrorMsg)) + if backend.ServicePort.Type == intstr.String { + if !validation.IsDNS1123Label(backend.ServicePort.StrVal) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("servicePort"), backend.ServicePort.StrVal, apivalidation.DNS1123LabelErrorMsg)) } - if !utilvalidation.IsValidPortName(backend.ServicePort.StrVal) { - allErrs = append(allErrs, errs.NewFieldInvalid("servicePort", backend.ServicePort.StrVal, portNameErrorMsg)) + if !validation.IsValidPortName(backend.ServicePort.StrVal) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("servicePort"), backend.ServicePort.StrVal, apivalidation.PortNameErrorMsg)) } - } else if !utilvalidation.IsValidPortNum(backend.ServicePort.IntVal) { - allErrs = append(allErrs, errs.NewFieldInvalid("servicePort", backend.ServicePort, portRangeErrorMsg)) + } else if !validation.IsValidPortNum(backend.ServicePort.IntValue()) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("servicePort"), backend.ServicePort, apivalidation.PortRangeErrorMsg)) } return allErrs } -func validateClusterAutoscalerSpec(spec extensions.ClusterAutoscalerSpec) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func validateClusterAutoscalerSpec(spec extensions.ClusterAutoscalerSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} if spec.MinNodes < 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("minNodes", spec.MinNodes, `must be non-negative`)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("minNodes"), spec.MinNodes, "must be greater than or equal to 0")) } if spec.MaxNodes < spec.MinNodes { - allErrs = append(allErrs, errs.NewFieldInvalid("maxNodes", spec.MaxNodes, `must be bigger or equal to minNodes`)) + allErrs = append(allErrs, field.Invalid(fldPath.Child("maxNodes"), spec.MaxNodes, "must be greater than or equal to `minNodes`")) } if len(spec.TargetUtilization) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("targetUtilization")) + allErrs = append(allErrs, field.Required(fldPath.Child("targetUtilization"), "")) } for _, target := range spec.TargetUtilization { if len(target.Resource) == 0 { - allErrs = append(allErrs, errs.NewFieldRequired("targetUtilization.resource")) + allErrs = append(allErrs, field.Required(fldPath.Child("targetUtilization", "resource"), "")) } if target.Value <= 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("targetUtilization.value", target.Value, "must be greater than 0")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("targetUtilization", "value"), target.Value, "must be greater than 0")) } if target.Value > 1 { - allErrs = append(allErrs, errs.NewFieldInvalid("targetUtilization.value", target.Value, "must be less or equal 1")) + allErrs = append(allErrs, field.Invalid(fldPath.Child("targetUtilization", "value"), target.Value, "must be less than or equal to 1")) } } return allErrs } -func ValidateClusterAutoscaler(autoscaler *extensions.ClusterAutoscaler) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} +func ValidateClusterAutoscaler(autoscaler *extensions.ClusterAutoscaler) field.ErrorList { + allErrs := field.ErrorList{} if autoscaler.Name != "ClusterAutoscaler" { - allErrs = append(allErrs, errs.NewFieldInvalid("name", autoscaler.Name, `name must be ClusterAutoscaler`)) + allErrs = append(allErrs, field.Invalid(field.NewPath("metadata", "name"), autoscaler.Name, "must be 'ClusterAutoscaler'")) } if autoscaler.Namespace != api.NamespaceDefault { - allErrs = append(allErrs, errs.NewFieldInvalid("namespace", autoscaler.Namespace, `namespace must be default`)) + allErrs = append(allErrs, field.Invalid(field.NewPath("metadata", "namespace"), autoscaler.Namespace, "must be 'default'")) } - allErrs = append(allErrs, validateClusterAutoscalerSpec(autoscaler.Spec)...) + allErrs = append(allErrs, validateClusterAutoscalerSpec(autoscaler.Spec, field.NewPath("spec"))...) return allErrs } -func ValidatePodSelector(ps *extensions.PodSelector) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - if ps == nil { - return allErrs +func ValidateScale(scale *extensions.Scale) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&scale.ObjectMeta, true, apivalidation.NameIsDNSSubdomain, field.NewPath("metadata"))...) + + if scale.Spec.Replicas < 0 { + allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "replicas"), scale.Spec.Replicas, "must be greater than or equal to 0")) } - allErrs = append(allErrs, apivalidation.ValidateLabels(ps.MatchLabels, "matchLabels")...) - for i, expr := range ps.MatchExpressions { - allErrs = append(allErrs, ValidatePodSelectorRequirement(expr).Prefix(fmt.Sprintf("matchExpressions.[%v]", i))...) + + return allErrs +} + +// ValidateReplicaSetName can be used to check whether the given ReplicaSet +// name is valid. +// Prefix indicates this name will be used as part of generation, in which case +// trailing dashes are allowed. +func ValidateReplicaSetName(name string, prefix bool) (bool, string) { + return apivalidation.NameIsDNSSubdomain(name, prefix) +} + +// ValidateReplicaSet tests if required fields in the ReplicaSet are set. +func ValidateReplicaSet(rs *extensions.ReplicaSet) field.ErrorList { + allErrs := apivalidation.ValidateObjectMeta(&rs.ObjectMeta, true, ValidateReplicaSetName, field.NewPath("metadata")) + allErrs = append(allErrs, ValidateReplicaSetSpec(&rs.Spec, field.NewPath("spec"))...) + return allErrs +} + +// ValidateReplicaSetUpdate tests if required fields in the ReplicaSet are set. +func ValidateReplicaSetUpdate(rs, oldRs *extensions.ReplicaSet) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&rs.ObjectMeta, &oldRs.ObjectMeta, field.NewPath("metadata"))...) + allErrs = append(allErrs, ValidateReplicaSetSpec(&rs.Spec, field.NewPath("spec"))...) + return allErrs +} + +// ValidateReplicaSetStatusUpdate tests if required fields in the ReplicaSet are set. +func ValidateReplicaSetStatusUpdate(rs, oldRs *extensions.ReplicaSet) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&rs.ObjectMeta, &oldRs.ObjectMeta, field.NewPath("metadata"))...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(rs.Status.Replicas), field.NewPath("status", "replicas"))...) + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(rs.Status.ObservedGeneration), field.NewPath("status", "observedGeneration"))...) + return allErrs +} + +// ValidateReplicaSetSpec tests if required fields in the ReplicaSet spec are set. +func ValidateReplicaSetSpec(spec *extensions.ReplicaSetSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(spec.Replicas), fldPath.Child("replicas"))...) + + if spec.Selector == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("selector"), "")) + } else { + allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(spec.Selector, fldPath.Child("selector"))...) + if len(spec.Selector.MatchLabels)+len(spec.Selector.MatchExpressions) == 0 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("selector"), spec.Selector, "empty selector is not valid for deployment.")) + } + } + + selector, err := unversioned.LabelSelectorAsSelector(spec.Selector) + if err != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("selector"), spec.Selector, "invalid label selector.")) + } else { + allErrs = append(allErrs, ValidatePodTemplateSpecForReplicaSet(spec.Template, selector, spec.Replicas, fldPath.Child("template"))...) } return allErrs } -func ValidatePodSelectorRequirement(sr extensions.PodSelectorRequirement) errs.ValidationErrorList { - allErrs := errs.ValidationErrorList{} - switch sr.Operator { - case extensions.PodSelectorOpIn, extensions.PodSelectorOpNotIn: - if len(sr.Values) == 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("values", sr.Values, "must be non-empty when operator is In or NotIn")) +// Validates the given template and ensures that it is in accordance with the desired selector and replicas. +func ValidatePodTemplateSpecForReplicaSet(template *api.PodTemplateSpec, selector labels.Selector, replicas int, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + if template == nil { + allErrs = append(allErrs, field.Required(fldPath, "")) + } else { + if !selector.Empty() { + // Verify that the ReplicaSet selector matches the labels in template. + labels := labels.Set(template.Labels) + if !selector.Matches(labels) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("metadata", "labels"), template.Labels, "`selector` does not match template `labels`")) + } } - case extensions.PodSelectorOpExists, extensions.PodSelectorOpDoesNotExist: - if len(sr.Values) > 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("values", sr.Values, "must be empty when operator is Exists or DoesNotExist")) + allErrs = append(allErrs, apivalidation.ValidatePodTemplateSpec(template, fldPath)...) + if replicas > 1 { + allErrs = append(allErrs, apivalidation.ValidateReadOnlyPersistentDisks(template.Spec.Volumes, fldPath.Child("spec", "volumes"))...) + } + // RestartPolicy has already been first-order validated as per ValidatePodTemplateSpec(). + if template.Spec.RestartPolicy != api.RestartPolicyAlways { + allErrs = append(allErrs, field.NotSupported(fldPath.Child("spec", "restartPolicy"), template.Spec.RestartPolicy, []string{string(api.RestartPolicyAlways)})) } - default: - allErrs = append(allErrs, errs.NewFieldInvalid("operator", sr.Operator, "not a valid pod selector operator")) } - allErrs = append(allErrs, apivalidation.ValidateLabelName(sr.Key, "key")...) + return allErrs +} + +// ValidatePodSecurityPolicyName can be used to check whether the given +// pod security policy name is valid. +// Prefix indicates this name will be used as part of generation, in which case +// trailing dashes are allowed. +func ValidatePodSecurityPolicyName(name string, prefix bool) (bool, string) { + return apivalidation.NameIsDNSSubdomain(name, prefix) +} + +func ValidatePodSecurityPolicy(psp *extensions.PodSecurityPolicy) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&psp.ObjectMeta, false, ValidatePodSecurityPolicyName, field.NewPath("metadata"))...) + allErrs = append(allErrs, ValidatePodSecurityPolicySpec(&psp.Spec, field.NewPath("spec"))...) + return allErrs +} + +func ValidatePodSecurityPolicySpec(spec *extensions.PodSecurityPolicySpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + allErrs = append(allErrs, validatePSPRunAsUser(fldPath.Child("runAsUser"), &spec.RunAsUser)...) + allErrs = append(allErrs, validatePSPSELinuxContext(fldPath.Child("seLinuxContext"), &spec.SELinuxContext)...) + allErrs = append(allErrs, validatePodSecurityPolicyVolumes(fldPath, spec.Volumes)...) + + return allErrs +} + +// validatePSPSELinuxContext validates the SELinuxContext fields of PodSecurityPolicy. +func validatePSPSELinuxContext(fldPath *field.Path, seLinuxContext *extensions.SELinuxContextStrategyOptions) field.ErrorList { + allErrs := field.ErrorList{} + + // ensure the selinux strategy has a valid type + supportedSELinuxContextTypes := sets.NewString(string(extensions.SELinuxStrategyMustRunAs), + string(extensions.SELinuxStrategyRunAsAny)) + if !supportedSELinuxContextTypes.Has(string(seLinuxContext.Type)) { + allErrs = append(allErrs, field.NotSupported(fldPath.Child("type"), seLinuxContext.Type, supportedSELinuxContextTypes.List())) + } + + return allErrs +} + +// validatePSPRunAsUser validates the RunAsUser fields of PodSecurityPolicy. +func validatePSPRunAsUser(fldPath *field.Path, runAsUser *extensions.RunAsUserStrategyOptions) field.ErrorList { + allErrs := field.ErrorList{} + + // ensure the user strategy has a valid type + supportedRunAsUserTypes := sets.NewString(string(extensions.RunAsUserStrategyMustRunAs), + string(extensions.RunAsUserStrategyMustRunAsNonRoot), + string(extensions.RunAsUserStrategyRunAsAny)) + if !supportedRunAsUserTypes.Has(string(runAsUser.Type)) { + allErrs = append(allErrs, field.NotSupported(fldPath.Child("type"), runAsUser.Type, supportedRunAsUserTypes.List())) + } + + // validate range settings + for idx, rng := range runAsUser.Ranges { + allErrs = append(allErrs, validateIDRanges(fldPath.Child("ranges").Index(idx), rng)...) + } + + return allErrs +} + +// validatePodSecurityPolicyVolumes validates the volume fields of PodSecurityPolicy. +func validatePodSecurityPolicyVolumes(fldPath *field.Path, volumes []extensions.FSType) field.ErrorList { + allErrs := field.ErrorList{} + allowed := sets.NewString(string(extensions.HostPath), + string(extensions.EmptyDir), + string(extensions.GCEPersistentDisk), + string(extensions.AWSElasticBlockStore), + string(extensions.GitRepo), + string(extensions.Secret), + string(extensions.NFS), + string(extensions.ISCSI), + string(extensions.Glusterfs), + string(extensions.PersistentVolumeClaim), + string(extensions.RBD), + string(extensions.Cinder), + string(extensions.CephFS), + string(extensions.DownwardAPI), + string(extensions.FC)) + for _, v := range volumes { + if !allowed.Has(string(v)) { + allErrs = append(allErrs, field.NotSupported(fldPath.Child("volumes"), v, allowed.List())) + } + } + + return allErrs +} + +// validateIDRanges ensures the range is valid. +func validateIDRanges(fldPath *field.Path, rng extensions.IDRange) field.ErrorList { + allErrs := field.ErrorList{} + + // if 0 <= Min <= Max then we do not need to validate max. It is always greater than or + // equal to 0 and Min. + if rng.Min < 0 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("min"), rng.Min, "min cannot be negative")) + } + if rng.Max < 0 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("max"), rng.Max, "max cannot be negative")) + } + if rng.Min > rng.Max { + allErrs = append(allErrs, field.Invalid(fldPath.Child("min"), rng.Min, "min cannot be greater than max")) + } + + return allErrs +} + +// ValidatePodSecurityPolicyUpdate validates a PSP for updates. +func ValidatePodSecurityPolicyUpdate(old *extensions.PodSecurityPolicy, new *extensions.PodSecurityPolicy) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&old.ObjectMeta, &new.ObjectMeta, field.NewPath("metadata"))...) + allErrs = append(allErrs, ValidatePodSecurityPolicySpec(&new.Spec, field.NewPath("spec"))...) return allErrs } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/validation/validation_test.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/validation/validation_test.go index f0fbad786..c421bdd40 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/validation/validation_test.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/validation/validation_test.go @@ -22,9 +22,10 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/util" - errors "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/controller/podautoscaler" + "k8s.io/kubernetes/pkg/util/intstr" ) func TestValidateHorizontalPodAutoscaler(t *testing.T) { @@ -36,6 +37,8 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { }, Spec: extensions.HorizontalPodAutoscalerSpec{ ScaleRef: extensions.SubresourceReference{ + Kind: "ReplicationController", + Name: "myrc", Subresource: "scale", }, MinReplicas: newInt(1), @@ -50,6 +53,26 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { }, Spec: extensions.HorizontalPodAutoscalerSpec{ ScaleRef: extensions.SubresourceReference{ + Kind: "ReplicationController", + Name: "myrc", + Subresource: "scale", + }, + MinReplicas: newInt(1), + MaxReplicas: 5, + }, + }, + { + ObjectMeta: api.ObjectMeta{ + Name: "myautoscaler", + Namespace: api.NamespaceDefault, + Annotations: map[string]string{ + podautoscaler.HpaCustomMetricsTargetAnnotationName: "{\"items\":[{\"name\":\"qps\",\"value\":\"20\"}]}", + }, + }, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{ + Kind: "ReplicationController", + Name: "myrc", Subresource: "scale", }, MinReplicas: newInt(1), @@ -67,6 +90,90 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { horizontalPodAutoscaler extensions.HorizontalPodAutoscaler msg string }{ + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{Name: "myrc", Subresource: "scale"}, + MinReplicas: newInt(1), + MaxReplicas: 5, + CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, + }, + }, + msg: "scaleRef.kind: Required", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{Kind: "..", Name: "myrc", Subresource: "scale"}, + MinReplicas: newInt(1), + MaxReplicas: 5, + CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, + }, + }, + msg: "scaleRef.kind: Invalid", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Subresource: "scale"}, + MinReplicas: newInt(1), + MaxReplicas: 5, + CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, + }, + }, + msg: "scaleRef.name: Required", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "..", Subresource: "scale"}, + MinReplicas: newInt(1), + MaxReplicas: 5, + CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, + }, + }, + msg: "scaleRef.name: Invalid", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "myrc", Subresource: ""}, + MinReplicas: newInt(1), + MaxReplicas: 5, + CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, + }, + }, + msg: "scaleRef.subresource: Required", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "myrc", Subresource: ".."}, + MinReplicas: newInt(1), + MaxReplicas: 5, + CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, + }, + }, + msg: "scaleRef.subresource: Invalid", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "myrc", Subresource: "randomsubresource"}, + MinReplicas: newInt(1), + MaxReplicas: 5, + CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, + }, + }, + msg: "scaleRef.subresource: Unsupported", + }, { horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ ObjectMeta: api.ObjectMeta{ @@ -81,7 +188,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { MaxReplicas: 5, }, }, - msg: "must be bigger or equal to 1", + msg: "must be greater than 0", }, { horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ @@ -97,7 +204,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { MaxReplicas: 5, }, }, - msg: "must be bigger or equal to minReplicas", + msg: "must be greater than or equal to `minReplicas`", }, { horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ @@ -114,16 +221,100 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: -70}, }, }, - msg: "must be bigger or equal to 1", + msg: "must be greater than 0", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{ + Name: "myautoscaler", + Namespace: api.NamespaceDefault, + Annotations: map[string]string{ + podautoscaler.HpaCustomMetricsTargetAnnotationName: "broken", + }, + }, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{ + Kind: "ReplicationController", + Name: "myrc", + Subresource: "scale", + }, + MinReplicas: newInt(1), + MaxReplicas: 5, + }, + }, + msg: "failed to parse custom metrics target annotation", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{ + Name: "myautoscaler", + Namespace: api.NamespaceDefault, + Annotations: map[string]string{ + podautoscaler.HpaCustomMetricsTargetAnnotationName: "{}", + }, + }, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{ + Kind: "ReplicationController", + Name: "myrc", + Subresource: "scale", + }, + MinReplicas: newInt(1), + MaxReplicas: 5, + }, + }, + msg: "custom metrics target must not be empty", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{ + Name: "myautoscaler", + Namespace: api.NamespaceDefault, + Annotations: map[string]string{ + podautoscaler.HpaCustomMetricsTargetAnnotationName: "{\"items\":[{\"value\":\"20\"}]}", + }, + }, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{ + Kind: "ReplicationController", + Name: "myrc", + Subresource: "scale", + }, + MinReplicas: newInt(1), + MaxReplicas: 5, + }, + }, + msg: "missing custom metric target name", + }, + { + horizontalPodAutoscaler: extensions.HorizontalPodAutoscaler{ + ObjectMeta: api.ObjectMeta{ + Name: "myautoscaler", + Namespace: api.NamespaceDefault, + Annotations: map[string]string{ + podautoscaler.HpaCustomMetricsTargetAnnotationName: "{\"items\":[{\"name\":\"qps\",\"value\":\"0\"}]}", + }, + }, + Spec: extensions.HorizontalPodAutoscalerSpec{ + ScaleRef: extensions.SubresourceReference{ + Kind: "ReplicationController", + Name: "myrc", + Subresource: "scale", + }, + MinReplicas: newInt(1), + MaxReplicas: 5, + }, + }, + msg: "custom metric target value must be greater than 0", }, } for _, c := range errorCases { errs := ValidateHorizontalPodAutoscaler(&c.horizontalPodAutoscaler) if len(errs) == 0 { - t.Errorf("expected failure for %s", c.msg) + t.Errorf("expected failure for %q", c.msg) } else if !strings.Contains(errs[0].Error(), c.msg) { - t.Errorf("unexpected error: %v, expected: %s", errs[0], c.msg) + t.Errorf("unexpected error: %q, expected: %q", errs[0], c.msg) } } } @@ -281,15 +472,15 @@ func TestValidateDaemonSetUpdate(t *testing.T) { old: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, update: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, }, @@ -297,15 +488,15 @@ func TestValidateDaemonSetUpdate(t *testing.T) { old: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, update: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector2, - Template: &validPodTemplateAbc2.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector2}, + Template: validPodTemplateAbc2.Template, }, }, }, @@ -313,15 +504,15 @@ func TestValidateDaemonSetUpdate(t *testing.T) { old: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, update: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateNodeSelector.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateNodeSelector.Template, }, }, }, @@ -329,7 +520,7 @@ func TestValidateDaemonSetUpdate(t *testing.T) { for _, successCase := range successCases { successCase.old.ObjectMeta.ResourceVersion = "1" successCase.update.ObjectMeta.ResourceVersion = "1" - if errs := ValidateDaemonSetUpdate(&successCase.old, &successCase.update); len(errs) != 0 { + if errs := ValidateDaemonSetUpdate(&successCase.update, &successCase.old); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } @@ -338,15 +529,15 @@ func TestValidateDaemonSetUpdate(t *testing.T) { old: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, update: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, }, @@ -354,15 +545,15 @@ func TestValidateDaemonSetUpdate(t *testing.T) { old: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, update: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: invalidSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: invalidSelector}, + Template: validPodTemplateAbc.Template, }, }, }, @@ -370,15 +561,15 @@ func TestValidateDaemonSetUpdate(t *testing.T) { old: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, update: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &invalidPodTemplate.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: invalidPodTemplate.Template, }, }, }, @@ -386,15 +577,15 @@ func TestValidateDaemonSetUpdate(t *testing.T) { old: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, update: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateDef.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateDef.Template, }, }, }, @@ -402,21 +593,37 @@ func TestValidateDaemonSetUpdate(t *testing.T) { old: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplateAbc.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, }, }, update: extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &readWriteVolumePodTemplate.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: readWriteVolumePodTemplate.Template, + }, + }, + }, + "invalid update strategy": { + old: extensions.DaemonSet{ + ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, + Spec: extensions.DaemonSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplateAbc.Template, + }, + }, + update: extensions.DaemonSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.DaemonSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: invalidSelector}, + Template: validPodTemplateAbc.Template, }, }, }, } for testName, errorCase := range errorCases { - if errs := ValidateDaemonSetUpdate(&errorCase.old, &errorCase.update); len(errs) == 0 { + if errs := ValidateDaemonSetUpdate(&errorCase.update, &errorCase.old); len(errs) == 0 { t.Errorf("expected failure: %s", testName) } } @@ -452,15 +659,15 @@ func TestValidateDaemonSet(t *testing.T) { { ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplate.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplate.Template, }, }, { ObjectMeta: api.ObjectMeta{Name: "abc-123", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplate.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplate.Template, }, }, } @@ -474,34 +681,34 @@ func TestValidateDaemonSet(t *testing.T) { "zero-length ID": { ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplate.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplate.Template, }, }, "missing-namespace": { ObjectMeta: api.ObjectMeta{Name: "abc-123"}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplate.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplate.Template, }, }, "empty selector": { ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Template: &validPodTemplate.Template, + Template: validPodTemplate.Template, }, }, "selector_doesnt_match": { ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: map[string]string{"foo": "bar"}, - Template: &validPodTemplate.Template, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, + Template: validPodTemplate.Template, }, }, - "invalid manifest": { + "invalid template": { ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, }, }, "invalid_label": { @@ -513,8 +720,8 @@ func TestValidateDaemonSet(t *testing.T) { }, }, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplate.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplate.Template, }, }, "invalid_label 2": { @@ -526,7 +733,7 @@ func TestValidateDaemonSet(t *testing.T) { }, }, Spec: extensions.DaemonSetSpec{ - Template: &invalidPodTemplate.Template, + Template: invalidPodTemplate.Template, }, }, "invalid_annotation": { @@ -538,8 +745,8 @@ func TestValidateDaemonSet(t *testing.T) { }, }, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &validPodTemplate.Template, + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: validPodTemplate.Template, }, }, "invalid restart policy 1": { @@ -548,8 +755,8 @@ func TestValidateDaemonSet(t *testing.T) { Namespace: api.NamespaceDefault, }, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &api.PodTemplateSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: api.PodTemplateSpec{ Spec: api.PodSpec{ RestartPolicy: api.RestartPolicyOnFailure, DNSPolicy: api.DNSClusterFirst, @@ -567,8 +774,8 @@ func TestValidateDaemonSet(t *testing.T) { Namespace: api.NamespaceDefault, }, Spec: extensions.DaemonSetSpec{ - Selector: validSelector, - Template: &api.PodTemplateSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validSelector}, + Template: api.PodTemplateSpec{ Spec: api.PodSpec{ RestartPolicy: api.RestartPolicyNever, DNSPolicy: api.DNSClusterFirst, @@ -587,8 +794,9 @@ func TestValidateDaemonSet(t *testing.T) { t.Errorf("expected failure for %s", k) } for i := range errs { - field := errs[i].(*errors.ValidationError).Field + field := errs[i].Field if !strings.HasPrefix(field, "spec.template.") && + !strings.HasPrefix(field, "spec.updateStrategy") && field != "metadata.name" && field != "metadata.namespace" && field != "spec.selector" && @@ -610,10 +818,12 @@ func validDeployment() *extensions.Deployment { Namespace: api.NamespaceDefault, }, Spec: extensions.DeploymentSpec{ - Selector: map[string]string{ - "name": "abc", + Selector: &unversioned.LabelSelector{ + MatchLabels: map[string]string{ + "name": "abc", + }, }, - Template: &api.PodTemplateSpec{ + Template: api.PodTemplateSpec{ ObjectMeta: api.ObjectMeta{ Name: "abc", Namespace: api.NamespaceDefault, @@ -633,7 +843,9 @@ func validDeployment() *extensions.Deployment { }, }, }, - UniqueLabelKey: "my-label", + RollbackTo: &extensions.RollbackConfig{ + Revision: 1, + }, }, } } @@ -649,27 +861,24 @@ func TestValidateDeployment(t *testing.T) { } errorCases := map[string]*extensions.Deployment{} - errorCases["metadata.name: required value"] = &extensions.Deployment{ + errorCases["metadata.name: Required value"] = &extensions.Deployment{ ObjectMeta: api.ObjectMeta{ Namespace: api.NamespaceDefault, }, } // selector should match the labels in pod template. invalidSelectorDeployment := validDeployment() - invalidSelectorDeployment.Spec.Selector = map[string]string{ - "name": "def", + invalidSelectorDeployment.Spec.Selector = &unversioned.LabelSelector{ + MatchLabels: map[string]string{ + "name": "def", + }, } - errorCases["selector does not match labels"] = invalidSelectorDeployment + errorCases["`selector` does not match template `labels`"] = invalidSelectorDeployment // RestartPolicy should be always. invalidRestartPolicyDeployment := validDeployment() invalidRestartPolicyDeployment.Spec.Template.Spec.RestartPolicy = api.RestartPolicyNever - errorCases["unsupported value 'Never'"] = invalidRestartPolicyDeployment - - // invalid unique label key. - invalidUniqueLabelDeployment := validDeployment() - invalidUniqueLabelDeployment.Spec.UniqueLabelKey = "abc/def/ghi" - errorCases["spec.uniqueLabel: invalid value"] = invalidUniqueLabelDeployment + errorCases["Unsupported value: \"Never\""] = invalidRestartPolicyDeployment // rollingUpdate should be nil for recreate. invalidRecreateDeployment := validDeployment() @@ -677,51 +886,96 @@ func TestValidateDeployment(t *testing.T) { Type: extensions.RecreateDeploymentStrategyType, RollingUpdate: &extensions.RollingUpdateDeployment{}, } - errorCases["rollingUpdate should be nil when strategy type is Recreate"] = invalidRecreateDeployment + errorCases["may not be specified when strategy `type` is 'Recreate'"] = invalidRecreateDeployment // MaxSurge should be in the form of 20%. invalidMaxSurgeDeployment := validDeployment() invalidMaxSurgeDeployment.Spec.Strategy = extensions.DeploymentStrategy{ Type: extensions.RollingUpdateDeploymentStrategyType, RollingUpdate: &extensions.RollingUpdateDeployment{ - MaxSurge: util.NewIntOrStringFromString("20Percent"), + MaxSurge: intstr.FromString("20Percent"), }, } - errorCases["value should be int(5) or percentage(5%)"] = invalidMaxSurgeDeployment + errorCases["must be an integer or percentage"] = invalidMaxSurgeDeployment // MaxSurge and MaxUnavailable cannot both be zero. invalidRollingUpdateDeployment := validDeployment() invalidRollingUpdateDeployment.Spec.Strategy = extensions.DeploymentStrategy{ Type: extensions.RollingUpdateDeploymentStrategyType, RollingUpdate: &extensions.RollingUpdateDeployment{ - MaxSurge: util.NewIntOrStringFromString("0%"), - MaxUnavailable: util.NewIntOrStringFromInt(0), + MaxSurge: intstr.FromString("0%"), + MaxUnavailable: intstr.FromInt(0), }, } - errorCases["cannot be 0 when maxSurge is 0 as well"] = invalidRollingUpdateDeployment + errorCases["may not be 0 when `maxSurge` is 0"] = invalidRollingUpdateDeployment // MaxUnavailable should not be more than 100%. invalidMaxUnavailableDeployment := validDeployment() invalidMaxUnavailableDeployment.Spec.Strategy = extensions.DeploymentStrategy{ Type: extensions.RollingUpdateDeploymentStrategyType, RollingUpdate: &extensions.RollingUpdateDeployment{ - MaxUnavailable: util.NewIntOrStringFromString("110%"), + MaxUnavailable: intstr.FromString("110%"), }, } - errorCases["should not be more than 100%"] = invalidMaxUnavailableDeployment + errorCases["must not be greater than 100%"] = invalidMaxUnavailableDeployment + + // Rollback.Revision must be non-negative + invalidRollbackRevisionDeployment := validDeployment() + invalidRollbackRevisionDeployment.Spec.RollbackTo.Revision = -3 + errorCases["must be greater than or equal to 0"] = invalidRollbackRevisionDeployment for k, v := range errorCases { errs := ValidateDeployment(v) if len(errs) == 0 { - t.Errorf("expected failure for %s", k) + t.Errorf("[%s] expected failure", k) } else if !strings.Contains(errs[0].Error(), k) { - t.Errorf("unexpected error: %v, expected: %s", errs[0], k) + t.Errorf("unexpected error: %q, expected: %q", errs[0].Error(), k) + } + } +} + +func validDeploymentRollback() *extensions.DeploymentRollback { + return &extensions.DeploymentRollback{ + Name: "abc", + UpdatedAnnotations: map[string]string{ + "created-by": "abc", + }, + RollbackTo: extensions.RollbackConfig{ + Revision: 1, + }, + } +} + +func TestValidateDeploymentRollback(t *testing.T) { + noAnnotation := validDeploymentRollback() + noAnnotation.UpdatedAnnotations = nil + successCases := []*extensions.DeploymentRollback{ + validDeploymentRollback(), + noAnnotation, + } + for _, successCase := range successCases { + if errs := ValidateDeploymentRollback(successCase); len(errs) != 0 { + t.Errorf("expected success: %v", errs) + } + } + + errorCases := map[string]*extensions.DeploymentRollback{} + invalidNoName := validDeploymentRollback() + invalidNoName.Name = "" + errorCases["name: Required value"] = invalidNoName + + for k, v := range errorCases { + errs := ValidateDeploymentRollback(v) + if len(errs) == 0 { + t.Errorf("[%s] expected failure", k) + } else if !strings.Contains(errs[0].Error(), k) { + t.Errorf("unexpected error: %q, expected: %q", errs[0].Error(), k) } } } func TestValidateJob(t *testing.T) { - validSelector := &extensions.PodSelector{ + validSelector := &unversioned.LabelSelector{ MatchLabels: map[string]string{"a": "b"}, } validPodTemplateSpec := api.PodTemplateSpec{ @@ -752,8 +1006,9 @@ func TestValidateJob(t *testing.T) { } } negative := -1 + negative64 := int64(-1) errorCases := map[string]extensions.Job{ - "spec.parallelism:must be non-negative": { + "spec.parallelism:must be greater than or equal to 0": { ObjectMeta: api.ObjectMeta{ Name: "myjob", Namespace: api.NamespaceDefault, @@ -764,7 +1019,7 @@ func TestValidateJob(t *testing.T) { Template: validPodTemplateSpec, }, }, - "spec.completions:must be non-negative": { + "spec.completions:must be greater than or equal to 0": { ObjectMeta: api.ObjectMeta{ Name: "myjob", Namespace: api.NamespaceDefault, @@ -775,7 +1030,18 @@ func TestValidateJob(t *testing.T) { Template: validPodTemplateSpec, }, }, - "spec.selector:required value": { + "spec.activeDeadlineSeconds:must be greater than or equal to 0": { + ObjectMeta: api.ObjectMeta{ + Name: "myjob", + Namespace: api.NamespaceDefault, + }, + Spec: extensions.JobSpec{ + ActiveDeadlineSeconds: &negative64, + Selector: validSelector, + Template: validPodTemplateSpec, + }, + }, + "spec.selector:Required value": { ObjectMeta: api.ObjectMeta{ Name: "myjob", Namespace: api.NamespaceDefault, @@ -784,7 +1050,7 @@ func TestValidateJob(t *testing.T) { Template: validPodTemplateSpec, }, }, - "spec.template.metadata.labels: invalid value 'map[y:z]', Details: selector does not match template": { + "spec.template.metadata.labels: Invalid value: {\"y\":\"z\"}: `selector` does not match template `labels`": { ObjectMeta: api.ObjectMeta{ Name: "myjob", Namespace: api.NamespaceDefault, @@ -803,7 +1069,7 @@ func TestValidateJob(t *testing.T) { }, }, }, - "spec.template.spec.restartPolicy:unsupported value": { + "spec.template.spec.restartPolicy: Unsupported value": { ObjectMeta: api.ObjectMeta{ Name: "myjob", Namespace: api.NamespaceDefault, @@ -830,9 +1096,9 @@ func TestValidateJob(t *testing.T) { t.Errorf("expected failure for %s", k) } else { s := strings.Split(k, ":") - err := errs[0].(*errors.ValidationError) + err := errs[0] if err.Field != s[0] || !strings.Contains(err.Error(), s[1]) { - t.Errorf("unexpected error: %v, expected: %s", errs[0], k) + t.Errorf("unexpected error: %v, expected: %s", err, k) } } } @@ -843,7 +1109,7 @@ type ingressRules map[string]string func TestValidateIngress(t *testing.T) { defaultBackend := extensions.IngressBackend{ ServiceName: "default-backend", - ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80}, + ServicePort: intstr.FromInt(80), } newValid := func() extensions.Ingress { @@ -855,7 +1121,7 @@ func TestValidateIngress(t *testing.T) { Spec: extensions.IngressSpec{ Backend: &extensions.IngressBackend{ ServiceName: "default-backend", - ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80}, + ServicePort: intstr.FromInt(80), }, Rules: []extensions.IngressRule{ { @@ -907,20 +1173,22 @@ func TestValidateIngress(t *testing.T) { Backend: defaultBackend, }, } - badPathErr := fmt.Sprintf("spec.rules.ingressRule.http.path: invalid value '%v'", - badPathExpr) + badPathErr := fmt.Sprintf("spec.rules[0].http.paths[0].path: Invalid value: '%v'", badPathExpr) hostIP := "127.0.0.1" badHostIP := newValid() badHostIP.Spec.Rules[0].Host = hostIP - badHostIPErr := fmt.Sprintf("spec.rules.host: invalid value '%v'", hostIP) + badHostIPErr := fmt.Sprintf("spec.rules[0].host: Invalid value: '%v'", hostIP) + noSecretName := newValid() + noSecretName.Spec.TLS = []extensions.IngressTLS{{SecretName: ""}} errorCases := map[string]extensions.Ingress{ - "spec.backend.serviceName: required value": servicelessBackend, - "spec.backend.serviceName: invalid value": invalidNameBackend, - "spec.backend.servicePort: invalid value": noPortBackend, - "spec.rules.host: invalid value": badHost, - "spec.rules.ingressRule.http.paths: required value": noPaths, - "spec.rules.ingressRule.http.path: invalid value": noForwardSlashPath, + "spec.backend.serviceName: Required value": servicelessBackend, + "spec.backend.serviceName: Invalid value": invalidNameBackend, + "spec.backend.servicePort: Invalid value": noPortBackend, + "spec.rules[0].host: Invalid value": badHost, + "spec.rules[0].http.paths: Required value": noPaths, + "spec.rules[0].http.paths[0].path: Invalid value": noForwardSlashPath, + "spec.tls[0].secretName: Required value": noSecretName, } errorCases[badPathErr] = badRegexPath errorCases[badHostIPErr] = badHostIP @@ -928,12 +1196,12 @@ func TestValidateIngress(t *testing.T) { for k, v := range errorCases { errs := ValidateIngress(&v) if len(errs) == 0 { - t.Errorf("expected failure for %s", k) + t.Errorf("expected failure for %q", k) } else { s := strings.Split(k, ":") - err := errs[0].(*errors.ValidationError) + err := errs[0] if err.Field != s[0] || !strings.Contains(err.Error(), s[1]) { - t.Errorf("unexpected error: %v, expected: %s", errs[0], k) + t.Errorf("unexpected error: %q, expected: %q", err, k) } } } @@ -942,7 +1210,7 @@ func TestValidateIngress(t *testing.T) { func TestValidateIngressStatusUpdate(t *testing.T) { defaultBackend := extensions.IngressBackend{ ServiceName: "default-backend", - ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80}, + ServicePort: intstr.FromInt(80), } newValid := func() extensions.Ingress { @@ -955,7 +1223,7 @@ func TestValidateIngressStatusUpdate(t *testing.T) { Spec: extensions.IngressSpec{ Backend: &extensions.IngressBackend{ ServiceName: "default-backend", - ServicePort: util.IntOrString{Kind: util.IntstrInt, IntVal: 80}, + ServicePort: intstr.FromInt(80), }, Rules: []extensions.IngressRule{ { @@ -1014,8 +1282,8 @@ func TestValidateIngressStatusUpdate(t *testing.T) { } errorCases := map[string]extensions.Ingress{ - "status.loadBalancer.ingress.ip: invalid value": invalidIP, - "status.loadBalancer.ingress.hostname: invalid value": invalidHostname, + "status.loadBalancer.ingress[0].ip: Invalid value": invalidIP, + "status.loadBalancer.ingress[0].hostname: Invalid value": invalidHostname, } for k, v := range errorCases { errs := ValidateIngressStatusUpdate(&v, &oldValue) @@ -1023,9 +1291,9 @@ func TestValidateIngressStatusUpdate(t *testing.T) { t.Errorf("expected failure for %s", k) } else { s := strings.Split(k, ":") - err := errs[0].(*errors.ValidationError) + err := errs[0] if err.Field != s[0] || !strings.Contains(err.Error(), s[1]) { - t.Errorf("unexpected error: %v, expected: %s", errs[0], k) + t.Errorf("unexpected error: %q, expected: %q", err, k) } } } @@ -1057,7 +1325,7 @@ func TestValidateClusterAutoscaler(t *testing.T) { } errorCases := map[string]extensions.ClusterAutoscaler{ - "name must be ClusterAutoscaler": { + "must be 'ClusterAutoscaler'": { ObjectMeta: api.ObjectMeta{ Name: "TestClusterAutoscaler", Namespace: api.NamespaceDefault, @@ -1073,7 +1341,7 @@ func TestValidateClusterAutoscaler(t *testing.T) { }, }, }, - "namespace must be default": { + "must be 'default'": { ObjectMeta: api.ObjectMeta{ Name: "ClusterAutoscaler", Namespace: "test", @@ -1090,7 +1358,7 @@ func TestValidateClusterAutoscaler(t *testing.T) { }, }, - `must be non-negative`: { + `must be greater than or equal to 0`: { ObjectMeta: api.ObjectMeta{ Name: "ClusterAutoscaler", Namespace: api.NamespaceDefault, @@ -1106,7 +1374,7 @@ func TestValidateClusterAutoscaler(t *testing.T) { }, }, }, - `must be bigger or equal to minNodes`: { + "must be greater than or equal to `minNodes`": { ObjectMeta: api.ObjectMeta{ Name: "ClusterAutoscaler", Namespace: api.NamespaceDefault, @@ -1122,7 +1390,7 @@ func TestValidateClusterAutoscaler(t *testing.T) { }, }, }, - "required value": { + "Required value": { ObjectMeta: api.ObjectMeta{ Name: "ClusterAutoscaler", Namespace: api.NamespaceDefault, @@ -1138,9 +1406,538 @@ func TestValidateClusterAutoscaler(t *testing.T) { for k, v := range errorCases { errs := ValidateClusterAutoscaler(&v) if len(errs) == 0 { - t.Errorf("expected failure for %s", k) + t.Errorf("[%s] expected failure", k) } else if !strings.Contains(errs[0].Error(), k) { - t.Errorf("unexpected error: %v, expected: %s", errs[0], k) + t.Errorf("unexpected error: %v, expected: %q", errs[0], k) + } + } +} + +func TestValidateScale(t *testing.T) { + successCases := []extensions.Scale{ + { + ObjectMeta: api.ObjectMeta{ + Name: "frontend", + Namespace: api.NamespaceDefault, + }, + Spec: extensions.ScaleSpec{ + Replicas: 1, + }, + }, + { + ObjectMeta: api.ObjectMeta{ + Name: "frontend", + Namespace: api.NamespaceDefault, + }, + Spec: extensions.ScaleSpec{ + Replicas: 10, + }, + }, + { + ObjectMeta: api.ObjectMeta{ + Name: "frontend", + Namespace: api.NamespaceDefault, + }, + Spec: extensions.ScaleSpec{ + Replicas: 0, + }, + }, + } + + for _, successCase := range successCases { + if errs := ValidateScale(&successCase); len(errs) != 0 { + t.Errorf("expected success: %v", errs) + } + } + + errorCases := []struct { + scale extensions.Scale + msg string + }{ + { + scale: extensions.Scale{ + ObjectMeta: api.ObjectMeta{ + Name: "frontend", + Namespace: api.NamespaceDefault, + }, + Spec: extensions.ScaleSpec{ + Replicas: -1, + }, + }, + msg: "must be greater than or equal to 0", + }, + } + + for _, c := range errorCases { + if errs := ValidateScale(&c.scale); len(errs) == 0 { + t.Errorf("expected failure for %s", c.msg) + } else if !strings.Contains(errs[0].Error(), c.msg) { + t.Errorf("unexpected error: %v, expected: %s", errs[0], c.msg) + } + } +} + +func TestValidateReplicaSetStatusUpdate(t *testing.T) { + validLabels := map[string]string{"a": "b"} + validPodTemplate := api.PodTemplate{ + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: validLabels, + }, + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + }, + }, + } + type rcUpdateTest struct { + old extensions.ReplicaSet + update extensions.ReplicaSet + } + successCases := []rcUpdateTest{ + { + old: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + Status: extensions.ReplicaSetStatus{ + Replicas: 2, + }, + }, + update: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: 3, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + Status: extensions.ReplicaSetStatus{ + Replicas: 4, + }, + }, + }, + } + for _, successCase := range successCases { + successCase.old.ObjectMeta.ResourceVersion = "1" + successCase.update.ObjectMeta.ResourceVersion = "1" + if errs := ValidateReplicaSetStatusUpdate(&successCase.update, &successCase.old); len(errs) != 0 { + t.Errorf("expected success: %v", errs) + } + } + errorCases := map[string]rcUpdateTest{ + "negative replicas": { + old: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + Status: extensions.ReplicaSetStatus{ + Replicas: 3, + }, + }, + update: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + Status: extensions.ReplicaSetStatus{ + Replicas: -3, + }, + }, + }, + } + for testName, errorCase := range errorCases { + if errs := ValidateReplicaSetStatusUpdate(&errorCase.update, &errorCase.old); len(errs) == 0 { + t.Errorf("expected failure: %s", testName) + } + } + +} + +func TestValidateReplicaSetUpdate(t *testing.T) { + validLabels := map[string]string{"a": "b"} + validPodTemplate := api.PodTemplate{ + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: validLabels, + }, + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + }, + }, + } + readWriteVolumePodTemplate := api.PodTemplate{ + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: validLabels, + }, + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + Volumes: []api.Volume{{Name: "gcepd", VolumeSource: api.VolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{PDName: "my-PD", FSType: "ext4", Partition: 1, ReadOnly: false}}}}, + }, + }, + } + invalidLabels := map[string]string{"NoUppercaseOrSpecialCharsLike=Equals": "b"} + invalidPodTemplate := api.PodTemplate{ + Template: api.PodTemplateSpec{ + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + ObjectMeta: api.ObjectMeta{ + Labels: invalidLabels, + }, + }, + } + type rcUpdateTest struct { + old extensions.ReplicaSet + update extensions.ReplicaSet + } + successCases := []rcUpdateTest{ + { + old: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + update: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: 3, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + }, + { + old: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + update: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: 1, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &readWriteVolumePodTemplate.Template, + }, + }, + }, + } + for _, successCase := range successCases { + successCase.old.ObjectMeta.ResourceVersion = "1" + successCase.update.ObjectMeta.ResourceVersion = "1" + if errs := ValidateReplicaSetUpdate(&successCase.update, &successCase.old); len(errs) != 0 { + t.Errorf("expected success: %v", errs) + } + } + errorCases := map[string]rcUpdateTest{ + "more than one read/write": { + old: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + update: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &readWriteVolumePodTemplate.Template, + }, + }, + }, + "invalid selector": { + old: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + update: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Selector: &unversioned.LabelSelector{MatchLabels: invalidLabels}, + Template: &validPodTemplate.Template, + }, + }, + }, + "invalid pod": { + old: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + update: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &invalidPodTemplate.Template, + }, + }, + }, + "negative replicas": { + old: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + update: extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: -1, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + }, + } + for testName, errorCase := range errorCases { + if errs := ValidateReplicaSetUpdate(&errorCase.update, &errorCase.old); len(errs) == 0 { + t.Errorf("expected failure: %s", testName) + } + } +} + +func TestValidateReplicaSet(t *testing.T) { + validLabels := map[string]string{"a": "b"} + validPodTemplate := api.PodTemplate{ + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: validLabels, + }, + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + }, + }, + } + readWriteVolumePodTemplate := api.PodTemplate{ + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: validLabels, + }, + Spec: api.PodSpec{ + Volumes: []api.Volume{{Name: "gcepd", VolumeSource: api.VolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{PDName: "my-PD", FSType: "ext4", Partition: 1, ReadOnly: false}}}}, + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + }, + }, + } + invalidLabels := map[string]string{"NoUppercaseOrSpecialCharsLike=Equals": "b"} + invalidPodTemplate := api.PodTemplate{ + Template: api.PodTemplateSpec{ + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyAlways, + DNSPolicy: api.DNSClusterFirst, + }, + ObjectMeta: api.ObjectMeta{ + Labels: invalidLabels, + }, + }, + } + successCases := []extensions.ReplicaSet{ + { + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + { + ObjectMeta: api.ObjectMeta{Name: "abc-123", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + { + ObjectMeta: api.ObjectMeta{Name: "abc-123", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: 1, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &readWriteVolumePodTemplate.Template, + }, + }, + } + for _, successCase := range successCases { + if errs := ValidateReplicaSet(&successCase); len(errs) != 0 { + t.Errorf("expected success: %v", errs) + } + } + + errorCases := map[string]extensions.ReplicaSet{ + "zero-length ID": { + ObjectMeta: api.ObjectMeta{Name: "", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + "missing-namespace": { + ObjectMeta: api.ObjectMeta{Name: "abc-123"}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + "empty selector": { + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Template: &validPodTemplate.Template, + }, + }, + "selector_doesnt_match": { + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, + Template: &validPodTemplate.Template, + }, + }, + "invalid manifest": { + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + }, + }, + "read-write persistent disk with > 1 pod": { + ObjectMeta: api.ObjectMeta{Name: "abc"}, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &readWriteVolumePodTemplate.Template, + }, + }, + "negative_replicas": { + ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: api.NamespaceDefault}, + Spec: extensions.ReplicaSetSpec{ + Replicas: -1, + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + }, + }, + "invalid_label": { + ObjectMeta: api.ObjectMeta{ + Name: "abc-123", + Namespace: api.NamespaceDefault, + Labels: map[string]string{ + "NoUppercaseOrSpecialCharsLike=Equals": "bar", + }, + }, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + "invalid_label 2": { + ObjectMeta: api.ObjectMeta{ + Name: "abc-123", + Namespace: api.NamespaceDefault, + Labels: map[string]string{ + "NoUppercaseOrSpecialCharsLike=Equals": "bar", + }, + }, + Spec: extensions.ReplicaSetSpec{ + Template: &invalidPodTemplate.Template, + }, + }, + "invalid_annotation": { + ObjectMeta: api.ObjectMeta{ + Name: "abc-123", + Namespace: api.NamespaceDefault, + Annotations: map[string]string{ + "NoUppercaseOrSpecialCharsLike=Equals": "bar", + }, + }, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &validPodTemplate.Template, + }, + }, + "invalid restart policy 1": { + ObjectMeta: api.ObjectMeta{ + Name: "abc-123", + Namespace: api.NamespaceDefault, + }, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &api.PodTemplateSpec{ + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyOnFailure, + DNSPolicy: api.DNSClusterFirst, + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + }, + ObjectMeta: api.ObjectMeta{ + Labels: validLabels, + }, + }, + }, + }, + "invalid restart policy 2": { + ObjectMeta: api.ObjectMeta{ + Name: "abc-123", + Namespace: api.NamespaceDefault, + }, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: validLabels}, + Template: &api.PodTemplateSpec{ + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyNever, + DNSPolicy: api.DNSClusterFirst, + Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}}, + }, + ObjectMeta: api.ObjectMeta{ + Labels: validLabels, + }, + }, + }, + }, + } + for k, v := range errorCases { + errs := ValidateReplicaSet(&v) + if len(errs) == 0 { + t.Errorf("expected failure for %s", k) + } + for i := range errs { + field := errs[i].Field + if !strings.HasPrefix(field, "spec.template.") && + field != "metadata.name" && + field != "metadata.namespace" && + field != "spec.selector" && + field != "spec.template" && + field != "GCEPersistentDisk.ReadOnly" && + field != "spec.replicas" && + field != "spec.template.labels" && + field != "metadata.annotations" && + field != "metadata.labels" && + field != "status.replicas" { + t.Errorf("%s: missing prefix for: %v", k, errs[i]) + } } } } @@ -1150,3 +1947,126 @@ func newInt(val int) *int { *p = val return p } + +func TestValidatePodSecurityPolicy(t *testing.T) { + validSCC := func() *extensions.PodSecurityPolicy { + return &extensions.PodSecurityPolicy{ + ObjectMeta: api.ObjectMeta{Name: "foo"}, + Spec: extensions.PodSecurityPolicySpec{ + SELinuxContext: extensions.SELinuxContextStrategyOptions{ + Type: extensions.SELinuxStrategyRunAsAny, + }, + RunAsUser: extensions.RunAsUserStrategyOptions{ + Type: extensions.RunAsUserStrategyRunAsAny, + }, + }, + } + } + + noUserOptions := validSCC() + noUserOptions.Spec.RunAsUser.Type = "" + + noSELinuxOptions := validSCC() + noSELinuxOptions.Spec.SELinuxContext.Type = "" + + invalidUserStratType := validSCC() + invalidUserStratType.Spec.RunAsUser.Type = "invalid" + + invalidSELinuxStratType := validSCC() + invalidSELinuxStratType.Spec.SELinuxContext.Type = "invalid" + + missingObjectMetaName := validSCC() + missingObjectMetaName.ObjectMeta.Name = "" + + invalidRangeMinGreaterThanMax := validSCC() + invalidRangeMinGreaterThanMax.Spec.RunAsUser.Ranges = []extensions.IDRange{ + {Min: 2, Max: 1}, + } + + invalidRangeNegativeMin := validSCC() + invalidRangeNegativeMin.Spec.RunAsUser.Ranges = []extensions.IDRange{ + {Min: -1, Max: 10}, + } + + invalidRangeNegativeMax := validSCC() + invalidRangeNegativeMax.Spec.RunAsUser.Ranges = []extensions.IDRange{ + {Min: 1, Max: -10}, + } + + errorCases := map[string]struct { + scc *extensions.PodSecurityPolicy + errorDetail string + }{ + "no user options": { + scc: noUserOptions, + errorDetail: "supported values: MustRunAs, MustRunAsNonRoot, RunAsAny", + }, + "no selinux options": { + scc: noSELinuxOptions, + errorDetail: "supported values: MustRunAs, RunAsAny", + }, + "invalid user strategy type": { + scc: invalidUserStratType, + errorDetail: "supported values: MustRunAs, MustRunAsNonRoot, RunAsAny", + }, + "invalid selinux strategy type": { + scc: invalidSELinuxStratType, + errorDetail: "supported values: MustRunAs, RunAsAny", + }, + "missing object meta name": { + scc: missingObjectMetaName, + errorDetail: "name or generateName is required", + }, + "invalid range min greater than max": { + scc: invalidRangeMinGreaterThanMax, + errorDetail: "min cannot be greater than max", + }, + "invalid range negative min": { + scc: invalidRangeNegativeMin, + errorDetail: "min cannot be negative", + }, + "invalid range negative max": { + scc: invalidRangeNegativeMax, + errorDetail: "max cannot be negative", + }, + } + + for k, v := range errorCases { + if errs := ValidatePodSecurityPolicy(v.scc); len(errs) == 0 || errs[0].Detail != v.errorDetail { + t.Errorf("Expected error with detail %s for %s, got %v", v.errorDetail, k, errs[0].Detail) + } + } + + mustRunAs := validSCC() + mustRunAs.Spec.RunAsUser.Type = extensions.RunAsUserStrategyMustRunAs + mustRunAs.Spec.RunAsUser.Ranges = []extensions.IDRange{ + { + Min: 1, + Max: 1, + }, + } + mustRunAs.Spec.SELinuxContext.Type = extensions.SELinuxStrategyMustRunAs + + runAsNonRoot := validSCC() + runAsNonRoot.Spec.RunAsUser.Type = extensions.RunAsUserStrategyMustRunAsNonRoot + + successCases := map[string]struct { + scc *extensions.PodSecurityPolicy + }{ + "must run as": { + scc: mustRunAs, + }, + "run as any": { + scc: validSCC(), + }, + "run as non-root (user only)": { + scc: runAsNonRoot, + }, + } + + for k, v := range successCases { + if errs := ValidatePodSecurityPolicy(v.scc); len(errs) != 0 { + t.Errorf("Expected success for %s, got %v", k, errs) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/deep_copy_generated.go new file mode 100644 index 000000000..e7562de52 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/deep_copy_generated.go @@ -0,0 +1,29 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh. + +package metrics + +import api "k8s.io/kubernetes/pkg/api" + +func init() { + err := api.Scheme.AddGeneratedDeepCopyFuncs() + if err != nil { + // if one of the deep copy functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/install/install.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/install/install.go new file mode 100644 index 000000000..e83c91cc4 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/install/install.go @@ -0,0 +1,129 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package install installs the metrics API group, making it available as +// an option to all of the API encoding/decoding machinery. +package install + +import ( + "fmt" + + "github.com/golang/glog" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/metrics" + "k8s.io/kubernetes/pkg/apis/metrics/v1alpha1" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/sets" +) + +const importPrefix = "k8s.io/kubernetes/pkg/apis/metrics" + +var accessor = meta.NewAccessor() + +// availableVersions lists all known external versions for this group from most preferred to least preferred +var availableVersions = []unversioned.GroupVersion{v1alpha1.SchemeGroupVersion} + +func init() { + registered.RegisterVersions(availableVersions) + externalVersions := []unversioned.GroupVersion{} + for _, v := range availableVersions { + if registered.IsAllowedVersion(v) { + externalVersions = append(externalVersions, v) + } + } + if len(externalVersions) == 0 { + glog.V(4).Infof("No version is registered for group %v", metrics.GroupName) + return + } + + if err := registered.EnableVersions(externalVersions...); err != nil { + glog.V(4).Infof("%v", err) + return + } + if err := enableVersions(externalVersions); err != nil { + glog.V(4).Infof("%v", err) + return + } +} + +// TODO: enableVersions should be centralized rather than spread in each API +// group. +// We can combine registered.RegisterVersions, registered.EnableVersions and +// registered.RegisterGroup once we have moved enableVersions there. +func enableVersions(externalVersions []unversioned.GroupVersion) error { + addVersionsToScheme(externalVersions...) + preferredExternalVersion := externalVersions[0] + + groupMeta := apimachinery.GroupMeta{ + GroupVersion: preferredExternalVersion, + GroupVersions: externalVersions, + RESTMapper: newRESTMapper(externalVersions), + SelfLinker: runtime.SelfLinker(accessor), + InterfacesFor: interfacesFor, + } + + if err := registered.RegisterGroup(groupMeta); err != nil { + return err + } + api.RegisterRESTMapper(groupMeta.RESTMapper) + return nil +} + +func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { + // the list of kinds that are scoped at the root of the api hierarchy + // if a kind is not enumerated here, it is assumed to have a namespace scope + rootScoped := sets.NewString() + + ignoredKinds := sets.NewString() + + return api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) +} + +// interfacesFor returns the default Codec and ResourceVersioner for a given version +// string, or an error if the version is not known. +func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { + switch version { + case v1alpha1.SchemeGroupVersion: + return &meta.VersionInterfaces{ + ObjectConvertor: api.Scheme, + MetadataAccessor: accessor, + }, nil + default: + g, _ := registered.Group(metrics.GroupName) + return nil, fmt.Errorf("unsupported storage version: %s (valid: %v)", version, g.GroupVersions) + } +} + +func addVersionsToScheme(externalVersions ...unversioned.GroupVersion) { + // add the internal version to Scheme + metrics.AddToScheme(api.Scheme) + // add the enabled external versions to Scheme + for _, v := range externalVersions { + if !registered.IsEnabledVersion(v) { + glog.Errorf("Version %s is not enabled, so it will not be added to the Scheme.", v) + continue + } + switch v { + case v1alpha1.SchemeGroupVersion: + v1alpha1.AddToScheme(api.Scheme) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/register.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/register.go new file mode 100644 index 000000000..29ad86a09 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/register.go @@ -0,0 +1,55 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package metrics + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +func AddToScheme(scheme *runtime.Scheme) { + // Add the API to Scheme. + addKnownTypes(scheme) +} + +// GroupName is the group name use in this package +const GroupName = "metrics" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) unversioned.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns back a Group qualified GroupResource +func Resource(resource string) unversioned.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) { + // TODO this will get cleaned up with the scheme types are fixed + scheme.AddKnownTypes(SchemeGroupVersion, + &RawNode{}, + &RawPod{}, + ) +} + +func (obj *RawNode) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *RawPod) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/types.generated.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/types.generated.go new file mode 100644 index 000000000..ecf3e8b36 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/types.generated.go @@ -0,0 +1,500 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED BY codecgen. +// ************************************************************ + +package metrics + +import ( + "errors" + "fmt" + codec1978 "github.com/ugorji/go/codec" + pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned" + "reflect" + "runtime" +) + +const ( + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- + codecSelferValueTypeArray1234 = 10 + codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 +) + +var ( + codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits()) + codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`) +) + +type codecSelfer1234 struct{} + +func init() { + if codec1978.GenVersion != 5 { + _, file, _, _ := runtime.Caller(0) + err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", + 5, codec1978.GenVersion, file) + panic(err) + } + if false { // reference the types, but skip this branch at build/run time + var v0 pkg1_unversioned.TypeMeta + _ = v0 + } +} + +func (x *RawNode) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RawNode) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RawNode) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RawNode) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *RawPod) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RawPod) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RawPod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RawPod) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/types.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/types.go new file mode 100644 index 000000000..1207116fc --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/types.go @@ -0,0 +1,29 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package metrics + +import "k8s.io/kubernetes/pkg/api/unversioned" + +// Placeholder top-level node resource metrics. +type RawNode struct { + unversioned.TypeMeta `json:",inline"` +} + +// Placeholder top-level pod resource metrics. +type RawPod struct { + unversioned.TypeMeta `json:",inline"` +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/conversion_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/conversion_generated.go new file mode 100644 index 000000000..928d2ca57 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/conversion_generated.go @@ -0,0 +1,96 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-conversions.sh + +package v1alpha1 + +import ( + reflect "reflect" + + api "k8s.io/kubernetes/pkg/api" + metrics "k8s.io/kubernetes/pkg/apis/metrics" + conversion "k8s.io/kubernetes/pkg/conversion" +) + +func autoConvert_metrics_RawNode_To_v1alpha1_RawNode(in *metrics.RawNode, out *RawNode, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*metrics.RawNode))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + return nil +} + +func Convert_metrics_RawNode_To_v1alpha1_RawNode(in *metrics.RawNode, out *RawNode, s conversion.Scope) error { + return autoConvert_metrics_RawNode_To_v1alpha1_RawNode(in, out, s) +} + +func autoConvert_metrics_RawPod_To_v1alpha1_RawPod(in *metrics.RawPod, out *RawPod, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*metrics.RawPod))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + return nil +} + +func Convert_metrics_RawPod_To_v1alpha1_RawPod(in *metrics.RawPod, out *RawPod, s conversion.Scope) error { + return autoConvert_metrics_RawPod_To_v1alpha1_RawPod(in, out, s) +} + +func autoConvert_v1alpha1_RawNode_To_metrics_RawNode(in *RawNode, out *metrics.RawNode, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*RawNode))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + return nil +} + +func Convert_v1alpha1_RawNode_To_metrics_RawNode(in *RawNode, out *metrics.RawNode, s conversion.Scope) error { + return autoConvert_v1alpha1_RawNode_To_metrics_RawNode(in, out, s) +} + +func autoConvert_v1alpha1_RawPod_To_metrics_RawPod(in *RawPod, out *metrics.RawPod, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*RawPod))(in) + } + if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { + return err + } + return nil +} + +func Convert_v1alpha1_RawPod_To_metrics_RawPod(in *RawPod, out *metrics.RawPod, s conversion.Scope) error { + return autoConvert_v1alpha1_RawPod_To_metrics_RawPod(in, out, s) +} + +func init() { + err := api.Scheme.AddGeneratedConversionFuncs( + autoConvert_metrics_RawNode_To_v1alpha1_RawNode, + autoConvert_metrics_RawPod_To_v1alpha1_RawPod, + autoConvert_v1alpha1_RawNode_To_metrics_RawNode, + autoConvert_v1alpha1_RawPod_To_metrics_RawPod, + ) + if err != nil { + // If one of the conversion functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/deep_copy_generated.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/deep_copy_generated.go new file mode 100644 index 000000000..d235d1a48 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/deep_copy_generated.go @@ -0,0 +1,57 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh. + +package v1alpha1 + +import ( + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + conversion "k8s.io/kubernetes/pkg/conversion" +) + +func deepCopy_unversioned_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error { + out.Kind = in.Kind + out.APIVersion = in.APIVersion + return nil +} + +func deepCopy_v1alpha1_RawNode(in RawNode, out *RawNode, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + return nil +} + +func deepCopy_v1alpha1_RawPod(in RawPod, out *RawPod, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + return nil +} + +func init() { + err := api.Scheme.AddGeneratedDeepCopyFuncs( + deepCopy_unversioned_TypeMeta, + deepCopy_v1alpha1_RawNode, + deepCopy_v1alpha1_RawPod, + ) + if err != nil { + // if one of the deep copy functions is malformed, detect it immediately. + panic(err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/register.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/register.go new file mode 100644 index 000000000..c943d5468 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/register.go @@ -0,0 +1,46 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/runtime" +) + +// GroupName is the group name use in this package +const GroupName = "metrics" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +func AddToScheme(scheme *runtime.Scheme) { + // Add the API to Scheme. + addKnownTypes(scheme) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) { + scheme.AddKnownTypes(SchemeGroupVersion, + &RawNode{}, + &RawPod{}, + &v1.DeleteOptions{}, + ) +} + +func (obj *RawNode) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *RawPod) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/types.generated.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/types.generated.go new file mode 100644 index 000000000..2e6d2f3c1 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/types.generated.go @@ -0,0 +1,500 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED BY codecgen. +// ************************************************************ + +package v1alpha1 + +import ( + "errors" + "fmt" + codec1978 "github.com/ugorji/go/codec" + pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned" + "reflect" + "runtime" +) + +const ( + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- + codecSelferValueTypeArray1234 = 10 + codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 +) + +var ( + codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits()) + codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`) +) + +type codecSelfer1234 struct{} + +func init() { + if codec1978.GenVersion != 5 { + _, file, _, _ := runtime.Caller(0) + err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", + 5, codec1978.GenVersion, file) + panic(err) + } + if false { // reference the types, but skip this branch at build/run time + var v0 pkg1_unversioned.TypeMeta + _ = v0 + } +} + +func (x *RawNode) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RawNode) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RawNode) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RawNode) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *RawPod) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [2]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(2) + } else { + yynn2 = 0 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RawPod) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RawPod) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RawPod) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj6-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/types.go b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/types.go new file mode 100644 index 000000000..1c45f0c23 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/apis/metrics/v1alpha1/types.go @@ -0,0 +1,29 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import "k8s.io/kubernetes/pkg/api/unversioned" + +// Placeholder top-level node resource metrics. +type RawNode struct { + unversioned.TypeMeta `json:",inline"` +} + +// Placeholder top-level pod resource metrics. +type RawPod struct { + unversioned.TypeMeta `json:",inline"` +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo.go b/vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo.go index fcf2c3137..e7cc1aad1 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo.go @@ -100,6 +100,12 @@ type DeltaFIFO struct { items map[string]Deltas queue []string + // populated is true if the first batch of items inserted by Replace() has been populated + // or Delete/Add/Update was called first. + populated bool + // initialPopulationCount is the number of items inserted by the first call of Replace() + initialPopulationCount int + // keyFunc is used to make the key used for queued item // insertion and retrieval, and should be deterministic. keyFunc KeyFunc @@ -141,11 +147,20 @@ func (f *DeltaFIFO) KeyOf(obj interface{}) (string, error) { return f.keyFunc(obj) } +// Return true if an Add/Update/Delete/AddIfNotPresent are called first, +// or an Update called first but the first batch of items inserted by Replace() has been popped +func (f *DeltaFIFO) HasSynced() bool { + f.lock.Lock() + defer f.lock.Unlock() + return f.populated && f.initialPopulationCount == 0 +} + // Add inserts an item, and puts it in the queue. The item is only enqueued // if it doesn't already exist in the set. func (f *DeltaFIFO) Add(obj interface{}) error { f.lock.Lock() defer f.lock.Unlock() + f.populated = true return f.queueActionLocked(Added, obj) } @@ -153,6 +168,7 @@ func (f *DeltaFIFO) Add(obj interface{}) error { func (f *DeltaFIFO) Update(obj interface{}) error { f.lock.Lock() defer f.lock.Unlock() + f.populated = true return f.queueActionLocked(Updated, obj) } @@ -166,6 +182,7 @@ func (f *DeltaFIFO) Delete(obj interface{}) error { } f.lock.Lock() defer f.lock.Unlock() + f.populated = true if f.knownObjects == nil { if _, exists := f.items[id]; !exists { // Presumably, this was deleted when a relist happened. @@ -203,6 +220,7 @@ func (f *DeltaFIFO) AddIfNotPresent(obj interface{}) error { } f.lock.Lock() defer f.lock.Unlock() + f.populated = true if _, exists := f.items[id]; exists { return nil } @@ -354,6 +372,9 @@ func (f *DeltaFIFO) Pop() interface{} { id := f.queue[0] f.queue = f.queue[1:] item, ok := f.items[id] + if f.initialPopulationCount > 0 { + f.initialPopulationCount-- + } if !ok { // Item may have been deleted subsequently. continue @@ -373,6 +394,12 @@ func (f *DeltaFIFO) Replace(list []interface{}, resourceVersion string) error { f.lock.Lock() defer f.lock.Unlock() keys := make(sets.String, len(list)) + + if !f.populated { + f.populated = true + f.initialPopulationCount = len(list) + } + for _, item := range list { key, err := f.KeyOf(item) if err != nil { diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo_test.go b/vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo_test.go index 6adec8605..8efd982b5 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo_test.go @@ -327,3 +327,59 @@ func TestDeltaFIFO_KeyOf(t *testing.T) { } } } + +func TestDeltaFIFO_HasSynced(t *testing.T) { + tests := []struct { + actions []func(f *DeltaFIFO) + expectedSynced bool + }{ + { + actions: []func(f *DeltaFIFO){}, + expectedSynced: false, + }, + { + actions: []func(f *DeltaFIFO){ + func(f *DeltaFIFO) { f.Add(mkFifoObj("a", 1)) }, + }, + expectedSynced: true, + }, + { + actions: []func(f *DeltaFIFO){ + func(f *DeltaFIFO) { f.Replace([]interface{}{}, "0") }, + }, + expectedSynced: true, + }, + { + actions: []func(f *DeltaFIFO){ + func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, + }, + expectedSynced: false, + }, + { + actions: []func(f *DeltaFIFO){ + func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, + func(f *DeltaFIFO) { f.Pop() }, + }, + expectedSynced: false, + }, + { + actions: []func(f *DeltaFIFO){ + func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, + func(f *DeltaFIFO) { f.Pop() }, + func(f *DeltaFIFO) { f.Pop() }, + }, + expectedSynced: true, + }, + } + + for i, test := range tests { + f := NewDeltaFIFO(testFifoObjectKeyFunc, nil, nil) + + for _, action := range test.actions { + action(f) + } + if e, a := test.expectedSynced, f.HasSynced(); a != e { + t.Errorf("test case %v failed, expected: %v , got %v", i, e, a) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/expiration_cache.go b/vendor/k8s.io/kubernetes/pkg/client/cache/expiration_cache.go index 0881bd0f0..5eb996b66 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/expiration_cache.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/expiration_cache.go @@ -21,6 +21,7 @@ import ( "github.com/golang/glog" "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/runtime" ) // ExpirationCache implements the store interface @@ -90,7 +91,7 @@ func (c *ExpirationCache) getOrExpire(key string) (interface{}, bool) { // fails; as long as we only return un-expired entries a // reader doesn't need to wait for the result of the delete. go func() { - defer util.HandleCrash() + defer runtime.HandleCrash() c.cacheStorage.Delete(key) }() return nil, false diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/expiration_cache_test.go b/vendor/k8s.io/kubernetes/pkg/client/cache/expiration_cache_test.go index 546b98d91..2e8cc5b57 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/expiration_cache_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/expiration_cache_test.go @@ -23,6 +23,7 @@ import ( "k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util/sets" + "k8s.io/kubernetes/pkg/util/wait" ) func TestTTLExpirationBasic(t *testing.T) { @@ -55,7 +56,7 @@ func TestTTLExpirationBasic(t *testing.T) { if delKey != key { t.Errorf("Unexpected delete for key %s", key) } - case <-time.After(util.ForeverTestTimeout): + case <-time.After(wait.ForeverTestTimeout): t.Errorf("Unexpected timeout waiting on delete") } close(deleteChan) @@ -100,7 +101,7 @@ func TestTTLList(t *testing.T) { t.Errorf("Unexpected delete for key %s", delKey) } expireKeys.Delete(delKey) - case <-time.After(util.ForeverTestTimeout): + case <-time.After(wait.ForeverTestTimeout): t.Errorf("Unexpected timeout waiting on delete") return } @@ -113,7 +114,7 @@ func TestTTLPolicy(t *testing.T) { exactlyOnTTL := fakeTime.Add(-ttl) expiredTime := fakeTime.Add(-(ttl + 1)) - policy := TTLPolicy{ttl, &util.FakeClock{Time: fakeTime}} + policy := TTLPolicy{ttl, util.NewFakeClock(fakeTime)} fakeTimestampedEntry := ×tampedEntry{obj: struct{}{}, timestamp: exactlyOnTTL} if policy.IsExpired(fakeTimestampedEntry) { t.Errorf("TTL cache should not expire entries exactly on ttl") diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/fifo.go b/vendor/k8s.io/kubernetes/pkg/client/cache/fifo.go index b56687ee0..d4076a326 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/fifo.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/fifo.go @@ -32,6 +32,9 @@ type Queue interface { // as nothing else (presumably more recent) // has since been added. AddIfNotPresent(interface{}) error + + // Return true if the first batch of items has been popped + HasSynced() bool } // FIFO receives adds and updates from a Reflector, and puts them in a queue for @@ -52,6 +55,13 @@ type FIFO struct { // We depend on the property that items in the set are in the queue and vice versa. items map[string]interface{} queue []string + + // populated is true if the first batch of items inserted by Replace() has been populated + // or Delete/Add/Update was called first. + populated bool + // initialPopulationCount is the number of items inserted by the first call of Replace() + initialPopulationCount int + // keyFunc is used to make the key used for queued item insertion and retrieval, and // should be deterministic. keyFunc KeyFunc @@ -61,6 +71,14 @@ var ( _ = Queue(&FIFO{}) // FIFO is a Queue ) +// Return true if an Add/Update/Delete/AddIfNotPresent are called first, +// or an Update called first but the first batch of items inserted by Replace() has been popped +func (f *FIFO) HasSynced() bool { + f.lock.Lock() + defer f.lock.Unlock() + return f.populated && f.initialPopulationCount == 0 +} + // Add inserts an item, and puts it in the queue. The item is only enqueued // if it doesn't already exist in the set. func (f *FIFO) Add(obj interface{}) error { @@ -70,6 +88,7 @@ func (f *FIFO) Add(obj interface{}) error { } f.lock.Lock() defer f.lock.Unlock() + f.populated = true if _, exists := f.items[id]; !exists { f.queue = append(f.queue, id) } @@ -91,6 +110,7 @@ func (f *FIFO) AddIfNotPresent(obj interface{}) error { } f.lock.Lock() defer f.lock.Unlock() + f.populated = true if _, exists := f.items[id]; exists { return nil } @@ -116,6 +136,7 @@ func (f *FIFO) Delete(obj interface{}) error { } f.lock.Lock() defer f.lock.Unlock() + f.populated = true delete(f.items, id) return err } @@ -174,6 +195,9 @@ func (f *FIFO) Pop() interface{} { } id := f.queue[0] f.queue = f.queue[1:] + if f.initialPopulationCount > 0 { + f.initialPopulationCount-- + } item, ok := f.items[id] if !ok { // Item may have been deleted subsequently. @@ -200,6 +224,12 @@ func (f *FIFO) Replace(list []interface{}, resourceVersion string) error { f.lock.Lock() defer f.lock.Unlock() + + if !f.populated { + f.populated = true + f.initialPopulationCount = len(items) + } + f.items = items f.queue = f.queue[:0] for id := range items { diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/fifo_test.go b/vendor/k8s.io/kubernetes/pkg/client/cache/fifo_test.go index bf99b5aa1..974fa6d3b 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/fifo_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/fifo_test.go @@ -177,3 +177,59 @@ func TestFIFO_addIfNotPresent(t *testing.T) { } } } + +func TestFIFO_HasSynced(t *testing.T) { + tests := []struct { + actions []func(f *FIFO) + expectedSynced bool + }{ + { + actions: []func(f *FIFO){}, + expectedSynced: false, + }, + { + actions: []func(f *FIFO){ + func(f *FIFO) { f.Add(mkFifoObj("a", 1)) }, + }, + expectedSynced: true, + }, + { + actions: []func(f *FIFO){ + func(f *FIFO) { f.Replace([]interface{}{}, "0") }, + }, + expectedSynced: true, + }, + { + actions: []func(f *FIFO){ + func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, + }, + expectedSynced: false, + }, + { + actions: []func(f *FIFO){ + func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, + func(f *FIFO) { f.Pop() }, + }, + expectedSynced: false, + }, + { + actions: []func(f *FIFO){ + func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, + func(f *FIFO) { f.Pop() }, + func(f *FIFO) { f.Pop() }, + }, + expectedSynced: true, + }, + } + + for i, test := range tests { + f := NewFIFO(testFifoObjectKeyFunc) + + for _, action := range test.actions { + action(f) + } + if e, a := test.expectedSynced, f.HasSynced(); a != e { + t.Errorf("test case %v failed, expected: %v , got %v", i, e, a) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/index.go b/vendor/k8s.io/kubernetes/pkg/client/cache/index.go index 0730ca459..a0c0c288c 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/index.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/index.go @@ -59,7 +59,7 @@ func MetaNamespaceIndexFunc(obj interface{}) ([]string, error) { if err != nil { return []string{""}, fmt.Errorf("object has no meta: %v", err) } - return []string{meta.Namespace()}, nil + return []string{meta.GetNamespace()}, nil } // Index maps the indexed value to a set of keys in the store that match on that value diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/listers.go b/vendor/k8s.io/kubernetes/pkg/client/cache/listers.go index f310459b8..81bac838e 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/listers.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/listers.go @@ -21,6 +21,7 @@ import ( "github.com/golang/glog" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/labels" ) @@ -95,6 +96,10 @@ func (s *StoreToPodLister) Exists(pod *api.Pod) (bool, error) { return exists, nil } +// NodeConditionPredicate is a function that indicates whether the given node's conditions meet +// some set of criteria defined by the function. +type NodeConditionPredicate func(node api.Node) bool + // StoreToNodeLister makes a Store have the List method of the client.NodeInterface // The Store must contain (only) Nodes. type StoreToNodeLister struct { @@ -109,70 +114,31 @@ func (s *StoreToNodeLister) List() (machines api.NodeList, err error) { } // NodeCondition returns a storeToNodeConditionLister -func (s *StoreToNodeLister) NodeCondition(conditionType api.NodeConditionType, conditionStatus api.ConditionStatus) storeToNodeConditionLister { +func (s *StoreToNodeLister) NodeCondition(predicate NodeConditionPredicate) storeToNodeConditionLister { // TODO: Move this filtering server side. Currently our selectors don't facilitate searching through a list so we // have the reflector filter out the Unschedulable field and sift through node conditions in the lister. - return storeToNodeConditionLister{s.Store, conditionType, conditionStatus} + return storeToNodeConditionLister{s.Store, predicate} } // storeToNodeConditionLister filters and returns nodes matching the given type and status from the store. type storeToNodeConditionLister struct { - store Store - conditionType api.NodeConditionType - conditionStatus api.ConditionStatus + store Store + predicate NodeConditionPredicate } -// List returns a list of nodes that match the condition type/status in the storeToNodeConditionLister. +// List returns a list of nodes that match the conditions defined by the predicate functions in the storeToNodeConditionLister. func (s storeToNodeConditionLister) List() (nodes api.NodeList, err error) { for _, m := range s.store.List() { node := *m.(*api.Node) - - // We currently only use a conditionType of "Ready". If the kubelet doesn't - // periodically report the status of a node, the nodecontroller sets its - // ConditionStatus to "Unknown". If the kubelet thinks a node is unhealthy - // it can (in theory) set its ConditionStatus to "False". - var nodeCondition *api.NodeCondition - - // Get the last condition of the required type - for _, cond := range node.Status.Conditions { - if cond.Type == s.conditionType { - nodeCondition = &cond - } else { - glog.V(4).Infof("Ignoring condition type %v for node %v", cond.Type, node.Name) - } - } - - // Check that the condition has the required status - if nodeCondition != nil { - if nodeCondition.Status == s.conditionStatus { - nodes.Items = append(nodes.Items, node) - } else { - glog.V(4).Infof("Ignoring node %v with condition status %v", node.Name, nodeCondition.Status) - } + if s.predicate(node) { + nodes.Items = append(nodes.Items, node) } else { - glog.V(2).Infof("Node %s doesn't have conditions of type %v", node.Name, s.conditionType) + glog.V(5).Infof("Node %s matches none of the conditions", node.Name) } } return } -// TODO Move this back to scheduler as a helper function that takes a Store, -// rather than a method of StoreToNodeLister. -// GetNodeInfo returns cached data for the node 'id'. -func (s *StoreToNodeLister) GetNodeInfo(id string) (*api.Node, error) { - node, exists, err := s.Get(&api.Node{ObjectMeta: api.ObjectMeta{Name: id}}) - - if err != nil { - return nil, fmt.Errorf("error retrieving node '%v' from cache: %v", id, err) - } - - if !exists { - return nil, fmt.Errorf("node '%v' is not in cache", id) - } - - return node.(*api.Node), nil -} - // StoreToReplicationControllerLister gives a store List and Exists methods. The store must contain only ReplicationControllers. type StoreToReplicationControllerLister struct { Store @@ -196,13 +162,34 @@ func (s *StoreToReplicationControllerLister) List() (controllers []api.Replicati return controllers, nil } +func (s *StoreToReplicationControllerLister) ReplicationControllers(namespace string) storeReplicationControllersNamespacer { + return storeReplicationControllersNamespacer{s.Store, namespace} +} + +type storeReplicationControllersNamespacer struct { + store Store + namespace string +} + +func (s storeReplicationControllersNamespacer) List(selector labels.Selector) (controllers []api.ReplicationController, err error) { + for _, c := range s.store.List() { + rc := *(c.(*api.ReplicationController)) + if s.namespace == api.NamespaceAll || s.namespace == rc.Namespace { + if selector.Matches(labels.Set(rc.Labels)) { + controllers = append(controllers, rc) + } + } + } + return +} + // GetPodControllers returns a list of replication controllers managing a pod. Returns an error only if no matching controllers are found. func (s *StoreToReplicationControllerLister) GetPodControllers(pod *api.Pod) (controllers []api.ReplicationController, err error) { var selector labels.Selector var rc api.ReplicationController if len(pod.Labels) == 0 { - err = fmt.Errorf("No controllers found for pod %v because it has no labels", pod.Name) + err = fmt.Errorf("no controllers found for pod %v because it has no labels", pod.Name) return } @@ -221,7 +208,139 @@ func (s *StoreToReplicationControllerLister) GetPodControllers(pod *api.Pod) (co controllers = append(controllers, rc) } if len(controllers) == 0 { - err = fmt.Errorf("Could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + err = fmt.Errorf("could not find controller for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + return +} + +// StoreToDeploymentLister gives a store List and Exists methods. The store must contain only Deployments. +type StoreToDeploymentLister struct { + Store +} + +// Exists checks if the given deployment exists in the store. +func (s *StoreToDeploymentLister) Exists(deployment *extensions.Deployment) (bool, error) { + _, exists, err := s.Store.Get(deployment) + if err != nil { + return false, err + } + return exists, nil +} + +// StoreToDeploymentLister lists all deployments in the store. +// TODO: converge on the interface in pkg/client +func (s *StoreToDeploymentLister) List() (deployments []extensions.Deployment, err error) { + for _, c := range s.Store.List() { + deployments = append(deployments, *(c.(*extensions.Deployment))) + } + return deployments, nil +} + +// GetDeploymentsForReplicaSet returns a list of deployments managing a replica set. Returns an error only if no matching deployments are found. +func (s *StoreToDeploymentLister) GetDeploymentsForReplicaSet(rs *extensions.ReplicaSet) (deployments []extensions.Deployment, err error) { + var d extensions.Deployment + + if len(rs.Labels) == 0 { + err = fmt.Errorf("no deployments found for ReplicaSet %v because it has no labels", rs.Name) + return + } + + // TODO: MODIFY THIS METHOD so that it checks for the podTemplateSpecHash label + for _, m := range s.Store.List() { + d = *m.(*extensions.Deployment) + if d.Namespace != rs.Namespace { + continue + } + + selector, err := unversioned.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + // If a deployment with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(rs.Labels)) { + continue + } + deployments = append(deployments, d) + } + if len(deployments) == 0 { + err = fmt.Errorf("could not find deployments set for ReplicaSet %s in namespace %s with labels: %v", rs.Name, rs.Namespace, rs.Labels) + } + return +} + +// StoreToReplicaSetLister gives a store List and Exists methods. The store must contain only ReplicaSets. +type StoreToReplicaSetLister struct { + Store +} + +// Exists checks if the given ReplicaSet exists in the store. +func (s *StoreToReplicaSetLister) Exists(rs *extensions.ReplicaSet) (bool, error) { + _, exists, err := s.Store.Get(rs) + if err != nil { + return false, err + } + return exists, nil +} + +// List lists all ReplicaSets in the store. +// TODO: converge on the interface in pkg/client +func (s *StoreToReplicaSetLister) List() (rss []extensions.ReplicaSet, err error) { + for _, rs := range s.Store.List() { + rss = append(rss, *(rs.(*extensions.ReplicaSet))) + } + return rss, nil +} + +type storeReplicaSetsNamespacer struct { + store Store + namespace string +} + +func (s storeReplicaSetsNamespacer) List(selector labels.Selector) (rss []extensions.ReplicaSet, err error) { + for _, c := range s.store.List() { + rs := *(c.(*extensions.ReplicaSet)) + if s.namespace == api.NamespaceAll || s.namespace == rs.Namespace { + if selector.Matches(labels.Set(rs.Labels)) { + rss = append(rss, rs) + } + } + } + return +} + +func (s *StoreToReplicaSetLister) ReplicaSets(namespace string) storeReplicaSetsNamespacer { + return storeReplicaSetsNamespacer{s.Store, namespace} +} + +// GetPodReplicaSets returns a list of ReplicaSets managing a pod. Returns an error only if no matching ReplicaSets are found. +func (s *StoreToReplicaSetLister) GetPodReplicaSets(pod *api.Pod) (rss []extensions.ReplicaSet, err error) { + var selector labels.Selector + var rs extensions.ReplicaSet + + if len(pod.Labels) == 0 { + err = fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + return + } + + for _, m := range s.Store.List() { + rs = *m.(*extensions.ReplicaSet) + if rs.Namespace != pod.Namespace { + continue + } + selector, err = unversioned.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + err = fmt.Errorf("invalid selector: %v", err) + return + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + if len(rss) == 0 { + err = fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) } return } @@ -242,9 +361,9 @@ func (s *StoreToDaemonSetLister) Exists(ds *extensions.DaemonSet) (bool, error) // List lists all daemon sets in the store. // TODO: converge on the interface in pkg/client -func (s *StoreToDaemonSetLister) List() (dss []extensions.DaemonSet, err error) { +func (s *StoreToDaemonSetLister) List() (dss extensions.DaemonSetList, err error) { for _, c := range s.Store.List() { - dss = append(dss, *(c.(*extensions.DaemonSet))) + dss.Items = append(dss.Items, *(c.(*extensions.DaemonSet))) } return dss, nil } @@ -256,7 +375,7 @@ func (s *StoreToDaemonSetLister) GetPodDaemonSets(pod *api.Pod) (daemonSets []ex var daemonSet extensions.DaemonSet if len(pod.Labels) == 0 { - err = fmt.Errorf("No daemon sets found for pod %v because it has no labels", pod.Name) + err = fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) return } @@ -265,7 +384,11 @@ func (s *StoreToDaemonSetLister) GetPodDaemonSets(pod *api.Pod) (daemonSets []ex if daemonSet.Namespace != pod.Namespace { continue } - selector = labels.Set(daemonSet.Spec.Selector).AsSelector() + selector, err = unversioned.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // this should not happen if the DaemonSet passed validation + return nil, err + } // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { @@ -274,7 +397,7 @@ func (s *StoreToDaemonSetLister) GetPodDaemonSets(pod *api.Pod) (daemonSets []ex daemonSets = append(daemonSets, daemonSet) } if len(daemonSets) == 0 { - err = fmt.Errorf("Could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + err = fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) } return } @@ -314,7 +437,7 @@ func (s *StoreToServiceLister) GetPodServices(pod *api.Pod) (services []api.Serv } } if len(services) == 0 { - err = fmt.Errorf("Could not find service for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + err = fmt.Errorf("could not find service for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) } return @@ -341,7 +464,7 @@ func (s *StoreToEndpointsLister) GetServiceEndpoints(svc *api.Service) (ep api.E return ep, nil } } - err = fmt.Errorf("Could not find endpoints for service: %v", svc.Name) + err = fmt.Errorf("could not find endpoints for service: %v", svc.Name) return } @@ -367,13 +490,13 @@ func (s *StoreToJobLister) List() (jobs extensions.JobList, err error) { return jobs, nil } -// GetPodControllers returns a list of jobs managing a pod. Returns an error only if no matching jobs are found. +// GetPodJobs returns a list of jobs managing a pod. Returns an error only if no matching jobs are found. func (s *StoreToJobLister) GetPodJobs(pod *api.Pod) (jobs []extensions.Job, err error) { var selector labels.Selector var job extensions.Job if len(pod.Labels) == 0 { - err = fmt.Errorf("No jobs found for pod %v because it has no labels", pod.Name) + err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name) return } @@ -383,14 +506,53 @@ func (s *StoreToJobLister) GetPodJobs(pod *api.Pod) (jobs []extensions.Job, err continue } - selector, _ = extensions.PodSelectorAsSelector(job.Spec.Selector) + selector, _ = unversioned.LabelSelectorAsSelector(job.Spec.Selector) if !selector.Matches(labels.Set(pod.Labels)) { continue } jobs = append(jobs, job) } if len(jobs) == 0 { - err = fmt.Errorf("Could not find jobs for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + err = fmt.Errorf("could not find jobs for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) } return } + +// Typed wrapper around a store of PersistentVolumes +type StoreToPVFetcher struct { + Store +} + +// GetPersistentVolumeInfo returns cached data for the PersistentVolume 'id'. +func (s *StoreToPVFetcher) GetPersistentVolumeInfo(id string) (*api.PersistentVolume, error) { + o, exists, err := s.Get(&api.PersistentVolume{ObjectMeta: api.ObjectMeta{Name: id}}) + + if err != nil { + return nil, fmt.Errorf("error retrieving PersistentVolume '%v' from cache: %v", id, err) + } + + if !exists { + return nil, fmt.Errorf("PersistentVolume '%v' is not in cache", id) + } + + return o.(*api.PersistentVolume), nil +} + +// Typed wrapper around a store of PersistentVolumeClaims +type StoreToPVCFetcher struct { + Store +} + +// GetPersistentVolumeClaimInfo returns cached data for the PersistentVolumeClaim 'id'. +func (s *StoreToPVCFetcher) GetPersistentVolumeClaimInfo(namespace string, id string) (*api.PersistentVolumeClaim, error) { + o, exists, err := s.Get(&api.PersistentVolumeClaim{ObjectMeta: api.ObjectMeta{Namespace: namespace, Name: id}}) + if err != nil { + return nil, fmt.Errorf("error retrieving PersistentVolumeClaim '%s/%s' from cache: %v", namespace, id, err) + } + + if !exists { + return nil, fmt.Errorf("PersistentVolumeClaim '%s/%s' is not in cache", namespace, id) + } + + return o.(*api.PersistentVolumeClaim), nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/listers_test.go b/vendor/k8s.io/kubernetes/pkg/client/cache/listers_test.go index 3ebafbd83..e95df1f21 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/listers_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/listers_test.go @@ -20,6 +20,7 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/util/sets" @@ -46,6 +47,81 @@ func TestStoreToNodeLister(t *testing.T) { } } +func TestStoreToNodeConditionLister(t *testing.T) { + store := NewStore(MetaNamespaceKeyFunc) + nodes := []*api.Node{ + { + ObjectMeta: api.ObjectMeta{Name: "foo"}, + Status: api.NodeStatus{ + Conditions: []api.NodeCondition{ + { + Type: api.NodeReady, + Status: api.ConditionTrue, + }, + { + Type: api.NodeOutOfDisk, + Status: api.ConditionFalse, + }, + }, + }, + }, + { + ObjectMeta: api.ObjectMeta{Name: "bar"}, + Status: api.NodeStatus{ + Conditions: []api.NodeCondition{ + { + Type: api.NodeOutOfDisk, + Status: api.ConditionTrue, + }, + }, + }, + }, + { + ObjectMeta: api.ObjectMeta{Name: "baz"}, + Status: api.NodeStatus{ + Conditions: []api.NodeCondition{ + { + Type: api.NodeReady, + Status: api.ConditionFalse, + }, + { + Type: api.NodeOutOfDisk, + Status: api.ConditionUnknown, + }, + }, + }, + }, + } + for _, n := range nodes { + store.Add(n) + } + + predicate := func(node api.Node) bool { + for _, cond := range node.Status.Conditions { + if cond.Type == api.NodeOutOfDisk && cond.Status == api.ConditionTrue { + return false + } + } + return true + } + + snl := StoreToNodeLister{store} + sncl := snl.NodeCondition(predicate) + + want := sets.NewString("foo", "baz") + gotNodes, err := sncl.List() + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + got := make([]string, len(gotNodes.Items)) + for ix := range gotNodes.Items { + got[ix] = gotNodes.Items[ix].Name + } + if !want.HasAll(got...) || len(got) != len(want) { + t.Errorf("Expected %v, got %v", want, got) + } +} + func TestStoreToReplicationControllerLister(t *testing.T) { store := NewStore(MetaNamespaceKeyFunc) lister := StoreToReplicationControllerLister{store} @@ -142,9 +218,11 @@ func TestStoreToReplicationControllerLister(t *testing.T) { if err != nil && c.expectErr { continue } else if c.expectErr { - t.Fatalf("Expected error, got none") + t.Error("Expected error, got none") + continue } else if err != nil { - t.Fatalf("Unexpected error %#v", err) + t.Errorf("Unexpected error %#v", err) + continue } gotNames := make([]string, len(gotControllers)) for ix := range gotControllers { @@ -156,6 +234,118 @@ func TestStoreToReplicationControllerLister(t *testing.T) { } } +func TestStoreToReplicaSetLister(t *testing.T) { + store := NewStore(MetaNamespaceKeyFunc) + lister := StoreToReplicaSetLister{store} + testCases := []struct { + inRSs []*extensions.ReplicaSet + list func() ([]extensions.ReplicaSet, error) + outRSNames sets.String + expectErr bool + }{ + // Basic listing with all labels and no selectors + { + inRSs: []*extensions.ReplicaSet{ + {ObjectMeta: api.ObjectMeta{Name: "basic"}}, + }, + list: func() ([]extensions.ReplicaSet, error) { + return lister.List() + }, + outRSNames: sets.NewString("basic"), + }, + // No pod labels + { + inRSs: []*extensions.ReplicaSet{ + { + ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "baz"}}, + }, + }, + }, + list: func() ([]extensions.ReplicaSet, error) { + pod := &api.Pod{ + ObjectMeta: api.ObjectMeta{Name: "pod1", Namespace: "ns"}, + } + return lister.GetPodReplicaSets(pod) + }, + outRSNames: sets.NewString(), + expectErr: true, + }, + // No ReplicaSet selectors + { + inRSs: []*extensions.ReplicaSet{ + { + ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"}, + }, + }, + list: func() ([]extensions.ReplicaSet, error) { + pod := &api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "pod1", + Namespace: "ns", + Labels: map[string]string{"foo": "bar"}, + }, + } + return lister.GetPodReplicaSets(pod) + }, + outRSNames: sets.NewString(), + expectErr: true, + }, + // Matching labels to selectors and namespace + { + inRSs: []*extensions.ReplicaSet{ + { + ObjectMeta: api.ObjectMeta{Name: "foo"}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, + }, + }, + { + ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"}, + Spec: extensions.ReplicaSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, + }, + }, + }, + list: func() ([]extensions.ReplicaSet, error) { + pod := &api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "pod1", + Labels: map[string]string{"foo": "bar"}, + Namespace: "ns", + }, + } + return lister.GetPodReplicaSets(pod) + }, + outRSNames: sets.NewString("bar"), + }, + } + for _, c := range testCases { + for _, r := range c.inRSs { + store.Add(r) + } + + gotRSs, err := c.list() + if err != nil && c.expectErr { + continue + } else if c.expectErr { + t.Error("Expected error, got none") + continue + } else if err != nil { + t.Errorf("Unexpected error %#v", err) + continue + } + gotNames := make([]string, len(gotRSs)) + for ix := range gotRSs { + gotNames[ix] = gotRSs[ix].Name + } + if !c.outRSNames.HasAll(gotNames...) || len(gotNames) != len(c.outRSNames) { + t.Errorf("Unexpected got ReplicaSets %+v expected %+v", gotNames, c.outRSNames) + } + } +} + func TestStoreToDaemonSetLister(t *testing.T) { store := NewStore(MetaNamespaceKeyFunc) lister := StoreToDaemonSetLister{store} @@ -171,7 +361,8 @@ func TestStoreToDaemonSetLister(t *testing.T) { {ObjectMeta: api.ObjectMeta{Name: "basic"}}, }, list: func() ([]extensions.DaemonSet, error) { - return lister.List() + list, err := lister.List() + return list.Items, err }, outDaemonSetNames: sets.NewString("basic"), }, @@ -183,7 +374,8 @@ func TestStoreToDaemonSetLister(t *testing.T) { {ObjectMeta: api.ObjectMeta{Name: "complex2"}}, }, list: func() ([]extensions.DaemonSet, error) { - return lister.List() + list, err := lister.List() + return list.Items, err }, outDaemonSetNames: sets.NewString("basic", "complex", "complex2"), }, @@ -193,7 +385,7 @@ func TestStoreToDaemonSetLister(t *testing.T) { { ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"}, Spec: extensions.DaemonSetSpec{ - Selector: map[string]string{"foo": "baz"}, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "baz"}}, }, }, }, @@ -232,13 +424,13 @@ func TestStoreToDaemonSetLister(t *testing.T) { { ObjectMeta: api.ObjectMeta{Name: "foo"}, Spec: extensions.DaemonSetSpec{ - Selector: map[string]string{"foo": "bar"}, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, }, }, { ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"}, Spec: extensions.DaemonSetSpec{ - Selector: map[string]string{"foo": "bar"}, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, }, }, }, @@ -264,9 +456,11 @@ func TestStoreToDaemonSetLister(t *testing.T) { if err != nil && c.expectErr { continue } else if c.expectErr { - t.Fatalf("Expected error, got none") + t.Error("Expected error, got none") + continue } else if err != nil { - t.Fatalf("Unexpected error %#v", err) + t.Errorf("Unexpected error %#v", err) + continue } daemonSetNames := make([]string, len(daemonSets)) for ix := range daemonSets { @@ -320,7 +514,7 @@ func TestStoreToJobLister(t *testing.T) { { ObjectMeta: api.ObjectMeta{Name: "basic", Namespace: "ns"}, Spec: extensions.JobSpec{ - Selector: &extensions.PodSelector{ + Selector: &unversioned.LabelSelector{ MatchLabels: map[string]string{"foo": "baz"}, }, }, @@ -363,7 +557,7 @@ func TestStoreToJobLister(t *testing.T) { { ObjectMeta: api.ObjectMeta{Name: "foo"}, Spec: extensions.JobSpec{ - Selector: &extensions.PodSelector{ + Selector: &unversioned.LabelSelector{ MatchLabels: map[string]string{"foo": "bar"}, }, }, @@ -371,7 +565,7 @@ func TestStoreToJobLister(t *testing.T) { { ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"}, Spec: extensions.JobSpec{ - Selector: &extensions.PodSelector{ + Selector: &unversioned.LabelSelector{ MatchLabels: map[string]string{"foo": "bar"}, }, }, @@ -396,7 +590,7 @@ func TestStoreToJobLister(t *testing.T) { { ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "foo"}, Spec: extensions.JobSpec{ - Selector: &extensions.PodSelector{ + Selector: &unversioned.LabelSelector{ MatchLabels: map[string]string{"foo": "bar"}, }, }, @@ -404,7 +598,7 @@ func TestStoreToJobLister(t *testing.T) { { ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "bar"}, Spec: extensions.JobSpec{ - Selector: &extensions.PodSelector{ + Selector: &unversioned.LabelSelector{ MatchLabels: map[string]string{"foo": "bar"}, }, }, @@ -491,7 +685,7 @@ func TestStoreToPodLister(t *testing.T) { t.Errorf("unexpected error: %v", err) } if exists { - t.Errorf("Unexpected pod exists") + t.Error("Unexpected pod exists") } } diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/listwatch.go b/vendor/k8s.io/kubernetes/pkg/client/cache/listwatch.go index 1383565db..18528d236 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/listwatch.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/listwatch.go @@ -17,6 +17,9 @@ limitations under the License. package cache import ( + "time" + + "k8s.io/kubernetes/pkg/api" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/runtime" @@ -24,10 +27,10 @@ import ( ) // ListFunc knows how to list resources -type ListFunc func() (runtime.Object, error) +type ListFunc func(options api.ListOptions) (runtime.Object, error) // WatchFunc knows how to watch resources -type WatchFunc func(resourceVersion string) (watch.Interface, error) +type WatchFunc func(options api.ListOptions) (watch.Interface, error) // ListWatch knows how to list and watch a set of apiserver resources. It satisfies the ListerWatcher interface. // It is a convenience function for users of NewReflector, etc. @@ -44,31 +47,40 @@ type Getter interface { // NewListWatchFromClient creates a new ListWatch from the specified client, resource, namespace and field selector. func NewListWatchFromClient(c Getter, resource string, namespace string, fieldSelector fields.Selector) *ListWatch { - listFunc := func() (runtime.Object, error) { + listFunc := func(options api.ListOptions) (runtime.Object, error) { return c.Get(). Namespace(namespace). Resource(resource). + VersionedParams(&options, api.ParameterCodec). FieldsSelectorParam(fieldSelector). Do(). Get() } - watchFunc := func(resourceVersion string) (watch.Interface, error) { + watchFunc := func(options api.ListOptions) (watch.Interface, error) { return c.Get(). Prefix("watch"). Namespace(namespace). Resource(resource). + VersionedParams(&options, api.ParameterCodec). FieldsSelectorParam(fieldSelector). - Param("resourceVersion", resourceVersion).Watch() + Watch() } return &ListWatch{ListFunc: listFunc, WatchFunc: watchFunc} } +func timeoutFromListOptions(options api.ListOptions) time.Duration { + if options.TimeoutSeconds != nil { + return time.Duration(*options.TimeoutSeconds) * time.Second + } + return 0 +} + // List a set of apiserver resources -func (lw *ListWatch) List() (runtime.Object, error) { - return lw.ListFunc() +func (lw *ListWatch) List(options api.ListOptions) (runtime.Object, error) { + return lw.ListFunc(options) } // Watch a set of apiserver resources -func (lw *ListWatch) Watch(resourceVersion string) (watch.Interface, error) { - return lw.WatchFunc(resourceVersion) +func (lw *ListWatch) Watch(options api.ListOptions) (watch.Interface, error) { + return lw.WatchFunc(options) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/listwatch_test.go b/vendor/k8s.io/kubernetes/pkg/client/cache/listwatch_test.go index db34c48eb..a0a72f5d8 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/listwatch_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/listwatch_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/kubernetes/pkg/api/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/util" + utiltesting "k8s.io/kubernetes/pkg/util/testing" ) func parseSelectorOrDie(s string) fields.Selector { @@ -55,7 +55,7 @@ func buildLocation(resourcePath string, query url.Values) string { } func TestListWatchesCanList(t *testing.T) { - fieldSelectorQueryParamName := unversioned.FieldSelectorQueryParam(testapi.Default.Version()) + fieldSelectorQueryParamName := unversioned.FieldSelectorQueryParam(testapi.Default.GroupVersion().String()) table := []struct { location string resource string @@ -89,23 +89,24 @@ func TestListWatchesCanList(t *testing.T) { }, } for _, item := range table { - handler := util.FakeHandler{ + handler := utiltesting.FakeHandler{ StatusCode: 500, ResponseBody: "", T: t, } server := httptest.NewServer(&handler) - defer server.Close() - client := client.NewOrDie(&client.Config{Host: server.URL, Version: testapi.Default.Version()}) + // TODO: Uncomment when fix #19254 + // defer server.Close() + client := client.NewOrDie(&client.Config{Host: server.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}}) lw := NewListWatchFromClient(client, item.resource, item.namespace, item.fieldSelector) // This test merely tests that the correct request is made. - lw.List() + lw.List(api.ListOptions{}) handler.ValidateRequest(t, item.location, "GET", nil) } } func TestListWatchesCanWatch(t *testing.T) { - fieldSelectorQueryParamName := unversioned.FieldSelectorQueryParam(testapi.Default.Version()) + fieldSelectorQueryParamName := unversioned.FieldSelectorQueryParam(testapi.Default.GroupVersion().String()) table := []struct { rv string location string @@ -117,7 +118,7 @@ func TestListWatchesCanWatch(t *testing.T) { { location: buildLocation( testapi.Default.ResourcePathWithPrefix("watch", "nodes", api.NamespaceAll, ""), - buildQueryValues(url.Values{"resourceVersion": []string{""}})), + buildQueryValues(url.Values{})), rv: "", resource: "nodes", namespace: api.NamespaceAll, @@ -155,17 +156,18 @@ func TestListWatchesCanWatch(t *testing.T) { } for _, item := range table { - handler := util.FakeHandler{ + handler := utiltesting.FakeHandler{ StatusCode: 500, ResponseBody: "", T: t, } server := httptest.NewServer(&handler) - defer server.Close() - client := client.NewOrDie(&client.Config{Host: server.URL, Version: testapi.Default.Version()}) + // TODO: Uncomment when fix #19254 + // defer server.Close() + client := client.NewOrDie(&client.Config{Host: server.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}}) lw := NewListWatchFromClient(client, item.resource, item.namespace, item.fieldSelector) // This test merely tests that the correct request is made. - lw.Watch(item.rv) + lw.Watch(api.ListOptions{ResourceVersion: item.rv}) handler.ValidateRequest(t, item.location, "GET", nil) } } diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/reflector.go b/vendor/k8s.io/kubernetes/pkg/client/cache/reflector.go index 4c2d66420..fa761d5c5 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/reflector.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/reflector.go @@ -20,6 +20,7 @@ import ( "errors" "fmt" "io" + "math/rand" "net" "net/url" "reflect" @@ -30,10 +31,12 @@ import ( "time" "github.com/golang/glog" + "k8s.io/kubernetes/pkg/api" apierrs "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + utilruntime "k8s.io/kubernetes/pkg/util/runtime" + "k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/watch" ) @@ -41,9 +44,9 @@ import ( type ListerWatcher interface { // List should return a list type object; the Items field will be extracted, and the // ResourceVersion field will be used to start the watch in the right place. - List() (runtime.Object, error) + List(options api.ListOptions) (runtime.Object, error) // Watch should begin a watch at the specified version. - Watch(resourceVersion string) (watch.Interface, error) + Watch(options api.ListOptions) (watch.Interface, error) } // Reflector watches a specified resource and causes all changes to be reflected in the given store. @@ -61,6 +64,10 @@ type Reflector struct { // the beginning of the next one. period time.Duration resyncPeriod time.Duration + // now() returns current time - exposed for testing purposes + now func() time.Time + // nextResync is approximate time of next resync (0 if not scheduled) + nextResync time.Time // lastSyncResourceVersion is the resource version token last // observed when doing a sync with the underlying store // it is thread safe, but not synchronized with the underlying store @@ -69,6 +76,20 @@ type Reflector struct { lastSyncResourceVersionMutex sync.RWMutex } +var ( + // We try to spread the load on apiserver by setting timeouts for + // watch requests - it is random in [minWatchTimeout, 2*minWatchTimeout]. + // However, it can be modified to avoid periodic resync to break the + // TCP connection. + minWatchTimeout = 5 * time.Minute + // If we are within 'forceResyncThreshold' from the next planned resync + // and are just before issueing Watch(), resync will be forced now. + forceResyncThreshold = 3 * time.Second + // We try to set timeouts for Watch() so that we will finish about + // than 'timeoutThreshold' from next planned periodic resync. + timeoutThreshold = 1 * time.Second +) + // NewNamespaceKeyedIndexerAndReflector creates an Indexer and a Reflector // The indexer is configured to key on namespace func NewNamespaceKeyedIndexerAndReflector(lw ListerWatcher, expectedType interface{}, resyncPeriod time.Duration) (indexer Indexer, reflector *Reflector) { @@ -96,6 +117,7 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{}, expectedType: reflect.TypeOf(expectedType), period: time.Second, resyncPeriod: resyncPeriod, + now: time.Now, } return r } @@ -135,13 +157,13 @@ outer: // Run starts a watch and handles watch events. Will restart the watch if it is closed. // Run starts a goroutine and returns immediately. func (r *Reflector) Run() { - go util.Until(func() { r.ListAndWatch(util.NeverStop) }, r.period, util.NeverStop) + go wait.Until(func() { r.ListAndWatch(wait.NeverStop) }, r.period, wait.NeverStop) } // RunUntil starts a watch and handles watch events. Will restart the watch if it is closed. // RunUntil starts a goroutine and returns immediately. It will exit when stopCh is closed. func (r *Reflector) RunUntil(stopCh <-chan struct{}) { - go util.Until(func() { r.ListAndWatch(stopCh) }, r.period, stopCh) + go wait.Until(func() { r.ListAndWatch(stopCh) }, r.period, stopCh) } var ( @@ -160,32 +182,69 @@ var ( // required, and a cleanup function. func (r *Reflector) resyncChan() (<-chan time.Time, func() bool) { if r.resyncPeriod == 0 { + r.nextResync = time.Time{} return neverExitWatch, func() bool { return false } } // The cleanup function is required: imagine the scenario where watches // always fail so we end up listing frequently. Then, if we don't // manually stop the timer, we could end up with many timers active // concurrently. + r.nextResync = r.now().Add(r.resyncPeriod) t := time.NewTimer(r.resyncPeriod) return t.C, t.Stop } -// Returns error if ListAndWatch didn't even tried to initialize watch. +// We want to avoid situations when periodic resyncing is breaking the TCP +// connection. +// If response`s body is not read to completion before calling body.Close(), +// that TCP connection will not be reused in the future - see #15664 issue +// for more details. +// Thus, we set timeout for watch requests to be smaller than the remaining +// time until next periodic resync and force resyncing ourself to avoid +// breaking TCP connection. +// +// TODO: This should be parametrizable based on server load. +func (r *Reflector) timeoutForWatch() *int64 { + randTimeout := time.Duration(float64(minWatchTimeout) * (rand.Float64() + 1.0)) + timeout := r.nextResync.Sub(r.now()) - timeoutThreshold + if timeout < 0 || randTimeout < timeout { + timeout = randTimeout + } + timeoutSeconds := int64(timeout.Seconds()) + return &timeoutSeconds +} + +// Returns true if we are close enough to next planned periodic resync +// and we can force resyncing ourself now. +func (r *Reflector) canForceResyncNow() bool { + if r.nextResync.IsZero() { + return false + } + return r.now().Add(forceResyncThreshold).After(r.nextResync) +} + +// ListAndWatch first lists all items and get the resource version at the moment of call, +// and then use the resource version to watch. +// It returns error if ListAndWatch didn't even try to initialize watch. func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error { var resourceVersion string resyncCh, cleanup := r.resyncChan() defer cleanup() - list, err := r.listerWatcher.List() + // Explicitly set "0" as resource version - it's fine for the List() + // to be served from cache and potentially be delayed relative to + // etcd contents. Reflector framework will catch up via Watch() eventually. + options := api.ListOptions{ResourceVersion: "0"} + list, err := r.listerWatcher.List(options) if err != nil { return fmt.Errorf("%s: Failed to list %v: %v", r.name, r.expectedType, err) } - meta, err := meta.Accessor(list) + metaInterface, err := meta.Accessor(list) if err != nil { return fmt.Errorf("%s: Unable to understand list result %#v", r.name, list) } - resourceVersion = meta.ResourceVersion() - items, err := runtime.ExtractList(list) + resourceVersion = metaInterface.GetResourceVersion() + items, err := meta.ExtractList(list) if err != nil { return fmt.Errorf("%s: Unable to understand list result %#v (%v)", r.name, list, err) } @@ -195,7 +254,13 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error { r.setLastSyncResourceVersion(resourceVersion) for { - w, err := r.listerWatcher.Watch(resourceVersion) + options := api.ListOptions{ + ResourceVersion: resourceVersion, + // We want to avoid situations when resyncing is breaking the TCP connection + // - see comment for 'timeoutForWatch()' for more details. + TimeoutSeconds: r.timeoutForWatch(), + } + w, err := r.listerWatcher.Watch(options) if err != nil { switch err { case io.EOF: @@ -203,7 +268,7 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error { case io.ErrUnexpectedEOF: glog.V(1).Infof("%s: Watch for %v closed with unexpected EOF: %v", r.name, r.expectedType, err) default: - util.HandleError(fmt.Errorf("%s: Failed to watch %v: %v", r.name, r.expectedType, err)) + utilruntime.HandleError(fmt.Errorf("%s: Failed to watch %v: %v", r.name, r.expectedType, err)) } // If this is "connection refused" error, it means that most likely apiserver is not responsive. // It doesn't make sense to re-list all objects because most likely we will be able to restart @@ -225,6 +290,10 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error { } return nil } + if r.canForceResyncNow() { + glog.V(4).Infof("%s: next resync planned for %#v, forcing now", r.name, r.nextResync) + return nil + } } } @@ -261,15 +330,15 @@ loop: return apierrs.FromObject(event.Object) } if e, a := r.expectedType, reflect.TypeOf(event.Object); e != nil && e != a { - util.HandleError(fmt.Errorf("%s: expected type %v, but watch event object had type %v", r.name, e, a)) + utilruntime.HandleError(fmt.Errorf("%s: expected type %v, but watch event object had type %v", r.name, e, a)) continue } meta, err := meta.Accessor(event.Object) if err != nil { - util.HandleError(fmt.Errorf("%s: unable to understand watch event %#v", r.name, event)) + utilruntime.HandleError(fmt.Errorf("%s: unable to understand watch event %#v", r.name, event)) continue } - newResourceVersion := meta.ResourceVersion() + newResourceVersion := meta.GetResourceVersion() switch event.Type { case watch.Added: r.store.Add(event.Object) @@ -281,7 +350,7 @@ loop: // to change this. r.store.Delete(event.Object) default: - util.HandleError(fmt.Errorf("%s: unable to understand watch event %#v", r.name, event)) + utilruntime.HandleError(fmt.Errorf("%s: unable to understand watch event %#v", r.name, event)) } *resourceVersion = newResourceVersion r.setLastSyncResourceVersion(newResourceVersion) diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/reflector_test.go b/vendor/k8s.io/kubernetes/pkg/client/cache/reflector_test.go index f05934348..223769ade 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/reflector_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/reflector_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/watch" ) @@ -35,9 +35,11 @@ type testLW struct { WatchFunc func(resourceVersion string) (watch.Interface, error) } -func (t *testLW) List() (runtime.Object, error) { return t.ListFunc() } -func (t *testLW) Watch(resourceVersion string) (watch.Interface, error) { - return t.WatchFunc(resourceVersion) +func (t *testLW) List(options api.ListOptions) (runtime.Object, error) { + return t.ListFunc() +} +func (t *testLW) Watch(options api.ListOptions) (watch.Interface, error) { + return t.WatchFunc(options.ResourceVersion) } func TestCloseWatchChannelOnError(t *testing.T) { @@ -52,15 +54,15 @@ func TestCloseWatchChannelOnError(t *testing.T) { return &api.PodList{ListMeta: unversioned.ListMeta{ResourceVersion: "1"}}, nil }, } - go r.ListAndWatch(util.NeverStop) + go r.ListAndWatch(wait.NeverStop) fw.Error(pod) select { case _, ok := <-fw.ResultChan(): if ok { t.Errorf("Watch channel left open after cancellation") } - case <-time.After(util.ForeverTestTimeout): - t.Errorf("the cancellation is at least %s late", util.ForeverTestTimeout.String()) + case <-time.After(wait.ForeverTestTimeout): + t.Errorf("the cancellation is at least %s late", wait.ForeverTestTimeout.String()) break } } @@ -88,17 +90,17 @@ func TestRunUntil(t *testing.T) { if ok { t.Errorf("Watch channel left open after stopping the watch") } - case <-time.After(util.ForeverTestTimeout): - t.Errorf("the cancellation is at least %s late", util.ForeverTestTimeout.String()) + case <-time.After(wait.ForeverTestTimeout): + t.Errorf("the cancellation is at least %s late", wait.ForeverTestTimeout.String()) break } } -func TestReflector_resyncChan(t *testing.T) { +func TestReflectorResyncChan(t *testing.T) { s := NewStore(MetaNamespaceKeyFunc) g := NewReflector(&testLW{}, &api.Pod{}, s, time.Millisecond) a, _ := g.resyncChan() - b := time.After(util.ForeverTestTimeout) + b := time.After(wait.ForeverTestTimeout) select { case <-a: t.Logf("got timeout as expected") @@ -107,7 +109,7 @@ func TestReflector_resyncChan(t *testing.T) { } } -func BenchmarkReflector_resyncChanMany(b *testing.B) { +func BenchmarkReflectorResyncChanMany(b *testing.B) { s := NewStore(MetaNamespaceKeyFunc) g := NewReflector(&testLW{}, &api.Pod{}, s, 25*time.Millisecond) // The improvement to this (calling the timer's Stop() method) makes @@ -119,7 +121,7 @@ func BenchmarkReflector_resyncChanMany(b *testing.B) { } } -func TestReflector_watchHandlerError(t *testing.T) { +func TestReflectorWatchHandlerError(t *testing.T) { s := NewStore(MetaNamespaceKeyFunc) g := NewReflector(&testLW{}, &api.Pod{}, s, 0) fw := watch.NewFake() @@ -127,13 +129,13 @@ func TestReflector_watchHandlerError(t *testing.T) { fw.Stop() }() var resumeRV string - err := g.watchHandler(fw, &resumeRV, neverExitWatch, util.NeverStop) + err := g.watchHandler(fw, &resumeRV, neverExitWatch, wait.NeverStop) if err == nil { t.Errorf("unexpected non-error") } } -func TestReflector_watchHandler(t *testing.T) { +func TestReflectorWatchHandler(t *testing.T) { s := NewStore(MetaNamespaceKeyFunc) g := NewReflector(&testLW{}, &api.Pod{}, s, 0) fw := watch.NewFake() @@ -147,7 +149,7 @@ func TestReflector_watchHandler(t *testing.T) { fw.Stop() }() var resumeRV string - err := g.watchHandler(fw, &resumeRV, neverExitWatch, util.NeverStop) + err := g.watchHandler(fw, &resumeRV, neverExitWatch, wait.NeverStop) if err != nil { t.Errorf("unexpected error %v", err) } @@ -189,14 +191,14 @@ func TestReflector_watchHandler(t *testing.T) { } } -func TestReflector_watchHandlerTimeout(t *testing.T) { +func TestReflectorWatchHandlerTimeout(t *testing.T) { s := NewStore(MetaNamespaceKeyFunc) g := NewReflector(&testLW{}, &api.Pod{}, s, 0) fw := watch.NewFake() var resumeRV string exit := make(chan time.Time, 1) exit <- time.Now() - err := g.watchHandler(fw, &resumeRV, exit, util.NeverStop) + err := g.watchHandler(fw, &resumeRV, exit, wait.NeverStop) if err != errorResyncRequested { t.Errorf("expected timeout error, but got %q", err) } @@ -215,7 +217,7 @@ func TestReflectorStopWatch(t *testing.T) { } } -func TestReflector_ListAndWatch(t *testing.T) { +func TestReflectorListAndWatch(t *testing.T) { createdFakes := make(chan *watch.FakeWatcher) // The ListFunc says that it's at revision 1. Therefore, we expect our WatchFunc @@ -240,7 +242,7 @@ func TestReflector_ListAndWatch(t *testing.T) { } s := NewFIFO(MetaNamespaceKeyFunc) r := NewReflector(lw, &api.Pod{}, s, 0) - go r.ListAndWatch(util.NeverStop) + go r.ListAndWatch(wait.NeverStop) ids := []string{"foo", "bar", "baz", "qux", "zoo"} var fw *watch.FakeWatcher @@ -273,7 +275,7 @@ func TestReflector_ListAndWatch(t *testing.T) { } } -func TestReflector_ListAndWatchWithErrors(t *testing.T) { +func TestReflectorListAndWatchWithErrors(t *testing.T) { mkPod := func(id string, rv string) *api.Pod { return &api.Pod{ObjectMeta: api.ObjectMeta{Name: id, ResourceVersion: rv}} } @@ -357,6 +359,46 @@ func TestReflector_ListAndWatchWithErrors(t *testing.T) { }, } r := NewReflector(lw, &api.Pod{}, s, 0) - r.ListAndWatch(util.NeverStop) + r.ListAndWatch(wait.NeverStop) + } +} + +func TestReflectorResync(t *testing.T) { + s := NewStore(MetaNamespaceKeyFunc) + + currentTime := time.Time{} + iteration := 0 + + lw := &testLW{ + WatchFunc: func(rv string) (watch.Interface, error) { + if iteration == 0 { + // Move time, but do not force resync. + currentTime = currentTime.Add(30 * time.Second) + } else if iteration == 1 { + // Move time to force resync. + currentTime = currentTime.Add(28 * time.Second) + } else if iteration >= 2 { + t.Fatalf("should have forced resync earlier") + } + iteration++ + fw := watch.NewFake() + // Send something to the watcher to avoid "watch too short" errors. + go func() { + fw.Add(&api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: strconv.Itoa(iteration)}}) + fw.Stop() + }() + return fw, nil + }, + ListFunc: func() (runtime.Object, error) { + return &api.PodList{ListMeta: unversioned.ListMeta{ResourceVersion: "0"}}, nil + }, + } + resyncPeriod := time.Minute + r := NewReflector(lw, &api.Pod{}, s, resyncPeriod) + r.now = func() time.Time { return currentTime } + + r.ListAndWatch(wait.NeverStop) + if iteration != 2 { + t.Errorf("exactly 2 iterations were expected, got: %v", iteration) } } diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/store.go b/vendor/k8s.io/kubernetes/pkg/client/cache/store.go index 3419ded66..17a360f8e 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/store.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/store.go @@ -80,10 +80,10 @@ func MetaNamespaceKeyFunc(obj interface{}) (string, error) { if err != nil { return "", fmt.Errorf("object has no meta: %v", err) } - if len(meta.Namespace()) > 0 { - return meta.Namespace() + "/" + meta.Name(), nil + if len(meta.GetNamespace()) > 0 { + return meta.GetNamespace() + "/" + meta.GetName(), nil } - return meta.Name(), nil + return meta.GetName(), nil } // SplitMetaNamespaceKey returns the namespace and name that @@ -116,6 +116,8 @@ type cache struct { keyFunc KeyFunc } +var _ Store = &cache{} + // Add inserts an item into the cache. func (c *cache) Add(obj interface{}) error { key, err := c.keyFunc(obj) diff --git a/vendor/k8s.io/kubernetes/pkg/client/cache/thread_safe_store.go b/vendor/k8s.io/kubernetes/pkg/client/cache/thread_safe_store.go index 653b9f297..ae4b802c8 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/cache/thread_safe_store.go +++ b/vendor/k8s.io/kubernetes/pkg/client/cache/thread_safe_store.go @@ -243,6 +243,6 @@ func NewThreadSafeStore(indexers Indexers, indices Indices) ThreadSafeStore { return &threadSafeMap{ items: map[string]interface{}{}, indexers: indexers, - indices: Indices{}, + indices: indices, } } diff --git a/vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/clientset.go b/vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/clientset.go new file mode 100644 index 000000000..3fe018b9c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/clientset.go @@ -0,0 +1,94 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package internalclientset + +import ( + "github.com/golang/glog" + core_unversioned "k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned" + extensions_unversioned "k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned" + unversioned "k8s.io/kubernetes/pkg/client/unversioned" +) + +type Interface interface { + Discovery() unversioned.DiscoveryInterface + Core() core_unversioned.CoreInterface + Extensions() extensions_unversioned.ExtensionsInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *unversioned.DiscoveryClient + *core_unversioned.CoreClient + *extensions_unversioned.ExtensionsClient +} + +// Core retrieves the CoreClient +func (c *Clientset) Core() core_unversioned.CoreInterface { + return c.CoreClient +} + +// Extensions retrieves the ExtensionsClient +func (c *Clientset) Extensions() extensions_unversioned.ExtensionsInterface { + return c.ExtensionsClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() unversioned.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *unversioned.Config) (*Clientset, error) { + var clientset Clientset + var err error + clientset.CoreClient, err = core_unversioned.NewForConfig(c) + if err != nil { + return &clientset, err + } + clientset.ExtensionsClient, err = extensions_unversioned.NewForConfig(c) + if err != nil { + return &clientset, err + } + + clientset.DiscoveryClient, err = unversioned.NewDiscoveryClientForConfig(c) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + } + return &clientset, err +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *unversioned.Config) *Clientset { + var clientset Clientset + clientset.CoreClient = core_unversioned.NewForConfigOrDie(c) + clientset.ExtensionsClient = extensions_unversioned.NewForConfigOrDie(c) + + clientset.DiscoveryClient = unversioned.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c *unversioned.RESTClient) *Clientset { + var clientset Clientset + clientset.CoreClient = core_unversioned.New(c) + clientset.ExtensionsClient = extensions_unversioned.New(c) + + clientset.DiscoveryClient = unversioned.NewDiscoveryClient(c) + return &clientset +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/clientset_adaption.go b/vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/clientset_adaption.go new file mode 100644 index 000000000..f16573a93 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/clientset_adaption.go @@ -0,0 +1,42 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package internalclientset + +import ( + core_unversioned "k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned" + extensions_unversioned "k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned" +) + +// FromUnversionedClient adapts a pkg/client/unversioned#Client to a Clientset. +// This function is temporary. We will remove it when everyone has moved to using +// Clientset. New code should NOT use this function. +func FromUnversionedClient(c *unversioned.Client) *Clientset { + var clientset Clientset + if c != nil { + clientset.CoreClient = core_unversioned.New(c.RESTClient) + } else { + clientset.CoreClient = core_unversioned.New(nil) + } + if c != nil && c.ExtensionsClient != nil { + clientset.ExtensionsClient = extensions_unversioned.New(c.ExtensionsClient.RESTClient) + } else { + clientset.ExtensionsClient = extensions_unversioned.New(nil) + } + + return &clientset +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/metrics/metrics.go b/vendor/k8s.io/kubernetes/pkg/client/metrics/metrics.go index c98d6a413..efa66fc8b 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/metrics/metrics.go +++ b/vendor/k8s.io/kubernetes/pkg/client/metrics/metrics.go @@ -38,6 +38,15 @@ var ( }, []string{"verb", "url"}, ) + + RequestResult = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Subsystem: restClientSubsystem, + Name: "request_status_codes", + Help: "Number of http requests, partitioned by metadata", + }, + []string{"code", "method", "host"}, + ) ) var registerMetrics sync.Once @@ -48,6 +57,7 @@ func Register() { // Register the metrics. registerMetrics.Do(func() { prometheus.MustRegister(RequestLatency) + prometheus.MustRegister(RequestResult) }) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/transport/cache.go b/vendor/k8s.io/kubernetes/pkg/client/transport/cache.go new file mode 100644 index 000000000..f1068930d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/transport/cache.go @@ -0,0 +1,83 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package transport + +import ( + "fmt" + "net" + "net/http" + "sync" + "time" +) + +// TlsTransportCache caches TLS http.RoundTrippers different configurations. The +// same RoundTripper will be returned for configs with identical TLS options If +// the config has no custom TLS options, http.DefaultTransport is returned. +type tlsTransportCache struct { + mu sync.Mutex + transports map[string]*http.Transport +} + +var tlsCache = &tlsTransportCache{transports: make(map[string]*http.Transport)} + +func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { + key, err := tlsConfigKey(config) + if err != nil { + return nil, err + } + + // Ensure we only create a single transport for the given TLS options + c.mu.Lock() + defer c.mu.Unlock() + + // See if we already have a custom transport for this config + if t, ok := c.transports[key]; ok { + return t, nil + } + + // Get the TLS options for this client config + tlsConfig, err := TLSConfigFor(config) + if err != nil { + return nil, err + } + // The options didn't require a custom TLS config + if tlsConfig == nil { + return http.DefaultTransport, nil + } + + // Cache a single transport for these options + c.transports[key] = &http.Transport{ + Proxy: http.ProxyFromEnvironment, + TLSHandshakeTimeout: 10 * time.Second, + TLSClientConfig: tlsConfig, + Dial: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + } + return c.transports[key], nil +} + +// tlsConfigKey returns a unique key for tls.Config objects returned from TLSConfigFor +func tlsConfigKey(c *Config) (string, error) { + // Make sure ca/key/cert content is loaded + if err := loadTLSFiles(c); err != nil { + return "", err + } + // Only include the things that actually affect the tls.Config + return fmt.Sprintf("%v/%x/%x/%x", c.TLS.Insecure, c.TLS.CAData, c.TLS.CertData, c.TLS.KeyData), nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/transport/cache_test.go b/vendor/k8s.io/kubernetes/pkg/client/transport/cache_test.go new file mode 100644 index 000000000..8a602c147 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/transport/cache_test.go @@ -0,0 +1,114 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package transport + +import ( + "net/http" + "testing" +) + +func TestTLSConfigKey(t *testing.T) { + // Make sure config fields that don't affect the tls config don't affect the cache key + identicalConfigurations := map[string]*Config{ + "empty": {}, + "basic": {Username: "bob", Password: "password"}, + "bearer": {BearerToken: "token"}, + "user agent": {UserAgent: "useragent"}, + "transport": {Transport: http.DefaultTransport}, + "wrap transport": {WrapTransport: func(http.RoundTripper) http.RoundTripper { return nil }}, + } + for nameA, valueA := range identicalConfigurations { + for nameB, valueB := range identicalConfigurations { + keyA, err := tlsConfigKey(valueA) + if err != nil { + t.Errorf("Unexpected error for %q: %v", nameA, err) + continue + } + keyB, err := tlsConfigKey(valueB) + if err != nil { + t.Errorf("Unexpected error for %q: %v", nameB, err) + continue + } + if keyA != keyB { + t.Errorf("Expected identical cache keys for %q and %q, got:\n\t%s\n\t%s", nameA, nameB, keyA, keyB) + continue + } + } + } + + // Make sure config fields that affect the tls config affect the cache key + uniqueConfigurations := map[string]*Config{ + "no tls": {}, + "insecure": {TLS: TLSConfig{Insecure: true}}, + "cadata 1": {TLS: TLSConfig{CAData: []byte{1}}}, + "cadata 2": {TLS: TLSConfig{CAData: []byte{2}}}, + "cert 1, key 1": { + TLS: TLSConfig{ + CertData: []byte{1}, + KeyData: []byte{1}, + }, + }, + "cert 1, key 2": { + TLS: TLSConfig{ + CertData: []byte{1}, + KeyData: []byte{2}, + }, + }, + "cert 2, key 1": { + TLS: TLSConfig{ + CertData: []byte{2}, + KeyData: []byte{1}, + }, + }, + "cert 2, key 2": { + TLS: TLSConfig{ + CertData: []byte{2}, + KeyData: []byte{2}, + }, + }, + "cadata 1, cert 1, key 1": { + TLS: TLSConfig{ + CAData: []byte{1}, + CertData: []byte{1}, + KeyData: []byte{1}, + }, + }, + } + for nameA, valueA := range uniqueConfigurations { + for nameB, valueB := range uniqueConfigurations { + // Don't compare to ourselves + if nameA == nameB { + continue + } + + keyA, err := tlsConfigKey(valueA) + if err != nil { + t.Errorf("Unexpected error for %q: %v", nameA, err) + continue + } + keyB, err := tlsConfigKey(valueB) + if err != nil { + t.Errorf("Unexpected error for %q: %v", nameB, err) + continue + } + if keyA == keyB { + t.Errorf("Expected unique cache keys for %q and %q, got:\n\t%s\n\t%s", nameA, nameB, keyA, keyB) + continue + } + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/transport/config.go b/vendor/k8s.io/kubernetes/pkg/client/transport/config.go new file mode 100644 index 000000000..801977f87 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/transport/config.go @@ -0,0 +1,81 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package transport + +import "net/http" + +// Config holds various options for establishing a transport. +type Config struct { + // UserAgent is an optional field that specifies the caller of this + // request. + UserAgent string + + // The base TLS configuration for this transport. + TLS TLSConfig + + // Username and password for basic authentication + Username string + Password string + + // Bearer token for authentication + BearerToken string + + // Transport may be used for custom HTTP behavior. This attribute may + // not be specified with the TLS client certificate options. Use + // WrapTransport for most client level operations. + Transport http.RoundTripper + + // WrapTransport will be invoked for custom HTTP behavior after the + // underlying transport is initialized (either the transport created + // from TLSClientConfig, Transport, or http.DefaultTransport). The + // config may layer other RoundTrippers on top of the returned + // RoundTripper. + WrapTransport func(rt http.RoundTripper) http.RoundTripper +} + +// HasCA returns whether the configuration has a certificate authority or not. +func (c *Config) HasCA() bool { + return len(c.TLS.CAData) > 0 || len(c.TLS.CAFile) > 0 +} + +// HasBasicAuth returns whether the configuration has basic authentication or not. +func (c *Config) HasBasicAuth() bool { + return len(c.Username) != 0 +} + +// HasTokenAuth returns whether the configuration has token authentication or not. +func (c *Config) HasTokenAuth() bool { + return len(c.BearerToken) != 0 +} + +// HasCertAuth returns whether the configuration has certificate authentication or not. +func (c *Config) HasCertAuth() bool { + return len(c.TLS.CertData) != 0 || len(c.TLS.CertFile) != 0 +} + +// TLSConfig holds the information needed to set up a TLS transport. +type TLSConfig struct { + CAFile string // Path of the PEM-encoded server trusted root certificates. + CertFile string // Path of the PEM-encoded client certificate. + KeyFile string // Path of the PEM-encoded client key. + + Insecure bool // Server should be accessed without verifying the certificate. For testing only. + + CAData []byte // Bytes of the PEM-encoded server trusted root certificates. Supercedes CAFile. + CertData []byte // Bytes of the PEM-encoded client certificate. Supercedes CertFile. + KeyData []byte // Bytes of the PEM-encoded client key. Supercedes KeyFile. +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/transport/round_trippers.go b/vendor/k8s.io/kubernetes/pkg/client/transport/round_trippers.go new file mode 100644 index 000000000..6136e080e --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/transport/round_trippers.go @@ -0,0 +1,305 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package transport + +import ( + "fmt" + "net/http" + "time" + + "github.com/golang/glog" +) + +// HTTPWrappersForConfig wraps a round tripper with any relevant layered +// behavior from the config. Exposed to allow more clients that need HTTP-like +// behavior but then must hijack the underlying connection (like WebSocket or +// HTTP2 clients). Pure HTTP clients should use the RoundTripper returned from +// New. +func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error) { + if config.WrapTransport != nil { + rt = config.WrapTransport(rt) + } + + rt = DebugWrappers(rt) + + // Set authentication wrappers + switch { + case config.HasBasicAuth() && config.HasTokenAuth(): + return nil, fmt.Errorf("username/password or bearer token may be set, but not both") + case config.HasTokenAuth(): + rt = NewBearerAuthRoundTripper(config.BearerToken, rt) + case config.HasBasicAuth(): + rt = NewBasicAuthRoundTripper(config.Username, config.Password, rt) + } + if len(config.UserAgent) > 0 { + rt = NewUserAgentRoundTripper(config.UserAgent, rt) + } + return rt, nil +} + +// DebugWrappers wraps a round tripper and logs based on the current log level. +func DebugWrappers(rt http.RoundTripper) http.RoundTripper { + switch { + case bool(glog.V(9)): + rt = newDebuggingRoundTripper(rt, debugCurlCommand, debugURLTiming, debugResponseHeaders) + case bool(glog.V(8)): + rt = newDebuggingRoundTripper(rt, debugJustURL, debugRequestHeaders, debugResponseStatus, debugResponseHeaders) + case bool(glog.V(7)): + rt = newDebuggingRoundTripper(rt, debugJustURL, debugRequestHeaders, debugResponseStatus) + case bool(glog.V(6)): + rt = newDebuggingRoundTripper(rt, debugURLTiming) + } + + return rt +} + +type requestCanceler interface { + CancelRequest(*http.Request) +} + +type userAgentRoundTripper struct { + agent string + rt http.RoundTripper +} + +func NewUserAgentRoundTripper(agent string, rt http.RoundTripper) http.RoundTripper { + return &userAgentRoundTripper{agent, rt} +} + +func (rt *userAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + if len(req.Header.Get("User-Agent")) != 0 { + return rt.rt.RoundTrip(req) + } + req = cloneRequest(req) + req.Header.Set("User-Agent", rt.agent) + return rt.rt.RoundTrip(req) +} + +func (rt *userAgentRoundTripper) CancelRequest(req *http.Request) { + if canceler, ok := rt.rt.(requestCanceler); ok { + canceler.CancelRequest(req) + } else { + glog.Errorf("CancelRequest not implemented") + } +} + +func (rt *userAgentRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt } + +type basicAuthRoundTripper struct { + username string + password string + rt http.RoundTripper +} + +// NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a +// request unless it has already been set. +func NewBasicAuthRoundTripper(username, password string, rt http.RoundTripper) http.RoundTripper { + return &basicAuthRoundTripper{username, password, rt} +} + +func (rt *basicAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + if len(req.Header.Get("Authorization")) != 0 { + return rt.rt.RoundTrip(req) + } + req = cloneRequest(req) + req.SetBasicAuth(rt.username, rt.password) + return rt.rt.RoundTrip(req) +} + +func (rt *basicAuthRoundTripper) CancelRequest(req *http.Request) { + if canceler, ok := rt.rt.(requestCanceler); ok { + canceler.CancelRequest(req) + } else { + glog.Errorf("CancelRequest not implemented") + } +} + +func (rt *basicAuthRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt } + +type bearerAuthRoundTripper struct { + bearer string + rt http.RoundTripper +} + +// NewBearerAuthRoundTripper adds the provided bearer token to a request +// unless the authorization header has already been set. +func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper { + return &bearerAuthRoundTripper{bearer, rt} +} + +func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + if len(req.Header.Get("Authorization")) != 0 { + return rt.rt.RoundTrip(req) + } + + req = cloneRequest(req) + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", rt.bearer)) + return rt.rt.RoundTrip(req) +} + +func (rt *bearerAuthRoundTripper) CancelRequest(req *http.Request) { + if canceler, ok := rt.rt.(requestCanceler); ok { + canceler.CancelRequest(req) + } else { + glog.Errorf("CancelRequest not implemented") + } +} + +func (rt *bearerAuthRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt } + +// cloneRequest returns a clone of the provided *http.Request. +// The clone is a shallow copy of the struct and its Header map. +func cloneRequest(r *http.Request) *http.Request { + // shallow copy of the struct + r2 := new(http.Request) + *r2 = *r + // deep copy of the Header + r2.Header = make(http.Header) + for k, s := range r.Header { + r2.Header[k] = s + } + return r2 +} + +// requestInfo keeps track of information about a request/response combination +type requestInfo struct { + RequestHeaders http.Header + RequestVerb string + RequestURL string + + ResponseStatus string + ResponseHeaders http.Header + ResponseErr error + + Duration time.Duration +} + +// newRequestInfo creates a new RequestInfo based on an http request +func newRequestInfo(req *http.Request) *requestInfo { + return &requestInfo{ + RequestURL: req.URL.String(), + RequestVerb: req.Method, + RequestHeaders: req.Header, + } +} + +// complete adds information about the response to the requestInfo +func (r *requestInfo) complete(response *http.Response, err error) { + if err != nil { + r.ResponseErr = err + return + } + r.ResponseStatus = response.Status + r.ResponseHeaders = response.Header +} + +// toCurl returns a string that can be run as a command in a terminal (minus the body) +func (r *requestInfo) toCurl() string { + headers := "" + for key, values := range r.RequestHeaders { + for _, value := range values { + headers += fmt.Sprintf(` -H %q`, fmt.Sprintf("%s: %s", key, value)) + } + } + + return fmt.Sprintf("curl -k -v -X%s %s %s", r.RequestVerb, headers, r.RequestURL) +} + +// debuggingRoundTripper will display information about the requests passing +// through it based on what is configured +type debuggingRoundTripper struct { + delegatedRoundTripper http.RoundTripper + + levels map[debugLevel]bool +} + +type debugLevel int + +const ( + debugJustURL debugLevel = iota + debugURLTiming + debugCurlCommand + debugRequestHeaders + debugResponseStatus + debugResponseHeaders +) + +func newDebuggingRoundTripper(rt http.RoundTripper, levels ...debugLevel) *debuggingRoundTripper { + drt := &debuggingRoundTripper{ + delegatedRoundTripper: rt, + levels: make(map[debugLevel]bool, len(levels)), + } + for _, v := range levels { + drt.levels[v] = true + } + return drt +} + +func (rt *debuggingRoundTripper) CancelRequest(req *http.Request) { + if canceler, ok := rt.delegatedRoundTripper.(requestCanceler); ok { + canceler.CancelRequest(req) + } else { + glog.Errorf("CancelRequest not implemented") + } +} + +func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + reqInfo := newRequestInfo(req) + + if rt.levels[debugJustURL] { + glog.Infof("%s %s", reqInfo.RequestVerb, reqInfo.RequestURL) + } + if rt.levels[debugCurlCommand] { + glog.Infof("%s", reqInfo.toCurl()) + + } + if rt.levels[debugRequestHeaders] { + glog.Infof("Request Headers:") + for key, values := range reqInfo.RequestHeaders { + for _, value := range values { + glog.Infof(" %s: %s", key, value) + } + } + } + + startTime := time.Now() + response, err := rt.delegatedRoundTripper.RoundTrip(req) + reqInfo.Duration = time.Since(startTime) + + reqInfo.complete(response, err) + + if rt.levels[debugURLTiming] { + glog.Infof("%s %s %s in %d milliseconds", reqInfo.RequestVerb, reqInfo.RequestURL, reqInfo.ResponseStatus, reqInfo.Duration.Nanoseconds()/int64(time.Millisecond)) + } + if rt.levels[debugResponseStatus] { + glog.Infof("Response Status: %s in %d milliseconds", reqInfo.ResponseStatus, reqInfo.Duration.Nanoseconds()/int64(time.Millisecond)) + } + if rt.levels[debugResponseHeaders] { + glog.Infof("Response Headers:") + for key, values := range reqInfo.ResponseHeaders { + for _, value := range values { + glog.Infof(" %s: %s", key, value) + } + } + } + + return response, err +} + +func (rt *debuggingRoundTripper) WrappedRoundTripper() http.RoundTripper { + return rt.delegatedRoundTripper +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/transport/round_trippers_test.go b/vendor/k8s.io/kubernetes/pkg/client/transport/round_trippers_test.go new file mode 100644 index 000000000..6e8e52f7d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/transport/round_trippers_test.go @@ -0,0 +1,101 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package transport + +import ( + "net/http" + "testing" +) + +type testRoundTripper struct { + Request *http.Request + Response *http.Response + Err error +} + +func (rt *testRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + rt.Request = req + return rt.Response, rt.Err +} + +func TestBearerAuthRoundTripper(t *testing.T) { + rt := &testRoundTripper{} + req := &http.Request{} + NewBearerAuthRoundTripper("test", rt).RoundTrip(req) + if rt.Request == nil { + t.Fatalf("unexpected nil request: %v", rt) + } + if rt.Request == req { + t.Fatalf("round tripper should have copied request object: %#v", rt.Request) + } + if rt.Request.Header.Get("Authorization") != "Bearer test" { + t.Errorf("unexpected authorization header: %#v", rt.Request) + } +} + +func TestBasicAuthRoundTripper(t *testing.T) { + for n, tc := range map[string]struct { + user string + pass string + }{ + "basic": {user: "user", pass: "pass"}, + "no pass": {user: "user"}, + } { + rt := &testRoundTripper{} + req := &http.Request{} + NewBasicAuthRoundTripper(tc.user, tc.pass, rt).RoundTrip(req) + if rt.Request == nil { + t.Fatalf("%s: unexpected nil request: %v", n, rt) + } + if rt.Request == req { + t.Fatalf("%s: round tripper should have copied request object: %#v", n, rt.Request) + } + if user, pass, found := rt.Request.BasicAuth(); !found || user != tc.user || pass != tc.pass { + t.Errorf("%s: unexpected authorization header: %#v", n, rt.Request) + } + } +} + +func TestUserAgentRoundTripper(t *testing.T) { + rt := &testRoundTripper{} + req := &http.Request{ + Header: make(http.Header), + } + req.Header.Set("User-Agent", "other") + NewUserAgentRoundTripper("test", rt).RoundTrip(req) + if rt.Request == nil { + t.Fatalf("unexpected nil request: %v", rt) + } + if rt.Request != req { + t.Fatalf("round tripper should not have copied request object: %#v", rt.Request) + } + if rt.Request.Header.Get("User-Agent") != "other" { + t.Errorf("unexpected user agent header: %#v", rt.Request) + } + + req = &http.Request{} + NewUserAgentRoundTripper("test", rt).RoundTrip(req) + if rt.Request == nil { + t.Fatalf("unexpected nil request: %v", rt) + } + if rt.Request == req { + t.Fatalf("round tripper should have copied request object: %#v", rt.Request) + } + if rt.Request.Header.Get("User-Agent") != "test" { + t.Errorf("unexpected user agent header: %#v", rt.Request) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/transport/transport.go b/vendor/k8s.io/kubernetes/pkg/client/transport/transport.go new file mode 100644 index 000000000..94d9c0fbe --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/transport/transport.go @@ -0,0 +1,138 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package transport + +import ( + "crypto/tls" + "crypto/x509" + "fmt" + "io/ioutil" + "net/http" +) + +// New returns an http.RoundTripper that will provide the authentication +// or transport level security defined by the provided Config. +func New(config *Config) (http.RoundTripper, error) { + // Set transport level security + if config.Transport != nil && (config.HasCA() || config.HasCertAuth() || config.TLS.Insecure) { + return nil, fmt.Errorf("using a custom transport with TLS certificate options or the insecure flag is not allowed") + } + + var ( + rt http.RoundTripper + err error + ) + + if config.Transport != nil { + rt = config.Transport + } else { + rt, err = tlsCache.get(config) + if err != nil { + return nil, err + } + } + + return HTTPWrappersForConfig(config, rt) +} + +// TLSConfigFor returns a tls.Config that will provide the transport level security defined +// by the provided Config. Will return nil if no transport level security is requested. +func TLSConfigFor(c *Config) (*tls.Config, error) { + if !(c.HasCA() || c.HasCertAuth() || c.TLS.Insecure) { + return nil, nil + } + if c.HasCA() && c.TLS.Insecure { + return nil, fmt.Errorf("specifying a root certificates file with the insecure flag is not allowed") + } + if err := loadTLSFiles(c); err != nil { + return nil, err + } + + tlsConfig := &tls.Config{ + // Change default from SSLv3 to TLSv1.0 (because of POODLE vulnerability) + MinVersion: tls.VersionTLS10, + InsecureSkipVerify: c.TLS.Insecure, + } + + if c.HasCA() { + tlsConfig.RootCAs = rootCertPool(c.TLS.CAData) + } + + if c.HasCertAuth() { + cert, err := tls.X509KeyPair(c.TLS.CertData, c.TLS.KeyData) + if err != nil { + return nil, err + } + tlsConfig.Certificates = []tls.Certificate{cert} + } + + return tlsConfig, nil +} + +// loadTLSFiles copies the data from the CertFile, KeyFile, and CAFile fields into the CertData, +// KeyData, and CAFile fields, or returns an error. If no error is returned, all three fields are +// either populated or were empty to start. +func loadTLSFiles(c *Config) error { + var err error + c.TLS.CAData, err = dataFromSliceOrFile(c.TLS.CAData, c.TLS.CAFile) + if err != nil { + return err + } + + c.TLS.CertData, err = dataFromSliceOrFile(c.TLS.CertData, c.TLS.CertFile) + if err != nil { + return err + } + + c.TLS.KeyData, err = dataFromSliceOrFile(c.TLS.KeyData, c.TLS.KeyFile) + if err != nil { + return err + } + return nil +} + +// dataFromSliceOrFile returns data from the slice (if non-empty), or from the file, +// or an error if an error occurred reading the file +func dataFromSliceOrFile(data []byte, file string) ([]byte, error) { + if len(data) > 0 { + return data, nil + } + if len(file) > 0 { + fileData, err := ioutil.ReadFile(file) + if err != nil { + return []byte{}, err + } + return fileData, nil + } + return nil, nil +} + +// rootCertPool returns nil if caData is empty. When passed along, this will mean "use system CAs". +// When caData is not empty, it will be the ONLY information used in the CertPool. +func rootCertPool(caData []byte) *x509.CertPool { + // What we really want is a copy of x509.systemRootsPool, but that isn't exposed. It's difficult to build (see the go + // code for a look at the platform specific insanity), so we'll use the fact that RootCAs == nil gives us the system values + // It doesn't allow trusting either/or, but hopefully that won't be an issue + if len(caData) == 0 { + return nil + } + + // if we have caData, use it + certPool := x509.NewCertPool() + certPool.AppendCertsFromPEM(caData) + return certPool +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/transport/transport_test.go b/vendor/k8s.io/kubernetes/pkg/client/transport/transport_test.go new file mode 100644 index 000000000..ca04172d2 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/transport/transport_test.go @@ -0,0 +1,204 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package transport + +import ( + "net/http" + "testing" +) + +const ( + rootCACert = `-----BEGIN CERTIFICATE----- +MIIC4DCCAcqgAwIBAgIBATALBgkqhkiG9w0BAQswIzEhMB8GA1UEAwwYMTAuMTMu +MTI5LjEwNkAxNDIxMzU5MDU4MB4XDTE1MDExNTIxNTczN1oXDTE2MDExNTIxNTcz +OFowIzEhMB8GA1UEAwwYMTAuMTMuMTI5LjEwNkAxNDIxMzU5MDU4MIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAunDRXGwsiYWGFDlWH6kjGun+PshDGeZX +xtx9lUnL8pIRWH3wX6f13PO9sktaOWW0T0mlo6k2bMlSLlSZgG9H6og0W6gLS3vq +s4VavZ6DbXIwemZG2vbRwsvR+t4G6Nbwelm6F8RFnA1Fwt428pavmNQ/wgYzo+T1 +1eS+HiN4ACnSoDSx3QRWcgBkB1g6VReofVjx63i0J+w8Q/41L9GUuLqquFxu6ZnH +60vTB55lHgFiDLjA1FkEz2dGvGh/wtnFlRvjaPC54JH2K1mPYAUXTreoeJtLJKX0 +ycoiyB24+zGCniUmgIsmQWRPaOPircexCp1BOeze82BT1LCZNTVaxQIDAQABoyMw +ITAOBgNVHQ8BAf8EBAMCAKQwDwYDVR0TAQH/BAUwAwEB/zALBgkqhkiG9w0BAQsD +ggEBADMxsUuAFlsYDpF4fRCzXXwrhbtj4oQwcHpbu+rnOPHCZupiafzZpDu+rw4x +YGPnCb594bRTQn4pAu3Ac18NbLD5pV3uioAkv8oPkgr8aUhXqiv7KdDiaWm6sbAL +EHiXVBBAFvQws10HMqMoKtO8f1XDNAUkWduakR/U6yMgvOPwS7xl0eUTqyRB6zGb +K55q2dejiFWaFqB/y78txzvz6UlOZKE44g2JAVoJVM6kGaxh33q8/FmrL4kuN3ut +W+MmJCVDvd4eEqPwbp7146ZWTqpIJ8lvA6wuChtqV8lhAPka2hD/LMqY8iXNmfXD +uml0obOEy+ON91k+SWTJ3ggmF/U= +-----END CERTIFICATE-----` + + certData = `-----BEGIN CERTIFICATE----- +MIIC6jCCAdSgAwIBAgIBCzALBgkqhkiG9w0BAQswIzEhMB8GA1UEAwwYMTAuMTMu +MTI5LjEwNkAxNDIxMzU5MDU4MB4XDTE1MDExNTIyMDEzMVoXDTE2MDExNTIyMDEz +MlowGzEZMBcGA1UEAxMQb3BlbnNoaWZ0LWNsaWVudDCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBAKtdhz0+uCLXw5cSYns9rU/XifFSpb/x24WDdrm72S/v +b9BPYsAStiP148buylr1SOuNi8sTAZmlVDDIpIVwMLff+o2rKYDicn9fjbrTxTOj +lI4pHJBH+JU3AJ0tbajupioh70jwFS0oYpwtneg2zcnE2Z4l6mhrj2okrc5Q1/X2 +I2HChtIU4JYTisObtin10QKJX01CLfYXJLa8upWzKZ4/GOcHG+eAV3jXWoXidtjb +1Usw70amoTZ6mIVCkiu1QwCoa8+ycojGfZhvqMsAp1536ZcCul+Na+AbCv4zKS7F +kQQaImVrXdUiFansIoofGlw/JNuoKK6ssVpS5Ic3pgcCAwEAAaM1MDMwDgYDVR0P +AQH/BAQDAgCgMBMGA1UdJQQMMAoGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwCwYJ +KoZIhvcNAQELA4IBAQCKLREH7bXtXtZ+8vI6cjD7W3QikiArGqbl36bAhhWsJLp/ +p/ndKz39iFNaiZ3GlwIURWOOKx3y3GA0x9m8FR+Llthf0EQ8sUjnwaknWs0Y6DQ3 +jjPFZOpV3KPCFrdMJ3++E3MgwFC/Ih/N2ebFX9EcV9Vcc6oVWMdwT0fsrhu683rq +6GSR/3iVX1G/pmOiuaR0fNUaCyCfYrnI4zHBDgSfnlm3vIvN2lrsR/DQBakNL8DJ +HBgKxMGeUPoneBv+c8DMXIL0EhaFXRlBv9QW45/GiAIOuyFJ0i6hCtGZpJjq4OpQ +BRjCI+izPzFTjsxD4aORE+WOkyWFCGPWKfNejfw0 +-----END CERTIFICATE-----` + + keyData = `-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAq12HPT64ItfDlxJiez2tT9eJ8VKlv/HbhYN2ubvZL+9v0E9i +wBK2I/Xjxu7KWvVI642LyxMBmaVUMMikhXAwt9/6jaspgOJyf1+NutPFM6OUjikc +kEf4lTcAnS1tqO6mKiHvSPAVLShinC2d6DbNycTZniXqaGuPaiStzlDX9fYjYcKG +0hTglhOKw5u2KfXRAolfTUIt9hcktry6lbMpnj8Y5wcb54BXeNdaheJ22NvVSzDv +RqahNnqYhUKSK7VDAKhrz7JyiMZ9mG+oywCnXnfplwK6X41r4BsK/jMpLsWRBBoi +ZWtd1SIVqewiih8aXD8k26gorqyxWlLkhzemBwIDAQABAoIBAD2XYRs3JrGHQUpU +FkdbVKZkvrSY0vAZOqBTLuH0zUv4UATb8487anGkWBjRDLQCgxH+jucPTrztekQK +aW94clo0S3aNtV4YhbSYIHWs1a0It0UdK6ID7CmdWkAj6s0T8W8lQT7C46mWYVLm +5mFnCTHi6aB42jZrqmEpC7sivWwuU0xqj3Ml8kkxQCGmyc9JjmCB4OrFFC8NNt6M +ObvQkUI6Z3nO4phTbpxkE1/9dT0MmPIF7GhHVzJMS+EyyRYUDllZ0wvVSOM3qZT0 +JMUaBerkNwm9foKJ1+dv2nMKZZbJajv7suUDCfU44mVeaEO+4kmTKSGCGjjTBGkr +7L1ySDECgYEA5ElIMhpdBzIivCuBIH8LlUeuzd93pqssO1G2Xg0jHtfM4tz7fyeI +cr90dc8gpli24dkSxzLeg3Tn3wIj/Bu64m2TpZPZEIlukYvgdgArmRIPQVxerYey +OkrfTNkxU1HXsYjLCdGcGXs5lmb+K/kuTcFxaMOs7jZi7La+jEONwf8CgYEAwCs/ +rUOOA0klDsWWisbivOiNPII79c9McZCNBqncCBfMUoiGe8uWDEO4TFHN60vFuVk9 +8PkwpCfvaBUX+ajvbafIfHxsnfk1M04WLGCeqQ/ym5Q4sQoQOcC1b1y9qc/xEWfg +nIUuia0ukYRpl7qQa3tNg+BNFyjypW8zukUAC/kCgYB1/Kojuxx5q5/oQVPrx73k +2bevD+B3c+DYh9MJqSCNwFtUpYIWpggPxoQan4LwdsmO0PKzocb/ilyNFj4i/vII +NToqSc/WjDFpaDIKyuu9oWfhECye45NqLWhb/6VOuu4QA/Nsj7luMhIBehnEAHW+ +GkzTKM8oD1PxpEG3nPKXYQKBgQC6AuMPRt3XBl1NkCrpSBy/uObFlFaP2Enpf39S +3OZ0Gv0XQrnSaL1kP8TMcz68rMrGX8DaWYsgytstR4W+jyy7WvZwsUu+GjTJ5aMG +77uEcEBpIi9CBzivfn7hPccE8ZgqPf+n4i6q66yxBJflW5xhvafJqDtW2LcPNbW/ +bvzdmQKBgExALRUXpq+5dbmkdXBHtvXdRDZ6rVmrnjy4nI5bPw+1GqQqk6uAR6B/ +F6NmLCQOO4PDG/cuatNHIr2FrwTmGdEL6ObLUGWn9Oer9gJhHVqqsY5I4sEPo4XX +stR0Yiw0buV6DL/moUO0HIM9Bjh96HJp+LxiIS6UCdIhMPp5HoQa +-----END RSA PRIVATE KEY-----` +) + +func TestNew(t *testing.T) { + testCases := map[string]struct { + Config *Config + Err bool + TLS bool + Default bool + }{ + "default transport": { + Default: true, + Config: &Config{}, + }, + + "ca transport": { + TLS: true, + Config: &Config{ + TLS: TLSConfig{ + CAData: []byte(rootCACert), + }, + }, + }, + "bad ca file transport": { + Err: true, + Config: &Config{ + TLS: TLSConfig{ + CAFile: "invalid file", + }, + }, + }, + "ca data overriding bad ca file transport": { + TLS: true, + Config: &Config{ + TLS: TLSConfig{ + CAData: []byte(rootCACert), + CAFile: "invalid file", + }, + }, + }, + + "cert transport": { + TLS: true, + Config: &Config{ + TLS: TLSConfig{ + CAData: []byte(rootCACert), + CertData: []byte(certData), + KeyData: []byte(keyData), + }, + }, + }, + "bad cert data transport": { + Err: true, + Config: &Config{ + TLS: TLSConfig{ + CAData: []byte(rootCACert), + CertData: []byte(certData), + KeyData: []byte("bad key data"), + }, + }, + }, + "bad file cert transport": { + Err: true, + Config: &Config{ + TLS: TLSConfig{ + CAData: []byte(rootCACert), + CertData: []byte(certData), + KeyFile: "invalid file", + }, + }, + }, + "key data overriding bad file cert transport": { + TLS: true, + Config: &Config{ + TLS: TLSConfig{ + CAData: []byte(rootCACert), + CertData: []byte(certData), + KeyData: []byte(keyData), + KeyFile: "invalid file", + }, + }, + }, + } + for k, testCase := range testCases { + transport, err := New(testCase.Config) + switch { + case testCase.Err && err == nil: + t.Errorf("%s: unexpected non-error", k) + continue + case !testCase.Err && err != nil: + t.Errorf("%s: unexpected error: %v", k, err) + continue + } + + switch { + case testCase.Default && transport != http.DefaultTransport: + t.Errorf("%s: expected the default transport, got %#v", k, transport) + continue + case !testCase.Default && transport == http.DefaultTransport: + t.Errorf("%s: expected non-default transport, got %#v", k, transport) + continue + } + + // We only know how to check TLSConfig on http.Transports + if transport, ok := transport.(*http.Transport); ok { + switch { + case testCase.TLS && transport.TLSClientConfig == nil: + t.Errorf("%s: expected TLSClientConfig, got %#v", k, transport) + continue + case !testCase.TLS && transport.TLSClientConfig != nil: + t.Errorf("%s: expected no TLSClientConfig, got %#v", k, transport) + continue + } + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/componentstatus.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/componentstatus.go new file mode 100644 index 000000000..0ef0667da --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/componentstatus.go @@ -0,0 +1,126 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ComponentStatusesGetter has a method to return a ComponentStatusInterface. +// A group's client should implement this interface. +type ComponentStatusesGetter interface { + ComponentStatuses() ComponentStatusInterface +} + +// ComponentStatusInterface has methods to work with ComponentStatus resources. +type ComponentStatusInterface interface { + Create(*api.ComponentStatus) (*api.ComponentStatus, error) + Update(*api.ComponentStatus) (*api.ComponentStatus, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.ComponentStatus, error) + List(opts api.ListOptions) (*api.ComponentStatusList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + ComponentStatusExpansion +} + +// componentStatuses implements ComponentStatusInterface +type componentStatuses struct { + client *CoreClient +} + +// newComponentStatuses returns a ComponentStatuses +func newComponentStatuses(c *CoreClient) *componentStatuses { + return &componentStatuses{ + client: c, + } +} + +// Create takes the representation of a componentStatus and creates it. Returns the server's representation of the componentStatus, and an error, if there is any. +func (c *componentStatuses) Create(componentStatus *api.ComponentStatus) (result *api.ComponentStatus, err error) { + result = &api.ComponentStatus{} + err = c.client.Post(). + Resource("componentstatuses"). + Body(componentStatus). + Do(). + Into(result) + return +} + +// Update takes the representation of a componentStatus and updates it. Returns the server's representation of the componentStatus, and an error, if there is any. +func (c *componentStatuses) Update(componentStatus *api.ComponentStatus) (result *api.ComponentStatus, err error) { + result = &api.ComponentStatus{} + err = c.client.Put(). + Resource("componentstatuses"). + Name(componentStatus.Name). + Body(componentStatus). + Do(). + Into(result) + return +} + +// Delete takes name of the componentStatus and deletes it. Returns an error if one occurs. +func (c *componentStatuses) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Resource("componentstatuses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *componentStatuses) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Resource("componentstatuses"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the componentStatus, and returns the corresponding componentStatus object, and an error if there is any. +func (c *componentStatuses) Get(name string) (result *api.ComponentStatus, err error) { + result = &api.ComponentStatus{} + err = c.client.Get(). + Resource("componentstatuses"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ComponentStatuses that match those selectors. +func (c *componentStatuses) List(opts api.ListOptions) (result *api.ComponentStatusList, err error) { + result = &api.ComponentStatusList{} + err = c.client.Get(). + Resource("componentstatuses"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested componentStatuses. +func (c *componentStatuses) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("componentstatuses"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/configmap.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/configmap.go new file mode 100644 index 000000000..b43e53d6c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/configmap.go @@ -0,0 +1,135 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ConfigMapsGetter has a method to return a ConfigMapInterface. +// A group's client should implement this interface. +type ConfigMapsGetter interface { + ConfigMaps(namespace string) ConfigMapInterface +} + +// ConfigMapInterface has methods to work with ConfigMap resources. +type ConfigMapInterface interface { + Create(*api.ConfigMap) (*api.ConfigMap, error) + Update(*api.ConfigMap) (*api.ConfigMap, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.ConfigMap, error) + List(opts api.ListOptions) (*api.ConfigMapList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + ConfigMapExpansion +} + +// configMaps implements ConfigMapInterface +type configMaps struct { + client *CoreClient + ns string +} + +// newConfigMaps returns a ConfigMaps +func newConfigMaps(c *CoreClient, namespace string) *configMaps { + return &configMaps{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a configMap and creates it. Returns the server's representation of the configMap, and an error, if there is any. +func (c *configMaps) Create(configMap *api.ConfigMap) (result *api.ConfigMap, err error) { + result = &api.ConfigMap{} + err = c.client.Post(). + Namespace(c.ns). + Resource("configmaps"). + Body(configMap). + Do(). + Into(result) + return +} + +// Update takes the representation of a configMap and updates it. Returns the server's representation of the configMap, and an error, if there is any. +func (c *configMaps) Update(configMap *api.ConfigMap) (result *api.ConfigMap, err error) { + result = &api.ConfigMap{} + err = c.client.Put(). + Namespace(c.ns). + Resource("configmaps"). + Name(configMap.Name). + Body(configMap). + Do(). + Into(result) + return +} + +// Delete takes name of the configMap and deletes it. Returns an error if one occurs. +func (c *configMaps) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("configmaps"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *configMaps) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("configmaps"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the configMap, and returns the corresponding configMap object, and an error if there is any. +func (c *configMaps) Get(name string) (result *api.ConfigMap, err error) { + result = &api.ConfigMap{} + err = c.client.Get(). + Namespace(c.ns). + Resource("configmaps"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ConfigMaps that match those selectors. +func (c *configMaps) List(opts api.ListOptions) (result *api.ConfigMapList, err error) { + result = &api.ConfigMapList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("configmaps"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested configMaps. +func (c *configMaps) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("configmaps"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/core_client.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/core_client.go new file mode 100644 index 000000000..c8119031e --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/core_client.go @@ -0,0 +1,165 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + unversioned "k8s.io/kubernetes/pkg/client/unversioned" +) + +type CoreInterface interface { + ComponentStatusesGetter + ConfigMapsGetter + EndpointsGetter + EventsGetter + LimitRangesGetter + NamespacesGetter + NodesGetter + PersistentVolumesGetter + PersistentVolumeClaimsGetter + PodsGetter + PodTemplatesGetter + ReplicationControllersGetter + ResourceQuotasGetter + SecretsGetter + ServicesGetter + ServiceAccountsGetter +} + +// CoreClient is used to interact with features provided by the Core group. +type CoreClient struct { + *unversioned.RESTClient +} + +func (c *CoreClient) ComponentStatuses() ComponentStatusInterface { + return newComponentStatuses(c) +} + +func (c *CoreClient) ConfigMaps(namespace string) ConfigMapInterface { + return newConfigMaps(c, namespace) +} + +func (c *CoreClient) Endpoints(namespace string) EndpointsInterface { + return newEndpoints(c, namespace) +} + +func (c *CoreClient) Events(namespace string) EventInterface { + return newEvents(c, namespace) +} + +func (c *CoreClient) LimitRanges(namespace string) LimitRangeInterface { + return newLimitRanges(c, namespace) +} + +func (c *CoreClient) Namespaces() NamespaceInterface { + return newNamespaces(c) +} + +func (c *CoreClient) Nodes() NodeInterface { + return newNodes(c) +} + +func (c *CoreClient) PersistentVolumes() PersistentVolumeInterface { + return newPersistentVolumes(c) +} + +func (c *CoreClient) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface { + return newPersistentVolumeClaims(c, namespace) +} + +func (c *CoreClient) Pods(namespace string) PodInterface { + return newPods(c, namespace) +} + +func (c *CoreClient) PodTemplates(namespace string) PodTemplateInterface { + return newPodTemplates(c, namespace) +} + +func (c *CoreClient) ReplicationControllers(namespace string) ReplicationControllerInterface { + return newReplicationControllers(c, namespace) +} + +func (c *CoreClient) ResourceQuotas(namespace string) ResourceQuotaInterface { + return newResourceQuotas(c, namespace) +} + +func (c *CoreClient) Secrets(namespace string) SecretInterface { + return newSecrets(c, namespace) +} + +func (c *CoreClient) Services(namespace string) ServiceInterface { + return newServices(c, namespace) +} + +func (c *CoreClient) ServiceAccounts(namespace string) ServiceAccountInterface { + return newServiceAccounts(c, namespace) +} + +// NewForConfig creates a new CoreClient for the given config. +func NewForConfig(c *unversioned.Config) (*CoreClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := unversioned.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &CoreClient{client}, nil +} + +// NewForConfigOrDie creates a new CoreClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *unversioned.Config) *CoreClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new CoreClient for the given RESTClient. +func New(c *unversioned.RESTClient) *CoreClient { + return &CoreClient{c} +} + +func setConfigDefaults(config *unversioned.Config) error { + // if core group is not registered, return an error + g, err := registered.Group("") + if err != nil { + return err + } + config.APIPath = "/api" + if config.UserAgent == "" { + config.UserAgent = unversioned.DefaultKubernetesUserAgent() + } + // TODO: Unconditionally set the config.Version, until we fix the config. + //if config.Version == "" { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + //} + + config.Codec = api.Codecs.LegacyCodec(*config.GroupVersion) + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/doc.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/doc.go new file mode 100644 index 000000000..930017040 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package unversioned has the automatically generated clients for unversioned resources. +package unversioned diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/endpoints.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/endpoints.go new file mode 100644 index 000000000..78e2a0878 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/endpoints.go @@ -0,0 +1,135 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// EndpointsGetter has a method to return a EndpointsInterface. +// A group's client should implement this interface. +type EndpointsGetter interface { + Endpoints(namespace string) EndpointsInterface +} + +// EndpointsInterface has methods to work with Endpoints resources. +type EndpointsInterface interface { + Create(*api.Endpoints) (*api.Endpoints, error) + Update(*api.Endpoints) (*api.Endpoints, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.Endpoints, error) + List(opts api.ListOptions) (*api.EndpointsList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + EndpointsExpansion +} + +// endpoints implements EndpointsInterface +type endpoints struct { + client *CoreClient + ns string +} + +// newEndpoints returns a Endpoints +func newEndpoints(c *CoreClient, namespace string) *endpoints { + return &endpoints{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a endpoints and creates it. Returns the server's representation of the endpoints, and an error, if there is any. +func (c *endpoints) Create(endpoints *api.Endpoints) (result *api.Endpoints, err error) { + result = &api.Endpoints{} + err = c.client.Post(). + Namespace(c.ns). + Resource("endpoints"). + Body(endpoints). + Do(). + Into(result) + return +} + +// Update takes the representation of a endpoints and updates it. Returns the server's representation of the endpoints, and an error, if there is any. +func (c *endpoints) Update(endpoints *api.Endpoints) (result *api.Endpoints, err error) { + result = &api.Endpoints{} + err = c.client.Put(). + Namespace(c.ns). + Resource("endpoints"). + Name(endpoints.Name). + Body(endpoints). + Do(). + Into(result) + return +} + +// Delete takes name of the endpoints and deletes it. Returns an error if one occurs. +func (c *endpoints) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("endpoints"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *endpoints) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("endpoints"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the endpoints, and returns the corresponding endpoints object, and an error if there is any. +func (c *endpoints) Get(name string) (result *api.Endpoints, err error) { + result = &api.Endpoints{} + err = c.client.Get(). + Namespace(c.ns). + Resource("endpoints"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Endpoints that match those selectors. +func (c *endpoints) List(opts api.ListOptions) (result *api.EndpointsList, err error) { + result = &api.EndpointsList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("endpoints"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested endpoints. +func (c *endpoints) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("endpoints"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event.go new file mode 100644 index 000000000..5627690a6 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event.go @@ -0,0 +1,135 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// EventsGetter has a method to return a EventInterface. +// A group's client should implement this interface. +type EventsGetter interface { + Events(namespace string) EventInterface +} + +// EventInterface has methods to work with Event resources. +type EventInterface interface { + Create(*api.Event) (*api.Event, error) + Update(*api.Event) (*api.Event, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.Event, error) + List(opts api.ListOptions) (*api.EventList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + EventExpansion +} + +// events implements EventInterface +type events struct { + client *CoreClient + ns string +} + +// newEvents returns a Events +func newEvents(c *CoreClient, namespace string) *events { + return &events{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a event and creates it. Returns the server's representation of the event, and an error, if there is any. +func (c *events) Create(event *api.Event) (result *api.Event, err error) { + result = &api.Event{} + err = c.client.Post(). + Namespace(c.ns). + Resource("events"). + Body(event). + Do(). + Into(result) + return +} + +// Update takes the representation of a event and updates it. Returns the server's representation of the event, and an error, if there is any. +func (c *events) Update(event *api.Event) (result *api.Event, err error) { + result = &api.Event{} + err = c.client.Put(). + Namespace(c.ns). + Resource("events"). + Name(event.Name). + Body(event). + Do(). + Into(result) + return +} + +// Delete takes name of the event and deletes it. Returns an error if one occurs. +func (c *events) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("events"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *events) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the event, and returns the corresponding event object, and an error if there is any. +func (c *events) Get(name string) (result *api.Event, err error) { + result = &api.Event{} + err = c.client.Get(). + Namespace(c.ns). + Resource("events"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Events that match those selectors. +func (c *events) List(opts api.ListOptions) (result *api.EventList, err error) { + result = &api.EventList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested events. +func (c *events) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("events"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event_expansion.go new file mode 100644 index 000000000..abdf89aa1 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/event_expansion.go @@ -0,0 +1,157 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "fmt" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/fields" + "k8s.io/kubernetes/pkg/runtime" +) + +// The EventExpansion interface allows manually adding extra methods to the EventInterface. +type EventExpansion interface { + // CreateWithEventNamespace is the same as a Create, except that it sends the request to the event.Namespace. + CreateWithEventNamespace(event *api.Event) (*api.Event, error) + // UpdateWithEventNamespace is the same as a Update, except that it sends the request to the event.Namespace. + UpdateWithEventNamespace(event *api.Event) (*api.Event, error) + Patch(event *api.Event, data []byte) (*api.Event, error) + // Search finds events about the specified object + Search(objOrRef runtime.Object) (*api.EventList, error) + // Returns the appropriate field selector based on the API version being used to communicate with the server. + // The returned field selector can be used with List and Watch to filter desired events. + GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector +} + +// CreateWithEventNamespace makes a new event. Returns the copy of the event the server returns, +// or an error. The namespace to create the event within is deduced from the +// event; it must either match this event client's namespace, or this event +// client must have been created with the "" namespace. +func (e *events) CreateWithEventNamespace(event *api.Event) (*api.Event, error) { + if e.ns != "" && event.Namespace != e.ns { + return nil, fmt.Errorf("can't create an event with namespace '%v' in namespace '%v'", event.Namespace, e.ns) + } + result := &api.Event{} + err := e.client.Post(). + NamespaceIfScoped(event.Namespace, len(event.Namespace) > 0). + Resource("events"). + Body(event). + Do(). + Into(result) + return result, err +} + +// UpdateWithEventNamespace modifies an existing event. It returns the copy of the event that the server returns, +// or an error. The namespace and key to update the event within is deduced from the event. The +// namespace must either match this event client's namespace, or this event client must have been +// created with the "" namespace. Update also requires the ResourceVersion to be set in the event +// object. +func (e *events) UpdateWithEventNamespace(event *api.Event) (*api.Event, error) { + result := &api.Event{} + err := e.client.Put(). + NamespaceIfScoped(event.Namespace, len(event.Namespace) > 0). + Resource("events"). + Name(event.Name). + Body(event). + Do(). + Into(result) + return result, err +} + +// Patch modifies an existing event. It returns the copy of the event that the server returns, or an +// error. The namespace and name of the target event is deduced from the incompleteEvent. The +// namespace must either match this event client's namespace, or this event client must have been +// created with the "" namespace. +func (e *events) Patch(incompleteEvent *api.Event, data []byte) (*api.Event, error) { + result := &api.Event{} + err := e.client.Patch(api.StrategicMergePatchType). + NamespaceIfScoped(incompleteEvent.Namespace, len(incompleteEvent.Namespace) > 0). + Resource("events"). + Name(incompleteEvent.Name). + Body(data). + Do(). + Into(result) + return result, err +} + +// Search finds events about the specified object. The namespace of the +// object must match this event's client namespace unless the event client +// was made with the "" namespace. +func (e *events) Search(objOrRef runtime.Object) (*api.EventList, error) { + ref, err := api.GetReference(objOrRef) + if err != nil { + return nil, err + } + if e.ns != "" && ref.Namespace != e.ns { + return nil, fmt.Errorf("won't be able to find any events of namespace '%v' in namespace '%v'", ref.Namespace, e.ns) + } + stringRefKind := string(ref.Kind) + var refKind *string + if stringRefKind != "" { + refKind = &stringRefKind + } + stringRefUID := string(ref.UID) + var refUID *string + if stringRefUID != "" { + refUID = &stringRefUID + } + fieldSelector := e.GetFieldSelector(&ref.Name, &ref.Namespace, refKind, refUID) + return e.List(api.ListOptions{FieldSelector: fieldSelector}) +} + +// Returns the appropriate field selector based on the API version being used to communicate with the server. +// The returned field selector can be used with List and Watch to filter desired events. +func (e *events) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector { + apiVersion := e.client.APIVersion().String() + field := fields.Set{} + if involvedObjectName != nil { + field[GetInvolvedObjectNameFieldLabel(apiVersion)] = *involvedObjectName + } + if involvedObjectNamespace != nil { + field["involvedObject.namespace"] = *involvedObjectNamespace + } + if involvedObjectKind != nil { + field["involvedObject.kind"] = *involvedObjectKind + } + if involvedObjectUID != nil { + field["involvedObject.uid"] = *involvedObjectUID + } + return field.AsSelector() +} + +// Returns the appropriate field label to use for name of the involved object as per the given API version. +func GetInvolvedObjectNameFieldLabel(version string) string { + return "involvedObject.name" +} + +// TODO: This is a temporary arrangement and will be removed once all clients are moved to use the clientset. +type EventSinkImpl struct { + Interface EventInterface +} + +func (e *EventSinkImpl) Create(event *api.Event) (*api.Event, error) { + return e.Interface.CreateWithEventNamespace(event) +} + +func (e *EventSinkImpl) Update(event *api.Event) (*api.Event, error) { + return e.Interface.UpdateWithEventNamespace(event) +} + +func (e *EventSinkImpl) Patch(event *api.Event, data []byte) (*api.Event, error) { + return e.Interface.Patch(event, data) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/doc.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/doc.go new file mode 100644 index 000000000..dd6d4da71 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_componentstatus.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_componentstatus.go new file mode 100644 index 000000000..478dd9dbf --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_componentstatus.go @@ -0,0 +1,95 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeComponentStatuses implements ComponentStatusInterface +type FakeComponentStatuses struct { + Fake *FakeCore +} + +func (c *FakeComponentStatuses) Create(componentStatus *api.ComponentStatus) (result *api.ComponentStatus, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction("componentstatuses", componentStatus), &api.ComponentStatus{}) + if obj == nil { + return nil, err + } + return obj.(*api.ComponentStatus), err +} + +func (c *FakeComponentStatuses) Update(componentStatus *api.ComponentStatus) (result *api.ComponentStatus, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction("componentstatuses", componentStatus), &api.ComponentStatus{}) + if obj == nil { + return nil, err + } + return obj.(*api.ComponentStatus), err +} + +func (c *FakeComponentStatuses) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction("componentstatuses", name), &api.ComponentStatus{}) + return err +} + +func (c *FakeComponentStatuses) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewRootDeleteCollectionAction("componentstatuses", listOptions) + + _, err := c.Fake.Invokes(action, &api.ComponentStatusList{}) + return err +} + +func (c *FakeComponentStatuses) Get(name string) (result *api.ComponentStatus, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction("componentstatuses", name), &api.ComponentStatus{}) + if obj == nil { + return nil, err + } + return obj.(*api.ComponentStatus), err +} + +func (c *FakeComponentStatuses) List(opts api.ListOptions) (result *api.ComponentStatusList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction("componentstatuses", opts), &api.ComponentStatusList{}) + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.ComponentStatusList{} + for _, item := range obj.(*api.ComponentStatusList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested componentStatuses. +func (c *FakeComponentStatuses) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction("componentstatuses", opts)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_configmap.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_configmap.go new file mode 100644 index 000000000..34fa0b229 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_configmap.go @@ -0,0 +1,102 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeConfigMaps implements ConfigMapInterface +type FakeConfigMaps struct { + Fake *FakeCore + ns string +} + +func (c *FakeConfigMaps) Create(configMap *api.ConfigMap) (result *api.ConfigMap, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("configmaps", c.ns, configMap), &api.ConfigMap{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ConfigMap), err +} + +func (c *FakeConfigMaps) Update(configMap *api.ConfigMap) (result *api.ConfigMap, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("configmaps", c.ns, configMap), &api.ConfigMap{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ConfigMap), err +} + +func (c *FakeConfigMaps) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("configmaps", c.ns, name), &api.ConfigMap{}) + + return err +} + +func (c *FakeConfigMaps) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("configmaps", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.ConfigMapList{}) + return err +} + +func (c *FakeConfigMaps) Get(name string) (result *api.ConfigMap, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("configmaps", c.ns, name), &api.ConfigMap{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ConfigMap), err +} + +func (c *FakeConfigMaps) List(opts api.ListOptions) (result *api.ConfigMapList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("configmaps", c.ns, opts), &api.ConfigMapList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.ConfigMapList{} + for _, item := range obj.(*api.ConfigMapList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested configMaps. +func (c *FakeConfigMaps) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("configmaps", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_core_client.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_core_client.go new file mode 100644 index 000000000..afc6cf6f9 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_core_client.go @@ -0,0 +1,90 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + core "k8s.io/kubernetes/pkg/client/testing/core" + unversioned "k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned" +) + +type FakeCore struct { + *core.Fake +} + +func (c *FakeCore) ComponentStatuses() unversioned.ComponentStatusInterface { + return &FakeComponentStatuses{c} +} + +func (c *FakeCore) ConfigMaps(namespace string) unversioned.ConfigMapInterface { + return &FakeConfigMaps{c, namespace} +} + +func (c *FakeCore) Endpoints(namespace string) unversioned.EndpointsInterface { + return &FakeEndpoints{c, namespace} +} + +func (c *FakeCore) Events(namespace string) unversioned.EventInterface { + return &FakeEvents{c, namespace} +} + +func (c *FakeCore) LimitRanges(namespace string) unversioned.LimitRangeInterface { + return &FakeLimitRanges{c, namespace} +} + +func (c *FakeCore) Namespaces() unversioned.NamespaceInterface { + return &FakeNamespaces{c} +} + +func (c *FakeCore) Nodes() unversioned.NodeInterface { + return &FakeNodes{c} +} + +func (c *FakeCore) PersistentVolumes() unversioned.PersistentVolumeInterface { + return &FakePersistentVolumes{c} +} + +func (c *FakeCore) PersistentVolumeClaims(namespace string) unversioned.PersistentVolumeClaimInterface { + return &FakePersistentVolumeClaims{c, namespace} +} + +func (c *FakeCore) Pods(namespace string) unversioned.PodInterface { + return &FakePods{c, namespace} +} + +func (c *FakeCore) PodTemplates(namespace string) unversioned.PodTemplateInterface { + return &FakePodTemplates{c, namespace} +} + +func (c *FakeCore) ReplicationControllers(namespace string) unversioned.ReplicationControllerInterface { + return &FakeReplicationControllers{c, namespace} +} + +func (c *FakeCore) ResourceQuotas(namespace string) unversioned.ResourceQuotaInterface { + return &FakeResourceQuotas{c, namespace} +} + +func (c *FakeCore) Secrets(namespace string) unversioned.SecretInterface { + return &FakeSecrets{c, namespace} +} + +func (c *FakeCore) Services(namespace string) unversioned.ServiceInterface { + return &FakeServices{c, namespace} +} + +func (c *FakeCore) ServiceAccounts(namespace string) unversioned.ServiceAccountInterface { + return &FakeServiceAccounts{c, namespace} +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_endpoints.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_endpoints.go new file mode 100644 index 000000000..cc25b6e06 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_endpoints.go @@ -0,0 +1,102 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeEndpoints implements EndpointsInterface +type FakeEndpoints struct { + Fake *FakeCore + ns string +} + +func (c *FakeEndpoints) Create(endpoints *api.Endpoints) (result *api.Endpoints, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("endpoints", c.ns, endpoints), &api.Endpoints{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Endpoints), err +} + +func (c *FakeEndpoints) Update(endpoints *api.Endpoints) (result *api.Endpoints, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("endpoints", c.ns, endpoints), &api.Endpoints{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Endpoints), err +} + +func (c *FakeEndpoints) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("endpoints", c.ns, name), &api.Endpoints{}) + + return err +} + +func (c *FakeEndpoints) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("endpoints", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.EndpointsList{}) + return err +} + +func (c *FakeEndpoints) Get(name string) (result *api.Endpoints, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("endpoints", c.ns, name), &api.Endpoints{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Endpoints), err +} + +func (c *FakeEndpoints) List(opts api.ListOptions) (result *api.EndpointsList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("endpoints", c.ns, opts), &api.EndpointsList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.EndpointsList{} + for _, item := range obj.(*api.EndpointsList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested endpoints. +func (c *FakeEndpoints) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("endpoints", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_event.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_event.go new file mode 100644 index 000000000..a9f88153b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_event.go @@ -0,0 +1,102 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeEvents implements EventInterface +type FakeEvents struct { + Fake *FakeCore + ns string +} + +func (c *FakeEvents) Create(event *api.Event) (result *api.Event, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("events", c.ns, event), &api.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Event), err +} + +func (c *FakeEvents) Update(event *api.Event) (result *api.Event, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("events", c.ns, event), &api.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Event), err +} + +func (c *FakeEvents) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("events", c.ns, name), &api.Event{}) + + return err +} + +func (c *FakeEvents) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("events", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.EventList{}) + return err +} + +func (c *FakeEvents) Get(name string) (result *api.Event, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("events", c.ns, name), &api.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Event), err +} + +func (c *FakeEvents) List(opts api.ListOptions) (result *api.EventList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("events", c.ns, opts), &api.EventList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.EventList{} + for _, item := range obj.(*api.EventList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested events. +func (c *FakeEvents) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("events", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_event_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_event_expansion.go new file mode 100644 index 000000000..bc514d505 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_event_expansion.go @@ -0,0 +1,88 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/fields" + "k8s.io/kubernetes/pkg/runtime" +) + +func (c *FakeEvents) CreateWithEventNamespace(event *api.Event) (*api.Event, error) { + action := core.NewRootCreateAction("events", event) + if c.ns != "" { + action = core.NewCreateAction("events", c.ns, event) + } + obj, err := c.Fake.Invokes(action, event) + if obj == nil { + return nil, err + } + + return obj.(*api.Event), err +} + +// Update replaces an existing event. Returns the copy of the event the server returns, or an error. +func (c *FakeEvents) UpdateWithEventNamespace(event *api.Event) (*api.Event, error) { + action := core.NewRootUpdateAction("events", event) + if c.ns != "" { + action = core.NewUpdateAction("events", c.ns, event) + } + obj, err := c.Fake.Invokes(action, event) + if obj == nil { + return nil, err + } + + return obj.(*api.Event), err +} + +// Patch patches an existing event. Returns the copy of the event the server returns, or an error. +func (c *FakeEvents) Patch(event *api.Event, data []byte) (*api.Event, error) { + action := core.NewRootPatchAction("events", event) + if c.ns != "" { + action = core.NewPatchAction("events", c.ns, event) + } + obj, err := c.Fake.Invokes(action, event) + if obj == nil { + return nil, err + } + + return obj.(*api.Event), err +} + +// Search returns a list of events matching the specified object. +func (c *FakeEvents) Search(objOrRef runtime.Object) (*api.EventList, error) { + action := core.NewRootListAction("events", api.ListOptions{}) + if c.ns != "" { + action = core.NewListAction("events", c.ns, api.ListOptions{}) + } + obj, err := c.Fake.Invokes(action, &api.EventList{}) + if obj == nil { + return nil, err + } + + return obj.(*api.EventList), err +} + +func (c *FakeEvents) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector { + action := core.GenericActionImpl{} + action.Verb = "get-field-selector" + action.Resource = "events" + + c.Fake.Invokes(action, nil) + return fields.Everything() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_limitrange.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_limitrange.go new file mode 100644 index 000000000..cab44ce4e --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_limitrange.go @@ -0,0 +1,102 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeLimitRanges implements LimitRangeInterface +type FakeLimitRanges struct { + Fake *FakeCore + ns string +} + +func (c *FakeLimitRanges) Create(limitRange *api.LimitRange) (result *api.LimitRange, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("limitranges", c.ns, limitRange), &api.LimitRange{}) + + if obj == nil { + return nil, err + } + return obj.(*api.LimitRange), err +} + +func (c *FakeLimitRanges) Update(limitRange *api.LimitRange) (result *api.LimitRange, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("limitranges", c.ns, limitRange), &api.LimitRange{}) + + if obj == nil { + return nil, err + } + return obj.(*api.LimitRange), err +} + +func (c *FakeLimitRanges) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("limitranges", c.ns, name), &api.LimitRange{}) + + return err +} + +func (c *FakeLimitRanges) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("limitranges", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.LimitRangeList{}) + return err +} + +func (c *FakeLimitRanges) Get(name string) (result *api.LimitRange, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("limitranges", c.ns, name), &api.LimitRange{}) + + if obj == nil { + return nil, err + } + return obj.(*api.LimitRange), err +} + +func (c *FakeLimitRanges) List(opts api.ListOptions) (result *api.LimitRangeList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("limitranges", c.ns, opts), &api.LimitRangeList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.LimitRangeList{} + for _, item := range obj.(*api.LimitRangeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested limitRanges. +func (c *FakeLimitRanges) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("limitranges", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_namespace.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_namespace.go new file mode 100644 index 000000000..78933814f --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_namespace.go @@ -0,0 +1,104 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeNamespaces implements NamespaceInterface +type FakeNamespaces struct { + Fake *FakeCore +} + +func (c *FakeNamespaces) Create(namespace *api.Namespace) (result *api.Namespace, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction("namespaces", namespace), &api.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*api.Namespace), err +} + +func (c *FakeNamespaces) Update(namespace *api.Namespace) (result *api.Namespace, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction("namespaces", namespace), &api.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*api.Namespace), err +} + +func (c *FakeNamespaces) UpdateStatus(namespace *api.Namespace) (*api.Namespace, error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateSubresourceAction("namespaces", "status", namespace), &api.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*api.Namespace), err +} + +func (c *FakeNamespaces) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction("namespaces", name), &api.Namespace{}) + return err +} + +func (c *FakeNamespaces) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewRootDeleteCollectionAction("namespaces", listOptions) + + _, err := c.Fake.Invokes(action, &api.NamespaceList{}) + return err +} + +func (c *FakeNamespaces) Get(name string) (result *api.Namespace, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction("namespaces", name), &api.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*api.Namespace), err +} + +func (c *FakeNamespaces) List(opts api.ListOptions) (result *api.NamespaceList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction("namespaces", opts), &api.NamespaceList{}) + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.NamespaceList{} + for _, item := range obj.(*api.NamespaceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested namespaces. +func (c *FakeNamespaces) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction("namespaces", opts)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_namespace_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_namespace_expansion.go new file mode 100644 index 000000000..8bb49ff2b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_namespace_expansion.go @@ -0,0 +1,37 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/client/testing/core" +) + +func (c *FakeNamespaces) Finalize(namespace *api.Namespace) (*api.Namespace, error) { + action := core.CreateActionImpl{} + action.Verb = "create" + action.Resource = "namespaces" + action.Subresource = "finalize" + action.Object = namespace + + obj, err := c.Fake.Invokes(action, namespace) + if obj == nil { + return nil, err + } + + return obj.(*api.Namespace), err +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_node.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_node.go new file mode 100644 index 000000000..8761c8772 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_node.go @@ -0,0 +1,104 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeNodes implements NodeInterface +type FakeNodes struct { + Fake *FakeCore +} + +func (c *FakeNodes) Create(node *api.Node) (result *api.Node, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction("nodes", node), &api.Node{}) + if obj == nil { + return nil, err + } + return obj.(*api.Node), err +} + +func (c *FakeNodes) Update(node *api.Node) (result *api.Node, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction("nodes", node), &api.Node{}) + if obj == nil { + return nil, err + } + return obj.(*api.Node), err +} + +func (c *FakeNodes) UpdateStatus(node *api.Node) (*api.Node, error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateSubresourceAction("nodes", "status", node), &api.Node{}) + if obj == nil { + return nil, err + } + return obj.(*api.Node), err +} + +func (c *FakeNodes) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction("nodes", name), &api.Node{}) + return err +} + +func (c *FakeNodes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewRootDeleteCollectionAction("nodes", listOptions) + + _, err := c.Fake.Invokes(action, &api.NodeList{}) + return err +} + +func (c *FakeNodes) Get(name string) (result *api.Node, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction("nodes", name), &api.Node{}) + if obj == nil { + return nil, err + } + return obj.(*api.Node), err +} + +func (c *FakeNodes) List(opts api.ListOptions) (result *api.NodeList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction("nodes", opts), &api.NodeList{}) + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.NodeList{} + for _, item := range obj.(*api.NodeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested nodes. +func (c *FakeNodes) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction("nodes", opts)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_persistentvolume.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_persistentvolume.go new file mode 100644 index 000000000..d3d8c79f5 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_persistentvolume.go @@ -0,0 +1,104 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakePersistentVolumes implements PersistentVolumeInterface +type FakePersistentVolumes struct { + Fake *FakeCore +} + +func (c *FakePersistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction("persistentvolumes", persistentVolume), &api.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*api.PersistentVolume), err +} + +func (c *FakePersistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction("persistentvolumes", persistentVolume), &api.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*api.PersistentVolume), err +} + +func (c *FakePersistentVolumes) UpdateStatus(persistentVolume *api.PersistentVolume) (*api.PersistentVolume, error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateSubresourceAction("persistentvolumes", "status", persistentVolume), &api.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*api.PersistentVolume), err +} + +func (c *FakePersistentVolumes) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction("persistentvolumes", name), &api.PersistentVolume{}) + return err +} + +func (c *FakePersistentVolumes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewRootDeleteCollectionAction("persistentvolumes", listOptions) + + _, err := c.Fake.Invokes(action, &api.PersistentVolumeList{}) + return err +} + +func (c *FakePersistentVolumes) Get(name string) (result *api.PersistentVolume, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction("persistentvolumes", name), &api.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*api.PersistentVolume), err +} + +func (c *FakePersistentVolumes) List(opts api.ListOptions) (result *api.PersistentVolumeList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction("persistentvolumes", opts), &api.PersistentVolumeList{}) + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.PersistentVolumeList{} + for _, item := range obj.(*api.PersistentVolumeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested persistentVolumes. +func (c *FakePersistentVolumes) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction("persistentvolumes", opts)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_persistentvolumeclaim.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_persistentvolumeclaim.go new file mode 100644 index 000000000..ba674f269 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_persistentvolumeclaim.go @@ -0,0 +1,112 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakePersistentVolumeClaims implements PersistentVolumeClaimInterface +type FakePersistentVolumeClaims struct { + Fake *FakeCore + ns string +} + +func (c *FakePersistentVolumeClaims) Create(persistentVolumeClaim *api.PersistentVolumeClaim) (result *api.PersistentVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("persistentvolumeclaims", c.ns, persistentVolumeClaim), &api.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*api.PersistentVolumeClaim), err +} + +func (c *FakePersistentVolumeClaims) Update(persistentVolumeClaim *api.PersistentVolumeClaim) (result *api.PersistentVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("persistentvolumeclaims", c.ns, persistentVolumeClaim), &api.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*api.PersistentVolumeClaim), err +} + +func (c *FakePersistentVolumeClaims) UpdateStatus(persistentVolumeClaim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("persistentvolumeclaims", "status", c.ns, persistentVolumeClaim), &api.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*api.PersistentVolumeClaim), err +} + +func (c *FakePersistentVolumeClaims) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("persistentvolumeclaims", c.ns, name), &api.PersistentVolumeClaim{}) + + return err +} + +func (c *FakePersistentVolumeClaims) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("persistentvolumeclaims", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.PersistentVolumeClaimList{}) + return err +} + +func (c *FakePersistentVolumeClaims) Get(name string) (result *api.PersistentVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("persistentvolumeclaims", c.ns, name), &api.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*api.PersistentVolumeClaim), err +} + +func (c *FakePersistentVolumeClaims) List(opts api.ListOptions) (result *api.PersistentVolumeClaimList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("persistentvolumeclaims", c.ns, opts), &api.PersistentVolumeClaimList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.PersistentVolumeClaimList{} + for _, item := range obj.(*api.PersistentVolumeClaimList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested persistentVolumeClaims. +func (c *FakePersistentVolumeClaims) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("persistentvolumeclaims", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_pod.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_pod.go new file mode 100644 index 000000000..6488c021d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_pod.go @@ -0,0 +1,112 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakePods implements PodInterface +type FakePods struct { + Fake *FakeCore + ns string +} + +func (c *FakePods) Create(pod *api.Pod) (result *api.Pod, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("pods", c.ns, pod), &api.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Pod), err +} + +func (c *FakePods) Update(pod *api.Pod) (result *api.Pod, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("pods", c.ns, pod), &api.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Pod), err +} + +func (c *FakePods) UpdateStatus(pod *api.Pod) (*api.Pod, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("pods", "status", c.ns, pod), &api.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Pod), err +} + +func (c *FakePods) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("pods", c.ns, name), &api.Pod{}) + + return err +} + +func (c *FakePods) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("pods", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.PodList{}) + return err +} + +func (c *FakePods) Get(name string) (result *api.Pod, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("pods", c.ns, name), &api.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Pod), err +} + +func (c *FakePods) List(opts api.ListOptions) (result *api.PodList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("pods", c.ns, opts), &api.PodList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.PodList{} + for _, item := range obj.(*api.PodList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested pods. +func (c *FakePods) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("pods", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_pod_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_pod_expansion.go new file mode 100644 index 000000000..034ecf2b2 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_pod_expansion.go @@ -0,0 +1,46 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/client/testing/core" + client "k8s.io/kubernetes/pkg/client/unversioned" +) + +func (c *FakePods) Bind(binding *api.Binding) error { + action := core.CreateActionImpl{} + action.Verb = "create" + action.Resource = "pods" + action.Subresource = "bindings" + action.Object = binding + + _, err := c.Fake.Invokes(action, binding) + return err +} + +func (c *FakePods) GetLogs(name string, opts *api.PodLogOptions) *client.Request { + action := core.GenericActionImpl{} + action.Verb = "get" + action.Namespace = c.ns + action.Resource = "pod" + action.Subresource = "logs" + action.Value = opts + + _, _ = c.Fake.Invokes(action, &api.Pod{}) + return &client.Request{} +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_podtemplate.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_podtemplate.go new file mode 100644 index 000000000..b900a113c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_podtemplate.go @@ -0,0 +1,102 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakePodTemplates implements PodTemplateInterface +type FakePodTemplates struct { + Fake *FakeCore + ns string +} + +func (c *FakePodTemplates) Create(podTemplate *api.PodTemplate) (result *api.PodTemplate, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("podtemplates", c.ns, podTemplate), &api.PodTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*api.PodTemplate), err +} + +func (c *FakePodTemplates) Update(podTemplate *api.PodTemplate) (result *api.PodTemplate, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("podtemplates", c.ns, podTemplate), &api.PodTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*api.PodTemplate), err +} + +func (c *FakePodTemplates) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("podtemplates", c.ns, name), &api.PodTemplate{}) + + return err +} + +func (c *FakePodTemplates) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("podtemplates", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.PodTemplateList{}) + return err +} + +func (c *FakePodTemplates) Get(name string) (result *api.PodTemplate, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("podtemplates", c.ns, name), &api.PodTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*api.PodTemplate), err +} + +func (c *FakePodTemplates) List(opts api.ListOptions) (result *api.PodTemplateList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("podtemplates", c.ns, opts), &api.PodTemplateList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.PodTemplateList{} + for _, item := range obj.(*api.PodTemplateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested podTemplates. +func (c *FakePodTemplates) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("podtemplates", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_replicationcontroller.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_replicationcontroller.go new file mode 100644 index 000000000..205f09456 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_replicationcontroller.go @@ -0,0 +1,112 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeReplicationControllers implements ReplicationControllerInterface +type FakeReplicationControllers struct { + Fake *FakeCore + ns string +} + +func (c *FakeReplicationControllers) Create(replicationController *api.ReplicationController) (result *api.ReplicationController, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("replicationcontrollers", c.ns, replicationController), &api.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ReplicationController), err +} + +func (c *FakeReplicationControllers) Update(replicationController *api.ReplicationController) (result *api.ReplicationController, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("replicationcontrollers", c.ns, replicationController), &api.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ReplicationController), err +} + +func (c *FakeReplicationControllers) UpdateStatus(replicationController *api.ReplicationController) (*api.ReplicationController, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("replicationcontrollers", "status", c.ns, replicationController), &api.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ReplicationController), err +} + +func (c *FakeReplicationControllers) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("replicationcontrollers", c.ns, name), &api.ReplicationController{}) + + return err +} + +func (c *FakeReplicationControllers) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("replicationcontrollers", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.ReplicationControllerList{}) + return err +} + +func (c *FakeReplicationControllers) Get(name string) (result *api.ReplicationController, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("replicationcontrollers", c.ns, name), &api.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ReplicationController), err +} + +func (c *FakeReplicationControllers) List(opts api.ListOptions) (result *api.ReplicationControllerList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("replicationcontrollers", c.ns, opts), &api.ReplicationControllerList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.ReplicationControllerList{} + for _, item := range obj.(*api.ReplicationControllerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested replicationControllers. +func (c *FakeReplicationControllers) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("replicationcontrollers", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_resourcequota.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_resourcequota.go new file mode 100644 index 000000000..056e61ed5 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_resourcequota.go @@ -0,0 +1,112 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeResourceQuotas implements ResourceQuotaInterface +type FakeResourceQuotas struct { + Fake *FakeCore + ns string +} + +func (c *FakeResourceQuotas) Create(resourceQuota *api.ResourceQuota) (result *api.ResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("resourcequotas", c.ns, resourceQuota), &api.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ResourceQuota), err +} + +func (c *FakeResourceQuotas) Update(resourceQuota *api.ResourceQuota) (result *api.ResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("resourcequotas", c.ns, resourceQuota), &api.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ResourceQuota), err +} + +func (c *FakeResourceQuotas) UpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("resourcequotas", "status", c.ns, resourceQuota), &api.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ResourceQuota), err +} + +func (c *FakeResourceQuotas) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("resourcequotas", c.ns, name), &api.ResourceQuota{}) + + return err +} + +func (c *FakeResourceQuotas) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("resourcequotas", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.ResourceQuotaList{}) + return err +} + +func (c *FakeResourceQuotas) Get(name string) (result *api.ResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("resourcequotas", c.ns, name), &api.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ResourceQuota), err +} + +func (c *FakeResourceQuotas) List(opts api.ListOptions) (result *api.ResourceQuotaList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("resourcequotas", c.ns, opts), &api.ResourceQuotaList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.ResourceQuotaList{} + for _, item := range obj.(*api.ResourceQuotaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested resourceQuotas. +func (c *FakeResourceQuotas) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("resourcequotas", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_secret.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_secret.go new file mode 100644 index 000000000..2f09be6e5 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_secret.go @@ -0,0 +1,102 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeSecrets implements SecretInterface +type FakeSecrets struct { + Fake *FakeCore + ns string +} + +func (c *FakeSecrets) Create(secret *api.Secret) (result *api.Secret, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("secrets", c.ns, secret), &api.Secret{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Secret), err +} + +func (c *FakeSecrets) Update(secret *api.Secret) (result *api.Secret, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("secrets", c.ns, secret), &api.Secret{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Secret), err +} + +func (c *FakeSecrets) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("secrets", c.ns, name), &api.Secret{}) + + return err +} + +func (c *FakeSecrets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("secrets", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.SecretList{}) + return err +} + +func (c *FakeSecrets) Get(name string) (result *api.Secret, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("secrets", c.ns, name), &api.Secret{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Secret), err +} + +func (c *FakeSecrets) List(opts api.ListOptions) (result *api.SecretList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("secrets", c.ns, opts), &api.SecretList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.SecretList{} + for _, item := range obj.(*api.SecretList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested secrets. +func (c *FakeSecrets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("secrets", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_service.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_service.go new file mode 100644 index 000000000..2cf38901c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_service.go @@ -0,0 +1,112 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeServices implements ServiceInterface +type FakeServices struct { + Fake *FakeCore + ns string +} + +func (c *FakeServices) Create(service *api.Service) (result *api.Service, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("services", c.ns, service), &api.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Service), err +} + +func (c *FakeServices) Update(service *api.Service) (result *api.Service, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("services", c.ns, service), &api.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Service), err +} + +func (c *FakeServices) UpdateStatus(service *api.Service) (*api.Service, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("services", "status", c.ns, service), &api.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Service), err +} + +func (c *FakeServices) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("services", c.ns, name), &api.Service{}) + + return err +} + +func (c *FakeServices) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("services", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.ServiceList{}) + return err +} + +func (c *FakeServices) Get(name string) (result *api.Service, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("services", c.ns, name), &api.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Service), err +} + +func (c *FakeServices) List(opts api.ListOptions) (result *api.ServiceList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("services", c.ns, opts), &api.ServiceList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.ServiceList{} + for _, item := range obj.(*api.ServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested services. +func (c *FakeServices) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("services", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_service_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_service_expansion.go new file mode 100644 index 000000000..7d72d1dfe --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_service_expansion.go @@ -0,0 +1,26 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + "k8s.io/kubernetes/pkg/client/testing/core" + client "k8s.io/kubernetes/pkg/client/unversioned" +) + +func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) client.ResponseWrapper { + return c.Fake.InvokesProxy(core.NewProxyGetAction("services", c.ns, scheme, name, port, path, params)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_serviceaccount.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_serviceaccount.go new file mode 100644 index 000000000..61d7a04f5 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/fake/fake_serviceaccount.go @@ -0,0 +1,102 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeServiceAccounts implements ServiceAccountInterface +type FakeServiceAccounts struct { + Fake *FakeCore + ns string +} + +func (c *FakeServiceAccounts) Create(serviceAccount *api.ServiceAccount) (result *api.ServiceAccount, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("serviceaccounts", c.ns, serviceAccount), &api.ServiceAccount{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ServiceAccount), err +} + +func (c *FakeServiceAccounts) Update(serviceAccount *api.ServiceAccount) (result *api.ServiceAccount, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("serviceaccounts", c.ns, serviceAccount), &api.ServiceAccount{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ServiceAccount), err +} + +func (c *FakeServiceAccounts) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("serviceaccounts", c.ns, name), &api.ServiceAccount{}) + + return err +} + +func (c *FakeServiceAccounts) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("serviceaccounts", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.ServiceAccountList{}) + return err +} + +func (c *FakeServiceAccounts) Get(name string) (result *api.ServiceAccount, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("serviceaccounts", c.ns, name), &api.ServiceAccount{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ServiceAccount), err +} + +func (c *FakeServiceAccounts) List(opts api.ListOptions) (result *api.ServiceAccountList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("serviceaccounts", c.ns, opts), &api.ServiceAccountList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &api.ServiceAccountList{} + for _, item := range obj.(*api.ServiceAccountList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested serviceAccounts. +func (c *FakeServiceAccounts) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("serviceaccounts", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/generated_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/generated_expansion.go new file mode 100644 index 000000000..eeb51962e --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/generated_expansion.go @@ -0,0 +1,41 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +type ComponentStatusExpansion interface{} + +type EndpointsExpansion interface{} + +type LimitRangeExpansion interface{} + +type NodeExpansion interface{} + +type PersistentVolumeExpansion interface{} + +type PersistentVolumeClaimExpansion interface{} + +type PodTemplateExpansion interface{} + +type ReplicationControllerExpansion interface{} + +type ResourceQuotaExpansion interface{} + +type SecretExpansion interface{} + +type ServiceAccountExpansion interface{} + +type ConfigMapExpansion interface{} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/limitrange.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/limitrange.go new file mode 100644 index 000000000..86cc9b07f --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/limitrange.go @@ -0,0 +1,135 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// LimitRangesGetter has a method to return a LimitRangeInterface. +// A group's client should implement this interface. +type LimitRangesGetter interface { + LimitRanges(namespace string) LimitRangeInterface +} + +// LimitRangeInterface has methods to work with LimitRange resources. +type LimitRangeInterface interface { + Create(*api.LimitRange) (*api.LimitRange, error) + Update(*api.LimitRange) (*api.LimitRange, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.LimitRange, error) + List(opts api.ListOptions) (*api.LimitRangeList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + LimitRangeExpansion +} + +// limitRanges implements LimitRangeInterface +type limitRanges struct { + client *CoreClient + ns string +} + +// newLimitRanges returns a LimitRanges +func newLimitRanges(c *CoreClient, namespace string) *limitRanges { + return &limitRanges{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a limitRange and creates it. Returns the server's representation of the limitRange, and an error, if there is any. +func (c *limitRanges) Create(limitRange *api.LimitRange) (result *api.LimitRange, err error) { + result = &api.LimitRange{} + err = c.client.Post(). + Namespace(c.ns). + Resource("limitranges"). + Body(limitRange). + Do(). + Into(result) + return +} + +// Update takes the representation of a limitRange and updates it. Returns the server's representation of the limitRange, and an error, if there is any. +func (c *limitRanges) Update(limitRange *api.LimitRange) (result *api.LimitRange, err error) { + result = &api.LimitRange{} + err = c.client.Put(). + Namespace(c.ns). + Resource("limitranges"). + Name(limitRange.Name). + Body(limitRange). + Do(). + Into(result) + return +} + +// Delete takes name of the limitRange and deletes it. Returns an error if one occurs. +func (c *limitRanges) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("limitranges"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *limitRanges) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("limitranges"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the limitRange, and returns the corresponding limitRange object, and an error if there is any. +func (c *limitRanges) Get(name string) (result *api.LimitRange, err error) { + result = &api.LimitRange{} + err = c.client.Get(). + Namespace(c.ns). + Resource("limitranges"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of LimitRanges that match those selectors. +func (c *limitRanges) List(opts api.ListOptions) (result *api.LimitRangeList, err error) { + result = &api.LimitRangeList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("limitranges"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested limitRanges. +func (c *limitRanges) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("limitranges"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/namespace.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/namespace.go new file mode 100644 index 000000000..c1c8b4506 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/namespace.go @@ -0,0 +1,139 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// NamespacesGetter has a method to return a NamespaceInterface. +// A group's client should implement this interface. +type NamespacesGetter interface { + Namespaces() NamespaceInterface +} + +// NamespaceInterface has methods to work with Namespace resources. +type NamespaceInterface interface { + Create(*api.Namespace) (*api.Namespace, error) + Update(*api.Namespace) (*api.Namespace, error) + UpdateStatus(*api.Namespace) (*api.Namespace, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.Namespace, error) + List(opts api.ListOptions) (*api.NamespaceList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + NamespaceExpansion +} + +// namespaces implements NamespaceInterface +type namespaces struct { + client *CoreClient +} + +// newNamespaces returns a Namespaces +func newNamespaces(c *CoreClient) *namespaces { + return &namespaces{ + client: c, + } +} + +// Create takes the representation of a namespace and creates it. Returns the server's representation of the namespace, and an error, if there is any. +func (c *namespaces) Create(namespace *api.Namespace) (result *api.Namespace, err error) { + result = &api.Namespace{} + err = c.client.Post(). + Resource("namespaces"). + Body(namespace). + Do(). + Into(result) + return +} + +// Update takes the representation of a namespace and updates it. Returns the server's representation of the namespace, and an error, if there is any. +func (c *namespaces) Update(namespace *api.Namespace) (result *api.Namespace, err error) { + result = &api.Namespace{} + err = c.client.Put(). + Resource("namespaces"). + Name(namespace.Name). + Body(namespace). + Do(). + Into(result) + return +} + +func (c *namespaces) UpdateStatus(namespace *api.Namespace) (result *api.Namespace, err error) { + result = &api.Namespace{} + err = c.client.Put(). + Resource("namespaces"). + Name(namespace.Name). + SubResource("status"). + Body(namespace). + Do(). + Into(result) + return +} + +// Delete takes name of the namespace and deletes it. Returns an error if one occurs. +func (c *namespaces) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Resource("namespaces"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *namespaces) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Resource("namespaces"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any. +func (c *namespaces) Get(name string) (result *api.Namespace, err error) { + result = &api.Namespace{} + err = c.client.Get(). + Resource("namespaces"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Namespaces that match those selectors. +func (c *namespaces) List(opts api.ListOptions) (result *api.NamespaceList, err error) { + result = &api.NamespaceList{} + err = c.client.Get(). + Resource("namespaces"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested namespaces. +func (c *namespaces) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("namespaces"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/namespace_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/namespace_expansion.go new file mode 100644 index 000000000..8f47aec48 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/namespace_expansion.go @@ -0,0 +1,31 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import "k8s.io/kubernetes/pkg/api" + +// The NamespaceExpansion interface allows manually adding extra methods to the NamespaceInterface. +type NamespaceExpansion interface { + Finalize(item *api.Namespace) (*api.Namespace, error) +} + +// Finalize takes the representation of a namespace to update. Returns the server's representation of the namespace, and an error, if it occurs. +func (c *namespaces) Finalize(namespace *api.Namespace) (result *api.Namespace, err error) { + result = &api.Namespace{} + err = c.client.Put().Resource("namespaces").Name(namespace.Name).SubResource("finalize").Body(namespace).Do().Into(result) + return +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/node.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/node.go new file mode 100644 index 000000000..b0c53ef1d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/node.go @@ -0,0 +1,139 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// NodesGetter has a method to return a NodeInterface. +// A group's client should implement this interface. +type NodesGetter interface { + Nodes() NodeInterface +} + +// NodeInterface has methods to work with Node resources. +type NodeInterface interface { + Create(*api.Node) (*api.Node, error) + Update(*api.Node) (*api.Node, error) + UpdateStatus(*api.Node) (*api.Node, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.Node, error) + List(opts api.ListOptions) (*api.NodeList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + NodeExpansion +} + +// nodes implements NodeInterface +type nodes struct { + client *CoreClient +} + +// newNodes returns a Nodes +func newNodes(c *CoreClient) *nodes { + return &nodes{ + client: c, + } +} + +// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any. +func (c *nodes) Create(node *api.Node) (result *api.Node, err error) { + result = &api.Node{} + err = c.client.Post(). + Resource("nodes"). + Body(node). + Do(). + Into(result) + return +} + +// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any. +func (c *nodes) Update(node *api.Node) (result *api.Node, err error) { + result = &api.Node{} + err = c.client.Put(). + Resource("nodes"). + Name(node.Name). + Body(node). + Do(). + Into(result) + return +} + +func (c *nodes) UpdateStatus(node *api.Node) (result *api.Node, err error) { + result = &api.Node{} + err = c.client.Put(). + Resource("nodes"). + Name(node.Name). + SubResource("status"). + Body(node). + Do(). + Into(result) + return +} + +// Delete takes name of the node and deletes it. Returns an error if one occurs. +func (c *nodes) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Resource("nodes"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *nodes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Resource("nodes"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the node, and returns the corresponding node object, and an error if there is any. +func (c *nodes) Get(name string) (result *api.Node, err error) { + result = &api.Node{} + err = c.client.Get(). + Resource("nodes"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Nodes that match those selectors. +func (c *nodes) List(opts api.ListOptions) (result *api.NodeList, err error) { + result = &api.NodeList{} + err = c.client.Get(). + Resource("nodes"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested nodes. +func (c *nodes) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("nodes"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/persistentvolume.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/persistentvolume.go new file mode 100644 index 000000000..6b4d0f017 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/persistentvolume.go @@ -0,0 +1,139 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// PersistentVolumesGetter has a method to return a PersistentVolumeInterface. +// A group's client should implement this interface. +type PersistentVolumesGetter interface { + PersistentVolumes() PersistentVolumeInterface +} + +// PersistentVolumeInterface has methods to work with PersistentVolume resources. +type PersistentVolumeInterface interface { + Create(*api.PersistentVolume) (*api.PersistentVolume, error) + Update(*api.PersistentVolume) (*api.PersistentVolume, error) + UpdateStatus(*api.PersistentVolume) (*api.PersistentVolume, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.PersistentVolume, error) + List(opts api.ListOptions) (*api.PersistentVolumeList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + PersistentVolumeExpansion +} + +// persistentVolumes implements PersistentVolumeInterface +type persistentVolumes struct { + client *CoreClient +} + +// newPersistentVolumes returns a PersistentVolumes +func newPersistentVolumes(c *CoreClient) *persistentVolumes { + return &persistentVolumes{ + client: c, + } +} + +// Create takes the representation of a persistentVolume and creates it. Returns the server's representation of the persistentVolume, and an error, if there is any. +func (c *persistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) { + result = &api.PersistentVolume{} + err = c.client.Post(). + Resource("persistentvolumes"). + Body(persistentVolume). + Do(). + Into(result) + return +} + +// Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any. +func (c *persistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) { + result = &api.PersistentVolume{} + err = c.client.Put(). + Resource("persistentvolumes"). + Name(persistentVolume.Name). + Body(persistentVolume). + Do(). + Into(result) + return +} + +func (c *persistentVolumes) UpdateStatus(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) { + result = &api.PersistentVolume{} + err = c.client.Put(). + Resource("persistentvolumes"). + Name(persistentVolume.Name). + SubResource("status"). + Body(persistentVolume). + Do(). + Into(result) + return +} + +// Delete takes name of the persistentVolume and deletes it. Returns an error if one occurs. +func (c *persistentVolumes) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Resource("persistentvolumes"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *persistentVolumes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Resource("persistentvolumes"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the persistentVolume, and returns the corresponding persistentVolume object, and an error if there is any. +func (c *persistentVolumes) Get(name string) (result *api.PersistentVolume, err error) { + result = &api.PersistentVolume{} + err = c.client.Get(). + Resource("persistentvolumes"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PersistentVolumes that match those selectors. +func (c *persistentVolumes) List(opts api.ListOptions) (result *api.PersistentVolumeList, err error) { + result = &api.PersistentVolumeList{} + err = c.client.Get(). + Resource("persistentvolumes"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested persistentVolumes. +func (c *persistentVolumes) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("persistentvolumes"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/persistentvolumeclaim.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/persistentvolumeclaim.go new file mode 100644 index 000000000..2f5b17437 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/persistentvolumeclaim.go @@ -0,0 +1,149 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// PersistentVolumeClaimsGetter has a method to return a PersistentVolumeClaimInterface. +// A group's client should implement this interface. +type PersistentVolumeClaimsGetter interface { + PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface +} + +// PersistentVolumeClaimInterface has methods to work with PersistentVolumeClaim resources. +type PersistentVolumeClaimInterface interface { + Create(*api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) + Update(*api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) + UpdateStatus(*api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.PersistentVolumeClaim, error) + List(opts api.ListOptions) (*api.PersistentVolumeClaimList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + PersistentVolumeClaimExpansion +} + +// persistentVolumeClaims implements PersistentVolumeClaimInterface +type persistentVolumeClaims struct { + client *CoreClient + ns string +} + +// newPersistentVolumeClaims returns a PersistentVolumeClaims +func newPersistentVolumeClaims(c *CoreClient, namespace string) *persistentVolumeClaims { + return &persistentVolumeClaims{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a persistentVolumeClaim and creates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any. +func (c *persistentVolumeClaims) Create(persistentVolumeClaim *api.PersistentVolumeClaim) (result *api.PersistentVolumeClaim, err error) { + result = &api.PersistentVolumeClaim{} + err = c.client.Post(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Body(persistentVolumeClaim). + Do(). + Into(result) + return +} + +// Update takes the representation of a persistentVolumeClaim and updates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any. +func (c *persistentVolumeClaims) Update(persistentVolumeClaim *api.PersistentVolumeClaim) (result *api.PersistentVolumeClaim, err error) { + result = &api.PersistentVolumeClaim{} + err = c.client.Put(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(persistentVolumeClaim.Name). + Body(persistentVolumeClaim). + Do(). + Into(result) + return +} + +func (c *persistentVolumeClaims) UpdateStatus(persistentVolumeClaim *api.PersistentVolumeClaim) (result *api.PersistentVolumeClaim, err error) { + result = &api.PersistentVolumeClaim{} + err = c.client.Put(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(persistentVolumeClaim.Name). + SubResource("status"). + Body(persistentVolumeClaim). + Do(). + Into(result) + return +} + +// Delete takes name of the persistentVolumeClaim and deletes it. Returns an error if one occurs. +func (c *persistentVolumeClaims) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *persistentVolumeClaims) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the persistentVolumeClaim, and returns the corresponding persistentVolumeClaim object, and an error if there is any. +func (c *persistentVolumeClaims) Get(name string) (result *api.PersistentVolumeClaim, err error) { + result = &api.PersistentVolumeClaim{} + err = c.client.Get(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PersistentVolumeClaims that match those selectors. +func (c *persistentVolumeClaims) List(opts api.ListOptions) (result *api.PersistentVolumeClaimList, err error) { + result = &api.PersistentVolumeClaimList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested persistentVolumeClaims. +func (c *persistentVolumeClaims) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/pod.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/pod.go new file mode 100644 index 000000000..1cdfc8e71 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/pod.go @@ -0,0 +1,149 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// PodsGetter has a method to return a PodInterface. +// A group's client should implement this interface. +type PodsGetter interface { + Pods(namespace string) PodInterface +} + +// PodInterface has methods to work with Pod resources. +type PodInterface interface { + Create(*api.Pod) (*api.Pod, error) + Update(*api.Pod) (*api.Pod, error) + UpdateStatus(*api.Pod) (*api.Pod, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.Pod, error) + List(opts api.ListOptions) (*api.PodList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + PodExpansion +} + +// pods implements PodInterface +type pods struct { + client *CoreClient + ns string +} + +// newPods returns a Pods +func newPods(c *CoreClient, namespace string) *pods { + return &pods{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a pod and creates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *pods) Create(pod *api.Pod) (result *api.Pod, err error) { + result = &api.Pod{} + err = c.client.Post(). + Namespace(c.ns). + Resource("pods"). + Body(pod). + Do(). + Into(result) + return +} + +// Update takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *pods) Update(pod *api.Pod) (result *api.Pod, err error) { + result = &api.Pod{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pods"). + Name(pod.Name). + Body(pod). + Do(). + Into(result) + return +} + +func (c *pods) UpdateStatus(pod *api.Pod) (result *api.Pod, err error) { + result = &api.Pod{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pods"). + Name(pod.Name). + SubResource("status"). + Body(pod). + Do(). + Into(result) + return +} + +// Delete takes name of the pod and deletes it. Returns an error if one occurs. +func (c *pods) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pods"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *pods) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pods"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the pod, and returns the corresponding pod object, and an error if there is any. +func (c *pods) Get(name string) (result *api.Pod, err error) { + result = &api.Pod{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pods"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Pods that match those selectors. +func (c *pods) List(opts api.ListOptions) (result *api.PodList, err error) { + result = &api.PodList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pods"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested pods. +func (c *pods) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("pods"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/pod_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/pod_expansion.go new file mode 100644 index 000000000..0a46431d5 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/pod_expansion.go @@ -0,0 +1,38 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/client/unversioned" +) + +// The PodExpansion interface allows manually adding extra methods to the PodInterface. +type PodExpansion interface { + Bind(binding *api.Binding) error + GetLogs(name string, opts *api.PodLogOptions) *unversioned.Request +} + +// Bind applies the provided binding to the named pod in the current namespace (binding.Namespace is ignored). +func (c *pods) Bind(binding *api.Binding) error { + return c.client.Post().Namespace(c.ns).Resource("pods").Name(binding.Name).SubResource("binding").Body(binding).Do().Error() +} + +// Get constructs a request for getting the logs for a pod +func (c *pods) GetLogs(name string, opts *api.PodLogOptions) *unversioned.Request { + return c.client.Get().Namespace(c.ns).Name(name).Resource("pods").SubResource("log").VersionedParams(opts, api.ParameterCodec) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/podtemplate.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/podtemplate.go new file mode 100644 index 000000000..cccef29f7 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/podtemplate.go @@ -0,0 +1,135 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// PodTemplatesGetter has a method to return a PodTemplateInterface. +// A group's client should implement this interface. +type PodTemplatesGetter interface { + PodTemplates(namespace string) PodTemplateInterface +} + +// PodTemplateInterface has methods to work with PodTemplate resources. +type PodTemplateInterface interface { + Create(*api.PodTemplate) (*api.PodTemplate, error) + Update(*api.PodTemplate) (*api.PodTemplate, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.PodTemplate, error) + List(opts api.ListOptions) (*api.PodTemplateList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + PodTemplateExpansion +} + +// podTemplates implements PodTemplateInterface +type podTemplates struct { + client *CoreClient + ns string +} + +// newPodTemplates returns a PodTemplates +func newPodTemplates(c *CoreClient, namespace string) *podTemplates { + return &podTemplates{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a podTemplate and creates it. Returns the server's representation of the podTemplate, and an error, if there is any. +func (c *podTemplates) Create(podTemplate *api.PodTemplate) (result *api.PodTemplate, err error) { + result = &api.PodTemplate{} + err = c.client.Post(). + Namespace(c.ns). + Resource("podtemplates"). + Body(podTemplate). + Do(). + Into(result) + return +} + +// Update takes the representation of a podTemplate and updates it. Returns the server's representation of the podTemplate, and an error, if there is any. +func (c *podTemplates) Update(podTemplate *api.PodTemplate) (result *api.PodTemplate, err error) { + result = &api.PodTemplate{} + err = c.client.Put(). + Namespace(c.ns). + Resource("podtemplates"). + Name(podTemplate.Name). + Body(podTemplate). + Do(). + Into(result) + return +} + +// Delete takes name of the podTemplate and deletes it. Returns an error if one occurs. +func (c *podTemplates) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("podtemplates"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *podTemplates) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("podtemplates"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the podTemplate, and returns the corresponding podTemplate object, and an error if there is any. +func (c *podTemplates) Get(name string) (result *api.PodTemplate, err error) { + result = &api.PodTemplate{} + err = c.client.Get(). + Namespace(c.ns). + Resource("podtemplates"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PodTemplates that match those selectors. +func (c *podTemplates) List(opts api.ListOptions) (result *api.PodTemplateList, err error) { + result = &api.PodTemplateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("podtemplates"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested podTemplates. +func (c *podTemplates) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("podtemplates"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/replicationcontroller.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/replicationcontroller.go new file mode 100644 index 000000000..6f9f06625 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/replicationcontroller.go @@ -0,0 +1,149 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ReplicationControllersGetter has a method to return a ReplicationControllerInterface. +// A group's client should implement this interface. +type ReplicationControllersGetter interface { + ReplicationControllers(namespace string) ReplicationControllerInterface +} + +// ReplicationControllerInterface has methods to work with ReplicationController resources. +type ReplicationControllerInterface interface { + Create(*api.ReplicationController) (*api.ReplicationController, error) + Update(*api.ReplicationController) (*api.ReplicationController, error) + UpdateStatus(*api.ReplicationController) (*api.ReplicationController, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.ReplicationController, error) + List(opts api.ListOptions) (*api.ReplicationControllerList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + ReplicationControllerExpansion +} + +// replicationControllers implements ReplicationControllerInterface +type replicationControllers struct { + client *CoreClient + ns string +} + +// newReplicationControllers returns a ReplicationControllers +func newReplicationControllers(c *CoreClient, namespace string) *replicationControllers { + return &replicationControllers{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a replicationController and creates it. Returns the server's representation of the replicationController, and an error, if there is any. +func (c *replicationControllers) Create(replicationController *api.ReplicationController) (result *api.ReplicationController, err error) { + result = &api.ReplicationController{} + err = c.client.Post(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Body(replicationController). + Do(). + Into(result) + return +} + +// Update takes the representation of a replicationController and updates it. Returns the server's representation of the replicationController, and an error, if there is any. +func (c *replicationControllers) Update(replicationController *api.ReplicationController) (result *api.ReplicationController, err error) { + result = &api.ReplicationController{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(replicationController.Name). + Body(replicationController). + Do(). + Into(result) + return +} + +func (c *replicationControllers) UpdateStatus(replicationController *api.ReplicationController) (result *api.ReplicationController, err error) { + result = &api.ReplicationController{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(replicationController.Name). + SubResource("status"). + Body(replicationController). + Do(). + Into(result) + return +} + +// Delete takes name of the replicationController and deletes it. Returns an error if one occurs. +func (c *replicationControllers) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *replicationControllers) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("replicationcontrollers"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the replicationController, and returns the corresponding replicationController object, and an error if there is any. +func (c *replicationControllers) Get(name string) (result *api.ReplicationController, err error) { + result = &api.ReplicationController{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ReplicationControllers that match those selectors. +func (c *replicationControllers) List(opts api.ListOptions) (result *api.ReplicationControllerList, err error) { + result = &api.ReplicationControllerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicationcontrollers"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested replicationControllers. +func (c *replicationControllers) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("replicationcontrollers"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/resourcequota.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/resourcequota.go new file mode 100644 index 000000000..2d0da73fb --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/resourcequota.go @@ -0,0 +1,149 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ResourceQuotasGetter has a method to return a ResourceQuotaInterface. +// A group's client should implement this interface. +type ResourceQuotasGetter interface { + ResourceQuotas(namespace string) ResourceQuotaInterface +} + +// ResourceQuotaInterface has methods to work with ResourceQuota resources. +type ResourceQuotaInterface interface { + Create(*api.ResourceQuota) (*api.ResourceQuota, error) + Update(*api.ResourceQuota) (*api.ResourceQuota, error) + UpdateStatus(*api.ResourceQuota) (*api.ResourceQuota, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.ResourceQuota, error) + List(opts api.ListOptions) (*api.ResourceQuotaList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + ResourceQuotaExpansion +} + +// resourceQuotas implements ResourceQuotaInterface +type resourceQuotas struct { + client *CoreClient + ns string +} + +// newResourceQuotas returns a ResourceQuotas +func newResourceQuotas(c *CoreClient, namespace string) *resourceQuotas { + return &resourceQuotas{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a resourceQuota and creates it. Returns the server's representation of the resourceQuota, and an error, if there is any. +func (c *resourceQuotas) Create(resourceQuota *api.ResourceQuota) (result *api.ResourceQuota, err error) { + result = &api.ResourceQuota{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourcequotas"). + Body(resourceQuota). + Do(). + Into(result) + return +} + +// Update takes the representation of a resourceQuota and updates it. Returns the server's representation of the resourceQuota, and an error, if there is any. +func (c *resourceQuotas) Update(resourceQuota *api.ResourceQuota) (result *api.ResourceQuota, err error) { + result = &api.ResourceQuota{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourcequotas"). + Name(resourceQuota.Name). + Body(resourceQuota). + Do(). + Into(result) + return +} + +func (c *resourceQuotas) UpdateStatus(resourceQuota *api.ResourceQuota) (result *api.ResourceQuota, err error) { + result = &api.ResourceQuota{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourcequotas"). + Name(resourceQuota.Name). + SubResource("status"). + Body(resourceQuota). + Do(). + Into(result) + return +} + +// Delete takes name of the resourceQuota and deletes it. Returns an error if one occurs. +func (c *resourceQuotas) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourcequotas"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceQuotas) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourcequotas"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the resourceQuota, and returns the corresponding resourceQuota object, and an error if there is any. +func (c *resourceQuotas) Get(name string) (result *api.ResourceQuota, err error) { + result = &api.ResourceQuota{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourcequotas"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceQuotas that match those selectors. +func (c *resourceQuotas) List(opts api.ListOptions) (result *api.ResourceQuotaList, err error) { + result = &api.ResourceQuotaList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourcequotas"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceQuotas. +func (c *resourceQuotas) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("resourcequotas"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/secret.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/secret.go new file mode 100644 index 000000000..101fbdb54 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/secret.go @@ -0,0 +1,135 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// SecretsGetter has a method to return a SecretInterface. +// A group's client should implement this interface. +type SecretsGetter interface { + Secrets(namespace string) SecretInterface +} + +// SecretInterface has methods to work with Secret resources. +type SecretInterface interface { + Create(*api.Secret) (*api.Secret, error) + Update(*api.Secret) (*api.Secret, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.Secret, error) + List(opts api.ListOptions) (*api.SecretList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + SecretExpansion +} + +// secrets implements SecretInterface +type secrets struct { + client *CoreClient + ns string +} + +// newSecrets returns a Secrets +func newSecrets(c *CoreClient, namespace string) *secrets { + return &secrets{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a secret and creates it. Returns the server's representation of the secret, and an error, if there is any. +func (c *secrets) Create(secret *api.Secret) (result *api.Secret, err error) { + result = &api.Secret{} + err = c.client.Post(). + Namespace(c.ns). + Resource("secrets"). + Body(secret). + Do(). + Into(result) + return +} + +// Update takes the representation of a secret and updates it. Returns the server's representation of the secret, and an error, if there is any. +func (c *secrets) Update(secret *api.Secret) (result *api.Secret, err error) { + result = &api.Secret{} + err = c.client.Put(). + Namespace(c.ns). + Resource("secrets"). + Name(secret.Name). + Body(secret). + Do(). + Into(result) + return +} + +// Delete takes name of the secret and deletes it. Returns an error if one occurs. +func (c *secrets) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("secrets"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *secrets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("secrets"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the secret, and returns the corresponding secret object, and an error if there is any. +func (c *secrets) Get(name string) (result *api.Secret, err error) { + result = &api.Secret{} + err = c.client.Get(). + Namespace(c.ns). + Resource("secrets"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Secrets that match those selectors. +func (c *secrets) List(opts api.ListOptions) (result *api.SecretList, err error) { + result = &api.SecretList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("secrets"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested secrets. +func (c *secrets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("secrets"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/service.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/service.go new file mode 100644 index 000000000..006f601c2 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/service.go @@ -0,0 +1,149 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ServicesGetter has a method to return a ServiceInterface. +// A group's client should implement this interface. +type ServicesGetter interface { + Services(namespace string) ServiceInterface +} + +// ServiceInterface has methods to work with Service resources. +type ServiceInterface interface { + Create(*api.Service) (*api.Service, error) + Update(*api.Service) (*api.Service, error) + UpdateStatus(*api.Service) (*api.Service, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.Service, error) + List(opts api.ListOptions) (*api.ServiceList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + ServiceExpansion +} + +// services implements ServiceInterface +type services struct { + client *CoreClient + ns string +} + +// newServices returns a Services +func newServices(c *CoreClient, namespace string) *services { + return &services{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any. +func (c *services) Create(service *api.Service) (result *api.Service, err error) { + result = &api.Service{} + err = c.client.Post(). + Namespace(c.ns). + Resource("services"). + Body(service). + Do(). + Into(result) + return +} + +// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any. +func (c *services) Update(service *api.Service) (result *api.Service, err error) { + result = &api.Service{} + err = c.client.Put(). + Namespace(c.ns). + Resource("services"). + Name(service.Name). + Body(service). + Do(). + Into(result) + return +} + +func (c *services) UpdateStatus(service *api.Service) (result *api.Service, err error) { + result = &api.Service{} + err = c.client.Put(). + Namespace(c.ns). + Resource("services"). + Name(service.Name). + SubResource("status"). + Body(service). + Do(). + Into(result) + return +} + +// Delete takes name of the service and deletes it. Returns an error if one occurs. +func (c *services) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("services"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *services) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("services"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the service, and returns the corresponding service object, and an error if there is any. +func (c *services) Get(name string) (result *api.Service, err error) { + result = &api.Service{} + err = c.client.Get(). + Namespace(c.ns). + Resource("services"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Services that match those selectors. +func (c *services) List(opts api.ListOptions) (result *api.ServiceList, err error) { + result = &api.ServiceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("services"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested services. +func (c *services) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("services"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/service_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/service_expansion.go new file mode 100644 index 000000000..b9fb6af86 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/service_expansion.go @@ -0,0 +1,41 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/util/net" +) + +// The ServiceExpansion interface allows manually adding extra methods to the ServiceInterface. +type ServiceExpansion interface { + ProxyGet(scheme, name, port, path string, params map[string]string) unversioned.ResponseWrapper +} + +// ProxyGet returns a response of the service by calling it through the proxy. +func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) unversioned.ResponseWrapper { + request := c.client.Get(). + Prefix("proxy"). + Namespace(c.ns). + Resource("services"). + Name(net.JoinSchemeNamePort(scheme, name, port)). + Suffix(path) + for k, v := range params { + request = request.Param(k, v) + } + return request +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/serviceaccount.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/serviceaccount.go new file mode 100644 index 000000000..65f7df263 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned/serviceaccount.go @@ -0,0 +1,135 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ServiceAccountsGetter has a method to return a ServiceAccountInterface. +// A group's client should implement this interface. +type ServiceAccountsGetter interface { + ServiceAccounts(namespace string) ServiceAccountInterface +} + +// ServiceAccountInterface has methods to work with ServiceAccount resources. +type ServiceAccountInterface interface { + Create(*api.ServiceAccount) (*api.ServiceAccount, error) + Update(*api.ServiceAccount) (*api.ServiceAccount, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*api.ServiceAccount, error) + List(opts api.ListOptions) (*api.ServiceAccountList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + ServiceAccountExpansion +} + +// serviceAccounts implements ServiceAccountInterface +type serviceAccounts struct { + client *CoreClient + ns string +} + +// newServiceAccounts returns a ServiceAccounts +func newServiceAccounts(c *CoreClient, namespace string) *serviceAccounts { + return &serviceAccounts{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a serviceAccount and creates it. Returns the server's representation of the serviceAccount, and an error, if there is any. +func (c *serviceAccounts) Create(serviceAccount *api.ServiceAccount) (result *api.ServiceAccount, err error) { + result = &api.ServiceAccount{} + err = c.client.Post(). + Namespace(c.ns). + Resource("serviceaccounts"). + Body(serviceAccount). + Do(). + Into(result) + return +} + +// Update takes the representation of a serviceAccount and updates it. Returns the server's representation of the serviceAccount, and an error, if there is any. +func (c *serviceAccounts) Update(serviceAccount *api.ServiceAccount) (result *api.ServiceAccount, err error) { + result = &api.ServiceAccount{} + err = c.client.Put(). + Namespace(c.ns). + Resource("serviceaccounts"). + Name(serviceAccount.Name). + Body(serviceAccount). + Do(). + Into(result) + return +} + +// Delete takes name of the serviceAccount and deletes it. Returns an error if one occurs. +func (c *serviceAccounts) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("serviceaccounts"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *serviceAccounts) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("serviceaccounts"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the serviceAccount, and returns the corresponding serviceAccount object, and an error if there is any. +func (c *serviceAccounts) Get(name string) (result *api.ServiceAccount, err error) { + result = &api.ServiceAccount{} + err = c.client.Get(). + Namespace(c.ns). + Resource("serviceaccounts"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ServiceAccounts that match those selectors. +func (c *serviceAccounts) List(opts api.ListOptions) (result *api.ServiceAccountList, err error) { + result = &api.ServiceAccountList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("serviceaccounts"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested serviceAccounts. +func (c *serviceAccounts) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("serviceaccounts"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/daemonset.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/daemonset.go new file mode 100644 index 000000000..96dae5835 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/daemonset.go @@ -0,0 +1,150 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + watch "k8s.io/kubernetes/pkg/watch" +) + +// DaemonSetsGetter has a method to return a DaemonSetInterface. +// A group's client should implement this interface. +type DaemonSetsGetter interface { + DaemonSets(namespace string) DaemonSetInterface +} + +// DaemonSetInterface has methods to work with DaemonSet resources. +type DaemonSetInterface interface { + Create(*extensions.DaemonSet) (*extensions.DaemonSet, error) + Update(*extensions.DaemonSet) (*extensions.DaemonSet, error) + UpdateStatus(*extensions.DaemonSet) (*extensions.DaemonSet, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*extensions.DaemonSet, error) + List(opts api.ListOptions) (*extensions.DaemonSetList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + DaemonSetExpansion +} + +// daemonSets implements DaemonSetInterface +type daemonSets struct { + client *ExtensionsClient + ns string +} + +// newDaemonSets returns a DaemonSets +func newDaemonSets(c *ExtensionsClient, namespace string) *daemonSets { + return &daemonSets{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any. +func (c *daemonSets) Create(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) { + result = &extensions.DaemonSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("daemonsets"). + Body(daemonSet). + Do(). + Into(result) + return +} + +// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any. +func (c *daemonSets) Update(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) { + result = &extensions.DaemonSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("daemonsets"). + Name(daemonSet.Name). + Body(daemonSet). + Do(). + Into(result) + return +} + +func (c *daemonSets) UpdateStatus(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) { + result = &extensions.DaemonSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("daemonsets"). + Name(daemonSet.Name). + SubResource("status"). + Body(daemonSet). + Do(). + Into(result) + return +} + +// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs. +func (c *daemonSets) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("daemonsets"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *daemonSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("daemonsets"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any. +func (c *daemonSets) Get(name string) (result *extensions.DaemonSet, err error) { + result = &extensions.DaemonSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("daemonsets"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of DaemonSets that match those selectors. +func (c *daemonSets) List(opts api.ListOptions) (result *extensions.DaemonSetList, err error) { + result = &extensions.DaemonSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("daemonsets"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested daemonSets. +func (c *daemonSets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("daemonsets"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/deployment.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/deployment.go new file mode 100644 index 000000000..3b995c021 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/deployment.go @@ -0,0 +1,150 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + watch "k8s.io/kubernetes/pkg/watch" +) + +// DeploymentsGetter has a method to return a DeploymentInterface. +// A group's client should implement this interface. +type DeploymentsGetter interface { + Deployments(namespace string) DeploymentInterface +} + +// DeploymentInterface has methods to work with Deployment resources. +type DeploymentInterface interface { + Create(*extensions.Deployment) (*extensions.Deployment, error) + Update(*extensions.Deployment) (*extensions.Deployment, error) + UpdateStatus(*extensions.Deployment) (*extensions.Deployment, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*extensions.Deployment, error) + List(opts api.ListOptions) (*extensions.DeploymentList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + DeploymentExpansion +} + +// deployments implements DeploymentInterface +type deployments struct { + client *ExtensionsClient + ns string +} + +// newDeployments returns a Deployments +func newDeployments(c *ExtensionsClient, namespace string) *deployments { + return &deployments{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any. +func (c *deployments) Create(deployment *extensions.Deployment) (result *extensions.Deployment, err error) { + result = &extensions.Deployment{} + err = c.client.Post(). + Namespace(c.ns). + Resource("deployments"). + Body(deployment). + Do(). + Into(result) + return +} + +// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any. +func (c *deployments) Update(deployment *extensions.Deployment) (result *extensions.Deployment, err error) { + result = &extensions.Deployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deployments"). + Name(deployment.Name). + Body(deployment). + Do(). + Into(result) + return +} + +func (c *deployments) UpdateStatus(deployment *extensions.Deployment) (result *extensions.Deployment, err error) { + result = &extensions.Deployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deployments"). + Name(deployment.Name). + SubResource("status"). + Body(deployment). + Do(). + Into(result) + return +} + +// Delete takes name of the deployment and deletes it. Returns an error if one occurs. +func (c *deployments) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("deployments"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *deployments) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("deployments"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any. +func (c *deployments) Get(name string) (result *extensions.Deployment, err error) { + result = &extensions.Deployment{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deployments"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Deployments that match those selectors. +func (c *deployments) List(opts api.ListOptions) (result *extensions.DeploymentList, err error) { + result = &extensions.DeploymentList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deployments"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested deployments. +func (c *deployments) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("deployments"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/deployment_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/deployment_expansion.go new file mode 100644 index 000000000..9969aecc9 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/deployment_expansion.go @@ -0,0 +1,29 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import "k8s.io/kubernetes/pkg/apis/extensions" + +// The DeploymentExpansion interface allows manually adding extra methods to the DeploymentInterface. +type DeploymentExpansion interface { + Rollback(*extensions.DeploymentRollback) error +} + +// Rollback applied the provided DeploymentRollback to the named deployment in the current namespace. +func (c *deployments) Rollback(deploymentRollback *extensions.DeploymentRollback) error { + return c.client.Post().Namespace(c.ns).Resource("deployments").Name(deploymentRollback.Name).SubResource("rollback").Body(deploymentRollback).Do().Error() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/doc.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/doc.go new file mode 100644 index 000000000..930017040 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package unversioned has the automatically generated clients for unversioned resources. +package unversioned diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/extensions_client.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/extensions_client.go new file mode 100644 index 000000000..6780a5c03 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/extensions_client.go @@ -0,0 +1,125 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + unversioned "k8s.io/kubernetes/pkg/client/unversioned" +) + +type ExtensionsInterface interface { + DaemonSetsGetter + DeploymentsGetter + HorizontalPodAutoscalersGetter + IngressesGetter + JobsGetter + ReplicaSetsGetter + ScalesGetter + ThirdPartyResourcesGetter +} + +// ExtensionsClient is used to interact with features provided by the Extensions group. +type ExtensionsClient struct { + *unversioned.RESTClient +} + +func (c *ExtensionsClient) DaemonSets(namespace string) DaemonSetInterface { + return newDaemonSets(c, namespace) +} + +func (c *ExtensionsClient) Deployments(namespace string) DeploymentInterface { + return newDeployments(c, namespace) +} + +func (c *ExtensionsClient) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface { + return newHorizontalPodAutoscalers(c, namespace) +} + +func (c *ExtensionsClient) Ingresses(namespace string) IngressInterface { + return newIngresses(c, namespace) +} + +func (c *ExtensionsClient) Jobs(namespace string) JobInterface { + return newJobs(c, namespace) +} + +func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface { + return newReplicaSets(c, namespace) +} + +func (c *ExtensionsClient) Scales(namespace string) ScaleInterface { + return newScales(c, namespace) +} + +func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface { + return newThirdPartyResources(c, namespace) +} + +// NewForConfig creates a new ExtensionsClient for the given config. +func NewForConfig(c *unversioned.Config) (*ExtensionsClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := unversioned.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ExtensionsClient{client}, nil +} + +// NewForConfigOrDie creates a new ExtensionsClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *unversioned.Config) *ExtensionsClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ExtensionsClient for the given RESTClient. +func New(c *unversioned.RESTClient) *ExtensionsClient { + return &ExtensionsClient{c} +} + +func setConfigDefaults(config *unversioned.Config) error { + // if extensions group is not registered, return an error + g, err := registered.Group("extensions") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = unversioned.DefaultKubernetesUserAgent() + } + // TODO: Unconditionally set the config.Version, until we fix the config. + //if config.Version == "" { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + //} + + config.Codec = api.Codecs.LegacyCodec(*config.GroupVersion) + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/doc.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/doc.go new file mode 100644 index 000000000..dd6d4da71 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_daemonset.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_daemonset.go new file mode 100644 index 000000000..7de9f927f --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_daemonset.go @@ -0,0 +1,113 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeDaemonSets implements DaemonSetInterface +type FakeDaemonSets struct { + Fake *FakeExtensions + ns string +} + +func (c *FakeDaemonSets) Create(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("daemonsets", c.ns, daemonSet), &extensions.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.DaemonSet), err +} + +func (c *FakeDaemonSets) Update(daemonSet *extensions.DaemonSet) (result *extensions.DaemonSet, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("daemonsets", c.ns, daemonSet), &extensions.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.DaemonSet), err +} + +func (c *FakeDaemonSets) UpdateStatus(daemonSet *extensions.DaemonSet) (*extensions.DaemonSet, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("daemonsets", "status", c.ns, daemonSet), &extensions.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.DaemonSet), err +} + +func (c *FakeDaemonSets) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("daemonsets", c.ns, name), &extensions.DaemonSet{}) + + return err +} + +func (c *FakeDaemonSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("daemonsets", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &extensions.DaemonSetList{}) + return err +} + +func (c *FakeDaemonSets) Get(name string) (result *extensions.DaemonSet, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("daemonsets", c.ns, name), &extensions.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.DaemonSet), err +} + +func (c *FakeDaemonSets) List(opts api.ListOptions) (result *extensions.DaemonSetList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("daemonsets", c.ns, opts), &extensions.DaemonSetList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &extensions.DaemonSetList{} + for _, item := range obj.(*extensions.DaemonSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested daemonSets. +func (c *FakeDaemonSets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("daemonsets", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_deployment.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_deployment.go new file mode 100644 index 000000000..748968a9d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_deployment.go @@ -0,0 +1,113 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeDeployments implements DeploymentInterface +type FakeDeployments struct { + Fake *FakeExtensions + ns string +} + +func (c *FakeDeployments) Create(deployment *extensions.Deployment) (result *extensions.Deployment, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("deployments", c.ns, deployment), &extensions.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Deployment), err +} + +func (c *FakeDeployments) Update(deployment *extensions.Deployment) (result *extensions.Deployment, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("deployments", c.ns, deployment), &extensions.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Deployment), err +} + +func (c *FakeDeployments) UpdateStatus(deployment *extensions.Deployment) (*extensions.Deployment, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("deployments", "status", c.ns, deployment), &extensions.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Deployment), err +} + +func (c *FakeDeployments) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("deployments", c.ns, name), &extensions.Deployment{}) + + return err +} + +func (c *FakeDeployments) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("deployments", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &extensions.DeploymentList{}) + return err +} + +func (c *FakeDeployments) Get(name string) (result *extensions.Deployment, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("deployments", c.ns, name), &extensions.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Deployment), err +} + +func (c *FakeDeployments) List(opts api.ListOptions) (result *extensions.DeploymentList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("deployments", c.ns, opts), &extensions.DeploymentList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &extensions.DeploymentList{} + for _, item := range obj.(*extensions.DeploymentList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested deployments. +func (c *FakeDeployments) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("deployments", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_deployment_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_deployment_expansion.go new file mode 100644 index 000000000..3edc64c01 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_deployment_expansion.go @@ -0,0 +1,33 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/client/testing/core" +) + +func (c *FakeDeployments) Rollback(deploymentRollback *extensions.DeploymentRollback) error { + action := core.CreateActionImpl{} + action.Verb = "create" + action.Resource = "deployments" + action.Subresource = "rollback" + action.Object = deploymentRollback + + _, err := c.Fake.Invokes(action, deploymentRollback) + return err +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_extensions_client.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_extensions_client.go new file mode 100644 index 000000000..2f7fb0423 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_extensions_client.go @@ -0,0 +1,58 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + core "k8s.io/kubernetes/pkg/client/testing/core" + unversioned "k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned" +) + +type FakeExtensions struct { + *core.Fake +} + +func (c *FakeExtensions) DaemonSets(namespace string) unversioned.DaemonSetInterface { + return &FakeDaemonSets{c, namespace} +} + +func (c *FakeExtensions) Deployments(namespace string) unversioned.DeploymentInterface { + return &FakeDeployments{c, namespace} +} + +func (c *FakeExtensions) HorizontalPodAutoscalers(namespace string) unversioned.HorizontalPodAutoscalerInterface { + return &FakeHorizontalPodAutoscalers{c, namespace} +} + +func (c *FakeExtensions) Ingresses(namespace string) unversioned.IngressInterface { + return &FakeIngresses{c, namespace} +} + +func (c *FakeExtensions) Jobs(namespace string) unversioned.JobInterface { + return &FakeJobs{c, namespace} +} + +func (c *FakeExtensions) ReplicaSets(namespace string) unversioned.ReplicaSetInterface { + return &FakeReplicaSets{c, namespace} +} + +func (c *FakeExtensions) Scales(namespace string) unversioned.ScaleInterface { + return &FakeScales{c, namespace} +} + +func (c *FakeExtensions) ThirdPartyResources(namespace string) unversioned.ThirdPartyResourceInterface { + return &FakeThirdPartyResources{c, namespace} +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_horizontalpodautoscaler.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_horizontalpodautoscaler.go new file mode 100644 index 000000000..71b5cf322 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_horizontalpodautoscaler.go @@ -0,0 +1,113 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface +type FakeHorizontalPodAutoscalers struct { + Fake *FakeExtensions + ns string +} + +func (c *FakeHorizontalPodAutoscalers) Create(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("horizontalpodautoscalers", c.ns, horizontalPodAutoscaler), &extensions.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.HorizontalPodAutoscaler), err +} + +func (c *FakeHorizontalPodAutoscalers) Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("horizontalpodautoscalers", c.ns, horizontalPodAutoscaler), &extensions.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.HorizontalPodAutoscaler), err +} + +func (c *FakeHorizontalPodAutoscalers) UpdateStatus(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("horizontalpodautoscalers", "status", c.ns, horizontalPodAutoscaler), &extensions.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.HorizontalPodAutoscaler), err +} + +func (c *FakeHorizontalPodAutoscalers) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("horizontalpodautoscalers", c.ns, name), &extensions.HorizontalPodAutoscaler{}) + + return err +} + +func (c *FakeHorizontalPodAutoscalers) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("horizontalpodautoscalers", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &extensions.HorizontalPodAutoscalerList{}) + return err +} + +func (c *FakeHorizontalPodAutoscalers) Get(name string) (result *extensions.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("horizontalpodautoscalers", c.ns, name), &extensions.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.HorizontalPodAutoscaler), err +} + +func (c *FakeHorizontalPodAutoscalers) List(opts api.ListOptions) (result *extensions.HorizontalPodAutoscalerList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("horizontalpodautoscalers", c.ns, opts), &extensions.HorizontalPodAutoscalerList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &extensions.HorizontalPodAutoscalerList{} + for _, item := range obj.(*extensions.HorizontalPodAutoscalerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers. +func (c *FakeHorizontalPodAutoscalers) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("horizontalpodautoscalers", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_ingress.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_ingress.go new file mode 100644 index 000000000..a331644e4 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_ingress.go @@ -0,0 +1,113 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeIngresses implements IngressInterface +type FakeIngresses struct { + Fake *FakeExtensions + ns string +} + +func (c *FakeIngresses) Create(ingress *extensions.Ingress) (result *extensions.Ingress, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("ingresses", c.ns, ingress), &extensions.Ingress{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Ingress), err +} + +func (c *FakeIngresses) Update(ingress *extensions.Ingress) (result *extensions.Ingress, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("ingresses", c.ns, ingress), &extensions.Ingress{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Ingress), err +} + +func (c *FakeIngresses) UpdateStatus(ingress *extensions.Ingress) (*extensions.Ingress, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("ingresses", "status", c.ns, ingress), &extensions.Ingress{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Ingress), err +} + +func (c *FakeIngresses) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("ingresses", c.ns, name), &extensions.Ingress{}) + + return err +} + +func (c *FakeIngresses) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("ingresses", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &extensions.IngressList{}) + return err +} + +func (c *FakeIngresses) Get(name string) (result *extensions.Ingress, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("ingresses", c.ns, name), &extensions.Ingress{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Ingress), err +} + +func (c *FakeIngresses) List(opts api.ListOptions) (result *extensions.IngressList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("ingresses", c.ns, opts), &extensions.IngressList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &extensions.IngressList{} + for _, item := range obj.(*extensions.IngressList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested ingresses. +func (c *FakeIngresses) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("ingresses", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_job.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_job.go new file mode 100644 index 000000000..c1875c006 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_job.go @@ -0,0 +1,113 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeJobs implements JobInterface +type FakeJobs struct { + Fake *FakeExtensions + ns string +} + +func (c *FakeJobs) Create(job *extensions.Job) (result *extensions.Job, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("jobs", c.ns, job), &extensions.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Job), err +} + +func (c *FakeJobs) Update(job *extensions.Job) (result *extensions.Job, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("jobs", c.ns, job), &extensions.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Job), err +} + +func (c *FakeJobs) UpdateStatus(job *extensions.Job) (*extensions.Job, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("jobs", "status", c.ns, job), &extensions.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Job), err +} + +func (c *FakeJobs) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("jobs", c.ns, name), &extensions.Job{}) + + return err +} + +func (c *FakeJobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("jobs", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &extensions.JobList{}) + return err +} + +func (c *FakeJobs) Get(name string) (result *extensions.Job, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("jobs", c.ns, name), &extensions.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.Job), err +} + +func (c *FakeJobs) List(opts api.ListOptions) (result *extensions.JobList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("jobs", c.ns, opts), &extensions.JobList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &extensions.JobList{} + for _, item := range obj.(*extensions.JobList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested jobs. +func (c *FakeJobs) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("jobs", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_replicaset.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_replicaset.go new file mode 100644 index 000000000..d861326b7 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_replicaset.go @@ -0,0 +1,113 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeReplicaSets implements ReplicaSetInterface +type FakeReplicaSets struct { + Fake *FakeExtensions + ns string +} + +func (c *FakeReplicaSets) Create(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("replicasets", c.ns, replicaSet), &extensions.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.ReplicaSet), err +} + +func (c *FakeReplicaSets) Update(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("replicasets", c.ns, replicaSet), &extensions.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.ReplicaSet), err +} + +func (c *FakeReplicaSets) UpdateStatus(replicaSet *extensions.ReplicaSet) (*extensions.ReplicaSet, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction("replicasets", "status", c.ns, replicaSet), &extensions.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.ReplicaSet), err +} + +func (c *FakeReplicaSets) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("replicasets", c.ns, name), &extensions.ReplicaSet{}) + + return err +} + +func (c *FakeReplicaSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("replicasets", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &extensions.ReplicaSetList{}) + return err +} + +func (c *FakeReplicaSets) Get(name string) (result *extensions.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("replicasets", c.ns, name), &extensions.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.ReplicaSet), err +} + +func (c *FakeReplicaSets) List(opts api.ListOptions) (result *extensions.ReplicaSetList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("replicasets", c.ns, opts), &extensions.ReplicaSetList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &extensions.ReplicaSetList{} + for _, item := range obj.(*extensions.ReplicaSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested replicaSets. +func (c *FakeReplicaSets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("replicasets", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_scale.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_scale.go new file mode 100644 index 000000000..d2cfc5f7b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_scale.go @@ -0,0 +1,23 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +// FakeScales implements ScaleInterface +type FakeScales struct { + Fake *FakeExtensions + ns string +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_scale_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_scale_expansion.go new file mode 100644 index 000000000..8c52e409b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_scale_expansion.go @@ -0,0 +1,46 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/client/testing/core" +) + +func (c *FakeScales) Get(kind string, name string) (result *extensions.Scale, err error) { + action := core.GetActionImpl{} + action.Verb = "get" + action.Namespace = c.ns + action.Resource = kind + action.Subresource = "scale" + action.Name = name + obj, err := c.Fake.Invokes(action, &extensions.Scale{}) + result = obj.(*extensions.Scale) + return +} + +func (c *FakeScales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) { + action := core.UpdateActionImpl{} + action.Verb = "update" + action.Namespace = c.ns + action.Resource = kind + action.Subresource = "scale" + action.Object = scale + obj, err := c.Fake.Invokes(action, scale) + result = obj.(*extensions.Scale) + return +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_thirdpartyresource.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_thirdpartyresource.go new file mode 100644 index 000000000..9a005d570 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/fake/fake_thirdpartyresource.go @@ -0,0 +1,103 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeThirdPartyResources implements ThirdPartyResourceInterface +type FakeThirdPartyResources struct { + Fake *FakeExtensions + ns string +} + +func (c *FakeThirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction("thirdpartyresources", c.ns, thirdPartyResource), &extensions.ThirdPartyResource{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.ThirdPartyResource), err +} + +func (c *FakeThirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction("thirdpartyresources", c.ns, thirdPartyResource), &extensions.ThirdPartyResource{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.ThirdPartyResource), err +} + +func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction("thirdpartyresources", c.ns, name), &extensions.ThirdPartyResource{}) + + return err +} + +func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := core.NewDeleteCollectionAction("thirdpartyresources", c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &extensions.ThirdPartyResourceList{}) + return err +} + +func (c *FakeThirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction("thirdpartyresources", c.ns, name), &extensions.ThirdPartyResource{}) + + if obj == nil { + return nil, err + } + return obj.(*extensions.ThirdPartyResource), err +} + +func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction("thirdpartyresources", c.ns, opts), &extensions.ThirdPartyResourceList{}) + + if obj == nil { + return nil, err + } + + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } + list := &extensions.ThirdPartyResourceList{} + for _, item := range obj.(*extensions.ThirdPartyResourceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested thirdPartyResources. +func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction("thirdpartyresources", c.ns, opts)) + +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/generated_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/generated_expansion.go new file mode 100644 index 000000000..0690e0c8c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/generated_expansion.go @@ -0,0 +1,29 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +type DaemonSetExpansion interface{} + +type HorizontalPodAutoscalerExpansion interface{} + +type IngressExpansion interface{} + +type JobExpansion interface{} + +type ThirdPartyResourceExpansion interface{} + +type ReplicaSetExpansion interface{} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/horizontalpodautoscaler.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/horizontalpodautoscaler.go new file mode 100644 index 000000000..2cffcee46 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/horizontalpodautoscaler.go @@ -0,0 +1,150 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + watch "k8s.io/kubernetes/pkg/watch" +) + +// HorizontalPodAutoscalersGetter has a method to return a HorizontalPodAutoscalerInterface. +// A group's client should implement this interface. +type HorizontalPodAutoscalersGetter interface { + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface +} + +// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources. +type HorizontalPodAutoscalerInterface interface { + Create(*extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) + Update(*extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) + UpdateStatus(*extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*extensions.HorizontalPodAutoscaler, error) + List(opts api.ListOptions) (*extensions.HorizontalPodAutoscalerList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + HorizontalPodAutoscalerExpansion +} + +// horizontalPodAutoscalers implements HorizontalPodAutoscalerInterface +type horizontalPodAutoscalers struct { + client *ExtensionsClient + ns string +} + +// newHorizontalPodAutoscalers returns a HorizontalPodAutoscalers +func newHorizontalPodAutoscalers(c *ExtensionsClient, namespace string) *horizontalPodAutoscalers { + return &horizontalPodAutoscalers{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *horizontalPodAutoscalers) Create(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) { + result = &extensions.HorizontalPodAutoscaler{} + err = c.client.Post(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Body(horizontalPodAutoscaler). + Do(). + Into(result) + return +} + +// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *horizontalPodAutoscalers) Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) { + result = &extensions.HorizontalPodAutoscaler{} + err = c.client.Put(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(horizontalPodAutoscaler.Name). + Body(horizontalPodAutoscaler). + Do(). + Into(result) + return +} + +func (c *horizontalPodAutoscalers) UpdateStatus(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (result *extensions.HorizontalPodAutoscaler, err error) { + result = &extensions.HorizontalPodAutoscaler{} + err = c.client.Put(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(horizontalPodAutoscaler.Name). + SubResource("status"). + Body(horizontalPodAutoscaler). + Do(). + Into(result) + return +} + +// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs. +func (c *horizontalPodAutoscalers) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *horizontalPodAutoscalers) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any. +func (c *horizontalPodAutoscalers) Get(name string) (result *extensions.HorizontalPodAutoscaler, err error) { + result = &extensions.HorizontalPodAutoscaler{} + err = c.client.Get(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors. +func (c *horizontalPodAutoscalers) List(opts api.ListOptions) (result *extensions.HorizontalPodAutoscalerList, err error) { + result = &extensions.HorizontalPodAutoscalerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers. +func (c *horizontalPodAutoscalers) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/ingress.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/ingress.go new file mode 100644 index 000000000..a9d950eae --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/ingress.go @@ -0,0 +1,150 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + watch "k8s.io/kubernetes/pkg/watch" +) + +// IngressesGetter has a method to return a IngressInterface. +// A group's client should implement this interface. +type IngressesGetter interface { + Ingresses(namespace string) IngressInterface +} + +// IngressInterface has methods to work with Ingress resources. +type IngressInterface interface { + Create(*extensions.Ingress) (*extensions.Ingress, error) + Update(*extensions.Ingress) (*extensions.Ingress, error) + UpdateStatus(*extensions.Ingress) (*extensions.Ingress, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*extensions.Ingress, error) + List(opts api.ListOptions) (*extensions.IngressList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + IngressExpansion +} + +// ingresses implements IngressInterface +type ingresses struct { + client *ExtensionsClient + ns string +} + +// newIngresses returns a Ingresses +func newIngresses(c *ExtensionsClient, namespace string) *ingresses { + return &ingresses{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a ingress and creates it. Returns the server's representation of the ingress, and an error, if there is any. +func (c *ingresses) Create(ingress *extensions.Ingress) (result *extensions.Ingress, err error) { + result = &extensions.Ingress{} + err = c.client.Post(). + Namespace(c.ns). + Resource("ingresses"). + Body(ingress). + Do(). + Into(result) + return +} + +// Update takes the representation of a ingress and updates it. Returns the server's representation of the ingress, and an error, if there is any. +func (c *ingresses) Update(ingress *extensions.Ingress) (result *extensions.Ingress, err error) { + result = &extensions.Ingress{} + err = c.client.Put(). + Namespace(c.ns). + Resource("ingresses"). + Name(ingress.Name). + Body(ingress). + Do(). + Into(result) + return +} + +func (c *ingresses) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) { + result = &extensions.Ingress{} + err = c.client.Put(). + Namespace(c.ns). + Resource("ingresses"). + Name(ingress.Name). + SubResource("status"). + Body(ingress). + Do(). + Into(result) + return +} + +// Delete takes name of the ingress and deletes it. Returns an error if one occurs. +func (c *ingresses) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("ingresses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *ingresses) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("ingresses"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the ingress, and returns the corresponding ingress object, and an error if there is any. +func (c *ingresses) Get(name string) (result *extensions.Ingress, err error) { + result = &extensions.Ingress{} + err = c.client.Get(). + Namespace(c.ns). + Resource("ingresses"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Ingresses that match those selectors. +func (c *ingresses) List(opts api.ListOptions) (result *extensions.IngressList, err error) { + result = &extensions.IngressList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("ingresses"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested ingresses. +func (c *ingresses) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("ingresses"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/job.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/job.go new file mode 100644 index 000000000..04d0d1282 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/job.go @@ -0,0 +1,150 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + watch "k8s.io/kubernetes/pkg/watch" +) + +// JobsGetter has a method to return a JobInterface. +// A group's client should implement this interface. +type JobsGetter interface { + Jobs(namespace string) JobInterface +} + +// JobInterface has methods to work with Job resources. +type JobInterface interface { + Create(*extensions.Job) (*extensions.Job, error) + Update(*extensions.Job) (*extensions.Job, error) + UpdateStatus(*extensions.Job) (*extensions.Job, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*extensions.Job, error) + List(opts api.ListOptions) (*extensions.JobList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + JobExpansion +} + +// jobs implements JobInterface +type jobs struct { + client *ExtensionsClient + ns string +} + +// newJobs returns a Jobs +func newJobs(c *ExtensionsClient, namespace string) *jobs { + return &jobs{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any. +func (c *jobs) Create(job *extensions.Job) (result *extensions.Job, err error) { + result = &extensions.Job{} + err = c.client.Post(). + Namespace(c.ns). + Resource("jobs"). + Body(job). + Do(). + Into(result) + return +} + +// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any. +func (c *jobs) Update(job *extensions.Job) (result *extensions.Job, err error) { + result = &extensions.Job{} + err = c.client.Put(). + Namespace(c.ns). + Resource("jobs"). + Name(job.Name). + Body(job). + Do(). + Into(result) + return +} + +func (c *jobs) UpdateStatus(job *extensions.Job) (result *extensions.Job, err error) { + result = &extensions.Job{} + err = c.client.Put(). + Namespace(c.ns). + Resource("jobs"). + Name(job.Name). + SubResource("status"). + Body(job). + Do(). + Into(result) + return +} + +// Delete takes name of the job and deletes it. Returns an error if one occurs. +func (c *jobs) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("jobs"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *jobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the job, and returns the corresponding job object, and an error if there is any. +func (c *jobs) Get(name string) (result *extensions.Job, err error) { + result = &extensions.Job{} + err = c.client.Get(). + Namespace(c.ns). + Resource("jobs"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Jobs that match those selectors. +func (c *jobs) List(opts api.ListOptions) (result *extensions.JobList, err error) { + result = &extensions.JobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested jobs. +func (c *jobs) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/replicaset.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/replicaset.go new file mode 100644 index 000000000..6257fd898 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/replicaset.go @@ -0,0 +1,150 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ReplicaSetsGetter has a method to return a ReplicaSetInterface. +// A group's client should implement this interface. +type ReplicaSetsGetter interface { + ReplicaSets(namespace string) ReplicaSetInterface +} + +// ReplicaSetInterface has methods to work with ReplicaSet resources. +type ReplicaSetInterface interface { + Create(*extensions.ReplicaSet) (*extensions.ReplicaSet, error) + Update(*extensions.ReplicaSet) (*extensions.ReplicaSet, error) + UpdateStatus(*extensions.ReplicaSet) (*extensions.ReplicaSet, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*extensions.ReplicaSet, error) + List(opts api.ListOptions) (*extensions.ReplicaSetList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + ReplicaSetExpansion +} + +// replicaSets implements ReplicaSetInterface +type replicaSets struct { + client *ExtensionsClient + ns string +} + +// newReplicaSets returns a ReplicaSets +func newReplicaSets(c *ExtensionsClient, namespace string) *replicaSets { + return &replicaSets{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *replicaSets) Create(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) { + result = &extensions.ReplicaSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("replicasets"). + Body(replicaSet). + Do(). + Into(result) + return +} + +// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *replicaSets) Update(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) { + result = &extensions.ReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSet.Name). + Body(replicaSet). + Do(). + Into(result) + return +} + +func (c *replicaSets) UpdateStatus(replicaSet *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) { + result = &extensions.ReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSet.Name). + SubResource("status"). + Body(replicaSet). + Do(). + Into(result) + return +} + +// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs. +func (c *replicaSets) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("replicasets"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *replicaSets) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any. +func (c *replicaSets) Get(name string) (result *extensions.ReplicaSet, err error) { + result = &extensions.ReplicaSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicasets"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors. +func (c *replicaSets) List(opts api.ListOptions) (result *extensions.ReplicaSetList, err error) { + result = &extensions.ReplicaSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested replicaSets. +func (c *replicaSets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/scale.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/scale.go new file mode 100644 index 000000000..7e54bc347 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/scale.go @@ -0,0 +1,42 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +// ScalesGetter has a method to return a ScaleInterface. +// A group's client should implement this interface. +type ScalesGetter interface { + Scales(namespace string) ScaleInterface +} + +// ScaleInterface has methods to work with Scale resources. +type ScaleInterface interface { + ScaleExpansion +} + +// scales implements ScaleInterface +type scales struct { + client *ExtensionsClient + ns string +} + +// newScales returns a Scales +func newScales(c *ExtensionsClient, namespace string) *scales { + return &scales{ + client: c, + ns: namespace, + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/scale_expansion.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/scale_expansion.go new file mode 100644 index 000000000..61a77f260 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/scale_expansion.go @@ -0,0 +1,65 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" +) + +// The ScaleExpansion interface allows manually adding extra methods to the ScaleInterface. +type ScaleExpansion interface { + Get(kind string, name string) (*extensions.Scale, error) + Update(kind string, scale *extensions.Scale) (*extensions.Scale, error) +} + +// Get takes the reference to scale subresource and returns the subresource or error, if one occurs. +func (c *scales) Get(kind string, name string) (result *extensions.Scale, err error) { + result = &extensions.Scale{} + + // TODO this method needs to take a proper unambiguous kind + fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind} + resource, _ := meta.KindToResource(fullyQualifiedKind) + + err = c.client.Get(). + Namespace(c.ns). + Resource(resource.Resource). + Name(name). + SubResource("scale"). + Do(). + Into(result) + return +} + +func (c *scales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) { + result = &extensions.Scale{} + + // TODO this method needs to take a proper unambiguous kind + fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind} + resource, _ := meta.KindToResource(fullyQualifiedKind) + + err = c.client.Put(). + Namespace(scale.Namespace). + Resource(resource.Resource). + Name(scale.Name). + SubResource("scale"). + Body(scale). + Do(). + Into(result) + return +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/thirdpartyresource.go b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/thirdpartyresource.go new file mode 100644 index 000000000..0f1026fab --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned/thirdpartyresource.go @@ -0,0 +1,136 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + api "k8s.io/kubernetes/pkg/api" + extensions "k8s.io/kubernetes/pkg/apis/extensions" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface. +// A group's client should implement this interface. +type ThirdPartyResourcesGetter interface { + ThirdPartyResources(namespace string) ThirdPartyResourceInterface +} + +// ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources. +type ThirdPartyResourceInterface interface { + Create(*extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) + Update(*extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) + Delete(name string, options *api.DeleteOptions) error + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error + Get(name string) (*extensions.ThirdPartyResource, error) + List(opts api.ListOptions) (*extensions.ThirdPartyResourceList, error) + Watch(opts api.ListOptions) (watch.Interface, error) + ThirdPartyResourceExpansion +} + +// thirdPartyResources implements ThirdPartyResourceInterface +type thirdPartyResources struct { + client *ExtensionsClient + ns string +} + +// newThirdPartyResources returns a ThirdPartyResources +func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources { + return &thirdPartyResources{ + client: c, + ns: namespace, + } +} + +// Create takes the representation of a thirdPartyResource and creates it. Returns the server's representation of the thirdPartyResource, and an error, if there is any. +func (c *thirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { + result = &extensions.ThirdPartyResource{} + err = c.client.Post(). + Namespace(c.ns). + Resource("thirdpartyresources"). + Body(thirdPartyResource). + Do(). + Into(result) + return +} + +// Update takes the representation of a thirdPartyResource and updates it. Returns the server's representation of the thirdPartyResource, and an error, if there is any. +func (c *thirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { + result = &extensions.ThirdPartyResource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("thirdpartyresources"). + Name(thirdPartyResource.Name). + Body(thirdPartyResource). + Do(). + Into(result) + return +} + +// Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs. +func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("thirdpartyresources"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("thirdpartyresources"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the thirdPartyResource, and returns the corresponding thirdPartyResource object, and an error if there is any. +func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) { + result = &extensions.ThirdPartyResource{} + err = c.client.Get(). + Namespace(c.ns). + Resource("thirdpartyresources"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ThirdPartyResources that match those selectors. +func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) { + result = &extensions.ThirdPartyResourceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("thirdpartyresources"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested thirdPartyResources. +func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("thirdpartyresources"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/client.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/client.go index 2333672eb..24bc54c93 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/client.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/client.go @@ -17,17 +17,9 @@ limitations under the License. package unversioned import ( - "encoding/json" - "fmt" "net" "net/url" "strings" - - "github.com/emicklei/go-restful/swagger" - - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/unversioned" - "k8s.io/kubernetes/pkg/version" ) // Interface holds the methods for clients of Kubernetes, @@ -38,7 +30,6 @@ type Interface interface { ReplicationControllersNamespacer ServicesNamespacer EndpointsNamespacer - VersionInterface NodesInterface EventNamespacer LimitRangesNamespacer @@ -49,7 +40,7 @@ type Interface interface { PersistentVolumesInterface PersistentVolumeClaimsNamespacer ComponentStatusesInterface - SwaggerSchemaInterface + ConfigMapsNamespacer Extensions() ExtensionsInterface Discovery() DiscoveryInterface } @@ -113,113 +104,17 @@ func (c *Client) ComponentStatuses() ComponentStatusInterface { return newComponentStatuses(c) } -// VersionInterface has a method to retrieve the server version. -type VersionInterface interface { - ServerVersion() (*version.Info, error) - ServerAPIVersions() (*unversioned.APIVersions, error) -} - -// APIStatus is exposed by errors that can be converted to an api.Status object -// for finer grained details. -type APIStatus interface { - Status() unversioned.Status +func (c *Client) ConfigMaps(namespace string) ConfigMapsInterface { + return newConfigMaps(c, namespace) } // Client is the implementation of a Kubernetes client. type Client struct { *RESTClient *ExtensionsClient - // TODO: remove this when we re-structure pkg/client. *DiscoveryClient } -// ServerVersion retrieves and parses the server's version. -func (c *Client) ServerVersion() (*version.Info, error) { - body, err := c.Get().AbsPath("/version").Do().Raw() - if err != nil { - return nil, err - } - var info version.Info - err = json.Unmarshal(body, &info) - if err != nil { - return nil, fmt.Errorf("got '%s': %v", string(body), err) - } - return &info, nil -} - -// ServerAPIVersions retrieves and parses the list of API versions the server supports. -func (c *Client) ServerAPIVersions() (*unversioned.APIVersions, error) { - body, err := c.Get().UnversionedPath("").Do().Raw() - if err != nil { - return nil, err - } - var v unversioned.APIVersions - err = json.Unmarshal(body, &v) - if err != nil { - return nil, fmt.Errorf("got '%s': %v", string(body), err) - } - return &v, nil -} - -type ComponentValidatorInterface interface { - ValidateComponents() (*api.ComponentStatusList, error) -} - -// ValidateComponents retrieves and parses the master's self-monitored cluster state. -// TODO: This should hit the versioned endpoint when that is implemented. -func (c *Client) ValidateComponents() (*api.ComponentStatusList, error) { - body, err := c.Get().AbsPath("/validate").DoRaw() - if err != nil { - return nil, err - } - - statuses := []api.ComponentStatus{} - if err := json.Unmarshal(body, &statuses); err != nil { - return nil, fmt.Errorf("got '%s': %v", string(body), err) - } - return &api.ComponentStatusList{Items: statuses}, nil -} - -// SwaggerSchemaInterface has a method to retrieve the swagger schema. Used in -// client.Interface -type SwaggerSchemaInterface interface { - SwaggerSchema(groupVersion string) (*swagger.ApiDeclaration, error) -} - -// SwaggerSchema retrieves and parses the swagger API schema the server supports. -func (c *Client) SwaggerSchema(groupVersion string) (*swagger.ApiDeclaration, error) { - if groupVersion == "" { - return nil, fmt.Errorf("groupVersion cannot be empty") - } - - groupList, err := c.Discovery().ServerGroups() - if err != nil { - return nil, err - } - groupVersions := extractGroupVersions(groupList) - // This check also takes care the case that kubectl is newer than the running endpoint - if stringDoesntExistIn(groupVersion, groupVersions) { - return nil, fmt.Errorf("API version: %s is not supported by the server. Use one of: %v", groupVersion, groupVersions) - } - var path string - if groupVersion == "v1" { - path = "/swaggerapi/api/" + groupVersion - } else { - path = "/swaggerapi/apis/" + groupVersion - } - - body, err := c.Get().AbsPath(path).Do().Raw() - if err != nil { - return nil, err - } - var schema swagger.ApiDeclaration - err = json.Unmarshal(body, &schema) - if err != nil { - return nil, fmt.Errorf("got '%s': %v", string(body), err) - } - return &schema, nil -} - func stringDoesntExistIn(str string, slice []string) bool { for _, s := range slice { if s == str { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/client_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/client_test.go index be795e315..487591c5d 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/client_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/client_test.go @@ -20,230 +20,16 @@ import ( "encoding/json" "net/http" "net/http/httptest" - "net/url" - "path" "reflect" - "strings" "testing" "github.com/emicklei/go-restful/swagger" - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" - "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/version" ) -const nameRequiredError = "resource name may not be empty" - -type testRequest struct { - Method string - Path string - Header string - Query url.Values - Body runtime.Object - RawBody *string -} - -type Response struct { - StatusCode int - Body runtime.Object - RawBody *string -} - -type testClient struct { - *Client - Request testRequest - Response Response - Error bool - Created bool - Version string - server *httptest.Server - handler *util.FakeHandler - // For query args, an optional function to validate the contents - // useful when the contents can change but still be correct. - // Maps from query arg key to validator. - // If no validator is present, string equality is used. - QueryValidator map[string]func(string, string) bool -} - -func (c *testClient) Setup(t *testing.T) *testClient { - c.handler = &util.FakeHandler{ - StatusCode: c.Response.StatusCode, - } - if responseBody := body(t, c.Response.Body, c.Response.RawBody); responseBody != nil { - c.handler.ResponseBody = *responseBody - } - c.server = httptest.NewServer(c.handler) - if c.Client == nil { - version := c.Version - if len(version) == 0 { - version = testapi.Default.Version() - } - c.Client = NewOrDie(&Config{ - Host: c.server.URL, - Version: version, - }) - - // TODO: caesarxuchao: hacky way to specify version of Experimental client. - // We will fix this by supporting multiple group versions in Config - version = c.Version - if len(version) == 0 { - version = testapi.Extensions.Version() - } - c.ExtensionsClient = NewExtensionsOrDie(&Config{ - Host: c.server.URL, - Version: version, - }) - } - c.QueryValidator = map[string]func(string, string) bool{} - return c -} - -func (c *testClient) Validate(t *testing.T, received runtime.Object, err error) { - c.ValidateCommon(t, err) - - if c.Response.Body != nil && !api.Semantic.DeepDerivative(c.Response.Body, received) { - t.Errorf("bad response for request %#v: expected %#v, got %#v", c.Request, c.Response.Body, received) - } -} - -func (c *testClient) ValidateRaw(t *testing.T, received []byte, err error) { - c.ValidateCommon(t, err) - - if c.Response.Body != nil && !reflect.DeepEqual(c.Response.Body, received) { - t.Errorf("bad response for request %#v: expected %#v, got %#v", c.Request, c.Response.Body, received) - } -} - -func (c *testClient) ValidateCommon(t *testing.T, err error) { - defer c.server.Close() - - if c.Error { - if err == nil { - t.Errorf("error expected for %#v, got none", c.Request) - } - return - } - if err != nil { - t.Errorf("no error expected for %#v, got: %v", c.Request, err) - } - - if c.handler.RequestReceived == nil { - t.Errorf("handler had an empty request, %#v", c) - return - } - - requestBody := body(t, c.Request.Body, c.Request.RawBody) - actualQuery := c.handler.RequestReceived.URL.Query() - t.Logf("got query: %v", actualQuery) - t.Logf("path: %v", c.Request.Path) - // We check the query manually, so blank it out so that FakeHandler.ValidateRequest - // won't check it. - c.handler.RequestReceived.URL.RawQuery = "" - c.handler.ValidateRequest(t, path.Join(c.Request.Path), c.Request.Method, requestBody) - for key, values := range c.Request.Query { - validator, ok := c.QueryValidator[key] - if !ok { - switch key { - case unversioned.LabelSelectorQueryParam(testapi.Default.Version()): - validator = validateLabels - case unversioned.FieldSelectorQueryParam(testapi.Default.Version()): - validator = validateFields - default: - validator = func(a, b string) bool { return a == b } - } - } - observed := actualQuery.Get(key) - wanted := strings.Join(values, "") - if !validator(wanted, observed) { - t.Errorf("Unexpected query arg for key: %s. Expected %s, Received %s", key, wanted, observed) - } - } - if c.Request.Header != "" { - if c.handler.RequestReceived.Header.Get(c.Request.Header) == "" { - t.Errorf("header %q not found in request %#v", c.Request.Header, c.handler.RequestReceived) - } - } - - if expected, received := requestBody, c.handler.RequestBody; expected != nil && *expected != received { - t.Errorf("bad body for request %#v: expected %s, got %s", c.Request, *expected, received) - } -} - -// buildResourcePath is a convenience function for knowing if a namespace should be in a path param or not -func buildResourcePath(namespace, resource string) string { - if len(namespace) > 0 { - return path.Join("namespaces", namespace, resource) - } - return resource -} - -// buildQueryValues is a convenience function for knowing if a namespace should be in a query param or not -func buildQueryValues(query url.Values) url.Values { - v := url.Values{} - if query != nil { - for key, values := range query { - for _, value := range values { - v.Add(key, value) - } - } - } - return v -} - -func validateLabels(a, b string) bool { - sA, eA := labels.Parse(a) - if eA != nil { - return false - } - sB, eB := labels.Parse(b) - if eB != nil { - return false - } - return sA.String() == sB.String() -} - -func validateFields(a, b string) bool { - sA, _ := fields.ParseSelector(a) - sB, _ := fields.ParseSelector(b) - return sA.String() == sB.String() -} - -func body(t *testing.T, obj runtime.Object, raw *string) *string { - if obj != nil { - _, kind, err := api.Scheme.ObjectVersionAndKind(obj) - if err != nil { - t.Errorf("unexpected encoding error: %v", err) - } - // TODO: caesarxuchao: we should detect which group an object belongs to - // by using the version returned by Schem.ObjectVersionAndKind() once we - // split the schemes for internal objects. - // TODO: caesarxuchao: we should add a map from kind to group in Scheme. - var bs []byte - if api.Scheme.Recognizes(testapi.Default.GroupAndVersion(), kind) { - bs, err = testapi.Default.Codec().Encode(obj) - if err != nil { - t.Errorf("unexpected encoding error: %v", err) - } - } else if api.Scheme.Recognizes(testapi.Extensions.GroupAndVersion(), kind) { - bs, err = testapi.Extensions.Codec().Encode(obj) - if err != nil { - t.Errorf("unexpected encoding error: %v", err) - } - } else { - t.Errorf("unexpected kind: %v", kind) - } - body := string(bs) - return &body - } - return raw -} - func TestGetServerVersion(t *testing.T) { expect := version.Info{ Major: "foo", @@ -260,9 +46,11 @@ func TestGetServerVersion(t *testing.T) { w.WriteHeader(http.StatusOK) w.Write(output) })) + // TODO: Uncomment when fix #19254 + // defer server.Close() client := NewOrDie(&Config{Host: server.URL}) - got, err := client.ServerVersion() + got, err := client.Discovery().ServerVersion() if err != nil { t.Fatalf("unexpected encoding error: %v", err) } @@ -271,21 +59,95 @@ func TestGetServerVersion(t *testing.T) { } } +func TestGetServerGroupsWithV1Server(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + var obj interface{} + switch req.URL.Path { + case "/api": + obj = &unversioned.APIVersions{ + Versions: []string{ + "v1", + }, + } + default: + w.WriteHeader(http.StatusNotFound) + return + } + output, err := json.Marshal(obj) + if err != nil { + t.Fatalf("unexpected encoding error: %v", err) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(output) + })) + // TODO: Uncomment when fix #19254 + // defer server.Close() + client := NewOrDie(&Config{Host: server.URL}) + // ServerGroups should not return an error even if server returns error at /api and /apis + apiGroupList, err := client.Discovery().ServerGroups() + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + groupVersions := ExtractGroupVersions(apiGroupList) + if !reflect.DeepEqual(groupVersions, []string{"v1"}) { + t.Errorf("expected: %q, got: %q", []string{"v1"}, groupVersions) + } +} + +func TestGetServerResourcesWithV1Server(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + var obj interface{} + switch req.URL.Path { + case "/api": + obj = &unversioned.APIVersions{ + Versions: []string{ + "v1", + }, + } + default: + w.WriteHeader(http.StatusNotFound) + return + } + output, err := json.Marshal(obj) + if err != nil { + t.Errorf("unexpected encoding error: %v", err) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(output) + })) + // TODO: Uncomment when fix #19254 + // defer server.Close() + client := NewOrDie(&Config{Host: server.URL}) + // ServerResources should not return an error even if server returns error at /api/v1. + resourceMap, err := client.Discovery().ServerResources() + if err != nil { + t.Errorf("unexpected error: %v", err) + } + if _, found := resourceMap["v1"]; !found { + t.Errorf("missing v1 in resource map") + } + +} + func TestGetServerResources(t *testing.T) { stable := unversioned.APIResourceList{ GroupVersion: "v1", APIResources: []unversioned.APIResource{ - {"pods", true}, - {"services", true}, - {"namespaces", false}, + {"pods", true, "Pod"}, + {"services", true, "Service"}, + {"namespaces", false, "Namespace"}, }, } beta := unversioned.APIResourceList{ GroupVersion: "extensions/v1", APIResources: []unversioned.APIResource{ - {"deployments", true}, - {"ingress", true}, - {"jobs", true}, + {"deployments", true, "Deployment"}, + {"ingresses", true, "Ingress"}, + {"jobs", true, "Job"}, }, } tests := []struct { @@ -330,7 +192,7 @@ func TestGetServerResources(t *testing.T) { list = &unversioned.APIGroupList{ Groups: []unversioned.APIGroup{ { - Versions: []unversioned.GroupVersion{ + Versions: []unversioned.GroupVersionForDiscovery{ {GroupVersion: "extensions/v1beta1"}, }, }, @@ -350,6 +212,8 @@ func TestGetServerResources(t *testing.T) { w.WriteHeader(http.StatusOK) w.Write(output) })) + // TODO: Uncomment when fix #19254 + // defer server.Close() client := NewOrDie(&Config{Host: server.URL}) for _, test := range tests { got, err := client.Discovery().ServerResourcesForGroupVersion(test.request) @@ -379,29 +243,6 @@ func TestGetServerResources(t *testing.T) { } } -func TestGetServerAPIVersions(t *testing.T) { - versions := []string{"v1", "v2", "v3"} - expect := unversioned.APIVersions{Versions: versions} - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - output, err := json.Marshal(expect) - if err != nil { - t.Errorf("unexpected encoding error: %v", err) - return - } - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - w.Write(output) - })) - client := NewOrDie(&Config{Host: server.URL}) - got, err := client.ServerAPIVersions() - if err != nil { - t.Fatalf("unexpected encoding error: %v", err) - } - if e, a := expect, *got; !reflect.DeepEqual(e, a) { - t.Errorf("expected %v, got %v", e, a) - } -} - func swaggerSchemaFakeServer() (*httptest.Server, error) { request := 1 var sErr error @@ -433,9 +274,11 @@ func TestGetSwaggerSchema(t *testing.T) { if err != nil { t.Errorf("unexpected encoding error: %v", err) } + // TODO: Uncomment when fix #19254 + // defer server.Close() client := NewOrDie(&Config{Host: server.URL}) - got, err := client.SwaggerSchema("v1") + got, err := client.Discovery().SwaggerSchema(v1.SchemeGroupVersion) if err != nil { t.Fatalf("unexpected encoding error: %v", err) } @@ -445,15 +288,17 @@ func TestGetSwaggerSchema(t *testing.T) { } func TestGetSwaggerSchemaFail(t *testing.T) { - expErr := "API version: v4 is not supported by the server. Use one of: [v1 v2 v3]" + expErr := "API version: api.group/v4 is not supported by the server. Use one of: [v1 v2 v3]" server, err := swaggerSchemaFakeServer() if err != nil { t.Errorf("unexpected encoding error: %v", err) } + // TODO: Uncomment when fix #19254 + // defer server.Close() client := NewOrDie(&Config{Host: server.URL}) - got, err := client.SwaggerSchema("v4") + got, err := client.Discovery().SwaggerSchema(unversioned.GroupVersion{Group: "api.group", Version: "v4"}) if got != nil { t.Fatalf("unexpected response: %v", got) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/helpers.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/helpers.go index e2d56570c..87330c500 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/helpers.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/helpers.go @@ -31,6 +31,14 @@ func init() { redactedBytes = []byte(string(sDec)) } +// IsConfigEmpty returns true if the config is empty. +func IsConfigEmpty(config *Config) bool { + return len(config.AuthInfos) == 0 && len(config.Clusters) == 0 && len(config.Contexts) == 0 && + len(config.CurrentContext) == 0 && + len(config.Preferences.Extensions) == 0 && !config.Preferences.Colors && + len(config.Extensions) == 0 +} + // MinifyConfig read the current context and uses that to keep only the relevant pieces of config // This is useful for making secrets based on kubeconfig files func MinifyConfig(config *Config) error { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest/latest.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest/latest.go index d12722956..90d5c5380 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest/latest.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest/latest.go @@ -17,13 +17,19 @@ limitations under the License. package latest import ( - "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" + _ "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer/json" + "k8s.io/kubernetes/pkg/runtime/serializer/versioning" ) // Version is the string that represents the current external default version. const Version = "v1" +var ExternalVersion = unversioned.GroupVersion{Group: "", Version: "v1"} + // OldestVersion is the string that represents the oldest server version supported, // for client code that wants to hardcode the lowest common denominator. const OldestVersion = "v1" @@ -34,8 +40,9 @@ const OldestVersion = "v1" // with a set of versions to choose. var Versions = []string{"v1"} -// Codec is the default codec for serializing output that should use -// the latest supported version. Use this Codec when writing to -// disk, a data store that is not dynamically versioned, or in tests. -// This codec can decode any object that Kubernetes is aware of. -var Codec = runtime.YAMLDecoder(v1.Codec) +var Codec = versioning.NewCodecForScheme( + api.Scheme, + json.NewYAMLSerializer(json.DefaultMetaFactory, api.Scheme, runtime.ObjectTyperToTyper(api.Scheme)), + []unversioned.GroupVersion{{Version: Version}}, + []unversioned.GroupVersion{{Version: runtime.APIVersionInternal}}, +) diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/register.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/register.go index 524822892..e4e23998a 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/register.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/register.go @@ -17,16 +17,27 @@ limitations under the License. package api import ( + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" ) // Scheme is the default instance of runtime.Scheme to which types in the Kubernetes API are already registered. var Scheme = runtime.NewScheme() +// SchemeGroupVersion is group version used to register these objects +// TODO this should be in the "kubeconfig" group +var SchemeGroupVersion = unversioned.GroupVersion{Group: "", Version: runtime.APIVersionInternal} + func init() { - Scheme.AddKnownTypes("", + Scheme.AddKnownTypes(SchemeGroupVersion, &Config{}, ) } -func (*Config) IsAnAPIObject() {} +func (obj *Config) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *Config) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() +} +func (obj *Config) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/types.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/types.go index b5d9674df..4a1dc364f 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/types.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/types.go @@ -24,6 +24,7 @@ import ( // Top level config objects and all values required for proper functioning are not "omitempty". Any truly optional piece of config is allowed to be omitted. // Config holds the information needed to build connect to remote kubernetes clusters as a given user +// IMPORTANT if you add fields to this struct, please update IsConfigEmpty() type Config struct { // Legacy field from pkg/api/types.go TypeMeta. // TODO(jlowdermilk): remove this after eliminating downstream dependencies. @@ -41,13 +42,14 @@ type Config struct { // CurrentContext is the name of the context that you would like to use by default CurrentContext string `json:"current-context"` // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - Extensions map[string]*runtime.EmbeddedObject `json:"extensions,omitempty"` + Extensions map[string]runtime.Object `json:"extensions,omitempty"` } +// IMPORTANT if you add fields to this struct, please update IsConfigEmpty() type Preferences struct { Colors bool `json:"colors,omitempty"` // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - Extensions map[string]*runtime.EmbeddedObject `json:"extensions,omitempty"` + Extensions map[string]runtime.Object `json:"extensions,omitempty"` } // Cluster contains information about how to communicate with a kubernetes cluster @@ -65,7 +67,7 @@ type Cluster struct { // CertificateAuthorityData contains PEM-encoded certificate authority certificates. Overrides CertificateAuthority CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"` // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - Extensions map[string]*runtime.EmbeddedObject `json:"extensions,omitempty"` + Extensions map[string]runtime.Object `json:"extensions,omitempty"` } // AuthInfo contains information that describes identity information. This is use to tell the kubernetes cluster who you are. @@ -87,7 +89,7 @@ type AuthInfo struct { // Password is the password for basic authentication to the kubernetes cluster. Password string `json:"password,omitempty"` // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - Extensions map[string]*runtime.EmbeddedObject `json:"extensions,omitempty"` + Extensions map[string]runtime.Object `json:"extensions,omitempty"` } // Context is a tuple of references to a cluster (how do I communicate with a kubernetes cluster), a user (how do I identify myself), and a namespace (what subset of resources do I want to work with) @@ -101,7 +103,7 @@ type Context struct { // Namespace is the default namespace to use on unspecified requests Namespace string `json:"namespace,omitempty"` // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - Extensions map[string]*runtime.EmbeddedObject `json:"extensions,omitempty"` + Extensions map[string]runtime.Object `json:"extensions,omitempty"` } // NewConfig is a convenience function that returns a new Config object with non-nil maps @@ -111,26 +113,26 @@ func NewConfig() *Config { Clusters: make(map[string]*Cluster), AuthInfos: make(map[string]*AuthInfo), Contexts: make(map[string]*Context), - Extensions: make(map[string]*runtime.EmbeddedObject), + Extensions: make(map[string]runtime.Object), } } // NewConfig is a convenience function that returns a new Config object with non-nil maps func NewContext() *Context { - return &Context{Extensions: make(map[string]*runtime.EmbeddedObject)} + return &Context{Extensions: make(map[string]runtime.Object)} } // NewConfig is a convenience function that returns a new Config object with non-nil maps func NewCluster() *Cluster { - return &Cluster{Extensions: make(map[string]*runtime.EmbeddedObject)} + return &Cluster{Extensions: make(map[string]runtime.Object)} } // NewConfig is a convenience function that returns a new Config object with non-nil maps func NewAuthInfo() *AuthInfo { - return &AuthInfo{Extensions: make(map[string]*runtime.EmbeddedObject)} + return &AuthInfo{Extensions: make(map[string]runtime.Object)} } // NewConfig is a convenience function that returns a new Config object with non-nil maps func NewPreferences() *Preferences { - return &Preferences{Extensions: make(map[string]*runtime.EmbeddedObject)} + return &Preferences{Extensions: make(map[string]runtime.Object)} } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/types_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/types_test.go index af351bf2f..8059fe21f 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/types_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/types_test.go @@ -44,13 +44,13 @@ func ExampleOfOptionsConfig() { defaultConfig.Preferences.Colors = true defaultConfig.Clusters["alfa"] = &Cluster{ Server: "https://alfa.org:8080", - APIVersion: "v1beta2", + APIVersion: "v1", InsecureSkipTLSVerify: true, CertificateAuthority: "path/to/my/cert-ca-filename", } defaultConfig.Clusters["bravo"] = &Cluster{ Server: "https://bravo.org:8080", - APIVersion: "v1beta1", + APIVersion: "v1", InsecureSkipTLSVerify: false, } defaultConfig.AuthInfos["white-mage-via-cert"] = &AuthInfo{ @@ -86,13 +86,13 @@ func ExampleOfOptionsConfig() { // clusters: // alfa: // LocationOfOrigin: "" - // api-version: v1beta2 + // api-version: v1 // certificate-authority: path/to/my/cert-ca-filename // insecure-skip-tls-verify: true // server: https://alfa.org:8080 // bravo: // LocationOfOrigin: "" - // api-version: v1beta1 + // api-version: v1 // server: https://bravo.org:8080 // contexts: // alfa-as-black-mage: diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1/conversion.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1/conversion.go index cffdeb6ea..e03fc60b1 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1/conversion.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1/conversion.go @@ -69,7 +69,7 @@ func init() { if err := s.Convert(&in.Contexts, &out.Contexts, 0); err != nil { return err } - out.Extensions = make(map[string]*runtime.EmbeddedObject) + out.Extensions = make(map[string]runtime.Object) if err := s.Convert(&in.Extensions, &out.Extensions, 0); err != nil { return err } @@ -192,10 +192,10 @@ func init() { return nil }, - func(in *[]NamedExtension, out *map[string]*runtime.EmbeddedObject, s conversion.Scope) error { + func(in *[]NamedExtension, out *map[string]runtime.Object, s conversion.Scope) error { for _, curr := range *in { - newExtension := &runtime.EmbeddedObject{} - if err := s.Convert(&curr.Extension, newExtension, 0); err != nil { + var newExtension runtime.Object + if err := s.Convert(&curr.Extension, &newExtension, 0); err != nil { return err } (*out)[curr.Name] = newExtension @@ -203,7 +203,7 @@ func init() { return nil }, - func(in *map[string]*runtime.EmbeddedObject, out *[]NamedExtension, s conversion.Scope) error { + func(in *map[string]runtime.Object, out *[]NamedExtension, s conversion.Scope) error { allKeys := make([]string, 0, len(*in)) for key := range *in { allKeys = append(allKeys, key) diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1/register.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1/register.go index c2cfeaf6c..edf9fe1a7 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1/register.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1/register.go @@ -17,17 +17,24 @@ limitations under the License. package v1 import ( + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" - "k8s.io/kubernetes/pkg/runtime" ) -// Codec encodes internal objects to the v1 scheme -var Codec = runtime.CodecFor(api.Scheme, "v1") +// SchemeGroupVersion is group version used to register these objects +// TODO this should be in the "kubeconfig" group +var SchemeGroupVersion = unversioned.GroupVersion{Group: "", Version: "v1"} func init() { - api.Scheme.AddKnownTypes("v1", + api.Scheme.AddKnownTypes(SchemeGroupVersion, &Config{}, ) } -func (*Config) IsAnAPIObject() {} +func (obj *Config) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *Config) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() +} +func (obj *Config) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/client_config.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/client_config.go index 0fc3ea63d..ce94a128b 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/client_config.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/client_config.go @@ -19,12 +19,16 @@ package clientcmd import ( "fmt" "io" + "io/ioutil" "net/url" "os" + "strings" + "github.com/golang/glog" "github.com/imdario/mergo" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned" clientauth "k8s.io/kubernetes/pkg/client/unversioned/auth" clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" @@ -92,13 +96,17 @@ func (config DirectClientConfig) ClientConfig() (*client.Config, error) { clientConfig := &client.Config{} clientConfig.Host = configClusterInfo.Server if u, err := url.ParseRequestURI(clientConfig.Host); err == nil && u.Opaque == "" && len(u.Path) > 1 { - clientConfig.Prefix = u.Path - u.Path = "" u.RawQuery = "" u.Fragment = "" clientConfig.Host = u.String() } - clientConfig.Version = configClusterInfo.APIVersion + if len(configClusterInfo.APIVersion) != 0 { + gv, err := unversioned.ParseGroupVersion(configClusterInfo.APIVersion) + if err != nil { + return nil, err + } + clientConfig.GroupVersion = &gv + } // only try to read the auth information if we are secure if client.IsConfigTransportTLS(*clientConfig) { @@ -233,7 +241,11 @@ func (config DirectClientConfig) ConfirmUsable() error { validationErrors := make([]error, 0) validationErrors = append(validationErrors, validateAuthInfo(config.getAuthInfoName(), config.getAuthInfo())...) validationErrors = append(validationErrors, validateClusterInfo(config.getClusterName(), config.getCluster())...) - + // when direct client config is specified, and our only error is that no server is defined, we should + // return a standard "no config" error + if len(validationErrors) == 1 && validationErrors[0] == ErrEmptyCluster { + return newErrConfigurationInvalid([]error{ErrEmptyConfig}) + } return newErrConfigurationInvalid(validationErrors) } @@ -315,12 +327,19 @@ func (inClusterClientConfig) ClientConfig() (*client.Config, error) { } func (inClusterClientConfig) Namespace() (string, error) { - // TODO: generic way to figure out what namespace you are running in? - // This way assumes you've set the POD_NAMESPACE environment variable - // using the downward API. + // This way assumes you've set the POD_NAMESPACE environment variable using the downward API. + // This check has to be done first for backwards compatibility with the way InClusterConfig was originally set up if ns := os.Getenv("POD_NAMESPACE"); ns != "" { return ns, nil } + + // Fall back to the namespace associated with the service account token, if available + if data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil { + if ns := strings.TrimSpace(string(data)); len(ns) > 0 { + return ns, nil + } + } + return "default", nil } @@ -331,3 +350,23 @@ func (inClusterClientConfig) Possible() bool { os.Getenv("KUBERNETES_SERVICE_PORT") != "" && err == nil && !fi.IsDir() } + +// BuildConfigFromFlags is a helper function that builds configs from a master +// url or a kubeconfig filepath. These are passed in as command line flags for cluster +// components. Warnings should reflect this usage. If neither masterUrl or kubeconfigPath +// are passed in we fallback to inClusterConfig. If inClusterConfig fails, we fallback +// to the default config. +func BuildConfigFromFlags(masterUrl, kubeconfigPath string) (*client.Config, error) { + if kubeconfigPath == "" && masterUrl == "" { + glog.Warningf("Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.") + kubeconfig, err := client.InClusterConfig() + if err == nil { + return kubeconfig, nil + } + glog.Warning("error creating inClusterConfig, falling back to default config: ", err) + } + + return NewNonInteractiveDeferredLoadingClientConfig( + &ClientConfigLoadingRules{ExplicitPath: kubeconfigPath}, + &ConfigOverrides{ClusterInfo: clientcmdapi.Cluster{Server: masterUrl}}).ClientConfig() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/client_config_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/client_config_test.go index cb6f861d1..834869677 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/client_config_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/client_config_test.go @@ -34,7 +34,7 @@ func createValidTestConfig() *clientcmdapi.Config { config := clientcmdapi.NewConfig() config.Clusters["clean"] = &clientcmdapi.Cluster{ Server: server, - APIVersion: testapi.Default.Version(), + APIVersion: testapi.Default.GroupVersion().String(), } config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{ Token: token, @@ -89,7 +89,7 @@ func TestCertificateData(t *testing.T) { config := clientcmdapi.NewConfig() config.Clusters["clean"] = &clientcmdapi.Cluster{ Server: "https://localhost:8443", - APIVersion: testapi.Default.Version(), + APIVersion: testapi.Default.GroupVersion().String(), CertificateAuthorityData: caData, } config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{ @@ -122,7 +122,7 @@ func TestBasicAuthData(t *testing.T) { config := clientcmdapi.NewConfig() config.Clusters["clean"] = &clientcmdapi.Cluster{ Server: "https://localhost:8443", - APIVersion: testapi.Default.Version(), + APIVersion: testapi.Default.GroupVersion().String(), } config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{ Username: username, @@ -156,8 +156,8 @@ func TestCreateClean(t *testing.T) { } matchStringArg(config.Clusters["clean"].Server, clientConfig.Host, t) - matchStringArg("", clientConfig.Prefix, t) - matchStringArg(config.Clusters["clean"].APIVersion, clientConfig.Version, t) + matchStringArg("", clientConfig.APIPath, t) + matchStringArg(config.Clusters["clean"].APIVersion, clientConfig.GroupVersion.String(), t) matchBoolArg(config.Clusters["clean"].InsecureSkipTLSVerify, clientConfig.Insecure, t) matchStringArg(config.AuthInfos["clean"].Token, clientConfig.BearerToken, t) } @@ -166,22 +166,21 @@ func TestCreateCleanWithPrefix(t *testing.T) { tt := []struct { server string host string - prefix string }{ - {"https://anything.com:8080/foo/bar", "https://anything.com:8080", "/foo/bar"}, - {"http://anything.com:8080/foo/bar", "http://anything.com:8080", "/foo/bar"}, - {"http://anything.com:8080/foo/bar/", "http://anything.com:8080", "/foo/bar/"}, - {"http://anything.com:8080/", "http://anything.com:8080/", ""}, - {"http://anything.com:8080//", "http://anything.com:8080", "//"}, - {"anything.com:8080/foo/bar", "anything.com:8080/foo/bar", ""}, - {"anything.com:8080", "anything.com:8080", ""}, - {"anything.com", "anything.com", ""}, - {"anything", "anything", ""}, + {"https://anything.com:8080/foo/bar", "https://anything.com:8080/foo/bar"}, + {"http://anything.com:8080/foo/bar", "http://anything.com:8080/foo/bar"}, + {"http://anything.com:8080/foo/bar/", "http://anything.com:8080/foo/bar/"}, + {"http://anything.com:8080/", "http://anything.com:8080/"}, + {"http://anything.com:8080//", "http://anything.com:8080//"}, + {"anything.com:8080/foo/bar", "anything.com:8080/foo/bar"}, + {"anything.com:8080", "anything.com:8080"}, + {"anything.com", "anything.com"}, + {"anything", "anything"}, } // WARNING: EnvVarCluster.Server is set during package loading time and can not be overriden by os.Setenv inside this test EnvVarCluster.Server = "" - tt = append(tt, struct{ server, host, prefix string }{"", "http://localhost:8080", ""}) + tt = append(tt, struct{ server, host string }{"", "http://localhost:8080"}) for _, tc := range tt { config := createValidTestConfig() @@ -198,7 +197,6 @@ func TestCreateCleanWithPrefix(t *testing.T) { } matchStringArg(tc.host, clientConfig.Host, t) - matchStringArg(tc.prefix, clientConfig.Prefix, t) } } @@ -212,7 +210,7 @@ func TestCreateCleanDefault(t *testing.T) { } matchStringArg(config.Clusters["clean"].Server, clientConfig.Host, t) - matchStringArg(config.Clusters["clean"].APIVersion, clientConfig.Version, t) + matchStringArg(config.Clusters["clean"].APIVersion, clientConfig.GroupVersion.String(), t) matchBoolArg(config.Clusters["clean"].InsecureSkipTLSVerify, clientConfig.Insecure, t) matchStringArg(config.AuthInfos["clean"].Token, clientConfig.BearerToken, t) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/loader.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/loader.go index 2e7ef62c2..215431583 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/loader.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/loader.go @@ -25,11 +25,13 @@ import ( "path/filepath" "strings" - "github.com/ghodss/yaml" + "github.com/golang/glog" "github.com/imdario/mergo" + "k8s.io/kubernetes/pkg/api/unversioned" clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" clientcmdlatest "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest" + "k8s.io/kubernetes/pkg/runtime" utilerrors "k8s.io/kubernetes/pkg/util/errors" ) @@ -225,6 +227,7 @@ func LoadFromFile(filename string) (*clientcmdapi.Config, error) { if err != nil { return nil, err } + glog.V(6).Infoln("Config loaded from file", filename) // set LocationOfOrigin on every Cluster, User, and Context for key, obj := range config.AuthInfos { @@ -240,6 +243,16 @@ func LoadFromFile(filename string) (*clientcmdapi.Config, error) { config.Contexts[key] = obj } + if config.AuthInfos == nil { + config.AuthInfos = map[string]*clientcmdapi.AuthInfo{} + } + if config.Clusters == nil { + config.Clusters = map[string]*clientcmdapi.Cluster{} + } + if config.Contexts == nil { + config.Contexts = map[string]*clientcmdapi.Context{} + } + return config, nil } @@ -251,11 +264,11 @@ func Load(data []byte) (*clientcmdapi.Config, error) { if len(data) == 0 { return config, nil } - - if err := clientcmdlatest.Codec.DecodeInto(data, config); err != nil { + decoded, _, err := clientcmdlatest.Codec.Decode(data, &unversioned.GroupVersionKind{Version: clientcmdlatest.Version, Kind: "Config"}, config) + if err != nil { return nil, err } - return config, nil + return decoded.(*clientcmdapi.Config), nil } // WriteToFile serializes the config to yaml and writes it out to a file. If not present, it creates the file with the mode 0600. If it is present @@ -280,15 +293,7 @@ func WriteToFile(config clientcmdapi.Config, filename string) error { // Write serializes the config to yaml. // Encapsulates serialization without assuming the destination is a file. func Write(config clientcmdapi.Config) ([]byte, error) { - json, err := clientcmdlatest.Codec.Encode(&config) - if err != nil { - return nil, err - } - content, err := yaml.JSONToYAML(json) - if err != nil { - return nil, err - } - return content, nil + return runtime.Encode(clientcmdlatest.Codec, &config) } func (rules ClientConfigLoadingRules) ResolvePaths() bool { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/loader_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/loader_test.go index 8e0c7a4f1..0921f7043 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/loader_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/loader_test.go @@ -30,6 +30,7 @@ import ( clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" clientcmdlatest "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest" + "k8s.io/kubernetes/pkg/runtime" ) var ( @@ -174,6 +175,32 @@ func TestConflictingCurrentContext(t *testing.T) { } } +func TestLoadingEmptyMaps(t *testing.T) { + configFile, _ := ioutil.TempFile("", "") + defer os.Remove(configFile.Name()) + + mockConfig := clientcmdapi.Config{ + CurrentContext: "any-context-value", + } + + WriteToFile(mockConfig, configFile.Name()) + + config, err := LoadFromFile(configFile.Name()) + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + + if config.Clusters == nil { + t.Error("expected config.Clusters to be non-nil") + } + if config.AuthInfos == nil { + t.Error("expected config.AuthInfos to be non-nil") + } + if config.Contexts == nil { + t.Error("expected config.Contexts to be non-nil") + } +} + func TestResolveRelativePaths(t *testing.T) { pathResolutionConfig1 := clientcmdapi.Config{ AuthInfos: map[string]*clientcmdapi.AuthInfo{ @@ -365,7 +392,7 @@ func ExampleNoMergingOnExplicitPaths() { mergedConfig, err := loadingRules.Load() - json, err := clientcmdlatest.Codec.Encode(mergedConfig) + json, err := runtime.Encode(clientcmdlatest.Codec, mergedConfig) if err != nil { fmt.Printf("Unexpected error: %v", err) } @@ -411,7 +438,7 @@ func ExampleMergingSomeWithConflict() { mergedConfig, err := loadingRules.Load() - json, err := clientcmdlatest.Codec.Encode(mergedConfig) + json, err := runtime.Encode(clientcmdlatest.Codec, mergedConfig) if err != nil { fmt.Printf("Unexpected error: %v", err) } @@ -470,7 +497,7 @@ func ExampleMergingEverythingNoConflicts() { mergedConfig, err := loadingRules.Load() - json, err := clientcmdlatest.Codec.Encode(mergedConfig) + json, err := runtime.Encode(clientcmdlatest.Codec, mergedConfig) if err != nil { fmt.Printf("Unexpected error: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go index 8a6d6bf14..d6bc496a2 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/overrides.go @@ -122,7 +122,7 @@ const ( // RecommendedAuthOverrideFlags is a convenience method to return recommended flag names prefixed with a string of your choosing func RecommendedAuthOverrideFlags(prefix string) AuthOverrideFlags { return AuthOverrideFlags{ - ClientCertificate: FlagInfo{prefix + FlagCertFile, "", "", "Path to a client key file for TLS."}, + ClientCertificate: FlagInfo{prefix + FlagCertFile, "", "", "Path to a client certificate file for TLS."}, ClientKey: FlagInfo{prefix + FlagKeyFile, "", "", "Path to a client key file for TLS."}, Token: FlagInfo{prefix + FlagBearerToken, "", "", "Bearer token for authentication to the API server."}, Username: FlagInfo{prefix + FlagUsername, "", "", "Username for basic authentication to the API server."}, diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/validation.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/validation.go index a631dc65d..bd1bd735e 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/validation.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/validation.go @@ -20,6 +20,7 @@ import ( "errors" "fmt" "os" + "reflect" "strings" clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" @@ -27,7 +28,12 @@ import ( "k8s.io/kubernetes/pkg/util/validation" ) -var ErrNoContext = errors.New("no context chosen") +var ( + ErrNoContext = errors.New("no context chosen") + ErrEmptyConfig = errors.New("no configuration has been provided") + // message is for consistency with old behavior + ErrEmptyCluster = errors.New("cluster has no server defined") +) type errContextNotFound struct { ContextName string @@ -49,6 +55,16 @@ func IsContextNotFound(err error) bool { return strings.Contains(err.Error(), "context was not found for specified context") } +// IsEmptyConfig returns true if the provided error indicates the provided configuration +// is empty. +func IsEmptyConfig(err error) bool { + switch t := err.(type) { + case errConfigurationInvalid: + return len(t) == 1 && t[0] == ErrEmptyConfig + } + return err == ErrEmptyConfig +} + // errConfigurationInvalid is a set of errors indicating the configuration is invalid. type errConfigurationInvalid []error @@ -88,6 +104,10 @@ func IsConfigurationInvalid(err error) bool { func Validate(config clientcmdapi.Config) error { validationErrors := make([]error, 0) + if clientcmdapi.IsConfigEmpty(&config) { + return newErrConfigurationInvalid([]error{ErrEmptyConfig}) + } + if len(config.CurrentContext) != 0 { if _, exists := config.Contexts[config.CurrentContext]; !exists { validationErrors = append(validationErrors, &errContextNotFound{config.CurrentContext}) @@ -114,6 +134,10 @@ func Validate(config clientcmdapi.Config) error { func ConfirmUsable(config clientcmdapi.Config, passedContextName string) error { validationErrors := make([]error, 0) + if clientcmdapi.IsConfigEmpty(&config) { + return newErrConfigurationInvalid([]error{ErrEmptyConfig}) + } + var contextName string if len(passedContextName) != 0 { contextName = passedContextName @@ -143,6 +167,10 @@ func ConfirmUsable(config clientcmdapi.Config, passedContextName string) error { func validateClusterInfo(clusterName string, clusterInfo clientcmdapi.Cluster) []error { validationErrors := make([]error, 0) + if reflect.DeepEqual(clientcmdapi.Cluster{}, clusterInfo) { + return []error{ErrEmptyCluster} + } + if len(clusterInfo.Server) == 0 { if len(clusterName) == 0 { validationErrors = append(validationErrors, fmt.Errorf("default cluster has no server defined")) diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/validation_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/validation_test.go index 7bf3244ea..ca4843a87 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/validation_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/clientcmd/validation_test.go @@ -87,7 +87,7 @@ func TestConfirmUsableEmptyConfig(t *testing.T) { config := clientcmdapi.NewConfig() test := configValidationTest{ config: config, - expectedErrorSubstring: []string{"no context chosen"}, + expectedErrorSubstring: []string{"invalid configuration: no configuration has been provided"}, } test.testConfirmUsable("", t) @@ -96,7 +96,7 @@ func TestConfirmUsableMissingConfig(t *testing.T) { config := clientcmdapi.NewConfig() test := configValidationTest{ config: config, - expectedErrorSubstring: []string{"context was not found for"}, + expectedErrorSubstring: []string{"invalid configuration: no configuration has been provided"}, } test.testConfirmUsable("not-here", t) @@ -104,7 +104,8 @@ func TestConfirmUsableMissingConfig(t *testing.T) { func TestValidateEmptyConfig(t *testing.T) { config := clientcmdapi.NewConfig() test := configValidationTest{ - config: config, + config: config, + expectedErrorSubstring: []string{"invalid configuration: no configuration has been provided"}, } test.testConfig(t) @@ -132,6 +133,18 @@ func TestIsContextNotFound(t *testing.T) { } } +func TestIsEmptyConfig(t *testing.T) { + config := clientcmdapi.NewConfig() + + err := Validate(*config) + if !IsEmptyConfig(err) { + t.Errorf("Expected context not found, but got %v", err) + } + if !IsConfigurationInvalid(err) { + t.Errorf("Expected configuration invalid, but got %v", err) + } +} + func TestIsConfigurationInvalid(t *testing.T) { if newErrConfigurationInvalid([]error{}) != nil { t.Errorf("unexpected error") @@ -177,7 +190,7 @@ func TestValidateEmptyClusterInfo(t *testing.T) { config.Clusters["empty"] = &clientcmdapi.Cluster{} test := configValidationTest{ config: config, - expectedErrorSubstring: []string{"no server found for"}, + expectedErrorSubstring: []string{"cluster has no server defined"}, } test.testCluster("empty", t) diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/componentstatuses.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/componentstatuses.go index b72a8a5db..0717cdec1 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/componentstatuses.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/componentstatuses.go @@ -18,8 +18,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) type ComponentStatusesInterface interface { @@ -28,11 +26,11 @@ type ComponentStatusesInterface interface { // ComponentStatusInterface contains methods to retrieve ComponentStatus type ComponentStatusInterface interface { - List(label labels.Selector, field fields.Selector) (*api.ComponentStatusList, error) + List(opts api.ListOptions) (*api.ComponentStatusList, error) Get(name string) (*api.ComponentStatus, error) // TODO: It'd be nice to have watch support at some point - //Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + //Watch(opts api.ListOptions) (watch.Interface, error) } // componentStatuses implements ComponentStatusesInterface @@ -44,12 +42,11 @@ func newComponentStatuses(c *Client) *componentStatuses { return &componentStatuses{c} } -func (c *componentStatuses) List(label labels.Selector, field fields.Selector) (result *api.ComponentStatusList, err error) { +func (c *componentStatuses) List(opts api.ListOptions) (result *api.ComponentStatusList, err error) { result = &api.ComponentStatusList{} err = c.client.Get(). Resource("componentStatuses"). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Do(). Into(result) diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/conditions.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/conditions.go index 9117a6ff3..7102c8116 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/conditions.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/conditions.go @@ -17,11 +17,69 @@ limitations under the License. package unversioned import ( + "time" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/util/wait" ) +// DefaultRetry is the recommended retry for a conflict where multiple clients +// are making changes to the same resource. +var DefaultRetry = wait.Backoff{ + Steps: 5, + Duration: 10 * time.Millisecond, + Factor: 1.0, + Jitter: 0.1, +} + +// DefaultBackoff is the recommended backoff for a conflict where a client +// may be attempting to make an unrelated modification to a resource under +// active management by one or more controllers. +var DefaultBackoff = wait.Backoff{ + Steps: 4, + Duration: 10 * time.Millisecond, + Factor: 5.0, + Jitter: 0.1, +} + +// RetryConflict executes the provided function repeatedly, retrying if the server returns a conflicting +// write. Callers should preserve previous executions if they wish to retry changes. It performs an +// exponential backoff. +// +// var pod *api.Pod +// err := RetryOnConflict(DefaultBackoff, func() (err error) { +// pod, err = c.Pods("mynamespace").UpdateStatus(podStatus) +// return +// }) +// if err != nil { +// // may be conflict if max retries were hit +// return err +// } +// ... +// +// TODO: Make Backoff an interface? +func RetryOnConflict(backoff wait.Backoff, fn func() error) error { + var lastConflictErr error + err := wait.ExponentialBackoff(backoff, func() (bool, error) { + err := fn() + switch { + case err == nil: + return true, nil + case errors.IsConflict(err): + lastConflictErr = err + return false, nil + default: + return false, err + } + }) + if err == wait.ErrWaitTimeout { + err = lastConflictErr + } + return err +} + // ControllerHasDesiredReplicas returns a condition that will be true if and only if // the desired replica count for a controller's ReplicaSelector equals the Replicas count. func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationController) wait.ConditionFunc { @@ -43,12 +101,35 @@ func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationContro } } -// JobHasDesiredParallelism returns a condition that will be true if the desired parallelism count -// for a job equals the current active counts or is less by an appropriate successful/unsuccessful count. -func JobHasDesiredParallelism(c Interface, job *extensions.Job) wait.ConditionFunc { +// ReplicaSetHasDesiredReplicas returns a condition that will be true if and only if +// the desired replica count for a ReplicaSet's ReplicaSelector equals the Replicas count. +func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.ReplicaSet) wait.ConditionFunc { + + // If we're given a ReplicaSet where the status lags the spec, it either means that the + // ReplicaSet is stale, or that the ReplicaSet manager hasn't noticed the update yet. + // Polling status.Replicas is not safe in the latter case. + desiredGeneration := replicaSet.Generation return func() (bool, error) { - job, err := c.Extensions().Jobs(job.Namespace).Get(job.Name) + rs, err := c.ReplicaSets(replicaSet.Namespace).Get(replicaSet.Name) + if err != nil { + return false, err + } + // There's a chance a concurrent update modifies the Spec.Replicas causing this check to + // pass, or, after this check has passed, a modification causes the ReplicaSet manager to + // create more pods. This will not be an issue once we've implemented graceful delete for + // ReplicaSets, but till then concurrent stop operations on the same ReplicaSet might have + // unintended side effects. + return rs.Status.ObservedGeneration >= desiredGeneration && rs.Status.Replicas == rs.Spec.Replicas, nil + } +} + +// JobHasDesiredParallelism returns a condition that will be true if the desired parallelism count +// for a job equals the current active counts or is less by an appropriate successful/unsuccessful count. +func JobHasDesiredParallelism(c ExtensionsInterface, job *extensions.Job) wait.ConditionFunc { + + return func() (bool, error) { + job, err := c.Jobs(job.Namespace).Get(job.Name) if err != nil { return false, err } @@ -57,8 +138,27 @@ func JobHasDesiredParallelism(c Interface, job *extensions.Job) wait.ConditionFu if job.Status.Active == *job.Spec.Parallelism { return true, nil } - // otherwise count successful - progress := *job.Spec.Completions - job.Status.Active - job.Status.Succeeded - return progress == 0, nil + if job.Spec.Completions == nil { + // A job without specified completions needs to wait for Active to reach Parallelism. + return false, nil + } else { + // otherwise count successful + progress := *job.Spec.Completions - job.Status.Active - job.Status.Succeeded + return progress == 0, nil + } + } +} + +// DeploymentHasDesiredReplicas returns a condition that will be true if and only if +// the desired replica count for a deployment equals its updated replicas count. +// (non-terminated pods that have the desired template spec). +func DeploymentHasDesiredReplicas(c ExtensionsInterface, deployment *extensions.Deployment) wait.ConditionFunc { + + return func() (bool, error) { + deployment, err := c.Deployments(deployment.Namespace).Get(deployment.Name) + if err != nil { + return false, err + } + return deployment.Status.UpdatedReplicas == deployment.Spec.Replicas, nil } } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/conditions_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/conditions_test.go new file mode 100644 index 000000000..1042461c0 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/conditions_test.go @@ -0,0 +1,71 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "fmt" + "testing" + + "k8s.io/kubernetes/pkg/api/errors" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/util/wait" +) + +func TestRetryOnConflict(t *testing.T) { + opts := wait.Backoff{Factor: 1.0, Steps: 3} + conflictErr := errors.NewConflict(unversioned.GroupResource{Resource: "test"}, "other", nil) + + // never returns + err := RetryOnConflict(opts, func() error { + return conflictErr + }) + if err != conflictErr { + t.Errorf("unexpected error: %v", err) + } + + // returns immediately + i := 0 + err = RetryOnConflict(opts, func() error { + i++ + return nil + }) + if err != nil || i != 1 { + t.Errorf("unexpected error: %v", err) + } + + // returns immediately on error + testErr := fmt.Errorf("some other error") + err = RetryOnConflict(opts, func() error { + return testErr + }) + if err != testErr { + t.Errorf("unexpected error: %v", err) + } + + // keeps retrying + i = 0 + err = RetryOnConflict(opts, func() error { + if i < 2 { + i++ + return errors.NewConflict(unversioned.GroupResource{Resource: "test"}, "other", nil) + } + return nil + }) + if err != nil || i != 2 { + t.Errorf("unexpected error: %v", err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/configmap.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/configmap.go new file mode 100644 index 000000000..60fffa755 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/configmap.go @@ -0,0 +1,122 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/watch" +) + +const ( + ConfigMapResourceName string = "configmaps" +) + +type ConfigMapsNamespacer interface { + ConfigMaps(namespace string) ConfigMapsInterface +} + +type ConfigMapsInterface interface { + Get(string) (*api.ConfigMap, error) + List(opts api.ListOptions) (*api.ConfigMapList, error) + Create(*api.ConfigMap) (*api.ConfigMap, error) + Delete(string) error + Update(*api.ConfigMap) (*api.ConfigMap, error) + Watch(api.ListOptions) (watch.Interface, error) +} + +type ConfigMaps struct { + client *Client + namespace string +} + +// ConfigMaps should implement ConfigMapsInterface +var _ ConfigMapsInterface = &ConfigMaps{} + +func newConfigMaps(c *Client, ns string) *ConfigMaps { + return &ConfigMaps{ + client: c, + namespace: ns, + } +} + +func (c *ConfigMaps) Get(name string) (*api.ConfigMap, error) { + result := &api.ConfigMap{} + err := c.client.Get(). + Namespace(c.namespace). + Resource(ConfigMapResourceName). + Name(name). + Do(). + Into(result) + + return result, err +} + +func (c *ConfigMaps) List(opts api.ListOptions) (*api.ConfigMapList, error) { + result := &api.ConfigMapList{} + err := c.client.Get(). + Namespace(c.namespace). + Resource(ConfigMapResourceName). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + + return result, err +} + +func (c *ConfigMaps) Create(cfg *api.ConfigMap) (*api.ConfigMap, error) { + result := &api.ConfigMap{} + err := c.client.Post(). + Namespace(c.namespace). + Resource(ConfigMapResourceName). + Body(cfg). + Do(). + Into(result) + + return result, err +} + +func (c *ConfigMaps) Delete(name string) error { + return c.client.Delete(). + Namespace(c.namespace). + Resource(ConfigMapResourceName). + Name(name). + Do(). + Error() +} + +func (c *ConfigMaps) Update(cfg *api.ConfigMap) (*api.ConfigMap, error) { + result := &api.ConfigMap{} + + err := c.client.Put(). + Namespace(c.namespace). + Resource(ConfigMapResourceName). + Name(cfg.Name). + Body(cfg). + Do(). + Into(result) + + return result, err +} + +func (c *ConfigMaps) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.namespace). + Resource(ConfigMapResourceName). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/containerinfo_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/containerinfo_test.go index 797ad5139..5e7e9768d 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/containerinfo_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/containerinfo_test.go @@ -70,7 +70,8 @@ func testHTTPContainerInfoGetter( t.Fatal(err) } })) - defer ts.Close() + // TODO: Uncomment when fix #19254 + // defer ts.Close() hostURL, err := url.Parse(ts.URL) if err != nil { t.Fatal(err) @@ -171,7 +172,8 @@ func TestHTTPGetMachineInfo(t *testing.T) { t.Fatal(err) } })) - defer ts.Close() + // TODO: Uncomment when fix #19254 + // defer ts.Close() hostURL, err := url.Parse(ts.URL) if err != nil { t.Fatal(err) diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/daemon_sets.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/daemon_sets.go index ebff86e54..fa12591a6 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/daemon_sets.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/daemon_sets.go @@ -17,9 +17,8 @@ limitations under the License. package unversioned import ( + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -29,13 +28,13 @@ type DaemonSetsNamespacer interface { } type DaemonSetInterface interface { - List(label labels.Selector, field fields.Selector) (*extensions.DaemonSetList, error) + List(opts api.ListOptions) (*extensions.DaemonSetList, error) Get(name string) (*extensions.DaemonSet, error) Create(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error) Update(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error) UpdateStatus(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error) Delete(name string) error - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // daemonSets implements DaemonsSetsNamespacer interface @@ -51,9 +50,9 @@ func newDaemonSets(c *ExtensionsClient, namespace string) *daemonSets { // Ensure statically that daemonSets implements DaemonSetsInterface. var _ DaemonSetInterface = &daemonSets{} -func (c *daemonSets) List(label labels.Selector, field fields.Selector) (result *extensions.DaemonSetList, err error) { +func (c *daemonSets) List(opts api.ListOptions) (result *extensions.DaemonSetList, err error) { result = &extensions.DaemonSetList{} - err = c.r.Get().Namespace(c.ns).Resource("daemonsets").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.r.Get().Namespace(c.ns).Resource("daemonsets").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } @@ -91,13 +90,11 @@ func (c *daemonSets) Delete(name string) error { } // Watch returns a watch.Interface that watches the requested daemon sets. -func (c *daemonSets) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *daemonSets) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). Resource("daemonsets"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/daemon_sets_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/daemon_sets_test.go index e81ac47e1..2bfbb44b0 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/daemon_sets_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/daemon_sets_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "testing" @@ -22,8 +27,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getDSResourceName() string { @@ -32,12 +35,12 @@ func getDSResourceName() string { func TestListDaemonSets(t *testing.T) { ns := api.NamespaceAll - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, ""), }, - Response: Response{StatusCode: 200, + Response: simple.Response{StatusCode: 200, Body: &extensions.DaemonSetList{ Items: []extensions.DaemonSet{ { @@ -49,23 +52,24 @@ func TestListDaemonSets(t *testing.T) { }, }, Spec: extensions.DaemonSetSpec{ - Template: &api.PodTemplateSpec{}, + Template: api.PodTemplateSpec{}, }, }, }, }, }, } - receivedDSs, err := c.Setup(t).Extensions().DaemonSets(ns).List(labels.Everything(), fields.Everything()) + receivedDSs, err := c.Setup(t).Extensions().DaemonSets(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, receivedDSs, err) } func TestGetDaemonSet(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{ + c := &simple.Client{ + Request: simple.Request{Method: "GET", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ StatusCode: 200, Body: &extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{ @@ -76,21 +80,23 @@ func TestGetDaemonSet(t *testing.T) { }, }, Spec: extensions.DaemonSetSpec{ - Template: &api.PodTemplateSpec{}, + Template: api.PodTemplateSpec{}, }, }, }, } receivedDaemonSet, err := c.Setup(t).Extensions().DaemonSets(ns).Get("foo") + defer c.Close() c.Validate(t, receivedDaemonSet, err) } func TestGetDaemonSetWithNoName(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{Error: true} + c := &simple.Client{Error: true} receivedPod, err := c.Setup(t).Extensions().DaemonSets(ns).Get("") - if (err != nil) && (err.Error() != nameRequiredError) { - t.Errorf("Expected error: %v, but got %v", nameRequiredError, err) + defer c.Close() + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) } c.Validate(t, receivedPod, err) @@ -101,9 +107,9 @@ func TestUpdateDaemonSet(t *testing.T) { requestDaemonSet := &extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{ + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ StatusCode: 200, Body: &extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{ @@ -114,12 +120,13 @@ func TestUpdateDaemonSet(t *testing.T) { }, }, Spec: extensions.DaemonSetSpec{ - Template: &api.PodTemplateSpec{}, + Template: api.PodTemplateSpec{}, }, }, }, } receivedDaemonSet, err := c.Setup(t).Extensions().DaemonSets(ns).Update(requestDaemonSet) + defer c.Close() c.Validate(t, receivedDaemonSet, err) } @@ -128,9 +135,9 @@ func TestUpdateDaemonSetUpdateStatus(t *testing.T) { requestDaemonSet := &extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo") + "/status", Query: buildQueryValues(nil)}, - Response: Response{ + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo") + "/status", Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ StatusCode: 200, Body: &extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{ @@ -141,23 +148,25 @@ func TestUpdateDaemonSetUpdateStatus(t *testing.T) { }, }, Spec: extensions.DaemonSetSpec{ - Template: &api.PodTemplateSpec{}, + Template: api.PodTemplateSpec{}, }, Status: extensions.DaemonSetStatus{}, }, }, } receivedDaemonSet, err := c.Setup(t).Extensions().DaemonSets(ns).UpdateStatus(requestDaemonSet) + defer c.Close() c.Validate(t, receivedDaemonSet, err) } func TestDeleteDaemon(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).Extensions().DaemonSets(ns).Delete("foo") + defer c.Close() c.Validate(t, nil, err) } @@ -166,9 +175,9 @@ func TestCreateDaemonSet(t *testing.T) { requestDaemonSet := &extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{Name: "foo"}, } - c := &testClient{ - Request: testRequest{Method: "POST", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, ""), Body: requestDaemonSet, Query: buildQueryValues(nil)}, - Response: Response{ + c := &simple.Client{ + Request: simple.Request{Method: "POST", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, ""), Body: requestDaemonSet, Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ StatusCode: 200, Body: &extensions.DaemonSet{ ObjectMeta: api.ObjectMeta{ @@ -179,11 +188,12 @@ func TestCreateDaemonSet(t *testing.T) { }, }, Spec: extensions.DaemonSetSpec{ - Template: &api.PodTemplateSpec{}, + Template: api.PodTemplateSpec{}, }, }, }, } receivedDaemonSet, err := c.Setup(t).Extensions().DaemonSets(ns).Create(requestDaemonSet) + defer c.Close() c.Validate(t, receivedDaemonSet, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/debugging.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/debugging.go deleted file mode 100644 index 76f8c2caa..000000000 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/debugging.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package unversioned - -import ( - "fmt" - "net/http" - "time" - - "github.com/golang/glog" - - "k8s.io/kubernetes/pkg/util" - "k8s.io/kubernetes/pkg/util/sets" -) - -// RequestInfo keeps track of information about a request/response combination -type RequestInfo struct { - RequestHeaders http.Header - RequestVerb string - RequestURL string - - ResponseStatus string - ResponseHeaders http.Header - ResponseErr error - - Duration time.Duration -} - -// NewRequestInfo creates a new RequestInfo based on an http request -func NewRequestInfo(req *http.Request) *RequestInfo { - reqInfo := &RequestInfo{} - reqInfo.RequestURL = req.URL.String() - reqInfo.RequestVerb = req.Method - reqInfo.RequestHeaders = req.Header - - return reqInfo -} - -// Complete adds information about the response to the RequestInfo -func (r *RequestInfo) Complete(response *http.Response, err error) { - if err != nil { - r.ResponseErr = err - return - } - r.ResponseStatus = response.Status - r.ResponseHeaders = response.Header -} - -// ToCurl returns a string that can be run as a command in a terminal (minus the body) -func (r RequestInfo) ToCurl() string { - headers := "" - for key, values := range map[string][]string(r.RequestHeaders) { - for _, value := range values { - headers += fmt.Sprintf(` -H %q`, fmt.Sprintf("%s: %s", key, value)) - } - } - - return fmt.Sprintf("curl -k -v -X%s %s %s", r.RequestVerb, headers, r.RequestURL) -} - -// DebuggingRoundTripper will display information about the requests passing through it based on what is configured -type DebuggingRoundTripper struct { - delegatedRoundTripper http.RoundTripper - - Levels sets.String -} - -const ( - JustURL string = "url" - URLTiming string = "urltiming" - CurlCommand string = "curlcommand" - RequestHeaders string = "requestheaders" - ResponseStatus string = "responsestatus" - ResponseHeaders string = "responseheaders" -) - -func NewDebuggingRoundTripper(rt http.RoundTripper, levels ...string) *DebuggingRoundTripper { - return &DebuggingRoundTripper{rt, sets.NewString(levels...)} -} - -func (rt *DebuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - reqInfo := NewRequestInfo(req) - - if rt.Levels.Has(JustURL) { - glog.Infof("%s %s", reqInfo.RequestVerb, reqInfo.RequestURL) - } - if rt.Levels.Has(CurlCommand) { - glog.Infof("%s", reqInfo.ToCurl()) - - } - if rt.Levels.Has(RequestHeaders) { - glog.Infof("Request Headers:") - for key, values := range reqInfo.RequestHeaders { - for _, value := range values { - glog.Infof(" %s: %s", key, value) - } - } - } - - startTime := time.Now() - response, err := rt.delegatedRoundTripper.RoundTrip(req) - reqInfo.Duration = time.Since(startTime) - - reqInfo.Complete(response, err) - - if rt.Levels.Has(URLTiming) { - glog.Infof("%s %s %s in %d milliseconds", reqInfo.RequestVerb, reqInfo.RequestURL, reqInfo.ResponseStatus, reqInfo.Duration.Nanoseconds()/int64(time.Millisecond)) - } - if rt.Levels.Has(ResponseStatus) { - glog.Infof("Response Status: %s in %d milliseconds", reqInfo.ResponseStatus, reqInfo.Duration.Nanoseconds()/int64(time.Millisecond)) - } - if rt.Levels.Has(ResponseHeaders) { - glog.Infof("Response Headers:") - for key, values := range reqInfo.ResponseHeaders { - for _, value := range values { - glog.Infof(" %s: %s", key, value) - } - } - } - - return response, err -} - -var _ = util.RoundTripperWrapper(&DebuggingRoundTripper{}) - -func (rt *DebuggingRoundTripper) WrappedRoundTripper() http.RoundTripper { - return rt.delegatedRoundTripper -} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/deployment.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/deployment.go index 878f5ee1f..1706418b3 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/deployment.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/deployment.go @@ -19,8 +19,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -31,12 +29,14 @@ type DeploymentsNamespacer interface { // DeploymentInterface has methods to work with Deployment resources. type DeploymentInterface interface { - List(label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error) + List(opts api.ListOptions) (*extensions.DeploymentList, error) Get(name string) (*extensions.Deployment, error) Delete(name string, options *api.DeleteOptions) error - Create(Deployment *extensions.Deployment) (*extensions.Deployment, error) - Update(Deployment *extensions.Deployment) (*extensions.Deployment, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Create(*extensions.Deployment) (*extensions.Deployment, error) + Update(*extensions.Deployment) (*extensions.Deployment, error) + UpdateStatus(*extensions.Deployment) (*extensions.Deployment, error) + Watch(opts api.ListOptions) (watch.Interface, error) + Rollback(*extensions.DeploymentRollback) error } // deployments implements DeploymentInterface @@ -54,9 +54,9 @@ func newDeployments(c *ExtensionsClient, namespace string) *deployments { } // List takes label and field selectors, and returns the list of Deployments that match those selectors. -func (c *deployments) List(label labels.Selector, field fields.Selector) (result *extensions.DeploymentList, err error) { +func (c *deployments) List(opts api.ListOptions) (result *extensions.DeploymentList, err error) { result = &extensions.DeploymentList{} - err = c.client.Get().Namespace(c.ns).Resource("deployments").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.client.Get().Namespace(c.ns).Resource("deployments").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } @@ -69,14 +69,7 @@ func (c *deployments) Get(name string) (result *extensions.Deployment, err error // Delete takes name of the deployment and deletes it. Returns an error if one occurs. func (c *deployments) Delete(name string, options *api.DeleteOptions) error { - if options == nil { - return c.client.Delete().Namespace(c.ns).Resource("deployments").Name(name).Do().Error() - } - body, err := api.Scheme.EncodeToVersion(options, c.client.APIVersion()) - if err != nil { - return err - } - return c.client.Delete().Namespace(c.ns).Resource("deployments").Name(name).Body(body).Do().Error() + return c.client.Delete().Namespace(c.ns).Resource("deployments").Name(name).Body(options).Do().Error() } // Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any. @@ -93,14 +86,23 @@ func (c *deployments) Update(deployment *extensions.Deployment) (result *extensi return } +func (c *deployments) UpdateStatus(deployment *extensions.Deployment) (result *extensions.Deployment, err error) { + result = &extensions.Deployment{} + err = c.client.Put().Namespace(c.ns).Resource("deployments").Name(deployment.Name).SubResource("status").Body(deployment).Do().Into(result) + return +} + // Watch returns a watch.Interface that watches the requested deployments. -func (c *deployments) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *deployments) Watch(opts api.ListOptions) (watch.Interface, error) { return c.client.Get(). Prefix("watch"). Namespace(c.ns). Resource("deployments"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } + +// Rollback applied the provided DeploymentRollback to the named deployment in the current namespace. +func (c *deployments) Rollback(deploymentRollback *extensions.DeploymentRollback) error { + return c.client.Post().Namespace(c.ns).Resource("deployments").Name(deploymentRollback.Name).SubResource("rollback").Body(deploymentRollback).Do().Error() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/deployment_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/deployment_test.go index 0a94a5f8c..2480c3a25 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/deployment_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/deployment_test.go @@ -14,20 +14,26 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) + +import ( + "net/http" "net/url" "testing" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" ) -func getDeploymentsResoureName() string { +func getDeploymentsResourceName() string { return "deployments" } @@ -39,17 +45,18 @@ func TestDeploymentCreate(t *testing.T) { Namespace: ns, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", - Path: testapi.Extensions.ResourcePath(getDeploymentsResoureName(), ns, ""), - Query: buildQueryValues(nil), + Path: testapi.Extensions.ResourcePath(getDeploymentsResourceName(), ns, ""), + Query: simple.BuildQueryValues(nil), Body: &deployment, }, - Response: Response{StatusCode: 200, Body: &deployment}, + Response: simple.Response{StatusCode: 200, Body: &deployment}, } response, err := c.Setup(t).Deployments(ns).Create(&deployment) + defer c.Close() if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -64,17 +71,18 @@ func TestDeploymentGet(t *testing.T) { Namespace: ns, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", - Path: testapi.Extensions.ResourcePath(getDeploymentsResoureName(), ns, "abc"), - Query: buildQueryValues(nil), + Path: testapi.Extensions.ResourcePath(getDeploymentsResourceName(), ns, "abc"), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: deployment}, + Response: simple.Response{StatusCode: 200, Body: deployment}, } response, err := c.Setup(t).Deployments(ns).Get("abc") + defer c.Close() c.Validate(t, response, err) } @@ -90,16 +98,17 @@ func TestDeploymentList(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", - Path: testapi.Extensions.ResourcePath(getDeploymentsResoureName(), ns, ""), - Query: buildQueryValues(nil), + Path: testapi.Extensions.ResourcePath(getDeploymentsResourceName(), ns, ""), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: deploymentList}, + Response: simple.Response{StatusCode: 200, Body: deploymentList}, } - response, err := c.Setup(t).Deployments(ns).List(labels.Everything(), fields.Everything()) + response, err := c.Setup(t).Deployments(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, response, err) } @@ -112,41 +121,120 @@ func TestDeploymentUpdate(t *testing.T) { ResourceVersion: "1", }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", - Path: testapi.Extensions.ResourcePath(getDeploymentsResoureName(), ns, "abc"), - Query: buildQueryValues(nil), + Path: testapi.Extensions.ResourcePath(getDeploymentsResourceName(), ns, "abc"), + Query: simple.BuildQueryValues(nil), }, - Response: Response{StatusCode: 200, Body: deployment}, + Response: simple.Response{StatusCode: 200, Body: deployment}, } response, err := c.Setup(t).Deployments(ns).Update(deployment) + defer c.Close() + c.Validate(t, response, err) +} + +func TestDeploymentUpdateStatus(t *testing.T) { + ns := api.NamespaceDefault + deployment := &extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + Name: "abc", + Namespace: ns, + ResourceVersion: "1", + }, + } + c := &simple.Client{ + Request: simple.Request{ + Method: "PUT", + Path: testapi.Extensions.ResourcePath(getDeploymentsResourceName(), ns, "abc") + "/status", + Query: simple.BuildQueryValues(nil), + }, + Response: simple.Response{StatusCode: 200, Body: deployment}, + } + response, err := c.Setup(t).Deployments(ns).UpdateStatus(deployment) + defer c.Close() c.Validate(t, response, err) } func TestDeploymentDelete(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "DELETE", - Path: testapi.Extensions.ResourcePath(getDeploymentsResoureName(), ns, "foo"), - Query: buildQueryValues(nil), + Path: testapi.Extensions.ResourcePath(getDeploymentsResourceName(), ns, "foo"), + Query: simple.BuildQueryValues(nil), }, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).Deployments(ns).Delete("foo", nil) + defer c.Close() c.Validate(t, nil, err) } func TestDeploymentWatch(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", - Path: testapi.Extensions.ResourcePathWithPrefix("watch", getDeploymentsResoureName(), "", ""), + Path: testapi.Extensions.ResourcePathWithPrefix("watch", getDeploymentsResourceName(), "", ""), Query: url.Values{"resourceVersion": []string{}}, }, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } - _, err := c.Setup(t).Deployments(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), "") + _, err := c.Setup(t).Deployments(api.NamespaceAll).Watch(api.ListOptions{}) + defer c.Close() c.Validate(t, nil, err) } + +func TestListDeploymentsLabels(t *testing.T) { + ns := api.NamespaceDefault + labelSelectorQueryParamName := unversioned.LabelSelectorQueryParam(testapi.Extensions.GroupVersion().String()) + c := &simple.Client{ + Request: simple.Request{ + Method: "GET", + Path: testapi.Extensions.ResourcePath("deployments", ns, ""), + Query: simple.BuildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, + Response: simple.Response{ + StatusCode: http.StatusOK, + Body: &extensions.DeploymentList{ + Items: []extensions.Deployment{ + { + ObjectMeta: api.ObjectMeta{ + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + }, + }, + }, + }, + } + c.Setup(t) + defer c.Close() + c.QueryValidator[labelSelectorQueryParamName] = simple.ValidateLabels + selector := labels.Set{"foo": "bar", "name": "baz"}.AsSelector() + options := api.ListOptions{LabelSelector: selector} + receivedPodList, err := c.Deployments(ns).List(options) + c.Validate(t, receivedPodList, err) +} + +func TestDeploymentRollback(t *testing.T) { + ns := api.NamespaceDefault + deploymentRollback := &extensions.DeploymentRollback{ + Name: "abc", + UpdatedAnnotations: map[string]string{}, + RollbackTo: extensions.RollbackConfig{Revision: 1}, + } + c := &simple.Client{ + Request: simple.Request{ + Method: "POST", + Path: testapi.Extensions.ResourcePath(getDeploymentsResourceName(), ns, "abc") + "/rollback", + Query: simple.BuildQueryValues(nil), + Body: deploymentRollback, + }, + Response: simple.Response{StatusCode: http.StatusOK}, + } + err := c.Setup(t).Deployments(ns).Rollback(deploymentRollback) + defer c.Close() + c.ValidateCommon(t, err) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/discovery_client.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/discovery_client.go index 273a20dac..890f37684 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/discovery_client.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/discovery_client.go @@ -19,10 +19,16 @@ package unversioned import ( "encoding/json" "fmt" - "net/http" "net/url" + "github.com/emicklei/go-restful/swagger" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/version" ) // DiscoveryInterface holds the methods that discover server-supported API groups, @@ -30,6 +36,8 @@ import ( type DiscoveryInterface interface { ServerGroupsInterface ServerResourcesInterface + ServerVersionInterface + SwaggerSchemaInterface } // ServerGroupsInterface has methods for obtaining supported groups on the API server @@ -47,19 +55,30 @@ type ServerResourcesInterface interface { ServerResources() (map[string]*unversioned.APIResourceList, error) } +// ServerVersionInterface has a method for retrieving the server's version. +type ServerVersionInterface interface { + // ServerVersion retrieves and parses the server's version (git version). + ServerVersion() (*version.Info, error) +} + +// SwaggerSchemaInterface has a method to retrieve the swagger schema. +type SwaggerSchemaInterface interface { + // SwaggerSchema retrieves and parses the swagger API schema the server supports. + SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) +} + // DiscoveryClient implements the functions that dicovery server-supported API groups, // versions and resources. type DiscoveryClient struct { - httpClient HTTPClient - baseURL url.URL + *RESTClient } // Convert unversioned.APIVersions to unversioned.APIGroup. APIVersions is used by legacy v1, so // group would be "". func apiVersionsToAPIGroup(apiVersions *unversioned.APIVersions) (apiGroup unversioned.APIGroup) { - groupVersions := []unversioned.GroupVersion{} + groupVersions := []unversioned.GroupVersionForDiscovery{} for _, version := range apiVersions.Versions { - groupVersion := unversioned.GroupVersion{ + groupVersion := unversioned.GroupVersionForDiscovery{ GroupVersion: version, Version: version, } @@ -71,42 +90,29 @@ func apiVersionsToAPIGroup(apiVersions *unversioned.APIVersions) (apiGroup unver return } -func (d *DiscoveryClient) get(url string) (resp *http.Response, err error) { - req, err := http.NewRequest("GET", url, nil) - if err != nil { - return nil, err - } - return d.httpClient.Do(req) -} - // ServerGroups returns the supported groups, with information like supported versions and the // preferred version. func (d *DiscoveryClient) ServerGroups() (apiGroupList *unversioned.APIGroupList, err error) { // Get the groupVersions exposed at /api - url := d.baseURL - url.Path = "/api" - resp, err := d.get(url.String()) - if err != nil { + v := &unversioned.APIVersions{} + err = d.Get().AbsPath("/api").Do().Into(v) + apiGroup := unversioned.APIGroup{} + if err == nil { + apiGroup = apiVersionsToAPIGroup(v) + } + if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) { return nil, err } - var v unversioned.APIVersions - defer resp.Body.Close() - err = json.NewDecoder(resp.Body).Decode(&v) - if err != nil { - return nil, fmt.Errorf("unexpected error: %v", err) - } - apiGroup := apiVersionsToAPIGroup(&v) // Get the groupVersions exposed at /apis - url.Path = "/apis" - resp2, err := d.get(url.String()) - if err != nil { + apiGroupList = &unversioned.APIGroupList{} + err = d.Get().AbsPath("/apis").Do().Into(apiGroupList) + if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) { return nil, err } - defer resp2.Body.Close() - apiGroupList = &unversioned.APIGroupList{} - if err = json.NewDecoder(resp2.Body).Decode(&apiGroupList); err != nil { - return nil, fmt.Errorf("unexpected error: %v", err) + // to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api + if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) { + apiGroupList = &unversioned.APIGroupList{} } // append the group retrieved from /api to the list @@ -116,20 +122,21 @@ func (d *DiscoveryClient) ServerGroups() (apiGroupList *unversioned.APIGroupList // ServerResourcesForGroupVersion returns the supported resources for a group and version. func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (resources *unversioned.APIResourceList, err error) { - url := d.baseURL + url := url.URL{} if groupVersion == "v1" { url.Path = "/api/" + groupVersion } else { url.Path = "/apis/" + groupVersion } - resp, err := d.get(url.String()) - if err != nil { - return nil, err - } - defer resp.Body.Close() resources = &unversioned.APIResourceList{} - if err = json.NewDecoder(resp.Body).Decode(resources); err != nil { - return nil, fmt.Errorf("unexpected error: %v", err) + err = d.Get().AbsPath(url.String()).Do().Into(resources) + if err != nil { + // ignore 403 or 404 error to be compatible with an v1.0 server. + if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) { + return resources, nil + } else { + return nil, err + } } return resources, nil } @@ -140,7 +147,7 @@ func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResource if err != nil { return nil, err } - groupVersions := extractGroupVersions(apiGroups) + groupVersions := ExtractGroupVersions(apiGroups) result := map[string]*unversioned.APIResourceList{} for _, groupVersion := range groupVersions { resources, err := d.ServerResourcesForGroupVersion(groupVersion) @@ -152,24 +159,84 @@ func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResource return result, nil } +// ServerVersion retrieves and parses the server's version (git version). +func (d *DiscoveryClient) ServerVersion() (*version.Info, error) { + body, err := d.Get().AbsPath("/version").Do().Raw() + if err != nil { + return nil, err + } + var info version.Info + err = json.Unmarshal(body, &info) + if err != nil { + return nil, fmt.Errorf("got '%s': %v", string(body), err) + } + return &info, nil +} + +// SwaggerSchema retrieves and parses the swagger API schema the server supports. +func (d *DiscoveryClient) SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) { + if version.IsEmpty() { + return nil, fmt.Errorf("groupVersion cannot be empty") + } + + groupList, err := d.ServerGroups() + if err != nil { + return nil, err + } + groupVersions := ExtractGroupVersions(groupList) + // This check also takes care the case that kubectl is newer than the running endpoint + if stringDoesntExistIn(version.String(), groupVersions) { + return nil, fmt.Errorf("API version: %v is not supported by the server. Use one of: %v", version, groupVersions) + } + var path string + if version == v1.SchemeGroupVersion { + path = "/swaggerapi/api/" + version.Version + } else { + path = "/swaggerapi/apis/" + version.Group + "/" + version.Version + } + + body, err := d.Get().AbsPath(path).Do().Raw() + if err != nil { + return nil, err + } + var schema swagger.ApiDeclaration + err = json.Unmarshal(body, &schema) + if err != nil { + return nil, fmt.Errorf("got '%s': %v", string(body), err) + } + return &schema, nil +} + func setDiscoveryDefaults(config *Config) error { - config.Prefix = "" - config.Version = "" + config.APIPath = "" + config.GroupVersion = nil + config.Codec = runtime.NoopEncoder{api.Codecs.UniversalDecoder()} return nil } -// NewDiscoveryClient creates a new DiscoveryClient for the given config. This client +// NewDiscoveryClientForConfig creates a new DiscoveryClient for the given config. This client // can be used to discover supported resources in the API server. -func NewDiscoveryClient(c *Config) (*DiscoveryClient, error) { +func NewDiscoveryClientForConfig(c *Config) (*DiscoveryClient, error) { config := *c if err := setDiscoveryDefaults(&config); err != nil { return nil, err } - transport, err := TransportFor(c) - if err != nil { - return nil, err - } - client := &http.Client{Transport: transport} - baseURL, err := defaultServerUrlFor(c) - return &DiscoveryClient{client, *baseURL}, nil + client, err := UnversionedRESTClientFor(&config) + return &DiscoveryClient{client}, err +} + +// NewDiscoveryClientForConfig creates a new DiscoveryClient for the given config. If +// there is an error, it panics. +func NewDiscoveryClientForConfigOrDie(c *Config) *DiscoveryClient { + client, err := NewDiscoveryClientForConfig(c) + if err != nil { + panic(err) + } + return client + +} + +// New creates a new DiscoveryClient for the given RESTClient. +func NewDiscoveryClient(c *RESTClient) *DiscoveryClient { + return &DiscoveryClient{c} } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/endpoints.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/endpoints.go index 406008324..c58c88a28 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/endpoints.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/endpoints.go @@ -17,11 +17,7 @@ limitations under the License. package unversioned import ( - "fmt" - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -33,11 +29,11 @@ type EndpointsNamespacer interface { // EndpointsInterface has methods to work with Endpoints resources type EndpointsInterface interface { Create(endpoints *api.Endpoints) (*api.Endpoints, error) - List(selector labels.Selector) (*api.EndpointsList, error) + List(opts api.ListOptions) (*api.EndpointsList, error) Get(name string) (*api.Endpoints, error) Delete(name string) error Update(endpoints *api.Endpoints) (*api.Endpoints, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // endpoints implements EndpointsInterface @@ -59,12 +55,12 @@ func (c *endpoints) Create(endpoints *api.Endpoints) (*api.Endpoints, error) { } // List takes a selector, and returns the list of endpoints that match that selector -func (c *endpoints) List(selector labels.Selector) (result *api.EndpointsList, err error) { +func (c *endpoints) List(opts api.ListOptions) (result *api.EndpointsList, err error) { result = &api.EndpointsList{} err = c.r.Get(). Namespace(c.ns). Resource("endpoints"). - LabelsSelectorParam(selector). + VersionedParams(&opts, api.ParameterCodec). Do(). Into(result) return @@ -83,22 +79,17 @@ func (c *endpoints) Delete(name string) error { } // Watch returns a watch.Interface that watches the requested endpoints for a service. -func (c *endpoints) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *endpoints) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). Resource("endpoints"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } func (c *endpoints) Update(endpoints *api.Endpoints) (*api.Endpoints, error) { result := &api.Endpoints{} - if len(endpoints.ResourceVersion) == 0 { - return nil, fmt.Errorf("invalid update object, missing resource version: %v", endpoints) - } err := c.r.Put(). Namespace(c.ns). Resource("endpoints"). diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/endpoints_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/endpoints_test.go index 0c39ec5bc..ef1701585 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/endpoints_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/endpoints_test.go @@ -14,21 +14,25 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "testing" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/labels" ) func TestListEndpoints(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.Default.ResourcePath("endpoints", ns, ""), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, + c := &simple.Client{ + Request: simple.Request{Method: "GET", Path: testapi.Default.ResourcePath("endpoints", ns, ""), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: &api.EndpointsList{ Items: []api.Endpoints{ { @@ -42,26 +46,29 @@ func TestListEndpoints(t *testing.T) { }, }, } - receivedEndpointsList, err := c.Setup(t).Endpoints(ns).List(labels.Everything()) + receivedEndpointsList, err := c.Setup(t).Endpoints(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, receivedEndpointsList, err) } func TestGetEndpoints(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.Default.ResourcePath("endpoints", ns, "endpoint-1"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: &api.Endpoints{ObjectMeta: api.ObjectMeta{Name: "endpoint-1"}}}, + c := &simple.Client{ + Request: simple.Request{Method: "GET", Path: testapi.Default.ResourcePath("endpoints", ns, "endpoint-1"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: &api.Endpoints{ObjectMeta: api.ObjectMeta{Name: "endpoint-1"}}}, } response, err := c.Setup(t).Endpoints(ns).Get("endpoint-1") + defer c.Close() c.Validate(t, response, err) } func TestGetEndpointWithNoName(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{Error: true} + c := &simple.Client{Error: true} receivedPod, err := c.Setup(t).Endpoints(ns).Get("") - if (err != nil) && (err.Error() != nameRequiredError) { - t.Errorf("Expected error: %v, but got %v", nameRequiredError, err) + defer c.Close() + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) } c.Validate(t, receivedPod, err) diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/events.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/events.go index 6094f9773..b882ccdc4 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/events.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/events.go @@ -21,7 +21,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/watch" ) @@ -36,12 +35,14 @@ type EventInterface interface { Create(event *api.Event) (*api.Event, error) Update(event *api.Event) (*api.Event, error) Patch(event *api.Event, data []byte) (*api.Event, error) - List(label labels.Selector, field fields.Selector) (*api.EventList, error) + List(opts api.ListOptions) (*api.EventList, error) Get(name string) (*api.Event, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) // Search finds events about the specified object Search(objOrRef runtime.Object) (*api.EventList, error) Delete(name string) error + // DeleteCollection deletes a collection of events. + DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error // Returns the appropriate field selector based on the API version being used to communicate with the server. // The returned field selector can be used with List and Watch to filter desired events. GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector @@ -71,7 +72,7 @@ func (e *events) Create(event *api.Event) (*api.Event, error) { } result := &api.Event{} err := e.client.Post(). - NamespaceIfScoped(event.Namespace, len(event.Namespace) > 0). + Namespace(event.Namespace). Resource("events"). Body(event). Do(). @@ -85,12 +86,9 @@ func (e *events) Create(event *api.Event) (*api.Event, error) { // created with the "" namespace. Update also requires the ResourceVersion to be set in the event // object. func (e *events) Update(event *api.Event) (*api.Event, error) { - if len(event.ResourceVersion) == 0 { - return nil, fmt.Errorf("invalid event update object, missing resource version: %#v", event) - } result := &api.Event{} err := e.client.Put(). - NamespaceIfScoped(event.Namespace, len(event.Namespace) > 0). + Namespace(event.Namespace). Resource("events"). Name(event.Name). Body(event). @@ -106,7 +104,7 @@ func (e *events) Update(event *api.Event) (*api.Event, error) { func (e *events) Patch(incompleteEvent *api.Event, data []byte) (*api.Event, error) { result := &api.Event{} err := e.client.Patch(api.StrategicMergePatchType). - NamespaceIfScoped(incompleteEvent.Namespace, len(incompleteEvent.Namespace) > 0). + Namespace(incompleteEvent.Namespace). Resource("events"). Name(incompleteEvent.Name). Body(data). @@ -116,13 +114,12 @@ func (e *events) Patch(incompleteEvent *api.Event, data []byte) (*api.Event, err } // List returns a list of events matching the selectors. -func (e *events) List(label labels.Selector, field fields.Selector) (*api.EventList, error) { +func (e *events) List(opts api.ListOptions) (*api.EventList, error) { result := &api.EventList{} err := e.client.Get(). - NamespaceIfScoped(e.namespace, len(e.namespace) > 0). + Namespace(e.namespace). Resource("events"). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Do(). Into(result) return result, err @@ -132,7 +129,7 @@ func (e *events) List(label labels.Selector, field fields.Selector) (*api.EventL func (e *events) Get(name string) (*api.Event, error) { result := &api.Event{} err := e.client.Get(). - NamespaceIfScoped(e.namespace, len(e.namespace) > 0). + Namespace(e.namespace). Resource("events"). Name(name). Do(). @@ -141,14 +138,12 @@ func (e *events) Get(name string) (*api.Event, error) { } // Watch starts watching for events matching the given selectors. -func (e *events) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (e *events) Watch(opts api.ListOptions) (watch.Interface, error) { return e.client.Get(). Prefix("watch"). - NamespaceIfScoped(e.namespace, len(e.namespace) > 0). + Namespace(e.namespace). Resource("events"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } @@ -174,26 +169,37 @@ func (e *events) Search(objOrRef runtime.Object) (*api.EventList, error) { refUID = &stringRefUID } fieldSelector := e.GetFieldSelector(&ref.Name, &ref.Namespace, refKind, refUID) - return e.List(labels.Everything(), fieldSelector) + return e.List(api.ListOptions{FieldSelector: fieldSelector}) } // Delete deletes an existing event. func (e *events) Delete(name string) error { return e.client.Delete(). - NamespaceIfScoped(e.namespace, len(e.namespace) > 0). + Namespace(e.namespace). Resource("events"). Name(name). Do(). Error() } +// DeleteCollection deletes a collection of objects. +func (e *events) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + return e.client.Delete(). + Namespace(e.namespace). + Resource("events"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + // Returns the appropriate field selector based on the API version being used to communicate with the server. // The returned field selector can be used with List and Watch to filter desired events. func (e *events) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector { - apiVersion := e.client.APIVersion() + apiVersion := e.client.APIVersion().String() field := fields.Set{} if involvedObjectName != nil { - field[getInvolvedObjectNameFieldLabel(apiVersion)] = *involvedObjectName + field[GetInvolvedObjectNameFieldLabel(apiVersion)] = *involvedObjectName } if involvedObjectNamespace != nil { field["involvedObject.namespace"] = *involvedObjectNamespace @@ -208,6 +214,6 @@ func (e *events) GetFieldSelector(involvedObjectName, involvedObjectNamespace, i } // Returns the appropriate field label to use for name of the involved object as per the given API version. -func getInvolvedObjectNameFieldLabel(version string) string { +func GetInvolvedObjectNameFieldLabel(version string) string { return "involvedObject.name" } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/events_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/events_test.go index 40ec69963..371c7544e 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/events_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/events_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -24,25 +29,23 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func TestEventSearch(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath("events", "baz", ""), Query: url.Values{ - unversioned.FieldSelectorQueryParam(testapi.Default.Version()): []string{ - getInvolvedObjectNameFieldLabel(testapi.Default.Version()) + "=foo,", + unversioned.FieldSelectorQueryParam(testapi.Default.GroupVersion().String()): []string{ + GetInvolvedObjectNameFieldLabel(testapi.Default.GroupVersion().String()) + "=foo,", "involvedObject.namespace=baz,", "involvedObject.kind=Pod", }, - unversioned.LabelSelectorQueryParam(testapi.Default.Version()): []string{}, + unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()): []string{}, }, }, - Response: Response{StatusCode: 200, Body: &api.EventList{}}, + Response: simple.Response{StatusCode: 200, Body: &api.EventList{}}, } eventList, err := c.Setup(t).Events("baz").Search( &api.Pod{ @@ -53,6 +56,7 @@ func TestEventSearch(t *testing.T) { }, }, ) + defer c.Close() c.Validate(t, eventList, err) } @@ -74,17 +78,19 @@ func TestEventCreate(t *testing.T) { FirstTimestamp: timeStamp, LastTimestamp: timeStamp, Count: 1, + Type: api.EventTypeNormal, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Default.ResourcePath("events", api.NamespaceDefault, ""), Body: event, }, - Response: Response{StatusCode: 200, Body: event}, + Response: simple.Response{StatusCode: 200, Body: event}, } response, err := c.Setup(t).Events(api.NamespaceDefault).Create(event) + defer c.Close() if err != nil { t.Fatalf("%v should be nil.", err) @@ -113,17 +119,19 @@ func TestEventGet(t *testing.T) { FirstTimestamp: timeStamp, LastTimestamp: timeStamp, Count: 1, + Type: api.EventTypeNormal, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath("events", "other", "1"), Body: nil, }, - Response: Response{StatusCode: 200, Body: event}, + Response: simple.Response{StatusCode: 200, Body: event}, } response, err := c.Setup(t).Events("other").Get("1") + defer c.Close() if err != nil { t.Fatalf("%v should be nil.", err) @@ -152,19 +160,20 @@ func TestEventList(t *testing.T) { FirstTimestamp: timeStamp, LastTimestamp: timeStamp, Count: 1, + Type: api.EventTypeNormal, }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath("events", ns, ""), Body: nil, }, - Response: Response{StatusCode: 200, Body: eventList}, + Response: simple.Response{StatusCode: 200, Body: eventList}, } - response, err := c.Setup(t).Events(ns).List(labels.Everything(), - fields.Everything()) + response, err := c.Setup(t).Events(ns).List(api.ListOptions{}) + defer c.Close() if err != nil { t.Errorf("%#v should be nil.", err) @@ -183,13 +192,14 @@ func TestEventList(t *testing.T) { func TestEventDelete(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "DELETE", Path: testapi.Default.ResourcePath("events", ns, "foo"), }, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).Events(ns).Delete("foo") + defer c.Close() c.Validate(t, nil, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/extensions.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/extensions.go index dba43f575..a95bd1b89 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/extensions.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/extensions.go @@ -17,13 +17,9 @@ limitations under the License. package unversioned import ( - "encoding/json" - "fmt" - "strings" - - "k8s.io/kubernetes/pkg/api/latest" - "k8s.io/kubernetes/pkg/api/unversioned" - "k8s.io/kubernetes/pkg/version" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/extensions" ) // Interface holds the experimental methods for clients of Kubernetes @@ -31,13 +27,15 @@ import ( // Features of Extensions group are not supported and may be changed or removed in // incompatible ways at any time. type ExtensionsInterface interface { - VersionInterface HorizontalPodAutoscalersNamespacer ScaleNamespacer DaemonSetsNamespacer DeploymentsNamespacer JobsNamespacer IngressNamespacer + ThirdPartyResourceNamespacer + ReplicaSetsNamespacer + PodSecurityPoliciesInterface } // ExtensionsClient is used to interact with experimental Kubernetes features. @@ -47,33 +45,8 @@ type ExtensionsClient struct { *RESTClient } -// ServerVersion retrieves and parses the server's version. -func (c *ExtensionsClient) ServerVersion() (*version.Info, error) { - body, err := c.Get().AbsPath("/version").Do().Raw() - if err != nil { - return nil, err - } - var info version.Info - err = json.Unmarshal(body, &info) - if err != nil { - return nil, fmt.Errorf("got '%s': %v", string(body), err) - } - return &info, nil -} - -// ServerAPIVersions retrieves and parses the list of experimental API versions the -// server supports. -func (c *ExtensionsClient) ServerAPIVersions() (*unversioned.APIVersions, error) { - body, err := c.Get().UnversionedPath("").Do().Raw() - if err != nil { - return nil, err - } - var v unversioned.APIVersions - err = json.Unmarshal(body, &v) - if err != nil { - return nil, fmt.Errorf("got '%s': %v", string(body), err) - } - return &v, nil +func (c *ExtensionsClient) PodSecurityPolicies() PodSecurityPolicyInterface { + return newPodSecurityPolicy(c) } func (c *ExtensionsClient) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface { @@ -100,6 +73,14 @@ func (c *ExtensionsClient) Ingress(namespace string) IngressInterface { return newIngress(c, namespace) } +func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface { + return newThirdPartyResources(c, namespace) +} + +func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface { + return newReplicaSets(c, namespace) +} + // NewExtensions creates a new ExtensionsClient for the given config. This client // provides access to experimental Kubernetes features. // Features of Extensions group are not supported and may be changed or removed in @@ -130,25 +111,21 @@ func NewExtensionsOrDie(c *Config) *ExtensionsClient { func setExtensionsDefaults(config *Config) error { // if experimental group is not registered, return an error - g, err := latest.Group("extensions") + g, err := registered.Group(extensions.GroupName) if err != nil { return err } - config.Prefix = "apis/" + config.APIPath = defaultAPIPath if config.UserAgent == "" { config.UserAgent = DefaultKubernetesUserAgent() } // TODO: Unconditionally set the config.Version, until we fix the config. //if config.Version == "" { - config.Version = g.GroupVersion + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion //} - versionInterfaces, err := g.InterfacesFor(config.Version) - if err != nil { - return fmt.Errorf("Extensions API version '%s' is not recognized (valid values: %s)", - config.Version, strings.Join(latest.GroupOrDie("extensions").Versions, ", ")) - } - config.Codec = versionInterfaces.Codec + config.Codec = api.Codecs.LegacyCodec(*config.GroupVersion) if config.QPS == 0 { config.QPS = 5 } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/fake/fake.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/fake/fake.go index 8e77910a6..3a314708f 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/fake/fake.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/fake/fake.go @@ -28,15 +28,21 @@ import ( "k8s.io/kubernetes/pkg/runtime" ) -type HTTPClientFunc func(*http.Request) (*http.Response, error) +func CreateHTTPClient(roundTripper func(*http.Request) (*http.Response, error)) *http.Client { + return &http.Client{ + Transport: roundTripperFunc(roundTripper), + } +} -func (f HTTPClientFunc) Do(req *http.Request) (*http.Response, error) { +type roundTripperFunc func(*http.Request) (*http.Response, error) + +func (f roundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error) { return f(req) } // RESTClient provides a fake RESTClient interface. type RESTClient struct { - Client unversioned.HTTPClient + Client *http.Client Codec runtime.Codec Req *http.Request Resp *http.Response @@ -44,29 +50,36 @@ type RESTClient struct { } func (c *RESTClient) Get() *unversioned.Request { - return unversioned.NewRequest(c, "GET", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec) + return c.request("GET") } func (c *RESTClient) Put() *unversioned.Request { - return unversioned.NewRequest(c, "PUT", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec) + return c.request("PUT") } func (c *RESTClient) Patch(_ api.PatchType) *unversioned.Request { - return unversioned.NewRequest(c, "PATCH", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec) + return c.request("PATCH") } func (c *RESTClient) Post() *unversioned.Request { - return unversioned.NewRequest(c, "POST", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec) + return c.request("POST") } func (c *RESTClient) Delete() *unversioned.Request { - return unversioned.NewRequest(c, "DELETE", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec) + return c.request("DELETE") +} + +func (c *RESTClient) request(verb string) *unversioned.Request { + return unversioned.NewRequest(c, verb, &url.URL{Host: "localhost"}, "", unversioned.ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: c.Codec}, nil, nil) } func (c *RESTClient) Do(req *http.Request) (*http.Response, error) { + if c.Err != nil { + return nil, c.Err + } c.Req = req - if c.Client != unversioned.HTTPClient(nil) { + if c.Client != nil { return c.Client.Do(req) } - return c.Resp, c.Err + return c.Resp, nil } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper.go index b217ae07f..507f9a30a 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper.go @@ -28,35 +28,40 @@ import ( "reflect" gruntime "runtime" "strings" - "sync" - "time" "github.com/golang/glog" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/latest" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util/sets" "k8s.io/kubernetes/pkg/version" ) +const ( + legacyAPIPath = "/api" + defaultAPIPath = "/apis" +) + // Config holds the common attributes that can be passed to a Kubernetes client on // initialization. type Config struct { - // Host must be a host string, a host:port pair, or a URL to the base of the API. + // Host must be a host string, a host:port pair, or a URL to the base of the apiserver. + // If a URL is given then the (optional) Path of that URL represents a prefix that must + // be appended to all request URIs used to access the apiserver. This allows a frontend + // proxy to easily relocate all of the apiserver endpoints. Host string + // APIPath is a sub-path that points to an API root. + APIPath string // Prefix is the sub path of the server. If not specified, the client will set // a default value. Use "/" to indicate the server root should be used Prefix string - // Version is the API version to talk to. Must be provided when initializing - // a RESTClient directly. When initializing a Client, will be set with the default - // code version. - Version string - // Codec specifies the encoding and decoding behavior for runtime.Objects passed - // to a RESTClient or Client. Required when initializing a RESTClient, optional - // when initializing a Client. - Codec runtime.Codec + + // ContentConfig contains settings that affect how objects are transformed when + // sent to the server. + ContentConfig // Server requires Basic authentication Username string @@ -94,24 +99,6 @@ type Config struct { Burst int } -type KubeletConfig struct { - // ToDo: Add support for different kubelet instances exposing different ports - Port uint - EnableHttps bool - - // TLSClientConfig contains settings to enable transport layer security - TLSClientConfig - - // Server requires Bearer authentication - BearerToken string - - // HTTPTimeout is used by the client to timeout http requests to Kubelet. - HTTPTimeout time.Duration - - // Dial is a custom dialer used for the client - Dial func(net, addr string) (net.Conn, error) -} - // TLSClientConfig contains settings to enable transport layer security type TLSClientConfig struct { // Server requires TLS client certificate authentication @@ -132,6 +119,22 @@ type TLSClientConfig struct { CAData []byte } +type ContentConfig struct { + // ContentType specifies the wire format used to communicate with the server. + // This value will be set as the Accept header on requests made to the server, and + // as the default content type on any object sent to the server. If not set, + // "application/json" is used. + ContentType string + // GroupVersion is the API version to talk to. Must be provided when initializing + // a RESTClient directly. When initializing a Client, will be set with the default + // code version. + GroupVersion *unversioned.GroupVersion + // Codec specifies the encoding and decoding behavior for runtime.Objects passed + // to a RESTClient or Client. Required when initializing a RESTClient, optional + // when initializing a Client. + Codec runtime.Codec +} + // New creates a Kubernetes client for the given config. This client works with pods, // replication controllers, daemons, and services. It allows operations such as list, get, update // and delete on these objects. An error is returned if the provided configuration @@ -147,12 +150,12 @@ func New(c *Config) (*Client, error) { } discoveryConfig := *c - discoveryClient, err := NewDiscoveryClient(&discoveryConfig) + discoveryClient, err := NewDiscoveryClientForConfig(&discoveryConfig) if err != nil { return nil, err } - if _, err := latest.Group("extensions"); err != nil { + if _, err := registered.Group(extensions.GroupName); err != nil { return &Client{RESTClient: client, ExtensionsClient: nil, DiscoveryClient: discoveryClient}, nil } experimentalConfig := *c @@ -176,7 +179,7 @@ func MatchesServerVersion(client *Client, c *Config) error { } } clientVersion := version.Get() - serverVersion, err := client.ServerVersion() + serverVersion, err := client.Discovery().ServerVersion() if err != nil { return fmt.Errorf("couldn't read version from server: %v\n", err) } @@ -187,7 +190,7 @@ func MatchesServerVersion(client *Client, c *Config) error { return nil } -func extractGroupVersions(l *unversioned.APIGroupList) []string { +func ExtractGroupVersions(l *unversioned.APIGroupList) []string { var groupVersions []string for _, g := range l.Groups { for _, gv := range g.Versions { @@ -199,7 +202,7 @@ func extractGroupVersions(l *unversioned.APIGroupList) []string { // ServerAPIVersions returns the GroupVersions supported by the API server. // It creates a RESTClient based on the passed in config, but it doesn't rely -// on the Version, Codec, and Prefix of the config, because it uses AbsPath and +// on the Version and Codec of the config, because it uses AbsPath and // takes the raw response. func ServerAPIVersions(c *Config) (groupVersions []string, err error) { transport, err := TransportFor(c) @@ -209,14 +212,15 @@ func ServerAPIVersions(c *Config) (groupVersions []string, err error) { client := http.Client{Transport: transport} configCopy := *c - configCopy.Version = "" - configCopy.Prefix = "" - baseURL, err := defaultServerUrlFor(c) + configCopy.GroupVersion = nil + configCopy.APIPath = "" + baseURL, _, err := defaultServerUrlFor(&configCopy) if err != nil { return nil, err } // Get the groupVersions exposed at /api - baseURL.Path = "/api" + originalPath := baseURL.Path + baseURL.Path = path.Join(originalPath, legacyAPIPath) resp, err := client.Get(baseURL.String()) if err != nil { return nil, err @@ -230,7 +234,7 @@ func ServerAPIVersions(c *Config) (groupVersions []string, err error) { groupVersions = append(groupVersions, v.Versions...) // Get the groupVersions exposed at /apis - baseURL.Path = "/apis" + baseURL.Path = path.Join(originalPath, defaultAPIPath) resp2, err := client.Get(baseURL.String()) if err != nil { return nil, err @@ -241,7 +245,7 @@ func ServerAPIVersions(c *Config) (groupVersions []string, err error) { if err != nil { return nil, fmt.Errorf("unexpected error: %v", err) } - groupVersions = append(groupVersions, extractGroupVersions(&apiGroupList)...) + groupVersions = append(groupVersions, ExtractGroupVersions(&apiGroupList)...) return groupVersions, nil } @@ -255,48 +259,60 @@ func ServerAPIVersions(c *Config) (groupVersions []string, err error) { // stderr and try client's registered versions in order of preference. // - If version is config default, and the server does not support it, // return an error. -func NegotiateVersion(client *Client, c *Config, version string, clientRegisteredVersions []string) (string, error) { +func NegotiateVersion(client *Client, c *Config, requestedGV *unversioned.GroupVersion, clientRegisteredGVs []unversioned.GroupVersion) (*unversioned.GroupVersion, error) { var err error if client == nil { client, err = New(c) if err != nil { - return "", err + return nil, err } } clientVersions := sets.String{} - for _, v := range clientRegisteredVersions { - clientVersions.Insert(v) + for _, gv := range clientRegisteredGVs { + clientVersions.Insert(gv.String()) } - apiVersions, err := client.ServerAPIVersions() + groups, err := client.ServerGroups() if err != nil { - return "", fmt.Errorf("couldn't read version from server: %v", err) + // This is almost always a connection error, and higher level code should treat this as a generic error, + // not a negotiation specific error. + return nil, err } + versions := ExtractGroupVersions(groups) serverVersions := sets.String{} - for _, v := range apiVersions.Versions { + for _, v := range versions { serverVersions.Insert(v) } + // If no version requested, use config version (may also be empty). - if len(version) == 0 { - version = c.Version + // make a copy of the original so we don't risk mutating input here or in the returned value + var preferredGV *unversioned.GroupVersion + switch { + case requestedGV != nil: + t := *requestedGV + preferredGV = &t + case c.GroupVersion != nil: + t := *c.GroupVersion + preferredGV = &t } + // If version explicitly requested verify that both client and server support it. // If server does not support warn, but try to negotiate a lower version. - if len(version) != 0 { - if !clientVersions.Has(version) { - return "", fmt.Errorf("Client does not support API version '%s'. Client supported API versions: %v", version, clientVersions) + if preferredGV != nil { + if !clientVersions.Has(preferredGV.String()) { + return nil, fmt.Errorf("client does not support API version %q; client supported API versions: %v", preferredGV, clientVersions) } - if serverVersions.Has(version) { - return version, nil + if serverVersions.Has(preferredGV.String()) { + return preferredGV, nil } // If we are using an explicit config version the server does not support, fail. - if version == c.Version { - return "", fmt.Errorf("Server does not support API version '%s'.", version) + if (c.GroupVersion != nil) && (*preferredGV == *c.GroupVersion) { + return nil, fmt.Errorf("server does not support API version %q", preferredGV) } } - for _, clientVersion := range clientRegisteredVersions { - if serverVersions.Has(clientVersion) { + for _, clientGV := range clientRegisteredGVs { + if serverVersions.Has(clientGV.String()) { // Version was not explicitly requested in command config (--api-version). // Ok to fall back to a supported version with a warning. // TODO: caesarxuchao: enable the warning message when we have @@ -304,11 +320,12 @@ func NegotiateVersion(client *Client, c *Config, version string, clientRegistere // if len(version) != 0 { // glog.Warningf("Server does not support API version '%s'. Falling back to '%s'.", version, clientVersion) // } - return clientVersion, nil + t := clientGV + return &t, nil } } - return "", fmt.Errorf("Failed to negotiate an api version. Server supports: %v. Client supports: %v.", - serverVersions, clientRegisteredVersions) + return nil, fmt.Errorf("failed to negotiate an api version; server supports: %v, client supports: %v", + serverVersions, clientVersions) } // NewOrDie creates a Kubernetes client and panics if the provided API version is not recognized. @@ -325,6 +342,11 @@ func NewOrDie(c *Config) *Client { // running inside a pod running on kuberenetes. It will return an error if // called from a process not running in a kubernetes environment. func InClusterConfig() (*Config, error) { + host, port := os.Getenv("KUBERNETES_SERVICE_HOST"), os.Getenv("KUBERNETES_SERVICE_PORT") + if len(host) == 0 || len(port) == 0 { + return nil, fmt.Errorf("unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined") + } + token, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/" + api.ServiceAccountTokenKey) if err != nil { return nil, err @@ -339,7 +361,7 @@ func InClusterConfig() (*Config, error) { return &Config{ // TODO: switch to using cluster DNS. - Host: "https://" + net.JoinHostPort(os.Getenv("KUBERNETES_SERVICE_HOST"), os.Getenv("KUBERNETES_SERVICE_PORT")), + Host: "https://" + net.JoinHostPort(host, port), BearerToken: string(token), TLSClientConfig: tlsClientConfig, }, nil @@ -358,22 +380,21 @@ func NewInCluster() (*Client, error) { // Kubernetes API or returns an error if any of the defaults are impossible or invalid. // TODO: this method needs to be split into one that sets defaults per group, expected to be fix in PR "Refactoring clientcache.go and helper.go #14592" func SetKubernetesDefaults(config *Config) error { - if config.Prefix == "" { - config.Prefix = "/api" + if config.APIPath == "" { + config.APIPath = legacyAPIPath } if len(config.UserAgent) == 0 { config.UserAgent = DefaultKubernetesUserAgent() } - if len(config.Version) == 0 { - config.Version = defaultVersionFor(config) - } - version := config.Version - versionInterfaces, err := latest.GroupOrDie("").InterfacesFor(version) + g, err := registered.Group(api.GroupName) if err != nil { - return fmt.Errorf("API version '%s' is not recognized (valid values: %s)", version, strings.Join(latest.GroupOrDie("").Versions, ", ")) + return err } + // TODO: Unconditionally set the config.Version, until we fix the config. + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion if config.Codec == nil { - config.Codec = versionInterfaces.Codec + config.Codec = api.Codecs.LegacyCodec(*config.GroupVersion) } if config.QPS == 0.0 { config.QPS = 5.0 @@ -389,160 +410,76 @@ func SetKubernetesDefaults(config *Config) error { // A RESTClient created by this method is generic - it expects to operate on an API that follows // the Kubernetes conventions, but may not be the Kubernetes API. func RESTClientFor(config *Config) (*RESTClient, error) { - if len(config.Version) == 0 { - return nil, fmt.Errorf("version is required when initializing a RESTClient") + if config.GroupVersion == nil { + return nil, fmt.Errorf("GroupVersion is required when initializing a RESTClient") } if config.Codec == nil { return nil, fmt.Errorf("Codec is required when initializing a RESTClient") } - baseURL, err := defaultServerUrlFor(config) + baseURL, versionedAPIPath, err := defaultServerUrlFor(config) if err != nil { return nil, err } - client := NewRESTClient(baseURL, config.Version, config.Codec, config.QPS, config.Burst) - transport, err := TransportFor(config) if err != nil { return nil, err } + var httpClient *http.Client if transport != http.DefaultTransport { - client.Client = &http.Client{Transport: transport} + httpClient = &http.Client{Transport: transport} } + + client := NewRESTClient(baseURL, versionedAPIPath, config.ContentConfig, config.QPS, config.Burst, httpClient) + return client, nil } -var ( - // tlsTransports stores reusable round trippers with custom TLSClientConfig options - tlsTransports = map[string]*http.Transport{} +// UnversionedRESTClientFor is the same as RESTClientFor, except that it allows +// the config.Version to be empty. +func UnversionedRESTClientFor(config *Config) (*RESTClient, error) { + if config.Codec == nil { + return nil, fmt.Errorf("Codec is required when initializing a RESTClient") + } - // tlsTransportLock protects retrieval and storage of round trippers into the tlsTransports map - tlsTransportLock sync.Mutex -) - -// tlsTransportFor returns a http.RoundTripper for the given config, or an error -// The same RoundTripper will be returned for configs with identical TLS options -// If the config has no custom TLS options, http.DefaultTransport is returned -func tlsTransportFor(config *Config) (http.RoundTripper, error) { - // Get a unique key for the TLS options in the config - key, err := tlsConfigKey(config) + baseURL, versionedAPIPath, err := defaultServerUrlFor(config) if err != nil { return nil, err } - // Ensure we only create a single transport for the given TLS options - tlsTransportLock.Lock() - defer tlsTransportLock.Unlock() - - // See if we already have a custom transport for this config - if cachedTransport, ok := tlsTransports[key]; ok { - return cachedTransport, nil - } - - // Get the TLS options for this client config - tlsConfig, err := TLSConfigFor(config) - if err != nil { - return nil, err - } - // The options didn't require a custom TLS config - if tlsConfig == nil { - return http.DefaultTransport, nil - } - - // Cache a single transport for these options - tlsTransports[key] = util.SetTransportDefaults(&http.Transport{ - TLSClientConfig: tlsConfig, - }) - return tlsTransports[key], nil -} - -// TransportFor returns an http.RoundTripper that will provide the authentication -// or transport level security defined by the provided Config. Will return the -// default http.DefaultTransport if no special case behavior is needed. -func TransportFor(config *Config) (http.RoundTripper, error) { - hasCA := len(config.CAFile) > 0 || len(config.CAData) > 0 - hasCert := len(config.CertFile) > 0 || len(config.CertData) > 0 - - // Set transport level security - if config.Transport != nil && (hasCA || hasCert || config.Insecure) { - return nil, fmt.Errorf("using a custom transport with TLS certificate options or the insecure flag is not allowed") - } - - var ( - transport http.RoundTripper - err error - ) - - if config.Transport != nil { - transport = config.Transport - } else { - transport, err = tlsTransportFor(config) - if err != nil { - return nil, err - } - } - - // Call wrap prior to adding debugging wrappers - if config.WrapTransport != nil { - transport = config.WrapTransport(transport) - } - - switch { - case bool(glog.V(9)): - transport = NewDebuggingRoundTripper(transport, CurlCommand, URLTiming, ResponseHeaders) - case bool(glog.V(8)): - transport = NewDebuggingRoundTripper(transport, JustURL, RequestHeaders, ResponseStatus, ResponseHeaders) - case bool(glog.V(7)): - transport = NewDebuggingRoundTripper(transport, JustURL, RequestHeaders, ResponseStatus) - case bool(glog.V(6)): - transport = NewDebuggingRoundTripper(transport, URLTiming) - } - - transport, err = HTTPWrappersForConfig(config, transport) + transport, err := TransportFor(config) if err != nil { return nil, err } - // TODO: use the config context to wrap a transport + var httpClient *http.Client + if transport != http.DefaultTransport { + httpClient = &http.Client{Transport: transport} + } - return transport, nil -} + versionConfig := config.ContentConfig + if versionConfig.GroupVersion == nil { + v := unversioned.SchemeGroupVersion + versionConfig.GroupVersion = &v + } -// HTTPWrappersForConfig wraps a round tripper with any relevant layered behavior from the -// config. Exposed to allow more clients that need HTTP-like behavior but then must hijack -// the underlying connection (like WebSocket or HTTP2 clients). Pure HTTP clients should use -// the higher level TransportFor or RESTClientFor methods. -func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error) { - // Set authentication wrappers - hasBasicAuth := config.Username != "" || config.Password != "" - if hasBasicAuth && config.BearerToken != "" { - return nil, fmt.Errorf("username/password or bearer token may be set, but not both") - } - switch { - case config.BearerToken != "": - rt = NewBearerAuthRoundTripper(config.BearerToken, rt) - case hasBasicAuth: - rt = NewBasicAuthRoundTripper(config.Username, config.Password, rt) - } - if len(config.UserAgent) > 0 { - rt = NewUserAgentRoundTripper(config.UserAgent, rt) - } - return rt, nil + client := NewRESTClient(baseURL, versionedAPIPath, versionConfig, config.QPS, config.Burst, httpClient) + return client, nil } // DefaultServerURL converts a host, host:port, or URL string to the default base server API path // to use with a Client at a given API version following the standard conventions for a // Kubernetes API. -func DefaultServerURL(host, prefix, version string, defaultTLS bool) (*url.URL, error) { +func DefaultServerURL(host, apiPath string, groupVersion unversioned.GroupVersion, defaultTLS bool) (*url.URL, string, error) { if host == "" { - return nil, fmt.Errorf("host must be a URL or a host:port pair") + return nil, "", fmt.Errorf("host must be a URL or a host:port pair") } base := host hostURL, err := url.Parse(base) if err != nil { - return nil, err + return nil, "", err } if hostURL.Scheme == "" { scheme := "http://" @@ -551,26 +488,34 @@ func DefaultServerURL(host, prefix, version string, defaultTLS bool) (*url.URL, } hostURL, err = url.Parse(scheme + base) if err != nil { - return nil, err + return nil, "", err } if hostURL.Path != "" && hostURL.Path != "/" { - return nil, fmt.Errorf("host must be a URL or a host:port pair: %q", base) + return nil, "", fmt.Errorf("host must be a URL or a host:port pair: %q", base) } } - // If the user specified a URL without a path component (http://server.com), automatically - // append the default prefix - if hostURL.Path == "" { - if prefix == "" { - prefix = "/" - } - hostURL.Path = prefix - } + // hostURL.Path is optional; a non-empty Path is treated as a prefix that is to be applied to + // all URIs used to access the host. this is useful when there's a proxy in front of the + // apiserver that has relocated the apiserver endpoints, forwarding all requests from, for + // example, /a/b/c to the apiserver. in this case the Path should be /a/b/c. + // + // if running without a frontend proxy (that changes the location of the apiserver), then + // hostURL.Path should be blank. + // + // versionedAPIPath, a path relative to baseURL.Path, points to a versioned API base + versionedAPIPath := path.Join("/", apiPath) // Add the version to the end of the path - hostURL.Path = path.Join(hostURL.Path, version) + if len(groupVersion.Group) > 0 { + versionedAPIPath = path.Join(versionedAPIPath, groupVersion.Group, groupVersion.Version) - return hostURL, nil + } else { + versionedAPIPath = path.Join(versionedAPIPath, groupVersion.Version) + + } + + return hostURL, versionedAPIPath, nil } // IsConfigTransportTLS returns true if and only if the provided config will result in a protected @@ -582,9 +527,9 @@ func DefaultServerURL(host, prefix, version string, defaultTLS bool) (*url.URL, func IsConfigTransportTLS(config Config) bool { // determination of TLS transport does not logically require a version to be specified // modify the copy of the config we got to satisfy preconditions for defaultServerUrlFor - config.Version = defaultVersionFor(&config) + config.GroupVersion = defaultVersionFor(&config) - baseURL, err := defaultServerUrlFor(&config) + baseURL, _, err := defaultServerUrlFor(&config) if err != nil { return false } @@ -593,7 +538,7 @@ func IsConfigTransportTLS(config Config) bool { // defaultServerUrlFor is shared between IsConfigTransportTLS and RESTClientFor. It // requires Host and Version to be set prior to being called. -func defaultServerUrlFor(config *Config) (*url.URL, error) { +func defaultServerUrlFor(config *Config) (*url.URL, string, error) { // TODO: move the default to secure when the apiserver supports TLS by default // config.Insecure is taken to mean "I want HTTPS but don't bother checking the certs against a CA." hasCA := len(config.CAFile) != 0 || len(config.CAData) != 0 @@ -603,18 +548,24 @@ func defaultServerUrlFor(config *Config) (*url.URL, error) { if host == "" { host = "localhost" } - return DefaultServerURL(host, config.Prefix, config.Version, defaultTLS) + + if config.GroupVersion != nil { + return DefaultServerURL(host, config.APIPath, *config.GroupVersion, defaultTLS) + } + return DefaultServerURL(host, config.APIPath, unversioned.GroupVersion{}, defaultTLS) } -// defaultVersionFor is shared between defaultServerUrlFor and RESTClientFor -func defaultVersionFor(config *Config) string { - version := config.Version - if version == "" { +// defaultVersionFor is shared between IsConfigTransportTLS and RESTClientFor +func defaultVersionFor(config *Config) *unversioned.GroupVersion { + if config.GroupVersion == nil { // Clients default to the preferred code API version // TODO: implement version negotiation (highest version supported by server) - version = latest.GroupOrDie("").Version + // TODO this drops out when groupmeta is refactored + copyGroupVersion := registered.GroupOrDie(api.GroupName).GroupVersion + return ©GroupVersion } - return version + + return config.GroupVersion } // DefaultKubernetesUserAgent returns the default user agent that clients can use. @@ -631,3 +582,47 @@ func DefaultKubernetesUserAgent() string { version = seg[0] return fmt.Sprintf("%s/%s (%s/%s) kubernetes/%s", path.Base(os.Args[0]), version, gruntime.GOOS, gruntime.GOARCH, commit) } + +// LoadTLSFiles copies the data from the CertFile, KeyFile, and CAFile fields into the CertData, +// KeyData, and CAFile fields, or returns an error. If no error is returned, all three fields are +// either populated or were empty to start. +func LoadTLSFiles(c *Config) error { + var err error + c.CAData, err = dataFromSliceOrFile(c.CAData, c.CAFile) + if err != nil { + return err + } + + c.CertData, err = dataFromSliceOrFile(c.CertData, c.CertFile) + if err != nil { + return err + } + + c.KeyData, err = dataFromSliceOrFile(c.KeyData, c.KeyFile) + if err != nil { + return err + } + return nil +} + +// dataFromSliceOrFile returns data from the slice (if non-empty), or from the file, +// or an error if an error occurred reading the file +func dataFromSliceOrFile(data []byte, file string) ([]byte, error) { + if len(data) > 0 { + return data, nil + } + if len(file) > 0 { + fileData, err := ioutil.ReadFile(file) + if err != nil { + return []byte{}, err + } + return fileData, nil + } + return nil, nil +} + +func AddUserAgent(config *Config, userAgent string) *Config { + fullUserAgent := DefaultKubernetesUserAgent() + "/" + userAgent + config.UserAgent = fullUserAgent + return config +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper_blackbox_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper_blackbox_test.go index 33f54871f..5d497d503 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper_blackbox_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper_blackbox_test.go @@ -19,12 +19,15 @@ package unversioned_test import ( "bytes" "encoding/json" + "errors" "io" "io/ioutil" "net/http" + "strings" "testing" "k8s.io/kubernetes/pkg/api/testapi" + uapi "k8s.io/kubernetes/pkg/api/unversioned" unversionedapi "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/fake" @@ -40,47 +43,52 @@ func objBody(object interface{}) io.ReadCloser { func TestNegotiateVersion(t *testing.T) { tests := []struct { - name, version, expectedVersion string - serverVersions []string - clientVersions []string - config *unversioned.Config - expectErr bool + name string + version *uapi.GroupVersion + expectedVersion *uapi.GroupVersion + serverVersions []string + clientVersions []uapi.GroupVersion + config *unversioned.Config + expectErr func(err error) bool + sendErr error }{ { name: "server supports client default", - version: "version1", + version: &uapi.GroupVersion{Version: "version1"}, config: &unversioned.Config{}, - serverVersions: []string{"version1", testapi.Default.Version()}, - clientVersions: []string{"version1", testapi.Default.Version()}, - expectedVersion: "version1", - expectErr: false, + serverVersions: []string{"version1", testapi.Default.GroupVersion().String()}, + clientVersions: []uapi.GroupVersion{{Version: "version1"}, *testapi.Default.GroupVersion()}, + expectedVersion: &uapi.GroupVersion{Version: "version1"}, }, { name: "server falls back to client supported", - version: testapi.Default.Version(), + version: testapi.Default.GroupVersion(), config: &unversioned.Config{}, serverVersions: []string{"version1"}, - clientVersions: []string{"version1", testapi.Default.Version()}, - expectedVersion: "version1", - expectErr: false, + clientVersions: []uapi.GroupVersion{{Version: "version1"}, *testapi.Default.GroupVersion()}, + expectedVersion: &uapi.GroupVersion{Version: "version1"}, }, { name: "explicit version supported", - version: "", - config: &unversioned.Config{Version: testapi.Default.Version()}, - serverVersions: []string{"version1", testapi.Default.Version()}, - clientVersions: []string{"version1", testapi.Default.Version()}, - expectedVersion: testapi.Default.Version(), - expectErr: false, + config: &unversioned.Config{ContentConfig: unversioned.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}}, + serverVersions: []string{"/version1", testapi.Default.GroupVersion().String()}, + clientVersions: []uapi.GroupVersion{{Version: "version1"}, *testapi.Default.GroupVersion()}, + expectedVersion: testapi.Default.GroupVersion(), }, { - name: "explicit version not supported", - version: "", - config: &unversioned.Config{Version: testapi.Default.Version()}, - serverVersions: []string{"version1"}, - clientVersions: []string{"version1", testapi.Default.Version()}, - expectedVersion: "", - expectErr: true, + name: "explicit version not supported", + config: &unversioned.Config{ContentConfig: unversioned.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}}, + serverVersions: []string{"version1"}, + clientVersions: []uapi.GroupVersion{{Version: "version1"}, *testapi.Default.GroupVersion()}, + expectErr: func(err error) bool { return strings.Contains(err.Error(), `server does not support API version "v1"`) }, + }, + { + name: "connection refused error", + config: &unversioned.Config{ContentConfig: unversioned.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}}, + serverVersions: []string{"version1"}, + clientVersions: []uapi.GroupVersion{{Version: "version1"}, *testapi.Default.GroupVersion()}, + sendErr: errors.New("connection refused"), + expectErr: func(err error) bool { return strings.Contains(err.Error(), "connection refused") }, }, } codec := testapi.Default.Codec() @@ -92,21 +100,27 @@ func TestNegotiateVersion(t *testing.T) { StatusCode: 200, Body: objBody(&unversionedapi.APIVersions{Versions: test.serverVersions}), }, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + if test.sendErr != nil { + return nil, test.sendErr + } return &http.Response{StatusCode: 200, Body: objBody(&unversionedapi.APIVersions{Versions: test.serverVersions})}, nil }), } c := unversioned.NewOrDie(test.config) - c.Client = fakeClient.Client + c.DiscoveryClient.Client = fakeClient.Client response, err := unversioned.NegotiateVersion(c, test.config, test.version, test.clientVersions) - if err == nil && test.expectErr { + if err == nil && test.expectErr != nil { t.Errorf("expected error, got nil for [%s].", test.name) } - if err != nil && !test.expectErr { - t.Errorf("unexpected error for [%s]: %v.", test.name, err) + if err != nil { + if test.expectErr == nil || !test.expectErr(err) { + t.Errorf("unexpected error for [%s]: %v.", test.name, err) + } + continue } - if response != test.expectedVersion { - t.Errorf("expected version %s, got %s.", test.expectedVersion, response) + if *response != *test.expectedVersion { + t.Errorf("%s: expected version %s, got %s.", test.name, test.expectedVersion, response) } } } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper_test.go index fe4365245..2d565afc2 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/helper_test.go @@ -20,256 +20,16 @@ import ( "encoding/json" "net/http" "net/http/httptest" + "path" "reflect" "strings" "testing" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" ) -const ( - rootCACert = `-----BEGIN CERTIFICATE----- -MIIC4DCCAcqgAwIBAgIBATALBgkqhkiG9w0BAQswIzEhMB8GA1UEAwwYMTAuMTMu -MTI5LjEwNkAxNDIxMzU5MDU4MB4XDTE1MDExNTIxNTczN1oXDTE2MDExNTIxNTcz -OFowIzEhMB8GA1UEAwwYMTAuMTMuMTI5LjEwNkAxNDIxMzU5MDU4MIIBIjANBgkq -hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAunDRXGwsiYWGFDlWH6kjGun+PshDGeZX -xtx9lUnL8pIRWH3wX6f13PO9sktaOWW0T0mlo6k2bMlSLlSZgG9H6og0W6gLS3vq -s4VavZ6DbXIwemZG2vbRwsvR+t4G6Nbwelm6F8RFnA1Fwt428pavmNQ/wgYzo+T1 -1eS+HiN4ACnSoDSx3QRWcgBkB1g6VReofVjx63i0J+w8Q/41L9GUuLqquFxu6ZnH -60vTB55lHgFiDLjA1FkEz2dGvGh/wtnFlRvjaPC54JH2K1mPYAUXTreoeJtLJKX0 -ycoiyB24+zGCniUmgIsmQWRPaOPircexCp1BOeze82BT1LCZNTVaxQIDAQABoyMw -ITAOBgNVHQ8BAf8EBAMCAKQwDwYDVR0TAQH/BAUwAwEB/zALBgkqhkiG9w0BAQsD -ggEBADMxsUuAFlsYDpF4fRCzXXwrhbtj4oQwcHpbu+rnOPHCZupiafzZpDu+rw4x -YGPnCb594bRTQn4pAu3Ac18NbLD5pV3uioAkv8oPkgr8aUhXqiv7KdDiaWm6sbAL -EHiXVBBAFvQws10HMqMoKtO8f1XDNAUkWduakR/U6yMgvOPwS7xl0eUTqyRB6zGb -K55q2dejiFWaFqB/y78txzvz6UlOZKE44g2JAVoJVM6kGaxh33q8/FmrL4kuN3ut -W+MmJCVDvd4eEqPwbp7146ZWTqpIJ8lvA6wuChtqV8lhAPka2hD/LMqY8iXNmfXD -uml0obOEy+ON91k+SWTJ3ggmF/U= ------END CERTIFICATE-----` - - certData = `-----BEGIN CERTIFICATE----- -MIIC6jCCAdSgAwIBAgIBCzALBgkqhkiG9w0BAQswIzEhMB8GA1UEAwwYMTAuMTMu -MTI5LjEwNkAxNDIxMzU5MDU4MB4XDTE1MDExNTIyMDEzMVoXDTE2MDExNTIyMDEz -MlowGzEZMBcGA1UEAxMQb3BlbnNoaWZ0LWNsaWVudDCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBAKtdhz0+uCLXw5cSYns9rU/XifFSpb/x24WDdrm72S/v -b9BPYsAStiP148buylr1SOuNi8sTAZmlVDDIpIVwMLff+o2rKYDicn9fjbrTxTOj -lI4pHJBH+JU3AJ0tbajupioh70jwFS0oYpwtneg2zcnE2Z4l6mhrj2okrc5Q1/X2 -I2HChtIU4JYTisObtin10QKJX01CLfYXJLa8upWzKZ4/GOcHG+eAV3jXWoXidtjb -1Usw70amoTZ6mIVCkiu1QwCoa8+ycojGfZhvqMsAp1536ZcCul+Na+AbCv4zKS7F -kQQaImVrXdUiFansIoofGlw/JNuoKK6ssVpS5Ic3pgcCAwEAAaM1MDMwDgYDVR0P -AQH/BAQDAgCgMBMGA1UdJQQMMAoGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwCwYJ -KoZIhvcNAQELA4IBAQCKLREH7bXtXtZ+8vI6cjD7W3QikiArGqbl36bAhhWsJLp/ -p/ndKz39iFNaiZ3GlwIURWOOKx3y3GA0x9m8FR+Llthf0EQ8sUjnwaknWs0Y6DQ3 -jjPFZOpV3KPCFrdMJ3++E3MgwFC/Ih/N2ebFX9EcV9Vcc6oVWMdwT0fsrhu683rq -6GSR/3iVX1G/pmOiuaR0fNUaCyCfYrnI4zHBDgSfnlm3vIvN2lrsR/DQBakNL8DJ -HBgKxMGeUPoneBv+c8DMXIL0EhaFXRlBv9QW45/GiAIOuyFJ0i6hCtGZpJjq4OpQ -BRjCI+izPzFTjsxD4aORE+WOkyWFCGPWKfNejfw0 ------END CERTIFICATE-----` - - keyData = `-----BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAq12HPT64ItfDlxJiez2tT9eJ8VKlv/HbhYN2ubvZL+9v0E9i -wBK2I/Xjxu7KWvVI642LyxMBmaVUMMikhXAwt9/6jaspgOJyf1+NutPFM6OUjikc -kEf4lTcAnS1tqO6mKiHvSPAVLShinC2d6DbNycTZniXqaGuPaiStzlDX9fYjYcKG -0hTglhOKw5u2KfXRAolfTUIt9hcktry6lbMpnj8Y5wcb54BXeNdaheJ22NvVSzDv -RqahNnqYhUKSK7VDAKhrz7JyiMZ9mG+oywCnXnfplwK6X41r4BsK/jMpLsWRBBoi -ZWtd1SIVqewiih8aXD8k26gorqyxWlLkhzemBwIDAQABAoIBAD2XYRs3JrGHQUpU -FkdbVKZkvrSY0vAZOqBTLuH0zUv4UATb8487anGkWBjRDLQCgxH+jucPTrztekQK -aW94clo0S3aNtV4YhbSYIHWs1a0It0UdK6ID7CmdWkAj6s0T8W8lQT7C46mWYVLm -5mFnCTHi6aB42jZrqmEpC7sivWwuU0xqj3Ml8kkxQCGmyc9JjmCB4OrFFC8NNt6M -ObvQkUI6Z3nO4phTbpxkE1/9dT0MmPIF7GhHVzJMS+EyyRYUDllZ0wvVSOM3qZT0 -JMUaBerkNwm9foKJ1+dv2nMKZZbJajv7suUDCfU44mVeaEO+4kmTKSGCGjjTBGkr -7L1ySDECgYEA5ElIMhpdBzIivCuBIH8LlUeuzd93pqssO1G2Xg0jHtfM4tz7fyeI -cr90dc8gpli24dkSxzLeg3Tn3wIj/Bu64m2TpZPZEIlukYvgdgArmRIPQVxerYey -OkrfTNkxU1HXsYjLCdGcGXs5lmb+K/kuTcFxaMOs7jZi7La+jEONwf8CgYEAwCs/ -rUOOA0klDsWWisbivOiNPII79c9McZCNBqncCBfMUoiGe8uWDEO4TFHN60vFuVk9 -8PkwpCfvaBUX+ajvbafIfHxsnfk1M04WLGCeqQ/ym5Q4sQoQOcC1b1y9qc/xEWfg -nIUuia0ukYRpl7qQa3tNg+BNFyjypW8zukUAC/kCgYB1/Kojuxx5q5/oQVPrx73k -2bevD+B3c+DYh9MJqSCNwFtUpYIWpggPxoQan4LwdsmO0PKzocb/ilyNFj4i/vII -NToqSc/WjDFpaDIKyuu9oWfhECye45NqLWhb/6VOuu4QA/Nsj7luMhIBehnEAHW+ -GkzTKM8oD1PxpEG3nPKXYQKBgQC6AuMPRt3XBl1NkCrpSBy/uObFlFaP2Enpf39S -3OZ0Gv0XQrnSaL1kP8TMcz68rMrGX8DaWYsgytstR4W+jyy7WvZwsUu+GjTJ5aMG -77uEcEBpIi9CBzivfn7hPccE8ZgqPf+n4i6q66yxBJflW5xhvafJqDtW2LcPNbW/ -bvzdmQKBgExALRUXpq+5dbmkdXBHtvXdRDZ6rVmrnjy4nI5bPw+1GqQqk6uAR6B/ -F6NmLCQOO4PDG/cuatNHIr2FrwTmGdEL6ObLUGWn9Oer9gJhHVqqsY5I4sEPo4XX -stR0Yiw0buV6DL/moUO0HIM9Bjh96HJp+LxiIS6UCdIhMPp5HoQa ------END RSA PRIVATE KEY-----` -) - -func TestTransportFor(t *testing.T) { - testCases := map[string]struct { - Config *Config - Err bool - TLS bool - Default bool - }{ - "default transport": { - Default: true, - Config: &Config{}, - }, - - "ca transport": { - TLS: true, - Config: &Config{ - TLSClientConfig: TLSClientConfig{ - CAData: []byte(rootCACert), - }, - }, - }, - "bad ca file transport": { - Err: true, - Config: &Config{ - TLSClientConfig: TLSClientConfig{ - CAFile: "invalid file", - }, - }, - }, - "ca data overriding bad ca file transport": { - TLS: true, - Config: &Config{ - TLSClientConfig: TLSClientConfig{ - CAData: []byte(rootCACert), - CAFile: "invalid file", - }, - }, - }, - - "cert transport": { - TLS: true, - Config: &Config{ - TLSClientConfig: TLSClientConfig{ - CertData: []byte(certData), - KeyData: []byte(keyData), - CAData: []byte(rootCACert), - }, - }, - }, - "bad cert data transport": { - Err: true, - Config: &Config{ - TLSClientConfig: TLSClientConfig{ - CertData: []byte(certData), - KeyData: []byte("bad key data"), - CAData: []byte(rootCACert), - }, - }, - }, - "bad file cert transport": { - Err: true, - Config: &Config{ - TLSClientConfig: TLSClientConfig{ - CertData: []byte(certData), - KeyFile: "invalid file", - CAData: []byte(rootCACert), - }, - }, - }, - "key data overriding bad file cert transport": { - TLS: true, - Config: &Config{ - TLSClientConfig: TLSClientConfig{ - CertData: []byte(certData), - KeyData: []byte(keyData), - KeyFile: "invalid file", - CAData: []byte(rootCACert), - }, - }, - }, - } - for k, testCase := range testCases { - transport, err := TransportFor(testCase.Config) - switch { - case testCase.Err && err == nil: - t.Errorf("%s: unexpected non-error", k) - continue - case !testCase.Err && err != nil: - t.Errorf("%s: unexpected error: %v", k, err) - continue - } - - switch { - case testCase.Default && transport != http.DefaultTransport: - t.Errorf("%s: expected the default transport, got %#v", k, transport) - continue - case !testCase.Default && transport == http.DefaultTransport: - t.Errorf("%s: expected non-default transport, got %#v", k, transport) - continue - } - - // We only know how to check TLSConfig on http.Transports - if transport, ok := transport.(*http.Transport); ok { - switch { - case testCase.TLS && transport.TLSClientConfig == nil: - t.Errorf("%s: expected TLSClientConfig, got %#v", k, transport) - continue - case !testCase.TLS && transport.TLSClientConfig != nil: - t.Errorf("%s: expected no TLSClientConfig, got %#v", k, transport) - continue - } - } - } -} - -func TestTLSTransportCache(t *testing.T) { - // Empty the cache - tlsTransports = map[string]*http.Transport{} - // Construct several transports (Insecure=true to force a transport with custom tls settings) - identicalConfigurations := map[string]*Config{ - "empty": {Insecure: true}, - "host": {Insecure: true, Host: "foo"}, - "prefix": {Insecure: true, Prefix: "foo"}, - "version": {Insecure: true, Version: "foo"}, - "codec": {Insecure: true, Codec: testapi.Default.Codec()}, - "basic": {Insecure: true, Username: "bob", Password: "password"}, - "bearer": {Insecure: true, BearerToken: "token"}, - "user agent": {Insecure: true, UserAgent: "useragent"}, - "wrap transport": {Insecure: true, WrapTransport: func(http.RoundTripper) http.RoundTripper { return nil }}, - "qps/burst": {Insecure: true, QPS: 1.0, Burst: 10}, - } - for k, v := range identicalConfigurations { - if _, err := TransportFor(v); err != nil { - t.Errorf("Unexpected error for %q: %v", k, err) - } - } - if len(tlsTransports) != 1 { - t.Errorf("Expected 1 cached transport, got %d", len(tlsTransports)) - } - - // Empty the cache - tlsTransports = map[string]*http.Transport{} - // Construct several transports with custom TLS settings - // (no normalization is performed on ca/cert/key data, so appending a newline lets us test "different" content) - uniqueConfigurations := map[string]*Config{ - "insecure": {Insecure: true}, - "cadata 1": {TLSClientConfig: TLSClientConfig{CAData: []byte(rootCACert)}}, - "cadata 2": {TLSClientConfig: TLSClientConfig{CAData: []byte(rootCACert + "\n")}}, - "cert 1, key 1": {TLSClientConfig: TLSClientConfig{CertData: []byte(certData), KeyData: []byte(keyData)}}, - "cert 1, key 2": {TLSClientConfig: TLSClientConfig{CertData: []byte(certData), KeyData: []byte(keyData + "\n")}}, - "cert 2, key 1": {TLSClientConfig: TLSClientConfig{CertData: []byte(certData + "\n"), KeyData: []byte(keyData)}}, - "cert 2, key 2": {TLSClientConfig: TLSClientConfig{CertData: []byte(certData + "\n"), KeyData: []byte(keyData + "\n")}}, - "cadata 1, cert 1, key 1": {TLSClientConfig: TLSClientConfig{CAData: []byte(rootCACert), CertData: []byte(certData), KeyData: []byte(keyData)}}, - } - for k, v := range uniqueConfigurations { - if _, err := TransportFor(v); err != nil { - t.Errorf("Unexpected error for %q: %v", k, err) - } - } - // All custom configs should result in a cache entry - if len(tlsTransports) != len(uniqueConfigurations) { - t.Errorf("Expected %d cached transports, got %d", len(uniqueConfigurations), len(tlsTransports)) - } - - // Empty the cache - tlsTransports = map[string]*http.Transport{} - if _, err := TransportFor(&Config{}); err != nil { - t.Errorf("Unexpected error: %v", err) - } - // A client config with no TLS options should use http.DefaultTransport, not a cached custom transport - if len(tlsTransports) != 0 { - t.Errorf("Expected no cached transports, got %d", len(tlsTransports)) - } -} - func TestIsConfigTransportTLS(t *testing.T) { testCases := []struct { Config *Config @@ -332,21 +92,24 @@ func TestSetKubernetesDefaults(t *testing.T) { { Config{}, Config{ - Prefix: "/api", - Version: testapi.Default.Version(), - Codec: testapi.Default.Codec(), - QPS: 5, - Burst: 10, + APIPath: "/api", + ContentConfig: ContentConfig{ + GroupVersion: testapi.Default.GroupVersion(), + Codec: testapi.Default.Codec(), + }, + QPS: 5, + Burst: 10, }, false, }, - { - Config{ - Version: "not_an_api", - }, - Config{}, - true, - }, + // Add this test back when we fixed config and SetKubernetesDefaults + // { + // Config{ + // GroupVersion: &unversioned.GroupVersion{Group: "not.a.group", Version: "not_an_api"}, + // }, + // Config{}, + // true, + // }, } for _, testCase := range testCases { val := &testCase.Config @@ -385,7 +148,7 @@ func TestHelperGetServerAPIVersions(t *testing.T) { APIGroupList := unversioned.APIGroupList{ Groups: []unversioned.APIGroup{ { - Versions: []unversioned.GroupVersion{ + Versions: []unversioned.GroupVersionForDiscovery{ { GroupVersion: "group1/v1", }, @@ -395,7 +158,7 @@ func TestHelperGetServerAPIVersions(t *testing.T) { }, }, { - Versions: []unversioned.GroupVersion{ + Versions: []unversioned.GroupVersionForDiscovery{ { GroupVersion: "group2/v1", }, @@ -425,7 +188,9 @@ func TestHelperGetServerAPIVersions(t *testing.T) { w.WriteHeader(http.StatusOK) w.Write(output) })) - got, err := ServerAPIVersions(&Config{Host: server.URL, Version: "invalid version", Codec: testapi.Default.Codec()}) + // TODO: Uncomment when fix #19254 + // defer server.Close() + got, err := ServerAPIVersions(&Config{Host: server.URL, ContentConfig: ContentConfig{GroupVersion: &unversioned.GroupVersion{Group: "invalid version", Version: "one"}, Codec: testapi.Default.Codec()}}) if err != nil { t.Fatalf("unexpected encoding error: %v", err) } @@ -433,3 +198,83 @@ func TestHelperGetServerAPIVersions(t *testing.T) { t.Errorf("expected %v, got %v", e, a) } } + +func TestSetsCodec(t *testing.T) { + testCases := map[string]struct { + Err bool + Prefix string + Codec runtime.Codec + }{ + testapi.Default.GroupVersion().Version: {false, "/api/" + testapi.Default.GroupVersion().Version, testapi.Default.Codec()}, + // Add this test back when we fixed config and SetKubernetesDefaults + // "invalidVersion": {true, "", nil}, + } + for version, expected := range testCases { + client, err := New(&Config{Host: "127.0.0.1", ContentConfig: ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: version}}}) + switch { + case err == nil && expected.Err: + t.Errorf("expected error but was nil") + continue + case err != nil && !expected.Err: + t.Errorf("unexpected error %v", err) + continue + case err != nil: + continue + } + if e, a := expected.Prefix, client.RESTClient.versionedAPIPath; e != a { + t.Errorf("expected %#v, got %#v", e, a) + } + if e, a := expected.Codec, client.RESTClient.contentConfig.Codec; !reflect.DeepEqual(e, a) { + t.Errorf("expected %#v, got %#v", e, a) + } + } +} + +func TestRESTClientRequires(t *testing.T) { + if _, err := RESTClientFor(&Config{Host: "127.0.0.1", ContentConfig: ContentConfig{Codec: testapi.Default.Codec()}}); err == nil { + t.Errorf("unexpected non-error") + } + if _, err := RESTClientFor(&Config{Host: "127.0.0.1", ContentConfig: ContentConfig{GroupVersion: testapi.Default.GroupVersion()}}); err == nil { + t.Errorf("unexpected non-error") + } + if _, err := RESTClientFor(&Config{Host: "127.0.0.1", ContentConfig: ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()}}); err != nil { + t.Errorf("unexpected error: %v", err) + } +} + +func TestValidatesHostParameter(t *testing.T) { + testCases := []struct { + Host string + APIPath string + + URL string + Err bool + }{ + {"127.0.0.1", "", "http://127.0.0.1/" + testapi.Default.GroupVersion().Version, false}, + {"127.0.0.1:8080", "", "http://127.0.0.1:8080/" + testapi.Default.GroupVersion().Version, false}, + {"foo.bar.com", "", "http://foo.bar.com/" + testapi.Default.GroupVersion().Version, false}, + {"http://host/prefix", "", "http://host/prefix/" + testapi.Default.GroupVersion().Version, false}, + {"http://host", "", "http://host/" + testapi.Default.GroupVersion().Version, false}, + {"http://host", "/", "http://host/" + testapi.Default.GroupVersion().Version, false}, + {"http://host", "/other", "http://host/other/" + testapi.Default.GroupVersion().Version, false}, + {"host/server", "", "", true}, + } + for i, testCase := range testCases { + u, versionedAPIPath, err := DefaultServerURL(testCase.Host, testCase.APIPath, *testapi.Default.GroupVersion(), false) + switch { + case err == nil && testCase.Err: + t.Errorf("expected error but was nil") + continue + case err != nil && !testCase.Err: + t.Errorf("unexpected error %v", err) + continue + case err != nil: + continue + } + u.Path = path.Join(u.Path, versionedAPIPath) + if e, a := testCase.URL, u.String(); e != a { + t.Errorf("%d: expected host %s, got %s", i, e, a) + continue + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go index af98c99df..efdf82b70 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler.go @@ -19,8 +19,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -31,13 +29,13 @@ type HorizontalPodAutoscalersNamespacer interface { // HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources. type HorizontalPodAutoscalerInterface interface { - List(label labels.Selector, field fields.Selector) (*extensions.HorizontalPodAutoscalerList, error) + List(opts api.ListOptions) (*extensions.HorizontalPodAutoscalerList, error) Get(name string) (*extensions.HorizontalPodAutoscaler, error) Delete(name string, options *api.DeleteOptions) error Create(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) UpdateStatus(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface @@ -55,9 +53,9 @@ func newHorizontalPodAutoscalers(c *ExtensionsClient, namespace string) *horizon } // List takes label and field selectors, and returns the list of horizontalPodAutoscalers that match those selectors. -func (c *horizontalPodAutoscalers) List(label labels.Selector, field fields.Selector) (result *extensions.HorizontalPodAutoscalerList, err error) { +func (c *horizontalPodAutoscalers) List(opts api.ListOptions) (result *extensions.HorizontalPodAutoscalerList, err error) { result = &extensions.HorizontalPodAutoscalerList{} - err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.client.Get().Namespace(c.ns).Resource("horizontalPodAutoscalers").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } @@ -70,15 +68,7 @@ func (c *horizontalPodAutoscalers) Get(name string) (result *extensions.Horizont // Delete takes the name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs. func (c *horizontalPodAutoscalers) Delete(name string, options *api.DeleteOptions) error { - // TODO: to make this reusable in other client libraries - if options == nil { - return c.client.Delete().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Do().Error() - } - body, err := api.Scheme.EncodeToVersion(options, c.client.APIVersion()) - if err != nil { - return err - } - return c.client.Delete().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Body(body).Do().Error() + return c.client.Delete().Namespace(c.ns).Resource("horizontalPodAutoscalers").Name(name).Body(options).Do().Error() } // Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if it occurs. @@ -103,13 +93,11 @@ func (c *horizontalPodAutoscalers) UpdateStatus(horizontalPodAutoscaler *extensi } // Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers. -func (c *horizontalPodAutoscalers) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *horizontalPodAutoscalers) Watch(opts api.ListOptions) (watch.Interface, error) { return c.client.Get(). Prefix("watch"). Namespace(c.ns). Resource("horizontalPodAutoscalers"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler_test.go index 42b8f7639..bd4c06c82 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/horizontalpodautoscaler_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -23,8 +28,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getHorizontalPodAutoscalersResoureName() string { @@ -39,17 +42,18 @@ func TestHorizontalPodAutoscalerCreate(t *testing.T) { Namespace: ns, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: &horizontalPodAutoscaler, }, - Response: Response{StatusCode: 200, Body: &horizontalPodAutoscaler}, + Response: simple.Response{StatusCode: 200, Body: &horizontalPodAutoscaler}, } response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).Create(&horizontalPodAutoscaler) + defer c.Close() if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -64,17 +68,18 @@ func TestHorizontalPodAutoscalerGet(t *testing.T) { Namespace: ns, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "abc"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: horizontalPodAutoscaler}, + Response: simple.Response{StatusCode: 200, Body: horizontalPodAutoscaler}, } response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).Get("abc") + defer c.Close() c.Validate(t, response, err) } @@ -90,16 +95,17 @@ func TestHorizontalPodAutoscalerList(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: horizontalPodAutoscalerList}, + Response: simple.Response{StatusCode: 200, Body: horizontalPodAutoscalerList}, } - response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).List(labels.Everything(), fields.Everything()) + response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, response, err) } @@ -112,11 +118,12 @@ func TestHorizontalPodAutoscalerUpdate(t *testing.T) { ResourceVersion: "1", }, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "abc"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: horizontalPodAutoscaler}, + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "abc"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: horizontalPodAutoscaler}, } response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).Update(horizontalPodAutoscaler) + defer c.Close() c.Validate(t, response, err) } @@ -129,32 +136,35 @@ func TestHorizontalPodAutoscalerUpdateStatus(t *testing.T) { ResourceVersion: "1", }, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "abc") + "/status", Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: horizontalPodAutoscaler}, + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "abc") + "/status", Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: horizontalPodAutoscaler}, } response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).UpdateStatus(horizontalPodAutoscaler) + defer c.Close() c.Validate(t, response, err) } func TestHorizontalPodAutoscalerDelete(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).Delete("foo", nil) + defer c.Close() c.Validate(t, nil, err) } func TestHorizontalPodAutoscalerWatch(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Extensions.ResourcePathWithPrefix("watch", getHorizontalPodAutoscalersResoureName(), "", ""), Query: url.Values{"resourceVersion": []string{}}}, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } - _, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), "") + _, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(api.NamespaceAll).Watch(api.ListOptions{}) + defer c.Close() c.Validate(t, nil, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/import_known_versions.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/import_known_versions.go index e0549772e..95f664430 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/import_known_versions.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/import_known_versions.go @@ -18,6 +18,18 @@ package unversioned // These imports are the API groups the client will support. import ( + "fmt" + _ "k8s.io/kubernetes/pkg/api/install" + "k8s.io/kubernetes/pkg/apimachinery/registered" + _ "k8s.io/kubernetes/pkg/apis/authorization/install" + _ "k8s.io/kubernetes/pkg/apis/componentconfig/install" _ "k8s.io/kubernetes/pkg/apis/extensions/install" + _ "k8s.io/kubernetes/pkg/apis/metrics/install" ) + +func init() { + if missingVersions := registered.ValidateEnvRequestedVersions(); len(missingVersions) != 0 { + panic(fmt.Sprintf("KUBE_API_VERSIONS contains versions that are not installed: %q.", missingVersions)) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/ingress.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/ingress.go index 8c8544c5c..4865b2086 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/ingress.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/ingress.go @@ -19,8 +19,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -31,12 +29,12 @@ type IngressNamespacer interface { // IngressInterface exposes methods to work on Ingress resources. type IngressInterface interface { - List(label labels.Selector, field fields.Selector) (*extensions.IngressList, error) + List(opts api.ListOptions) (*extensions.IngressList, error) Get(name string) (*extensions.Ingress, error) Create(ingress *extensions.Ingress) (*extensions.Ingress, error) Update(ingress *extensions.Ingress) (*extensions.Ingress, error) Delete(name string, options *api.DeleteOptions) error - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) UpdateStatus(ingress *extensions.Ingress) (*extensions.Ingress, error) } @@ -52,61 +50,51 @@ func newIngress(c *ExtensionsClient, namespace string) *ingress { } // List returns a list of ingress that match the label and field selectors. -func (c *ingress) List(label labels.Selector, field fields.Selector) (result *extensions.IngressList, err error) { +func (c *ingress) List(opts api.ListOptions) (result *extensions.IngressList, err error) { result = &extensions.IngressList{} - err = c.r.Get().Namespace(c.ns).Resource("ingress").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.r.Get().Namespace(c.ns).Resource("ingresses").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } // Get returns information about a particular ingress. func (c *ingress) Get(name string) (result *extensions.Ingress, err error) { result = &extensions.Ingress{} - err = c.r.Get().Namespace(c.ns).Resource("ingress").Name(name).Do().Into(result) + err = c.r.Get().Namespace(c.ns).Resource("ingresses").Name(name).Do().Into(result) return } // Create creates a new ingress. func (c *ingress) Create(ingress *extensions.Ingress) (result *extensions.Ingress, err error) { result = &extensions.Ingress{} - err = c.r.Post().Namespace(c.ns).Resource("ingress").Body(ingress).Do().Into(result) + err = c.r.Post().Namespace(c.ns).Resource("ingresses").Body(ingress).Do().Into(result) return } // Update updates an existing ingress. func (c *ingress) Update(ingress *extensions.Ingress) (result *extensions.Ingress, err error) { result = &extensions.Ingress{} - err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).Body(ingress).Do().Into(result) + err = c.r.Put().Namespace(c.ns).Resource("ingresses").Name(ingress.Name).Body(ingress).Do().Into(result) return } // Delete deletes a ingress, returns error if one occurs. func (c *ingress) Delete(name string, options *api.DeleteOptions) (err error) { - if options == nil { - return c.r.Delete().Namespace(c.ns).Resource("ingress").Name(name).Do().Error() - } - - body, err := api.Scheme.EncodeToVersion(options, c.r.APIVersion()) - if err != nil { - return err - } - return c.r.Delete().Namespace(c.ns).Resource("ingress").Name(name).Body(body).Do().Error() + return c.r.Delete().Namespace(c.ns).Resource("ingresses").Name(name).Body(options).Do().Error() } // Watch returns a watch.Interface that watches the requested ingress. -func (c *ingress) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *ingress) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). - Resource("ingress"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + Resource("ingresses"). + VersionedParams(&opts, api.ParameterCodec). Watch() } // UpdateStatus takes the name of the ingress and the new status. Returns the server's representation of the ingress, and an error, if it occurs. func (c *ingress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) { result = &extensions.Ingress{} - err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).SubResource("status").Body(ingress).Do().Into(result) + err = c.r.Put().Namespace(c.ns).Resource("ingresses").Name(ingress.Name).SubResource("status").Body(ingress).Do().Into(result) return } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/ingress_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/ingress_test.go index a8a5e35fe..6bab5f5ed 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/ingress_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/ingress_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "testing" @@ -22,22 +27,20 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getIngressResourceName() string { - return "ingress" + return "ingresses" } func TestListIngress(t *testing.T) { ns := api.NamespaceAll - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Extensions.ResourcePath(getIngressResourceName(), ns, ""), }, - Response: Response{StatusCode: 200, + Response: simple.Response{StatusCode: 200, Body: &extensions.IngressList{ Items: []extensions.Ingress{ { @@ -56,19 +59,20 @@ func TestListIngress(t *testing.T) { }, }, } - receivedIngressList, err := c.Setup(t).Extensions().Ingress(ns).List(labels.Everything(), fields.Everything()) + receivedIngressList, err := c.Setup(t).Extensions().Ingress(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, receivedIngressList, err) } func TestGetIngress(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Extensions.ResourcePath(getIngressResourceName(), ns, "foo"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{ + Response: simple.Response{ StatusCode: 200, Body: &extensions.Ingress{ ObjectMeta: api.ObjectMeta{ @@ -85,15 +89,17 @@ func TestGetIngress(t *testing.T) { }, } receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).Get("foo") + defer c.Close() c.Validate(t, receivedIngress, err) } func TestGetIngressWithNoName(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{Error: true} + c := &simple.Client{Error: true} receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).Get("") - if (err != nil) && (err.Error() != nameRequiredError) { - t.Errorf("Expected error: %v, but got %v", nameRequiredError, err) + defer c.Close() + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) } c.Validate(t, receivedIngress, err) @@ -108,13 +114,13 @@ func TestUpdateIngress(t *testing.T) { ResourceVersion: "1", }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Extensions.ResourcePath(getIngressResourceName(), ns, "foo"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{ + Response: simple.Response{ StatusCode: 200, Body: &extensions.Ingress{ ObjectMeta: api.ObjectMeta{ @@ -131,6 +137,7 @@ func TestUpdateIngress(t *testing.T) { }, } receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).Update(requestIngress) + defer c.Close() c.Validate(t, receivedIngress, err) } @@ -151,13 +158,13 @@ func TestUpdateIngressStatus(t *testing.T) { LoadBalancer: lbStatus, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Extensions.ResourcePath(getIngressResourceName(), ns, "foo") + "/status", - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{ + Response: simple.Response{ StatusCode: 200, Body: &extensions.Ingress{ ObjectMeta: api.ObjectMeta{ @@ -177,20 +184,22 @@ func TestUpdateIngressStatus(t *testing.T) { }, } receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).UpdateStatus(requestIngress) + defer c.Close() c.Validate(t, receivedIngress, err) } func TestDeleteIngress(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "DELETE", Path: testapi.Extensions.ResourcePath(getIngressResourceName(), ns, "foo"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).Extensions().Ingress(ns).Delete("foo", nil) + defer c.Close() c.Validate(t, nil, err) } @@ -202,14 +211,14 @@ func TestCreateIngress(t *testing.T) { Namespace: ns, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Extensions.ResourcePath(getIngressResourceName(), ns, ""), Body: requestIngress, - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{ + Response: simple.Response{ StatusCode: 200, Body: &extensions.Ingress{ ObjectMeta: api.ObjectMeta{ @@ -226,5 +235,6 @@ func TestCreateIngress(t *testing.T) { }, } receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).Create(requestIngress) + defer c.Close() c.Validate(t, receivedIngress, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/jobs.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/jobs.go index d6a88edb1..0d10997c7 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/jobs.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/jobs.go @@ -18,10 +18,7 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/latest" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -32,12 +29,12 @@ type JobsNamespacer interface { // JobInterface exposes methods to work on Job resources. type JobInterface interface { - List(label labels.Selector, field fields.Selector) (*extensions.JobList, error) + List(opts api.ListOptions) (*extensions.JobList, error) Get(name string) (*extensions.Job, error) Create(job *extensions.Job) (*extensions.Job, error) Update(job *extensions.Job) (*extensions.Job, error) Delete(name string, options *api.DeleteOptions) error - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) UpdateStatus(job *extensions.Job) (*extensions.Job, error) } @@ -56,9 +53,9 @@ func newJobs(c *ExtensionsClient, namespace string) *jobs { var _ JobInterface = &jobs{} // List returns a list of jobs that match the label and field selectors. -func (c *jobs) List(label labels.Selector, field fields.Selector) (result *extensions.JobList, err error) { +func (c *jobs) List(opts api.ListOptions) (result *extensions.JobList, err error) { result = &extensions.JobList{} - err = c.r.Get().Namespace(c.ns).Resource("jobs").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.r.Get().Namespace(c.ns).Resource("jobs").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } @@ -85,26 +82,16 @@ func (c *jobs) Update(job *extensions.Job) (result *extensions.Job, err error) { // Delete deletes a job, returns error if one occurs. func (c *jobs) Delete(name string, options *api.DeleteOptions) (err error) { - if options == nil { - return c.r.Delete().Namespace(c.ns).Resource("jobs").Name(name).Do().Error() - } - - body, err := api.Scheme.EncodeToVersion(options, latest.GroupOrDie("").GroupVersion) - if err != nil { - return err - } - return c.r.Delete().Namespace(c.ns).Resource("jobs").Name(name).Body(body).Do().Error() + return c.r.Delete().Namespace(c.ns).Resource("jobs").Name(name).Body(options).Do().Error() } // Watch returns a watch.Interface that watches the requested jobs. -func (c *jobs) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *jobs) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). Resource("jobs"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/jobs_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/jobs_test.go index 856dfaf19..76a87eab0 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/jobs_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/jobs_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "testing" @@ -22,8 +27,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getJobResourceName() string { @@ -32,12 +35,12 @@ func getJobResourceName() string { func TestListJobs(t *testing.T) { ns := api.NamespaceAll - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Extensions.ResourcePath(getJobResourceName(), ns, ""), }, - Response: Response{StatusCode: 200, + Response: simple.Response{StatusCode: 200, Body: &extensions.JobList{ Items: []extensions.Job{ { @@ -56,19 +59,20 @@ func TestListJobs(t *testing.T) { }, }, } - receivedJobList, err := c.Setup(t).Extensions().Jobs(ns).List(labels.Everything(), fields.Everything()) + receivedJobList, err := c.Setup(t).Extensions().Jobs(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, receivedJobList, err) } func TestGetJob(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Extensions.ResourcePath(getJobResourceName(), ns, "foo"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{ + Response: simple.Response{ StatusCode: 200, Body: &extensions.Job{ ObjectMeta: api.ObjectMeta{ @@ -85,15 +89,17 @@ func TestGetJob(t *testing.T) { }, } receivedJob, err := c.Setup(t).Extensions().Jobs(ns).Get("foo") + defer c.Close() c.Validate(t, receivedJob, err) } func TestGetJobWithNoName(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{Error: true} + c := &simple.Client{Error: true} receivedJob, err := c.Setup(t).Extensions().Jobs(ns).Get("") - if (err != nil) && (err.Error() != nameRequiredError) { - t.Errorf("Expected error: %v, but got %v", nameRequiredError, err) + defer c.Close() + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) } c.Validate(t, receivedJob, err) @@ -108,13 +114,13 @@ func TestUpdateJob(t *testing.T) { ResourceVersion: "1", }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Extensions.ResourcePath(getJobResourceName(), ns, "foo"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{ + Response: simple.Response{ StatusCode: 200, Body: &extensions.Job{ ObjectMeta: api.ObjectMeta{ @@ -131,6 +137,7 @@ func TestUpdateJob(t *testing.T) { }, } receivedJob, err := c.Setup(t).Extensions().Jobs(ns).Update(requestJob) + defer c.Close() c.Validate(t, receivedJob, err) } @@ -143,13 +150,13 @@ func TestUpdateJobStatus(t *testing.T) { ResourceVersion: "1", }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Extensions.ResourcePath(getJobResourceName(), ns, "foo") + "/status", - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{ + Response: simple.Response{ StatusCode: 200, Body: &extensions.Job{ ObjectMeta: api.ObjectMeta{ @@ -169,20 +176,22 @@ func TestUpdateJobStatus(t *testing.T) { }, } receivedJob, err := c.Setup(t).Extensions().Jobs(ns).UpdateStatus(requestJob) + defer c.Close() c.Validate(t, receivedJob, err) } func TestDeleteJob(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "DELETE", Path: testapi.Extensions.ResourcePath(getJobResourceName(), ns, "foo"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).Extensions().Jobs(ns).Delete("foo", nil) + defer c.Close() c.Validate(t, nil, err) } @@ -194,14 +203,14 @@ func TestCreateJob(t *testing.T) { Namespace: ns, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Extensions.ResourcePath(getJobResourceName(), ns, ""), Body: requestJob, - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), }, - Response: Response{ + Response: simple.Response{ StatusCode: 200, Body: &extensions.Job{ ObjectMeta: api.ObjectMeta{ @@ -218,5 +227,6 @@ func TestCreateJob(t *testing.T) { }, } receivedJob, err := c.Setup(t).Extensions().Jobs(ns).Create(requestJob) + defer c.Close() c.Validate(t, receivedJob, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/kubelet.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/kubelet.go deleted file mode 100644 index 4f54f31d7..000000000 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/kubelet.go +++ /dev/null @@ -1,100 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package unversioned - -import ( - "errors" - "net/http" - - "k8s.io/kubernetes/pkg/util" -) - -// KubeletClient is an interface for all kubelet functionality -type KubeletClient interface { - ConnectionInfoGetter -} - -type ConnectionInfoGetter interface { - GetConnectionInfo(host string) (scheme string, port uint, transport http.RoundTripper, err error) -} - -// HTTPKubeletClient is the default implementation of KubeletHealthchecker, accesses the kubelet over HTTP. -type HTTPKubeletClient struct { - Client *http.Client - Config *KubeletConfig -} - -func MakeTransport(config *KubeletConfig) (http.RoundTripper, error) { - cfg := &Config{TLSClientConfig: config.TLSClientConfig} - if config.EnableHttps { - hasCA := len(config.CAFile) > 0 || len(config.CAData) > 0 - if !hasCA { - cfg.Insecure = true - } - } - tlsConfig, err := TLSConfigFor(cfg) - if err != nil { - return nil, err - } - - transport := http.DefaultTransport - if config.Dial != nil || tlsConfig != nil { - transport = util.SetTransportDefaults(&http.Transport{ - Dial: config.Dial, - TLSClientConfig: tlsConfig, - }) - } - - if len(config.BearerToken) > 0 { - transport = NewBearerAuthRoundTripper(config.BearerToken, transport) - } - - return transport, nil -} - -// TODO: this structure is questionable, it should be using client.Config and overriding defaults. -func NewKubeletClient(config *KubeletConfig) (KubeletClient, error) { - transport, err := MakeTransport(config) - if err != nil { - return nil, err - } - c := &http.Client{ - Transport: transport, - Timeout: config.HTTPTimeout, - } - return &HTTPKubeletClient{ - Client: c, - Config: config, - }, nil -} - -func (c *HTTPKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error) { - scheme := "http" - if c.Config.EnableHttps { - scheme = "https" - } - return scheme, c.Config.Port, c.Client.Transport, nil -} - -// FakeKubeletClient is a fake implementation of KubeletClient which returns an error -// when called. It is useful to pass to the master in a test configuration with -// no kubelets. -type FakeKubeletClient struct{} - -func (c FakeKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error) { - return "", 0, nil, errors.New("Not Implemented") -} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/kubelet_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/kubelet_test.go deleted file mode 100644 index 8b3b25583..000000000 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/kubelet_test.go +++ /dev/null @@ -1,102 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package unversioned - -import ( - "encoding/json" - "net/http/httptest" - "net/url" - "testing" - - "k8s.io/kubernetes/pkg/probe" - "k8s.io/kubernetes/pkg/util" -) - -func TestHTTPKubeletClient(t *testing.T) { - expectObj := probe.Success - body, err := json.Marshal(expectObj) - if err != nil { - t.Errorf("unexpected error: %v", err) - } - - fakeHandler := util.FakeHandler{ - StatusCode: 200, - ResponseBody: string(body), - } - testServer := httptest.NewServer(&fakeHandler) - defer testServer.Close() - - _, err = url.Parse(testServer.URL) - if err != nil { - t.Errorf("unexpected error: %v", err) - } -} - -func TestNewKubeletClient(t *testing.T) { - config := &KubeletConfig{ - EnableHttps: false, - } - - client, err := NewKubeletClient(config) - if err != nil { - t.Errorf("Error while trying to create a client: %v", err) - } - if client == nil { - t.Error("client is nil.") - } -} - -func TestNewKubeletClientTLSInvalid(t *testing.T) { - config := &KubeletConfig{ - EnableHttps: true, - //Invalid certificate and key path - TLSClientConfig: TLSClientConfig{ - CertFile: "../testdata/mycertinvalid.cer", - KeyFile: "../testdata/mycertinvalid.key", - CAFile: "../testdata/myCA.cer", - }, - } - - client, err := NewKubeletClient(config) - if err == nil { - t.Errorf("Expected an error") - } - if client != nil { - t.Error("client should be nil as we provided invalid cert file") - } -} - -func TestNewKubeletClientTLSValid(t *testing.T) { - config := &KubeletConfig{ - EnableHttps: true, - TLSClientConfig: TLSClientConfig{ - CertFile: "../testdata/mycertvalid.cer", - // TLS Configuration, only applies if EnableHttps is true. - KeyFile: "../testdata/mycertvalid.key", - // TLS Configuration, only applies if EnableHttps is true. - CAFile: "../testdata/myCA.cer", - }, - } - - client, err := NewKubeletClient(config) - if err != nil { - t.Errorf("Not expecting an error #%v", err) - } - if client == nil { - t.Error("client should not be nil") - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/limit_ranges.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/limit_ranges.go index 5e90480ec..8bc2253da 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/limit_ranges.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/limit_ranges.go @@ -17,11 +17,7 @@ limitations under the License. package unversioned import ( - "fmt" - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -32,12 +28,12 @@ type LimitRangesNamespacer interface { // LimitRangeInterface has methods to work with LimitRange resources. type LimitRangeInterface interface { - List(label labels.Selector, field fields.Selector) (*api.LimitRangeList, error) + List(opts api.ListOptions) (*api.LimitRangeList, error) Get(name string) (*api.LimitRange, error) Delete(name string) error Create(limitRange *api.LimitRange) (*api.LimitRange, error) Update(limitRange *api.LimitRange) (*api.LimitRange, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // limitRanges implements LimitRangesNamespacer interface @@ -55,9 +51,9 @@ func newLimitRanges(c *Client, namespace string) *limitRanges { } // List takes a selector, and returns the list of limitRanges that match that selector. -func (c *limitRanges) List(label labels.Selector, field fields.Selector) (result *api.LimitRangeList, err error) { +func (c *limitRanges) List(opts api.ListOptions) (result *api.LimitRangeList, err error) { result = &api.LimitRangeList{} - err = c.r.Get().Namespace(c.ns).Resource("limitRanges").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.r.Get().Namespace(c.ns).Resource("limitRanges").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } @@ -83,22 +79,16 @@ func (c *limitRanges) Create(limitRange *api.LimitRange) (result *api.LimitRange // Update takes the representation of a limitRange to update. Returns the server's representation of the limitRange, and an error, if it occurs. func (c *limitRanges) Update(limitRange *api.LimitRange) (result *api.LimitRange, err error) { result = &api.LimitRange{} - if len(limitRange.ResourceVersion) == 0 { - err = fmt.Errorf("invalid update object, missing resource version: %v", limitRange) - return - } err = c.r.Put().Namespace(c.ns).Resource("limitRanges").Name(limitRange.Name).Body(limitRange).Do().Into(result) return } // Watch returns a watch.Interface that watches the requested resource -func (c *limitRanges) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *limitRanges) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). Resource("limitRanges"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/limit_ranges_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/limit_ranges_test.go index 23e0fbad5..f6936570c 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/limit_ranges_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/limit_ranges_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -23,8 +28,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getLimitRangesResourceName() string { @@ -53,17 +56,18 @@ func TestLimitRangeCreate(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Default.ResourcePath(getLimitRangesResourceName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: limitRange, }, - Response: Response{StatusCode: 200, Body: limitRange}, + Response: simple.Response{StatusCode: 200, Body: limitRange}, } response, err := c.Setup(t).LimitRanges(ns).Create(limitRange) + defer c.Close() c.Validate(t, response, err) } @@ -89,17 +93,18 @@ func TestLimitRangeGet(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getLimitRangesResourceName(), ns, "abc"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: limitRange}, + Response: simple.Response{StatusCode: 200, Body: limitRange}, } response, err := c.Setup(t).LimitRanges(ns).Get("abc") + defer c.Close() c.Validate(t, response, err) } @@ -113,16 +118,17 @@ func TestLimitRangeList(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getLimitRangesResourceName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: limitRangeList}, + Response: simple.Response{StatusCode: 200, Body: limitRangeList}, } - response, err := c.Setup(t).LimitRanges(ns).List(labels.Everything(), fields.Everything()) + response, err := c.Setup(t).LimitRanges(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, response, err) } @@ -149,64 +155,35 @@ func TestLimitRangeUpdate(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: limitRange}, + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: limitRange}, } response, err := c.Setup(t).LimitRanges(ns).Update(limitRange) + defer c.Close() c.Validate(t, response, err) } -func TestInvalidLimitRangeUpdate(t *testing.T) { - ns := api.NamespaceDefault - limitRange := &api.LimitRange{ - ObjectMeta: api.ObjectMeta{ - Name: "abc", - }, - Spec: api.LimitRangeSpec{ - Limits: []api.LimitRangeItem{ - { - Type: api.LimitTypePod, - Max: api.ResourceList{ - api.ResourceCPU: resource.MustParse("100"), - api.ResourceMemory: resource.MustParse("10000"), - }, - Min: api.ResourceList{ - api.ResourceCPU: resource.MustParse("0"), - api.ResourceMemory: resource.MustParse("100"), - }, - }, - }, - }, - } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: limitRange}, - } - _, err := c.Setup(t).LimitRanges(ns).Update(limitRange) - if err == nil { - t.Errorf("Expected an error due to missing ResourceVersion") - } -} - func TestLimitRangeDelete(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath(getLimitRangesResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath(getLimitRangesResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).LimitRanges(ns).Delete("foo") + defer c.Close() c.Validate(t, nil, err) } func TestLimitRangeWatch(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePathWithPrefix("watch", getLimitRangesResourceName(), "", ""), Query: url.Values{"resourceVersion": []string{}}}, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } - _, err := c.Setup(t).LimitRanges(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), "") + _, err := c.Setup(t).LimitRanges(api.NamespaceAll).Watch(api.ListOptions{}) + defer c.Close() c.Validate(t, nil, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go index d8baf2918..122bcba50 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/namespaces.go @@ -20,8 +20,6 @@ import ( "fmt" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -32,10 +30,10 @@ type NamespacesInterface interface { type NamespaceInterface interface { Create(item *api.Namespace) (*api.Namespace, error) Get(name string) (result *api.Namespace, err error) - List(label labels.Selector, field fields.Selector) (*api.NamespaceList, error) + List(opts api.ListOptions) (*api.NamespaceList, error) Delete(name string) error Update(item *api.Namespace) (*api.Namespace, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) Finalize(item *api.Namespace) (*api.Namespace, error) Status(item *api.Namespace) (*api.Namespace, error) } @@ -58,12 +56,11 @@ func (c *namespaces) Create(namespace *api.Namespace) (*api.Namespace, error) { } // List lists all the namespaces in the cluster. -func (c *namespaces) List(label labels.Selector, field fields.Selector) (*api.NamespaceList, error) { +func (c *namespaces) List(opts api.ListOptions) (*api.NamespaceList, error) { result := &api.NamespaceList{} err := c.r.Get(). Resource("namespaces"). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Do().Into(result) return result, err } @@ -71,10 +68,6 @@ func (c *namespaces) List(label labels.Selector, field fields.Selector) (*api.Na // Update takes the representation of a namespace to update. Returns the server's representation of the namespace, and an error, if it occurs. func (c *namespaces) Update(namespace *api.Namespace) (result *api.Namespace, err error) { result = &api.Namespace{} - if len(namespace.ResourceVersion) == 0 { - err = fmt.Errorf("invalid update object, missing resource version: %v", namespace) - return - } err = c.r.Put().Resource("namespaces").Name(namespace.Name).Body(namespace).Do().Into(result) return } @@ -114,12 +107,10 @@ func (c *namespaces) Delete(name string) error { } // Watch returns a watch.Interface that watches the requested namespaces. -func (c *namespaces) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *namespaces) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Resource("namespaces"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/namespaces_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/namespaces_test.go index 7fc361573..509980e7e 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/namespaces_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/namespaces_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -22,8 +27,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func TestNamespaceCreate(t *testing.T) { @@ -31,17 +34,18 @@ func TestNamespaceCreate(t *testing.T) { namespace := &api.Namespace{ ObjectMeta: api.ObjectMeta{Name: "foo"}, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Default.ResourcePath("namespaces", "", ""), Body: namespace, }, - Response: Response{StatusCode: 200, Body: namespace}, + Response: simple.Response{StatusCode: 200, Body: namespace}, } // from the source ns, provision a new global namespace "foo" response, err := c.Setup(t).Namespaces().Create(namespace) + defer c.Close() if err != nil { t.Errorf("%#v should be nil.", err) @@ -56,16 +60,17 @@ func TestNamespaceGet(t *testing.T) { namespace := &api.Namespace{ ObjectMeta: api.ObjectMeta{Name: "foo"}, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath("namespaces", "", "foo"), Body: nil, }, - Response: Response{StatusCode: 200, Body: namespace}, + Response: simple.Response{StatusCode: 200, Body: namespace}, } response, err := c.Setup(t).Namespaces().Get("foo") + defer c.Close() if err != nil { t.Errorf("%#v should be nil.", err) @@ -84,15 +89,16 @@ func TestNamespaceList(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath("namespaces", "", ""), Body: nil, }, - Response: Response{StatusCode: 200, Body: namespaceList}, + Response: simple.Response{StatusCode: 200, Body: namespaceList}, } - response, err := c.Setup(t).Namespaces().List(labels.Everything(), fields.Everything()) + response, err := c.Setup(t).Namespaces().List(api.ListOptions{}) + defer c.Close() if err != nil { t.Errorf("%#v should be nil.", err) @@ -122,13 +128,14 @@ func TestNamespaceUpdate(t *testing.T) { Finalizers: []api.FinalizerName{api.FinalizerKubernetes}, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Default.ResourcePath("namespaces", "", "foo")}, - Response: Response{StatusCode: 200, Body: requestNamespace}, + Response: simple.Response{StatusCode: 200, Body: requestNamespace}, } receivedNamespace, err := c.Setup(t).Namespaces().Update(requestNamespace) + defer c.Close() c.Validate(t, receivedNamespace, err) } @@ -146,34 +153,37 @@ func TestNamespaceFinalize(t *testing.T) { Finalizers: []api.FinalizerName{api.FinalizerKubernetes}, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Default.ResourcePath("namespaces", "", "foo") + "/finalize", }, - Response: Response{StatusCode: 200, Body: requestNamespace}, + Response: simple.Response{StatusCode: 200, Body: requestNamespace}, } receivedNamespace, err := c.Setup(t).Namespaces().Finalize(requestNamespace) + defer c.Close() c.Validate(t, receivedNamespace, err) } func TestNamespaceDelete(t *testing.T) { - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath("namespaces", "", "foo")}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath("namespaces", "", "foo")}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).Namespaces().Delete("foo") + defer c.Close() c.Validate(t, nil, err) } func TestNamespaceWatch(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePathWithPrefix("watch", "namespaces", "", ""), Query: url.Values{"resourceVersion": []string{}}}, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } - _, err := c.Setup(t).Namespaces().Watch(labels.Everything(), fields.Everything(), "") + _, err := c.Setup(t).Namespaces().Watch(api.ListOptions{}) + defer c.Close() c.Validate(t, nil, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/nodes.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/nodes.go index 4b86c04c6..452a03f16 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/nodes.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/nodes.go @@ -17,11 +17,7 @@ limitations under the License. package unversioned import ( - "fmt" - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -32,11 +28,11 @@ type NodesInterface interface { type NodeInterface interface { Get(name string) (result *api.Node, err error) Create(node *api.Node) (*api.Node, error) - List(label labels.Selector, field fields.Selector) (*api.NodeList, error) + List(opts api.ListOptions) (*api.NodeList, error) Delete(name string) error Update(*api.Node) (*api.Node, error) UpdateStatus(*api.Node) (*api.Node, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // nodes implements NodesInterface @@ -62,9 +58,9 @@ func (c *nodes) Create(node *api.Node) (*api.Node, error) { } // List takes a selector, and returns the list of nodes that match that selector in the cluster. -func (c *nodes) List(label labels.Selector, field fields.Selector) (*api.NodeList, error) { +func (c *nodes) List(opts api.ListOptions) (*api.NodeList, error) { result := &api.NodeList{} - err := c.r.Get().Resource(c.resourceName()).LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err := c.r.Get().Resource(c.resourceName()).VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return result, err } @@ -83,32 +79,22 @@ func (c *nodes) Delete(name string) error { // Update updates an existing node. func (c *nodes) Update(node *api.Node) (*api.Node, error) { result := &api.Node{} - if len(node.ResourceVersion) == 0 { - err := fmt.Errorf("invalid update object, missing resource version: %v", node) - return nil, err - } err := c.r.Put().Resource(c.resourceName()).Name(node.Name).Body(node).Do().Into(result) return result, err } func (c *nodes) UpdateStatus(node *api.Node) (*api.Node, error) { result := &api.Node{} - if len(node.ResourceVersion) == 0 { - err := fmt.Errorf("invalid update object, missing resource version: %v", node) - return nil, err - } err := c.r.Put().Resource(c.resourceName()).Name(node.Name).SubResource("status").Body(node).Do().Into(result) return result, err } // Watch returns a watch.Interface that watches the requested nodes. -func (c *nodes) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *nodes) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(api.NamespaceAll). Resource(c.resourceName()). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/nodes_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/nodes_test.go index 96d67d641..37735ec7d 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/nodes_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/nodes_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -24,7 +29,6 @@ import ( "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" - "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" ) @@ -33,25 +37,26 @@ func getNodesResourceName() string { } func TestListNodes(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getNodesResourceName(), "", ""), }, - Response: Response{StatusCode: 200, Body: &api.NodeList{ListMeta: unversioned.ListMeta{ResourceVersion: "1"}}}, + Response: simple.Response{StatusCode: 200, Body: &api.NodeList{ListMeta: unversioned.ListMeta{ResourceVersion: "1"}}}, } - response, err := c.Setup(t).Nodes().List(labels.Everything(), fields.Everything()) + response, err := c.Setup(t).Nodes().List(api.ListOptions{}) + defer c.Close() c.Validate(t, response, err) } func TestListNodesLabels(t *testing.T) { - labelSelectorQueryParamName := unversioned.LabelSelectorQueryParam(testapi.Default.Version()) - c := &testClient{ - Request: testRequest{ + labelSelectorQueryParamName := unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()) + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getNodesResourceName(), "", ""), - Query: buildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, - Response: Response{ + Query: simple.BuildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, + Response: simple.Response{ StatusCode: 200, Body: &api.NodeList{ Items: []api.Node{ @@ -68,29 +73,33 @@ func TestListNodesLabels(t *testing.T) { }, } c.Setup(t) - c.QueryValidator[labelSelectorQueryParamName] = validateLabels + defer c.Close() + c.QueryValidator[labelSelectorQueryParamName] = simple.ValidateLabels selector := labels.Set{"foo": "bar", "name": "baz"}.AsSelector() - receivedNodeList, err := c.Nodes().List(selector, fields.Everything()) + options := api.ListOptions{LabelSelector: selector} + receivedNodeList, err := c.Nodes().List(options) c.Validate(t, receivedNodeList, err) } func TestGetNode(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getNodesResourceName(), "", "1"), }, - Response: Response{StatusCode: 200, Body: &api.Node{ObjectMeta: api.ObjectMeta{Name: "node-1"}}}, + Response: simple.Response{StatusCode: 200, Body: &api.Node{ObjectMeta: api.ObjectMeta{Name: "node-1"}}}, } response, err := c.Setup(t).Nodes().Get("1") + defer c.Close() c.Validate(t, response, err) } func TestGetNodeWithNoName(t *testing.T) { - c := &testClient{Error: true} + c := &simple.Client{Error: true} receivedNode, err := c.Setup(t).Nodes().Get("") - if (err != nil) && (err.Error() != nameRequiredError) { - t.Errorf("Expected error: %v, but got %v", nameRequiredError, err) + defer c.Close() + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) } c.Validate(t, receivedNode, err) @@ -111,29 +120,31 @@ func TestCreateNode(t *testing.T) { Unschedulable: false, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Default.ResourcePath(getNodesResourceName(), "", ""), Body: requestNode}, - Response: Response{ + Response: simple.Response{ StatusCode: 200, Body: requestNode, }, } receivedNode, err := c.Setup(t).Nodes().Create(requestNode) + defer c.Close() c.Validate(t, receivedNode, err) } func TestDeleteNode(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "DELETE", Path: testapi.Default.ResourcePath(getNodesResourceName(), "", "foo"), }, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).Nodes().Delete("foo") + defer c.Close() c.Validate(t, nil, err) } @@ -153,13 +164,14 @@ func TestUpdateNode(t *testing.T) { Unschedulable: true, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Default.ResourcePath(getNodesResourceName(), "", "foo"), }, - Response: Response{StatusCode: 200, Body: requestNode}, + Response: simple.Response{StatusCode: 200, Body: requestNode}, } response, err := c.Setup(t).Nodes().Update(requestNode) + defer c.Close() c.Validate(t, response, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolume_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolume_test.go index 6b09f5f51..329539a83 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolume_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolume_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -23,8 +28,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getPersistentVolumesResoureName() string { @@ -46,17 +49,18 @@ func TestPersistentVolumeCreate(t *testing.T) { }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Default.ResourcePath(getPersistentVolumesResoureName(), "", ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: pv, }, - Response: Response{StatusCode: 200, Body: pv}, + Response: simple.Response{StatusCode: 200, Body: pv}, } response, err := c.Setup(t).PersistentVolumes().Create(pv) + defer c.Close() c.Validate(t, response, err) } @@ -75,17 +79,18 @@ func TestPersistentVolumeGet(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getPersistentVolumesResoureName(), "", "abc"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: persistentVolume}, + Response: simple.Response{StatusCode: 200, Body: persistentVolume}, } response, err := c.Setup(t).PersistentVolumes().Get("abc") + defer c.Close() c.Validate(t, response, err) } @@ -97,16 +102,17 @@ func TestPersistentVolumeList(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getPersistentVolumesResoureName(), "", ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: persistentVolumeList}, + Response: simple.Response{StatusCode: 200, Body: persistentVolumeList}, } - response, err := c.Setup(t).PersistentVolumes().List(labels.Everything(), fields.Everything()) + response, err := c.Setup(t).PersistentVolumes().List(api.ListOptions{}) + defer c.Close() c.Validate(t, response, err) } @@ -125,11 +131,12 @@ func TestPersistentVolumeUpdate(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath(getPersistentVolumesResoureName(), "", "abc"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: persistentVolume}, + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath(getPersistentVolumesResoureName(), "", "abc"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: persistentVolume}, } response, err := c.Setup(t).PersistentVolumes().Update(persistentVolume) + defer c.Close() c.Validate(t, response, err) } @@ -152,34 +159,37 @@ func TestPersistentVolumeStatusUpdate(t *testing.T) { Message: "foo", }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Default.ResourcePath(getPersistentVolumesResoureName(), "", "abc") + "/status", - Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: persistentVolume}, + Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: persistentVolume}, } response, err := c.Setup(t).PersistentVolumes().UpdateStatus(persistentVolume) + defer c.Close() c.Validate(t, response, err) } func TestPersistentVolumeDelete(t *testing.T) { - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath(getPersistentVolumesResoureName(), "", "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath(getPersistentVolumesResoureName(), "", "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).PersistentVolumes().Delete("foo") + defer c.Close() c.Validate(t, nil, err) } func TestPersistentVolumeWatch(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePathWithPrefix("watch", getPersistentVolumesResoureName(), "", ""), Query: url.Values{"resourceVersion": []string{}}}, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } - _, err := c.Setup(t).PersistentVolumes().Watch(labels.Everything(), fields.Everything(), "") + _, err := c.Setup(t).PersistentVolumes().Watch(api.ListOptions{}) + defer c.Close() c.Validate(t, nil, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumeclaim.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumeclaim.go index 23453b333..bf5447d75 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumeclaim.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumeclaim.go @@ -17,11 +17,7 @@ limitations under the License. package unversioned import ( - "fmt" - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -32,13 +28,13 @@ type PersistentVolumeClaimsNamespacer interface { // PersistentVolumeClaimInterface has methods to work with PersistentVolumeClaim resources. type PersistentVolumeClaimInterface interface { - List(label labels.Selector, field fields.Selector) (*api.PersistentVolumeClaimList, error) + List(opts api.ListOptions) (*api.PersistentVolumeClaimList, error) Get(name string) (*api.PersistentVolumeClaim, error) Create(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) Update(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) UpdateStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) Delete(name string) error - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // persistentVolumeClaims implements PersistentVolumeClaimsNamespacer interface @@ -52,14 +48,13 @@ func newPersistentVolumeClaims(c *Client, namespace string) *persistentVolumeCla return &persistentVolumeClaims{c, namespace} } -func (c *persistentVolumeClaims) List(label labels.Selector, field fields.Selector) (result *api.PersistentVolumeClaimList, err error) { +func (c *persistentVolumeClaims) List(opts api.ListOptions) (result *api.PersistentVolumeClaimList, err error) { result = &api.PersistentVolumeClaimList{} err = c.client.Get(). Namespace(c.namespace). Resource("persistentVolumeClaims"). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Do(). Into(result) @@ -80,10 +75,6 @@ func (c *persistentVolumeClaims) Create(claim *api.PersistentVolumeClaim) (resul func (c *persistentVolumeClaims) Update(claim *api.PersistentVolumeClaim) (result *api.PersistentVolumeClaim, err error) { result = &api.PersistentVolumeClaim{} - if len(claim.ResourceVersion) == 0 { - err = fmt.Errorf("invalid update object, missing resource version: %v", claim) - return - } err = c.client.Put().Namespace(c.namespace).Resource("persistentVolumeClaims").Name(claim.Name).Body(claim).Do().Into(result) return } @@ -98,13 +89,11 @@ func (c *persistentVolumeClaims) Delete(name string) error { return c.client.Delete().Namespace(c.namespace).Resource("persistentVolumeClaims").Name(name).Do().Error() } -func (c *persistentVolumeClaims) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *persistentVolumeClaims) Watch(opts api.ListOptions) (watch.Interface, error) { return c.client.Get(). Prefix("watch"). Namespace(c.namespace). Resource("persistentVolumeClaims"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumeclaim_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumeclaim_test.go index ae50560ab..837b72a9c 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumeclaim_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumeclaim_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -23,8 +28,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getPersistentVolumeClaimsResoureName() string { @@ -50,17 +53,18 @@ func TestPersistentVolumeClaimCreate(t *testing.T) { }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Default.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: pv, }, - Response: Response{StatusCode: 200, Body: pv}, + Response: simple.Response{StatusCode: 200, Body: pv}, } response, err := c.Setup(t).PersistentVolumeClaims(ns).Create(pv) + defer c.Close() c.Validate(t, response, err) } @@ -83,17 +87,18 @@ func TestPersistentVolumeClaimGet(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: persistentVolumeClaim}, + Response: simple.Response{StatusCode: 200, Body: persistentVolumeClaim}, } response, err := c.Setup(t).PersistentVolumeClaims(ns).Get("abc") + defer c.Close() c.Validate(t, response, err) } @@ -106,16 +111,17 @@ func TestPersistentVolumeClaimList(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: persistentVolumeList}, + Response: simple.Response{StatusCode: 200, Body: persistentVolumeList}, } - response, err := c.Setup(t).PersistentVolumeClaims(ns).List(labels.Everything(), fields.Everything()) + response, err := c.Setup(t).PersistentVolumeClaims(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, response, err) } @@ -138,11 +144,12 @@ func TestPersistentVolumeClaimUpdate(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: persistentVolumeClaim}, + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: persistentVolumeClaim}, } response, err := c.Setup(t).PersistentVolumeClaims(ns).Update(persistentVolumeClaim) + defer c.Close() c.Validate(t, response, err) } @@ -168,35 +175,38 @@ func TestPersistentVolumeClaimStatusUpdate(t *testing.T) { Phase: api.ClaimBound, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Default.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc") + "/status", - Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: persistentVolumeClaim}, + Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: persistentVolumeClaim}, } response, err := c.Setup(t).PersistentVolumeClaims(ns).UpdateStatus(persistentVolumeClaim) + defer c.Close() c.Validate(t, response, err) } func TestPersistentVolumeClaimDelete(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).PersistentVolumeClaims(ns).Delete("foo") + defer c.Close() c.Validate(t, nil, err) } func TestPersistentVolumeClaimWatch(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePathWithPrefix("watch", getPersistentVolumeClaimsResoureName(), "", ""), Query: url.Values{"resourceVersion": []string{}}}, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } - _, err := c.Setup(t).PersistentVolumeClaims(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), "") + _, err := c.Setup(t).PersistentVolumeClaims(api.NamespaceAll).Watch(api.ListOptions{}) + defer c.Close() c.Validate(t, nil, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumes.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumes.go index bf3628645..2de17bb71 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumes.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/persistentvolumes.go @@ -17,11 +17,7 @@ limitations under the License. package unversioned import ( - "fmt" - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -31,13 +27,13 @@ type PersistentVolumesInterface interface { // PersistentVolumeInterface has methods to work with PersistentVolume resources. type PersistentVolumeInterface interface { - List(label labels.Selector, field fields.Selector) (*api.PersistentVolumeList, error) + List(opts api.ListOptions) (*api.PersistentVolumeList, error) Get(name string) (*api.PersistentVolume, error) Create(volume *api.PersistentVolume) (*api.PersistentVolume, error) Update(volume *api.PersistentVolume) (*api.PersistentVolume, error) UpdateStatus(persistentVolume *api.PersistentVolume) (*api.PersistentVolume, error) Delete(name string) error - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // persistentVolumes implements PersistentVolumesInterface @@ -49,12 +45,11 @@ func newPersistentVolumes(c *Client) *persistentVolumes { return &persistentVolumes{c} } -func (c *persistentVolumes) List(label labels.Selector, field fields.Selector) (result *api.PersistentVolumeList, err error) { +func (c *persistentVolumes) List(opts api.ListOptions) (result *api.PersistentVolumeList, err error) { result = &api.PersistentVolumeList{} err = c.client.Get(). Resource("persistentVolumes"). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Do(). Into(result) @@ -75,10 +70,6 @@ func (c *persistentVolumes) Create(volume *api.PersistentVolume) (result *api.Pe func (c *persistentVolumes) Update(volume *api.PersistentVolume) (result *api.PersistentVolume, err error) { result = &api.PersistentVolume{} - if len(volume.ResourceVersion) == 0 { - err = fmt.Errorf("invalid update object, missing resource version: %v", volume) - return - } err = c.client.Put().Resource("persistentVolumes").Name(volume.Name).Body(volume).Do().Into(result) return } @@ -93,12 +84,10 @@ func (c *persistentVolumes) Delete(name string) error { return c.client.Delete().Resource("persistentVolumes").Name(name).Do().Error() } -func (c *persistentVolumes) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *persistentVolumes) Watch(opts api.ListOptions) (watch.Interface, error) { return c.client.Get(). Prefix("watch"). Resource("persistentVolumes"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/pod_templates.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/pod_templates.go index 13d9a6bf8..ed5b733c6 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/pod_templates.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/pod_templates.go @@ -18,8 +18,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -30,12 +28,12 @@ type PodTemplatesNamespacer interface { // PodTemplateInterface has methods to work with PodTemplate resources. type PodTemplateInterface interface { - List(label labels.Selector, field fields.Selector) (*api.PodTemplateList, error) + List(opts api.ListOptions) (*api.PodTemplateList, error) Get(name string) (*api.PodTemplate, error) Delete(name string, options *api.DeleteOptions) error Create(podTemplate *api.PodTemplate) (*api.PodTemplate, error) Update(podTemplate *api.PodTemplate) (*api.PodTemplate, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // podTemplates implements PodTemplatesNamespacer interface @@ -53,9 +51,9 @@ func newPodTemplates(c *Client, namespace string) *podTemplates { } // List takes label and field selectors, and returns the list of podTemplates that match those selectors. -func (c *podTemplates) List(label labels.Selector, field fields.Selector) (result *api.PodTemplateList, err error) { +func (c *podTemplates) List(opts api.ListOptions) (result *api.PodTemplateList, err error) { result = &api.PodTemplateList{} - err = c.r.Get().Namespace(c.ns).Resource("podTemplates").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.r.Get().Namespace(c.ns).Resource("podTemplates").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } @@ -68,15 +66,7 @@ func (c *podTemplates) Get(name string) (result *api.PodTemplate, err error) { // Delete takes the name of the podTemplate, and returns an error if one occurs func (c *podTemplates) Delete(name string, options *api.DeleteOptions) error { - // TODO: to make this reusable in other client libraries - if options == nil { - return c.r.Delete().Namespace(c.ns).Resource("podTemplates").Name(name).Do().Error() - } - body, err := api.Scheme.EncodeToVersion(options, c.r.APIVersion()) - if err != nil { - return err - } - return c.r.Delete().Namespace(c.ns).Resource("podTemplates").Name(name).Body(body).Do().Error() + return c.r.Delete().Namespace(c.ns).Resource("podTemplates").Name(name).Body(options).Do().Error() } // Create takes the representation of a podTemplate. Returns the server's representation of the podTemplate, and an error, if it occurs. @@ -94,13 +84,11 @@ func (c *podTemplates) Update(podTemplate *api.PodTemplate) (result *api.PodTemp } // Watch returns a watch.Interface that watches the requested podTemplates. -func (c *podTemplates) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *podTemplates) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). Resource("podTemplates"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/pod_templates_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/pod_templates_test.go index 5f35efa9d..bd9bcb549 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/pod_templates_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/pod_templates_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -22,8 +27,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getPodTemplatesResoureName() string { @@ -39,17 +42,18 @@ func TestPodTemplateCreate(t *testing.T) { }, Template: api.PodTemplateSpec{}, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Default.ResourcePath(getPodTemplatesResoureName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: &podTemplate, }, - Response: Response{StatusCode: 200, Body: &podTemplate}, + Response: simple.Response{StatusCode: 200, Body: &podTemplate}, } response, err := c.Setup(t).PodTemplates(ns).Create(&podTemplate) + defer c.Close() c.Validate(t, response, err) } @@ -62,17 +66,18 @@ func TestPodTemplateGet(t *testing.T) { }, Template: api.PodTemplateSpec{}, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getPodTemplatesResoureName(), ns, "abc"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: podTemplate}, + Response: simple.Response{StatusCode: 200, Body: podTemplate}, } response, err := c.Setup(t).PodTemplates(ns).Get("abc") + defer c.Close() c.Validate(t, response, err) } @@ -88,16 +93,17 @@ func TestPodTemplateList(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getPodTemplatesResoureName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: podTemplateList}, + Response: simple.Response{StatusCode: 200, Body: podTemplateList}, } - response, err := c.Setup(t).PodTemplates(ns).List(labels.Everything(), fields.Everything()) + response, err := c.Setup(t).PodTemplates(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, response, err) } @@ -111,32 +117,35 @@ func TestPodTemplateUpdate(t *testing.T) { }, Template: api.PodTemplateSpec{}, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath(getPodTemplatesResoureName(), ns, "abc"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: podTemplate}, + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath(getPodTemplatesResoureName(), ns, "abc"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: podTemplate}, } response, err := c.Setup(t).PodTemplates(ns).Update(podTemplate) + defer c.Close() c.Validate(t, response, err) } func TestPodTemplateDelete(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath(getPodTemplatesResoureName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath(getPodTemplatesResoureName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).PodTemplates(ns).Delete("foo", nil) + defer c.Close() c.Validate(t, nil, err) } func TestPodTemplateWatch(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePathWithPrefix("watch", getPodTemplatesResoureName(), "", ""), Query: url.Values{"resourceVersion": []string{}}}, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } - _, err := c.Setup(t).PodTemplates(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), "") + _, err := c.Setup(t).PodTemplates(api.NamespaceAll).Watch(api.ListOptions{}) + defer c.Close() c.Validate(t, nil, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/pods.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/pods.go index 2d465b12b..04bb989c2 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/pods.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/pods.go @@ -18,8 +18,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -30,14 +28,15 @@ type PodsNamespacer interface { // PodInterface has methods to work with Pod resources. type PodInterface interface { - List(label labels.Selector, field fields.Selector) (*api.PodList, error) + List(opts api.ListOptions) (*api.PodList, error) Get(name string) (*api.Pod, error) Delete(name string, options *api.DeleteOptions) error Create(pod *api.Pod) (*api.Pod, error) Update(pod *api.Pod) (*api.Pod, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) Bind(binding *api.Binding) error UpdateStatus(pod *api.Pod) (*api.Pod, error) + GetLogs(name string, opts *api.PodLogOptions) *Request } // pods implements PodsNamespacer interface @@ -55,9 +54,9 @@ func newPods(c *Client, namespace string) *pods { } // List takes label and field selectors, and returns the list of pods that match those selectors. -func (c *pods) List(label labels.Selector, field fields.Selector) (result *api.PodList, err error) { +func (c *pods) List(opts api.ListOptions) (result *api.PodList, err error) { result = &api.PodList{} - err = c.r.Get().Namespace(c.ns).Resource("pods").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.r.Get().Namespace(c.ns).Resource("pods").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } @@ -70,15 +69,7 @@ func (c *pods) Get(name string) (result *api.Pod, err error) { // Delete takes the name of the pod, and returns an error if one occurs func (c *pods) Delete(name string, options *api.DeleteOptions) error { - // TODO: to make this reusable in other client libraries - if options == nil { - return c.r.Delete().Namespace(c.ns).Resource("pods").Name(name).Do().Error() - } - body, err := api.Scheme.EncodeToVersion(options, c.r.APIVersion()) - if err != nil { - return err - } - return c.r.Delete().Namespace(c.ns).Resource("pods").Name(name).Body(body).Do().Error() + return c.r.Delete().Namespace(c.ns).Resource("pods").Name(name).Body(options).Do().Error() } // Create takes the representation of a pod. Returns the server's representation of the pod, and an error, if it occurs. @@ -96,14 +87,12 @@ func (c *pods) Update(pod *api.Pod) (result *api.Pod, err error) { } // Watch returns a watch.Interface that watches the requested pods. -func (c *pods) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *pods) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). Resource("pods"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } @@ -118,3 +107,8 @@ func (c *pods) UpdateStatus(pod *api.Pod) (result *api.Pod, err error) { err = c.r.Put().Namespace(c.ns).Resource("pods").Name(pod.Name).SubResource("status").Body(pod).Do().Into(result) return } + +// Get constructs a request for getting the logs for a pod +func (c *pods) GetLogs(name string, opts *api.PodLogOptions) *Request { + return c.r.Get().Namespace(c.ns).Name(name).Resource("pods").SubResource("log").VersionedParams(opts, api.ParameterCodec) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/pods_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/pods_test.go index 2e2a41725..49175facb 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/pods_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/pods_test.go @@ -14,34 +14,38 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import . "k8s.io/kubernetes/pkg/client/unversioned" import ( + "net/http" "net/url" "testing" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" - "k8s.io/kubernetes/pkg/fields" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" "k8s.io/kubernetes/pkg/labels" ) func TestListEmptyPods(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.Default.ResourcePath("pods", ns, ""), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: &api.PodList{}}, + c := &simple.Client{ + Request: simple.Request{Method: "GET", Path: testapi.Default.ResourcePath("pods", ns, ""), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: http.StatusOK, Body: &api.PodList{}}, } - podList, err := c.Setup(t).Pods(ns).List(labels.Everything(), fields.Everything()) + podList, err := c.Setup(t).Pods(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, podList, err) } func TestListPods(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.Default.ResourcePath("pods", ns, ""), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, + c := &simple.Client{ + Request: simple.Request{Method: "GET", Path: testapi.Default.ResourcePath("pods", ns, ""), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: http.StatusOK, Body: &api.PodList{ Items: []api.Pod{ { @@ -59,20 +63,21 @@ func TestListPods(t *testing.T) { }, }, } - receivedPodList, err := c.Setup(t).Pods(ns).List(labels.Everything(), fields.Everything()) + receivedPodList, err := c.Setup(t).Pods(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, receivedPodList, err) } func TestListPodsLabels(t *testing.T) { ns := api.NamespaceDefault - labelSelectorQueryParamName := unversioned.LabelSelectorQueryParam(testapi.Default.Version()) - c := &testClient{ - Request: testRequest{ + labelSelectorQueryParamName := unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()) + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath("pods", ns, ""), - Query: buildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, - Response: Response{ - StatusCode: 200, + Query: simple.BuildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, + Response: simple.Response{ + StatusCode: http.StatusOK, Body: &api.PodList{ Items: []api.Pod{ { @@ -91,18 +96,20 @@ func TestListPodsLabels(t *testing.T) { }, } c.Setup(t) - c.QueryValidator[labelSelectorQueryParamName] = validateLabels + defer c.Close() + c.QueryValidator[labelSelectorQueryParamName] = simple.ValidateLabels selector := labels.Set{"foo": "bar", "name": "baz"}.AsSelector() - receivedPodList, err := c.Pods(ns).List(selector, fields.Everything()) + options := api.ListOptions{LabelSelector: selector} + receivedPodList, err := c.Pods(ns).List(options) c.Validate(t, receivedPodList, err) } func TestGetPod(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.Default.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{ - StatusCode: 200, + c := &simple.Client{ + Request: simple.Request{Method: "GET", Path: testapi.Default.ResourcePath("pods", ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ + StatusCode: http.StatusOK, Body: &api.Pod{ Status: api.PodStatus{ Phase: api.PodRunning, @@ -117,15 +124,17 @@ func TestGetPod(t *testing.T) { }, } receivedPod, err := c.Setup(t).Pods(ns).Get("foo") + defer c.Close() c.Validate(t, receivedPod, err) } func TestGetPodWithNoName(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{Error: true} + c := &simple.Client{Error: true} receivedPod, err := c.Setup(t).Pods(ns).Get("") - if (err != nil) && (err.Error() != nameRequiredError) { - t.Errorf("Expected error: %v, but got %v", nameRequiredError, err) + defer c.Close() + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) } c.Validate(t, receivedPod, err) @@ -133,11 +142,12 @@ func TestGetPodWithNoName(t *testing.T) { func TestDeletePod(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath("pods", ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: http.StatusOK}, } err := c.Setup(t).Pods(ns).Delete("foo", nil) + defer c.Close() c.Validate(t, nil, err) } @@ -154,14 +164,15 @@ func TestCreatePod(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{Method: "POST", Path: testapi.Default.ResourcePath("pods", ns, ""), Query: buildQueryValues(nil), Body: requestPod}, - Response: Response{ - StatusCode: 200, + c := &simple.Client{ + Request: simple.Request{Method: "POST", Path: testapi.Default.ResourcePath("pods", ns, ""), Query: simple.BuildQueryValues(nil), Body: requestPod}, + Response: simple.Response{ + StatusCode: http.StatusOK, Body: requestPod, }, } receivedPod, err := c.Setup(t).Pods(ns).Create(requestPod) + defer c.Close() c.Validate(t, receivedPod, err) } @@ -180,10 +191,38 @@ func TestUpdatePod(t *testing.T) { Phase: api.PodRunning, }, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: requestPod}, + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath("pods", ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: http.StatusOK, Body: requestPod}, } receivedPod, err := c.Setup(t).Pods(ns).Update(requestPod) + defer c.Close() c.Validate(t, receivedPod, err) } + +func TestPodGetLogs(t *testing.T) { + ns := api.NamespaceDefault + opts := &api.PodLogOptions{ + Follow: true, + Timestamps: true, + } + c := &simple.Client{ + Request: simple.Request{ + Method: "GET", + Path: testapi.Default.ResourcePath("pods", ns, "podName") + "/log", + Query: url.Values{ + "follow": []string{"true"}, + "timestamps": []string{"true"}, + }, + }, + Response: simple.Response{StatusCode: http.StatusOK}, + } + + body, err := c.Setup(t).Pods(ns).GetLogs("podName", opts).Stream() + defer c.Close() + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + defer body.Close() + c.ValidateCommon(t, err) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/podsecuritypolicy.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/podsecuritypolicy.go new file mode 100644 index 000000000..64a34b4b2 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/podsecuritypolicy.go @@ -0,0 +1,111 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/watch" +) + +type PodSecurityPoliciesInterface interface { + PodSecurityPolicies() PodSecurityPolicyInterface +} + +type PodSecurityPolicyInterface interface { + Get(name string) (result *extensions.PodSecurityPolicy, err error) + Create(scc *extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) + List(opts api.ListOptions) (*extensions.PodSecurityPolicyList, error) + Delete(name string) error + Update(*extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) + Watch(opts api.ListOptions) (watch.Interface, error) +} + +// podSecurityPolicy implements PodSecurityPolicyInterface +type podSecurityPolicy struct { + client *ExtensionsClient +} + +// newPodSecurityPolicy returns a podSecurityPolicy object. +func newPodSecurityPolicy(c *ExtensionsClient) *podSecurityPolicy { + return &podSecurityPolicy{c} +} + +func (s *podSecurityPolicy) Create(scc *extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) { + result := &extensions.PodSecurityPolicy{} + err := s.client.Post(). + Resource("podsecuritypolicies"). + Body(scc). + Do(). + Into(result) + + return result, err +} + +// List returns a list of PodSecurityPolicies matching the selectors. +func (s *podSecurityPolicy) List(opts api.ListOptions) (*extensions.PodSecurityPolicyList, error) { + result := &extensions.PodSecurityPolicyList{} + + err := s.client.Get(). + Resource("podsecuritypolicies"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + + return result, err +} + +// Get returns the given PodSecurityPolicy, or an error. +func (s *podSecurityPolicy) Get(name string) (*extensions.PodSecurityPolicy, error) { + result := &extensions.PodSecurityPolicy{} + err := s.client.Get(). + Resource("podsecuritypolicies"). + Name(name). + Do(). + Into(result) + + return result, err +} + +// Watch starts watching for PodSecurityPolicies matching the given selectors. +func (s *podSecurityPolicy) Watch(opts api.ListOptions) (watch.Interface, error) { + return s.client.Get(). + Prefix("watch"). + Resource("podsecuritypolicies"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +func (s *podSecurityPolicy) Delete(name string) error { + return s.client.Delete(). + Resource("podsecuritypolicies"). + Name(name). + Do(). + Error() +} + +func (s *podSecurityPolicy) Update(psp *extensions.PodSecurityPolicy) (result *extensions.PodSecurityPolicy, err error) { + result = &extensions.PodSecurityPolicy{} + err = s.client.Put(). + Resource("podsecuritypolicies"). + Name(psp.Name). + Body(psp). + Do(). + Into(result) + + return +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/podsecuritypolicy_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/podsecuritypolicy_test.go new file mode 100644 index 000000000..dee0f5935 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/podsecuritypolicy_test.go @@ -0,0 +1,138 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned_test + +import ( + "fmt" + "net/url" + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/apis/extensions" + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) + +func TestPodSecurityPolicyCreate(t *testing.T) { + ns := api.NamespaceNone + scc := &extensions.PodSecurityPolicy{ + ObjectMeta: api.ObjectMeta{ + Name: "abc", + }, + } + + c := &simple.Client{ + Request: simple.Request{ + Method: "POST", + Path: testapi.Extensions.ResourcePath(getPSPResourcename(), ns, ""), + Query: simple.BuildQueryValues(nil), + Body: scc, + }, + Response: simple.Response{StatusCode: 200, Body: scc}, + } + + response, err := c.Setup(t).PodSecurityPolicies().Create(scc) + c.Validate(t, response, err) +} + +func TestPodSecurityPolicyGet(t *testing.T) { + ns := api.NamespaceNone + scc := &extensions.PodSecurityPolicy{ + ObjectMeta: api.ObjectMeta{ + Name: "abc", + }, + } + c := &simple.Client{ + Request: simple.Request{ + Method: "GET", + Path: testapi.Extensions.ResourcePath(getPSPResourcename(), ns, "abc"), + Query: simple.BuildQueryValues(nil), + Body: nil, + }, + Response: simple.Response{StatusCode: 200, Body: scc}, + } + + response, err := c.Setup(t).PodSecurityPolicies().Get("abc") + c.Validate(t, response, err) +} + +func TestPodSecurityPolicyList(t *testing.T) { + ns := api.NamespaceNone + sccList := &extensions.PodSecurityPolicyList{ + Items: []extensions.PodSecurityPolicy{ + { + ObjectMeta: api.ObjectMeta{ + Name: "abc", + }, + }, + }, + } + c := &simple.Client{ + Request: simple.Request{ + Method: "GET", + Path: testapi.Extensions.ResourcePath(getPSPResourcename(), ns, ""), + Query: simple.BuildQueryValues(nil), + Body: nil, + }, + Response: simple.Response{StatusCode: 200, Body: sccList}, + } + response, err := c.Setup(t).PodSecurityPolicies().List(api.ListOptions{}) + c.Validate(t, response, err) +} + +func TestPodSecurityPolicyUpdate(t *testing.T) { + ns := api.NamespaceNone + scc := &extensions.PodSecurityPolicy{ + ObjectMeta: api.ObjectMeta{ + Name: "abc", + ResourceVersion: "1", + }, + } + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getPSPResourcename(), ns, "abc"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: scc}, + } + response, err := c.Setup(t).PodSecurityPolicies().Update(scc) + c.Validate(t, response, err) +} + +func TestPodSecurityPolicyDelete(t *testing.T) { + ns := api.NamespaceNone + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getPSPResourcename(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, + } + err := c.Setup(t).PodSecurityPolicies().Delete("foo") + c.Validate(t, nil, err) +} + +func TestPodSecurityPolicyWatch(t *testing.T) { + c := &simple.Client{ + Request: simple.Request{ + Method: "GET", + Path: fmt.Sprintf("%s/watch/%s", testapi.Extensions.ResourcePath("", "", ""), getPSPResourcename()), + Query: url.Values{"resourceVersion": []string{}}}, + Response: simple.Response{StatusCode: 200}, + } + _, err := c.Setup(t).PodSecurityPolicies().Watch(api.ListOptions{}) + c.Validate(t, nil, err) +} + +func getPSPResourcename() string { + return "podsecuritypolicies" +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/portforward/portforward.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/portforward/portforward.go index 36916bdcf..78e6695e6 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/portforward/portforward.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/portforward/portforward.go @@ -29,8 +29,9 @@ import ( "github.com/golang/glog" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/kubelet/server/portforward" "k8s.io/kubernetes/pkg/util/httpstream" + "k8s.io/kubernetes/pkg/util/runtime" ) // PortForwarder knows how to listen for local connections and forward them to @@ -128,7 +129,7 @@ func (pf *PortForwarder) ForwardPorts() error { defer pf.Close() var err error - pf.streamConn, err = pf.dialer.Dial() + pf.streamConn, _, err = pf.dialer.Dial(portforward.PortForwardProtocolV1Name) if err != nil { return fmt.Errorf("error upgrading connection: %s", err) } @@ -164,7 +165,7 @@ func (pf *PortForwarder) forward() error { select { case <-pf.stopChan: case <-pf.streamConn.CloseChan(): - util.HandleError(errors.New("lost connection to pod")) + runtime.HandleError(errors.New("lost connection to pod")) } return nil @@ -198,7 +199,7 @@ func (pf *PortForwarder) listenOnPortAndAddress(port *ForwardedPort, protocol st func (pf *PortForwarder) getListener(protocol string, hostname string, port *ForwardedPort) (net.Listener, error) { listener, err := net.Listen(protocol, fmt.Sprintf("%s:%d", hostname, port.Local)) if err != nil { - util.HandleError(fmt.Errorf("Unable to create listener: Error %s", err)) + runtime.HandleError(fmt.Errorf("Unable to create listener: Error %s", err)) return nil, err } listenerAddress := listener.Addr().String() @@ -222,7 +223,7 @@ func (pf *PortForwarder) waitForConnection(listener net.Listener, port Forwarded if err != nil { // TODO consider using something like https://github.com/hydrogen18/stoppableListener? if !strings.Contains(strings.ToLower(err.Error()), "use of closed network connection") { - util.HandleError(fmt.Errorf("Error accepting connection on port %d: %v", port.Local, err)) + runtime.HandleError(fmt.Errorf("Error accepting connection on port %d: %v", port.Local, err)) } return } @@ -254,7 +255,7 @@ func (pf *PortForwarder) handleConnection(conn net.Conn, port ForwardedPort) { headers.Set(api.PortForwardRequestIDHeader, strconv.Itoa(requestID)) errorStream, err := pf.streamConn.CreateStream(headers) if err != nil { - util.HandleError(fmt.Errorf("error creating error stream for port %d -> %d: %v", port.Local, port.Remote, err)) + runtime.HandleError(fmt.Errorf("error creating error stream for port %d -> %d: %v", port.Local, port.Remote, err)) return } // we're not writing to this stream @@ -276,7 +277,7 @@ func (pf *PortForwarder) handleConnection(conn net.Conn, port ForwardedPort) { headers.Set(api.StreamType, api.StreamTypeData) dataStream, err := pf.streamConn.CreateStream(headers) if err != nil { - util.HandleError(fmt.Errorf("error creating forwarding stream for port %d -> %d: %v", port.Local, port.Remote, err)) + runtime.HandleError(fmt.Errorf("error creating forwarding stream for port %d -> %d: %v", port.Local, port.Remote, err)) return } @@ -286,7 +287,7 @@ func (pf *PortForwarder) handleConnection(conn net.Conn, port ForwardedPort) { go func() { // Copy from the remote side to the local port. if _, err := io.Copy(conn, dataStream); err != nil && !strings.Contains(err.Error(), "use of closed network connection") { - util.HandleError(fmt.Errorf("error copying from remote stream to local connection: %v", err)) + runtime.HandleError(fmt.Errorf("error copying from remote stream to local connection: %v", err)) } // inform the select below that the remote copy is done @@ -299,7 +300,7 @@ func (pf *PortForwarder) handleConnection(conn net.Conn, port ForwardedPort) { // Copy from the local port to the remote side. if _, err := io.Copy(dataStream, conn); err != nil && !strings.Contains(err.Error(), "use of closed network connection") { - util.HandleError(fmt.Errorf("error copying from local connection to remote stream: %v", err)) + runtime.HandleError(fmt.Errorf("error copying from local connection to remote stream: %v", err)) // break out of the select below without waiting for the other copy to finish close(localError) } @@ -314,7 +315,7 @@ func (pf *PortForwarder) handleConnection(conn net.Conn, port ForwardedPort) { // always expect something on errorChan (it may be nil) err = <-errorChan if err != nil { - util.HandleError(err) + runtime.HandleError(err) } } @@ -322,7 +323,7 @@ func (pf *PortForwarder) Close() { // stop all listeners for _, l := range pf.listeners { if err := l.Close(); err != nil { - util.HandleError(fmt.Errorf("error closing listener: %v", err)) + runtime.HandleError(fmt.Errorf("error closing listener: %v", err)) } } } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/portforward/portforward_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/portforward/portforward_test.go index f208a9e88..2d5060b29 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/portforward/portforward_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/portforward/portforward_test.go @@ -32,20 +32,21 @@ import ( client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/remotecommand" - "k8s.io/kubernetes/pkg/kubelet" + kubeletserver "k8s.io/kubernetes/pkg/kubelet/server" "k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/util/httpstream" ) type fakeDialer struct { - dialed bool - conn httpstream.Connection - err error + dialed bool + conn httpstream.Connection + err error + negotiatedProtocol string } -func (d *fakeDialer) Dial() (httpstream.Connection, error) { +func (d *fakeDialer) Dial(protocols ...string) (httpstream.Connection, string, error) { d.dialed = true - return d.conn, d.err + return d.conn, d.negotiatedProtocol, d.err } func TestParsePortsAndNew(t *testing.T) { @@ -203,47 +204,39 @@ func TestGetListener(t *testing.T) { } // fakePortForwarder simulates port forwarding for testing. It implements -// kubelet.PortForwarder. +// kubeletserver.PortForwarder. type fakePortForwarder struct { lock sync.Mutex + // stores data expected from the stream per port + expected map[uint16]string // stores data received from the stream per port received map[uint16]string // data to be sent to the stream per port send map[uint16]string } -var _ kubelet.PortForwarder = &fakePortForwarder{} +var _ kubeletserver.PortForwarder = &fakePortForwarder{} func (pf *fakePortForwarder) PortForward(name string, uid types.UID, port uint16, stream io.ReadWriteCloser) error { defer stream.Close() - var wg sync.WaitGroup + // read from the client + received := make([]byte, len(pf.expected[port])) + n, err := stream.Read(received) + if err != nil { + return fmt.Errorf("error reading from client for port %d: %v", port, err) + } + if n != len(pf.expected[port]) { + return fmt.Errorf("unexpected length read from client for port %d: got %d, expected %d. data=%q", port, n, len(pf.expected[port]), string(received)) + } - // client -> server - wg.Add(1) - go func() { - defer wg.Done() + // store the received content + pf.lock.Lock() + pf.received[port] = string(received) + pf.lock.Unlock() - // copy from stream into a buffer - received := new(bytes.Buffer) - io.Copy(received, stream) - - // store the received content - pf.lock.Lock() - pf.received[port] = received.String() - pf.lock.Unlock() - }() - - // server -> client - wg.Add(1) - go func() { - defer wg.Done() - - // send the hardcoded data to the stream - io.Copy(stream, strings.NewReader(pf.send[port])) - }() - - wg.Wait() + // send the hardcoded data to the client + io.Copy(stream, strings.NewReader(pf.send[port])) return nil } @@ -253,10 +246,11 @@ func (pf *fakePortForwarder) PortForward(name string, uid types.UID, port uint16 func fakePortForwardServer(t *testing.T, testName string, serverSends, expectedFromClient map[uint16]string) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { pf := &fakePortForwarder{ + expected: expectedFromClient, received: make(map[uint16]string), send: serverSends, } - kubelet.ServePortForward(w, req, pf, "pod", "uid", 0, 10*time.Second) + kubeletserver.ServePortForward(w, req, pf, "pod", "uid", 0, 10*time.Second) for port, expected := range expectedFromClient { actual, ok := pf.received[port] @@ -326,7 +320,8 @@ func TestForwardPorts(t *testing.T) { clientConn, err := net.Dial("tcp", fmt.Sprintf("localhost:%d", port)) if err != nil { t.Errorf("%s: error dialing %d: %s", testName, port, err) - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() continue } defer clientConn.Close() @@ -334,24 +329,28 @@ func TestForwardPorts(t *testing.T) { n, err := clientConn.Write([]byte(data)) if err != nil && err != io.EOF { t.Errorf("%s: Error sending data '%s': %s", testName, data, err) - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() continue } if n == 0 { t.Errorf("%s: unexpected write of 0 bytes", testName) - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() continue } b := make([]byte, 4) n, err = clientConn.Read(b) if err != nil && err != io.EOF { t.Errorf("%s: Error reading data: %s", testName, err) - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() continue } if !bytes.Equal([]byte(test.serverSends[port]), b) { t.Errorf("%s: expected to read '%s', got '%s'", testName, test.serverSends[port], b) - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() continue } } @@ -363,14 +362,16 @@ func TestForwardPorts(t *testing.T) { if err != nil { t.Errorf("%s: unexpected error: %s", testName, err) } - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() } } func TestForwardPortsReturnsErrorWhenAllBindsFailed(t *testing.T) { server := httptest.NewServer(fakePortForwardServer(t, "allBindsFailed", nil, nil)) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() url, _ := url.Parse(server.URL) exec, err := remotecommand.NewExecutor(&client.Config{}, "POST", url) diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand.go index 505e3fc9c..d827f1010 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand.go @@ -19,14 +19,13 @@ package remotecommand import ( "fmt" "io" - "io/ioutil" "net/http" "net/url" - "sync" - "k8s.io/kubernetes/pkg/api" + "github.com/golang/glog" + + "k8s.io/kubernetes/pkg/client/transport" client "k8s.io/kubernetes/pkg/client/unversioned" - "k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util/httpstream" "k8s.io/kubernetes/pkg/util/httpstream/spdy" ) @@ -97,155 +96,85 @@ func NewStreamExecutor(upgrader httpstream.UpgradeRoundTripper, fn func(http.Rou }, nil } -// Dial opens a connection to a remote server and attempts to negotiate a SPDY connection. -func (e *streamExecutor) Dial() (httpstream.Connection, error) { - client := &http.Client{Transport: e.transport} +// Dial opens a connection to a remote server and attempts to negotiate a SPDY +// connection. Upon success, it returns the connection and the protocol +// selected by the server. +func (e *streamExecutor) Dial(protocols ...string) (httpstream.Connection, string, error) { + rt := transport.DebugWrappers(e.transport) + + // TODO the client probably shouldn't be created here, as it doesn't allow + // flexibility to allow callers to configure it. + client := &http.Client{Transport: rt} req, err := http.NewRequest(e.method, e.url.String(), nil) if err != nil { - return nil, fmt.Errorf("error creating request: %s", err) + return nil, "", fmt.Errorf("error creating request: %v", err) + } + for i := range protocols { + req.Header.Add(httpstream.HeaderProtocolVersion, protocols[i]) } resp, err := client.Do(req) if err != nil { - return nil, fmt.Errorf("error sending request: %s", err) + return nil, "", fmt.Errorf("error sending request: %v", err) } defer resp.Body.Close() - // TODO: handle protocol selection in the future - return e.upgrader.NewConnection(resp) + conn, err := e.upgrader.NewConnection(resp) + if err != nil { + return nil, "", err + } + + return conn, resp.Header.Get(httpstream.HeaderProtocolVersion), nil +} + +const ( + // The SPDY subprotocol "channel.k8s.io" is used for remote command + // attachment/execution. This represents the initial unversioned subprotocol, + // which has the known bugs http://issues.k8s.io/13394 and + // http://issues.k8s.io/13395. + StreamProtocolV1Name = "channel.k8s.io" + // The SPDY subprotocol "v2.channel.k8s.io" is used for remote command + // attachment/execution. It is the second version of the subprotocol and + // resolves the issues present in the first version. + StreamProtocolV2Name = "v2.channel.k8s.io" +) + +type streamProtocolHandler interface { + stream(httpstream.Connection) error } // Stream opens a protocol streamer to the server and streams until a client closes // the connection or the server disconnects. func (e *streamExecutor) Stream(stdin io.Reader, stdout, stderr io.Writer, tty bool) error { - conn, err := e.Dial() + supportedProtocols := []string{StreamProtocolV2Name, StreamProtocolV1Name} + conn, protocol, err := e.Dial(supportedProtocols...) if err != nil { return err } defer conn.Close() - // TODO: negotiate protocols - streamer := &streamProtocol{ - stdin: stdin, - stdout: stdout, - stderr: stderr, - tty: tty, + + var streamer streamProtocolHandler + + switch protocol { + case StreamProtocolV2Name: + streamer = &streamProtocolV2{ + stdin: stdin, + stdout: stdout, + stderr: stderr, + tty: tty, + } + case "": + glog.V(4).Infof("The server did not negotiate a streaming protocol version. Falling back to %s", StreamProtocolV1Name) + fallthrough + case StreamProtocolV1Name: + streamer = &streamProtocolV1{ + stdin: stdin, + stdout: stdout, + stderr: stderr, + tty: tty, + } } + return streamer.stream(conn) } - -type streamProtocol struct { - stdin io.Reader - stdout io.Writer - stderr io.Writer - tty bool -} - -func (e *streamProtocol) stream(conn httpstream.Connection) error { - headers := http.Header{} - - // set up error stream - errorChan := make(chan error) - headers.Set(api.StreamType, api.StreamTypeError) - errorStream, err := conn.CreateStream(headers) - if err != nil { - return err - } - - go func() { - message, err := ioutil.ReadAll(errorStream) - switch { - case err != nil && err != io.EOF: - errorChan <- fmt.Errorf("error reading from error stream: %s", err) - case len(message) > 0: - errorChan <- fmt.Errorf("error executing remote command: %s", message) - default: - errorChan <- nil - } - close(errorChan) - }() - - var wg sync.WaitGroup - var once sync.Once - - // set up stdin stream - if e.stdin != nil { - headers.Set(api.StreamType, api.StreamTypeStdin) - remoteStdin, err := conn.CreateStream(headers) - if err != nil { - return err - } - - // copy from client's stdin to container's stdin - go func() { - // if e.stdin is noninteractive, e.g. `echo abc | kubectl exec -i -- cat`, make sure - // we close remoteStdin as soon as the copy from e.stdin to remoteStdin finishes. Otherwise - // the executed command will remain running. - defer once.Do(func() { remoteStdin.Close() }) - - if _, err := io.Copy(remoteStdin, e.stdin); err != nil { - util.HandleError(err) - } - }() - - // read from remoteStdin until the stream is closed. this is essential to - // be able to exit interactive sessions cleanly and not leak goroutines or - // hang the client's terminal. - // - // go-dockerclient's current hijack implementation - // (https://github.com/fsouza/go-dockerclient/blob/89f3d56d93788dfe85f864a44f85d9738fca0670/client.go#L564) - // waits for all three streams (stdin/stdout/stderr) to finish copying - // before returning. When hijack finishes copying stdout/stderr, it calls - // Close() on its side of remoteStdin, which allows this copy to complete. - // When that happens, we must Close() on our side of remoteStdin, to - // allow the copy in hijack to complete, and hijack to return. - go func() { - defer once.Do(func() { remoteStdin.Close() }) - // this "copy" doesn't actually read anything - it's just here to wait for - // the server to close remoteStdin. - if _, err := io.Copy(ioutil.Discard, remoteStdin); err != nil { - util.HandleError(err) - } - }() - } - - // set up stdout stream - if e.stdout != nil { - headers.Set(api.StreamType, api.StreamTypeStdout) - remoteStdout, err := conn.CreateStream(headers) - if err != nil { - return err - } - - wg.Add(1) - go func() { - defer wg.Done() - if _, err := io.Copy(e.stdout, remoteStdout); err != nil { - util.HandleError(err) - } - }() - } - - // set up stderr stream - if e.stderr != nil && !e.tty { - headers.Set(api.StreamType, api.StreamTypeStderr) - remoteStderr, err := conn.CreateStream(headers) - if err != nil { - return err - } - - wg.Add(1) - go func() { - defer wg.Done() - if _, err := io.Copy(e.stderr, remoteStderr); err != nil { - util.HandleError(err) - } - }() - } - - // we're waiting for stdout/stderr to finish copying - wg.Wait() - - // waits for errorStream to finish reading with an error or nil - return <-errorChan -} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand_test.go index 56cb3372b..71acd239d 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/remotecommand_test.go @@ -28,11 +28,25 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/util/httpstream" "k8s.io/kubernetes/pkg/util/httpstream/spdy" ) +type streamAndReply struct { + httpstream.Stream + replySent <-chan struct{} +} + +func waitStreamReply(replySent <-chan struct{}, notify chan<- struct{}, stop <-chan struct{}) { + select { + case <-replySent: + notify <- struct{}{} + case <-stop: + } +} + func fakeExecServer(t *testing.T, i int, stdinData, stdoutData, stderrData, errorData string, tty bool, messageCount int) http.HandlerFunc { // error + stdin + stdout expectedStreams := 3 @@ -42,11 +56,18 @@ func fakeExecServer(t *testing.T, i int, stdinData, stdoutData, stderrData, erro } return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - streamCh := make(chan httpstream.Stream) + protocol, err := httpstream.Handshake(req, w, []string{StreamProtocolV2Name}, StreamProtocolV1Name) + if err != nil { + t.Fatal(err) + } + if protocol != StreamProtocolV2Name { + t.Fatalf("unexpected protocol: %s", protocol) + } + streamCh := make(chan streamAndReply) upgrader := spdy.NewResponseUpgrader() - conn := upgrader.UpgradeResponse(w, req, func(stream httpstream.Stream) error { - streamCh <- stream + conn := upgrader.UpgradeResponse(w, req, func(stream httpstream.Stream, replySent <-chan struct{}) error { + streamCh <- streamAndReply{Stream: stream, replySent: replySent} return nil }) // from this point on, we can no longer call methods on w @@ -60,6 +81,9 @@ func fakeExecServer(t *testing.T, i int, stdinData, stdoutData, stderrData, erro var errorStream, stdinStream, stdoutStream, stderrStream httpstream.Stream receivedStreams := 0 + replyChan := make(chan struct{}) + stop := make(chan struct{}) + defer close(stop) WaitForStreams: for { select { @@ -68,20 +92,25 @@ func fakeExecServer(t *testing.T, i int, stdinData, stdoutData, stderrData, erro switch streamType { case api.StreamTypeError: errorStream = stream - receivedStreams++ + go waitStreamReply(stream.replySent, replyChan, stop) case api.StreamTypeStdin: stdinStream = stream - receivedStreams++ + go waitStreamReply(stream.replySent, replyChan, stop) case api.StreamTypeStdout: stdoutStream = stream - receivedStreams++ + go waitStreamReply(stream.replySent, replyChan, stop) case api.StreamTypeStderr: stderrStream = stream - receivedStreams++ + go waitStreamReply(stream.replySent, replyChan, stop) default: t.Errorf("%d: unexpected stream type: %q", i, streamType) } + if receivedStreams == expectedStreams { + break WaitForStreams + } + case <-replyChan: + receivedStreams++ if receivedStreams == expectedStreams { break WaitForStreams } @@ -182,8 +211,9 @@ func TestRequestExecuteRemoteCommand(t *testing.T) { server := httptest.NewServer(fakeExecServer(t, i, testCase.Stdin, testCase.Stdout, testCase.Stderr, testCase.Error, testCase.Tty, testCase.MessageCount)) url, _ := url.ParseRequestURI(server.URL) - c := client.NewRESTClient(url, "x", nil, -1, -1) + c := client.NewRESTClient(url, "", client.ContentConfig{GroupVersion: &unversioned.GroupVersion{Group: "x"}}, -1, -1, nil) req := c.Post().Resource("testing") + req.SetHeader(httpstream.HeaderProtocolVersion, StreamProtocolV2Name) req.Param("command", "ls") req.Param("command", "/") conf := &client.Config{ @@ -206,13 +236,15 @@ func TestRequestExecuteRemoteCommand(t *testing.T) { } } - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() continue } if hasErr { t.Errorf("%d: unexpected error: %v", i, err) - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() continue } @@ -228,7 +260,8 @@ func TestRequestExecuteRemoteCommand(t *testing.T) { } } - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() } } @@ -263,7 +296,7 @@ func TestRequestAttachRemoteCommand(t *testing.T) { server := httptest.NewServer(fakeExecServer(t, i, testCase.Stdin, testCase.Stdout, testCase.Stderr, testCase.Error, testCase.Tty, 1)) url, _ := url.ParseRequestURI(server.URL) - c := client.NewRESTClient(url, "x", nil, -1, -1) + c := client.NewRESTClient(url, "", client.ContentConfig{GroupVersion: &unversioned.GroupVersion{Group: "x"}}, -1, -1, nil) req := c.Post().Resource("testing") conf := &client.Config{ @@ -286,13 +319,15 @@ func TestRequestAttachRemoteCommand(t *testing.T) { } } - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() continue } if hasErr { t.Errorf("%d: unexpected error: %v", i, err) - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() continue } @@ -308,7 +343,8 @@ func TestRequestAttachRemoteCommand(t *testing.T) { } } - server.Close() + // TODO: Uncomment when fix #19254 + // server.Close() } } @@ -347,7 +383,7 @@ func TestDial(t *testing.T) { checkResponse: true, conn: &fakeConnection{}, resp: &http.Response{ - StatusCode: http.StatusOK, + StatusCode: http.StatusSwitchingProtocols, Body: ioutil.NopCloser(&bytes.Buffer{}), }, } @@ -363,7 +399,7 @@ func TestDial(t *testing.T) { if err != nil { t.Fatal(err) } - conn, err := exec.Dial() + conn, protocol, err := exec.Dial("protocol1") if err != nil { t.Fatal(err) } @@ -373,4 +409,5 @@ func TestDial(t *testing.T) { if !called { t.Errorf("wrapper not called") } + _ = protocol } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/v1.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/v1.go new file mode 100644 index 000000000..f5428e0f9 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/v1.go @@ -0,0 +1,156 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package remotecommand + +import ( + "fmt" + "io" + "io/ioutil" + "net/http" + + "github.com/golang/glog" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/util/httpstream" +) + +// streamProtocolV1 implements the first version of the streaming exec & attach +// protocol. This version has some bugs, such as not being able to detecte when +// non-interactive stdin data has ended. See http://issues.k8s.io/13394 and +// http://issues.k8s.io/13395 for more details. +type streamProtocolV1 struct { + stdin io.Reader + stdout io.Writer + stderr io.Writer + tty bool +} + +var _ streamProtocolHandler = &streamProtocolV1{} + +func (e *streamProtocolV1) stream(conn httpstream.Connection) error { + doneChan := make(chan struct{}, 2) + errorChan := make(chan error) + + cp := func(s string, dst io.Writer, src io.Reader) { + glog.V(6).Infof("Copying %s", s) + defer glog.V(6).Infof("Done copying %s", s) + if _, err := io.Copy(dst, src); err != nil && err != io.EOF { + glog.Errorf("Error copying %s: %v", s, err) + } + if s == api.StreamTypeStdout || s == api.StreamTypeStderr { + doneChan <- struct{}{} + } + } + + var ( + err error + errorStream, remoteStdin, remoteStdout, remoteStderr httpstream.Stream + ) + + // set up all the streams first + headers := http.Header{} + headers.Set(api.StreamType, api.StreamTypeError) + errorStream, err = conn.CreateStream(headers) + if err != nil { + return err + } + defer errorStream.Reset() + + // Create all the streams first, then start the copy goroutines. The server doesn't start its copy + // goroutines until it's received all of the streams. If the client creates the stdin stream and + // immediately begins copying stdin data to the server, it's possible to overwhelm and wedge the + // spdy frame handler in the server so that it is full of unprocessed frames. The frames aren't + // getting processed because the server hasn't started its copying, and it won't do that until it + // gets all the streams. By creating all the streams first, we ensure that the server is ready to + // process data before the client starts sending any. See https://issues.k8s.io/16373 for more info. + if e.stdin != nil { + headers.Set(api.StreamType, api.StreamTypeStdin) + remoteStdin, err = conn.CreateStream(headers) + if err != nil { + return err + } + defer remoteStdin.Reset() + } + + if e.stdout != nil { + headers.Set(api.StreamType, api.StreamTypeStdout) + remoteStdout, err = conn.CreateStream(headers) + if err != nil { + return err + } + defer remoteStdout.Reset() + } + + if e.stderr != nil && !e.tty { + headers.Set(api.StreamType, api.StreamTypeStderr) + remoteStderr, err = conn.CreateStream(headers) + if err != nil { + return err + } + defer remoteStderr.Reset() + } + + // now that all the streams have been created, proceed with reading & copying + + // always read from errorStream + go func() { + message, err := ioutil.ReadAll(errorStream) + if err != nil && err != io.EOF { + errorChan <- fmt.Errorf("Error reading from error stream: %s", err) + return + } + if len(message) > 0 { + errorChan <- fmt.Errorf("Error executing remote command: %s", message) + return + } + }() + + if e.stdin != nil { + // TODO this goroutine will never exit cleanly (the io.Copy never unblocks) + // because stdin is not closed until the process exits. If we try to call + // stdin.Close(), it returns no error but doesn't unblock the copy. It will + // exit when the process exits, instead. + go cp(api.StreamTypeStdin, remoteStdin, e.stdin) + } + + waitCount := 0 + completedStreams := 0 + + if e.stdout != nil { + waitCount++ + go cp(api.StreamTypeStdout, e.stdout, remoteStdout) + } + + if e.stderr != nil && !e.tty { + waitCount++ + go cp(api.StreamTypeStderr, e.stderr, remoteStderr) + } + +Loop: + for { + select { + case <-doneChan: + completedStreams++ + if completedStreams == waitCount { + break Loop + } + case err := <-errorChan: + return err + } + } + + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/v2.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/v2.go new file mode 100644 index 000000000..67e8637cf --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/remotecommand/v2.go @@ -0,0 +1,166 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package remotecommand + +import ( + "fmt" + "io" + "io/ioutil" + "net/http" + "sync" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/util/httpstream" + "k8s.io/kubernetes/pkg/util/runtime" +) + +// streamProtocolV2 implements version 2 of the streaming protocol for attach +// and exec. The original streaming protocol was unversioned. As a result, this +// version is referred to as version 2, even though it is the first actual +// numbered version. +type streamProtocolV2 struct { + stdin io.Reader + stdout io.Writer + stderr io.Writer + tty bool +} + +var _ streamProtocolHandler = &streamProtocolV2{} + +func (e *streamProtocolV2) stream(conn httpstream.Connection) error { + var ( + err error + errorStream, remoteStdin, remoteStdout, remoteStderr httpstream.Stream + ) + + headers := http.Header{} + + // set up all the streams first + // set up error stream + errorChan := make(chan error) + headers.Set(api.StreamType, api.StreamTypeError) + errorStream, err = conn.CreateStream(headers) + if err != nil { + return err + } + + // set up stdin stream + if e.stdin != nil { + headers.Set(api.StreamType, api.StreamTypeStdin) + remoteStdin, err = conn.CreateStream(headers) + if err != nil { + return err + } + } + + // set up stdout stream + if e.stdout != nil { + headers.Set(api.StreamType, api.StreamTypeStdout) + remoteStdout, err = conn.CreateStream(headers) + if err != nil { + return err + } + } + + // set up stderr stream + if e.stderr != nil && !e.tty { + headers.Set(api.StreamType, api.StreamTypeStderr) + remoteStderr, err = conn.CreateStream(headers) + if err != nil { + return err + } + } + + // now that all the streams have been created, proceed with reading & copying + + // always read from errorStream + go func() { + message, err := ioutil.ReadAll(errorStream) + switch { + case err != nil && err != io.EOF: + errorChan <- fmt.Errorf("error reading from error stream: %s", err) + case len(message) > 0: + errorChan <- fmt.Errorf("error executing remote command: %s", message) + default: + errorChan <- nil + } + close(errorChan) + }() + + var wg sync.WaitGroup + var once sync.Once + + if e.stdin != nil { + // copy from client's stdin to container's stdin + go func() { + // if e.stdin is noninteractive, e.g. `echo abc | kubectl exec -i -- cat`, make sure + // we close remoteStdin as soon as the copy from e.stdin to remoteStdin finishes. Otherwise + // the executed command will remain running. + defer once.Do(func() { remoteStdin.Close() }) + + if _, err := io.Copy(remoteStdin, e.stdin); err != nil { + runtime.HandleError(err) + } + }() + + // read from remoteStdin until the stream is closed. this is essential to + // be able to exit interactive sessions cleanly and not leak goroutines or + // hang the client's terminal. + // + // go-dockerclient's current hijack implementation + // (https://github.com/fsouza/go-dockerclient/blob/89f3d56d93788dfe85f864a44f85d9738fca0670/client.go#L564) + // waits for all three streams (stdin/stdout/stderr) to finish copying + // before returning. When hijack finishes copying stdout/stderr, it calls + // Close() on its side of remoteStdin, which allows this copy to complete. + // When that happens, we must Close() on our side of remoteStdin, to + // allow the copy in hijack to complete, and hijack to return. + go func() { + defer once.Do(func() { remoteStdin.Close() }) + // this "copy" doesn't actually read anything - it's just here to wait for + // the server to close remoteStdin. + if _, err := io.Copy(ioutil.Discard, remoteStdin); err != nil { + runtime.HandleError(err) + } + }() + } + + if e.stdout != nil { + wg.Add(1) + go func() { + defer wg.Done() + if _, err := io.Copy(e.stdout, remoteStdout); err != nil { + runtime.HandleError(err) + } + }() + } + + if e.stderr != nil && !e.tty { + wg.Add(1) + go func() { + defer wg.Done() + if _, err := io.Copy(e.stderr, remoteStderr); err != nil { + runtime.HandleError(err) + } + }() + } + + // we're waiting for stdout/stderr to finish copying + wg.Wait() + + // waits for errorStream to finish reading with an error or nil + return <-errorChan +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/replica_sets.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/replica_sets.go new file mode 100644 index 000000000..be9284084 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/replica_sets.go @@ -0,0 +1,100 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/watch" +) + +// ReplicaSetsNamespacer has methods to work with ReplicaSet resources in a namespace +type ReplicaSetsNamespacer interface { + ReplicaSets(namespace string) ReplicaSetInterface +} + +// ReplicaSetInterface has methods to work with ReplicaSet resources. +type ReplicaSetInterface interface { + List(opts api.ListOptions) (*extensions.ReplicaSetList, error) + Get(name string) (*extensions.ReplicaSet, error) + Create(ctrl *extensions.ReplicaSet) (*extensions.ReplicaSet, error) + Update(ctrl *extensions.ReplicaSet) (*extensions.ReplicaSet, error) + UpdateStatus(ctrl *extensions.ReplicaSet) (*extensions.ReplicaSet, error) + Delete(name string, options *api.DeleteOptions) error + Watch(opts api.ListOptions) (watch.Interface, error) +} + +// replicaSets implements ReplicaSetsNamespacer interface +type replicaSets struct { + client *ExtensionsClient + ns string +} + +// newReplicaSets returns a ReplicaSetClient +func newReplicaSets(c *ExtensionsClient, namespace string) *replicaSets { + return &replicaSets{c, namespace} +} + +// List takes a selector, and returns the list of ReplicaSets that match that selector. +func (c *replicaSets) List(opts api.ListOptions) (result *extensions.ReplicaSetList, err error) { + result = &extensions.ReplicaSetList{} + err = c.client.Get().Namespace(c.ns).Resource("replicasets").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) + return +} + +// Get returns information about a particular ReplicaSet. +func (c *replicaSets) Get(name string) (result *extensions.ReplicaSet, err error) { + result = &extensions.ReplicaSet{} + err = c.client.Get().Namespace(c.ns).Resource("replicasets").Name(name).Do().Into(result) + return +} + +// Create creates a new ReplicaSet. +func (c *replicaSets) Create(rs *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) { + result = &extensions.ReplicaSet{} + err = c.client.Post().Namespace(c.ns).Resource("replicasets").Body(rs).Do().Into(result) + return +} + +// Update updates an existing ReplicaSet. +func (c *replicaSets) Update(rs *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) { + result = &extensions.ReplicaSet{} + err = c.client.Put().Namespace(c.ns).Resource("replicasets").Name(rs.Name).Body(rs).Do().Into(result) + return +} + +// UpdateStatus updates an existing ReplicaSet status +func (c *replicaSets) UpdateStatus(rs *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) { + result = &extensions.ReplicaSet{} + err = c.client.Put().Namespace(c.ns).Resource("replicasets").Name(rs.Name).SubResource("status").Body(rs).Do().Into(result) + return +} + +// Delete deletes an existing ReplicaSet. +func (c *replicaSets) Delete(name string, options *api.DeleteOptions) (err error) { + return c.client.Delete().Namespace(c.ns).Resource("replicasets").Name(name).Body(options).Do().Error() +} + +// Watch returns a watch.Interface that watches the requested ReplicaSets. +func (c *replicaSets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/replica_sets_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/replica_sets_test.go new file mode 100644 index 000000000..960baae04 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/replica_sets_test.go @@ -0,0 +1,197 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) + +import ( + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/apis/extensions" +) + +func getReplicaSetResourceName() string { + return "replicasets" +} + +func TestListReplicaSets(t *testing.T) { + ns := api.NamespaceAll + c := &simple.Client{ + Request: simple.Request{ + Method: "GET", + Path: testapi.Extensions.ResourcePath(getReplicaSetResourceName(), ns, ""), + }, + Response: simple.Response{StatusCode: 200, + Body: &extensions.ReplicaSetList{ + Items: []extensions.ReplicaSet{ + { + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Template: &api.PodTemplateSpec{}, + }, + }, + }, + }, + }, + } + receivedRSList, err := c.Setup(t).Extensions().ReplicaSets(ns).List(api.ListOptions{}) + c.Validate(t, receivedRSList, err) +} + +func TestGetReplicaSet(t *testing.T) { + ns := api.NamespaceDefault + c := &simple.Client{ + Request: simple.Request{Method: "GET", Path: testapi.Extensions.ResourcePath(getReplicaSetResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ + StatusCode: 200, + Body: &extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Template: &api.PodTemplateSpec{}, + }, + }, + }, + } + receivedRS, err := c.Setup(t).Extensions().ReplicaSets(ns).Get("foo") + c.Validate(t, receivedRS, err) +} + +func TestGetReplicaSetWithNoName(t *testing.T) { + ns := api.NamespaceDefault + c := &simple.Client{Error: true} + receivedPod, err := c.Setup(t).Extensions().ReplicaSets(ns).Get("") + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) + } + + c.Validate(t, receivedPod, err) +} + +func TestUpdateReplicaSet(t *testing.T) { + ns := api.NamespaceDefault + requestRS := &extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, + } + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getReplicaSetResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ + StatusCode: 200, + Body: &extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Template: &api.PodTemplateSpec{}, + }, + }, + }, + } + receivedRS, err := c.Setup(t).Extensions().ReplicaSets(ns).Update(requestRS) + c.Validate(t, receivedRS, err) +} + +func TestUpdateStatusReplicaSet(t *testing.T) { + ns := api.NamespaceDefault + requestRS := &extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, + } + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getReplicaSetResourceName(), ns, "foo") + "/status", Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ + StatusCode: 200, + Body: &extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Template: &api.PodTemplateSpec{}, + }, + Status: extensions.ReplicaSetStatus{ + Replicas: 2, + }, + }, + }, + } + receivedRS, err := c.Setup(t).Extensions().ReplicaSets(ns).UpdateStatus(requestRS) + c.Validate(t, receivedRS, err) +} +func TestDeleteReplicaSet(t *testing.T) { + ns := api.NamespaceDefault + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getReplicaSetResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, + } + err := c.Setup(t).Extensions().ReplicaSets(ns).Delete("foo", nil) + c.Validate(t, nil, err) +} + +func TestCreateReplicaSet(t *testing.T) { + ns := api.NamespaceDefault + requestRS := &extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{Name: "foo"}, + } + c := &simple.Client{ + Request: simple.Request{Method: "POST", Path: testapi.Extensions.ResourcePath(getReplicaSetResourceName(), ns, ""), Body: requestRS, Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ + StatusCode: 200, + Body: &extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 2, + Template: &api.PodTemplateSpec{}, + }, + }, + }, + } + receivedRS, err := c.Setup(t).Extensions().ReplicaSets(ns).Create(requestRS) + c.Validate(t, receivedRS, err) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/replication_controllers.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/replication_controllers.go index 1ea08d6cb..f237a76ac 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/replication_controllers.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/replication_controllers.go @@ -18,8 +18,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -30,13 +28,13 @@ type ReplicationControllersNamespacer interface { // ReplicationControllerInterface has methods to work with ReplicationController resources. type ReplicationControllerInterface interface { - List(label labels.Selector, field fields.Selector) (*api.ReplicationControllerList, error) + List(opts api.ListOptions) (*api.ReplicationControllerList, error) Get(name string) (*api.ReplicationController, error) Create(ctrl *api.ReplicationController) (*api.ReplicationController, error) Update(ctrl *api.ReplicationController) (*api.ReplicationController, error) UpdateStatus(ctrl *api.ReplicationController) (*api.ReplicationController, error) Delete(name string) error - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // replicationControllers implements ReplicationControllersNamespacer interface @@ -51,9 +49,9 @@ func newReplicationControllers(c *Client, namespace string) *replicationControll } // List takes a selector, and returns the list of replication controllers that match that selector. -func (c *replicationControllers) List(label labels.Selector, field fields.Selector) (result *api.ReplicationControllerList, err error) { +func (c *replicationControllers) List(opts api.ListOptions) (result *api.ReplicationControllerList, err error) { result = &api.ReplicationControllerList{} - err = c.r.Get().Namespace(c.ns).Resource("replicationControllers").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.r.Get().Namespace(c.ns).Resource("replicationControllers").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } @@ -91,13 +89,11 @@ func (c *replicationControllers) Delete(name string) error { } // Watch returns a watch.Interface that watches the requested controllers. -func (c *replicationControllers) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *replicationControllers) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). Resource("replicationControllers"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/replication_controllers_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/replication_controllers_test.go index 2e3d0f550..151423b92 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/replication_controllers_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/replication_controllers_test.go @@ -14,15 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "testing" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getRCResourceName() string { @@ -31,12 +34,12 @@ func getRCResourceName() string { func TestListControllers(t *testing.T) { ns := api.NamespaceAll - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, ""), }, - Response: Response{StatusCode: 200, + Response: simple.Response{StatusCode: 200, Body: &api.ReplicationControllerList{ Items: []api.ReplicationController{ { @@ -56,16 +59,17 @@ func TestListControllers(t *testing.T) { }, }, } - receivedControllerList, err := c.Setup(t).ReplicationControllers(ns).List(labels.Everything(), fields.Everything()) + receivedControllerList, err := c.Setup(t).ReplicationControllers(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, receivedControllerList, err) } func TestGetController(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{ + c := &simple.Client{ + Request: simple.Request{Method: "GET", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ StatusCode: 200, Body: &api.ReplicationController{ ObjectMeta: api.ObjectMeta{ @@ -83,15 +87,17 @@ func TestGetController(t *testing.T) { }, } receivedController, err := c.Setup(t).ReplicationControllers(ns).Get("foo") + defer c.Close() c.Validate(t, receivedController, err) } func TestGetControllerWithNoName(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{Error: true} + c := &simple.Client{Error: true} receivedPod, err := c.Setup(t).ReplicationControllers(ns).Get("") - if (err != nil) && (err.Error() != nameRequiredError) { - t.Errorf("Expected error: %v, but got %v", nameRequiredError, err) + defer c.Close() + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) } c.Validate(t, receivedPod, err) @@ -102,9 +108,9 @@ func TestUpdateController(t *testing.T) { requestController := &api.ReplicationController{ ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{ + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ StatusCode: 200, Body: &api.ReplicationController{ ObjectMeta: api.ObjectMeta{ @@ -122,6 +128,7 @@ func TestUpdateController(t *testing.T) { }, } receivedController, err := c.Setup(t).ReplicationControllers(ns).Update(requestController) + defer c.Close() c.Validate(t, receivedController, err) } @@ -130,9 +137,9 @@ func TestUpdateStatusController(t *testing.T) { requestController := &api.ReplicationController{ ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, "foo") + "/status", Query: buildQueryValues(nil)}, - Response: Response{ + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, "foo") + "/status", Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ StatusCode: 200, Body: &api.ReplicationController{ ObjectMeta: api.ObjectMeta{ @@ -153,15 +160,17 @@ func TestUpdateStatusController(t *testing.T) { }, } receivedController, err := c.Setup(t).ReplicationControllers(ns).UpdateStatus(requestController) + defer c.Close() c.Validate(t, receivedController, err) } func TestDeleteController(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).ReplicationControllers(ns).Delete("foo") + defer c.Close() c.Validate(t, nil, err) } @@ -170,9 +179,9 @@ func TestCreateController(t *testing.T) { requestController := &api.ReplicationController{ ObjectMeta: api.ObjectMeta{Name: "foo"}, } - c := &testClient{ - Request: testRequest{Method: "POST", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, ""), Body: requestController, Query: buildQueryValues(nil)}, - Response: Response{ + c := &simple.Client{ + Request: simple.Request{Method: "POST", Path: testapi.Default.ResourcePath(getRCResourceName(), ns, ""), Body: requestController, Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ StatusCode: 200, Body: &api.ReplicationController{ ObjectMeta: api.ObjectMeta{ @@ -190,5 +199,6 @@ func TestCreateController(t *testing.T) { }, } receivedController, err := c.Setup(t).ReplicationControllers(ns).Create(requestController) + defer c.Close() c.Validate(t, receivedController, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/request.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/request.go index 04c71854d..c46961999 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/request.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/request.go @@ -25,6 +25,7 @@ import ( "net/http" "net/url" "path" + "reflect" "strconv" "strings" "time" @@ -32,12 +33,14 @@ import ( "github.com/golang/glog" "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/api/validation" "k8s.io/kubernetes/pkg/client/metrics" - "k8s.io/kubernetes/pkg/conversion/queryparams" "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/net" "k8s.io/kubernetes/pkg/util/sets" "k8s.io/kubernetes/pkg/watch" watchjson "k8s.io/kubernetes/pkg/watch/json" @@ -47,6 +50,10 @@ import ( // are therefore not allowed to set manually. var specialParams = sets.NewString("timeout") +func init() { + metrics.Register() +} + // HTTPClient is an interface for testing a request object. type HTTPClient interface { Do(req *http.Request) (*http.Response, error) @@ -74,16 +81,17 @@ func (r *RequestConstructionError) Error() string { // check once. type Request struct { // required - client HTTPClient - verb string + client HTTPClient + verb string + baseURL *url.URL - codec runtime.Codec + content ContentConfig // generic components accessible via method setters - path string - subpath string - params url.Values - headers http.Header + pathPrefix string + subpath string + params url.Values + headers http.Header // structural elements of the request that are part of the Kubernetes API conventions namespace string @@ -94,8 +102,6 @@ type Request struct { selector labels.Selector timeout time.Duration - apiVersion string - // output err error body io.Reader @@ -103,20 +109,35 @@ type Request struct { // The constructed request and the response req *http.Request resp *http.Response + + backoffMgr BackoffManager + throttle util.RateLimiter } // NewRequest creates a new request helper object for accessing runtime.Objects on a server. -func NewRequest(client HTTPClient, verb string, baseURL *url.URL, apiVersion string, - codec runtime.Codec) *Request { - metrics.Register() - return &Request{ +func NewRequest(client HTTPClient, verb string, baseURL *url.URL, versionedAPIPath string, content ContentConfig, backoff BackoffManager, throttle util.RateLimiter) *Request { + if backoff == nil { + glog.V(2).Infof("Not implementing request backoff strategy.") + backoff = &NoBackoff{} + } + + pathPrefix := "/" + if baseURL != nil { + pathPrefix = path.Join(pathPrefix, baseURL.Path) + } + r := &Request{ client: client, verb: verb, baseURL: baseURL, - path: baseURL.Path, - apiVersion: apiVersion, - codec: codec, + pathPrefix: path.Join(pathPrefix, versionedAPIPath), + content: content, + backoffMgr: backoff, + throttle: throttle, } + if len(content.ContentType) > 0 { + r.SetHeader("Accept", content.ContentType+", */*") + } + return r } // Prefix adds segments to the relative beginning to the request path. These @@ -126,7 +147,7 @@ func (r *Request) Prefix(segments ...string) *Request { if r.err != nil { return r } - r.path = path.Join(r.path, path.Join(segments...)) + r.pathPrefix = path.Join(r.pathPrefix, path.Join(segments...)) return r } @@ -149,6 +170,10 @@ func (r *Request) Resource(resource string) *Request { r.err = fmt.Errorf("resource already set to %q, cannot change to %q", r.resource, resource) return r } + if ok, msg := validation.IsValidPathSegmentName(resource); !ok { + r.err = fmt.Errorf("invalid resource %q: %s", resource, msg) + return r + } r.resource = resource return r } @@ -164,6 +189,12 @@ func (r *Request) SubResource(subresources ...string) *Request { r.err = fmt.Errorf("subresource already set to %q, cannot change to %q", r.resource, subresource) return r } + for _, s := range subresources { + if ok, msg := validation.IsValidPathSegmentName(s); !ok { + r.err = fmt.Errorf("invalid subresource %q: %s", s, msg) + return r + } + } r.subresource = subresource return r } @@ -181,6 +212,10 @@ func (r *Request) Name(resourceName string) *Request { r.err = fmt.Errorf("resource name already set to %q, cannot change to %q", r.resourceName, resourceName) return r } + if ok, msg := validation.IsValidPathSegmentName(resourceName); !ok { + r.err = fmt.Errorf("invalid resource name %q: %s", resourceName, msg) + return r + } r.resourceName = resourceName return r } @@ -194,6 +229,10 @@ func (r *Request) Namespace(namespace string) *Request { r.err = fmt.Errorf("namespace already set to %q, cannot change to %q", r.namespace, namespace) return r } + if ok, msg := validation.IsValidPathSegmentName(namespace); !ok { + r.err = fmt.Errorf("invalid namespace %q: %s", namespace, msg) + return r + } r.namespaceSet = true r.namespace = namespace return r @@ -207,34 +246,16 @@ func (r *Request) NamespaceIfScoped(namespace string, scoped bool) *Request { return r } -// UnversionedPath strips the apiVersion from the baseURL before appending segments. -func (r *Request) UnversionedPath(segments ...string) *Request { - if r.err != nil { - return r - } - upath := path.Clean(r.baseURL.Path) - //TODO(jdef) this is a pretty hackish version test - if strings.HasPrefix(path.Base(upath), "v") { - upath = path.Dir(upath) - if upath == "." { - upath = "/" - } - } - r.path = path.Join(append([]string{upath}, segments...)...) - return r -} - // AbsPath overwrites an existing path with the segments provided. Trailing slashes are preserved // when a single segment is passed. func (r *Request) AbsPath(segments ...string) *Request { if r.err != nil { return r } - if len(segments) == 1 { + r.pathPrefix = path.Join(r.baseURL.Path, path.Join(segments...)) + if len(segments) == 1 && (len(r.baseURL.Path) > 1 || len(segments[0]) > 1) && strings.HasSuffix(segments[0], "/") { // preserve any trailing slashes for legacy behavior - r.path = segments[0] - } else { - r.path = path.Join(segments...) + r.pathPrefix += "/" } return r } @@ -250,7 +271,7 @@ func (r *Request) RequestURI(uri string) *Request { r.err = err return r } - r.path = locator.Path + r.pathPrefix = locator.Path if len(locator.Query()) > 0 { if r.params == nil { r.params = make(url.Values) @@ -273,6 +294,7 @@ const ( EventReason = "reason" EventSource = "source" + EventType = "type" EventInvolvedKind = "involvedObject.kind" EventInvolvedNamespace = "involvedObject.namespace" EventInvolvedName = "involvedObject.name" @@ -302,53 +324,54 @@ func (r resourceTypeToFieldMapping) filterField(resourceType, field, value strin return fMapping.filterField(field, value) } -type versionToResourceToFieldMapping map[string]resourceTypeToFieldMapping +type versionToResourceToFieldMapping map[unversioned.GroupVersion]resourceTypeToFieldMapping -func (v versionToResourceToFieldMapping) filterField(apiVersion, resourceType, field, value string) (newField, newValue string, err error) { - rMapping, ok := v[apiVersion] +func (v versionToResourceToFieldMapping) filterField(groupVersion *unversioned.GroupVersion, resourceType, field, value string) (newField, newValue string, err error) { + rMapping, ok := v[*groupVersion] if !ok { - glog.Warningf("Field selector: %v - %v - %v - %v: need to check if this is versioned correctly.", apiVersion, resourceType, field, value) + glog.Warningf("Field selector: %v - %v - %v - %v: need to check if this is versioned correctly.", groupVersion, resourceType, field, value) return field, value, nil } newField, newValue, err = rMapping.filterField(resourceType, field, value) if err != nil { // This is only a warning until we find and fix all of the client's usages. - glog.Warningf("Field selector: %v - %v - %v - %v: need to check if this is versioned correctly.", apiVersion, resourceType, field, value) + glog.Warningf("Field selector: %v - %v - %v - %v: need to check if this is versioned correctly.", groupVersion, resourceType, field, value) return field, value, nil } return newField, newValue, nil } var fieldMappings = versionToResourceToFieldMapping{ - "v1": resourceTypeToFieldMapping{ + v1.SchemeGroupVersion: resourceTypeToFieldMapping{ "nodes": clientFieldNameToAPIVersionFieldName{ - ObjectNameField: "metadata.name", - NodeUnschedulable: "spec.unschedulable", + ObjectNameField: ObjectNameField, + NodeUnschedulable: NodeUnschedulable, }, "pods": clientFieldNameToAPIVersionFieldName{ - PodHost: "spec.nodeName", - PodStatus: "status.phase", + PodHost: PodHost, + PodStatus: PodStatus, }, "secrets": clientFieldNameToAPIVersionFieldName{ - SecretType: "type", + SecretType: SecretType, }, "serviceAccounts": clientFieldNameToAPIVersionFieldName{ - ObjectNameField: "metadata.name", + ObjectNameField: ObjectNameField, }, "endpoints": clientFieldNameToAPIVersionFieldName{ - ObjectNameField: "metadata.name", + ObjectNameField: ObjectNameField, }, "events": clientFieldNameToAPIVersionFieldName{ - ObjectNameField: "metadata.name", - EventReason: "reason", - EventSource: "source", - EventInvolvedKind: "involvedObject.kind", - EventInvolvedNamespace: "involvedObject.namespace", - EventInvolvedName: "involvedObject.name", - EventInvolvedUID: "involvedObject.uid", - EventInvolvedAPIVersion: "involvedObject.apiVersion", - EventInvolvedResourceVersion: "involvedObject.resourceVersion", - EventInvolvedFieldPath: "involvedObject.fieldPath", + ObjectNameField: ObjectNameField, + EventReason: EventReason, + EventSource: EventSource, + EventType: EventType, + EventInvolvedKind: EventInvolvedKind, + EventInvolvedNamespace: EventInvolvedNamespace, + EventInvolvedName: EventInvolvedName, + EventInvolvedUID: EventInvolvedUID, + EventInvolvedAPIVersion: EventInvolvedAPIVersion, + EventInvolvedResourceVersion: EventInvolvedResourceVersion, + EventInvolvedFieldPath: EventInvolvedFieldPath, }, }, } @@ -365,13 +388,13 @@ func (r *Request) FieldsSelectorParam(s fields.Selector) *Request { return r } s2, err := s.Transform(func(field, value string) (newField, newValue string, err error) { - return fieldMappings.filterField(r.apiVersion, r.resource, field, value) + return fieldMappings.filterField(r.content.GroupVersion, r.resource, field, value) }) if err != nil { r.err = err return r } - return r.setParam(unversioned.FieldSelectorQueryParam(r.apiVersion), s2.String()) + return r.setParam(unversioned.FieldSelectorQueryParam(r.content.GroupVersion.String()), s2.String()) } // LabelsSelectorParam adds the given selector as a query parameter @@ -385,7 +408,7 @@ func (r *Request) LabelsSelectorParam(s labels.Selector) *Request { if s.Empty() { return r } - return r.setParam(unversioned.LabelSelectorQueryParam(r.apiVersion), s.String()) + return r.setParam(unversioned.LabelSelectorQueryParam(r.content.GroupVersion.String()), s.String()) } // UintParam creates a query parameter with the given value. @@ -405,25 +428,54 @@ func (r *Request) Param(paramName, s string) *Request { } // VersionedParams will take the provided object, serialize it to a map[string][]string using the -// implicit RESTClient API version and the provided object convertor, and then add those as parameters +// implicit RESTClient API version and the default parameter codec, and then add those as parameters // to the request. Use this to provide versioned query parameters from client libraries. -func (r *Request) VersionedParams(obj runtime.Object, convertor runtime.ObjectConvertor) *Request { +func (r *Request) VersionedParams(obj runtime.Object, codec runtime.ParameterCodec) *Request { if r.err != nil { return r } - versioned, err := convertor.ConvertToVersion(obj, r.apiVersion) - if err != nil { - r.err = err - return r - } - params, err := queryparams.Convert(versioned) + params, err := codec.EncodeParameters(obj, *r.content.GroupVersion) if err != nil { r.err = err return r } for k, v := range params { - for _, vv := range v { - r.setParam(k, vv) + for _, value := range v { + // TODO: Move it to setParam method, once we get rid of + // FieldSelectorParam & LabelSelectorParam methods. + if k == unversioned.LabelSelectorQueryParam(r.content.GroupVersion.String()) && value == "" { + // Don't set an empty selector for backward compatibility. + // Since there is no way to get the difference between empty + // and unspecified string, we don't set it to avoid having + // labelSelector= param in every request. + continue + } + if k == unversioned.FieldSelectorQueryParam(r.content.GroupVersion.String()) { + if len(value) == 0 { + // Don't set an empty selector for backward compatibility. + // Since there is no way to get the difference between empty + // and unspecified string, we don't set it to avoid having + // fieldSelector= param in every request. + continue + } + // TODO: Filtering should be handled somewhere else. + selector, err := fields.ParseSelector(value) + if err != nil { + r.err = fmt.Errorf("unparsable field selector: %v", err) + return r + } + filteredSelector, err := selector.Transform( + func(field, value string) (newField, newValue string, err error) { + return fieldMappings.filterField(r.content.GroupVersion, r.resource, field, value) + }) + if err != nil { + r.err = fmt.Errorf("untransformable field selector: %v", err) + return r + } + value = filteredSelector.String() + } + + r.setParam(k, value) } } return r @@ -463,7 +515,8 @@ func (r *Request) Timeout(d time.Duration) *Request { // If obj is a string, try to read a file of that name. // If obj is a []byte, send it directly. // If obj is an io.Reader, use it directly. -// If obj is a runtime.Object, marshal it correctly. +// If obj is a runtime.Object, marshal it correctly, and set Content-Type header. +// If obj is a runtime.Object and nil, do nothing. // Otherwise, set an error. func (r *Request) Body(obj interface{}) *Request { if r.err != nil { @@ -484,13 +537,18 @@ func (r *Request) Body(obj interface{}) *Request { case io.Reader: r.body = t case runtime.Object: - data, err := r.codec.Encode(t) + // callers may pass typed interface pointers, therefore we must check nil with reflection + if reflect.ValueOf(t).IsNil() { + return r + } + data, err := runtime.Encode(r.content.Codec, t) if err != nil { r.err = err return r } glog.V(8).Infof("Request Body: %s", string(data)) r.body = bytes.NewBuffer(data) + r.SetHeader("Content-Type", r.content.ContentType) default: r.err = fmt.Errorf("unknown type used for body: %+v", obj) } @@ -499,14 +557,14 @@ func (r *Request) Body(obj interface{}) *Request { // URL returns the current working URL. func (r *Request) URL() *url.URL { - p := r.path + p := r.pathPrefix if r.namespaceSet && len(r.namespace) > 0 { p = path.Join(p, "namespaces", r.namespace) } if len(r.resource) != 0 { p = path.Join(p, strings.ToLower(r.resource)) } - // Join trims trailing slashes, so preserve r.path's trailing slash for backwards compat if nothing was changed + // Join trims trailing slashes, so preserve r.pathPrefix's trailing slash for backwards compat if nothing was changed if len(r.resourceName) != 0 || len(r.subpath) != 0 || len(r.subresource) != 0 { p = path.Join(p, r.resourceName, r.subresource, r.subpath) } @@ -557,6 +615,8 @@ func (r Request) finalURLTemplate() string { // Watch attempts to begin watching the requested location. // Returns a watch.Interface, or an error. func (r *Request) Watch() (watch.Interface, error) { + // We specifically don't want to rate limit watches, so we + // don't use r.throttle here. if r.err != nil { return nil, r.err } @@ -569,22 +629,49 @@ func (r *Request) Watch() (watch.Interface, error) { if client == nil { client = http.DefaultClient } + time.Sleep(r.backoffMgr.CalculateBackoff(r.URL())) resp, err := client.Do(req) + updateURLMetrics(r, resp, err) + if r.baseURL != nil { + if err != nil { + r.backoffMgr.UpdateBackoff(r.baseURL, err, 0) + } else { + r.backoffMgr.UpdateBackoff(r.baseURL, err, resp.StatusCode) + } + } if err != nil { // The watch stream mechanism handles many common partial data errors, so closed // connections can be retried in many cases. - if util.IsProbableEOF(err) { + if net.IsProbableEOF(err) { return watch.NewEmptyWatch(), nil } return nil, err } if resp.StatusCode != http.StatusOK { + defer resp.Body.Close() if result := r.transformResponse(resp, req); result.err != nil { return nil, result.err } return nil, fmt.Errorf("for request '%+v', got status: %v", url, resp.StatusCode) } - return watch.NewStreamWatcher(watchjson.NewDecoder(resp.Body, r.codec)), nil + return watch.NewStreamWatcher(watchjson.NewDecoder(resp.Body, r.content.Codec)), nil +} + +// updateURLMetrics is a convenience function for pushing metrics. +// It also handles corner cases for incomplete/invalid request data. +func updateURLMetrics(req *Request, resp *http.Response, err error) { + url := "none" + if req.baseURL != nil { + url = req.baseURL.Host + } + + // If we have an error (i.e. apiserver down) we report that as a metric label. + if err != nil { + metrics.RequestResult.WithLabelValues(err.Error(), req.verb, url).Inc() + } else { + //Metrics for failure codes + metrics.RequestResult.WithLabelValues(strconv.Itoa(resp.StatusCode), req.verb, url).Inc() + } } // Stream formats and executes the request, and offers streaming of the response. @@ -595,6 +682,11 @@ func (r *Request) Stream() (io.ReadCloser, error) { if r.err != nil { return nil, r.err } + + if r.throttle != nil { + r.throttle.Accept() + } + url := r.URL().String() req, err := http.NewRequest(r.verb, url, nil) if err != nil { @@ -604,7 +696,16 @@ func (r *Request) Stream() (io.ReadCloser, error) { if client == nil { client = http.DefaultClient } + time.Sleep(r.backoffMgr.CalculateBackoff(r.URL())) resp, err := client.Do(req) + updateURLMetrics(r, resp, err) + if r.baseURL != nil { + if err != nil { + r.backoffMgr.UpdateBackoff(r.URL(), err, 0) + } else { + r.backoffMgr.UpdateBackoff(r.URL(), err, resp.StatusCode) + } + } if err != nil { return nil, err } @@ -623,10 +724,10 @@ func (r *Request) Stream() (io.ReadCloser, error) { return nil, fmt.Errorf("%v while accessing %v", resp.Status, url) } - if runtimeObject, err := r.codec.Decode(bodyBytes); err == nil { + if runtimeObject, err := runtime.Decode(r.content.Codec, bodyBytes); err == nil { statusError := errors.FromObject(runtimeObject) - if _, ok := statusError.(APIStatus); ok { + if _, ok := statusError.(errors.APIStatus); ok { return nil, statusError } } @@ -641,7 +742,14 @@ func (r *Request) Stream() (io.ReadCloser, error) { // fn at most once. It will return an error if a problem occurred prior to connecting to the // server - the provided function is responsible for handling server errors. func (r *Request) request(fn func(*http.Request, *http.Response)) error { + //Metrics for total request latency + start := time.Now() + defer func() { + metrics.RequestLatency.WithLabelValues(r.verb, r.finalURLTemplate()).Observe(metrics.SinceInMicroseconds(start)) + }() + if r.err != nil { + glog.V(4).Infof("Error in request: %v", r.err) return r.err } @@ -670,7 +778,14 @@ func (r *Request) request(fn func(*http.Request, *http.Response)) error { } req.Header = r.headers + time.Sleep(r.backoffMgr.CalculateBackoff(r.URL())) resp, err := client.Do(req) + updateURLMetrics(r, resp, err) + if err != nil { + r.backoffMgr.UpdateBackoff(r.URL(), err, 0) + } else { + r.backoffMgr.UpdateBackoff(r.URL(), err, resp.StatusCode) + } if err != nil { return err } @@ -704,10 +819,10 @@ func (r *Request) request(fn func(*http.Request, *http.Response)) error { // * If the server responds with a status: *errors.StatusError or *errors.UnexpectedObjectError // * http.Client.Do errors are returned directly. func (r *Request) Do() Result { - start := time.Now() - defer func() { - metrics.RequestLatency.WithLabelValues(r.verb, r.finalURLTemplate()).Observe(metrics.SinceInMicroseconds(start)) - }() + if r.throttle != nil { + r.throttle.Accept() + } + var result Result err := r.request(func(req *http.Request, resp *http.Response) { result = r.transformResponse(resp, req) @@ -720,10 +835,10 @@ func (r *Request) Do() Result { // DoRaw executes the request but does not process the response body. func (r *Request) DoRaw() ([]byte, error) { - start := time.Now() - defer func() { - metrics.RequestLatency.WithLabelValues(r.verb, r.finalURLTemplate()).Observe(metrics.SinceInMicroseconds(start)) - }() + if r.throttle != nil { + r.throttle.Accept() + } + var result Result err := r.request(func(req *http.Request, resp *http.Response) { result.body, result.err = ioutil.ReadAll(resp.Body) @@ -746,8 +861,13 @@ func (r *Request) transformResponse(resp *http.Response, req *http.Request) Resu // Did the server give us a status response? isStatusResponse := false - var status unversioned.Status - if err := r.codec.DecodeInto(body, &status); err == nil && status.Status != "" { + // Because release-1.1 server returns Status with empty APIVersion at paths + // to the Extensions resources, we need to use DecodeInto here to provide + // default groupVersion, otherwise a status response won't be correctly + // decoded. + status := &unversioned.Status{} + err := runtime.DecodeInto(r.content.Codec, body, status) + if err == nil && len(status.Status) > 0 { isStatusResponse = true } @@ -758,20 +878,21 @@ func (r *Request) transformResponse(resp *http.Response, req *http.Request) Resu if !isStatusResponse { return Result{err: r.transformUnstructuredResponseError(resp, req, body)} } - return Result{err: errors.FromObject(&status)} + return Result{err: errors.FromObject(status)} } // If the server gave us a status back, look at what it was. success := resp.StatusCode >= http.StatusOK && resp.StatusCode <= http.StatusPartialContent if isStatusResponse && (status.Status != unversioned.StatusSuccess && !success) { // "Failed" requests are clearly just an error and it makes sense to return them as such. - return Result{err: errors.FromObject(&status)} + return Result{err: errors.FromObject(status)} } return Result{ - body: body, - statusCode: resp.StatusCode, - codec: r.codec, + body: body, + contentType: resp.Header.Get("Content-Type"), + statusCode: resp.StatusCode, + decoder: r.content.Codec, } } @@ -806,7 +927,18 @@ func (r *Request) transformUnstructuredResponseError(resp *http.Response, req *h message = strings.TrimSpace(string(body)) } retryAfter, _ := retryAfterSeconds(resp) - return errors.NewGenericServerResponse(resp.StatusCode, req.Method, r.resource, r.resourceName, message, retryAfter, true) + return errors.NewGenericServerResponse( + resp.StatusCode, + req.Method, + unversioned.GroupResource{ + Group: r.content.GroupVersion.Group, + Resource: r.resource, + }, + r.resourceName, + message, + retryAfter, + true, + ) } // isTextResponse returns true if the response appears to be a textual media type. @@ -825,7 +957,10 @@ func isTextResponse(resp *http.Response) bool { // checkWait returns true along with a number of seconds if the server instructed us to wait // before retrying. func checkWait(resp *http.Response) (int, bool) { - if resp.StatusCode != errors.StatusTooManyRequests { + switch r := resp.StatusCode; { + // any 500 error code and 429 can trigger a wait + case r == errors.StatusTooManyRequests, r >= 500: + default: return 0, false } i, ok := retryAfterSeconds(resp) @@ -845,11 +980,12 @@ func retryAfterSeconds(resp *http.Response) (int, bool) { // Result contains the result of calling Request.Do(). type Result struct { - body []byte - err error - statusCode int + body []byte + contentType string + err error + statusCode int - codec runtime.Codec + decoder runtime.Decoder } // Raw returns the raw result. @@ -862,7 +998,7 @@ func (r Result) Get() (runtime.Object, error) { if r.err != nil { return nil, r.err } - return r.codec.Decode(r.body) + return runtime.Decode(r.decoder, r.body) } // StatusCode returns the HTTP status code of the request. (Only valid if no @@ -872,12 +1008,12 @@ func (r Result) StatusCode(statusCode *int) Result { return r } -// Into stores the result into obj, if possible. +// Into stores the result into obj, if possible. If obj is nil it is ignored. func (r Result) Into(obj runtime.Object) error { if r.err != nil { return r.err } - return r.codec.DecodeInto(r.body, obj) + return runtime.DecodeInto(r.decoder, r.body, obj) } // WasCreated updates the provided bool pointer to whether the server returned diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/request_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/request_test.go index ca9e5e698..266be6b24 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/request_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/request_test.go @@ -18,7 +18,6 @@ package unversioned import ( "bytes" - "encoding/base64" "errors" "io" "io/ioutil" @@ -35,18 +34,32 @@ import ( apierrors "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util/httpstream" + "k8s.io/kubernetes/pkg/util/intstr" + utiltesting "k8s.io/kubernetes/pkg/util/testing" "k8s.io/kubernetes/pkg/watch" watchjson "k8s.io/kubernetes/pkg/watch/json" ) +func TestNewRequestSetsAccept(t *testing.T) { + r := NewRequest(nil, "get", &url.URL{Path: "/path/"}, "", ContentConfig{}, nil, nil) + if r.headers.Get("Accept") != "" { + t.Errorf("unexpected headers: %#v", r.headers) + } + r = NewRequest(nil, "get", &url.URL{Path: "/path/"}, "", ContentConfig{ContentType: "application/other"}, nil, nil) + if r.headers.Get("Accept") != "application/other, */*" { + t.Errorf("unexpected headers: %#v", r.headers) + } +} + func TestRequestWithErrorWontChange(t *testing.T) { original := Request{ - err: errors.New("test"), - apiVersion: testapi.Default.Version(), + err: errors.New("test"), + content: ContentConfig{GroupVersion: testapi.Default.GroupVersion()}, } r := original changed := r.Param("foo", "bar"). @@ -69,7 +82,7 @@ func TestRequestWithErrorWontChange(t *testing.T) { } func TestRequestPreservesBaseTrailingSlash(t *testing.T) { - r := &Request{baseURL: &url.URL{}, path: "/path/"} + r := &Request{baseURL: &url.URL{}, pathPrefix: "/path/"} if s := r.URL().String(); s != "/path/" { t.Errorf("trailing slash should be preserved: %s", s) } @@ -111,8 +124,8 @@ func TestRequestSetsNamespace(t *testing.T) { func TestRequestOrdersNamespaceInPath(t *testing.T) { r := (&Request{ - baseURL: &url.URL{}, - path: "/test/", + baseURL: &url.URL{}, + pathPrefix: "/test/", }).Name("bar").Resource("baz").Namespace("foo") if s := r.URL().String(); s != "/test/namespaces/foo/baz/bar" { t.Errorf("namespace should be in order in path: %s", s) @@ -121,8 +134,8 @@ func TestRequestOrdersNamespaceInPath(t *testing.T) { func TestRequestOrdersSubResource(t *testing.T) { r := (&Request{ - baseURL: &url.URL{}, - path: "/test/", + baseURL: &url.URL{}, + pathPrefix: "/test/", }).Name("bar").Resource("baz").Namespace("foo").Suffix("test").SubResource("a", "b") if s := r.URL().String(); s != "/test/namespaces/foo/baz/bar/a/b/test" { t.Errorf("namespace should be in order in path: %s", s) @@ -144,6 +157,25 @@ func TestRequestSetTwiceError(t *testing.T) { } } +func TestInvalidSegments(t *testing.T) { + invalidSegments := []string{".", "..", "test/segment", "test%2bsegment"} + setters := map[string]func(string, *Request){ + "namespace": func(s string, r *Request) { r.Namespace(s) }, + "resource": func(s string, r *Request) { r.Resource(s) }, + "name": func(s string, r *Request) { r.Name(s) }, + "subresource": func(s string, r *Request) { r.SubResource(s) }, + } + for _, invalidSegment := range invalidSegments { + for setterName, setter := range setters { + r := &Request{} + setter(invalidSegment, r) + if r.err == nil { + t.Errorf("%s: %s: expected error, got none", setterName, invalidSegment) + } + } + } +} + func TestRequestParam(t *testing.T) { r := (&Request{}).Param("foo", "a") if !reflect.DeepEqual(r.params, url.Values{"foo": []string{"a"}}) { @@ -158,11 +190,11 @@ func TestRequestParam(t *testing.T) { } func TestRequestVersionedParams(t *testing.T) { - r := (&Request{apiVersion: "v1"}).Param("foo", "a") + r := (&Request{content: ContentConfig{GroupVersion: &v1.SchemeGroupVersion}}).Param("foo", "a") if !reflect.DeepEqual(r.params, url.Values{"foo": []string{"a"}}) { t.Errorf("should have set a param: %#v", r) } - r.VersionedParams(&api.PodLogOptions{Follow: true, Container: "bar"}, api.Scheme) + r.VersionedParams(&api.PodLogOptions{Follow: true, Container: "bar"}, api.ParameterCodec) if !reflect.DeepEqual(r.params, url.Values{ "foo": []string{"a"}, @@ -173,11 +205,30 @@ func TestRequestVersionedParams(t *testing.T) { } } +func TestRequestVersionedParamsFromListOptions(t *testing.T) { + r := &Request{content: ContentConfig{GroupVersion: &v1.SchemeGroupVersion}} + r.VersionedParams(&api.ListOptions{ResourceVersion: "1"}, api.ParameterCodec) + if !reflect.DeepEqual(r.params, url.Values{ + "resourceVersion": []string{"1"}, + }) { + t.Errorf("should have set a param: %#v", r) + } + + var timeout int64 = 10 + r.VersionedParams(&api.ListOptions{ResourceVersion: "2", TimeoutSeconds: &timeout}, api.ParameterCodec) + if !reflect.DeepEqual(r.params, url.Values{ + "resourceVersion": []string{"1", "2"}, + "timeoutSeconds": []string{"10"}, + }) { + t.Errorf("should have set a param: %#v", r) + } +} + func TestRequestURI(t *testing.T) { r := (&Request{}).Param("foo", "a") r.Prefix("other") r.RequestURI("/test?foo=b&a=b&c=1&c=2") - if r.path != "/test" { + if r.pathPrefix != "/test" { t.Errorf("path is wrong: %#v", r) } if !reflect.DeepEqual(r.params, url.Values{"a": []string{"b"}, "foo": []string{"b"}, "c": []string{"1", "2"}}) { @@ -187,7 +238,8 @@ func TestRequestURI(t *testing.T) { type NotAnAPIObject struct{} -func (NotAnAPIObject) IsAnAPIObject() {} +func (obj NotAnAPIObject) GroupVersionKind() *unversioned.GroupVersionKind { return nil } +func (obj NotAnAPIObject) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) {} func TestRequestBody(t *testing.T) { // test unknown type @@ -201,6 +253,7 @@ func TestRequestBody(t *testing.T) { if err != nil { t.Fatalf("unable to create temp file") } + defer f.Close() os.Remove(f.Name()) r = (&Request{}).Body(f.Name()) if r.err == nil || r.body != nil { @@ -208,7 +261,7 @@ func TestRequestBody(t *testing.T) { } // test unencodable api object - r = (&Request{codec: testapi.Default.Codec()}).Body(&NotAnAPIObject{}) + r = (&Request{content: ContentConfig{Codec: testapi.Default.Codec()}}).Body(&NotAnAPIObject{}) if r.err == nil || r.body != nil { t.Errorf("should have set err and left body nil: %#v", r) } @@ -223,7 +276,7 @@ func TestResultIntoWithErrReturnsErr(t *testing.T) { func TestURLTemplate(t *testing.T) { uri, _ := url.Parse("http://localhost") - r := NewRequest(nil, "POST", uri, "test", nil) + r := NewRequest(nil, "POST", uri, "", ContentConfig{GroupVersion: &unversioned.GroupVersion{Group: "test"}}, nil, nil) r.Prefix("pre1").Resource("r1").Namespace("ns").Name("nm").Param("p0", "v0") full := r.URL() if full.String() != "http://localhost/pre1/namespaces/ns/r1/nm?p0=v0" { @@ -284,7 +337,7 @@ func TestTransformResponse(t *testing.T) { {Response: &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid}, } for i, test := range testCases { - r := NewRequest(nil, "", uri, testapi.Default.Version(), testapi.Default.Codec()) + r := NewRequest(nil, "", uri, "", ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()}, nil, nil) if test.Response.Body == nil { test.Response.Body = ioutil.NopCloser(bytes.NewReader([]byte{})) } @@ -294,12 +347,12 @@ func TestTransformResponse(t *testing.T) { if hasErr != test.Error { t.Errorf("%d: unexpected error: %t %v", i, test.Error, err) } else if hasErr && test.Response.StatusCode > 399 { - status, ok := err.(APIStatus) + status, ok := err.(apierrors.APIStatus) if !ok { t.Errorf("%d: response should have been transformable into APIStatus: %v", i, err) continue } - if status.Status().Code != test.Response.StatusCode { + if int(status.Status().Code) != test.Response.StatusCode { t.Errorf("%d: status code did not match response: %#v", i, status.Status()) } } @@ -371,7 +424,7 @@ func TestTransformUnstructuredError(t *testing.T) { for _, testCase := range testCases { r := &Request{ - codec: testapi.Default.Codec(), + content: ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()}, resourceName: testCase.Name, resource: testCase.Resource, } @@ -408,7 +461,7 @@ func TestRequestWatch(t *testing.T) { Err: true, }, { - Request: &Request{baseURL: &url.URL{}, path: "%"}, + Request: &Request{baseURL: &url.URL{}, pathPrefix: "%"}, Err: true, }, { @@ -422,9 +475,12 @@ func TestRequestWatch(t *testing.T) { }, { Request: &Request{ - codec: testapi.Default.Codec(), + content: ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()}, client: clientFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{StatusCode: http.StatusForbidden}, nil + return &http.Response{ + StatusCode: http.StatusForbidden, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, nil }), baseURL: &url.URL{}, }, @@ -435,9 +491,12 @@ func TestRequestWatch(t *testing.T) { }, { Request: &Request{ - codec: testapi.Default.Codec(), + content: ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()}, client: clientFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{StatusCode: http.StatusUnauthorized}, nil + return &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, nil }), baseURL: &url.URL{}, }, @@ -448,7 +507,7 @@ func TestRequestWatch(t *testing.T) { }, { Request: &Request{ - codec: testapi.Default.Codec(), + content: ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()}, client: clientFunc(func(req *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusUnauthorized, @@ -503,6 +562,8 @@ func TestRequestWatch(t *testing.T) { }, } for i, testCase := range testCases { + t.Logf("testcase %v", testCase.Request) + testCase.Request.backoffMgr = &NoBackoff{} watch, err := testCase.Request.Watch() hasErr := err != nil if hasErr != testCase.Err { @@ -535,7 +596,7 @@ func TestRequestStream(t *testing.T) { Err: true, }, { - Request: &Request{baseURL: &url.URL{}, path: "%"}, + Request: &Request{baseURL: &url.URL{}, pathPrefix: "%"}, Err: true, }, { @@ -558,13 +619,14 @@ func TestRequestStream(t *testing.T) { })))), }, nil }), - codec: testapi.Default.Codec(), + content: ContentConfig{Codec: testapi.Default.Codec()}, baseURL: &url.URL{}, }, Err: true, }, } for i, testCase := range testCases { + testCase.Request.backoffMgr = &NoBackoff{} body, err := testCase.Request.Stream() hasErr := err != nil if hasErr != testCase.Err { @@ -620,7 +682,7 @@ func TestRequestDo(t *testing.T) { Err: true, }, { - Request: &Request{baseURL: &url.URL{}, path: "%"}, + Request: &Request{baseURL: &url.URL{}, pathPrefix: "%"}, Err: true, }, { @@ -634,6 +696,7 @@ func TestRequestDo(t *testing.T) { }, } for i, testCase := range testCases { + testCase.Request.backoffMgr = &NoBackoff{} body, err := testCase.Request.Do().Raw() hasErr := err != nil if hasErr != testCase.Err { @@ -650,17 +713,18 @@ func TestDoRequestNewWay(t *testing.T) { expectedObj := &api.Service{Spec: api.ServiceSpec{Ports: []api.ServicePort{{ Protocol: "TCP", Port: 12345, - TargetPort: util.NewIntOrStringFromInt(12345), + TargetPort: intstr.FromInt(12345), }}}} - expectedBody, _ := testapi.Default.Codec().Encode(expectedObj) - fakeHandler := util.FakeHandler{ + expectedBody, _ := runtime.Encode(testapi.Default.Codec(), expectedObj) + fakeHandler := utiltesting.FakeHandler{ StatusCode: 200, ResponseBody: string(expectedBody), T: t, } testServer := httptest.NewServer(&fakeHandler) - defer testServer.Close() - c := NewOrDie(&Config{Host: testServer.URL, Version: testapi.Default.Version(), Username: "user", Password: "pass"}) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() + c := testRESTClient(t, testServer) obj, err := c.Verb("POST"). Prefix("foo", "bar"). Suffix("baz"). @@ -679,8 +743,42 @@ func TestDoRequestNewWay(t *testing.T) { requestURL := testapi.Default.ResourcePathWithPrefix("foo/bar", "", "", "baz") requestURL += "?timeout=1s" fakeHandler.ValidateRequest(t, requestURL, "POST", &reqBody) - if fakeHandler.RequestReceived.Header["Authorization"] == nil { - t.Errorf("Request is missing authorization header: %#v", *fakeHandler.RequestReceived) +} + +// This test assumes that the client implementation backs off exponentially, for an individual request. +func TestBackoffLifecycle(t *testing.T) { + count := 0 + testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + count++ + t.Logf("Attempt %d", count) + if count == 5 || count == 9 { + w.WriteHeader(http.StatusOK) + return + } else { + w.WriteHeader(http.StatusGatewayTimeout) + return + } + })) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() + c := testRESTClient(t, testServer) + + // Test backoff recovery and increase. This correlates to the constants + // which are used in the server implementation returning StatusOK above. + seconds := []int{0, 1, 2, 4, 8, 0, 1, 2, 4, 0} + request := c.Verb("POST").Prefix("backofftest").Suffix("abc") + request.backoffMgr = &URLBackoff{ + Backoff: util.NewBackOff( + time.Duration(1)*time.Second, + time.Duration(200)*time.Second)} + for _, sec := range seconds { + start := time.Now() + request.DoRaw() + finish := time.Since(start) + t.Logf("%v finished in %v", sec, finish) + if finish < time.Duration(sec)*time.Second || finish >= time.Duration(sec+5)*time.Second { + t.Fatalf("%v not in range %v", finish, sec) + } } } @@ -698,9 +796,10 @@ func TestCheckRetryClosesBody(t *testing.T) { w.Header().Set("Retry-After", "0") w.WriteHeader(apierrors.StatusTooManyRequests) })) - defer testServer.Close() + // TODO: Uncomment when fix #19254 + // defer testServer.Close() - c := NewOrDie(&Config{Host: testServer.URL, Version: testapi.Default.Version(), Username: "user", Password: "pass"}) + c := testRESTClient(t, testServer) _, err := c.Verb("POST"). Prefix("foo", "bar"). Suffix("baz"). @@ -716,7 +815,40 @@ func TestCheckRetryClosesBody(t *testing.T) { } } -func BenchmarkCheckRetryClosesBody(t *testing.B) { +func TestCheckRetryHandles429And5xx(t *testing.T) { + count := 0 + ch := make(chan struct{}) + testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + t.Logf("attempt %d", count) + if count >= 4 { + w.WriteHeader(http.StatusOK) + close(ch) + return + } + w.Header().Set("Retry-After", "0") + w.WriteHeader([]int{apierrors.StatusTooManyRequests, 500, 501, 504}[count]) + count++ + })) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() + + c := testRESTClient(t, testServer) + _, err := c.Verb("POST"). + Prefix("foo", "bar"). + Suffix("baz"). + Timeout(time.Second). + Body([]byte(strings.Repeat("abcd", 1000))). + DoRaw() + if err != nil { + t.Fatalf("Unexpected error: %v %#v", err, err) + } + <-ch + if count != 4 { + t.Errorf("unexpected retries: %d", count) + } +} + +func BenchmarkCheckRetryClosesBody(b *testing.B) { count := 0 testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { count++ @@ -727,37 +859,41 @@ func BenchmarkCheckRetryClosesBody(t *testing.B) { w.Header().Set("Retry-After", "0") w.WriteHeader(apierrors.StatusTooManyRequests) })) - defer testServer.Close() + // TODO: Uncomment when fix #19254 + // defer testServer.Close() - c := NewOrDie(&Config{Host: testServer.URL, Version: testapi.Default.Version(), Username: "user", Password: "pass"}) + c := testRESTClient(b, testServer) r := c.Verb("POST"). Prefix("foo", "bar"). Suffix("baz"). Timeout(time.Second). Body([]byte(strings.Repeat("abcd", 1000))) - for i := 0; i < t.N; i++ { + for i := 0; i < b.N; i++ { if _, err := r.DoRaw(); err != nil { - t.Fatalf("Unexpected error: %v %#v", err, err) + b.Fatalf("Unexpected error: %v %#v", err, err) } } } + func TestDoRequestNewWayReader(t *testing.T) { reqObj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - reqBodyExpected, _ := testapi.Default.Codec().Encode(reqObj) + reqBodyExpected, _ := runtime.Encode(testapi.Default.Codec(), reqObj) expectedObj := &api.Service{Spec: api.ServiceSpec{Ports: []api.ServicePort{{ Protocol: "TCP", Port: 12345, - TargetPort: util.NewIntOrStringFromInt(12345), + TargetPort: intstr.FromInt(12345), }}}} - expectedBody, _ := testapi.Default.Codec().Encode(expectedObj) - fakeHandler := util.FakeHandler{ + expectedBody, _ := runtime.Encode(testapi.Default.Codec(), expectedObj) + fakeHandler := utiltesting.FakeHandler{ StatusCode: 200, ResponseBody: string(expectedBody), T: t, } testServer := httptest.NewServer(&fakeHandler) - c := NewOrDie(&Config{Host: testServer.URL, Version: testapi.Default.Version(), Username: "user", Password: "pass"}) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() + c := testRESTClient(t, testServer) obj, err := c.Verb("POST"). Resource("bar"). Name("baz"). @@ -777,29 +913,28 @@ func TestDoRequestNewWayReader(t *testing.T) { } tmpStr := string(reqBodyExpected) requestURL := testapi.Default.ResourcePathWithPrefix("foo", "bar", "", "baz") - requestURL += "?" + unversioned.LabelSelectorQueryParam(testapi.Default.Version()) + "=name%3Dfoo&timeout=1s" + requestURL += "?" + unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()) + "=name%3Dfoo&timeout=1s" fakeHandler.ValidateRequest(t, requestURL, "POST", &tmpStr) - if fakeHandler.RequestReceived.Header["Authorization"] == nil { - t.Errorf("Request is missing authorization header: %#v", *fakeHandler.RequestReceived) - } } func TestDoRequestNewWayObj(t *testing.T) { reqObj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - reqBodyExpected, _ := testapi.Default.Codec().Encode(reqObj) + reqBodyExpected, _ := runtime.Encode(testapi.Default.Codec(), reqObj) expectedObj := &api.Service{Spec: api.ServiceSpec{Ports: []api.ServicePort{{ Protocol: "TCP", Port: 12345, - TargetPort: util.NewIntOrStringFromInt(12345), + TargetPort: intstr.FromInt(12345), }}}} - expectedBody, _ := testapi.Default.Codec().Encode(expectedObj) - fakeHandler := util.FakeHandler{ + expectedBody, _ := runtime.Encode(testapi.Default.Codec(), expectedObj) + fakeHandler := utiltesting.FakeHandler{ StatusCode: 200, ResponseBody: string(expectedBody), T: t, } testServer := httptest.NewServer(&fakeHandler) - c := NewOrDie(&Config{Host: testServer.URL, Version: testapi.Default.Version(), Username: "user", Password: "pass"}) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() + c := testRESTClient(t, testServer) obj, err := c.Verb("POST"). Suffix("baz"). Name("bar"). @@ -819,16 +954,13 @@ func TestDoRequestNewWayObj(t *testing.T) { } tmpStr := string(reqBodyExpected) requestURL := testapi.Default.ResourcePath("foo", "", "bar/baz") - requestURL += "?" + unversioned.LabelSelectorQueryParam(testapi.Default.Version()) + "=name%3Dfoo&timeout=1s" + requestURL += "?" + unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()) + "=name%3Dfoo&timeout=1s" fakeHandler.ValidateRequest(t, requestURL, "POST", &tmpStr) - if fakeHandler.RequestReceived.Header["Authorization"] == nil { - t.Errorf("Request is missing authorization header: %#v", *fakeHandler.RequestReceived) - } } func TestDoRequestNewWayFile(t *testing.T) { reqObj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - reqBodyExpected, err := testapi.Default.Codec().Encode(reqObj) + reqBodyExpected, err := runtime.Encode(testapi.Default.Codec(), reqObj) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -837,6 +969,7 @@ func TestDoRequestNewWayFile(t *testing.T) { if err != nil { t.Errorf("unexpected error: %v", err) } + defer file.Close() _, err = file.Write(reqBodyExpected) if err != nil { @@ -846,16 +979,18 @@ func TestDoRequestNewWayFile(t *testing.T) { expectedObj := &api.Service{Spec: api.ServiceSpec{Ports: []api.ServicePort{{ Protocol: "TCP", Port: 12345, - TargetPort: util.NewIntOrStringFromInt(12345), + TargetPort: intstr.FromInt(12345), }}}} - expectedBody, _ := testapi.Default.Codec().Encode(expectedObj) - fakeHandler := util.FakeHandler{ + expectedBody, _ := runtime.Encode(testapi.Default.Codec(), expectedObj) + fakeHandler := utiltesting.FakeHandler{ StatusCode: 200, ResponseBody: string(expectedBody), T: t, } testServer := httptest.NewServer(&fakeHandler) - c := NewOrDie(&Config{Host: testServer.URL, Version: testapi.Default.Version(), Username: "user", Password: "pass"}) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() + c := testRESTClient(t, testServer) wasCreated := true obj, err := c.Verb("POST"). Prefix("foo/bar", "baz"). @@ -878,14 +1013,11 @@ func TestDoRequestNewWayFile(t *testing.T) { requestURL := testapi.Default.ResourcePathWithPrefix("foo/bar/baz", "", "", "") requestURL += "?timeout=1s" fakeHandler.ValidateRequest(t, requestURL, "POST", &tmpStr) - if fakeHandler.RequestReceived.Header["Authorization"] == nil { - t.Errorf("Request is missing authorization header: %#v", *fakeHandler.RequestReceived) - } } func TestWasCreated(t *testing.T) { reqObj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - reqBodyExpected, err := testapi.Default.Codec().Encode(reqObj) + reqBodyExpected, err := runtime.Encode(testapi.Default.Codec(), reqObj) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -893,16 +1025,18 @@ func TestWasCreated(t *testing.T) { expectedObj := &api.Service{Spec: api.ServiceSpec{Ports: []api.ServicePort{{ Protocol: "TCP", Port: 12345, - TargetPort: util.NewIntOrStringFromInt(12345), + TargetPort: intstr.FromInt(12345), }}}} - expectedBody, _ := testapi.Default.Codec().Encode(expectedObj) - fakeHandler := util.FakeHandler{ + expectedBody, _ := runtime.Encode(testapi.Default.Codec(), expectedObj) + fakeHandler := utiltesting.FakeHandler{ StatusCode: 201, ResponseBody: string(expectedBody), T: t, } testServer := httptest.NewServer(&fakeHandler) - c := NewOrDie(&Config{Host: testServer.URL, Version: testapi.Default.Version(), Username: "user", Password: "pass"}) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() + c := testRESTClient(t, testServer) wasCreated := false obj, err := c.Verb("PUT"). Prefix("foo/bar", "baz"). @@ -926,13 +1060,10 @@ func TestWasCreated(t *testing.T) { requestURL := testapi.Default.ResourcePathWithPrefix("foo/bar/baz", "", "", "") requestURL += "?timeout=1s" fakeHandler.ValidateRequest(t, requestURL, "PUT", &tmpStr) - if fakeHandler.RequestReceived.Header["Authorization"] == nil { - t.Errorf("Request is missing authorization header: %#v", *fakeHandler.RequestReceived) - } } func TestVerbs(t *testing.T) { - c := NewOrDie(&Config{}) + c := testRESTClient(t, nil) if r := c.Post(); r.verb != "POST" { t.Errorf("Post verb is wrong") } @@ -947,49 +1078,38 @@ func TestVerbs(t *testing.T) { } } -func TestUnversionedPath(t *testing.T) { - tt := []struct { - host string - prefix string - unversioned string - expectedPath string - }{ - {"", "", "", "/api"}, - {"", "", "versions", "/api/versions"}, - {"", "/", "", "/"}, - {"", "/versions", "", "/versions"}, - {"", "/api", "", "/api"}, - {"", "/api/vfake", "", "/api/vfake"}, - {"", "/api/vfake", "v1beta100", "/api/vfake/v1beta100"}, - {"", "/api", "/versions", "/api/versions"}, - {"", "/api", "versions", "/api/versions"}, - {"", "/a/api", "", "/a/api"}, - {"", "/a/api", "/versions", "/a/api/versions"}, - {"", "/a/api", "/versions/d/e", "/a/api/versions/d/e"}, - {"", "/a/api/vfake", "/versions/d/e", "/a/api/vfake/versions/d/e"}, - } - for i, tc := range tt { - c := NewOrDie(&Config{Host: tc.host, Prefix: tc.prefix}) - r := c.Post().Prefix("/alpha").UnversionedPath(tc.unversioned) - if r.path != tc.expectedPath { - t.Errorf("test case %d failed: unexpected path: %s, expected %s", i+1, r.path, tc.expectedPath) - } - } - for i, tc := range tt { - c := NewOrDie(&Config{Host: tc.host, Prefix: tc.prefix, Version: "v1"}) - r := c.Post().Prefix("/alpha").UnversionedPath(tc.unversioned) - if r.path != tc.expectedPath { - t.Errorf("test case %d failed: unexpected path: %s, expected %s", i+1, r.path, tc.expectedPath) - } - } -} - func TestAbsPath(t *testing.T) { - expectedPath := "/bar/foo" - c := NewOrDie(&Config{}) - r := c.Post().Prefix("/foo").AbsPath(expectedPath) - if r.path != expectedPath { - t.Errorf("unexpected path: %s, expected %s", r.path, expectedPath) + for i, tc := range []struct { + configPrefix string + resourcePrefix string + absPath string + wantsAbsPath string + }{ + {"", "", "", "/"}, + {"", "", "/", "/"}, + {"", "", "/api", "/api"}, + {"", "", "/api/", "/api/"}, + {"", "", "/apis", "/apis"}, + {"", "/foo", "/bar/foo", "/bar/foo"}, + {"", "/api/foo/123", "/bar/foo", "/bar/foo"}, + {"/p1", "", "", "/p1"}, + {"/p1", "", "/", "/p1/"}, + {"/p1", "", "/api", "/p1/api"}, + {"/p1", "", "/apis", "/p1/apis"}, + {"/p1", "/r1", "/apis", "/p1/apis"}, + {"/p1", "/api/r1", "/apis", "/p1/apis"}, + {"/p1/api/p2", "", "", "/p1/api/p2"}, + {"/p1/api/p2", "", "/", "/p1/api/p2/"}, + {"/p1/api/p2", "", "/api", "/p1/api/p2/api"}, + {"/p1/api/p2", "", "/api/", "/p1/api/p2/api/"}, + {"/p1/api/p2", "/r1", "/api/", "/p1/api/p2/api/"}, + {"/p1/api/p2", "/api/r1", "/api/", "/p1/api/p2/api/"}, + } { + c := NewOrDie(&Config{Host: "http://localhost:123" + tc.configPrefix}) + r := c.Post().Prefix(tc.resourcePrefix).AbsPath(tc.absPath) + if r.pathPrefix != tc.wantsAbsPath { + t.Errorf("test case %d failed, unexpected path: %q, expected %q", i, r.pathPrefix, tc.wantsAbsPath) + } } } @@ -1005,8 +1125,8 @@ func TestUintParam(t *testing.T) { } for _, item := range table { - c := NewOrDie(&Config{}) - r := c.Get().AbsPath("").UintParam(item.name, item.testVal) + u, _ := url.Parse("http://localhost") + r := NewRequest(nil, "GET", u, "", ContentConfig{GroupVersion: &unversioned.GroupVersion{Group: "test"}}, nil, nil).AbsPath("").UintParam(item.name, item.testVal) if e, a := item.expectStr, r.URL().String(); e != a { t.Errorf("expected %v, got %v", e, a) } @@ -1023,7 +1143,7 @@ func TestUnacceptableParamNames(t *testing.T) { } for _, item := range table { - c := NewOrDie(&Config{}) + c := testRESTClient(t, nil) r := c.Get().setParam(item.name, item.testVal) if e, a := item.expectSuccess, r.err == nil; e != a { t.Errorf("expected %v, got %v (%v)", e, a, r.err) @@ -1034,6 +1154,9 @@ func TestUnacceptableParamNames(t *testing.T) { func TestBody(t *testing.T) { const data = "test payload" + obj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} + bodyExpected, _ := runtime.Encode(testapi.Default.Codec(), obj) + f, err := ioutil.TempFile("", "test_body") if err != nil { t.Fatalf("TempFile error: %v", err) @@ -1043,59 +1166,52 @@ func TestBody(t *testing.T) { } f.Close() - c := NewOrDie(&Config{}) - tests := []interface{}{[]byte(data), f.Name(), strings.NewReader(data)} + var nilObject *api.DeleteOptions + typedObject := interface{}(nilObject) + c := testRESTClient(t, nil) + tests := []struct { + input interface{} + expected string + headers map[string]string + }{ + {[]byte(data), data, nil}, + {f.Name(), data, nil}, + {strings.NewReader(data), data, nil}, + {obj, string(bodyExpected), map[string]string{"Content-Type": "application/json"}}, + {typedObject, "", nil}, + } for i, tt := range tests { - r := c.Post().Body(tt) + r := c.Post().Body(tt.input) if r.err != nil { t.Errorf("%d: r.Body(%#v) error: %v", i, tt, r.err) continue } - buf := make([]byte, len(data)) + if tt.headers != nil { + for k, v := range tt.headers { + if r.headers.Get(k) != v { + t.Errorf("%d: r.headers[%q] = %q; want %q", i, k, v, v) + } + } + } + + if r.body == nil { + if len(tt.expected) != 0 { + t.Errorf("%d: r.body = %q; want %q", i, r.body, tt.expected) + } + continue + } + buf := make([]byte, len(tt.expected)) if _, err := r.body.Read(buf); err != nil { t.Errorf("%d: r.body.Read error: %v", i, err) continue } body := string(buf) - if body != data { - t.Errorf("%d: r.body = %q; want %q", i, body, data) + if body != tt.expected { + t.Errorf("%d: r.body = %q; want %q", i, body, tt.expected) } } } -func authFromReq(r *http.Request) (*Config, bool) { - auth, ok := r.Header["Authorization"] - if !ok { - return nil, false - } - - encoded := strings.Split(auth[0], " ") - if len(encoded) != 2 || encoded[0] != "Basic" { - return nil, false - } - - decoded, err := base64.StdEncoding.DecodeString(encoded[1]) - if err != nil { - return nil, false - } - parts := strings.Split(string(decoded), ":") - if len(parts) != 2 { - return nil, false - } - return &Config{Username: parts[0], Password: parts[1]}, true -} - -// checkAuth sets errors if the auth found in r doesn't match the expectation. -// TODO: Move to util, test in more places. -func checkAuth(t *testing.T, expect *Config, r *http.Request) { - foundAuth, found := authFromReq(r) - if !found { - t.Errorf("no auth found") - } else if e, a := expect, foundAuth; !api.Semantic.DeepDerivative(e, a) { - t.Fatalf("Wrong basic auth: wanted %#v, got %#v", e, a) - } -} - func TestWatch(t *testing.T) { var table = []struct { t watch.EventType @@ -1106,9 +1222,7 @@ func TestWatch(t *testing.T) { {watch.Deleted, &api.Pod{ObjectMeta: api.ObjectMeta{Name: "last"}}}, } - auth := &Config{Username: "user", Password: "pass"} testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - checkAuth(t, auth, r) flusher, ok := w.(http.Flusher) if !ok { panic("need flusher!") @@ -1126,17 +1240,10 @@ func TestWatch(t *testing.T) { flusher.Flush() } })) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() - s, err := New(&Config{ - Host: testServer.URL, - Version: testapi.Default.Version(), - Username: "user", - Password: "pass", - }) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - + s := testRESTClient(t, testServer) watching, err := s.Get().Prefix("path/to/watch/thing").Watch() if err != nil { t.Fatalf("Unexpected error") @@ -1162,11 +1269,9 @@ func TestWatch(t *testing.T) { } func TestStream(t *testing.T) { - auth := &Config{Username: "user", Password: "pass"} expectedBody := "expected body" testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - checkAuth(t, auth, r) flusher, ok := w.(http.Flusher) if !ok { panic("need flusher!") @@ -1176,16 +1281,10 @@ func TestStream(t *testing.T) { w.Write([]byte(expectedBody)) flusher.Flush() })) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() - s, err := New(&Config{ - Host: testServer.URL, - Version: testapi.Default.Version(), - Username: "user", - Password: "pass", - }) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } + s := testRESTClient(t, testServer) readCloser, err := s.Get().Prefix("path/to/stream/thing").Stream() if err != nil { t.Fatalf("unexpected error: %v", err) @@ -1199,3 +1298,16 @@ func TestStream(t *testing.T) { t.Errorf("Expected %s, got %s", expectedBody, resultBody) } } + +func testRESTClient(t testing.TB, srv *httptest.Server) *RESTClient { + baseURL, _ := url.Parse("http://localhost") + if srv != nil { + var err error + baseURL, err = url.Parse(srv.URL) + if err != nil { + t.Fatalf("failed to parse test URL: %v", err) + } + } + versionedAPIPath := testapi.Default.ResourcePath("", "", "") + return NewRESTClient(baseURL, versionedAPIPath, ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()}, 0, 0, nil) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/resource_quotas.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/resource_quotas.go index 46241be29..acfd8ddb3 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/resource_quotas.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/resource_quotas.go @@ -18,8 +18,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -30,13 +28,13 @@ type ResourceQuotasNamespacer interface { // ResourceQuotaInterface has methods to work with ResourceQuota resources. type ResourceQuotaInterface interface { - List(label labels.Selector, field fields.Selector) (*api.ResourceQuotaList, error) + List(opts api.ListOptions) (*api.ResourceQuotaList, error) Get(name string) (*api.ResourceQuota, error) Delete(name string) error Create(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) Update(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) UpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // resourceQuotas implements ResourceQuotasNamespacer interface @@ -54,9 +52,9 @@ func newResourceQuotas(c *Client, namespace string) *resourceQuotas { } // List takes a selector, and returns the list of resourceQuotas that match that selector. -func (c *resourceQuotas) List(label labels.Selector, field fields.Selector) (result *api.ResourceQuotaList, err error) { +func (c *resourceQuotas) List(opts api.ListOptions) (result *api.ResourceQuotaList, err error) { result = &api.ResourceQuotaList{} - err = c.r.Get().Namespace(c.ns).Resource("resourceQuotas").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result) + err = c.r.Get().Namespace(c.ns).Resource("resourceQuotas").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) return } @@ -94,13 +92,11 @@ func (c *resourceQuotas) UpdateStatus(resourceQuota *api.ResourceQuota) (result } // Watch returns a watch.Interface that watches the requested resource -func (c *resourceQuotas) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *resourceQuotas) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). Resource("resourceQuotas"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/resource_quotas_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/resource_quotas_test.go index 27688fb2c..ff8abddce 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/resource_quotas_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/resource_quotas_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -23,8 +28,6 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) func getResourceQuotasResoureName() string { @@ -49,17 +52,18 @@ func TestResourceQuotaCreate(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: resourceQuota, }, - Response: Response{StatusCode: 200, Body: resourceQuota}, + Response: simple.Response{StatusCode: 200, Body: resourceQuota}, } response, err := c.Setup(t).ResourceQuotas(ns).Create(resourceQuota) + defer c.Close() c.Validate(t, response, err) } @@ -81,17 +85,18 @@ func TestResourceQuotaGet(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: resourceQuota}, + Response: simple.Response{StatusCode: 200, Body: resourceQuota}, } response, err := c.Setup(t).ResourceQuotas(ns).Get("abc") + defer c.Close() c.Validate(t, response, err) } @@ -105,16 +110,17 @@ func TestResourceQuotaList(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, ""), - Query: buildQueryValues(nil), + Query: simple.BuildQueryValues(nil), Body: nil, }, - Response: Response{StatusCode: 200, Body: resourceQuotaList}, + Response: simple.Response{StatusCode: 200, Body: resourceQuotaList}, } - response, err := c.Setup(t).ResourceQuotas(ns).List(labels.Everything(), fields.Everything()) + response, err := c.Setup(t).ResourceQuotas(ns).List(api.ListOptions{}) + defer c.Close() c.Validate(t, response, err) } @@ -137,11 +143,12 @@ func TestResourceQuotaUpdate(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: resourceQuota}, + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: resourceQuota}, } response, err := c.Setup(t).ResourceQuotas(ns).Update(resourceQuota) + defer c.Close() c.Validate(t, response, err) } @@ -164,35 +171,38 @@ func TestResourceQuotaStatusUpdate(t *testing.T) { }, }, } - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "PUT", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "abc") + "/status", - Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: resourceQuota}, + Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: resourceQuota}, } response, err := c.Setup(t).ResourceQuotas(ns).UpdateStatus(resourceQuota) + defer c.Close() c.Validate(t, response, err) } func TestResourceQuotaDelete(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "foo"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).ResourceQuotas(ns).Delete("foo") + defer c.Close() c.Validate(t, nil, err) } func TestResourceQuotaWatch(t *testing.T) { - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePathWithPrefix("watch", getResourceQuotasResoureName(), "", ""), Query: url.Values{"resourceVersion": []string{}}}, - Response: Response{StatusCode: 200}, + Response: simple.Response{StatusCode: 200}, } - _, err := c.Setup(t).ResourceQuotas(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), "") + _, err := c.Setup(t).ResourceQuotas(api.NamespaceAll).Watch(api.ListOptions{}) + defer c.Close() c.Validate(t, nil, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/restclient.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/restclient.go index db7ab1ee2..3946754f3 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/restclient.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/restclient.go @@ -17,15 +17,25 @@ limitations under the License. package unversioned import ( + "net/http" "net/url" + "os" + "strconv" "strings" "time" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/util" ) +const ( + // Environment variables: Note that the duration should be long enough that the backoff + // persists for some reasonable time (i.e. 120 seconds). The typical base might be "1". + envBackoffBase = "KUBE_CLIENT_BACKOFF_BASE" + envBackoffDuration = "KUBE_CLIENT_BACKOFF_DURATION" +) + // RESTClient imposes common Kubernetes API conventions on a set of resource paths. // The baseURL is expected to point to an HTTP or HTTPS path that is the parent // of one or more resources. The server should return a decodable API resource @@ -34,28 +44,25 @@ import ( // // Most consumers should use client.New() to get a Kubernetes API client. type RESTClient struct { - baseURL *url.URL - // A string identifying the version of the API this client is expected to use. - apiVersion string + // base is the root URL for all invocations of the client + base *url.URL + // versionedAPIPath is a path segment connecting the base URL to the resource root + versionedAPIPath string - // Codec is the encoding and decoding scheme that applies to a particular set of - // REST resources. - Codec runtime.Codec - - // Set specific behavior of the client. If not set http.DefaultClient will be - // used. - Client HTTPClient - - Timeout time.Duration + // contentConfig is the information used to communicate with the server. + contentConfig ContentConfig // TODO extract this into a wrapper interface via the RESTClient interface in kubectl. Throttle util.RateLimiter + + // Set specific behavior of the client. If not set http.DefaultClient will be used. + Client *http.Client } // NewRESTClient creates a new RESTClient. This client performs generic REST functions // such as Get, Put, Post, and Delete on specified paths. Codec controls encoding and // decoding of responses from the server. -func NewRESTClient(baseURL *url.URL, apiVersion string, c runtime.Codec, maxQPS float32, maxBurst int) *RESTClient { +func NewRESTClient(baseURL *url.URL, versionedAPIPath string, config ContentConfig, maxQPS float32, maxBurst int, client *http.Client) *RESTClient { base := *baseURL if !strings.HasSuffix(base.Path, "/") { base.Path += "/" @@ -63,18 +70,44 @@ func NewRESTClient(baseURL *url.URL, apiVersion string, c runtime.Codec, maxQPS base.RawQuery = "" base.Fragment = "" + if config.GroupVersion == nil { + config.GroupVersion = &unversioned.GroupVersion{} + } + if len(config.ContentType) == 0 { + config.ContentType = "application/json" + } + var throttle util.RateLimiter if maxQPS > 0 { throttle = util.NewTokenBucketRateLimiter(maxQPS, maxBurst) } return &RESTClient{ - baseURL: &base, - apiVersion: apiVersion, - Codec: c, - Throttle: throttle, + base: &base, + versionedAPIPath: versionedAPIPath, + contentConfig: config, + Throttle: throttle, + Client: client, } } +// readExpBackoffConfig handles the internal logic of determining what the +// backoff policy is. By default if no information is available, NoBackoff. +// TODO Generalize this see #17727 . +func readExpBackoffConfig() BackoffManager { + backoffBase := os.Getenv(envBackoffBase) + backoffDuration := os.Getenv(envBackoffDuration) + + backoffBaseInt, errBase := strconv.ParseInt(backoffBase, 10, 64) + backoffDurationInt, errDuration := strconv.ParseInt(backoffDuration, 10, 64) + if errBase != nil || errDuration != nil { + return &NoBackoff{} + } + return &URLBackoff{ + Backoff: util.NewBackOff( + time.Duration(backoffBaseInt)*time.Second, + time.Duration(backoffDurationInt)*time.Second)} +} + // Verb begins a request with a verb (GET, POST, PUT, DELETE). // // Example usage of RESTClient's request building interface: @@ -88,10 +121,12 @@ func NewRESTClient(baseURL *url.URL, apiVersion string, c runtime.Codec, maxQPS // list, ok := resp.(*api.PodList) // func (c *RESTClient) Verb(verb string) *Request { - if c.Throttle != nil { - c.Throttle.Accept() + backoff := readExpBackoffConfig() + + if c.Client == nil { + return NewRequest(nil, verb, c.base, c.versionedAPIPath, c.contentConfig, backoff, c.Throttle) } - return NewRequest(c.Client, verb, c.baseURL, c.apiVersion, c.Codec).Timeout(c.Timeout) + return NewRequest(c.Client, verb, c.base, c.versionedAPIPath, c.contentConfig, backoff, c.Throttle) } // Post begins a POST request. Short for c.Verb("POST"). @@ -120,6 +155,6 @@ func (c *RESTClient) Delete() *Request { } // APIVersion returns the APIVersion this RESTClient is expected to use. -func (c *RESTClient) APIVersion() string { - return c.apiVersion +func (c *RESTClient) APIVersion() unversioned.GroupVersion { + return *c.contentConfig.GroupVersion } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/restclient_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/restclient_test.go index 801485d9b..912611f4a 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/restclient_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/restclient_test.go @@ -19,175 +19,37 @@ package unversioned import ( "net/http" "net/http/httptest" + "net/url" + "os" "reflect" "testing" + "time" + "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util" + utiltesting "k8s.io/kubernetes/pkg/util/testing" ) -func TestSetsCodec(t *testing.T) { - testCases := map[string]struct { - Err bool - Prefix string - Codec runtime.Codec - }{ - testapi.Default.Version(): {false, "/api/" + testapi.Default.Version() + "/", testapi.Default.Codec()}, - "invalidVersion": {true, "", nil}, - } - for version, expected := range testCases { - client, err := New(&Config{Host: "127.0.0.1", Version: version}) - switch { - case err == nil && expected.Err: - t.Errorf("expected error but was nil") - continue - case err != nil && !expected.Err: - t.Errorf("unexpected error %v", err) - continue - case err != nil: - continue - } - if e, a := expected.Prefix, client.RESTClient.baseURL.Path; e != a { - t.Errorf("expected %#v, got %#v", e, a) - } - if e, a := expected.Codec, client.RESTClient.Codec; e != a { - t.Errorf("expected %#v, got %#v", e, a) - } - } -} - -func TestRESTClientRequires(t *testing.T) { - if _, err := RESTClientFor(&Config{Host: "127.0.0.1", Version: "", Codec: testapi.Default.Codec()}); err == nil { - t.Errorf("unexpected non-error") - } - if _, err := RESTClientFor(&Config{Host: "127.0.0.1", Version: testapi.Default.Version()}); err == nil { - t.Errorf("unexpected non-error") - } - if _, err := RESTClientFor(&Config{Host: "127.0.0.1", Version: testapi.Default.Version(), Codec: testapi.Default.Codec()}); err != nil { - t.Errorf("unexpected error: %v", err) - } -} - -func TestValidatesHostParameter(t *testing.T) { - testCases := []struct { - Host string - Prefix string - - URL string - Err bool - }{ - {"127.0.0.1", "", "http://127.0.0.1/" + testapi.Default.Version() + "/", false}, - {"127.0.0.1:8080", "", "http://127.0.0.1:8080/" + testapi.Default.Version() + "/", false}, - {"foo.bar.com", "", "http://foo.bar.com/" + testapi.Default.Version() + "/", false}, - {"http://host/prefix", "", "http://host/prefix/" + testapi.Default.Version() + "/", false}, - {"http://host", "", "http://host/" + testapi.Default.Version() + "/", false}, - {"http://host", "/", "http://host/" + testapi.Default.Version() + "/", false}, - {"http://host", "/other", "http://host/other/" + testapi.Default.Version() + "/", false}, - {"host/server", "", "", true}, - } - for i, testCase := range testCases { - c, err := RESTClientFor(&Config{Host: testCase.Host, Prefix: testCase.Prefix, Version: testapi.Default.Version(), Codec: testapi.Default.Codec()}) - switch { - case err == nil && testCase.Err: - t.Errorf("expected error but was nil") - continue - case err != nil && !testCase.Err: - t.Errorf("unexpected error %v", err) - continue - case err != nil: - continue - } - if e, a := testCase.URL, c.baseURL.String(); e != a { - t.Errorf("%d: expected host %s, got %s", i, e, a) - continue - } - } -} - -func TestDoRequestBearer(t *testing.T) { - status := &unversioned.Status{Status: unversioned.StatusFailure} - expectedBody, _ := testapi.Default.Codec().Encode(status) - fakeHandler := util.FakeHandler{ - StatusCode: 400, - ResponseBody: string(expectedBody), - T: t, - } - testServer := httptest.NewServer(&fakeHandler) - defer testServer.Close() - request, _ := http.NewRequest("GET", testServer.URL, nil) - c, err := RESTClientFor(&Config{ - Host: testServer.URL, - Version: testapi.Default.Version(), - Codec: testapi.Default.Codec(), - BearerToken: "test", - }) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - err = c.Get().Do().Error() - if err == nil { - t.Fatalf("unexpected non-error: %v", err) - } - if fakeHandler.RequestReceived.Header.Get("Authorization") != "Bearer test" { - t.Errorf("Request is missing authorization header: %#v", *request) - } -} - -func TestDoRequestWithoutPassword(t *testing.T) { - status := &unversioned.Status{Status: unversioned.StatusFailure} - expectedBody, _ := testapi.Default.Codec().Encode(status) - fakeHandler := util.FakeHandler{ - StatusCode: 400, - ResponseBody: string(expectedBody), - T: t, - } - testServer := httptest.NewServer(&fakeHandler) - defer testServer.Close() - c, err := RESTClientFor(&Config{ - Host: testServer.URL, - Version: testapi.Default.Version(), - Codec: testapi.Default.Codec(), - Username: "test", - }) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - body, err := c.Get().Prefix("test").Do().Raw() - if err == nil { - t.Fatalf("Unexpected non-error") - } - if fakeHandler.RequestReceived.Header["Authorization"] == nil { - t.Errorf("Request is missing authorization header: %#v", fakeHandler.RequestReceived) - } - se, ok := err.(APIStatus) - if !ok { - t.Fatalf("Unexpected kind of error: %#v", err) - } - if !reflect.DeepEqual(se.Status(), *status) { - t.Errorf("Unexpected status: %#v %#v", se.Status(), status) - } - if body != nil { - t.Errorf("Expected nil body, but saw: '%s'", string(body)) - } - fakeHandler.ValidateRequest(t, "/"+testapi.Default.Version()+"/test", "GET", nil) -} - func TestDoRequestSuccess(t *testing.T) { status := &unversioned.Status{Status: unversioned.StatusSuccess} - expectedBody, _ := testapi.Default.Codec().Encode(status) - fakeHandler := util.FakeHandler{ + expectedBody, _ := runtime.Encode(testapi.Default.Codec(), status) + fakeHandler := utiltesting.FakeHandler{ StatusCode: 200, ResponseBody: string(expectedBody), T: t, } testServer := httptest.NewServer(&fakeHandler) - defer testServer.Close() + // TODO: Uncomment when fix #19254 + // defer testServer.Close() c, err := RESTClientFor(&Config{ - Host: testServer.URL, - Version: testapi.Default.Version(), - Codec: testapi.Default.Codec(), + Host: testServer.URL, + ContentConfig: ContentConfig{ + GroupVersion: testapi.Default.GroupVersion(), + Codec: testapi.Default.Codec(), + }, Username: "user", Password: "pass", }) @@ -201,14 +63,14 @@ func TestDoRequestSuccess(t *testing.T) { if fakeHandler.RequestReceived.Header["Authorization"] == nil { t.Errorf("Request is missing authorization header: %#v", fakeHandler.RequestReceived) } - statusOut, err := testapi.Default.Codec().Decode(body) + statusOut, err := runtime.Decode(testapi.Default.Codec(), body) if err != nil { t.Errorf("Unexpected error %#v", err) } if !reflect.DeepEqual(status, statusOut) { t.Errorf("Unexpected mis-match. Expected %#v. Saw %#v", status, statusOut) } - fakeHandler.ValidateRequest(t, "/"+testapi.Default.Version()+"/test", "GET", nil) + fakeHandler.ValidateRequest(t, "/"+testapi.Default.GroupVersion().String()+"/test", "GET", nil) } func TestDoRequestFailed(t *testing.T) { @@ -219,18 +81,21 @@ func TestDoRequestFailed(t *testing.T) { Message: " \"\" not found", Details: &unversioned.StatusDetails{}, } - expectedBody, _ := testapi.Default.Codec().Encode(status) - fakeHandler := util.FakeHandler{ + expectedBody, _ := runtime.Encode(testapi.Default.Codec(), status) + fakeHandler := utiltesting.FakeHandler{ StatusCode: 404, ResponseBody: string(expectedBody), T: t, } testServer := httptest.NewServer(&fakeHandler) - defer testServer.Close() + // TODO: Uncomment when fix #19254 + // defer testServer.Close() c, err := RESTClientFor(&Config{ - Host: testServer.URL, - Version: testapi.Default.Version(), - Codec: testapi.Default.Codec(), + Host: testServer.URL, + ContentConfig: ContentConfig{ + GroupVersion: testapi.Default.GroupVersion(), + Codec: testapi.Default.Codec(), + }, }) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -239,30 +104,37 @@ func TestDoRequestFailed(t *testing.T) { if err == nil || body != nil { t.Errorf("unexpected non-error: %#v", body) } - ss, ok := err.(APIStatus) + ss, ok := err.(errors.APIStatus) if !ok { t.Errorf("unexpected error type %v", err) } actual := ss.Status() - if !reflect.DeepEqual(status, &actual) { + expected := *status + // The decoder will apply the default Version and Kind to the Status. + expected.APIVersion = "v1" + expected.Kind = "Status" + if !reflect.DeepEqual(&expected, &actual) { t.Errorf("Unexpected mis-match: %s", util.ObjectDiff(status, &actual)) } } func TestDoRequestCreated(t *testing.T) { status := &unversioned.Status{Status: unversioned.StatusSuccess} - expectedBody, _ := testapi.Default.Codec().Encode(status) - fakeHandler := util.FakeHandler{ + expectedBody, _ := runtime.Encode(testapi.Default.Codec(), status) + fakeHandler := utiltesting.FakeHandler{ StatusCode: 201, ResponseBody: string(expectedBody), T: t, } testServer := httptest.NewServer(&fakeHandler) - defer testServer.Close() + // TODO: Uncomment when fix #19254 + // defer testServer.Close() c, err := RESTClientFor(&Config{ - Host: testServer.URL, - Version: testapi.Default.Version(), - Codec: testapi.Default.Codec(), + Host: testServer.URL, + ContentConfig: ContentConfig{ + GroupVersion: testapi.Default.GroupVersion(), + Codec: testapi.Default.Codec(), + }, Username: "user", Password: "pass", }) @@ -277,12 +149,48 @@ func TestDoRequestCreated(t *testing.T) { if !created { t.Errorf("Expected object to be created") } - statusOut, err := testapi.Default.Codec().Decode(body) + statusOut, err := runtime.Decode(testapi.Default.Codec(), body) if err != nil { t.Errorf("Unexpected error %#v", err) } if !reflect.DeepEqual(status, statusOut) { t.Errorf("Unexpected mis-match. Expected %#v. Saw %#v", status, statusOut) } - fakeHandler.ValidateRequest(t, "/"+testapi.Default.Version()+"/test", "GET", nil) + fakeHandler.ValidateRequest(t, "/"+testapi.Default.GroupVersion().String()+"/test", "GET", nil) +} + +func TestCreateBackoffManager(t *testing.T) { + + theUrl, _ := url.Parse("http://localhost") + + // 1 second base backoff + duration of 2 seconds -> exponential backoff for requests. + os.Setenv(envBackoffBase, "1") + os.Setenv(envBackoffDuration, "2") + backoff := readExpBackoffConfig() + backoff.UpdateBackoff(theUrl, nil, 500) + backoff.UpdateBackoff(theUrl, nil, 500) + if backoff.CalculateBackoff(theUrl)/time.Second != 2 { + t.Errorf("Backoff env not working.") + } + + // 0 duration -> no backoff. + os.Setenv(envBackoffBase, "1") + os.Setenv(envBackoffDuration, "0") + backoff.UpdateBackoff(theUrl, nil, 500) + backoff.UpdateBackoff(theUrl, nil, 500) + backoff = readExpBackoffConfig() + if backoff.CalculateBackoff(theUrl)/time.Second != 0 { + t.Errorf("Zero backoff duration, but backoff still occuring.") + } + + // No env -> No backoff. + os.Setenv(envBackoffBase, "") + os.Setenv(envBackoffDuration, "") + backoff = readExpBackoffConfig() + backoff.UpdateBackoff(theUrl, nil, 500) + backoff.UpdateBackoff(theUrl, nil, 500) + if backoff.CalculateBackoff(theUrl)/time.Second != 0 { + t.Errorf("Backoff should have been 0.") + } + } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/scale.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/scale.go index 7663325b4..705f6048b 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/scale.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/scale.go @@ -18,6 +18,7 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" ) @@ -48,17 +49,25 @@ func newScales(c *ExtensionsClient, namespace string) *scales { // Get takes the reference to scale subresource and returns the subresource or error, if one occurs. func (c *scales) Get(kind string, name string) (result *extensions.Scale, err error) { result = &extensions.Scale{} - resource, _ := meta.KindToResource(kind, false) - err = c.client.Get().Namespace(c.ns).Resource(resource).Name(name).SubResource("scale").Do().Into(result) + + // TODO this method needs to take a proper unambiguous kind + fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind} + resource, _ := meta.KindToResource(fullyQualifiedKind) + + err = c.client.Get().Namespace(c.ns).Resource(resource.Resource).Name(name).SubResource("scale").Do().Into(result) return } func (c *scales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) { result = &extensions.Scale{} - resource, _ := meta.KindToResource(kind, false) + + // TODO this method needs to take a proper unambiguous kind + fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind} + resource, _ := meta.KindToResource(fullyQualifiedKind) + err = c.client.Put(). Namespace(scale.Namespace). - Resource(resource). + Resource(resource.Resource). Name(scale.Name). SubResource("scale"). Body(scale). diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/secrets.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/secrets.go index 0b3712301..33d77ad24 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/secrets.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/secrets.go @@ -18,8 +18,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -31,9 +29,9 @@ type SecretsInterface interface { Create(secret *api.Secret) (*api.Secret, error) Update(secret *api.Secret) (*api.Secret, error) Delete(name string) error - List(label labels.Selector, field fields.Selector) (*api.SecretList, error) + List(opts api.ListOptions) (*api.SecretList, error) Get(name string) (*api.Secret, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // events implements Secrets interface @@ -63,14 +61,13 @@ func (s *secrets) Create(secret *api.Secret) (*api.Secret, error) { } // List returns a list of secrets matching the selectors. -func (s *secrets) List(label labels.Selector, field fields.Selector) (*api.SecretList, error) { +func (s *secrets) List(opts api.ListOptions) (*api.SecretList, error) { result := &api.SecretList{} err := s.client.Get(). Namespace(s.namespace). Resource("secrets"). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Do(). Into(result) @@ -91,14 +88,12 @@ func (s *secrets) Get(name string) (*api.Secret, error) { } // Watch starts watching for secrets matching the given selectors. -func (s *secrets) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (s *secrets) Watch(opts api.ListOptions) (watch.Interface, error) { return s.client.Get(). Prefix("watch"). Namespace(s.namespace). Resource("secrets"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go index 45ad664c2..d78a25c47 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/service_accounts.go @@ -18,8 +18,6 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -31,9 +29,9 @@ type ServiceAccountsInterface interface { Create(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error) Update(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error) Delete(name string) error - List(label labels.Selector, field fields.Selector) (*api.ServiceAccountList, error) + List(opts api.ListOptions) (*api.ServiceAccountList, error) Get(name string) (*api.ServiceAccount, error) - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) + Watch(opts api.ListOptions) (watch.Interface, error) } // serviceAccounts implements ServiceAccounts interface @@ -63,14 +61,13 @@ func (s *serviceAccounts) Create(serviceAccount *api.ServiceAccount) (*api.Servi } // List returns a list of serviceAccounts matching the selectors. -func (s *serviceAccounts) List(label labels.Selector, field fields.Selector) (*api.ServiceAccountList, error) { +func (s *serviceAccounts) List(opts api.ListOptions) (*api.ServiceAccountList, error) { result := &api.ServiceAccountList{} err := s.client.Get(). Namespace(s.namespace). Resource("serviceAccounts"). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Do(). Into(result) @@ -91,14 +88,12 @@ func (s *serviceAccounts) Get(name string) (*api.ServiceAccount, error) { } // Watch starts watching for serviceAccounts matching the given selectors. -func (s *serviceAccounts) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (s *serviceAccounts) Watch(opts api.ListOptions) (watch.Interface, error) { return s.client.Get(). Prefix("watch"). Namespace(s.namespace). Resource("serviceAccounts"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/services.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/services.go index 54b1171e9..510ed99b7 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/services.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/services.go @@ -18,8 +18,7 @@ package unversioned import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" + "k8s.io/kubernetes/pkg/util/net" "k8s.io/kubernetes/pkg/watch" ) @@ -30,13 +29,14 @@ type ServicesNamespacer interface { // ServiceInterface has methods to work with Service resources. type ServiceInterface interface { - List(label labels.Selector, field fields.Selector) (*api.ServiceList, error) + List(opts api.ListOptions) (*api.ServiceList, error) Get(name string) (*api.Service, error) Create(srv *api.Service) (*api.Service, error) Update(srv *api.Service) (*api.Service, error) + UpdateStatus(srv *api.Service) (*api.Service, error) Delete(name string) error - Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) - ProxyGet(name, path string, params map[string]string) ResponseWrapper + Watch(opts api.ListOptions) (watch.Interface, error) + ProxyGet(scheme, name, port, path string, params map[string]string) ResponseWrapper } // services implements ServicesNamespacer interface @@ -51,13 +51,12 @@ func newServices(c *Client, namespace string) *services { } // List takes a selector, and returns the list of services that match that selector -func (c *services) List(label labels.Selector, field fields.Selector) (result *api.ServiceList, err error) { +func (c *services) List(opts api.ListOptions) (result *api.ServiceList, err error) { result = &api.ServiceList{} err = c.r.Get(). Namespace(c.ns). Resource("services"). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Do(). Into(result) return @@ -84,30 +83,35 @@ func (c *services) Update(svc *api.Service) (result *api.Service, err error) { return } +// UpdateStatus takes a Service object with the new status and applies it as an update to the existing Service. +func (c *services) UpdateStatus(service *api.Service) (result *api.Service, err error) { + result = &api.Service{} + err = c.r.Put().Namespace(c.ns).Resource("services").Name(service.Name).SubResource("status").Body(service).Do().Into(result) + return +} + // Delete deletes an existing service. func (c *services) Delete(name string) error { return c.r.Delete().Namespace(c.ns).Resource("services").Name(name).Do().Error() } // Watch returns a watch.Interface that watches the requested services. -func (c *services) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { +func (c *services) Watch(opts api.ListOptions) (watch.Interface, error) { return c.r.Get(). Prefix("watch"). Namespace(c.ns). Resource("services"). - Param("resourceVersion", resourceVersion). - LabelsSelectorParam(label). - FieldsSelectorParam(field). + VersionedParams(&opts, api.ParameterCodec). Watch() } // ProxyGet returns a response of the service by calling it through the proxy. -func (c *services) ProxyGet(name, path string, params map[string]string) ResponseWrapper { +func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) ResponseWrapper { request := c.r.Get(). Prefix("proxy"). Namespace(c.ns). Resource("services"). - Name(name). + Name(net.JoinSchemeNamePort(scheme, name, port)). Suffix(path) for k, v := range params { request = request.Param(k, v) diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/services_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/services_test.go index a491b0951..e984a42aa 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/services_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/services_test.go @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unversioned +package unversioned_test + +import ( + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) import ( "net/url" @@ -23,18 +28,17 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" - "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" ) func TestListServices(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath("services", ns, ""), - Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, + Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: &api.ServiceList{ Items: []api.Service{ { @@ -55,20 +59,21 @@ func TestListServices(t *testing.T) { }, }, } - receivedServiceList, err := c.Setup(t).Services(ns).List(labels.Everything(), fields.Everything()) + receivedServiceList, err := c.Setup(t).Services(ns).List(api.ListOptions{}) + defer c.Close() t.Logf("received services: %v %#v", err, receivedServiceList) c.Validate(t, receivedServiceList, err) } func TestListServicesLabels(t *testing.T) { ns := api.NamespaceDefault - labelSelectorQueryParamName := unversioned.LabelSelectorQueryParam(testapi.Default.Version()) - c := &testClient{ - Request: testRequest{ + labelSelectorQueryParamName := unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()) + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath("services", ns, ""), - Query: buildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, - Response: Response{StatusCode: 200, + Query: simple.BuildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, + Response: simple.Response{StatusCode: 200, Body: &api.ServiceList{ Items: []api.Service{ { @@ -90,31 +95,35 @@ func TestListServicesLabels(t *testing.T) { }, } c.Setup(t) - c.QueryValidator[labelSelectorQueryParamName] = validateLabels + defer c.Close() + c.QueryValidator[labelSelectorQueryParamName] = simple.ValidateLabels selector := labels.Set{"foo": "bar", "name": "baz"}.AsSelector() - receivedServiceList, err := c.Services(ns).List(selector, fields.Everything()) + options := api.ListOptions{LabelSelector: selector} + receivedServiceList, err := c.Services(ns).List(options) c.Validate(t, receivedServiceList, err) } func TestGetService(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePath("services", ns, "1"), - Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}}, + Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}}, } response, err := c.Setup(t).Services(ns).Get("1") + defer c.Close() c.Validate(t, response, err) } func TestGetServiceWithNoName(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{Error: true} + c := &simple.Client{Error: true} receivedPod, err := c.Setup(t).Services(ns).Get("") - if (err != nil) && (err.Error() != nameRequiredError) { - t.Errorf("Expected error: %v, but got %v", nameRequiredError, err) + defer c.Close() + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) } c.Validate(t, receivedPod, err) @@ -122,50 +131,112 @@ func TestGetServiceWithNoName(t *testing.T) { func TestCreateService(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "POST", Path: testapi.Default.ResourcePath("services", ns, ""), Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}, - Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}}, + Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}}, } response, err := c.Setup(t).Services(ns).Create(&api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}) + defer c.Close() c.Validate(t, response, err) } func TestUpdateService(t *testing.T) { ns := api.NamespaceDefault svc := &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1", ResourceVersion: "1"}} - c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath("services", ns, "service-1"), Body: svc, Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200, Body: svc}, + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath("services", ns, "service-1"), Body: svc, Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200, Body: svc}, } response, err := c.Setup(t).Services(ns).Update(svc) + defer c.Close() c.Validate(t, response, err) } func TestDeleteService(t *testing.T) { ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath("services", ns, "1"), Query: buildQueryValues(nil)}, - Response: Response{StatusCode: 200}, + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath("services", ns, "1"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, } err := c.Setup(t).Services(ns).Delete("1") + defer c.Close() c.Validate(t, nil, err) } +func TestUpdateServiceStatus(t *testing.T) { + ns := api.NamespaceDefault + lbStatus := api.LoadBalancerStatus{ + Ingress: []api.LoadBalancerIngress{ + {IP: "127.0.0.1"}, + }, + } + requestService := &api.Service{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Namespace: ns, + ResourceVersion: "1", + }, + Status: api.ServiceStatus{ + LoadBalancer: lbStatus, + }, + } + c := &simple.Client{ + Request: simple.Request{ + Method: "PUT", + Path: testapi.Default.ResourcePath("services", ns, "foo") + "/status", + Query: simple.BuildQueryValues(nil), + }, + Response: simple.Response{ + StatusCode: 200, + Body: &api.Service{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Spec: api.ServiceSpec{}, + Status: api.ServiceStatus{ + LoadBalancer: lbStatus, + }, + }, + }, + } + receivedService, err := c.Setup(t).Services(ns).UpdateStatus(requestService) + defer c.Close() + c.Validate(t, receivedService, err) +} + func TestServiceProxyGet(t *testing.T) { body := "OK" ns := api.NamespaceDefault - c := &testClient{ - Request: testRequest{ + c := &simple.Client{ + Request: simple.Request{ Method: "GET", Path: testapi.Default.ResourcePathWithPrefix("proxy", "services", ns, "service-1") + "/foo", - Query: buildQueryValues(url.Values{"param-name": []string{"param-value"}}), + Query: simple.BuildQueryValues(url.Values{"param-name": []string{"param-value"}}), }, - Response: Response{StatusCode: 200, RawBody: &body}, + Response: simple.Response{StatusCode: 200, RawBody: &body}, } - response, err := c.Setup(t).Services(ns).ProxyGet("service-1", "foo", map[string]string{"param-name": "param-value"}).DoRaw() + response, err := c.Setup(t).Services(ns).ProxyGet("", "service-1", "", "foo", map[string]string{"param-name": "param-value"}).DoRaw() + defer c.Close() + c.ValidateRaw(t, response, err) + + // With scheme and port specified + c = &simple.Client{ + Request: simple.Request{ + Method: "GET", + Path: testapi.Default.ResourcePathWithPrefix("proxy", "services", ns, "https:service-1:my-port") + "/foo", + Query: simple.BuildQueryValues(url.Values{"param-name": []string{"param-value"}}), + }, + Response: simple.Response{StatusCode: 200, RawBody: &body}, + } + response, err = c.Setup(t).Services(ns).ProxyGet("https", "service-1", "my-port", "foo", map[string]string{"param-name": "param-value"}).DoRaw() + defer c.Close() c.ValidateRaw(t, response, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/actions.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/actions.go index 04132dc25..1e5a5e470 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/actions.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/actions.go @@ -19,6 +19,7 @@ package testclient import ( "strings" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" @@ -43,21 +44,37 @@ func NewGetAction(resource, namespace, name string) GetActionImpl { return action } -func NewRootListAction(resource string, label labels.Selector, field fields.Selector) ListActionImpl { +func NewRootListAction(resource string, opts api.ListOptions) ListActionImpl { action := ListActionImpl{} action.Verb = "list" action.Resource = resource - action.ListRestrictions = ListRestrictions{label, field} + labelSelector := opts.LabelSelector + if labelSelector == nil { + labelSelector = labels.Everything() + } + fieldSelector := opts.FieldSelector + if fieldSelector == nil { + fieldSelector = fields.Everything() + } + action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector} return action } -func NewListAction(resource, namespace string, label labels.Selector, field fields.Selector) ListActionImpl { +func NewListAction(resource, namespace string, opts api.ListOptions) ListActionImpl { action := ListActionImpl{} action.Verb = "list" action.Resource = resource action.Namespace = namespace - action.ListRestrictions = ListRestrictions{label, field} + labelSelector := opts.LabelSelector + if labelSelector == nil { + labelSelector = labels.Everything() + } + fieldSelector := opts.FieldSelector + if fieldSelector == nil { + fieldSelector = fields.Everything() + } + action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector} return action } @@ -149,31 +166,84 @@ func NewDeleteAction(resource, namespace, name string) DeleteActionImpl { return action } -func NewRootWatchAction(resource string, label labels.Selector, field fields.Selector, resourceVersion string) WatchActionImpl { - action := WatchActionImpl{} - action.Verb = "watch" +func NewRootDeleteCollectionAction(resource string, opts api.ListOptions) DeleteCollectionActionImpl { + action := DeleteCollectionActionImpl{} + action.Verb = "delete-collection" action.Resource = resource - action.WatchRestrictions = WatchRestrictions{label, field, resourceVersion} + labelSelector := opts.LabelSelector + if labelSelector == nil { + labelSelector = labels.Everything() + } + fieldSelector := opts.FieldSelector + if fieldSelector == nil { + fieldSelector = fields.Everything() + } + action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector} return action } -func NewWatchAction(resource, namespace string, label labels.Selector, field fields.Selector, resourceVersion string) WatchActionImpl { +func NewDeleteCollectionAction(resource, namespace string, opts api.ListOptions) DeleteCollectionActionImpl { + action := DeleteCollectionActionImpl{} + action.Verb = "delete-collection" + action.Resource = resource + action.Namespace = namespace + labelSelector := opts.LabelSelector + if labelSelector == nil { + labelSelector = labels.Everything() + } + fieldSelector := opts.FieldSelector + if fieldSelector == nil { + fieldSelector = fields.Everything() + } + action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector} + + return action +} + +func NewRootWatchAction(resource string, opts api.ListOptions) WatchActionImpl { + action := WatchActionImpl{} + action.Verb = "watch" + action.Resource = resource + labelSelector := opts.LabelSelector + if labelSelector == nil { + labelSelector = labels.Everything() + } + fieldSelector := opts.FieldSelector + if fieldSelector == nil { + fieldSelector = fields.Everything() + } + action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, opts.ResourceVersion} + + return action +} + +func NewWatchAction(resource, namespace string, opts api.ListOptions) WatchActionImpl { action := WatchActionImpl{} action.Verb = "watch" action.Resource = resource action.Namespace = namespace - action.WatchRestrictions = WatchRestrictions{label, field, resourceVersion} + labelSelector := opts.LabelSelector + if labelSelector == nil { + labelSelector = labels.Everything() + } + fieldSelector := opts.FieldSelector + if fieldSelector == nil { + fieldSelector = fields.Everything() + } + action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, opts.ResourceVersion} return action } -func NewProxyGetAction(resource, namespace, name, path string, params map[string]string) ProxyGetActionImpl { +func NewProxyGetAction(resource, namespace, scheme, name, port, path string, params map[string]string) ProxyGetActionImpl { action := ProxyGetActionImpl{} action.Verb = "get" action.Resource = resource action.Namespace = namespace + action.Scheme = scheme action.Name = name + action.Port = port action.Path = path action.Params = params return action @@ -234,7 +304,9 @@ type WatchAction interface { type ProxyGetAction interface { Action + GetScheme() string GetName() string + GetPort() string GetPath() string GetParams() map[string]string } @@ -326,6 +398,15 @@ func (a DeleteActionImpl) GetName() string { return a.Name } +type DeleteCollectionActionImpl struct { + ActionImpl + ListRestrictions ListRestrictions +} + +func (a DeleteCollectionActionImpl) GetListRestrictions() ListRestrictions { + return a.ListRestrictions +} + type WatchActionImpl struct { ActionImpl WatchRestrictions WatchRestrictions @@ -337,15 +418,25 @@ func (a WatchActionImpl) GetWatchRestrictions() WatchRestrictions { type ProxyGetActionImpl struct { ActionImpl + Scheme string Name string + Port string Path string Params map[string]string } +func (a ProxyGetActionImpl) GetScheme() string { + return a.Scheme +} + func (a ProxyGetActionImpl) GetName() string { return a.Name } +func (a ProxyGetActionImpl) GetPort() string { + return a.Port +} + func (a ProxyGetActionImpl) GetPath() string { return a.Path } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_componentstatuses.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_componentstatuses.go index d259948ab..34bf210d4 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_componentstatuses.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_componentstatuses.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" ) // Fake implements ComponentStatusInterface. @@ -36,8 +34,8 @@ func (c *FakeComponentStatuses) Get(name string) (*api.ComponentStatus, error) { return obj.(*api.ComponentStatus), err } -func (c *FakeComponentStatuses) List(label labels.Selector, field fields.Selector) (result *api.ComponentStatusList, err error) { - obj, err := c.Fake.Invokes(NewRootListAction("componentstatuses", label, field), &api.ComponentStatusList{}) +func (c *FakeComponentStatuses) List(opts api.ListOptions) (result *api.ComponentStatusList, err error) { + obj, err := c.Fake.Invokes(NewRootListAction("componentstatuses", opts), &api.ComponentStatusList{}) if obj == nil { return nil, err } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_configmaps.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_configmaps.go new file mode 100644 index 000000000..17a5bfeb8 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_configmaps.go @@ -0,0 +1,78 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testclient + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/watch" +) + +const ( + configMapResourceName string = "configMaps" +) + +// FakeConfigMaps implements ConfigMapInterface. Meant to be embedded into a struct to get a default +// implementation. This makes faking out just the method you want to test easier. +type FakeConfigMaps struct { + Fake *Fake + Namespace string +} + +func (c *FakeConfigMaps) Get(name string) (*api.ConfigMap, error) { + obj, err := c.Fake.Invokes(NewGetAction(configMapResourceName, c.Namespace, name), &api.ConfigMap{}) + if obj == nil { + return nil, err + } + + return obj.(*api.ConfigMap), err +} + +func (c *FakeConfigMaps) List(opts api.ListOptions) (*api.ConfigMapList, error) { + obj, err := c.Fake.Invokes(NewListAction(configMapResourceName, c.Namespace, opts), &api.ConfigMapList{}) + if obj == nil { + return nil, err + } + + return obj.(*api.ConfigMapList), err +} + +func (c *FakeConfigMaps) Create(cfg *api.ConfigMap) (*api.ConfigMap, error) { + obj, err := c.Fake.Invokes(NewCreateAction(configMapResourceName, c.Namespace, cfg), cfg) + if obj == nil { + return nil, err + } + + return obj.(*api.ConfigMap), err +} + +func (c *FakeConfigMaps) Update(cfg *api.ConfigMap) (*api.ConfigMap, error) { + obj, err := c.Fake.Invokes(NewUpdateAction(configMapResourceName, c.Namespace, cfg), cfg) + if obj == nil { + return nil, err + } + + return obj.(*api.ConfigMap), err +} + +func (c *FakeConfigMaps) Delete(name string) error { + _, err := c.Fake.Invokes(NewDeleteAction(configMapResourceName, c.Namespace, name), &api.ConfigMap{}) + return err +} + +func (c *FakeConfigMaps) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction(configMapResourceName, c.Namespace, opts)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_daemon_sets.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_daemon_sets.go index b0a4c61ca..d0e1e73e1 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_daemon_sets.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_daemon_sets.go @@ -17,10 +17,9 @@ limitations under the License. package testclient import ( + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions" kclientlib "k8s.io/kubernetes/pkg/client/unversioned" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -42,8 +41,8 @@ func (c *FakeDaemonSets) Get(name string) (*extensions.DaemonSet, error) { return obj.(*extensions.DaemonSet), err } -func (c *FakeDaemonSets) List(label labels.Selector, field fields.Selector) (*extensions.DaemonSetList, error) { - obj, err := c.Fake.Invokes(NewListAction("daemonsets", c.Namespace, label, field), &extensions.DaemonSetList{}) +func (c *FakeDaemonSets) List(opts api.ListOptions) (*extensions.DaemonSetList, error) { + obj, err := c.Fake.Invokes(NewListAction("daemonsets", c.Namespace, opts), &extensions.DaemonSetList{}) if obj == nil { return nil, err } @@ -79,6 +78,6 @@ func (c *FakeDaemonSets) Delete(name string) error { return err } -func (c *FakeDaemonSets) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("daemonsets", c.Namespace, label, field, resourceVersion)) +func (c *FakeDaemonSets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("daemonsets", c.Namespace, opts)) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_deployments.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_deployments.go index 6febc1298..f53f27198 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_deployments.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_deployments.go @@ -19,7 +19,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -40,11 +39,15 @@ func (c *FakeDeployments) Get(name string) (*extensions.Deployment, error) { return obj.(*extensions.Deployment), err } -func (c *FakeDeployments) List(label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error) { - obj, err := c.Fake.Invokes(NewListAction("deployments", c.Namespace, label, field), &extensions.DeploymentList{}) +func (c *FakeDeployments) List(opts api.ListOptions) (*extensions.DeploymentList, error) { + obj, err := c.Fake.Invokes(NewListAction("deployments", c.Namespace, opts), &extensions.DeploymentList{}) if obj == nil { return nil, err } + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } list := &extensions.DeploymentList{} for _, deployment := range obj.(*extensions.DeploymentList).Items { if label.Matches(labels.Set(deployment.Labels)) { @@ -72,11 +75,31 @@ func (c *FakeDeployments) Update(deployment *extensions.Deployment) (*extensions return obj.(*extensions.Deployment), err } +func (c *FakeDeployments) UpdateStatus(deployment *extensions.Deployment) (*extensions.Deployment, error) { + obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("deployments", "status", c.Namespace, deployment), deployment) + if obj == nil { + return nil, err + } + + return obj.(*extensions.Deployment), err +} + func (c *FakeDeployments) Delete(name string, options *api.DeleteOptions) error { _, err := c.Fake.Invokes(NewDeleteAction("deployments", c.Namespace, name), &extensions.Deployment{}) return err } -func (c *FakeDeployments) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("deployments", c.Namespace, label, field, resourceVersion)) +func (c *FakeDeployments) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("deployments", c.Namespace, opts)) +} + +func (c *FakeDeployments) Rollback(deploymentRollback *extensions.DeploymentRollback) error { + action := CreateActionImpl{} + action.Verb = "create" + action.Resource = "deployments" + action.Subresource = "rollback" + action.Object = deploymentRollback + + _, err := c.Fake.Invokes(action, deploymentRollback) + return err } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_endpoints.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_endpoints.go index 1ba9b5d42..68f6178f7 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_endpoints.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_endpoints.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -39,8 +37,8 @@ func (c *FakeEndpoints) Get(name string) (*api.Endpoints, error) { return obj.(*api.Endpoints), err } -func (c *FakeEndpoints) List(label labels.Selector) (*api.EndpointsList, error) { - obj, err := c.Fake.Invokes(NewListAction("endpoints", c.Namespace, label, nil), &api.EndpointsList{}) +func (c *FakeEndpoints) List(opts api.ListOptions) (*api.EndpointsList, error) { + obj, err := c.Fake.Invokes(NewListAction("endpoints", c.Namespace, opts), &api.EndpointsList{}) if obj == nil { return nil, err } @@ -71,6 +69,6 @@ func (c *FakeEndpoints) Delete(name string) error { return err } -func (c *FakeEndpoints) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("endpoints", c.Namespace, label, field, resourceVersion)) +func (c *FakeEndpoints) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("endpoints", c.Namespace, opts)) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_events.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_events.go index f8186e9a8..3da2143fc 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_events.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_events.go @@ -19,7 +19,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/watch" ) @@ -46,10 +45,10 @@ func (c *FakeEvents) Get(name string) (*api.Event, error) { } // List returns a list of events matching the selectors. -func (c *FakeEvents) List(label labels.Selector, field fields.Selector) (*api.EventList, error) { - action := NewRootListAction("events", label, field) +func (c *FakeEvents) List(opts api.ListOptions) (*api.EventList, error) { + action := NewRootListAction("events", opts) if c.Namespace != "" { - action = NewListAction("events", c.Namespace, label, field) + action = NewListAction("events", c.Namespace, opts) } obj, err := c.Fake.Invokes(action, &api.EventList{}) if obj == nil { @@ -110,20 +109,29 @@ func (c *FakeEvents) Delete(name string) error { return err } -// Watch starts watching for events matching the given selectors. -func (c *FakeEvents) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - action := NewRootWatchAction("events", label, field, resourceVersion) +func (c *FakeEvents) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { + action := NewRootDeleteCollectionAction("events", listOptions) if c.Namespace != "" { - action = NewWatchAction("events", c.Namespace, label, field, resourceVersion) + action = NewDeleteCollectionAction("events", c.Namespace, listOptions) + } + _, err := c.Fake.Invokes(action, &api.EventList{}) + return err +} + +// Watch starts watching for events matching the given selectors. +func (c *FakeEvents) Watch(opts api.ListOptions) (watch.Interface, error) { + action := NewRootWatchAction("events", opts) + if c.Namespace != "" { + action = NewWatchAction("events", c.Namespace, opts) } return c.Fake.InvokesWatch(action) } // Search returns a list of events matching the specified object. func (c *FakeEvents) Search(objOrRef runtime.Object) (*api.EventList, error) { - action := NewRootListAction("events", nil, nil) + action := NewRootListAction("events", api.ListOptions{}) if c.Namespace != "" { - action = NewListAction("events", c.Namespace, nil, nil) + action = NewListAction("events", c.Namespace, api.ListOptions{}) } obj, err := c.Fake.Invokes(action, &api.EventList{}) if obj == nil { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_horizontal_pod_autoscalers.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_horizontal_pod_autoscalers.go index bc901f9d4..a70a1af99 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_horizontal_pod_autoscalers.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_horizontal_pod_autoscalers.go @@ -19,7 +19,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -40,11 +39,15 @@ func (c *FakeHorizontalPodAutoscalers) Get(name string) (*extensions.HorizontalP return obj.(*extensions.HorizontalPodAutoscaler), err } -func (c *FakeHorizontalPodAutoscalers) List(label labels.Selector, field fields.Selector) (*extensions.HorizontalPodAutoscalerList, error) { - obj, err := c.Fake.Invokes(NewListAction("horizontalpodautoscalers", c.Namespace, label, field), &extensions.HorizontalPodAutoscalerList{}) +func (c *FakeHorizontalPodAutoscalers) List(opts api.ListOptions) (*extensions.HorizontalPodAutoscalerList, error) { + obj, err := c.Fake.Invokes(NewListAction("horizontalpodautoscalers", c.Namespace, opts), &extensions.HorizontalPodAutoscalerList{}) if obj == nil { return nil, err } + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } list := &extensions.HorizontalPodAutoscalerList{} for _, a := range obj.(*extensions.HorizontalPodAutoscalerList).Items { if label.Matches(labels.Set(a.Labels)) { @@ -85,6 +88,6 @@ func (c *FakeHorizontalPodAutoscalers) Delete(name string, options *api.DeleteOp return err } -func (c *FakeHorizontalPodAutoscalers) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("horizontalpodautoscalers", c.Namespace, label, field, resourceVersion)) +func (c *FakeHorizontalPodAutoscalers) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("horizontalpodautoscalers", c.Namespace, opts)) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_ingress.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_ingress.go index 30be16ffb..b15458997 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_ingress.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_ingress.go @@ -19,8 +19,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -32,7 +30,7 @@ type FakeIngress struct { } func (c *FakeIngress) Get(name string) (*extensions.Ingress, error) { - obj, err := c.Fake.Invokes(NewGetAction("ingress", c.Namespace, name), &extensions.Ingress{}) + obj, err := c.Fake.Invokes(NewGetAction("ingresses", c.Namespace, name), &extensions.Ingress{}) if obj == nil { return nil, err } @@ -40,8 +38,8 @@ func (c *FakeIngress) Get(name string) (*extensions.Ingress, error) { return obj.(*extensions.Ingress), err } -func (c *FakeIngress) List(label labels.Selector, fields fields.Selector) (*extensions.IngressList, error) { - obj, err := c.Fake.Invokes(NewListAction("ingress", c.Namespace, label, nil), &extensions.IngressList{}) +func (c *FakeIngress) List(opts api.ListOptions) (*extensions.IngressList, error) { + obj, err := c.Fake.Invokes(NewListAction("ingresses", c.Namespace, opts), &extensions.IngressList{}) if obj == nil { return nil, err } @@ -50,7 +48,7 @@ func (c *FakeIngress) List(label labels.Selector, fields fields.Selector) (*exte } func (c *FakeIngress) Create(ingress *extensions.Ingress) (*extensions.Ingress, error) { - obj, err := c.Fake.Invokes(NewCreateAction("ingress", c.Namespace, ingress), ingress) + obj, err := c.Fake.Invokes(NewCreateAction("ingresses", c.Namespace, ingress), ingress) if obj == nil { return nil, err } @@ -59,7 +57,7 @@ func (c *FakeIngress) Create(ingress *extensions.Ingress) (*extensions.Ingress, } func (c *FakeIngress) Update(ingress *extensions.Ingress) (*extensions.Ingress, error) { - obj, err := c.Fake.Invokes(NewUpdateAction("ingress", c.Namespace, ingress), ingress) + obj, err := c.Fake.Invokes(NewUpdateAction("ingresses", c.Namespace, ingress), ingress) if obj == nil { return nil, err } @@ -68,16 +66,16 @@ func (c *FakeIngress) Update(ingress *extensions.Ingress) (*extensions.Ingress, } func (c *FakeIngress) Delete(name string, options *api.DeleteOptions) error { - _, err := c.Fake.Invokes(NewDeleteAction("ingress", c.Namespace, name), &extensions.Ingress{}) + _, err := c.Fake.Invokes(NewDeleteAction("ingresses", c.Namespace, name), &extensions.Ingress{}) return err } -func (c *FakeIngress) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("ingress", c.Namespace, label, field, resourceVersion)) +func (c *FakeIngress) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("ingresses", c.Namespace, opts)) } func (c *FakeIngress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) { - obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("ingress", "status", c.Namespace, ingress), ingress) + obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("ingresses", "status", c.Namespace, ingress), ingress) if obj == nil { return nil, err } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_jobs.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_jobs.go index 6bd1e7180..d6fb79fa1 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_jobs.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_jobs.go @@ -19,8 +19,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -40,8 +38,8 @@ func (c *FakeJobs) Get(name string) (*extensions.Job, error) { return obj.(*extensions.Job), err } -func (c *FakeJobs) List(label labels.Selector, fields fields.Selector) (*extensions.JobList, error) { - obj, err := c.Fake.Invokes(NewListAction("jobs", c.Namespace, label, nil), &extensions.JobList{}) +func (c *FakeJobs) List(opts api.ListOptions) (*extensions.JobList, error) { + obj, err := c.Fake.Invokes(NewListAction("jobs", c.Namespace, opts), &extensions.JobList{}) if obj == nil { return nil, err } @@ -72,8 +70,8 @@ func (c *FakeJobs) Delete(name string, options *api.DeleteOptions) error { return err } -func (c *FakeJobs) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("jobs", c.Namespace, label, field, resourceVersion)) +func (c *FakeJobs) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("jobs", c.Namespace, opts)) } func (c *FakeJobs) UpdateStatus(job *extensions.Job) (result *extensions.Job, err error) { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_limit_ranges.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_limit_ranges.go index 473f3d19d..3669f5ff8 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_limit_ranges.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_limit_ranges.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -39,8 +37,8 @@ func (c *FakeLimitRanges) Get(name string) (*api.LimitRange, error) { return obj.(*api.LimitRange), err } -func (c *FakeLimitRanges) List(label labels.Selector, field fields.Selector) (*api.LimitRangeList, error) { - obj, err := c.Fake.Invokes(NewListAction("limitranges", c.Namespace, label, field), &api.LimitRangeList{}) +func (c *FakeLimitRanges) List(opts api.ListOptions) (*api.LimitRangeList, error) { + obj, err := c.Fake.Invokes(NewListAction("limitranges", c.Namespace, opts), &api.LimitRangeList{}) if obj == nil { return nil, err } @@ -71,6 +69,6 @@ func (c *FakeLimitRanges) Delete(name string) error { return err } -func (c *FakeLimitRanges) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("limitranges", c.Namespace, label, field, resourceVersion)) +func (c *FakeLimitRanges) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("limitranges", c.Namespace, opts)) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_namespaces.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_namespaces.go index 638ee7a92..8c4ac1ac2 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_namespaces.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_namespaces.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -38,8 +36,8 @@ func (c *FakeNamespaces) Get(name string) (*api.Namespace, error) { return obj.(*api.Namespace), err } -func (c *FakeNamespaces) List(label labels.Selector, field fields.Selector) (*api.NamespaceList, error) { - obj, err := c.Fake.Invokes(NewRootListAction("namespaces", label, field), &api.NamespaceList{}) +func (c *FakeNamespaces) List(opts api.ListOptions) (*api.NamespaceList, error) { + obj, err := c.Fake.Invokes(NewRootListAction("namespaces", opts), &api.NamespaceList{}) if obj == nil { return nil, err } @@ -70,8 +68,8 @@ func (c *FakeNamespaces) Delete(name string) error { return err } -func (c *FakeNamespaces) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewRootWatchAction("namespaces", label, field, resourceVersion)) +func (c *FakeNamespaces) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewRootWatchAction("namespaces", opts)) } func (c *FakeNamespaces) Finalize(namespace *api.Namespace) (*api.Namespace, error) { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_nodes.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_nodes.go index ff70ce376..b1943366e 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_nodes.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_nodes.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -38,8 +36,8 @@ func (c *FakeNodes) Get(name string) (*api.Node, error) { return obj.(*api.Node), err } -func (c *FakeNodes) List(label labels.Selector, field fields.Selector) (*api.NodeList, error) { - obj, err := c.Fake.Invokes(NewRootListAction("nodes", label, field), &api.NodeList{}) +func (c *FakeNodes) List(opts api.ListOptions) (*api.NodeList, error) { + obj, err := c.Fake.Invokes(NewRootListAction("nodes", opts), &api.NodeList{}) if obj == nil { return nil, err } @@ -70,8 +68,8 @@ func (c *FakeNodes) Delete(name string) error { return err } -func (c *FakeNodes) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewRootWatchAction("nodes", label, field, resourceVersion)) +func (c *FakeNodes) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewRootWatchAction("nodes", opts)) } func (c *FakeNodes) UpdateStatus(node *api.Node) (*api.Node, error) { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_persistent_volume_claims.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_persistent_volume_claims.go index d5752a133..cadfb084c 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_persistent_volume_claims.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_persistent_volume_claims.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -37,8 +35,8 @@ func (c *FakePersistentVolumeClaims) Get(name string) (*api.PersistentVolumeClai return obj.(*api.PersistentVolumeClaim), err } -func (c *FakePersistentVolumeClaims) List(label labels.Selector, field fields.Selector) (*api.PersistentVolumeClaimList, error) { - obj, err := c.Fake.Invokes(NewListAction("persistentvolumeclaims", c.Namespace, label, field), &api.PersistentVolumeClaimList{}) +func (c *FakePersistentVolumeClaims) List(opts api.ListOptions) (*api.PersistentVolumeClaimList, error) { + obj, err := c.Fake.Invokes(NewListAction("persistentvolumeclaims", c.Namespace, opts), &api.PersistentVolumeClaimList{}) if obj == nil { return nil, err } @@ -69,8 +67,8 @@ func (c *FakePersistentVolumeClaims) Delete(name string) error { return err } -func (c *FakePersistentVolumeClaims) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("persistentvolumeclaims", c.Namespace, label, field, resourceVersion)) +func (c *FakePersistentVolumeClaims) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("persistentvolumeclaims", c.Namespace, opts)) } func (c *FakePersistentVolumeClaims) UpdateStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_persistent_volumes.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_persistent_volumes.go index d26ead23a..cb184bc44 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_persistent_volumes.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_persistent_volumes.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -36,8 +34,8 @@ func (c *FakePersistentVolumes) Get(name string) (*api.PersistentVolume, error) return obj.(*api.PersistentVolume), err } -func (c *FakePersistentVolumes) List(label labels.Selector, field fields.Selector) (*api.PersistentVolumeList, error) { - obj, err := c.Fake.Invokes(NewRootListAction("persistentvolumes", label, field), &api.PersistentVolumeList{}) +func (c *FakePersistentVolumes) List(opts api.ListOptions) (*api.PersistentVolumeList, error) { + obj, err := c.Fake.Invokes(NewRootListAction("persistentvolumes", opts), &api.PersistentVolumeList{}) if obj == nil { return nil, err } @@ -68,8 +66,8 @@ func (c *FakePersistentVolumes) Delete(name string) error { return err } -func (c *FakePersistentVolumes) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewRootWatchAction("persistentvolumes", label, field, resourceVersion)) +func (c *FakePersistentVolumes) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewRootWatchAction("persistentvolumes", opts)) } func (c *FakePersistentVolumes) UpdateStatus(pv *api.PersistentVolume) (*api.PersistentVolume, error) { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_pod_templates.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_pod_templates.go index 74cb68261..47ff3d8ac 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_pod_templates.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_pod_templates.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -39,8 +37,8 @@ func (c *FakePodTemplates) Get(name string) (*api.PodTemplate, error) { return obj.(*api.PodTemplate), err } -func (c *FakePodTemplates) List(label labels.Selector, field fields.Selector) (*api.PodTemplateList, error) { - obj, err := c.Fake.Invokes(NewListAction("podtemplates", c.Namespace, label, field), &api.PodTemplateList{}) +func (c *FakePodTemplates) List(opts api.ListOptions) (*api.PodTemplateList, error) { + obj, err := c.Fake.Invokes(NewListAction("podtemplates", c.Namespace, opts), &api.PodTemplateList{}) if obj == nil { return nil, err } @@ -71,6 +69,6 @@ func (c *FakePodTemplates) Delete(name string, options *api.DeleteOptions) error return err } -func (c *FakePodTemplates) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("podtemplates", c.Namespace, label, field, resourceVersion)) +func (c *FakePodTemplates) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("podtemplates", c.Namespace, opts)) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_pods.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_pods.go index 05cda9f84..824356aac 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_pods.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_pods.go @@ -18,7 +18,7 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" + client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -39,11 +39,15 @@ func (c *FakePods) Get(name string) (*api.Pod, error) { return obj.(*api.Pod), err } -func (c *FakePods) List(label labels.Selector, field fields.Selector) (*api.PodList, error) { - obj, err := c.Fake.Invokes(NewListAction("pods", c.Namespace, label, field), &api.PodList{}) +func (c *FakePods) List(opts api.ListOptions) (*api.PodList, error) { + obj, err := c.Fake.Invokes(NewListAction("pods", c.Namespace, opts), &api.PodList{}) if obj == nil { return nil, err } + label := opts.LabelSelector + if label == nil { + label = labels.Everything() + } list := &api.PodList{} for _, pod := range obj.(*api.PodList).Items { if label.Matches(labels.Set(pod.Labels)) { @@ -76,8 +80,8 @@ func (c *FakePods) Delete(name string, options *api.DeleteOptions) error { return err } -func (c *FakePods) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("pods", c.Namespace, label, field, resourceVersion)) +func (c *FakePods) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("pods", c.Namespace, opts)) } func (c *FakePods) Bind(binding *api.Binding) error { @@ -99,3 +103,15 @@ func (c *FakePods) UpdateStatus(pod *api.Pod) (*api.Pod, error) { return obj.(*api.Pod), err } + +func (c *FakePods) GetLogs(name string, opts *api.PodLogOptions) *client.Request { + action := GenericActionImpl{} + action.Verb = "get" + action.Namespace = c.Namespace + action.Resource = "pod" + action.Subresource = "logs" + action.Value = opts + + _, _ = c.Fake.Invokes(action, &api.Pod{}) + return &client.Request{} +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_podsecuritypolicy.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_podsecuritypolicy.go new file mode 100644 index 000000000..bb611d322 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_podsecuritypolicy.go @@ -0,0 +1,73 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testclient + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/watch" +) + +// FakePodSecurityPolicy implements PodSecurityPolicyInterface. Meant to be +// embedded into a struct to get a default implementation. This makes faking out just +// the method you want to test easier. +type FakePodSecurityPolicy struct { + Fake *Fake + Namespace string +} + +func (c *FakePodSecurityPolicy) List(opts api.ListOptions) (*extensions.PodSecurityPolicyList, error) { + obj, err := c.Fake.Invokes(NewListAction("podsecuritypolicies", c.Namespace, opts), &extensions.PodSecurityPolicyList{}) + if obj == nil { + return nil, err + } + + return obj.(*extensions.PodSecurityPolicyList), err +} + +func (c *FakePodSecurityPolicy) Get(name string) (*extensions.PodSecurityPolicy, error) { + obj, err := c.Fake.Invokes(NewGetAction("podsecuritypolicies", c.Namespace, name), &extensions.PodSecurityPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*extensions.PodSecurityPolicy), err +} + +func (c *FakePodSecurityPolicy) Create(scc *extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) { + obj, err := c.Fake.Invokes(NewCreateAction("podsecuritypolicies", c.Namespace, scc), &extensions.PodSecurityPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*extensions.PodSecurityPolicy), err +} + +func (c *FakePodSecurityPolicy) Update(scc *extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) { + obj, err := c.Fake.Invokes(NewUpdateAction("podsecuritypolicies", c.Namespace, scc), &extensions.PodSecurityPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*extensions.PodSecurityPolicy), err +} + +func (c *FakePodSecurityPolicy) Delete(name string) error { + _, err := c.Fake.Invokes(NewDeleteAction("podsecuritypolicies", c.Namespace, name), &extensions.PodSecurityPolicy{}) + return err +} + +func (c *FakePodSecurityPolicy) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("podsecuritypolicies", c.Namespace, opts)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_replica_sets.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_replica_sets.go new file mode 100644 index 000000000..29c985c8c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_replica_sets.go @@ -0,0 +1,83 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testclient + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/watch" +) + +// FakeReplicaSets implements ReplicaSetsInterface. Meant to be embedded into a struct to get a default +// implementation. This makes faking out just the method you want to test easier. +type FakeReplicaSets struct { + Fake *FakeExperimental + Namespace string +} + +func (c *FakeReplicaSets) Get(name string) (*extensions.ReplicaSet, error) { + obj, err := c.Fake.Invokes(NewGetAction("replicasets", c.Namespace, name), &extensions.ReplicaSet{}) + if obj == nil { + return nil, err + } + + return obj.(*extensions.ReplicaSet), err +} + +func (c *FakeReplicaSets) List(opts api.ListOptions) (*extensions.ReplicaSetList, error) { + obj, err := c.Fake.Invokes(NewListAction("replicasets", c.Namespace, opts), &extensions.ReplicaSetList{}) + if obj == nil { + return nil, err + } + return obj.(*extensions.ReplicaSetList), err +} + +func (c *FakeReplicaSets) Create(rs *extensions.ReplicaSet) (*extensions.ReplicaSet, error) { + obj, err := c.Fake.Invokes(NewCreateAction("replicasets", c.Namespace, rs), rs) + if obj == nil { + return nil, err + } + + return obj.(*extensions.ReplicaSet), err +} + +func (c *FakeReplicaSets) Update(rs *extensions.ReplicaSet) (*extensions.ReplicaSet, error) { + obj, err := c.Fake.Invokes(NewUpdateAction("replicasets", c.Namespace, rs), rs) + if obj == nil { + return nil, err + } + + return obj.(*extensions.ReplicaSet), err +} + +func (c *FakeReplicaSets) Delete(name string, options *api.DeleteOptions) error { + _, err := c.Fake.Invokes(NewDeleteAction("replicasets", c.Namespace, name), &extensions.ReplicaSet{}) + return err +} + +func (c *FakeReplicaSets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("replicasets", c.Namespace, opts)) +} + +func (c *FakeReplicaSets) UpdateStatus(rs *extensions.ReplicaSet) (result *extensions.ReplicaSet, err error) { + obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("replicasets", "status", c.Namespace, rs), rs) + if obj == nil { + return nil, err + } + + return obj.(*extensions.ReplicaSet), err +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_replication_controllers.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_replication_controllers.go index c9eeddd88..e44b82615 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_replication_controllers.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_replication_controllers.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -39,8 +37,8 @@ func (c *FakeReplicationControllers) Get(name string) (*api.ReplicationControlle return obj.(*api.ReplicationController), err } -func (c *FakeReplicationControllers) List(label labels.Selector, field fields.Selector) (*api.ReplicationControllerList, error) { - obj, err := c.Fake.Invokes(NewListAction("replicationcontrollers", c.Namespace, label, field), &api.ReplicationControllerList{}) +func (c *FakeReplicationControllers) List(opts api.ListOptions) (*api.ReplicationControllerList, error) { + obj, err := c.Fake.Invokes(NewListAction("replicationcontrollers", c.Namespace, opts), &api.ReplicationControllerList{}) if obj == nil { return nil, err } @@ -79,6 +77,6 @@ func (c *FakeReplicationControllers) Delete(name string) error { return err } -func (c *FakeReplicationControllers) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("replicationcontrollers", c.Namespace, label, field, resourceVersion)) +func (c *FakeReplicationControllers) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("replicationcontrollers", c.Namespace, opts)) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_resource_quotas.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_resource_quotas.go index 9dd2bd4f4..d5090f0d0 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_resource_quotas.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_resource_quotas.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -39,8 +37,8 @@ func (c *FakeResourceQuotas) Get(name string) (*api.ResourceQuota, error) { return obj.(*api.ResourceQuota), err } -func (c *FakeResourceQuotas) List(label labels.Selector, field fields.Selector) (*api.ResourceQuotaList, error) { - obj, err := c.Fake.Invokes(NewListAction("resourcequotas", c.Namespace, label, field), &api.ResourceQuotaList{}) +func (c *FakeResourceQuotas) List(opts api.ListOptions) (*api.ResourceQuotaList, error) { + obj, err := c.Fake.Invokes(NewListAction("resourcequotas", c.Namespace, opts), &api.ResourceQuotaList{}) if obj == nil { return nil, err } @@ -71,8 +69,8 @@ func (c *FakeResourceQuotas) Delete(name string) error { return err } -func (c *FakeResourceQuotas) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("resourcequotas", c.Namespace, label, field, resourceVersion)) +func (c *FakeResourceQuotas) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("resourcequotas", c.Namespace, opts)) } func (c *FakeResourceQuotas) UpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) { diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_secrets.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_secrets.go index 7db25bc40..f54cffb87 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_secrets.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_secrets.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -39,8 +37,8 @@ func (c *FakeSecrets) Get(name string) (*api.Secret, error) { return obj.(*api.Secret), err } -func (c *FakeSecrets) List(label labels.Selector, field fields.Selector) (*api.SecretList, error) { - obj, err := c.Fake.Invokes(NewListAction("secrets", c.Namespace, label, field), &api.SecretList{}) +func (c *FakeSecrets) List(opts api.ListOptions) (*api.SecretList, error) { + obj, err := c.Fake.Invokes(NewListAction("secrets", c.Namespace, opts), &api.SecretList{}) if obj == nil { return nil, err } @@ -71,6 +69,6 @@ func (c *FakeSecrets) Delete(name string) error { return err } -func (c *FakeSecrets) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("secrets", c.Namespace, label, field, resourceVersion)) +func (c *FakeSecrets) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("secrets", c.Namespace, opts)) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_service_accounts.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_service_accounts.go index 4dcd20d68..e40641668 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_service_accounts.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_service_accounts.go @@ -18,8 +18,6 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/watch" ) @@ -39,8 +37,8 @@ func (c *FakeServiceAccounts) Get(name string) (*api.ServiceAccount, error) { return obj.(*api.ServiceAccount), err } -func (c *FakeServiceAccounts) List(label labels.Selector, field fields.Selector) (*api.ServiceAccountList, error) { - obj, err := c.Fake.Invokes(NewListAction("serviceaccounts", c.Namespace, label, field), &api.ServiceAccountList{}) +func (c *FakeServiceAccounts) List(opts api.ListOptions) (*api.ServiceAccountList, error) { + obj, err := c.Fake.Invokes(NewListAction("serviceaccounts", c.Namespace, opts), &api.ServiceAccountList{}) if obj == nil { return nil, err } @@ -71,6 +69,6 @@ func (c *FakeServiceAccounts) Delete(name string) error { return err } -func (c *FakeServiceAccounts) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("serviceaccounts", c.Namespace, label, field, resourceVersion)) +func (c *FakeServiceAccounts) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("serviceaccounts", c.Namespace, opts)) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_services.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_services.go index caaadbb81..2f17c7578 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_services.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_services.go @@ -18,9 +18,7 @@ package testclient import ( "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/client/unversioned" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" + client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/watch" ) @@ -40,8 +38,8 @@ func (c *FakeServices) Get(name string) (*api.Service, error) { return obj.(*api.Service), err } -func (c *FakeServices) List(label labels.Selector, field fields.Selector) (*api.ServiceList, error) { - obj, err := c.Fake.Invokes(NewListAction("services", c.Namespace, label, field), &api.ServiceList{}) +func (c *FakeServices) List(opts api.ListOptions) (*api.ServiceList, error) { + obj, err := c.Fake.Invokes(NewListAction("services", c.Namespace, opts), &api.ServiceList{}) if obj == nil { return nil, err } @@ -67,15 +65,24 @@ func (c *FakeServices) Update(service *api.Service) (*api.Service, error) { return obj.(*api.Service), err } +func (c *FakeServices) UpdateStatus(service *api.Service) (result *api.Service, err error) { + obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("services", "status", c.Namespace, service), service) + if obj == nil { + return nil, err + } + + return obj.(*api.Service), err +} + func (c *FakeServices) Delete(name string) error { _, err := c.Fake.Invokes(NewDeleteAction("services", c.Namespace, name), &api.Service{}) return err } -func (c *FakeServices) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return c.Fake.InvokesWatch(NewWatchAction("services", c.Namespace, label, field, resourceVersion)) +func (c *FakeServices) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("services", c.Namespace, opts)) } -func (c *FakeServices) ProxyGet(name, path string, params map[string]string) unversioned.ResponseWrapper { - return c.Fake.InvokesProxy(NewProxyGetAction("services", c.Namespace, name, path, params)) +func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) client.ResponseWrapper { + return c.Fake.InvokesProxy(NewProxyGetAction("services", c.Namespace, scheme, name, port, path, params)) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_thirdpartyresources.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_thirdpartyresources.go new file mode 100644 index 000000000..8aa198d70 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fake_thirdpartyresources.go @@ -0,0 +1,83 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testclient + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apis/extensions" + kclientlib "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/watch" +) + +// FakeThirdPartyResources implements ThirdPartyResourceInterface. Meant to be embedded into a struct to get a default +// implementation. This makes faking out just the method you want to test easier. +type FakeThirdPartyResources struct { + Fake *FakeExperimental + Namespace string +} + +// Ensure statically that FakeThirdPartyResources implements DaemonInterface. +var _ kclientlib.ThirdPartyResourceInterface = &FakeThirdPartyResources{} + +func (c *FakeThirdPartyResources) Get(name string) (*extensions.ThirdPartyResource, error) { + obj, err := c.Fake.Invokes(NewGetAction("thirdpartyresources", c.Namespace, name), &extensions.ThirdPartyResource{}) + if obj == nil { + return nil, err + } + return obj.(*extensions.ThirdPartyResource), err +} + +func (c *FakeThirdPartyResources) List(opts api.ListOptions) (*extensions.ThirdPartyResourceList, error) { + obj, err := c.Fake.Invokes(NewListAction("thirdpartyresources", c.Namespace, opts), &extensions.ThirdPartyResourceList{}) + if obj == nil { + return nil, err + } + return obj.(*extensions.ThirdPartyResourceList), err +} + +func (c *FakeThirdPartyResources) Create(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) { + obj, err := c.Fake.Invokes(NewCreateAction("thirdpartyresources", c.Namespace, daemon), &extensions.ThirdPartyResource{}) + if obj == nil { + return nil, err + } + return obj.(*extensions.ThirdPartyResource), err +} + +func (c *FakeThirdPartyResources) Update(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) { + obj, err := c.Fake.Invokes(NewUpdateAction("thirdpartyresources", c.Namespace, daemon), &extensions.ThirdPartyResource{}) + if obj == nil { + return nil, err + } + return obj.(*extensions.ThirdPartyResource), err +} + +func (c *FakeThirdPartyResources) UpdateStatus(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) { + obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("thirdpartyresources", "status", c.Namespace, daemon), &extensions.ThirdPartyResource{}) + if obj == nil { + return nil, err + } + return obj.(*extensions.ThirdPartyResource), err +} + +func (c *FakeThirdPartyResources) Delete(name string) error { + _, err := c.Fake.Invokes(NewDeleteAction("thirdpartyresources", c.Namespace, name), &extensions.ThirdPartyResource{}) + return err +} + +func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(NewWatchAction("thirdpartyresources", c.Namespace, opts)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fixture.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fixture.go index fd515ec03..64388fb63 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fixture.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/fixture.go @@ -38,11 +38,18 @@ import ( type ObjectRetriever interface { // Kind should return a resource or a list of resources (depending on the provided kind and // name). It should return an error if the caller should communicate an error to the server. - Kind(kind, name string) (runtime.Object, error) + Kind(gvk unversioned.GroupVersionKind, name string) (runtime.Object, error) // Add adds a runtime object for test purposes into this object. Add(runtime.Object) error } +// ObjectScheme abstracts the implementation of common operations on objects. +type ObjectScheme interface { + runtime.ObjectCreater + runtime.ObjectCopier + runtime.ObjectTyper +} + // ObjectReaction returns a ReactionFunc that takes a generic action string of the form // - or -- and attempts to return a runtime // Object or error that matches the requested action. For instance, list-replicationControllers @@ -52,7 +59,7 @@ type ObjectRetriever interface { func ObjectReaction(o ObjectRetriever, mapper meta.RESTMapper) ReactionFunc { return func(action Action) (bool, runtime.Object, error) { - _, kind, err := mapper.VersionAndKindForResource(action.GetResource()) + kind, err := mapper.KindFor(unversioned.GroupVersionResource{Resource: action.GetResource()}) if err != nil { return false, nil, fmt.Errorf("unrecognized action %s: %v", action.GetResource(), err) } @@ -60,7 +67,8 @@ func ObjectReaction(o ObjectRetriever, mapper meta.RESTMapper) ReactionFunc { // TODO: have mapper return a Kind for a subresource? switch castAction := action.(type) { case ListAction: - resource, err := o.Kind(kind+"List", "") + kind.Kind += "List" + resource, err := o.Kind(kind, "") return true, resource, err case GetAction: @@ -106,7 +114,7 @@ func AddObjectsFromPath(path string, o ObjectRetriever, decoder runtime.Decoder) if err != nil { return err } - obj, err := decoder.Decode(data) + obj, err := runtime.Decode(decoder, data) if err != nil { return err } @@ -119,8 +127,8 @@ func AddObjectsFromPath(path string, o ObjectRetriever, decoder runtime.Decoder) type objects struct { types map[string][]runtime.Object last map[string]int - scheme runtime.ObjectScheme - decoder runtime.ObjectDecoder + scheme ObjectScheme + decoder runtime.Decoder } var _ ObjectRetriever = &objects{} @@ -135,7 +143,7 @@ var _ ObjectRetriever = &objects{} // as a runtime.Object if Status == Success). If multiple PodLists are provided, they // will be returned in order by the Kind call, and the last PodList will be reused for // subsequent calls. -func NewObjects(scheme runtime.ObjectScheme, decoder runtime.ObjectDecoder) ObjectRetriever { +func NewObjects(scheme ObjectScheme, decoder runtime.Decoder) ObjectRetriever { return objects{ types: make(map[string][]runtime.Object), last: make(map[string]int), @@ -144,23 +152,25 @@ func NewObjects(scheme runtime.ObjectScheme, decoder runtime.ObjectDecoder) Obje } } -func (o objects) Kind(kind, name string) (runtime.Object, error) { - empty, _ := o.scheme.New("", kind) +func (o objects) Kind(kind unversioned.GroupVersionKind, name string) (runtime.Object, error) { + kind.Version = runtime.APIVersionInternal + + empty, _ := o.scheme.New(kind) nilValue := reflect.Zero(reflect.TypeOf(empty)).Interface().(runtime.Object) - arr, ok := o.types[kind] + arr, ok := o.types[kind.Kind] if !ok { - if strings.HasSuffix(kind, "List") { - itemKind := kind[:len(kind)-4] + if strings.HasSuffix(kind.Kind, "List") { + itemKind := kind.Kind[:len(kind.Kind)-4] arr, ok := o.types[itemKind] if !ok { return empty, nil } - out, err := o.scheme.New("", kind) + out, err := o.scheme.New(kind) if err != nil { return nilValue, err } - if err := runtime.SetList(out, arr); err != nil { + if err := meta.SetList(out, arr); err != nil { return nilValue, err } if out, err = o.scheme.Copy(out); err != nil { @@ -168,25 +178,25 @@ func (o objects) Kind(kind, name string) (runtime.Object, error) { } return out, nil } - return nilValue, errors.NewNotFound(kind, name) + return nilValue, errors.NewNotFound(unversioned.GroupResource{Group: kind.Group, Resource: kind.Kind}, name) } - index := o.last[kind] + index := o.last[kind.Kind] if index >= len(arr) { index = len(arr) - 1 } if index < 0 { - return nilValue, errors.NewNotFound(kind, name) + return nilValue, errors.NewNotFound(unversioned.GroupResource{Group: kind.Group, Resource: kind.Kind}, name) } out, err := o.scheme.Copy(arr[index]) if err != nil { return nilValue, err } - o.last[kind] = index + 1 + o.last[kind.Kind] = index + 1 if status, ok := out.(*unversioned.Status); ok { if status.Details != nil { - status.Details.Kind = kind + status.Details.Kind = kind.Kind } if status.Status != unversioned.StatusSuccess { return nilValue, &errors.StatusError{ErrStatus: *status} @@ -197,18 +207,19 @@ func (o objects) Kind(kind, name string) (runtime.Object, error) { } func (o objects) Add(obj runtime.Object) error { - _, kind, err := o.scheme.ObjectVersionAndKind(obj) + gvk, err := o.scheme.ObjectKind(obj) if err != nil { return err } + kind := gvk.Kind switch { - case runtime.IsListType(obj): + case meta.IsListType(obj): if kind != "List" { o.types[kind] = append(o.types[kind], obj) } - list, err := runtime.ExtractList(obj) + list, err := meta.ExtractList(obj) if err != nil { return err } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/simple/simple_testclient.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/simple/simple_testclient.go new file mode 100644 index 000000000..7325f16ae --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/simple/simple_testclient.go @@ -0,0 +1,228 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package simple + +import ( + "net/http/httptest" + "net/url" + "path" + "reflect" + "strings" + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/api/unversioned" + clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + client "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/fields" + "k8s.io/kubernetes/pkg/labels" + "k8s.io/kubernetes/pkg/runtime" + utiltesting "k8s.io/kubernetes/pkg/util/testing" +) + +const NameRequiredError = "resource name may not be empty" + +type Request struct { + Method string + Path string + Header string + Query url.Values + Body runtime.Object + RawBody *string +} + +type Response struct { + StatusCode int + Body runtime.Object + RawBody *string +} + +type Client struct { + *client.Client + Clientset *clientset.Clientset + Request Request + Response Response + Error bool + Created bool + server *httptest.Server + handler *utiltesting.FakeHandler + // For query args, an optional function to validate the contents + // useful when the contents can change but still be correct. + // Maps from query arg key to validator. + // If no validator is present, string equality is used. + QueryValidator map[string]func(string, string) bool +} + +func (c *Client) Setup(t *testing.T) *Client { + c.handler = &utiltesting.FakeHandler{ + StatusCode: c.Response.StatusCode, + } + if responseBody := body(t, c.Response.Body, c.Response.RawBody); responseBody != nil { + c.handler.ResponseBody = *responseBody + } + c.server = httptest.NewServer(c.handler) + if c.Client == nil { + c.Client = client.NewOrDie(&client.Config{ + Host: c.server.URL, + ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}, + }) + + // TODO: caesarxuchao: hacky way to specify version of Experimental client. + // We will fix this by supporting multiple group versions in Config + c.ExtensionsClient = client.NewExtensionsOrDie(&client.Config{ + Host: c.server.URL, + ContentConfig: client.ContentConfig{GroupVersion: testapi.Extensions.GroupVersion()}, + }) + + c.Clientset = clientset.NewForConfigOrDie(&client.Config{Host: c.server.URL}) + } + c.QueryValidator = map[string]func(string, string) bool{} + return c +} + +func (c *Client) Close() { + if c.server != nil { + // TODO: Uncomment when fix #19254 + // c.server.Close() + } +} + +func (c *Client) ServerURL() string { + return c.server.URL +} + +func (c *Client) Validate(t *testing.T, received runtime.Object, err error) { + c.ValidateCommon(t, err) + + if c.Response.Body != nil && !api.Semantic.DeepDerivative(c.Response.Body, received) { + t.Errorf("bad response for request %#v: \nexpected %#v\ngot %#v\n", c.Request, c.Response.Body, received) + } +} + +func (c *Client) ValidateRaw(t *testing.T, received []byte, err error) { + c.ValidateCommon(t, err) + + if c.Response.Body != nil && !reflect.DeepEqual(c.Response.Body, received) { + t.Errorf("bad response for request %#v: expected %#v, got %#v", c.Request, c.Response.Body, received) + } +} + +func (c *Client) ValidateCommon(t *testing.T, err error) { + if c.Error { + if err == nil { + t.Errorf("error expected for %#v, got none", c.Request) + } + return + } + if err != nil { + t.Errorf("no error expected for %#v, got: %v", c.Request, err) + } + + if c.handler.RequestReceived == nil { + t.Errorf("handler had an empty request, %#v", c) + return + } + + requestBody := body(t, c.Request.Body, c.Request.RawBody) + actualQuery := c.handler.RequestReceived.URL.Query() + t.Logf("got query: %v", actualQuery) + t.Logf("path: %v", c.Request.Path) + // We check the query manually, so blank it out so that FakeHandler.ValidateRequest + // won't check it. + c.handler.RequestReceived.URL.RawQuery = "" + c.handler.ValidateRequest(t, path.Join(c.Request.Path), c.Request.Method, requestBody) + for key, values := range c.Request.Query { + validator, ok := c.QueryValidator[key] + if !ok { + switch key { + case unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()): + validator = ValidateLabels + case unversioned.FieldSelectorQueryParam(testapi.Default.GroupVersion().String()): + validator = validateFields + default: + validator = func(a, b string) bool { return a == b } + } + } + observed := actualQuery.Get(key) + wanted := strings.Join(values, "") + if !validator(wanted, observed) { + t.Errorf("Unexpected query arg for key: %s. Expected %s, Received %s", key, wanted, observed) + } + } + if c.Request.Header != "" { + if c.handler.RequestReceived.Header.Get(c.Request.Header) == "" { + t.Errorf("header %q not found in request %#v", c.Request.Header, c.handler.RequestReceived) + } + } + + if expected, received := requestBody, c.handler.RequestBody; expected != nil && *expected != received { + t.Errorf("bad body for request %#v: expected %s, got %s", c.Request, *expected, received) + } +} + +// buildQueryValues is a convenience function for knowing if a namespace should be in a query param or not +func BuildQueryValues(query url.Values) url.Values { + v := url.Values{} + if query != nil { + for key, values := range query { + for _, value := range values { + v.Add(key, value) + } + } + } + return v +} + +func ValidateLabels(a, b string) bool { + sA, eA := labels.Parse(a) + if eA != nil { + return false + } + sB, eB := labels.Parse(b) + if eB != nil { + return false + } + return sA.String() == sB.String() +} + +func validateFields(a, b string) bool { + sA, _ := fields.ParseSelector(a) + sB, _ := fields.ParseSelector(b) + return sA.String() == sB.String() +} + +func body(t *testing.T, obj runtime.Object, raw *string) *string { + if obj != nil { + fqKind, err := api.Scheme.ObjectKind(obj) + if err != nil { + t.Errorf("unexpected encoding error: %v", err) + } + var bs []byte + g, found := testapi.Groups[fqKind.GroupVersion().Group] + if !found { + t.Errorf("Group %s is not registered in testapi", fqKind.GroupVersion().Group) + } + bs, err = runtime.Encode(g.Codec(), obj) + if err != nil { + t.Errorf("unexpected encoding error: %v", err) + } + body := string(bs) + return &body + } + return raw +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/testclient.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/testclient.go index 296dca5c1..0da887984 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/testclient.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/testclient.go @@ -23,8 +23,8 @@ import ( "github.com/emicklei/go-restful/swagger" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/registered" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/version" @@ -33,7 +33,7 @@ import ( // NewSimpleFake returns a client that will respond with the provided objects func NewSimpleFake(objects ...runtime.Object) *Fake { - o := NewObjects(api.Scheme, api.Scheme) + o := NewObjects(api.Scheme, api.Codecs.UniversalDecoder()) for _, obj := range objects { if err := o.Add(obj); err != nil { panic(err) @@ -230,6 +230,10 @@ func (c *Fake) Nodes() client.NodeInterface { return &FakeNodes{Fake: c} } +func (c *Fake) PodSecurityPolicies() client.PodSecurityPolicyInterface { + return &FakePodSecurityPolicy{Fake: c} +} + func (c *Fake) Events(namespace string) client.EventInterface { return &FakeEvents{Fake: c, Namespace: namespace} } @@ -278,39 +282,33 @@ func (c *Fake) Discovery() client.DiscoveryInterface { return &FakeDiscovery{c} } -func (c *Fake) ServerVersion() (*version.Info, error) { - action := ActionImpl{} - action.Verb = "get" - action.Resource = "version" - - c.Invokes(action, nil) - versionInfo := version.Get() - return &versionInfo, nil -} - -func (c *Fake) ServerAPIVersions() (*unversioned.APIVersions, error) { - action := ActionImpl{} - action.Verb = "get" - action.Resource = "apiversions" - - c.Invokes(action, nil) - return &unversioned.APIVersions{Versions: registered.RegisteredVersions}, nil -} - func (c *Fake) ComponentStatuses() client.ComponentStatusInterface { return &FakeComponentStatuses{Fake: c} } +func (c *Fake) ConfigMaps(namespace string) client.ConfigMapsInterface { + return &FakeConfigMaps{Fake: c, Namespace: namespace} +} + // SwaggerSchema returns an empty swagger.ApiDeclaration for testing -func (c *Fake) SwaggerSchema(version string) (*swagger.ApiDeclaration, error) { +func (c *Fake) SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) { action := ActionImpl{} action.Verb = "get" - action.Resource = "/swaggerapi/api/" + version + if version == v1.SchemeGroupVersion { + action.Resource = "/swaggerapi/api/" + version.Version + } else { + action.Resource = "/swaggerapi/apis/" + version.Group + "/" + version.Version + } c.Invokes(action, nil) return &swagger.ApiDeclaration{}, nil } +// NewSimpleFakeExp returns a client that will respond with the provided objects +func NewSimpleFakeExp(objects ...runtime.Object) *FakeExperimental { + return &FakeExperimental{Fake: NewSimpleFake(objects...)} +} + type FakeExperimental struct { *Fake } @@ -339,6 +337,14 @@ func (c *FakeExperimental) Ingress(namespace string) client.IngressInterface { return &FakeIngress{Fake: c, Namespace: namespace} } +func (c *FakeExperimental) ThirdPartyResources(namespace string) client.ThirdPartyResourceInterface { + return &FakeThirdPartyResources{Fake: c, Namespace: namespace} +} + +func (c *FakeExperimental) ReplicaSets(namespace string) client.ReplicaSetInterface { + return &FakeReplicaSets{Fake: c, Namespace: namespace} +} + type FakeDiscovery struct { *Fake } @@ -364,3 +370,13 @@ func (c *FakeDiscovery) ServerResources() (map[string]*unversioned.APIResourceLi func (c *FakeDiscovery) ServerGroups() (*unversioned.APIGroupList, error) { return nil, nil } + +func (c *FakeDiscovery) ServerVersion() (*version.Info, error) { + action := ActionImpl{} + action.Verb = "get" + action.Resource = "version" + + c.Invokes(action, nil) + versionInfo := version.Get() + return &versionInfo, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/testclient_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/testclient_test.go index 9ee7d77e1..b31bdc213 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/testclient_test.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/testclient/testclient_test.go @@ -22,19 +22,17 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" ) func TestNewClient(t *testing.T) { - o := NewObjects(api.Scheme, api.Scheme) - if err := AddObjectsFromPath("../../../../examples/guestbook/frontend-service.yaml", o, api.Scheme); err != nil { + o := NewObjects(api.Scheme, api.Codecs.UniversalDecoder()) + if err := AddObjectsFromPath("../../../../examples/guestbook/frontend-service.yaml", o, api.Codecs.UniversalDecoder()); err != nil { t.Fatal(err) } client := &Fake{} client.AddReactor("*", "*", ObjectReaction(o, testapi.Default.RESTMapper())) - list, err := client.Services("test").List(labels.Everything(), fields.Everything()) + list, err := client.Services("test").List(api.ListOptions{}) if err != nil { t.Fatal(err) } @@ -43,7 +41,7 @@ func TestNewClient(t *testing.T) { } // When list is invoked a second time, the same results are returned. - list, err = client.Services("test").List(labels.Everything(), fields.Everything()) + list, err = client.Services("test").List(api.ListOptions{}) if err != nil { t.Fatal(err) } @@ -54,23 +52,23 @@ func TestNewClient(t *testing.T) { } func TestErrors(t *testing.T) { - o := NewObjects(api.Scheme, api.Scheme) + o := NewObjects(api.Scheme, api.Codecs.UniversalDecoder()) o.Add(&api.List{ Items: []runtime.Object{ // This first call to List will return this error - &(errors.NewNotFound("ServiceList", "").(*errors.StatusError).ErrStatus), + &(errors.NewNotFound(api.Resource("ServiceList"), "").(*errors.StatusError).ErrStatus), // The second call to List will return this error - &(errors.NewForbidden("ServiceList", "", nil).(*errors.StatusError).ErrStatus), + &(errors.NewForbidden(api.Resource("ServiceList"), "", nil).(*errors.StatusError).ErrStatus), }, }) client := &Fake{} client.AddReactor("*", "*", ObjectReaction(o, testapi.Default.RESTMapper())) - _, err := client.Services("test").List(labels.Everything(), fields.Everything()) + _, err := client.Services("test").List(api.ListOptions{}) if !errors.IsNotFound(err) { t.Fatalf("unexpected error: %v", err) } t.Logf("error: %#v", err.(*errors.StatusError).Status()) - _, err = client.Services("test").List(labels.Everything(), fields.Everything()) + _, err = client.Services("test").List(api.ListOptions{}) if !errors.IsForbidden(err) { t.Fatalf("unexpected error: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/thirdpartyresources.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/thirdpartyresources.go new file mode 100644 index 000000000..09bc4e4af --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/thirdpartyresources.go @@ -0,0 +1,100 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/watch" +) + +// ThirdPartyResourceNamespacer has methods to work with ThirdPartyResource resources in a namespace +type ThirdPartyResourceNamespacer interface { + ThirdPartyResources(namespace string) ThirdPartyResourceInterface +} + +type ThirdPartyResourceInterface interface { + List(opts api.ListOptions) (*extensions.ThirdPartyResourceList, error) + Get(name string) (*extensions.ThirdPartyResource, error) + Create(ctrl *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) + Update(ctrl *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) + UpdateStatus(ctrl *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) + Delete(name string) error + Watch(opts api.ListOptions) (watch.Interface, error) +} + +// thirdPartyResources implements DaemonsSetsNamespacer interface +type thirdPartyResources struct { + r *ExtensionsClient + ns string +} + +func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources { + return &thirdPartyResources{c, namespace} +} + +// Ensure statically that thirdPartyResources implements ThirdPartyResourcesInterface. +var _ ThirdPartyResourceInterface = &thirdPartyResources{} + +func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) { + result = &extensions.ThirdPartyResourceList{} + err = c.r.Get().Namespace(c.ns).Resource("thirdpartyresources").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) + return +} + +// Get returns information about a particular third party resource. +func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) { + result = &extensions.ThirdPartyResource{} + err = c.r.Get().Namespace(c.ns).Resource("thirdpartyresources").Name(name).Do().Into(result) + return +} + +// Create creates a new third party resource. +func (c *thirdPartyResources) Create(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { + result = &extensions.ThirdPartyResource{} + err = c.r.Post().Namespace(c.ns).Resource("thirdpartyresources").Body(resource).Do().Into(result) + return +} + +// Update updates an existing third party resource. +func (c *thirdPartyResources) Update(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { + result = &extensions.ThirdPartyResource{} + err = c.r.Put().Namespace(c.ns).Resource("thirdpartyresources").Name(resource.Name).Body(resource).Do().Into(result) + return +} + +// UpdateStatus updates an existing third party resource status +func (c *thirdPartyResources) UpdateStatus(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { + result = &extensions.ThirdPartyResource{} + err = c.r.Put().Namespace(c.ns).Resource("thirdpartyresources").Name(resource.Name).SubResource("status").Body(resource).Do().Into(result) + return +} + +// Delete deletes an existing third party resource. +func (c *thirdPartyResources) Delete(name string) error { + return c.r.Delete().Namespace(c.ns).Resource("thirdpartyresources").Name(name).Do().Error() +} + +// Watch returns a watch.Interface that watches the requested third party resources. +func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { + return c.r.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("thirdpartyresources"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/thirdpartyresources_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/thirdpartyresources_test.go new file mode 100644 index 000000000..bf2e9e15c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/thirdpartyresources_test.go @@ -0,0 +1,185 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned_test + +import ( + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/apis/extensions" + . "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" +) + +func getThirdPartyResourceName() string { + return "thirdpartyresources" +} + +func TestListThirdPartyResources(t *testing.T) { + ns := api.NamespaceAll + c := &simple.Client{ + Request: simple.Request{ + Method: "GET", + Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, ""), + }, + Response: simple.Response{StatusCode: 200, + Body: &extensions.ThirdPartyResourceList{ + Items: []extensions.ThirdPartyResource{ + { + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Description: "test third party resource", + }, + }, + }, + }, + } + receivedDSs, err := c.Setup(t).Extensions().ThirdPartyResources(ns).List(api.ListOptions{}) + defer c.Close() + c.Validate(t, receivedDSs, err) + +} + +func TestGetThirdPartyResource(t *testing.T) { + ns := api.NamespaceDefault + c := &simple.Client{ + Request: simple.Request{Method: "GET", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ + StatusCode: 200, + Body: &extensions.ThirdPartyResource{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Description: "test third party resource", + }, + }, + } + receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Get("foo") + defer c.Close() + c.Validate(t, receivedThirdPartyResource, err) +} + +func TestGetThirdPartyResourceWithNoName(t *testing.T) { + ns := api.NamespaceDefault + c := &simple.Client{Error: true} + receivedPod, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Get("") + defer c.Close() + if (err != nil) && (err.Error() != simple.NameRequiredError) { + t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) + } + + c.Validate(t, receivedPod, err) +} + +func TestUpdateThirdPartyResource(t *testing.T) { + ns := api.NamespaceDefault + requestThirdPartyResource := &extensions.ThirdPartyResource{ + ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, + } + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ + StatusCode: 200, + Body: &extensions.ThirdPartyResource{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Description: "test third party resource", + }, + }, + } + receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Update(requestThirdPartyResource) + defer c.Close() + c.Validate(t, receivedThirdPartyResource, err) +} + +func TestUpdateThirdPartyResourceUpdateStatus(t *testing.T) { + ns := api.NamespaceDefault + requestThirdPartyResource := &extensions.ThirdPartyResource{ + ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, + } + c := &simple.Client{ + Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo") + "/status", Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ + StatusCode: 200, + Body: &extensions.ThirdPartyResource{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Description: "test third party resource", + }, + }, + } + receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).UpdateStatus(requestThirdPartyResource) + defer c.Close() + c.Validate(t, receivedThirdPartyResource, err) +} + +func TestDeleteThirdPartyResource(t *testing.T) { + ns := api.NamespaceDefault + c := &simple.Client{ + Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{StatusCode: 200}, + } + err := c.Setup(t).Extensions().ThirdPartyResources(ns).Delete("foo") + defer c.Close() + c.Validate(t, nil, err) +} + +func TestCreateThirdPartyResource(t *testing.T) { + ns := api.NamespaceDefault + requestThirdPartyResource := &extensions.ThirdPartyResource{ + ObjectMeta: api.ObjectMeta{Name: "foo"}, + } + c := &simple.Client{ + Request: simple.Request{Method: "POST", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, ""), Body: requestThirdPartyResource, Query: simple.BuildQueryValues(nil)}, + Response: simple.Response{ + StatusCode: 200, + Body: &extensions.ThirdPartyResource{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{ + "foo": "bar", + "name": "baz", + }, + }, + Description: "test third party resource", + }, + }, + } + receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Create(requestThirdPartyResource) + defer c.Close() + c.Validate(t, receivedThirdPartyResource, err) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/transport.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/transport.go index 405b495c2..74469cae0 100644 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/transport.go +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/transport.go @@ -18,204 +18,49 @@ package unversioned import ( "crypto/tls" - "crypto/x509" - "fmt" - "io/ioutil" "net/http" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/client/transport" ) -type userAgentRoundTripper struct { - agent string - rt http.RoundTripper -} - -func NewUserAgentRoundTripper(agent string, rt http.RoundTripper) http.RoundTripper { - return &userAgentRoundTripper{agent, rt} -} - -func (rt *userAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - if len(req.Header.Get("User-Agent")) != 0 { - return rt.rt.RoundTrip(req) - } - req = cloneRequest(req) - req.Header.Set("User-Agent", rt.agent) - return rt.rt.RoundTrip(req) -} - -var _ = util.RoundTripperWrapper(&userAgentRoundTripper{}) - -func (rt *userAgentRoundTripper) WrappedRoundTripper() http.RoundTripper { - return rt.rt -} - -type basicAuthRoundTripper struct { - username string - password string - rt http.RoundTripper -} - -// NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a request unless it has -// already been set. -func NewBasicAuthRoundTripper(username, password string, rt http.RoundTripper) http.RoundTripper { - return &basicAuthRoundTripper{username, password, rt} -} - -func (rt *basicAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - if len(req.Header.Get("Authorization")) != 0 { - return rt.rt.RoundTrip(req) - } - req = cloneRequest(req) - req.SetBasicAuth(rt.username, rt.password) - return rt.rt.RoundTrip(req) -} - -var _ = util.RoundTripperWrapper(&basicAuthRoundTripper{}) - -func (rt *basicAuthRoundTripper) WrappedRoundTripper() http.RoundTripper { - return rt.rt -} - -type bearerAuthRoundTripper struct { - bearer string - rt http.RoundTripper -} - -// NewBearerAuthRoundTripper adds the provided bearer token to a request unless the authorization -// header has already been set. -func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper { - return &bearerAuthRoundTripper{bearer, rt} -} - -func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - if len(req.Header.Get("Authorization")) != 0 { - return rt.rt.RoundTrip(req) - } - - req = cloneRequest(req) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", rt.bearer)) - return rt.rt.RoundTrip(req) -} - -var _ = util.RoundTripperWrapper(&bearerAuthRoundTripper{}) - -func (rt *bearerAuthRoundTripper) WrappedRoundTripper() http.RoundTripper { - return rt.rt -} - // TLSConfigFor returns a tls.Config that will provide the transport level security defined // by the provided Config. Will return nil if no transport level security is requested. func TLSConfigFor(config *Config) (*tls.Config, error) { - hasCA := len(config.CAFile) > 0 || len(config.CAData) > 0 - hasCert := len(config.CertFile) > 0 || len(config.CertData) > 0 - - if !hasCA && !hasCert && !config.Insecure { - return nil, nil - } - if hasCA && config.Insecure { - return nil, fmt.Errorf("specifying a root certificates file with the insecure flag is not allowed") - } - if err := LoadTLSFiles(config); err != nil { - return nil, err - } - - tlsConfig := &tls.Config{ - // Change default from SSLv3 to TLSv1.0 (because of POODLE vulnerability) - MinVersion: tls.VersionTLS10, - InsecureSkipVerify: config.Insecure, - } - - if hasCA { - tlsConfig.RootCAs = rootCertPool(config.CAData) - } - - if hasCert { - cert, err := tls.X509KeyPair(config.CertData, config.KeyData) - if err != nil { - return nil, err - } - tlsConfig.Certificates = []tls.Certificate{cert} - } - - return tlsConfig, nil + return transport.TLSConfigFor(config.transportConfig()) } -// tlsConfigKey returns a unique key for tls.Config objects returned from TLSConfigFor -func tlsConfigKey(config *Config) (string, error) { - // Make sure ca/key/cert content is loaded - if err := LoadTLSFiles(config); err != nil { - return "", err - } - // Only include the things that actually affect the tls.Config - return fmt.Sprintf("%v/%x/%x/%x", config.Insecure, config.CAData, config.CertData, config.KeyData), nil +// TransportFor returns an http.RoundTripper that will provide the authentication +// or transport level security defined by the provided Config. Will return the +// default http.DefaultTransport if no special case behavior is needed. +func TransportFor(config *Config) (http.RoundTripper, error) { + return transport.New(config.transportConfig()) } -// LoadTLSFiles copies the data from the CertFile, KeyFile, and CAFile fields into the CertData, -// KeyData, and CAFile fields, or returns an error. If no error is returned, all three fields are -// either populated or were empty to start. -func LoadTLSFiles(config *Config) error { - certData, err := dataFromSliceOrFile(config.CertData, config.CertFile) - if err != nil { - return err - } - config.CertData = certData - keyData, err := dataFromSliceOrFile(config.KeyData, config.KeyFile) - if err != nil { - return err - } - config.KeyData = keyData - caData, err := dataFromSliceOrFile(config.CAData, config.CAFile) - if err != nil { - return err - } - config.CAData = caData - - return nil +// HTTPWrappersForConfig wraps a round tripper with any relevant layered behavior from the +// config. Exposed to allow more clients that need HTTP-like behavior but then must hijack +// the underlying connection (like WebSocket or HTTP2 clients). Pure HTTP clients should use +// the higher level TransportFor or RESTClientFor methods. +func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error) { + return transport.HTTPWrappersForConfig(config.transportConfig(), rt) } -// dataFromSliceOrFile returns data from the slice (if non-empty), or from the file, -// or an error if an error occurred reading the file -func dataFromSliceOrFile(data []byte, file string) ([]byte, error) { - if len(data) > 0 { - return data, nil +// transportConfig converts a client config to an appropriate transport config. +func (c *Config) transportConfig() *transport.Config { + return &transport.Config{ + UserAgent: c.UserAgent, + Transport: c.Transport, + WrapTransport: c.WrapTransport, + TLS: transport.TLSConfig{ + CAFile: c.CAFile, + CAData: c.CAData, + CertFile: c.CertFile, + CertData: c.CertData, + KeyFile: c.KeyFile, + KeyData: c.KeyData, + Insecure: c.Insecure, + }, + Username: c.Username, + Password: c.Password, + BearerToken: c.BearerToken, } - if len(file) > 0 { - fileData, err := ioutil.ReadFile(file) - if err != nil { - return []byte{}, err - } - return fileData, nil - } - return nil, nil -} - -// rootCertPool returns nil if caData is empty. When passed along, this will mean "use system CAs". -// When caData is not empty, it will be the ONLY information used in the CertPool. -func rootCertPool(caData []byte) *x509.CertPool { - // What we really want is a copy of x509.systemRootsPool, but that isn't exposed. It's difficult to build (see the go - // code for a look at the platform specific insanity), so we'll use the fact that RootCAs == nil gives us the system values - // It doesn't allow trusting either/or, but hopefully that won't be an issue - if len(caData) == 0 { - return nil - } - - // if we have caData, use it - certPool := x509.NewCertPool() - certPool.AppendCertsFromPEM(caData) - return certPool -} - -// cloneRequest returns a clone of the provided *http.Request. -// The clone is a shallow copy of the struct and its Header map. -func cloneRequest(r *http.Request) *http.Request { - // shallow copy of the struct - r2 := new(http.Request) - *r2 = *r - // deep copy of the Header - r2.Header = make(http.Header) - for k, s := range r.Header { - r2.Header[k] = s - } - return r2 } diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/transport_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/transport_test.go deleted file mode 100644 index 8ba609110..000000000 --- a/vendor/k8s.io/kubernetes/pkg/client/unversioned/transport_test.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package unversioned - -import ( - "encoding/base64" - "net/http" - "testing" - - "k8s.io/kubernetes/pkg/api/testapi" -) - -type testRoundTripper struct { - Request *http.Request - Response *http.Response - Err error -} - -func (rt *testRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - rt.Request = req - return rt.Response, rt.Err -} - -func TestBearerAuthRoundTripper(t *testing.T) { - rt := &testRoundTripper{} - req := &http.Request{} - NewBearerAuthRoundTripper("test", rt).RoundTrip(req) - if rt.Request == nil { - t.Fatalf("unexpected nil request: %v", rt) - } - if rt.Request == req { - t.Fatalf("round tripper should have copied request object: %#v", rt.Request) - } - if rt.Request.Header.Get("Authorization") != "Bearer test" { - t.Errorf("unexpected authorization header: %#v", rt.Request) - } -} - -func TestBasicAuthRoundTripper(t *testing.T) { - rt := &testRoundTripper{} - req := &http.Request{} - NewBasicAuthRoundTripper("user", "pass", rt).RoundTrip(req) - if rt.Request == nil { - t.Fatalf("unexpected nil request: %v", rt) - } - if rt.Request == req { - t.Fatalf("round tripper should have copied request object: %#v", rt.Request) - } - if rt.Request.Header.Get("Authorization") != "Basic "+base64.StdEncoding.EncodeToString([]byte("user:pass")) { - t.Errorf("unexpected authorization header: %#v", rt.Request) - } -} - -func TestUserAgentRoundTripper(t *testing.T) { - rt := &testRoundTripper{} - req := &http.Request{ - Header: make(http.Header), - } - req.Header.Set("User-Agent", "other") - NewUserAgentRoundTripper("test", rt).RoundTrip(req) - if rt.Request == nil { - t.Fatalf("unexpected nil request: %v", rt) - } - if rt.Request != req { - t.Fatalf("round tripper should not have copied request object: %#v", rt.Request) - } - if rt.Request.Header.Get("User-Agent") != "other" { - t.Errorf("unexpected user agent header: %#v", rt.Request) - } - - req = &http.Request{} - NewUserAgentRoundTripper("test", rt).RoundTrip(req) - if rt.Request == nil { - t.Fatalf("unexpected nil request: %v", rt) - } - if rt.Request == req { - t.Fatalf("round tripper should have copied request object: %#v", rt.Request) - } - if rt.Request.Header.Get("User-Agent") != "test" { - t.Errorf("unexpected user agent header: %#v", rt.Request) - } -} - -func TestTLSConfigKey(t *testing.T) { - // Make sure config fields that don't affect the tls config don't affect the cache key - identicalConfigurations := map[string]*Config{ - "empty": {}, - "host": {Host: "foo"}, - "prefix": {Prefix: "foo"}, - "version": {Version: "foo"}, - "codec": {Codec: testapi.Default.Codec()}, - "basic": {Username: "bob", Password: "password"}, - "bearer": {BearerToken: "token"}, - "user agent": {UserAgent: "useragent"}, - "transport": {Transport: http.DefaultTransport}, - "wrap transport": {WrapTransport: func(http.RoundTripper) http.RoundTripper { return nil }}, - "qps/burst": {QPS: 1.0, Burst: 10}, - } - for nameA, valueA := range identicalConfigurations { - for nameB, valueB := range identicalConfigurations { - keyA, err := tlsConfigKey(valueA) - if err != nil { - t.Errorf("Unexpected error for %q: %v", nameA, err) - continue - } - keyB, err := tlsConfigKey(valueB) - if err != nil { - t.Errorf("Unexpected error for %q: %v", nameB, err) - continue - } - if keyA != keyB { - t.Errorf("Expected identical cache keys for %q and %q, got:\n\t%s\n\t%s", nameA, nameB, keyA, keyB) - continue - } - } - } - - // Make sure config fields that affect the tls config affect the cache key - uniqueConfigurations := map[string]*Config{ - "no tls": {}, - "insecure": {Insecure: true}, - "cadata 1": {TLSClientConfig: TLSClientConfig{CAData: []byte{1}}}, - "cadata 2": {TLSClientConfig: TLSClientConfig{CAData: []byte{2}}}, - "cert 1, key 1": {TLSClientConfig: TLSClientConfig{CertData: []byte{1}, KeyData: []byte{1}}}, - "cert 1, key 2": {TLSClientConfig: TLSClientConfig{CertData: []byte{1}, KeyData: []byte{2}}}, - "cert 2, key 1": {TLSClientConfig: TLSClientConfig{CertData: []byte{2}, KeyData: []byte{1}}}, - "cert 2, key 2": {TLSClientConfig: TLSClientConfig{CertData: []byte{2}, KeyData: []byte{2}}}, - "cadata 1, cert 1, key 1": {TLSClientConfig: TLSClientConfig{CAData: []byte{1}, CertData: []byte{1}, KeyData: []byte{1}}}, - } - for nameA, valueA := range uniqueConfigurations { - for nameB, valueB := range uniqueConfigurations { - // Don't compare to ourselves - if nameA == nameB { - continue - } - - keyA, err := tlsConfigKey(valueA) - if err != nil { - t.Errorf("Unexpected error for %q: %v", nameA, err) - continue - } - keyB, err := tlsConfigKey(valueB) - if err != nil { - t.Errorf("Unexpected error for %q: %v", nameB, err) - continue - } - if keyA == keyB { - t.Errorf("Expected unique cache keys for %q and %q, got:\n\t%s\n\t%s", nameA, nameB, keyA, keyB) - continue - } - } - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/urlbackoff.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/urlbackoff.go new file mode 100644 index 000000000..331079bd7 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/urlbackoff.go @@ -0,0 +1,97 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "net/url" + "time" + + "github.com/golang/glog" + "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/sets" +) + +// Set of resp. Codes that we backoff for. +// In general these should be errors that indicate a server is overloaded. +// These shouldn't be configured by any user, we set them based on conventions +// described in +var serverIsOverloadedSet = sets.NewInt(429) +var maxResponseCode = 499 + +type BackoffManager interface { + UpdateBackoff(actualUrl *url.URL, err error, responseCode int) + CalculateBackoff(actualUrl *url.URL) time.Duration +} + +// URLBackoff struct implements the semantics on top of Backoff which +// we need for URL specific exponential backoff. +type URLBackoff struct { + // Uses backoff as underlying implementation. + Backoff *util.Backoff +} + +// NoBackoff is a stub implementation, can be used for mocking or else as a default. +type NoBackoff struct { +} + +func (n *NoBackoff) UpdateBackoff(actualUrl *url.URL, err error, responseCode int) { + // do nothing. +} +func (n *NoBackoff) CalculateBackoff(actualUrl *url.URL) time.Duration { + return 0 * time.Second +} + +// Disable makes the backoff trivial, i.e., sets it to zero. This might be used +// by tests which want to run 1000s of mock requests without slowing down. +func (b *URLBackoff) Disable() { + glog.V(4).Infof("Disabling backoff strategy") + b.Backoff = util.NewBackOff(0*time.Second, 0*time.Second) +} + +// baseUrlKey returns the key which urls will be mapped to. +// For example, 127.0.0.1:8080/api/v2/abcde -> 127.0.0.1:8080. +func (b *URLBackoff) baseUrlKey(rawurl *url.URL) string { + // Simple implementation for now, just the host. + // We may backoff specific paths (i.e. "pods") differentially + // in the future. + host, err := url.Parse(rawurl.String()) + if err != nil { + glog.V(4).Infof("Error extracting url: %v", rawurl) + panic("bad url!") + } + return host.Host +} + +// UpdateBackoff updates backoff metadata +func (b *URLBackoff) UpdateBackoff(actualUrl *url.URL, err error, responseCode int) { + // range for retry counts that we store is [0,13] + if responseCode > maxResponseCode || serverIsOverloadedSet.Has(responseCode) { + b.Backoff.Next(b.baseUrlKey(actualUrl), time.Now()) + return + } else if responseCode >= 300 || err != nil { + glog.V(4).Infof("Client is returning errors: code %v, error %v", responseCode, err) + } + + //If we got this far, there is no backoff required for this URL anymore. + b.Backoff.Reset(b.baseUrlKey(actualUrl)) +} + +// CalculateBackoff takes a url and back's off exponentially, +// based on its knowledge of existing failures. +func (b *URLBackoff) CalculateBackoff(actualUrl *url.URL) time.Duration { + return b.Backoff.Get(b.baseUrlKey(actualUrl)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/client/unversioned/urlbackoff_test.go b/vendor/k8s.io/kubernetes/pkg/client/unversioned/urlbackoff_test.go new file mode 100644 index 000000000..8457c977b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/client/unversioned/urlbackoff_test.go @@ -0,0 +1,78 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import ( + "k8s.io/kubernetes/pkg/util" + "net/url" + "testing" + "time" +) + +func parse(raw string) *url.URL { + theUrl, _ := url.Parse(raw) + return theUrl +} + +func TestURLBackoffFunctionalityCollisions(t *testing.T) { + myBackoff := &URLBackoff{ + Backoff: util.NewBackOff(1*time.Second, 60*time.Second), + } + + // Add some noise and make sure backoff for a clean URL is zero. + myBackoff.UpdateBackoff(parse("http://100.200.300.400:8080"), nil, 500) + + myBackoff.UpdateBackoff(parse("http://1.2.3.4:8080"), nil, 500) + + if myBackoff.CalculateBackoff(parse("http://1.2.3.4:100")) > 0 { + t.Errorf("URLs are colliding in the backoff map!") + } +} + +// TestURLBackoffFunctionality generally tests the URLBackoff wrapper. We avoid duplicating tests from backoff and request. +func TestURLBackoffFunctionality(t *testing.T) { + myBackoff := &URLBackoff{ + Backoff: util.NewBackOff(1*time.Second, 60*time.Second), + } + + // Now test that backoff increases, then recovers. + // 200 and 300 should both result in clearing the backoff. + // all others like 429 should result in increased backoff. + seconds := []int{0, + 1, 2, 4, 8, 0, + 1, 2} + returnCodes := []int{ + 429, 500, 501, 502, 300, + 500, 501, 502, + } + + if len(seconds) != len(returnCodes) { + t.Fatalf("responseCode to backoff arrays should be the same length... sanity check failed.") + } + + for i, sec := range seconds { + backoffSec := myBackoff.CalculateBackoff(parse("http://1.2.3.4:100")) + if backoffSec < time.Duration(sec)*time.Second || backoffSec > time.Duration(sec+5)*time.Second { + t.Errorf("Backoff out of range %v: %v %v", i, sec, backoffSec) + } + myBackoff.UpdateBackoff(parse("http://1.2.3.4:100/responseCodeForFuncTest"), nil, returnCodes[i]) + } + + if myBackoff.CalculateBackoff(parse("http://1.2.3.4:100")) == 0 { + t.Errorf("The final return code %v should have resulted in a backoff ! ", returnCodes[7]) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/converter.go b/vendor/k8s.io/kubernetes/pkg/conversion/converter.go index 61025b617..19cd4bef9 100644 --- a/vendor/k8s.io/kubernetes/pkg/conversion/converter.go +++ b/vendor/k8s.io/kubernetes/pkg/conversion/converter.go @@ -36,12 +36,19 @@ type DebugLogger interface { Logf(format string, args ...interface{}) } +type NameFunc func(t reflect.Type) string + +var DefaultNameFunc = func(t reflect.Type) string { return t.Name() } + // Converter knows how to convert one type to another. type Converter struct { // Map from the conversion pair to a function which can // do the conversion. - conversionFuncs map[typePair]reflect.Value - generatedConversionFuncs map[typePair]reflect.Value + conversionFuncs ConversionFuncs + generatedConversionFuncs ConversionFuncs + + // Set of conversions that should be treated as a no-op + ignoredConversions map[typePair]struct{} // This is a map from a source field type and name, to a list of destination // field type and name. @@ -74,25 +81,41 @@ type Converter struct { } // NewConverter creates a new Converter object. -func NewConverter() *Converter { +func NewConverter(nameFn NameFunc) *Converter { c := &Converter{ - conversionFuncs: map[typePair]reflect.Value{}, - generatedConversionFuncs: map[typePair]reflect.Value{}, - defaultingFuncs: map[reflect.Type]reflect.Value{}, - defaultingInterfaces: map[reflect.Type]interface{}{}, - nameFunc: func(t reflect.Type) string { return t.Name() }, - structFieldDests: map[typeNamePair][]typeNamePair{}, - structFieldSources: map[typeNamePair][]typeNamePair{}, + conversionFuncs: NewConversionFuncs(), + generatedConversionFuncs: NewConversionFuncs(), + ignoredConversions: make(map[typePair]struct{}), + defaultingFuncs: make(map[reflect.Type]reflect.Value), + defaultingInterfaces: make(map[reflect.Type]interface{}), + nameFunc: nameFn, + structFieldDests: make(map[typeNamePair][]typeNamePair), + structFieldSources: make(map[typeNamePair][]typeNamePair), - inputFieldMappingFuncs: map[reflect.Type]FieldMappingFunc{}, - inputDefaultFlags: map[reflect.Type]FieldMatchingFlags{}, + inputFieldMappingFuncs: make(map[reflect.Type]FieldMappingFunc), + inputDefaultFlags: make(map[reflect.Type]FieldMatchingFlags), } - c.RegisterConversionFunc(byteSliceCopy) + c.RegisterConversionFunc(ByteSliceCopy) return c } -// Prevent recursing into every byte... -func byteSliceCopy(in *[]byte, out *[]byte, s Scope) error { +// WithConversions returns a Converter that is a copy of c but with the additional +// fns merged on top. +func (c *Converter) WithConversions(fns ConversionFuncs) *Converter { + copied := *c + copied.conversionFuncs = c.conversionFuncs.Merge(fns) + return &copied +} + +// DefaultMeta returns the conversion FieldMappingFunc and meta for a given type. +func (c *Converter) DefaultMeta(t reflect.Type) (FieldMatchingFlags, *Meta) { + return c.inputDefaultFlags[t], &Meta{ + KeyNameMapping: c.inputFieldMappingFuncs[t], + } +} + +// ByteSliceCopy prevents recursing into every byte +func ByteSliceCopy(in *[]byte, out *[]byte, s Scope) error { *out = make([]byte, len(*in)) copy(*out, *in) return nil @@ -130,6 +153,42 @@ type Scope interface { // the value of the source or destination struct tags. type FieldMappingFunc func(key string, sourceTag, destTag reflect.StructTag) (source string, dest string) +func NewConversionFuncs() ConversionFuncs { + return ConversionFuncs{fns: make(map[typePair]reflect.Value)} +} + +type ConversionFuncs struct { + fns map[typePair]reflect.Value +} + +// Add adds the provided conversion functions to the lookup table - they must have the signature +// `func(type1, type2, Scope) error`. Functions are added in the order passed and will override +// previously registered pairs. +func (c ConversionFuncs) Add(fns ...interface{}) error { + for _, fn := range fns { + fv := reflect.ValueOf(fn) + ft := fv.Type() + if err := verifyConversionFunctionSignature(ft); err != nil { + return err + } + c.fns[typePair{ft.In(0).Elem(), ft.In(1).Elem()}] = fv + } + return nil +} + +// Merge returns a new ConversionFuncs that contains all conversions from +// both other and c, with other conversions taking precedence. +func (c ConversionFuncs) Merge(other ConversionFuncs) ConversionFuncs { + merged := NewConversionFuncs() + for k, v := range c.fns { + merged.fns[k] = v + } + for k, v := range other.fns { + merged.fns[k] = v + } + return merged +} + // Meta is supplied by Scheme, when it calls Convert. type Meta struct { SrcVersion string @@ -291,37 +350,52 @@ func verifyConversionFunctionSignature(ft reflect.Type) error { // // Example: // c.RegisterConversionFunc( -// func(in *Pod, out *v1beta1.Pod, s Scope) error { +// func(in *Pod, out *v1.Pod, s Scope) error { // // conversion logic... // return nil // }) func (c *Converter) RegisterConversionFunc(conversionFunc interface{}) error { - fv := reflect.ValueOf(conversionFunc) - ft := fv.Type() - if err := verifyConversionFunctionSignature(ft); err != nil { - return err - } - c.conversionFuncs[typePair{ft.In(0).Elem(), ft.In(1).Elem()}] = fv - return nil + return c.conversionFuncs.Add(conversionFunc) } // Similar to RegisterConversionFunc, but registers conversion function that were // automatically generated. func (c *Converter) RegisterGeneratedConversionFunc(conversionFunc interface{}) error { - fv := reflect.ValueOf(conversionFunc) - ft := fv.Type() - if err := verifyConversionFunctionSignature(ft); err != nil { - return err + return c.generatedConversionFuncs.Add(conversionFunc) +} + +// RegisterIgnoredConversion registers a "no-op" for conversion, where any requested +// conversion between from and to is ignored. +func (c *Converter) RegisterIgnoredConversion(from, to interface{}) error { + typeFrom := reflect.TypeOf(from) + typeTo := reflect.TypeOf(to) + if reflect.TypeOf(from).Kind() != reflect.Ptr { + return fmt.Errorf("expected pointer arg for 'from' param 0, got: %v", typeFrom) } - c.generatedConversionFuncs[typePair{ft.In(0).Elem(), ft.In(1).Elem()}] = fv + if typeTo.Kind() != reflect.Ptr { + return fmt.Errorf("expected pointer arg for 'to' param 1, got: %v", typeTo) + } + c.ignoredConversions[typePair{typeFrom.Elem(), typeTo.Elem()}] = struct{}{} return nil } -func (c *Converter) HasConversionFunc(inType, outType reflect.Type) bool { - _, found := c.conversionFuncs[typePair{inType, outType}] +// IsConversionIgnored returns true if the specified objects should be dropped during +// conversion. +func (c *Converter) IsConversionIgnored(inType, outType reflect.Type) bool { + _, found := c.ignoredConversions[typePair{inType, outType}] return found } +func (c *Converter) HasConversionFunc(inType, outType reflect.Type) bool { + _, found := c.conversionFuncs.fns[typePair{inType, outType}] + return found +} + +func (c *Converter) ConversionFuncValue(inType, outType reflect.Type) (reflect.Value, bool) { + value, found := c.conversionFuncs.fns[typePair{inType, outType}] + return value, found +} + // SetStructFieldCopy registers a correspondence. Whenever a struct field is encountered // which has a type and name matching srcFieldType and srcFieldName, it wil be copied // into the field in the destination struct matching destFieldType & Name, if such a @@ -343,7 +417,7 @@ func (c *Converter) SetStructFieldCopy(srcFieldType interface{}, srcFieldName st // // Example: // c.RegisteDefaultingFunc( -// func(in *v1beta1.Pod) { +// func(in *v1.Pod) { // // defaulting logic... // }) func (c *Converter) RegisterDefaultingFunc(defaultingFunc interface{}) error { @@ -504,16 +578,26 @@ func (c *Converter) convert(sv, dv reflect.Value, scope *scope) error { fv.Call(args) } + pair := typePair{st, dt} + + // ignore conversions of this type + if _, ok := c.ignoredConversions[pair]; ok { + if c.Debug != nil { + c.Debug.Logf("Ignoring conversion of '%v' to '%v'", st, dt) + } + return nil + } + // Convert sv to dv. - if fv, ok := c.conversionFuncs[typePair{st, dt}]; ok { + if fv, ok := c.conversionFuncs.fns[pair]; ok { if c.Debug != nil { c.Debug.Logf("Calling custom conversion of '%v' to '%v'", st, dt) } return c.callCustom(sv, dv, fv, scope) } - if fv, ok := c.generatedConversionFuncs[typePair{st, dt}]; ok { + if fv, ok := c.generatedConversionFuncs.fns[pair]; ok { if c.Debug != nil { - c.Debug.Logf("Calling custom conversion of '%v' to '%v'", st, dt) + c.Debug.Logf("Calling generated conversion of '%v' to '%v'", st, dt) } return c.callCustom(sv, dv, fv, scope) } diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/converter_test.go b/vendor/k8s.io/kubernetes/pkg/conversion/converter_test.go index 2a110546b..c639492a7 100644 --- a/vendor/k8s.io/kubernetes/pkg/conversion/converter_test.go +++ b/vendor/k8s.io/kubernetes/pkg/conversion/converter_test.go @@ -17,6 +17,7 @@ limitations under the License. package conversion import ( + "encoding/json" "fmt" "reflect" "strconv" @@ -24,10 +25,79 @@ import ( "testing" "github.com/google/gofuzz" + flag "github.com/spf13/pflag" + + "k8s.io/kubernetes/pkg/util" ) +var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.") + +// Test a weird version/kind embedding format. +type MyWeirdCustomEmbeddedVersionKindField struct { + ID string `json:"ID,omitempty"` + APIVersion string `json:"myVersionKey,omitempty"` + ObjectKind string `json:"myKindKey,omitempty"` + Z string `json:"Z,omitempty"` + Y uint64 `json:"Y,omitempty"` +} + +type TestType1 struct { + MyWeirdCustomEmbeddedVersionKindField `json:",inline"` + A string `json:"A,omitempty"` + B int `json:"B,omitempty"` + C int8 `json:"C,omitempty"` + D int16 `json:"D,omitempty"` + E int32 `json:"E,omitempty"` + F int64 `json:"F,omitempty"` + G uint `json:"G,omitempty"` + H uint8 `json:"H,omitempty"` + I uint16 `json:"I,omitempty"` + J uint32 `json:"J,omitempty"` + K uint64 `json:"K,omitempty"` + L bool `json:"L,omitempty"` + M map[string]int `json:"M,omitempty"` + N map[string]TestType2 `json:"N,omitempty"` + O *TestType2 `json:"O,omitempty"` + P []TestType2 `json:"Q,omitempty"` +} + +type TestType2 struct { + A string `json:"A,omitempty"` + B int `json:"B,omitempty"` +} + +type ExternalTestType2 struct { + A string `json:"A,omitempty"` + B int `json:"B,omitempty"` +} +type ExternalTestType1 struct { + MyWeirdCustomEmbeddedVersionKindField `json:",inline"` + A string `json:"A,omitempty"` + B int `json:"B,omitempty"` + C int8 `json:"C,omitempty"` + D int16 `json:"D,omitempty"` + E int32 `json:"E,omitempty"` + F int64 `json:"F,omitempty"` + G uint `json:"G,omitempty"` + H uint8 `json:"H,omitempty"` + I uint16 `json:"I,omitempty"` + J uint32 `json:"J,omitempty"` + K uint64 `json:"K,omitempty"` + L bool `json:"L,omitempty"` + M map[string]int `json:"M,omitempty"` + N map[string]ExternalTestType2 `json:"N,omitempty"` + O *ExternalTestType2 `json:"O,omitempty"` + P []ExternalTestType2 `json:"Q,omitempty"` +} + +func testLogger(t *testing.T) DebugLogger { + // We don't set logger to eliminate rubbish logs in tests. + // If you want to switch it, simply switch it to: "return t" + return nil +} + func TestConverter_byteSlice(t *testing.T) { - c := NewConverter() + c := NewConverter(DefaultNameFunc) src := []byte{1, 2, 3} dest := []byte{} err := c.Convert(&src, &dest, 0, nil) @@ -40,7 +110,7 @@ func TestConverter_byteSlice(t *testing.T) { } func TestConverter_MismatchedTypes(t *testing.T) { - c := NewConverter() + c := NewConverter(DefaultNameFunc) err := c.RegisterConversionFunc( func(in *[]string, out *int, s Scope) error { @@ -76,8 +146,8 @@ func TestConverter_DefaultConvert(t *testing.T) { Bar string Baz int } - c := NewConverter() - c.Debug = t + c := NewConverter(DefaultNameFunc) + c.Debug = testLogger(t) c.nameFunc = func(t reflect.Type) string { return "MyType" } // Ensure conversion funcs can call DefaultConvert to get default behavior, @@ -115,8 +185,8 @@ func TestConverter_DeepCopy(t *testing.T) { Baz interface{} Qux map[string]string } - c := NewConverter() - c.Debug = t + c := NewConverter(DefaultNameFunc) + c.Debug = testLogger(t) foo, baz := "foo", "baz" x := A{ @@ -158,8 +228,8 @@ func TestConverter_CallsRegisteredFunctions(t *testing.T) { Baz int } type C struct{} - c := NewConverter() - c.Debug = t + c := NewConverter(DefaultNameFunc) + c.Debug = testLogger(t) err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error { out.Bar = in.Foo return s.Convert(&in.Baz, &out.Baz, 0) @@ -215,10 +285,59 @@ func TestConverter_CallsRegisteredFunctions(t *testing.T) { } } +func TestConverter_IgnoredConversion(t *testing.T) { + type A struct{} + type B struct{} + + count := 0 + c := NewConverter(DefaultNameFunc) + if err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error { + count++ + return nil + }); err != nil { + t.Fatalf("unexpected error %v", err) + } + if err := c.RegisterIgnoredConversion(&A{}, &B{}); err != nil { + t.Fatal(err) + } + a := A{} + b := B{} + if err := c.Convert(&a, &b, 0, nil); err != nil { + t.Errorf("%v", err) + } + if count != 0 { + t.Errorf("unexpected number of conversion invocations") + } +} + +func TestConverter_IgnoredConversionNested(t *testing.T) { + type C string + type A struct { + C C + } + type B struct { + C C + } + + c := NewConverter(DefaultNameFunc) + typed := C("") + if err := c.RegisterIgnoredConversion(&typed, &typed); err != nil { + t.Fatal(err) + } + a := A{C: C("test")} + b := B{C: C("other")} + if err := c.Convert(&a, &b, AllowDifferentFieldTypeNames, nil); err != nil { + t.Errorf("%v", err) + } + if b.C != C("other") { + t.Errorf("expected no conversion of field C: %#v", b) + } +} + func TestConverter_GeneratedConversionOverriden(t *testing.T) { type A struct{} type B struct{} - c := NewConverter() + c := NewConverter(DefaultNameFunc) if err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error { return nil }); err != nil { @@ -237,14 +356,45 @@ func TestConverter_GeneratedConversionOverriden(t *testing.T) { } } +func TestConverter_WithConversionOverriden(t *testing.T) { + type A struct{} + type B struct{} + c := NewConverter(DefaultNameFunc) + if err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error { + return fmt.Errorf("conversion function should be overriden") + }); err != nil { + t.Fatalf("unexpected error %v", err) + } + if err := c.RegisterGeneratedConversionFunc(func(in *A, out *B, s Scope) error { + return fmt.Errorf("generated function should be overriden") + }); err != nil { + t.Fatalf("unexpected error %v", err) + } + + ext := NewConversionFuncs() + ext.Add(func(in *A, out *B, s Scope) error { + return nil + }) + newc := c.WithConversions(ext) + + a := A{} + b := B{} + if err := c.Convert(&a, &b, 0, nil); err == nil || err.Error() != "conversion function should be overriden" { + t.Errorf("unexpected error: %v", err) + } + if err := newc.Convert(&a, &b, 0, nil); err != nil { + t.Errorf("%v", err) + } +} + func TestConverter_MapsStringArrays(t *testing.T) { type A struct { Foo string Baz int Other string } - c := NewConverter() - c.Debug = t + c := NewConverter(DefaultNameFunc) + c.Debug = testLogger(t) if err := c.RegisterConversionFunc(func(input *[]string, out *string, s Scope) error { if len(*input) == 0 { *out = "" @@ -296,8 +446,8 @@ func TestConverter_MapsStringArraysWithMappingKey(t *testing.T) { Baz int Other string } - c := NewConverter() - c.Debug = t + c := NewConverter(DefaultNameFunc) + c.Debug = testLogger(t) if err := c.RegisterConversionFunc(func(input *[]string, out *string, s Scope) error { if len(*input) == 0 { *out = "" @@ -346,7 +496,7 @@ func TestConverter_fuzz(t *testing.T) { } f := fuzz.New().NilChance(.5).NumElements(0, 100) - c := NewConverter() + c := NewConverter(DefaultNameFunc) c.nameFunc = func(t reflect.Type) string { // Hide the fact that we don't have separate packages for these things. return map[reflect.Type]string{ @@ -356,7 +506,7 @@ func TestConverter_fuzz(t *testing.T) { reflect.TypeOf(ExternalTestType2{}): "TestType2", }[t] } - c.Debug = t + c.Debug = testLogger(t) for i, item := range table { for j := 0; j < *fuzzIters; j++ { @@ -385,8 +535,8 @@ func TestConverter_MapElemAddr(t *testing.T) { type Bar struct { A map[string]string } - c := NewConverter() - c.Debug = t + c := NewConverter(DefaultNameFunc) + c.Debug = testLogger(t) err := c.RegisterConversionFunc( func(in *int, out *string, s Scope) error { *out = fmt.Sprintf("%v", *in) @@ -431,8 +581,8 @@ func TestConverter_tags(t *testing.T) { type Bar struct { A string `test:"bar"` } - c := NewConverter() - c.Debug = t + c := NewConverter(DefaultNameFunc) + c.Debug = testLogger(t) err := c.RegisterConversionFunc( func(in *string, out *string, s Scope) error { if e, a := "foo", s.SrcTag().Get("test"); e != a { @@ -456,8 +606,8 @@ func TestConverter_tags(t *testing.T) { func TestConverter_meta(t *testing.T) { type Foo struct{ A string } type Bar struct{ A string } - c := NewConverter() - c.Debug = t + c := NewConverter(DefaultNameFunc) + c.Debug = testLogger(t) checks := 0 err := c.RegisterConversionFunc( func(in *Foo, out *Bar, s Scope) error { @@ -565,8 +715,8 @@ func TestConverter_flags(t *testing.T) { }, } f := fuzz.New().NilChance(.5).NumElements(0, 100) - c := NewConverter() - c.Debug = t + c := NewConverter(DefaultNameFunc) + c.Debug = testLogger(t) for i, item := range table { for j := 0; j < *fuzzIters; j++ { @@ -603,7 +753,7 @@ func TestConverter_FieldRename(t *testing.T) { NameMeta } - c := NewConverter() + c := NewConverter(DefaultNameFunc) err := c.SetStructFieldCopy(WeirdMeta{}, "WeirdMeta", TypeMeta{}, "TypeMeta") if err != nil { t.Fatalf("unexpected error %v", err) @@ -620,7 +770,7 @@ func TestConverter_FieldRename(t *testing.T) { if err != nil { t.Fatalf("unexpected error %v", err) } - c.Debug = t + c.Debug = testLogger(t) aVal := &A{ WeirdMeta: WeirdMeta{ @@ -675,3 +825,23 @@ func TestConverter_FieldRename(t *testing.T) { } } } + +func objDiff(a, b interface{}) string { + ab, err := json.Marshal(a) + if err != nil { + panic("a") + } + bb, err := json.Marshal(b) + if err != nil { + panic("b") + } + return util.StringDiff(string(ab), string(bb)) + + // An alternate diff attempt, in case json isn't showing you + // the difference. (reflect.DeepEqual makes a distinction between + // nil and empty slices, for example.) + //return util.StringDiff( + // fmt.Sprintf("%#v", a), + // fmt.Sprintf("%#v", b), + //) +} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/decode.go b/vendor/k8s.io/kubernetes/pkg/conversion/decode.go deleted file mode 100644 index b6a5da5ed..000000000 --- a/vendor/k8s.io/kubernetes/pkg/conversion/decode.go +++ /dev/null @@ -1,152 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package conversion - -import ( - "errors" - "fmt" - "github.com/ugorji/go/codec" -) - -func (s *Scheme) DecodeToVersionedObject(data []byte) (obj interface{}, version, kind string, err error) { - version, kind, err = s.DataVersionAndKind(data) - if err != nil { - return - } - if version == "" && s.InternalVersion != "" { - return nil, "", "", fmt.Errorf("version not set in '%s'", string(data)) - } - if kind == "" { - return nil, "", "", fmt.Errorf("kind not set in '%s'", string(data)) - } - obj, err = s.NewObject(version, kind) - if err != nil { - return nil, "", "", err - } - - if err := codec.NewDecoderBytes(data, new(codec.JsonHandle)).Decode(obj); err != nil { - return nil, "", "", err - } - return -} - -// Decode converts a JSON string back into a pointer to an api object. -// Deduces the type based upon the fields added by the MetaInsertionFactory -// technique. The object will be converted, if necessary, into the -// s.InternalVersion type before being returned. Decode will not decode -// objects without version set unless InternalVersion is also "". -func (s *Scheme) Decode(data []byte) (interface{}, error) { - return s.DecodeToVersion(data, s.InternalVersion) -} - -// DecodeToVersion converts a JSON string back into a pointer to an api object. -// Deduces the type based upon the fields added by the MetaInsertionFactory -// technique. The object will be converted, if necessary, into the versioned -// type before being returned. Decode will not decode objects without version -// set unless version is also "". -func (s *Scheme) DecodeToVersion(data []byte, version string) (interface{}, error) { - obj, sourceVersion, kind, err := s.DecodeToVersionedObject(data) - if err != nil { - return nil, err - } - // Version and Kind should be blank in memory. - if err := s.SetVersionAndKind("", "", obj); err != nil { - return nil, err - } - - // Convert if needed. - if version != sourceVersion { - objOut, err := s.NewObject(version, kind) - if err != nil { - return nil, err - } - flags, meta := s.generateConvertMeta(sourceVersion, version, obj) - if err := s.converter.Convert(obj, objOut, flags, meta); err != nil { - return nil, err - } - obj = objOut - } - return obj, nil -} - -// DecodeInto parses a JSON string and stores it in obj. Returns an error -// if data.Kind is set and doesn't match the type of obj. Obj should be a -// pointer to an api type. -// If obj's version doesn't match that in data, an attempt will be made to convert -// data into obj's version. -func (s *Scheme) DecodeInto(data []byte, obj interface{}) error { - return s.DecodeIntoWithSpecifiedVersionKind(data, obj, "", "") -} - -// DecodeIntoWithSpecifiedVersionKind compares the passed in specifiedVersion and -// specifiedKind with data.Version and data.Kind, defaulting data.Version and -// data.Kind to the specified value if they are empty, or generating an error if -// data.Version and data.Kind are not empty and differ from the specified value. -// The function then implements the functionality of DecodeInto. -// If specifiedVersion and specifiedKind are empty, the function degenerates to -// DecodeInto. -func (s *Scheme) DecodeIntoWithSpecifiedVersionKind(data []byte, obj interface{}, specifiedVersion, specifiedKind string) error { - if len(data) == 0 { - return errors.New("empty input") - } - dataVersion, dataKind, err := s.DataVersionAndKind(data) - if err != nil { - return err - } - if dataVersion == "" { - dataVersion = specifiedVersion - } - if dataKind == "" { - dataKind = specifiedKind - } - if len(specifiedVersion) > 0 && (dataVersion != specifiedVersion) { - return errors.New(fmt.Sprintf("The apiVersion in the data (%s) does not match the specified apiVersion(%s)", dataVersion, specifiedVersion)) - } - if len(specifiedKind) > 0 && (dataKind != specifiedKind) { - return errors.New(fmt.Sprintf("The kind in the data (%s) does not match the specified kind(%s)", dataKind, specifiedKind)) - } - - objVersion, objKind, err := s.ObjectVersionAndKind(obj) - if err != nil { - return err - } - if dataKind == "" { - // Assume objects with unset Kind fields are being unmarshalled into the - // correct type. - dataKind = objKind - } - if dataVersion == "" { - // Assume objects with unset Version fields are being unmarshalled into the - // correct type. - dataVersion = objVersion - } - - external, err := s.NewObject(dataVersion, dataKind) - if err != nil { - return err - } - if err := codec.NewDecoderBytes(data, new(codec.JsonHandle)).Decode(external); err != nil { - return err - } - flags, meta := s.generateConvertMeta(dataVersion, objVersion, external) - if err := s.converter.Convert(external, obj, flags, meta); err != nil { - return err - } - - // Version and Kind should be blank in memory. - return s.SetVersionAndKind("", "", obj) -} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/doc.go b/vendor/k8s.io/kubernetes/pkg/conversion/doc.go index f0626a569..3ef2eaba4 100644 --- a/vendor/k8s.io/kubernetes/pkg/conversion/doc.go +++ b/vendor/k8s.io/kubernetes/pkg/conversion/doc.go @@ -14,18 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package conversion provides go object versioning and encoding/decoding -// mechanisms. +// Package conversion provides go object versioning. // // Specifically, conversion provides a way for you to define multiple versions // of the same object. You may write functions which implement conversion logic, // but for the fields which did not change, copying is automated. This makes it // easy to modify the structures you use in memory without affecting the format // you store on disk or respond to in your external API calls. -// -// The second offering of this package is automated encoding/decoding. The version -// and type of the object is recorded in the output, so it can be recreated upon -// reading. Currently, conversion writes JSON output, and interprets both JSON -// and YAML input. -// package conversion diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/encode.go b/vendor/k8s.io/kubernetes/pkg/conversion/encode.go deleted file mode 100644 index 7e1b82445..000000000 --- a/vendor/k8s.io/kubernetes/pkg/conversion/encode.go +++ /dev/null @@ -1,147 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package conversion - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "path" -) - -// EncodeToVersion turns the given api object into an appropriate JSON string. -// Obj may be a pointer to a struct, or a struct. If a struct, a copy -// will be made, therefore it's recommended to pass a pointer to a -// struct. The type must have been registered. -// -// Memory/wire format differences: -// * Having to keep track of the Kind and Version fields makes tests -// very annoying, so the rule is that they are set only in wire format -// (json), not when in native (memory) format. This is possible because -// both pieces of information are implicit in the go typed object. -// * An exception: note that, if there are embedded API objects of known -// type, for example, PodList{... Items []Pod ...}, these embedded -// objects must be of the same version of the object they are embedded -// within, and their Version and Kind must both be empty. -// * Note that the exception does not apply to a generic APIObject type -// which recursively does Encode()/Decode(), and is capable of -// expressing any API object. -// * Only versioned objects should be encoded. This means that, if you pass -// a native object, Encode will convert it to a versioned object. For -// example, an api.Pod will get converted to a v1beta1.Pod. However, if -// you pass in an object that's already versioned (v1beta1.Pod), Encode -// will not modify it. -// -// The purpose of the above complex conversion behavior is to allow us to -// change the memory format yet not break compatibility with any stored -// objects, whether they be in our storage layer (e.g., etcd), or in user's -// config files. -// -func (s *Scheme) EncodeToVersion(obj interface{}, destVersion string) (data []byte, err error) { - buff := &bytes.Buffer{} - if err := s.EncodeToVersionStream(obj, destVersion, buff); err != nil { - return nil, err - } - return buff.Bytes(), nil -} - -func (s *Scheme) EncodeToVersionStream(obj interface{}, destVersion string, stream io.Writer) error { - obj = maybeCopy(obj) - v, _ := EnforcePtr(obj) // maybeCopy guarantees a pointer - - // Don't encode an object defined in the unversioned package, unless if the - // destVersion is v1, encode it to v1 for backward compatibility. - pkg := path.Base(v.Type().PkgPath()) - if pkg == "unversioned" && destVersion != "v1" { - // TODO: convert this to streaming too - data, err := s.encodeUnversionedObject(obj) - if err != nil { - return err - } - _, err = stream.Write(data) - return err - } - - if _, registered := s.typeToVersion[v.Type()]; !registered { - return fmt.Errorf("type %v is not registered for %q and it will be impossible to Decode it, therefore Encode will refuse to encode it.", v.Type(), destVersion) - } - - objVersion, objKind, err := s.ObjectVersionAndKind(obj) - if err != nil { - return err - } - - // Perform a conversion if necessary. - if objVersion != destVersion { - objOut, err := s.NewObject(destVersion, objKind) - if err != nil { - return err - } - flags, meta := s.generateConvertMeta(objVersion, destVersion, obj) - err = s.converter.Convert(obj, objOut, flags, meta) - if err != nil { - return err - } - obj = objOut - } - - // ensure the output object name comes from the destination type - _, objKind, err = s.ObjectVersionAndKind(obj) - if err != nil { - return err - } - - // Version and Kind should be set on the wire. - err = s.SetVersionAndKind(destVersion, objKind, obj) - if err != nil { - return err - } - - // To add metadata, do some simple surgery on the JSON. - encoder := json.NewEncoder(stream) - if err := encoder.Encode(obj); err != nil { - return err - } - - // Version and Kind should be blank in memory. Reset them, since it's - // possible that we modified a user object and not a copy above. - err = s.SetVersionAndKind("", "", obj) - if err != nil { - return err - } - - return nil -} - -func (s *Scheme) encodeUnversionedObject(obj interface{}) (data []byte, err error) { - _, objKind, err := s.ObjectVersionAndKind(obj) - if err != nil { - return nil, err - } - if err = s.SetVersionAndKind("", objKind, obj); err != nil { - return nil, err - } - data, err = json.Marshal(obj) - if err != nil { - return nil, err - } - // Version and Kind should be blank in memory. Reset them, since it's - // possible that we modified a user object and not a copy above. - err = s.SetVersionAndKind("", "", obj) - return data, nil -} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/error.go b/vendor/k8s.io/kubernetes/pkg/conversion/error.go deleted file mode 100644 index fc62e842f..000000000 --- a/vendor/k8s.io/kubernetes/pkg/conversion/error.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package conversion - -import ( - "fmt" - "reflect" -) - -type notRegisteredErr struct { - kind string - version string - t reflect.Type -} - -func (k *notRegisteredErr) Error() string { - if k.t != nil { - return fmt.Sprintf("no kind is registered for the type %v", k.t) - } - if len(k.kind) == 0 { - return fmt.Sprintf("no version %q has been registered", k.version) - } - if len(k.version) == 0 { - return fmt.Sprintf("no kind %q is registered for the default version", k.kind) - } - return fmt.Sprintf("no kind %q is registered for version %q", k.kind, k.version) -} - -// IsNotRegisteredError returns true if the error indicates the provided -// object or input data is not registered. -func IsNotRegisteredError(err error) bool { - if err == nil { - return false - } - _, ok := err.(*notRegisteredErr) - return ok -} - -type missingKindErr struct { - data string -} - -func NewMissingKindErr(data string) error { - return &missingKindErr{data} -} - -func (k *missingKindErr) Error() string { - return fmt.Sprintf("Object 'Kind' is missing in '%s'", k.data) -} - -func IsMissingKind(err error) bool { - if err == nil { - return false - } - _, ok := err.(*missingKindErr) - return ok -} - -type missingVersionErr struct { - data string -} - -func NewMissingVersionErr(data string) error { - return &missingVersionErr{data} -} - -func (k *missingVersionErr) Error() string { - return fmt.Sprintf("Object 'apiVersion' is missing in '%s'", k.data) -} - -func IsMissingVersion(err error) bool { - if err == nil { - return false - } - _, ok := err.(*missingVersionErr) - return ok -} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/helper.go b/vendor/k8s.io/kubernetes/pkg/conversion/helper.go new file mode 100644 index 000000000..39f782659 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/conversion/helper.go @@ -0,0 +1,39 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conversion + +import ( + "fmt" + "reflect" +) + +// EnforcePtr ensures that obj is a pointer of some sort. Returns a reflect.Value +// of the dereferenced pointer, ensuring that it is settable/addressable. +// Returns an error if this is not possible. +func EnforcePtr(obj interface{}) (reflect.Value, error) { + v := reflect.ValueOf(obj) + if v.Kind() != reflect.Ptr { + if v.Kind() == reflect.Invalid { + return reflect.Value{}, fmt.Errorf("expected pointer, but got invalid kind") + } + return reflect.Value{}, fmt.Errorf("expected pointer, but got %v type", v.Type()) + } + if v.IsNil() { + return reflect.Value{}, fmt.Errorf("expected pointer, but got nil") + } + return v.Elem(), nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/helper_test.go b/vendor/k8s.io/kubernetes/pkg/conversion/helper_test.go new file mode 100644 index 000000000..69fef3334 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/conversion/helper_test.go @@ -0,0 +1,38 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conversion + +import "testing" + +func TestInvalidPtrValueKind(t *testing.T) { + var simple interface{} + switch obj := simple.(type) { + default: + _, err := EnforcePtr(obj) + if err == nil { + t.Errorf("Expected error on invalid kind") + } + } +} + +func TestEnforceNilPtr(t *testing.T) { + var nilPtr *struct{} + _, err := EnforcePtr(nilPtr) + if err == nil { + t.Errorf("Expected error on nil pointer") + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/meta.go b/vendor/k8s.io/kubernetes/pkg/conversion/meta.go deleted file mode 100644 index 1488570f3..000000000 --- a/vendor/k8s.io/kubernetes/pkg/conversion/meta.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package conversion - -import ( - "encoding/json" - "fmt" - "path" - "reflect" -) - -// MetaFactory is used to store and retrieve the version and kind -// information for all objects in a scheme. -type MetaFactory interface { - // Update sets the given version and kind onto the object. - Update(version, kind string, obj interface{}) error - // Interpret should return the version and kind of the wire-format of - // the object. - Interpret(data []byte) (version, kind string, err error) -} - -// DefaultMetaFactory is a default factory for versioning objects in JSON. The object -// in memory and in the default JSON serialization will use the "kind" and "apiVersion" -// fields. -var DefaultMetaFactory = SimpleMetaFactory{KindField: "Kind", VersionField: "APIVersion"} - -// SimpleMetaFactory provides default methods for retrieving the type and version of objects -// that are identified with an "apiVersion" and "kind" fields in their JSON -// serialization. It may be parameterized with the names of the fields in memory, or an -// optional list of base structs to search for those fields in memory. -type SimpleMetaFactory struct { - // The name of the API version field in memory of the struct - VersionField string - // The name of the kind field in memory of the struct. - KindField string - // Optional, if set will look in the named inline structs to find the fields to set. - BaseFields []string -} - -// Interpret will return the APIVersion and Kind of the JSON wire-format -// encoding of an object, or an error. -func (SimpleMetaFactory) Interpret(data []byte) (version, kind string, err error) { - findKind := struct { - APIVersion string `json:"apiVersion,omitempty"` - Kind string `json:"kind,omitempty"` - }{} - err = json.Unmarshal(data, &findKind) - if err != nil { - return "", "", fmt.Errorf("couldn't get version/kind; json parse error: %v", err) - } - return findKind.APIVersion, findKind.Kind, nil -} - -func (f SimpleMetaFactory) Update(version, kind string, obj interface{}) error { - return UpdateVersionAndKind(f.BaseFields, f.VersionField, version, f.KindField, kind, obj) -} - -// UpdateVersionAndKind uses reflection to find and set the versionField and kindField fields -// on a pointer to a struct to version and kind. Provided as a convenience for others -// implementing MetaFactory. Pass an array to baseFields to check one or more nested structs -// for the named fields. The version field is treated as optional if it is not present in the struct. -func UpdateVersionAndKind(baseFields []string, versionField, version, kindField, kind string, obj interface{}) error { - v, err := EnforcePtr(obj) - if err != nil { - return err - } - pkg := path.Base(v.Type().PkgPath()) - t := v.Type() - name := t.Name() - if v.Kind() != reflect.Struct { - return fmt.Errorf("expected struct, but got %v: %v (%#v)", v.Kind(), name, v.Interface()) - } - - for i := range baseFields { - base := v.FieldByName(baseFields[i]) - if !base.IsValid() { - continue - } - v = base - } - - field := v.FieldByName(kindField) - if !field.IsValid() { - // Types defined in the unversioned package are allowed to not have a - // kindField. Clients will have to know what they are based on the - // context. - // TODO: add some type trait here, or some way of indicating whether - // this feature is allowed on a per-type basis. Using package name is - // overly broad and a bit hacky. - if pkg == "unversioned" { - return nil - } - return fmt.Errorf("couldn't find %v field in %#v", kindField, v.Interface()) - } - field.SetString(kind) - - if field := v.FieldByName(versionField); field.IsValid() { - field.SetString(version) - } - - return nil -} - -// EnforcePtr ensures that obj is a pointer of some sort. Returns a reflect.Value -// of the dereferenced pointer, ensuring that it is settable/addressable. -// Returns an error if this is not possible. -func EnforcePtr(obj interface{}) (reflect.Value, error) { - v := reflect.ValueOf(obj) - if v.Kind() != reflect.Ptr { - if v.Kind() == reflect.Invalid { - return reflect.Value{}, fmt.Errorf("expected pointer, but got invalid kind") - } - return reflect.Value{}, fmt.Errorf("expected pointer, but got %v type", v.Type()) - } - if v.IsNil() { - return reflect.Value{}, fmt.Errorf("expected pointer, but got nil") - } - return v.Elem(), nil -} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/meta_test.go b/vendor/k8s.io/kubernetes/pkg/conversion/meta_test.go deleted file mode 100644 index 452ea1483..000000000 --- a/vendor/k8s.io/kubernetes/pkg/conversion/meta_test.go +++ /dev/null @@ -1,285 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package conversion - -import ( - "fmt" - "reflect" - "testing" - - "k8s.io/kubernetes/pkg/api/unversioned" -) - -func TestSimpleMetaFactoryInterpret(t *testing.T) { - factory := SimpleMetaFactory{} - version, kind, err := factory.Interpret([]byte(`{"apiVersion":"1","kind":"object"}`)) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - if version != "1" || kind != "object" { - t.Errorf("unexpected interpret: %s %s", version, kind) - } - - // no kind or version - version, kind, err = factory.Interpret([]byte(`{}`)) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - if version != "" || kind != "" { - t.Errorf("unexpected interpret: %s %s", version, kind) - } - - // unparsable - version, kind, err = factory.Interpret([]byte(`{`)) - if err == nil { - t.Errorf("unexpected non-error") - } -} - -func TestSimpleMetaFactoryUpdate(t *testing.T) { - factory := SimpleMetaFactory{VersionField: "V", KindField: "K"} - - obj := struct { - V string - K string - }{"1", "2"} - - // must pass a pointer - if err := factory.Update("test", "other", obj); err == nil { - t.Errorf("unexpected non-error") - } - if obj.V != "1" || obj.K != "2" { - t.Errorf("unexpected update: %v", obj) - } - - // updates - if err := factory.Update("test", "other", &obj); err != nil { - t.Fatalf("unexpected error: %v", err) - } - if obj.V != "test" || obj.K != "other" { - t.Errorf("unexpected update: %v", obj) - } -} - -// Test Updating objects that don't have a Kind field. -func TestSimpleMetaFactoryUpdateNoKindField(t *testing.T) { - factory := SimpleMetaFactory{VersionField: "APIVersion", KindField: "Kind"} - // obj does not have a Kind field and is not defined in the unversioned package. - obj := struct { - SomeField string - }{"1"} - expectedError := fmt.Errorf("couldn't find %v field in %#v", factory.KindField, obj) - if err := factory.Update("test", "other", &obj); err == nil || expectedError.Error() != err.Error() { - t.Fatalf("expected error: %v, got: %v", expectedError, err) - } - - // ListMeta does not have a Kind field, but is defined in the unversioned package. - listMeta := unversioned.ListMeta{} - if err := factory.Update("test", "other", &listMeta); err != nil { - t.Fatalf("unexpected error: %v", err) - } -} - -func TestSimpleMetaFactoryUpdateStruct(t *testing.T) { - factory := SimpleMetaFactory{BaseFields: []string{"Test"}, VersionField: "V", KindField: "K"} - - type Inner struct { - V string - K string - } - obj := struct { - Test Inner - }{Test: Inner{"1", "2"}} - - // updates - if err := factory.Update("test", "other", &obj); err != nil { - t.Fatalf("unexpected error: %v", err) - } - if obj.Test.V != "test" || obj.Test.K != "other" { - t.Errorf("unexpected update: %v", obj) - } -} - -func TestMetaValues(t *testing.T) { - type InternalSimple struct { - APIVersion string `json:"apiVersion,omitempty"` - Kind string `json:"kind,omitempty"` - TestString string `json:"testString"` - } - type ExternalSimple struct { - APIVersion string `json:"apiVersion,omitempty"` - Kind string `json:"kind,omitempty"` - TestString string `json:"testString"` - } - s := NewScheme() - s.AddKnownTypeWithName("", "Simple", &InternalSimple{}) - s.AddKnownTypeWithName("externalVersion", "Simple", &ExternalSimple{}) - - internalToExternalCalls := 0 - externalToInternalCalls := 0 - - // Register functions to verify that scope.Meta() gets set correctly. - err := s.AddConversionFuncs( - func(in *InternalSimple, out *ExternalSimple, scope Scope) error { - t.Logf("internal -> external") - if e, a := "", scope.Meta().SrcVersion; e != a { - t.Fatalf("Expected '%v', got '%v'", e, a) - } - if e, a := "externalVersion", scope.Meta().DestVersion; e != a { - t.Fatalf("Expected '%v', got '%v'", e, a) - } - scope.Convert(&in.TestString, &out.TestString, 0) - internalToExternalCalls++ - return nil - }, - func(in *ExternalSimple, out *InternalSimple, scope Scope) error { - t.Logf("external -> internal") - if e, a := "externalVersion", scope.Meta().SrcVersion; e != a { - t.Errorf("Expected '%v', got '%v'", e, a) - } - if e, a := "", scope.Meta().DestVersion; e != a { - t.Fatalf("Expected '%v', got '%v'", e, a) - } - scope.Convert(&in.TestString, &out.TestString, 0) - externalToInternalCalls++ - return nil - }, - ) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - simple := &InternalSimple{ - TestString: "foo", - } - - s.Log(t) - - // Test Encode, Decode, and DecodeInto - data, err := s.EncodeToVersion(simple, "externalVersion") - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - - t.Logf(string(data)) - obj2, err := s.Decode(data) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - if _, ok := obj2.(*InternalSimple); !ok { - t.Fatalf("Got wrong type") - } - if e, a := simple, obj2; !reflect.DeepEqual(e, a) { - t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a) - } - - obj3 := &InternalSimple{} - if err := s.DecodeInto(data, obj3); err != nil { - t.Fatalf("unexpected error: %v", err) - } - if e, a := simple, obj3; !reflect.DeepEqual(e, a) { - t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a) - } - - // Test Convert - external := &ExternalSimple{} - err = s.Convert(simple, external) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if e, a := simple.TestString, external.TestString; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - - // Encode and Convert should each have caused an increment. - if e, a := 2, internalToExternalCalls; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - // Decode and DecodeInto should each have caused an increment. - if e, a := 2, externalToInternalCalls; e != a { - t.Errorf("Expected %v, got %v", e, a) - } -} - -func TestMetaValuesUnregisteredConvert(t *testing.T) { - type InternalSimple struct { - Version string `json:"apiVersion,omitempty"` - Kind string `json:"kind,omitempty"` - TestString string `json:"testString"` - } - type ExternalSimple struct { - Version string `json:"apiVersion,omitempty"` - Kind string `json:"kind,omitempty"` - TestString string `json:"testString"` - } - s := NewScheme() - s.InternalVersion = "" - // We deliberately don't register the types. - - internalToExternalCalls := 0 - - // Register functions to verify that scope.Meta() gets set correctly. - err := s.AddConversionFuncs( - func(in *InternalSimple, out *ExternalSimple, scope Scope) error { - if e, a := "unknown", scope.Meta().SrcVersion; e != a { - t.Fatalf("Expected '%v', got '%v'", e, a) - } - if e, a := "unknown", scope.Meta().DestVersion; e != a { - t.Fatalf("Expected '%v', got '%v'", e, a) - } - scope.Convert(&in.TestString, &out.TestString, 0) - internalToExternalCalls++ - return nil - }, - ) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - - simple := &InternalSimple{TestString: "foo"} - external := &ExternalSimple{} - err = s.Convert(simple, external) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if e, a := simple.TestString, external.TestString; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - - // Verify that our conversion handler got called. - if e, a := 1, internalToExternalCalls; e != a { - t.Errorf("Expected %v, got %v", e, a) - } -} - -func TestInvalidPtrValueKind(t *testing.T) { - var simple interface{} - switch obj := simple.(type) { - default: - _, err := EnforcePtr(obj) - if err == nil { - t.Errorf("Expected error on invalid kind") - } - } -} - -func TestEnforceNilPtr(t *testing.T) { - var nilPtr *struct{} - _, err := EnforcePtr(nilPtr) - if err == nil { - t.Errorf("Expected error on nil pointer") - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/queryparams/convert.go b/vendor/k8s.io/kubernetes/pkg/conversion/queryparams/convert.go index 450a43001..0f04e7bb4 100644 --- a/vendor/k8s.io/kubernetes/pkg/conversion/queryparams/convert.go +++ b/vendor/k8s.io/kubernetes/pkg/conversion/queryparams/convert.go @@ -21,8 +21,6 @@ import ( "net/url" "reflect" "strings" - - "k8s.io/kubernetes/pkg/runtime" ) func jsonTag(field reflect.StructField) (string, bool) { @@ -93,10 +91,10 @@ func addListOfParams(values url.Values, tag string, omitempty bool, list reflect } } -// Convert takes a versioned runtime.Object and serializes it to a url.Values object -// using JSON tags as parameter names. Only top-level simple values, arrays, and slices -// are serialized. Embedded structs, maps, etc. will not be serialized. -func Convert(obj runtime.Object) (url.Values, error) { +// Convert takes an object and converts it to a url.Values object using JSON tags as +// parameter names. Only top-level simple values, arrays, and slices are serialized. +// Embedded structs, maps, etc. will not be serialized. +func Convert(obj interface{}) (url.Values, error) { result := url.Values{} if obj == nil { return result, nil diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/queryparams/convert_test.go b/vendor/k8s.io/kubernetes/pkg/conversion/queryparams/convert_test.go index c409756e4..405357557 100644 --- a/vendor/k8s.io/kubernetes/pkg/conversion/queryparams/convert_test.go +++ b/vendor/k8s.io/kubernetes/pkg/conversion/queryparams/convert_test.go @@ -14,14 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -package queryparams +package queryparams_test import ( "net/url" "reflect" "testing" - "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/conversion/queryparams" ) type namedString string @@ -38,7 +39,7 @@ type bar struct { Ignored2 string } -func (*bar) IsAnAPIObject() {} +func (obj *bar) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } type foo struct { Str string `json:"str"` @@ -51,14 +52,14 @@ type foo struct { Testmap map[string]string `json:"testmap,omitempty"` } -func (*foo) IsAnAPIObject() {} +func (obj *foo) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } type baz struct { Ptr *int `json:"ptr"` Bptr *bool `json:"bptr,omitempty"` } -func (*baz) IsAnAPIObject() {} +func (obj *baz) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } func validateResult(t *testing.T, input interface{}, actual, expected url.Values) { local := url.Values{} @@ -83,7 +84,7 @@ func validateResult(t *testing.T, input interface{}, actual, expected url.Values func TestConvert(t *testing.T) { tests := []struct { - input runtime.Object + input interface{} expected url.Values }{ { @@ -160,7 +161,7 @@ func TestConvert(t *testing.T) { } for _, test := range tests { - result, err := Convert(test.input) + result, err := queryparams.Convert(test.input) if err != nil { t.Errorf("Unexpected error while converting %#v: %v", test.input, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/scheme.go b/vendor/k8s.io/kubernetes/pkg/conversion/scheme.go deleted file mode 100644 index 1906178a9..000000000 --- a/vendor/k8s.io/kubernetes/pkg/conversion/scheme.go +++ /dev/null @@ -1,418 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package conversion - -import ( - "fmt" - "reflect" -) - -// Scheme defines an entire encoding and decoding scheme. -type Scheme struct { - // versionMap allows one to figure out the go type of an object with - // the given version and name. - versionMap map[string]map[string]reflect.Type - - // typeToVersion allows one to figure out the version for a given go object. - // The reflect.Type we index by should *not* be a pointer. If the same type - // is registered for multiple versions, the last one wins. - typeToVersion map[reflect.Type]string - - // typeToKind allows one to figure out the desired "kind" field for a given - // go object. Requirements and caveats are the same as typeToVersion. - typeToKind map[reflect.Type][]string - - // converter stores all registered conversion functions. It also has - // default coverting behavior. - converter *Converter - - // cloner stores all registered copy functions. It also has default - // deep copy behavior. - cloner *Cloner - - // Indent will cause the JSON output from Encode to be indented, - // if and only if it is true. - Indent bool - - // InternalVersion is the default internal version. It is recommended that - // you use "" for the internal version. - InternalVersion string - - // MetaInsertionFactory is used to create an object to store and retrieve - // the version and kind information for all objects. The default uses the - // keys "apiVersion" and "kind" respectively. - MetaFactory MetaFactory -} - -// NewScheme manufactures a new scheme. -func NewScheme() *Scheme { - s := &Scheme{ - versionMap: map[string]map[string]reflect.Type{}, - typeToVersion: map[reflect.Type]string{}, - typeToKind: map[reflect.Type][]string{}, - converter: NewConverter(), - cloner: NewCloner(), - InternalVersion: "", - MetaFactory: DefaultMetaFactory, - } - s.converter.nameFunc = s.nameFunc - return s -} - -// Log sets a logger on the scheme. For test purposes only -func (s *Scheme) Log(l DebugLogger) { - s.converter.Debug = l -} - -// nameFunc returns the name of the type that we wish to use to determine when two types attempt -// a conversion. Defaults to the go name of the type if the type is not registered. -func (s *Scheme) nameFunc(t reflect.Type) string { - // find the preferred names for this type - names, ok := s.typeToKind[t] - if !ok { - return t.Name() - } - if internal, ok := s.versionMap[""]; ok { - for _, name := range names { - if t, ok := internal[name]; ok { - return s.typeToKind[t][0] - } - } - } - return names[0] -} - -// AddKnownTypes registers all types passed in 'types' as being members of version 'version. -// Encode() will refuse objects unless their type has been registered with AddKnownTypes. -// All objects passed to types should be pointers to structs. The name that go reports for -// the struct becomes the "kind" field when encoding. -func (s *Scheme) AddKnownTypes(version string, types ...interface{}) { - knownTypes, found := s.versionMap[version] - if !found { - knownTypes = map[string]reflect.Type{} - s.versionMap[version] = knownTypes - } - for _, obj := range types { - t := reflect.TypeOf(obj) - if t.Kind() != reflect.Ptr { - panic("All types must be pointers to structs.") - } - t = t.Elem() - if t.Kind() != reflect.Struct { - panic("All types must be pointers to structs.") - } - knownTypes[t.Name()] = t - s.typeToVersion[t] = version - s.typeToKind[t] = append(s.typeToKind[t], t.Name()) - } -} - -// AddKnownTypeWithName is like AddKnownTypes, but it lets you specify what this type should -// be encoded as. Useful for testing when you don't want to make multiple packages to define -// your structs. -func (s *Scheme) AddKnownTypeWithName(version, kind string, obj interface{}) { - knownTypes, found := s.versionMap[version] - if !found { - knownTypes = map[string]reflect.Type{} - s.versionMap[version] = knownTypes - } - t := reflect.TypeOf(obj) - if t.Kind() != reflect.Ptr { - panic("All types must be pointers to structs.") - } - t = t.Elem() - if t.Kind() != reflect.Struct { - panic("All types must be pointers to structs.") - } - knownTypes[kind] = t - s.typeToVersion[t] = version - s.typeToKind[t] = append(s.typeToKind[t], kind) -} - -// KnownTypes returns an array of the types that are known for a particular version. -func (s *Scheme) KnownTypes(version string) map[string]reflect.Type { - all, ok := s.versionMap[version] - if !ok { - return map[string]reflect.Type{} - } - types := make(map[string]reflect.Type) - for k, v := range all { - types[k] = v - } - return types -} - -// NewObject returns a new object of the given version and name, -// or an error if it hasn't been registered. -func (s *Scheme) NewObject(versionName, kind string) (interface{}, error) { - if types, ok := s.versionMap[versionName]; ok { - if t, ok := types[kind]; ok { - return reflect.New(t).Interface(), nil - } - return nil, ¬RegisteredErr{kind: kind, version: versionName} - } - return nil, ¬RegisteredErr{kind: kind, version: versionName} -} - -// AddConversionFuncs adds functions to the list of conversion functions. The given -// functions should know how to convert between two of your API objects, or their -// sub-objects. We deduce how to call these functions from the types of their two -// parameters; see the comment for Converter.Register. -// -// Note that, if you need to copy sub-objects that didn't change, you can use the -// conversion.Scope object that will be passed to your conversion function. -// Additionally, all conversions started by Scheme will set the SrcVersion and -// DestVersion fields on the Meta object. Example: -// -// s.AddConversionFuncs( -// func(in *InternalObject, out *ExternalObject, scope conversion.Scope) error { -// // You can depend on Meta() being non-nil, and this being set to -// // the source version, e.g., "" -// s.Meta().SrcVersion -// // You can depend on this being set to the destination version, -// // e.g., "v1beta1". -// s.Meta().DestVersion -// // Call scope.Convert to copy sub-fields. -// s.Convert(&in.SubFieldThatMoved, &out.NewLocation.NewName, 0) -// return nil -// }, -// ) -// -// (For more detail about conversion functions, see Converter.Register's comment.) -// -// Also note that the default behavior, if you don't add a conversion function, is to -// sanely copy fields that have the same names and same type names. It's OK if the -// destination type has extra fields, but it must not remove any. So you only need to -// add conversion functions for things with changed/removed fields. -func (s *Scheme) AddConversionFuncs(conversionFuncs ...interface{}) error { - for _, f := range conversionFuncs { - if err := s.converter.RegisterConversionFunc(f); err != nil { - return err - } - } - return nil -} - -// Similar to AddConversionFuncs, but registers conversion functions that were -// automatically generated. -func (s *Scheme) AddGeneratedConversionFuncs(conversionFuncs ...interface{}) error { - for _, f := range conversionFuncs { - if err := s.converter.RegisterGeneratedConversionFunc(f); err != nil { - return err - } - } - return nil -} - -// AddDeepCopyFuncs adds functions to the list of deep copy functions. -// Note that to copy sub-objects, you can use the conversion.Cloner object that -// will be passed to your deep-copy function. -func (s *Scheme) AddDeepCopyFuncs(deepCopyFuncs ...interface{}) error { - for _, f := range deepCopyFuncs { - if err := s.cloner.RegisterDeepCopyFunc(f); err != nil { - return err - } - } - return nil -} - -// Similar to AddDeepCopyFuncs, but registers deep copy functions that were -// automatically generated. -func (s *Scheme) AddGeneratedDeepCopyFuncs(deepCopyFuncs ...interface{}) error { - for _, f := range deepCopyFuncs { - if err := s.cloner.RegisterGeneratedDeepCopyFunc(f); err != nil { - return err - } - } - return nil -} - -// AddStructFieldConversion allows you to specify a mechanical copy for a moved -// or renamed struct field without writing an entire conversion function. See -// the comment in Converter.SetStructFieldCopy for parameter details. -// Call as many times as needed, even on the same fields. -func (s *Scheme) AddStructFieldConversion(srcFieldType interface{}, srcFieldName string, destFieldType interface{}, destFieldName string) error { - return s.converter.SetStructFieldCopy(srcFieldType, srcFieldName, destFieldType, destFieldName) -} - -// AddDefaultingFuncs adds functions to the list of default-value functions. -// Each of the given functions is responsible for applying default values -// when converting an instance of a versioned API object into an internal -// API object. These functions do not need to handle sub-objects. We deduce -// how to call these functions from the types of their two parameters. -// -// s.AddDefaultingFuncs( -// func(obj *v1beta1.Pod) { -// if obj.OptionalField == "" { -// obj.OptionalField = "DefaultValue" -// } -// }, -// ) -func (s *Scheme) AddDefaultingFuncs(defaultingFuncs ...interface{}) error { - for _, f := range defaultingFuncs { - err := s.converter.RegisterDefaultingFunc(f) - if err != nil { - return err - } - } - return nil -} - -// Recognizes returns true if the scheme is able to handle the provided version and kind -// of an object. -func (s *Scheme) Recognizes(version, kind string) bool { - m, ok := s.versionMap[version] - if !ok { - return false - } - _, ok = m[kind] - return ok -} - -// RegisterInputDefaults sets the provided field mapping function and field matching -// as the defaults for the provided input type. The fn may be nil, in which case no -// mapping will happen by default. Use this method to register a mechanism for handling -// a specific input type in conversion, such as a map[string]string to structs. -func (s *Scheme) RegisterInputDefaults(in interface{}, fn FieldMappingFunc, defaultFlags FieldMatchingFlags) error { - return s.converter.RegisterInputDefaults(in, fn, defaultFlags) -} - -// Performs a deep copy of the given object. -func (s *Scheme) DeepCopy(in interface{}) (interface{}, error) { - return s.cloner.DeepCopy(in) -} - -// Convert will attempt to convert in into out. Both must be pointers. For easy -// testing of conversion functions. Returns an error if the conversion isn't -// possible. You can call this with types that haven't been registered (for example, -// a to test conversion of types that are nested within registered types), but in -// that case, the conversion.Scope object passed to your conversion functions won't -// have SrcVersion or DestVersion fields set correctly in Meta(). -func (s *Scheme) Convert(in, out interface{}) error { - inVersion := "unknown" - outVersion := "unknown" - if v, _, err := s.ObjectVersionAndKind(in); err == nil { - inVersion = v - } - if v, _, err := s.ObjectVersionAndKind(out); err == nil { - outVersion = v - } - flags, meta := s.generateConvertMeta(inVersion, outVersion, in) - if flags == 0 { - flags = AllowDifferentFieldTypeNames - } - return s.converter.Convert(in, out, flags, meta) -} - -// ConvertToVersion attempts to convert an input object to its matching Kind in another -// version within this scheme. Will return an error if the provided version does not -// contain the inKind (or a mapping by name defined with AddKnownTypeWithName). -func (s *Scheme) ConvertToVersion(in interface{}, outVersion string) (interface{}, error) { - t := reflect.TypeOf(in) - if t.Kind() != reflect.Ptr { - return nil, fmt.Errorf("only pointer types may be converted: %v", t) - } - t = t.Elem() - if t.Kind() != reflect.Struct { - return nil, fmt.Errorf("only pointers to struct types may be converted: %v", t) - } - - kinds, ok := s.typeToKind[t] - if !ok { - return nil, fmt.Errorf("%v cannot be converted into version %q", t, outVersion) - } - outKind := kinds[0] - - inVersion, _, err := s.ObjectVersionAndKind(in) - if err != nil { - return nil, err - } - - out, err := s.NewObject(outVersion, outKind) - if err != nil { - return nil, err - } - - flags, meta := s.generateConvertMeta(inVersion, outVersion, in) - if err := s.converter.Convert(in, out, flags, meta); err != nil { - return nil, err - } - - if err := s.SetVersionAndKind(outVersion, outKind, out); err != nil { - return nil, err - } - - return out, nil -} - -// Converter allows access to the converter for the scheme -func (s *Scheme) Converter() *Converter { - return s.converter -} - -// generateConvertMeta constructs the meta value we pass to Convert. -func (s *Scheme) generateConvertMeta(srcVersion, destVersion string, in interface{}) (FieldMatchingFlags, *Meta) { - t := reflect.TypeOf(in) - return s.converter.inputDefaultFlags[t], &Meta{ - SrcVersion: srcVersion, - DestVersion: destVersion, - KeyNameMapping: s.converter.inputFieldMappingFuncs[t], - } -} - -// DataVersionAndKind will return the APIVersion and Kind of the given wire-format -// encoding of an API Object, or an error. -func (s *Scheme) DataVersionAndKind(data []byte) (version, kind string, err error) { - return s.MetaFactory.Interpret(data) -} - -// ObjectVersionAndKind returns the API version and kind of the go object, -// or an error if it's not a pointer or is unregistered. -func (s *Scheme) ObjectVersionAndKind(obj interface{}) (apiVersion, kind string, err error) { - v, err := EnforcePtr(obj) - if err != nil { - return "", "", err - } - t := v.Type() - version, vOK := s.typeToVersion[t] - kinds, kOK := s.typeToKind[t] - if !vOK || !kOK { - return "", "", ¬RegisteredErr{t: t} - } - apiVersion = version - kind = kinds[0] - return -} - -// SetVersionAndKind sets the version and kind fields (with help from -// MetaInsertionFactory). Returns an error if this isn't possible. obj -// must be a pointer. -func (s *Scheme) SetVersionAndKind(version, kind string, obj interface{}) error { - return s.MetaFactory.Update(version, kind, obj) -} - -// maybeCopy copies obj if it is not a pointer, to get a settable/addressable -// object. Guaranteed to return a pointer. -func maybeCopy(obj interface{}) interface{} { - v := reflect.ValueOf(obj) - if v.Kind() == reflect.Ptr { - return obj - } - v2 := reflect.New(v.Type()) - v2.Elem().Set(v) - return v2.Interface() -} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/aws/aws_credentials.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/aws/aws_credentials.go new file mode 100644 index 000000000..395c438ed --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/aws/aws_credentials.go @@ -0,0 +1,163 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package aws_credentials + +import ( + "encoding/base64" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/ecr" + "github.com/golang/glog" + "k8s.io/kubernetes/pkg/cloudprovider" + "k8s.io/kubernetes/pkg/credentialprovider" +) + +var registryUrls = []string{"*.dkr.ecr.*.amazonaws.com"} + +// awsHandlerLogger is a handler that logs all AWS SDK requests +// Copied from cloudprovider/aws/log_handler.go +func awsHandlerLogger(req *request.Request) { + service := req.ClientInfo.ServiceName + + name := "?" + if req.Operation != nil { + name = req.Operation.Name + } + + glog.V(4).Infof("AWS request: %s %s", service, name) +} + +// An interface for testing purposes. +type tokenGetter interface { + GetAuthorizationToken(input *ecr.GetAuthorizationTokenInput) (*ecr.GetAuthorizationTokenOutput, error) +} + +// The canonical implementation +type ecrTokenGetter struct { + svc *ecr.ECR +} + +func (p *ecrTokenGetter) GetAuthorizationToken(input *ecr.GetAuthorizationTokenInput) (*ecr.GetAuthorizationTokenOutput, error) { + return p.svc.GetAuthorizationToken(input) +} + +// ecrProvider is a DockerConfigProvider that gets and refreshes 12-hour tokens +// from AWS to access ECR. +type ecrProvider struct { + getter tokenGetter +} + +// Not using the package init() function: this module should be initialized only +// if using the AWS cloud provider. This way, we avoid timeouts waiting for a +// non-existent provider. +func Init() { + credentialprovider.RegisterCredentialProvider("aws-ecr-key", + &credentialprovider.CachingDockerConfigProvider{ + Provider: &ecrProvider{}, + // Refresh credentials a little earlier before they expire + Lifetime: 11*time.Hour + 55*time.Minute, + }) +} + +// Enabled implements DockerConfigProvider.Enabled for the AWS token-based implementation. +// For now, it gets activated only if AWS was chosen as the cloud provider. +// TODO: figure how to enable it manually for deployments that are not on AWS but still +// use ECR somehow? +func (p *ecrProvider) Enabled() bool { + provider, err := cloudprovider.GetCloudProvider("aws", nil) + if err != nil { + glog.Errorf("while initializing AWS cloud provider %v", err) + return false + } + if provider == nil { + return false + } + + zones, ok := provider.Zones() + if !ok { + glog.Errorf("couldn't get Zones() interface") + return false + } + zone, err := zones.GetZone() + if err != nil { + glog.Errorf("while getting zone %v", err) + return false + } + if zone.Region == "" { + glog.Errorf("Region information is empty") + return false + } + + getter := &ecrTokenGetter{svc: ecr.New(session.New(&aws.Config{ + Credentials: nil, + Region: &zone.Region, + }))} + getter.svc.Handlers.Sign.PushFrontNamed(request.NamedHandler{ + Name: "k8s/logger", + Fn: awsHandlerLogger, + }) + p.getter = getter + + return true +} + +// Provide implements DockerConfigProvider.Provide, refreshing ECR tokens on demand +func (p *ecrProvider) Provide() credentialprovider.DockerConfig { + cfg := credentialprovider.DockerConfig{} + + // TODO: fill in RegistryIds? + params := &ecr.GetAuthorizationTokenInput{} + output, err := p.getter.GetAuthorizationToken(params) + if err != nil { + glog.Errorf("while requesting ECR authorization token %v", err) + return cfg + } + if output == nil { + glog.Errorf("Got back no ECR token") + return cfg + } + + for _, data := range output.AuthorizationData { + if data.ProxyEndpoint != nil && + data.AuthorizationToken != nil { + decodedToken, err := base64.StdEncoding.DecodeString(aws.StringValue(data.AuthorizationToken)) + if err != nil { + glog.Errorf("while decoding token for endpoint %s %v", data.ProxyEndpoint, err) + return cfg + } + parts := strings.SplitN(string(decodedToken), ":", 2) + user := parts[0] + password := parts[1] + entry := credentialprovider.DockerConfigEntry{ + Username: user, + Password: password, + // ECR doesn't care and Docker is about to obsolete it + Email: "not@val.id", + } + + // Add our entry for each of the supported container registry URLs + for _, k := range registryUrls { + cfg[k] = entry + } + } + } + return cfg +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/aws/aws_credentials_test.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/aws/aws_credentials_test.go new file mode 100644 index 000000000..a07493993 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/aws/aws_credentials_test.go @@ -0,0 +1,108 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package aws_credentials + +import ( + "encoding/base64" + "fmt" + "path" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/ecr" + + "k8s.io/kubernetes/pkg/credentialprovider" +) + +const user = "foo" +const password = "1234567890abcdef" +const email = "not@val.id" + +// Mock implementation +type testTokenGetter struct { + user string + password string + endpoint string +} + +func (p *testTokenGetter) GetAuthorizationToken(input *ecr.GetAuthorizationTokenInput) (*ecr.GetAuthorizationTokenOutput, error) { + + expiration := time.Now().Add(1 * time.Hour) + creds := []byte(fmt.Sprintf("%s:%s", p.user, p.password)) + data := &ecr.AuthorizationData{ + AuthorizationToken: aws.String(base64.StdEncoding.EncodeToString(creds)), + ExpiresAt: &expiration, + ProxyEndpoint: aws.String(p.endpoint), + } + output := &ecr.GetAuthorizationTokenOutput{ + AuthorizationData: []*ecr.AuthorizationData{data}, + } + + return output, nil //p.svc.GetAuthorizationToken(input) +} + +func TestEcrProvide(t *testing.T) { + registry := "123456789012.dkr.ecr.lala-land-1.amazonaws.com" + otherRegistries := []string{"private.registry.com", + "gcr.io", + } + image := "foo/bar" + + provider := &ecrProvider{ + getter: &testTokenGetter{ + user: user, + password: password, + endpoint: registry}, + } + + keyring := &credentialprovider.BasicDockerKeyring{} + keyring.Add(provider.Provide()) + + // Verify that we get the expected username/password combo for + // an ECR image name. + fullImage := path.Join(registry, image) + creds, ok := keyring.Lookup(fullImage) + if !ok { + t.Errorf("Didn't find expected URL: %s", fullImage) + return + } + if len(creds) > 1 { + t.Errorf("Got more hits than expected: %s", creds) + } + val := creds[0] + + if user != val.Username { + t.Errorf("Unexpected username value, want: _token, got: %s", val.Username) + } + if password != val.Password { + t.Errorf("Unexpected password value, want: %s, got: %s", password, val.Password) + } + if email != val.Email { + t.Errorf("Unexpected email value, want: %s, got: %s", email, val.Email) + } + + // Verify that we get an error for other images. + for _, otherRegistry := range otherRegistries { + fullImage = path.Join(otherRegistry, image) + creds, ok = keyring.Lookup(fullImage) + if ok { + t.Errorf("Unexpectedly found image: %s", fullImage) + return + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/config.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/config.go new file mode 100644 index 000000000..f03bd26c3 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/config.go @@ -0,0 +1,255 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package credentialprovider + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "os" + "path/filepath" + "strings" + "sync" + + "github.com/golang/glog" +) + +// DockerConfigJson represents ~/.docker/config.json file info +// see https://github.com/docker/docker/pull/12009 +type DockerConfigJson struct { + Auths DockerConfig `json:"auths"` + HttpHeaders map[string]string `json:"HttpHeaders,omitempty"` +} + +// DockerConfig represents the config file used by the docker CLI. +// This config that represents the credentials that should be used +// when pulling images from specific image repositories. +type DockerConfig map[string]DockerConfigEntry + +type DockerConfigEntry struct { + Username string + Password string + Email string +} + +var ( + preferredPathLock sync.Mutex + preferredPath = "" + workingDirPath = "" + homeDirPath = os.Getenv("HOME") + rootDirPath = "/" + homeJsonDirPath = filepath.Join(homeDirPath, ".docker") + rootJsonDirPath = filepath.Join(rootDirPath, ".docker") + + configFileName = ".dockercfg" + configJsonFileName = "config.json" +) + +func SetPreferredDockercfgPath(path string) { + preferredPathLock.Lock() + defer preferredPathLock.Unlock() + preferredPath = path +} + +func GetPreferredDockercfgPath() string { + preferredPathLock.Lock() + defer preferredPathLock.Unlock() + return preferredPath +} + +func ReadDockerConfigFile() (cfg DockerConfig, err error) { + // Try happy path first - latest config file + dockerConfigJsonLocations := []string{GetPreferredDockercfgPath(), workingDirPath, homeJsonDirPath, rootJsonDirPath} + for _, configPath := range dockerConfigJsonLocations { + absDockerConfigFileLocation, err := filepath.Abs(filepath.Join(configPath, configJsonFileName)) + if err != nil { + glog.Errorf("while trying to canonicalize %s: %v", configPath, err) + continue + } + glog.V(4).Infof("looking for .docker/config.json at %s", absDockerConfigFileLocation) + contents, err := ioutil.ReadFile(absDockerConfigFileLocation) + if os.IsNotExist(err) { + continue + } + if err != nil { + glog.V(4).Infof("while trying to read %s: %v", absDockerConfigFileLocation, err) + continue + } + cfg, err := readDockerConfigJsonFileFromBytes(contents) + if err == nil { + glog.V(4).Infof("found .docker/config.json at %s", absDockerConfigFileLocation) + return cfg, nil + } + } + glog.V(4).Infof("couldn't find valid .docker/config.json after checking in %v", dockerConfigJsonLocations) + + // Can't find latest config file so check for the old one + dockerConfigFileLocations := []string{GetPreferredDockercfgPath(), workingDirPath, homeDirPath, rootDirPath} + for _, configPath := range dockerConfigFileLocations { + absDockerConfigFileLocation, err := filepath.Abs(filepath.Join(configPath, configFileName)) + if err != nil { + glog.Errorf("while trying to canonicalize %s: %v", configPath, err) + continue + } + glog.V(4).Infof("looking for .dockercfg at %s", absDockerConfigFileLocation) + contents, err := ioutil.ReadFile(absDockerConfigFileLocation) + if os.IsNotExist(err) { + continue + } + if err != nil { + glog.V(4).Infof("while trying to read %s: %v", absDockerConfigFileLocation, err) + continue + } + cfg, err := readDockerConfigFileFromBytes(contents) + if err == nil { + glog.V(4).Infof("found .dockercfg at %s", absDockerConfigFileLocation) + return cfg, nil + } + } + return nil, fmt.Errorf("couldn't find valid .dockercfg after checking in %v", dockerConfigFileLocations) +} + +// HttpError wraps a non-StatusOK error code as an error. +type HttpError struct { + StatusCode int + Url string +} + +// Error implements error +func (he *HttpError) Error() string { + return fmt.Sprintf("http status code: %d while fetching url %s", + he.StatusCode, he.Url) +} + +func ReadUrl(url string, client *http.Client, header *http.Header) (body []byte, err error) { + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return nil, err + } + if header != nil { + req.Header = *header + } + resp, err := client.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + glog.V(2).Infof("body of failing http response: %v", resp.Body) + return nil, &HttpError{ + StatusCode: resp.StatusCode, + Url: url, + } + } + + contents, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + return contents, nil +} + +func ReadDockerConfigFileFromUrl(url string, client *http.Client, header *http.Header) (cfg DockerConfig, err error) { + if contents, err := ReadUrl(url, client, header); err != nil { + return nil, err + } else { + return readDockerConfigFileFromBytes(contents) + } +} + +func readDockerConfigFileFromBytes(contents []byte) (cfg DockerConfig, err error) { + if err = json.Unmarshal(contents, &cfg); err != nil { + glog.Errorf("while trying to parse blob %q: %v", contents, err) + return nil, err + } + return +} + +func readDockerConfigJsonFileFromBytes(contents []byte) (cfg DockerConfig, err error) { + var cfgJson DockerConfigJson + if err = json.Unmarshal(contents, &cfgJson); err != nil { + glog.Errorf("while trying to parse blob %q: %v", contents, err) + return nil, err + } + cfg = cfgJson.Auths + return +} + +// dockerConfigEntryWithAuth is used solely for deserializing the Auth field +// into a dockerConfigEntry during JSON deserialization. +type dockerConfigEntryWithAuth struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Email string `json:"email,omitempty"` + Auth string `json:"auth,omitempty"` +} + +func (ident *DockerConfigEntry) UnmarshalJSON(data []byte) error { + var tmp dockerConfigEntryWithAuth + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + ident.Username = tmp.Username + ident.Password = tmp.Password + ident.Email = tmp.Email + + if len(tmp.Auth) == 0 { + return nil + } + + ident.Username, ident.Password, err = decodeDockerConfigFieldAuth(tmp.Auth) + return err +} + +func (ident DockerConfigEntry) MarshalJSON() ([]byte, error) { + toEncode := dockerConfigEntryWithAuth{ident.Username, ident.Password, ident.Email, ""} + toEncode.Auth = encodeDockerConfigFieldAuth(ident.Username, ident.Password) + + return json.Marshal(toEncode) +} + +// decodeDockerConfigFieldAuth deserializes the "auth" field from dockercfg into a +// username and a password. The format of the auth field is base64(:). +func decodeDockerConfigFieldAuth(field string) (username, password string, err error) { + decoded, err := base64.StdEncoding.DecodeString(field) + if err != nil { + return + } + + parts := strings.SplitN(string(decoded), ":", 2) + if len(parts) != 2 { + err = fmt.Errorf("unable to parse auth field") + return + } + + username = parts[0] + password = parts[1] + + return +} + +func encodeDockerConfigFieldAuth(username, password string) string { + fieldValue := username + ":" + password + + return base64.StdEncoding.EncodeToString([]byte(fieldValue)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/config_test.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/config_test.go new file mode 100644 index 000000000..587879fe9 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/config_test.go @@ -0,0 +1,225 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package credentialprovider + +import ( + "encoding/json" + "reflect" + "testing" +) + +func TestDockerConfigJsonJSONDecode(t *testing.T) { + input := []byte(`{"auths": {"http://foo.example.com":{"username": "foo", "password": "bar", "email": "foo@example.com"}, "http://bar.example.com":{"username": "bar", "password": "baz", "email": "bar@example.com"}}}`) + + expect := DockerConfigJson{ + Auths: DockerConfig(map[string]DockerConfigEntry{ + "http://foo.example.com": { + Username: "foo", + Password: "bar", + Email: "foo@example.com", + }, + "http://bar.example.com": { + Username: "bar", + Password: "baz", + Email: "bar@example.com", + }, + }), + } + + var output DockerConfigJson + err := json.Unmarshal(input, &output) + if err != nil { + t.Errorf("Received unexpected error: %v", err) + } + + if !reflect.DeepEqual(expect, output) { + t.Errorf("Received unexpected output. Expected %#v, got %#v", expect, output) + } +} + +func TestDockerConfigJSONDecode(t *testing.T) { + input := []byte(`{"http://foo.example.com":{"username": "foo", "password": "bar", "email": "foo@example.com"}, "http://bar.example.com":{"username": "bar", "password": "baz", "email": "bar@example.com"}}`) + + expect := DockerConfig(map[string]DockerConfigEntry{ + "http://foo.example.com": { + Username: "foo", + Password: "bar", + Email: "foo@example.com", + }, + "http://bar.example.com": { + Username: "bar", + Password: "baz", + Email: "bar@example.com", + }, + }) + + var output DockerConfig + err := json.Unmarshal(input, &output) + if err != nil { + t.Errorf("Received unexpected error: %v", err) + } + + if !reflect.DeepEqual(expect, output) { + t.Errorf("Received unexpected output. Expected %#v, got %#v", expect, output) + } +} + +func TestDockerConfigEntryJSONDecode(t *testing.T) { + tests := []struct { + input []byte + expect DockerConfigEntry + fail bool + }{ + // simple case, just decode the fields + { + input: []byte(`{"username": "foo", "password": "bar", "email": "foo@example.com"}`), + expect: DockerConfigEntry{ + Username: "foo", + Password: "bar", + Email: "foo@example.com", + }, + fail: false, + }, + + // auth field decodes to username & password + { + input: []byte(`{"auth": "Zm9vOmJhcg==", "email": "foo@example.com"}`), + expect: DockerConfigEntry{ + Username: "foo", + Password: "bar", + Email: "foo@example.com", + }, + fail: false, + }, + + // auth field overrides username & password + { + input: []byte(`{"username": "foo", "password": "bar", "auth": "cGluZzpwb25n", "email": "foo@example.com"}`), + expect: DockerConfigEntry{ + Username: "ping", + Password: "pong", + Email: "foo@example.com", + }, + fail: false, + }, + + // poorly-formatted auth causes failure + { + input: []byte(`{"auth": "pants", "email": "foo@example.com"}`), + expect: DockerConfigEntry{ + Username: "", + Password: "", + Email: "foo@example.com", + }, + fail: true, + }, + + // invalid JSON causes failure + { + input: []byte(`{"email": false}`), + expect: DockerConfigEntry{ + Username: "", + Password: "", + Email: "", + }, + fail: true, + }, + } + + for i, tt := range tests { + var output DockerConfigEntry + err := json.Unmarshal(tt.input, &output) + if (err != nil) != tt.fail { + t.Errorf("case %d: expected fail=%t, got err=%v", i, tt.fail, err) + } + + if !reflect.DeepEqual(tt.expect, output) { + t.Errorf("case %d: expected output %#v, got %#v", i, tt.expect, output) + } + } +} + +func TestDecodeDockerConfigFieldAuth(t *testing.T) { + tests := []struct { + input string + username string + password string + fail bool + }{ + // auth field decodes to username & password + { + input: "Zm9vOmJhcg==", + username: "foo", + password: "bar", + }, + + // good base64 data, but no colon separating username & password + { + input: "cGFudHM=", + fail: true, + }, + + // bad base64 data + { + input: "pants", + fail: true, + }, + } + + for i, tt := range tests { + username, password, err := decodeDockerConfigFieldAuth(tt.input) + if (err != nil) != tt.fail { + t.Errorf("case %d: expected fail=%t, got err=%v", i, tt.fail, err) + } + + if tt.username != username { + t.Errorf("case %d: expected username %q, got %q", i, tt.username, username) + } + + if tt.password != password { + t.Errorf("case %d: expected password %q, got %q", i, tt.password, password) + } + } +} + +func TestDockerConfigEntryJSONCompatibleEncode(t *testing.T) { + tests := []struct { + input DockerConfigEntry + expect []byte + }{ + // simple case, just decode the fields + { + expect: []byte(`{"username":"foo","password":"bar","email":"foo@example.com","auth":"Zm9vOmJhcg=="}`), + input: DockerConfigEntry{ + Username: "foo", + Password: "bar", + Email: "foo@example.com", + }, + }, + } + + for i, tt := range tests { + actual, err := json.Marshal(tt.input) + if err != nil { + t.Errorf("case %d: unexpected error: %v", i, err) + } + + if string(tt.expect) != string(actual) { + t.Errorf("case %d: expected %v, got %v", i, string(tt.expect), string(actual)) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/tools/doc.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/doc.go similarity index 77% rename from vendor/k8s.io/kubernetes/pkg/tools/doc.go rename to vendor/k8s.io/kubernetes/pkg/credentialprovider/doc.go index 3379ee4f8..f071c0c89 100644 --- a/vendor/k8s.io/kubernetes/pkg/tools/doc.go +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package tools implements types which help work with etcd which depend on the api package. -// TODO: move this package to an etcd specific utility package. -package tools +// Package credentialprovider supplies interfaces and implementations for +// docker registry providers to expose their authentication scheme. +package credentialprovider diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/doc.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/doc.go new file mode 100644 index 000000000..e6f2beba8 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package gcp_credentials contains implementations of DockerConfigProvider +// for Google Cloud Platform. +package gcp_credentials diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/jwt.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/jwt.go new file mode 100644 index 000000000..3c1a05d4b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/jwt.go @@ -0,0 +1,111 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package gcp_credentials + +import ( + "io/ioutil" + "time" + + "github.com/golang/glog" + "golang.org/x/oauth2" + "golang.org/x/oauth2/google" + "golang.org/x/oauth2/jwt" + "k8s.io/kubernetes/pkg/credentialprovider" + + "github.com/spf13/pflag" +) + +const ( + storageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only" +) + +var ( + flagJwtFile = pflag.String("google-json-key", "", + "The Google Cloud Platform Service Account JSON Key to use for authentication.") +) + +// A DockerConfigProvider that reads its configuration from Google +// Compute Engine metadata. +type jwtProvider struct { + path *string + config *jwt.Config + tokenUrl string +} + +// init registers the various means by which credentials may +// be resolved on GCP. +func init() { + credentialprovider.RegisterCredentialProvider("google-jwt-key", + &credentialprovider.CachingDockerConfigProvider{ + Provider: &jwtProvider{ + path: flagJwtFile, + }, + Lifetime: 30 * time.Minute, + }) +} + +// Enabled implements DockerConfigProvider for the JSON Key based implementation. +func (j *jwtProvider) Enabled() bool { + if *j.path == "" { + return false + } + + data, err := ioutil.ReadFile(*j.path) + if err != nil { + glog.Errorf("while reading file %s got %v", *j.path, err) + return false + } + config, err := google.JWTConfigFromJSON(data, storageReadOnlyScope) + if err != nil { + glog.Errorf("while parsing %s data got %v", *j.path, err) + return false + } + + j.config = config + if j.tokenUrl != "" { + j.config.TokenURL = j.tokenUrl + } + return true +} + +// Provide implements DockerConfigProvider +func (j *jwtProvider) Provide() credentialprovider.DockerConfig { + cfg := credentialprovider.DockerConfig{} + + ts := j.config.TokenSource(oauth2.NoContext) + token, err := ts.Token() + if err != nil { + glog.Errorf("while exchanging json key %s for access token %v", *j.path, err) + return cfg + } + if !token.Valid() { + glog.Errorf("Got back invalid token: %v", token) + return cfg + } + + entry := credentialprovider.DockerConfigEntry{ + Username: "_token", + Password: token.AccessToken, + Email: j.config.Email, + } + + // Add our entry for each of the supported container registry URLs + for _, k := range containerRegistryUrls { + cfg[k] = entry + } + return cfg +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/jwt_test.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/jwt_test.go new file mode 100644 index 000000000..8aa2ad733 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/jwt_test.go @@ -0,0 +1,127 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package gcp_credentials + +import ( + "fmt" + "io/ioutil" + "net/http" + "net/http/httptest" + "os" + "strings" + "testing" + + "k8s.io/kubernetes/pkg/credentialprovider" +) + +const email = "foo@bar.com" + +// From oauth2/jwt_test.go +var ( + dummyPrivateKey = `-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAx4fm7dngEmOULNmAs1IGZ9Apfzh+BkaQ1dzkmbUgpcoghucE +DZRnAGd2aPyB6skGMXUytWQvNYav0WTR00wFtX1ohWTfv68HGXJ8QXCpyoSKSSFY +fuP9X36wBSkSX9J5DVgiuzD5VBdzUISSmapjKm+DcbRALjz6OUIPEWi1Tjl6p5RK +1w41qdbmt7E5/kGhKLDuT7+M83g4VWhgIvaAXtnhklDAggilPPa8ZJ1IFe31lNlr +k4DRk38nc6sEutdf3RL7QoH7FBusI7uXV03DC6dwN1kP4GE7bjJhcRb/7jYt7CQ9 +/E9Exz3c0yAp0yrTg0Fwh+qxfH9dKwN52S7SBwIDAQABAoIBAQCaCs26K07WY5Jt +3a2Cw3y2gPrIgTCqX6hJs7O5ByEhXZ8nBwsWANBUe4vrGaajQHdLj5OKfsIDrOvn +2NI1MqflqeAbu/kR32q3tq8/Rl+PPiwUsW3E6Pcf1orGMSNCXxeducF2iySySzh3 +nSIhCG5uwJDWI7a4+9KiieFgK1pt/Iv30q1SQS8IEntTfXYwANQrfKUVMmVF9aIK +6/WZE2yd5+q3wVVIJ6jsmTzoDCX6QQkkJICIYwCkglmVy5AeTckOVwcXL0jqw5Kf +5/soZJQwLEyBoQq7Kbpa26QHq+CJONetPP8Ssy8MJJXBT+u/bSseMb3Zsr5cr43e +DJOhwsThAoGBAPY6rPKl2NT/K7XfRCGm1sbWjUQyDShscwuWJ5+kD0yudnT/ZEJ1 +M3+KS/iOOAoHDdEDi9crRvMl0UfNa8MAcDKHflzxg2jg/QI+fTBjPP5GOX0lkZ9g +z6VePoVoQw2gpPFVNPPTxKfk27tEzbaffvOLGBEih0Kb7HTINkW8rIlzAoGBAM9y +1yr+jvfS1cGFtNU+Gotoihw2eMKtIqR03Yn3n0PK1nVCDKqwdUqCypz4+ml6cxRK +J8+Pfdh7D+ZJd4LEG6Y4QRDLuv5OA700tUoSHxMSNn3q9As4+T3MUyYxWKvTeu3U +f2NWP9ePU0lV8ttk7YlpVRaPQmc1qwooBA/z/8AdAoGAW9x0HWqmRICWTBnpjyxx +QGlW9rQ9mHEtUotIaRSJ6K/F3cxSGUEkX1a3FRnp6kPLcckC6NlqdNgNBd6rb2rA +cPl/uSkZP42Als+9YMoFPU/xrrDPbUhu72EDrj3Bllnyb168jKLa4VBOccUvggxr +Dm08I1hgYgdN5huzs7y6GeUCgYEAj+AZJSOJ6o1aXS6rfV3mMRve9bQ9yt8jcKXw +5HhOCEmMtaSKfnOF1Ziih34Sxsb7O2428DiX0mV/YHtBnPsAJidL0SdLWIapBzeg +KHArByIRkwE6IvJvwpGMdaex1PIGhx5i/3VZL9qiq/ElT05PhIb+UXgoWMabCp84 +OgxDK20CgYAeaFo8BdQ7FmVX2+EEejF+8xSge6WVLtkaon8bqcn6P0O8lLypoOhd +mJAYH8WU+UAy9pecUnDZj14LAGNVmYcse8HFX71MoshnvCTFEPVo4rZxIAGwMpeJ +5jgQ3slYLpqrGlcbLgUXBUgzEO684Wk/UV9DFPlHALVqCfXQ9dpJPg== +-----END RSA PRIVATE KEY-----` + + jsonKey = fmt.Sprintf(`{"private_key":"%[1]s", "client_email":"%[2]s"}`, + strings.Replace(dummyPrivateKey, "\n", "\\n", -1), email) +) + +func TestJwtProvider(t *testing.T) { + token := "asdhflkjsdfkjhsdf" + + // Modeled after oauth2/jwt_test.go + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(fmt.Sprintf(`{ + "access_token": "%[1]s", + "scope": "user", + "token_type": "bearer", + "expires_in": 3600 + }`, token))) + })) + // TODO: Uncomment when fix #19254 + // defer ts.Close() + + file, err := ioutil.TempFile(os.TempDir(), "temp") + if err != nil { + t.Fatalf("Error creating temp file: %v", err) + } + + filename := file.Name() + _, err = file.WriteString(jsonKey) + if err != nil { + t.Fatalf("Error writing temp file: %v", err) + } + + provider := &jwtProvider{ + path: &filename, + tokenUrl: ts.URL, + } + if !provider.Enabled() { + t.Fatalf("Provider is unexpectedly disabled") + } + + keyring := &credentialprovider.BasicDockerKeyring{} + keyring.Add(provider.Provide()) + + // Verify that we get the expected username/password combo for + // a gcr.io image name. + registryUrl := "gcr.io/foo/bar" + creds, ok := keyring.Lookup(registryUrl) + if !ok { + t.Errorf("Didn't find expected URL: %s", registryUrl) + return + } + if len(creds) > 1 { + t.Errorf("Got more hits than expected: %s", creds) + } + val := creds[0] + + if "_token" != val.Username { + t.Errorf("Unexpected username value, want: _token, got: %s", val.Username) + } + if token != val.Password { + t.Errorf("Unexpected password value, want: %s, got: %s", token, val.Password) + } + if email != val.Email { + t.Errorf("Unexpected email value, want: %s, got: %s", email, val.Email) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/metadata.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/metadata.go new file mode 100644 index 000000000..8ab929315 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/metadata.go @@ -0,0 +1,202 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package gcp_credentials + +import ( + "encoding/json" + "net/http" + "strings" + "time" + + "github.com/golang/glog" + "k8s.io/kubernetes/pkg/credentialprovider" +) + +const ( + metadataUrl = "http://metadata.google.internal./computeMetadata/v1/" + metadataAttributes = metadataUrl + "instance/attributes/" + dockerConfigKey = metadataAttributes + "google-dockercfg" + dockerConfigUrlKey = metadataAttributes + "google-dockercfg-url" + metadataScopes = metadataUrl + "instance/service-accounts/default/scopes" + metadataToken = metadataUrl + "instance/service-accounts/default/token" + metadataEmail = metadataUrl + "instance/service-accounts/default/email" + storageScopePrefix = "https://www.googleapis.com/auth/devstorage" + cloudPlatformScopePrefix = "https://www.googleapis.com/auth/cloud-platform" +) + +// For these urls, the parts of the host name can be glob, for example '*.gcr.io" will match +// "foo.gcr.io" and "bar.gcr.io". +var containerRegistryUrls = []string{"container.cloud.google.com", "gcr.io", "*.gcr.io"} + +var metadataHeader = &http.Header{ + "Metadata-Flavor": []string{"Google"}, +} + +// A DockerConfigProvider that reads its configuration from Google +// Compute Engine metadata. +type metadataProvider struct { + Client *http.Client +} + +// A DockerConfigProvider that reads its configuration from a specific +// Google Compute Engine metadata key: 'google-dockercfg'. +type dockerConfigKeyProvider struct { + metadataProvider +} + +// A DockerConfigProvider that reads its configuration from a URL read from +// a specific Google Compute Engine metadata key: 'google-dockercfg-url'. +type dockerConfigUrlKeyProvider struct { + metadataProvider +} + +// A DockerConfigProvider that provides a dockercfg with: +// Username: "_token" +// Password: "{access token from metadata}" +type containerRegistryProvider struct { + metadataProvider +} + +// init registers the various means by which credentials may +// be resolved on GCP. +func init() { + credentialprovider.RegisterCredentialProvider("google-dockercfg", + &credentialprovider.CachingDockerConfigProvider{ + Provider: &dockerConfigKeyProvider{ + metadataProvider{Client: http.DefaultClient}, + }, + Lifetime: 60 * time.Second, + }) + + credentialprovider.RegisterCredentialProvider("google-dockercfg-url", + &credentialprovider.CachingDockerConfigProvider{ + Provider: &dockerConfigUrlKeyProvider{ + metadataProvider{Client: http.DefaultClient}, + }, + Lifetime: 60 * time.Second, + }) + + credentialprovider.RegisterCredentialProvider("google-container-registry", + // Never cache this. The access token is already + // cached by the metadata service. + &containerRegistryProvider{ + metadataProvider{Client: http.DefaultClient}, + }) +} + +// Enabled implements DockerConfigProvider for all of the Google implementations. +func (g *metadataProvider) Enabled() bool { + _, err := credentialprovider.ReadUrl(metadataUrl, g.Client, metadataHeader) + return err == nil +} + +// Provide implements DockerConfigProvider +func (g *dockerConfigKeyProvider) Provide() credentialprovider.DockerConfig { + // Read the contents of the google-dockercfg metadata key and + // parse them as an alternate .dockercfg + if cfg, err := credentialprovider.ReadDockerConfigFileFromUrl(dockerConfigKey, g.Client, metadataHeader); err != nil { + glog.Errorf("while reading 'google-dockercfg' metadata: %v", err) + } else { + return cfg + } + + return credentialprovider.DockerConfig{} +} + +// Provide implements DockerConfigProvider +func (g *dockerConfigUrlKeyProvider) Provide() credentialprovider.DockerConfig { + // Read the contents of the google-dockercfg-url key and load a .dockercfg from there + if url, err := credentialprovider.ReadUrl(dockerConfigUrlKey, g.Client, metadataHeader); err != nil { + glog.Errorf("while reading 'google-dockercfg-url' metadata: %v", err) + } else { + if strings.HasPrefix(string(url), "http") { + if cfg, err := credentialprovider.ReadDockerConfigFileFromUrl(string(url), g.Client, nil); err != nil { + glog.Errorf("while reading 'google-dockercfg-url'-specified url: %s, %v", string(url), err) + } else { + return cfg + } + } else { + // TODO(mattmoor): support reading alternate scheme URLs (e.g. gs:// or s3://) + glog.Errorf("Unsupported URL scheme: %s", string(url)) + } + } + + return credentialprovider.DockerConfig{} +} + +// Enabled implements a special metadata-based check, which verifies the +// storage scope is available on the GCE VM. +func (g *containerRegistryProvider) Enabled() bool { + value, err := credentialprovider.ReadUrl(metadataScopes+"?alt=json", g.Client, metadataHeader) + if err != nil { + return false + } + var scopes []string + if err := json.Unmarshal([]byte(value), &scopes); err != nil { + return false + } + + for _, v := range scopes { + // cloudPlatformScope implies storage scope. + if strings.HasPrefix(v, storageScopePrefix) || strings.HasPrefix(v, cloudPlatformScopePrefix) { + return true + } + } + glog.Warningf("Google container registry is disabled, no storage scope is available: %s", value) + return false +} + +// tokenBlob is used to decode the JSON blob containing an access token +// that is returned by GCE metadata. +type tokenBlob struct { + AccessToken string `json:"access_token"` +} + +// Provide implements DockerConfigProvider +func (g *containerRegistryProvider) Provide() credentialprovider.DockerConfig { + cfg := credentialprovider.DockerConfig{} + + tokenJsonBlob, err := credentialprovider.ReadUrl(metadataToken, g.Client, metadataHeader) + if err != nil { + glog.Errorf("while reading access token endpoint: %v", err) + return cfg + } + + email, err := credentialprovider.ReadUrl(metadataEmail, g.Client, metadataHeader) + if err != nil { + glog.Errorf("while reading email endpoint: %v", err) + return cfg + } + + var parsedBlob tokenBlob + if err := json.Unmarshal([]byte(tokenJsonBlob), &parsedBlob); err != nil { + glog.Errorf("while parsing json blob %s: %v", tokenJsonBlob, err) + return cfg + } + + entry := credentialprovider.DockerConfigEntry{ + Username: "_token", + Password: parsedBlob.AccessToken, + Email: string(email), + } + + // Add our entry for each of the supported container registry URLs + for _, k := range containerRegistryUrls { + cfg[k] = entry + } + return cfg +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/metadata_test.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/metadata_test.go new file mode 100644 index 000000000..5da1bcd3b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/gcp/metadata_test.go @@ -0,0 +1,347 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package gcp_credentials + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "net/http" + "net/http/httptest" + "net/url" + "reflect" + "strings" + "testing" + + "k8s.io/kubernetes/pkg/credentialprovider" +) + +func TestDockerKeyringFromGoogleDockerConfigMetadata(t *testing.T) { + registryUrl := "hello.kubernetes.io" + email := "foo@bar.baz" + username := "foo" + password := "bar" + auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password))) + sampleDockerConfig := fmt.Sprintf(`{ + "https://%s": { + "email": %q, + "auth": %q + } +}`, registryUrl, email, auth) + + const probeEndpoint = "/computeMetadata/v1/" + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Only serve the one metadata key. + if probeEndpoint == r.URL.Path { + w.WriteHeader(http.StatusOK) + } else if strings.HasSuffix(dockerConfigKey, r.URL.Path) { + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "application/json") + fmt.Fprintln(w, sampleDockerConfig) + } else { + w.WriteHeader(http.StatusNotFound) + } + })) + // TODO: Uncomment when fix #19254 + // defer server.Close() + + // Make a transport that reroutes all traffic to the example server + transport := &http.Transport{ + Proxy: func(req *http.Request) (*url.URL, error) { + return url.Parse(server.URL + req.URL.Path) + }, + } + + keyring := &credentialprovider.BasicDockerKeyring{} + provider := &dockerConfigKeyProvider{ + metadataProvider{Client: &http.Client{Transport: transport}}, + } + + if !provider.Enabled() { + t.Errorf("Provider is unexpectedly disabled") + } + + keyring.Add(provider.Provide()) + + creds, ok := keyring.Lookup(registryUrl) + if !ok { + t.Errorf("Didn't find expected URL: %s", registryUrl) + return + } + if len(creds) > 1 { + t.Errorf("Got more hits than expected: %s", creds) + } + val := creds[0] + + if username != val.Username { + t.Errorf("Unexpected username value, want: %s, got: %s", username, val.Username) + } + if password != val.Password { + t.Errorf("Unexpected password value, want: %s, got: %s", password, val.Password) + } + if email != val.Email { + t.Errorf("Unexpected email value, want: %s, got: %s", email, val.Email) + } +} + +func TestDockerKeyringFromGoogleDockerConfigMetadataUrl(t *testing.T) { + registryUrl := "hello.kubernetes.io" + email := "foo@bar.baz" + username := "foo" + password := "bar" + auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password))) + sampleDockerConfig := fmt.Sprintf(`{ + "https://%s": { + "email": %q, + "auth": %q + } +}`, registryUrl, email, auth) + + const probeEndpoint = "/computeMetadata/v1/" + const valueEndpoint = "/my/value" + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Only serve the URL key and the value endpoint + if probeEndpoint == r.URL.Path { + w.WriteHeader(http.StatusOK) + } else if valueEndpoint == r.URL.Path { + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "application/json") + fmt.Fprintln(w, sampleDockerConfig) + } else if strings.HasSuffix(dockerConfigUrlKey, r.URL.Path) { + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "application/text") + fmt.Fprint(w, "http://foo.bar.com"+valueEndpoint) + } else { + w.WriteHeader(http.StatusNotFound) + } + })) + // TODO: Uncomment when fix #19254 + // defer server.Close() + + // Make a transport that reroutes all traffic to the example server + transport := &http.Transport{ + Proxy: func(req *http.Request) (*url.URL, error) { + return url.Parse(server.URL + req.URL.Path) + }, + } + + keyring := &credentialprovider.BasicDockerKeyring{} + provider := &dockerConfigUrlKeyProvider{ + metadataProvider{Client: &http.Client{Transport: transport}}, + } + + if !provider.Enabled() { + t.Errorf("Provider is unexpectedly disabled") + } + + keyring.Add(provider.Provide()) + + creds, ok := keyring.Lookup(registryUrl) + if !ok { + t.Errorf("Didn't find expected URL: %s", registryUrl) + return + } + if len(creds) > 1 { + t.Errorf("Got more hits than expected: %s", creds) + } + val := creds[0] + + if username != val.Username { + t.Errorf("Unexpected username value, want: %s, got: %s", username, val.Username) + } + if password != val.Password { + t.Errorf("Unexpected password value, want: %s, got: %s", password, val.Password) + } + if email != val.Email { + t.Errorf("Unexpected email value, want: %s, got: %s", email, val.Email) + } +} + +func TestContainerRegistryBasics(t *testing.T) { + registryUrl := "container.cloud.google.com" + email := "1234@project.gserviceaccount.com" + token := &tokenBlob{AccessToken: "ya26.lots-of-indiscernible-garbage"} + + const ( + defaultEndpoint = "/computeMetadata/v1/instance/service-accounts/default/" + scopeEndpoint = defaultEndpoint + "scopes" + emailEndpoint = defaultEndpoint + "email" + tokenEndpoint = defaultEndpoint + "token" + ) + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Only serve the URL key and the value endpoint + if scopeEndpoint == r.URL.Path { + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "application/json") + fmt.Fprintf(w, `["%s.read_write"]`, storageScopePrefix) + } else if emailEndpoint == r.URL.Path { + w.WriteHeader(http.StatusOK) + fmt.Fprint(w, email) + } else if tokenEndpoint == r.URL.Path { + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "application/json") + bytes, err := json.Marshal(token) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + fmt.Fprintln(w, string(bytes)) + } else { + w.WriteHeader(http.StatusNotFound) + } + })) + // TODO: Uncomment when fix #19254 + // defer server.Close() + + // Make a transport that reroutes all traffic to the example server + transport := &http.Transport{ + Proxy: func(req *http.Request) (*url.URL, error) { + return url.Parse(server.URL + req.URL.Path) + }, + } + + keyring := &credentialprovider.BasicDockerKeyring{} + provider := &containerRegistryProvider{ + metadataProvider{Client: &http.Client{Transport: transport}}, + } + + if !provider.Enabled() { + t.Errorf("Provider is unexpectedly disabled") + } + + keyring.Add(provider.Provide()) + + creds, ok := keyring.Lookup(registryUrl) + if !ok { + t.Errorf("Didn't find expected URL: %s", registryUrl) + return + } + if len(creds) > 1 { + t.Errorf("Got more hits than expected: %s", creds) + } + val := creds[0] + + if "_token" != val.Username { + t.Errorf("Unexpected username value, want: %s, got: %s", "_token", val.Username) + } + if token.AccessToken != val.Password { + t.Errorf("Unexpected password value, want: %s, got: %s", token.AccessToken, val.Password) + } + if email != val.Email { + t.Errorf("Unexpected email value, want: %s, got: %s", email, val.Email) + } +} + +func TestContainerRegistryNoStorageScope(t *testing.T) { + const ( + defaultEndpoint = "/computeMetadata/v1/instance/service-accounts/default/" + scopeEndpoint = defaultEndpoint + "scopes" + ) + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Only serve the URL key and the value endpoint + if scopeEndpoint == r.URL.Path { + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "application/json") + fmt.Fprint(w, `["https://www.googleapis.com/auth/compute.read_write"]`) + } else { + w.WriteHeader(http.StatusNotFound) + } + })) + // TODO: Uncomment when fix #19254 + // defer server.Close() + + // Make a transport that reroutes all traffic to the example server + transport := &http.Transport{ + Proxy: func(req *http.Request) (*url.URL, error) { + return url.Parse(server.URL + req.URL.Path) + }, + } + + provider := &containerRegistryProvider{ + metadataProvider{Client: &http.Client{Transport: transport}}, + } + + if provider.Enabled() { + t.Errorf("Provider is unexpectedly enabled") + } +} + +func TestComputePlatformScopeSubstitutesStorageScope(t *testing.T) { + const ( + defaultEndpoint = "/computeMetadata/v1/instance/service-accounts/default/" + scopeEndpoint = defaultEndpoint + "scopes" + ) + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Only serve the URL key and the value endpoint + if scopeEndpoint == r.URL.Path { + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "application/json") + fmt.Fprint(w, `["https://www.googleapis.com/auth/compute.read_write","https://www.googleapis.com/auth/cloud-platform.read-only"]`) + } else { + w.WriteHeader(http.StatusNotFound) + } + })) + // TODO: Uncomment when fix #19254 + // defer server.Close() + + // Make a transport that reroutes all traffic to the example server + transport := &http.Transport{ + Proxy: func(req *http.Request) (*url.URL, error) { + return url.Parse(server.URL + req.URL.Path) + }, + } + + provider := &containerRegistryProvider{ + metadataProvider{Client: &http.Client{Transport: transport}}, + } + + if !provider.Enabled() { + t.Errorf("Provider is unexpectedly disabled") + } +} + +func TestAllProvidersNoMetadata(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotFound) + })) + // TODO: Uncomment when fix #19254 + // defer server.Close() + + // Make a transport that reroutes all traffic to the example server + transport := &http.Transport{ + Proxy: func(req *http.Request) (*url.URL, error) { + return url.Parse(server.URL + req.URL.Path) + }, + } + + providers := []credentialprovider.DockerConfigProvider{ + &dockerConfigKeyProvider{ + metadataProvider{Client: &http.Client{Transport: transport}}, + }, + &dockerConfigUrlKeyProvider{ + metadataProvider{Client: &http.Client{Transport: transport}}, + }, + &containerRegistryProvider{ + metadataProvider{Client: &http.Client{Transport: transport}}, + }, + } + + for _, provider := range providers { + if provider.Enabled() { + t.Errorf("Provider %s is unexpectedly enabled", reflect.TypeOf(provider).String()) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/keyring.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/keyring.go new file mode 100644 index 000000000..0ea079aee --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/keyring.go @@ -0,0 +1,306 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package credentialprovider + +import ( + "encoding/json" + "net" + "net/url" + "path/filepath" + "sort" + "strings" + + docker "github.com/fsouza/go-dockerclient" + "github.com/golang/glog" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/util/sets" +) + +// DockerKeyring tracks a set of docker registry credentials, maintaining a +// reverse index across the registry endpoints. A registry endpoint is made +// up of a host (e.g. registry.example.com), but it may also contain a path +// (e.g. registry.example.com/foo) This index is important for two reasons: +// - registry endpoints may overlap, and when this happens we must find the +// most specific match for a given image +// - iterating a map does not yield predictable results +type DockerKeyring interface { + Lookup(image string) ([]docker.AuthConfiguration, bool) +} + +// BasicDockerKeyring is a trivial map-backed implementation of DockerKeyring +type BasicDockerKeyring struct { + index []string + creds map[string][]docker.AuthConfiguration +} + +// lazyDockerKeyring is an implementation of DockerKeyring that lazily +// materializes its dockercfg based on a set of dockerConfigProviders. +type lazyDockerKeyring struct { + Providers []DockerConfigProvider +} + +func (dk *BasicDockerKeyring) Add(cfg DockerConfig) { + if dk.index == nil { + dk.index = make([]string, 0) + dk.creds = make(map[string][]docker.AuthConfiguration) + } + for loc, ident := range cfg { + + creds := docker.AuthConfiguration{ + Username: ident.Username, + Password: ident.Password, + Email: ident.Email, + } + + parsed, err := url.Parse(loc) + if err != nil { + glog.Errorf("Entry %q in dockercfg invalid (%v), ignoring", loc, err) + continue + } + + // The docker client allows exact matches: + // foo.bar.com/namespace + // Or hostname matches: + // foo.bar.com + // See ResolveAuthConfig in docker/registry/auth.go. + if parsed.Host != "" { + // NOTE: foo.bar.com comes through as Path. + dk.creds[parsed.Host] = append(dk.creds[parsed.Host], creds) + dk.index = append(dk.index, parsed.Host) + } + if (len(parsed.Path) > 0) && (parsed.Path != "/") { + key := parsed.Host + parsed.Path + dk.creds[key] = append(dk.creds[key], creds) + dk.index = append(dk.index, key) + } + } + + eliminateDupes := sets.NewString(dk.index...) + dk.index = eliminateDupes.List() + + // Update the index used to identify which credentials to use for a given + // image. The index is reverse-sorted so more specific paths are matched + // first. For example, if for the given image "quay.io/coreos/etcd", + // credentials for "quay.io/coreos" should match before "quay.io". + sort.Sort(sort.Reverse(sort.StringSlice(dk.index))) +} + +const defaultRegistryHost = "index.docker.io/v1/" + +// isDefaultRegistryMatch determines whether the given image will +// pull from the default registry (DockerHub) based on the +// characteristics of its name. +func isDefaultRegistryMatch(image string) bool { + parts := strings.SplitN(image, "/", 2) + + if len(parts[0]) == 0 { + return false + } + + if len(parts) == 1 { + // e.g. library/ubuntu + return true + } + + if parts[0] == "docker.io" || parts[0] == "index.docker.io" { + // resolve docker.io/image and index.docker.io/image as default registry + return true + } + + // From: http://blog.docker.com/2013/07/how-to-use-your-own-registry/ + // Docker looks for either a “.” (domain separator) or “:” (port separator) + // to learn that the first part of the repository name is a location and not + // a user name. + return !strings.ContainsAny(parts[0], ".:") +} + +// url.Parse require a scheme, but ours don't have schemes. Adding a +// scheme to make url.Parse happy, then clear out the resulting scheme. +func parseSchemelessUrl(schemelessUrl string) (*url.URL, error) { + parsed, err := url.Parse("https://" + schemelessUrl) + if err != nil { + return nil, err + } + // clear out the resulting scheme + parsed.Scheme = "" + return parsed, nil +} + +// split the host name into parts, as well as the port +func splitUrl(url *url.URL) (parts []string, port string) { + host, port, err := net.SplitHostPort(url.Host) + if err != nil { + // could not parse port + host, port = url.Host, "" + } + return strings.Split(host, "."), port +} + +// overloaded version of urlsMatch, operating on strings instead of URLs. +func urlsMatchStr(glob string, target string) (bool, error) { + globUrl, err := parseSchemelessUrl(glob) + if err != nil { + return false, err + } + targetUrl, err := parseSchemelessUrl(target) + if err != nil { + return false, err + } + return urlsMatch(globUrl, targetUrl) +} + +// check whether the given target url matches the glob url, which may have +// glob wild cards in the host name. +// +// Examples: +// globUrl=*.docker.io, targetUrl=blah.docker.io => match +// globUrl=*.docker.io, targetUrl=not.right.io => no match +// +// Note that we don't support wildcards in ports and paths yet. +func urlsMatch(globUrl *url.URL, targetUrl *url.URL) (bool, error) { + globUrlParts, globPort := splitUrl(globUrl) + targetUrlParts, targetPort := splitUrl(targetUrl) + if globPort != targetPort { + // port doesn't match + return false, nil + } + if len(globUrlParts) != len(targetUrlParts) { + // host name does not have the same number of parts + return false, nil + } + if !strings.HasPrefix(targetUrl.Path, globUrl.Path) { + // the path of the credential must be a prefix + return false, nil + } + for k, globUrlPart := range globUrlParts { + targetUrlPart := targetUrlParts[k] + matched, err := filepath.Match(globUrlPart, targetUrlPart) + if err != nil { + return false, err + } + if !matched { + // glob mismatch for some part + return false, nil + } + } + // everything matches + return true, nil +} + +// Lookup implements the DockerKeyring method for fetching credentials based on image name. +// Multiple credentials may be returned if there are multiple potentially valid credentials +// available. This allows for rotation. +func (dk *BasicDockerKeyring) Lookup(image string) ([]docker.AuthConfiguration, bool) { + // range over the index as iterating over a map does not provide a predictable ordering + ret := []docker.AuthConfiguration{} + for _, k := range dk.index { + // both k and image are schemeless URLs because even though schemes are allowed + // in the credential configurations, we remove them in Add. + if matched, _ := urlsMatchStr(k, image); !matched { + continue + } + + ret = append(ret, dk.creds[k]...) + } + + if len(ret) > 0 { + return ret, true + } + + // Use credentials for the default registry if provided, and appropriate + if auth, ok := dk.creds[defaultRegistryHost]; ok && isDefaultRegistryMatch(image) { + return auth, true + } + + return []docker.AuthConfiguration{}, false +} + +// Lookup implements the DockerKeyring method for fetching credentials +// based on image name. +func (dk *lazyDockerKeyring) Lookup(image string) ([]docker.AuthConfiguration, bool) { + keyring := &BasicDockerKeyring{} + + for _, p := range dk.Providers { + keyring.Add(p.Provide()) + } + + return keyring.Lookup(image) +} + +type FakeKeyring struct { + auth []docker.AuthConfiguration + ok bool +} + +func (f *FakeKeyring) Lookup(image string) ([]docker.AuthConfiguration, bool) { + return f.auth, f.ok +} + +// unionDockerKeyring delegates to a set of keyrings. +type unionDockerKeyring struct { + keyrings []DockerKeyring +} + +func (k *unionDockerKeyring) Lookup(image string) ([]docker.AuthConfiguration, bool) { + authConfigs := []docker.AuthConfiguration{} + + for _, subKeyring := range k.keyrings { + if subKeyring == nil { + continue + } + + currAuthResults, _ := subKeyring.Lookup(image) + authConfigs = append(authConfigs, currAuthResults...) + } + + return authConfigs, (len(authConfigs) > 0) +} + +// MakeDockerKeyring inspects the passedSecrets to see if they contain any DockerConfig secrets. If they do, +// then a DockerKeyring is built based on every hit and unioned with the defaultKeyring. +// If they do not, then the default keyring is returned +func MakeDockerKeyring(passedSecrets []api.Secret, defaultKeyring DockerKeyring) (DockerKeyring, error) { + passedCredentials := []DockerConfig{} + for _, passedSecret := range passedSecrets { + if dockerConfigJsonBytes, dockerConfigJsonExists := passedSecret.Data[api.DockerConfigJsonKey]; (passedSecret.Type == api.SecretTypeDockerConfigJson) && dockerConfigJsonExists && (len(dockerConfigJsonBytes) > 0) { + dockerConfigJson := DockerConfigJson{} + if err := json.Unmarshal(dockerConfigJsonBytes, &dockerConfigJson); err != nil { + return nil, err + } + + passedCredentials = append(passedCredentials, dockerConfigJson.Auths) + } else if dockercfgBytes, dockercfgExists := passedSecret.Data[api.DockerConfigKey]; (passedSecret.Type == api.SecretTypeDockercfg) && dockercfgExists && (len(dockercfgBytes) > 0) { + dockercfg := DockerConfig{} + if err := json.Unmarshal(dockercfgBytes, &dockercfg); err != nil { + return nil, err + } + + passedCredentials = append(passedCredentials, dockercfg) + } + } + + if len(passedCredentials) > 0 { + basicKeyring := &BasicDockerKeyring{} + for _, currCredentials := range passedCredentials { + basicKeyring.Add(currCredentials) + } + return &unionDockerKeyring{[]DockerKeyring{basicKeyring, defaultKeyring}}, nil + } + + return defaultKeyring, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/keyring_test.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/keyring_test.go new file mode 100644 index 000000000..cd92d79b2 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/keyring_test.go @@ -0,0 +1,476 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package credentialprovider + +import ( + "encoding/base64" + "fmt" + "testing" +) + +func TestUrlsMatch(t *testing.T) { + tests := []struct { + globUrl string + targetUrl string + matchExpected bool + }{ + // match when there is no path component + { + globUrl: "*.kubernetes.io", + targetUrl: "prefix.kubernetes.io", + matchExpected: true, + }, + { + globUrl: "prefix.*.io", + targetUrl: "prefix.kubernetes.io", + matchExpected: true, + }, + { + globUrl: "prefix.kubernetes.*", + targetUrl: "prefix.kubernetes.io", + matchExpected: true, + }, + { + globUrl: "*-good.kubernetes.io", + targetUrl: "prefix-good.kubernetes.io", + matchExpected: true, + }, + // match with path components + { + globUrl: "*.kubernetes.io/blah", + targetUrl: "prefix.kubernetes.io/blah", + matchExpected: true, + }, + { + globUrl: "prefix.*.io/foo", + targetUrl: "prefix.kubernetes.io/foo/bar", + matchExpected: true, + }, + // match with path components and ports + { + globUrl: "*.kubernetes.io:1111/blah", + targetUrl: "prefix.kubernetes.io:1111/blah", + matchExpected: true, + }, + { + globUrl: "prefix.*.io:1111/foo", + targetUrl: "prefix.kubernetes.io:1111/foo/bar", + matchExpected: true, + }, + // no match when number of parts mismatch + { + globUrl: "*.kubernetes.io", + targetUrl: "kubernetes.io", + matchExpected: false, + }, + { + globUrl: "*.*.kubernetes.io", + targetUrl: "prefix.kubernetes.io", + matchExpected: false, + }, + { + globUrl: "*.*.kubernetes.io", + targetUrl: "kubernetes.io", + matchExpected: false, + }, + // no match when some parts mismatch + { + globUrl: "kubernetes.io", + targetUrl: "kubernetes.com", + matchExpected: false, + }, + { + globUrl: "k*.io", + targetUrl: "quay.io", + matchExpected: false, + }, + // no match when ports mismatch + { + globUrl: "*.kubernetes.io:1234/blah", + targetUrl: "prefix.kubernetes.io:1111/blah", + matchExpected: false, + }, + { + globUrl: "prefix.*.io/foo", + targetUrl: "prefix.kubernetes.io:1111/foo/bar", + matchExpected: false, + }, + } + for _, test := range tests { + matched, _ := urlsMatchStr(test.globUrl, test.targetUrl) + if matched != test.matchExpected { + t.Errorf("Expected match result of %s and %s to be %t, but was %t", + test.globUrl, test.targetUrl, test.matchExpected, matched) + } + } +} + +func TestDockerKeyringForGlob(t *testing.T) { + tests := []struct { + globUrl string + targetUrl string + }{ + { + globUrl: "hello.kubernetes.io", + targetUrl: "hello.kubernetes.io", + }, + { + globUrl: "*.docker.io", + targetUrl: "prefix.docker.io", + }, + { + globUrl: "prefix.*.io", + targetUrl: "prefix.docker.io", + }, + { + globUrl: "prefix.docker.*", + targetUrl: "prefix.docker.io", + }, + { + globUrl: "*.docker.io/path", + targetUrl: "prefix.docker.io/path", + }, + { + globUrl: "prefix.*.io/path", + targetUrl: "prefix.docker.io/path/subpath", + }, + { + globUrl: "prefix.docker.*/path", + targetUrl: "prefix.docker.io/path", + }, + { + globUrl: "*.docker.io:8888", + targetUrl: "prefix.docker.io:8888", + }, + { + globUrl: "prefix.*.io:8888", + targetUrl: "prefix.docker.io:8888", + }, + { + globUrl: "prefix.docker.*:8888", + targetUrl: "prefix.docker.io:8888", + }, + { + globUrl: "*.docker.io/path:1111", + targetUrl: "prefix.docker.io/path:1111", + }, + { + globUrl: "prefix.*.io/path:1111", + targetUrl: "prefix.docker.io/path/subpath:1111", + }, + { + globUrl: "prefix.docker.*/path:1111", + targetUrl: "prefix.docker.io/path:1111", + }, + } + for _, test := range tests { + email := "foo@bar.baz" + username := "foo" + password := "bar" + auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password))) + sampleDockerConfig := fmt.Sprintf(`{ + "https://%s": { + "email": %q, + "auth": %q + } +}`, test.globUrl, email, auth) + + keyring := &BasicDockerKeyring{} + if cfg, err := readDockerConfigFileFromBytes([]byte(sampleDockerConfig)); err != nil { + t.Errorf("Error processing json blob %q, %v", sampleDockerConfig, err) + } else { + keyring.Add(cfg) + } + + creds, ok := keyring.Lookup(test.targetUrl + "/foo/bar") + if !ok { + t.Errorf("Didn't find expected URL: %s", test.targetUrl) + return + } + val := creds[0] + + if username != val.Username { + t.Errorf("Unexpected username value, want: %s, got: %s", username, val.Username) + } + if password != val.Password { + t.Errorf("Unexpected password value, want: %s, got: %s", password, val.Password) + } + if email != val.Email { + t.Errorf("Unexpected email value, want: %s, got: %s", email, val.Email) + } + } +} + +func TestKeyringMiss(t *testing.T) { + tests := []struct { + globUrl string + lookupUrl string + }{ + { + globUrl: "hello.kubernetes.io", + lookupUrl: "world.mesos.org/foo/bar", + }, + { + globUrl: "*.docker.com", + lookupUrl: "prefix.docker.io", + }, + { + globUrl: "suffix.*.io", + lookupUrl: "prefix.docker.io", + }, + { + globUrl: "prefix.docker.c*", + lookupUrl: "prefix.docker.io", + }, + } + for _, test := range tests { + email := "foo@bar.baz" + username := "foo" + password := "bar" + auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password))) + sampleDockerConfig := fmt.Sprintf(`{ + "https://%s": { + "email": %q, + "auth": %q + } +}`, test.globUrl, email, auth) + + keyring := &BasicDockerKeyring{} + if cfg, err := readDockerConfigFileFromBytes([]byte(sampleDockerConfig)); err != nil { + t.Errorf("Error processing json blob %q, %v", sampleDockerConfig, err) + } else { + keyring.Add(cfg) + } + + _, ok := keyring.Lookup(test.lookupUrl + "/foo/bar") + if ok { + t.Errorf("Expected not to find URL %s, but found", test.lookupUrl) + } + } + +} + +func TestKeyringMissWithDockerHubCredentials(t *testing.T) { + url := defaultRegistryHost + email := "foo@bar.baz" + username := "foo" + password := "bar" + auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password))) + sampleDockerConfig := fmt.Sprintf(`{ + "https://%s": { + "email": %q, + "auth": %q + } +}`, url, email, auth) + + keyring := &BasicDockerKeyring{} + if cfg, err := readDockerConfigFileFromBytes([]byte(sampleDockerConfig)); err != nil { + t.Errorf("Error processing json blob %q, %v", sampleDockerConfig, err) + } else { + keyring.Add(cfg) + } + + val, ok := keyring.Lookup("world.mesos.org/foo/bar") + if ok { + t.Errorf("Found unexpected credential: %+v", val) + } +} + +func TestKeyringHitWithUnqualifiedDockerHub(t *testing.T) { + url := defaultRegistryHost + email := "foo@bar.baz" + username := "foo" + password := "bar" + auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password))) + sampleDockerConfig := fmt.Sprintf(`{ + "https://%s": { + "email": %q, + "auth": %q + } +}`, url, email, auth) + + keyring := &BasicDockerKeyring{} + if cfg, err := readDockerConfigFileFromBytes([]byte(sampleDockerConfig)); err != nil { + t.Errorf("Error processing json blob %q, %v", sampleDockerConfig, err) + } else { + keyring.Add(cfg) + } + + creds, ok := keyring.Lookup("google/docker-registry") + if !ok { + t.Errorf("Didn't find expected URL: %s", url) + return + } + if len(creds) > 1 { + t.Errorf("Got more hits than expected: %s", creds) + } + val := creds[0] + + if username != val.Username { + t.Errorf("Unexpected username value, want: %s, got: %s", username, val.Username) + } + if password != val.Password { + t.Errorf("Unexpected password value, want: %s, got: %s", password, val.Password) + } + if email != val.Email { + t.Errorf("Unexpected email value, want: %s, got: %s", email, val.Email) + } +} + +func TestKeyringHitWithUnqualifiedLibraryDockerHub(t *testing.T) { + url := defaultRegistryHost + email := "foo@bar.baz" + username := "foo" + password := "bar" + auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password))) + sampleDockerConfig := fmt.Sprintf(`{ + "https://%s": { + "email": %q, + "auth": %q + } +}`, url, email, auth) + + keyring := &BasicDockerKeyring{} + if cfg, err := readDockerConfigFileFromBytes([]byte(sampleDockerConfig)); err != nil { + t.Errorf("Error processing json blob %q, %v", sampleDockerConfig, err) + } else { + keyring.Add(cfg) + } + + creds, ok := keyring.Lookup("jenkins") + if !ok { + t.Errorf("Didn't find expected URL: %s", url) + return + } + if len(creds) > 1 { + t.Errorf("Got more hits than expected: %s", creds) + } + val := creds[0] + + if username != val.Username { + t.Errorf("Unexpected username value, want: %s, got: %s", username, val.Username) + } + if password != val.Password { + t.Errorf("Unexpected password value, want: %s, got: %s", password, val.Password) + } + if email != val.Email { + t.Errorf("Unexpected email value, want: %s, got: %s", email, val.Email) + } +} + +func TestKeyringHitWithQualifiedDockerHub(t *testing.T) { + url := defaultRegistryHost + email := "foo@bar.baz" + username := "foo" + password := "bar" + auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password))) + sampleDockerConfig := fmt.Sprintf(`{ + "https://%s": { + "email": %q, + "auth": %q + } +}`, url, email, auth) + + keyring := &BasicDockerKeyring{} + if cfg, err := readDockerConfigFileFromBytes([]byte(sampleDockerConfig)); err != nil { + t.Errorf("Error processing json blob %q, %v", sampleDockerConfig, err) + } else { + keyring.Add(cfg) + } + + creds, ok := keyring.Lookup(url + "/google/docker-registry") + if !ok { + t.Errorf("Didn't find expected URL: %s", url) + return + } + if len(creds) > 2 { + t.Errorf("Got more hits than expected: %s", creds) + } + val := creds[0] + + if username != val.Username { + t.Errorf("Unexpected username value, want: %s, got: %s", username, val.Username) + } + if password != val.Password { + t.Errorf("Unexpected password value, want: %s, got: %s", password, val.Password) + } + if email != val.Email { + t.Errorf("Unexpected email value, want: %s, got: %s", email, val.Email) + } +} + +func TestIsDefaultRegistryMatch(t *testing.T) { + samples := []map[bool]string{ + {true: "foo/bar"}, + {true: "docker.io/foo/bar"}, + {true: "index.docker.io/foo/bar"}, + {true: "foo"}, + {false: ""}, + {false: "registry.tld/foo/bar"}, + {false: "registry:5000/foo/bar"}, + {false: "myhostdocker.io/foo/bar"}, + } + for _, sample := range samples { + for expected, imageName := range sample { + if got := isDefaultRegistryMatch(imageName); got != expected { + t.Errorf("Expected '%s' to be %t, got %t", imageName, expected, got) + } + } + } +} + +type testProvider struct { + Count int +} + +// Enabled implements dockerConfigProvider +func (d *testProvider) Enabled() bool { + return true +} + +// Provide implements dockerConfigProvider +func (d *testProvider) Provide() DockerConfig { + d.Count += 1 + return DockerConfig{} +} + +func TestLazyKeyring(t *testing.T) { + provider := &testProvider{ + Count: 0, + } + lazy := &lazyDockerKeyring{ + Providers: []DockerConfigProvider{ + provider, + }, + } + + if provider.Count != 0 { + t.Errorf("Unexpected number of Provide calls: %v", provider.Count) + } + lazy.Lookup("foo") + if provider.Count != 1 { + t.Errorf("Unexpected number of Provide calls: %v", provider.Count) + } + lazy.Lookup("foo") + if provider.Count != 2 { + t.Errorf("Unexpected number of Provide calls: %v", provider.Count) + } + lazy.Lookup("foo") + if provider.Count != 3 { + t.Errorf("Unexpected number of Provide calls: %v", provider.Count) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/plugins.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/plugins.go new file mode 100644 index 000000000..cc29ffd83 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/plugins.go @@ -0,0 +1,62 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package credentialprovider + +import ( + "sync" + + "github.com/golang/glog" +) + +// All registered credential providers. +var providersMutex sync.Mutex +var providers = make(map[string]DockerConfigProvider) + +// RegisterCredentialProvider is called by provider implementations on +// initialization to register themselves, like so: +// func init() { +// RegisterCredentialProvider("name", &myProvider{...}) +// } +func RegisterCredentialProvider(name string, provider DockerConfigProvider) { + providersMutex.Lock() + defer providersMutex.Unlock() + _, found := providers[name] + if found { + glog.Fatalf("Credential provider %q was registered twice", name) + } + glog.V(1).Infof("Registered credential provider %q", name) + providers[name] = provider +} + +// NewDockerKeyring creates a DockerKeyring to use for resolving credentials, +// which lazily draws from the set of registered credential providers. +func NewDockerKeyring() DockerKeyring { + keyring := &lazyDockerKeyring{ + Providers: make([]DockerConfigProvider, 0), + } + + // TODO(mattmoor): iterating over the map is non-deterministic. We should + // introduce the notion of priorities for conflict resolution. + for name, provider := range providers { + if provider.Enabled() { + glog.Infof("Registering credential provider: %v", name) + keyring.Providers = append(keyring.Providers, provider) + } + } + + return keyring +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/provider.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/provider.go new file mode 100644 index 000000000..f4f52c8fd --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/provider.go @@ -0,0 +1,95 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package credentialprovider + +import ( + "os" + "reflect" + "sync" + "time" + + "github.com/golang/glog" +) + +// DockerConfigProvider is the interface that registered extensions implement +// to materialize 'dockercfg' credentials. +type DockerConfigProvider interface { + Enabled() bool + Provide() DockerConfig +} + +// A DockerConfigProvider that simply reads the .dockercfg file +type defaultDockerConfigProvider struct{} + +// init registers our default provider, which simply reads the .dockercfg file. +func init() { + RegisterCredentialProvider(".dockercfg", + &CachingDockerConfigProvider{ + Provider: &defaultDockerConfigProvider{}, + Lifetime: 5 * time.Minute, + }) +} + +// CachingDockerConfigProvider implements DockerConfigProvider by composing +// with another DockerConfigProvider and caching the DockerConfig it provides +// for a pre-specified lifetime. +type CachingDockerConfigProvider struct { + Provider DockerConfigProvider + Lifetime time.Duration + + // cache fields + cacheDockerConfig DockerConfig + expiration time.Time + mu sync.Mutex +} + +// Enabled implements dockerConfigProvider +func (d *defaultDockerConfigProvider) Enabled() bool { + return true +} + +// Provide implements dockerConfigProvider +func (d *defaultDockerConfigProvider) Provide() DockerConfig { + // Read the standard Docker credentials from .dockercfg + if cfg, err := ReadDockerConfigFile(); err == nil { + return cfg + } else if !os.IsNotExist(err) { + glog.V(4).Infof("Unable to parse Docker config file: %v", err) + } + return DockerConfig{} +} + +// Enabled implements dockerConfigProvider +func (d *CachingDockerConfigProvider) Enabled() bool { + return d.Provider.Enabled() +} + +// Provide implements dockerConfigProvider +func (d *CachingDockerConfigProvider) Provide() DockerConfig { + d.mu.Lock() + defer d.mu.Unlock() + + // If the cache hasn't expired, return our cache + if time.Now().Before(d.expiration) { + return d.cacheDockerConfig + } + + glog.Infof("Refreshing cache for provider: %v", reflect.TypeOf(d.Provider).String()) + d.cacheDockerConfig = d.Provider.Provide() + d.expiration = time.Now().Add(d.Lifetime) + return d.cacheDockerConfig +} diff --git a/vendor/k8s.io/kubernetes/pkg/credentialprovider/provider_test.go b/vendor/k8s.io/kubernetes/pkg/credentialprovider/provider_test.go new file mode 100644 index 000000000..099d839fb --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/credentialprovider/provider_test.go @@ -0,0 +1,62 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package credentialprovider + +import ( + "testing" + "time" +) + +func TestCachingProvider(t *testing.T) { + provider := &testProvider{ + Count: 0, + } + + cache := &CachingDockerConfigProvider{ + Provider: provider, + Lifetime: 1 * time.Second, + } + + if provider.Count != 0 { + t.Errorf("Unexpected number of Provide calls: %v", provider.Count) + } + cache.Provide() + cache.Provide() + cache.Provide() + cache.Provide() + if provider.Count != 1 { + t.Errorf("Unexpected number of Provide calls: %v", provider.Count) + } + + time.Sleep(cache.Lifetime) + cache.Provide() + cache.Provide() + cache.Provide() + cache.Provide() + if provider.Count != 2 { + t.Errorf("Unexpected number of Provide calls: %v", provider.Count) + } + + time.Sleep(cache.Lifetime) + cache.Provide() + cache.Provide() + cache.Provide() + cache.Provide() + if provider.Count != 3 { + t.Errorf("Unexpected number of Provide calls: %v", provider.Count) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/fieldpath/fieldpath.go b/vendor/k8s.io/kubernetes/pkg/fieldpath/fieldpath.go index 0eba1aafd..88c8a3131 100644 --- a/vendor/k8s.io/kubernetes/pkg/fieldpath/fieldpath.go +++ b/vendor/k8s.io/kubernetes/pkg/fieldpath/fieldpath.go @@ -23,12 +23,12 @@ import ( ) // formatMap formats map[string]string to a string. -func formatMap(m map[string]string) string { - var l string +func formatMap(m map[string]string) (fmtStr string) { for key, value := range m { - l += key + "=" + fmt.Sprintf("%q", value) + "\n" + fmtStr += fmt.Sprintf("%v=%q\n", key, value) } - return l + + return } // ExtractFieldPathAsString extracts the field from the given object @@ -47,13 +47,13 @@ func ExtractFieldPathAsString(obj interface{}, fieldPath string) (string, error) switch fieldPath { case "metadata.annotations": - return formatMap(accessor.Annotations()), nil + return formatMap(accessor.GetAnnotations()), nil case "metadata.labels": - return formatMap(accessor.Labels()), nil + return formatMap(accessor.GetLabels()), nil case "metadata.name": - return accessor.Name(), nil + return accessor.GetName(), nil case "metadata.namespace": - return accessor.Namespace(), nil + return accessor.GetNamespace(), nil } return "", fmt.Errorf("Unsupported fieldPath: %v", fieldPath) diff --git a/vendor/k8s.io/kubernetes/pkg/fields/selector.go b/vendor/k8s.io/kubernetes/pkg/fields/selector.go index 3d0f8711b..c0a638581 100644 --- a/vendor/k8s.io/kubernetes/pkg/fields/selector.go +++ b/vendor/k8s.io/kubernetes/pkg/fields/selector.go @@ -181,6 +181,16 @@ func SelectorFromSet(ls Set) Selector { return andTerm(items) } +// ParseSelectorOrDie takes a string representing a selector and returns an +// object suitable for matching, or panic when an error occur. +func ParseSelectorOrDie(s string) Selector { + selector, err := ParseSelector(s) + if err != nil { + panic(err) + } + return selector +} + // ParseSelector takes a string representing a selector and returns an // object suitable for matching, or an error. func ParseSelector(selector string) (Selector, error) { diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/apply.go b/vendor/k8s.io/kubernetes/pkg/kubectl/apply.go index 8b77abbd1..3149bcb29 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/apply.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/apply.go @@ -21,6 +21,7 @@ import ( "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" ) type debugError interface { @@ -80,7 +81,7 @@ func SetOriginalConfiguration(info *resource.Info, original []byte) error { // If annotate is true, it embeds the result as an anotation in the modified // configuration. If an object was read from the command input, it will use that // version of the object. Otherwise, it will use the version from the server. -func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error) { +func GetModifiedConfiguration(info *resource.Info, annotate bool, codec runtime.Encoder) ([]byte, error) { // First serialize the object without the annotation to prevent recursion, // then add that serialization to it as the annotation and serialize it again. var modified []byte @@ -92,7 +93,7 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error } // Get the current annotations from the object. - annotations := accessor.Annotations() + annotations := accessor.GetAnnotations() if annotations == nil { annotations = map[string]string{} } @@ -100,6 +101,8 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error original := annotations[LastAppliedConfigAnnotation] delete(annotations, LastAppliedConfigAnnotation) accessor.SetAnnotations(annotations) + // TODO: this needs to be abstracted - there should be no assumption that versioned object + // can be marshalled to JSON. modified, err = json.Marshal(info.VersionedObject) if err != nil { return nil, err @@ -108,6 +111,8 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error if annotate { annotations[LastAppliedConfigAnnotation] = string(modified) accessor.SetAnnotations(annotations) + // TODO: this needs to be abstracted - there should be no assumption that versioned object + // can be marshalled to JSON. modified, err = json.Marshal(info.VersionedObject) if err != nil { return nil, err @@ -136,7 +141,7 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error return nil, err } - modified, err = info.Mapping.Codec.Encode(info.Object) + modified, err = runtime.Encode(codec, info.Object) if err != nil { return nil, err } @@ -147,7 +152,7 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error return nil, err } - modified, err = info.Mapping.Codec.Encode(info.Object) + modified, err = runtime.Encode(codec, info.Object) if err != nil { return nil, err } @@ -163,17 +168,30 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool) ([]byte, error return modified, nil } -// UpdateApplyAnnotation gets the modified configuration of the object, +// UpdateApplyAnnotation calls CreateApplyAnnotation if the last applied +// configuration annotation is already present. Otherwise, it does nothing. +func UpdateApplyAnnotation(info *resource.Info, codec runtime.Encoder) error { + if original, err := GetOriginalConfiguration(info); err != nil || len(original) <= 0 { + return err + } + return CreateApplyAnnotation(info, codec) +} + +// CreateApplyAnnotation gets the modified configuration of the object, // without embedding it again, and then sets it on the object as the annotation. -func UpdateApplyAnnotation(info *resource.Info) error { - modified, err := GetModifiedConfiguration(info, false) +func CreateApplyAnnotation(info *resource.Info, codec runtime.Encoder) error { + modified, err := GetModifiedConfiguration(info, false, codec) if err != nil { return err } - - if err := SetOriginalConfiguration(info, modified); err != nil { - return err - } - - return nil + return SetOriginalConfiguration(info, modified) +} + +// Create the annotation used by kubectl apply only when createAnnotation is true +// Otherwise, only update the annotation when it already exists +func CreateOrUpdateAnnotation(createAnnotation bool, info *resource.Info, codec runtime.Encoder) error { + if createAnnotation { + return CreateApplyAnnotation(info, codec) + } + return UpdateApplyAnnotation(info, codec) } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/autoscale.go b/vendor/k8s.io/kubernetes/pkg/kubectl/autoscale.go index 253e5aac4..e831bca70 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/autoscale.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/autoscale.go @@ -36,7 +36,6 @@ func (HorizontalPodAutoscalerV1Beta1) ParamNames() []GeneratorParam { {"default-name", true}, {"name", false}, {"scaleRef-kind", false}, - {"scaleRef-namespace", false}, {"scaleRef-name", false}, {"scaleRef-apiVersion", false}, {"scaleRef-subresource", false}, @@ -94,7 +93,6 @@ func (HorizontalPodAutoscalerV1Beta1) Generate(genericParams map[string]interfac Spec: extensions.HorizontalPodAutoscalerSpec{ ScaleRef: extensions.SubresourceReference{ Kind: params["scaleRef-kind"], - Namespace: params["scaleRef-namespace"], Name: params["scaleRef-name"], APIVersion: params["scaleRef-apiVersion"], Subresource: scaleSubResource, diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/annotate.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/annotate.go index e4dff167e..daebf57d1 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/annotate.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/annotate.go @@ -23,6 +23,7 @@ import ( "io" "strings" + "github.com/golang/glog" "github.com/spf13/cobra" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/kubectl" @@ -39,10 +40,18 @@ type AnnotateOptions struct { removeAnnotations []string builder *resource.Builder filenames []string + selector string overwrite bool all bool resourceVersion string + + changeCause string + recordChangeCause bool + + f *cmdutil.Factory + out io.Writer + cmd *cobra.Command } const ( @@ -56,7 +65,7 @@ If --resource-version is specified, then updates will use this resource version, Possible resources include (case insensitive): pods (po), services (svc), replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), -resourcequotas (quota) or secrets.` +horizontalpodautoscalers (hpa), resourcequotas (quota) or secrets.` annotate_example = `# Update pod 'foo' with the annotation 'description' and the value 'my frontend'. # If the same annotation is set multiple times, only the last value will be applied $ kubectl annotate pods foo description='my frontend' @@ -87,27 +96,31 @@ func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command { Long: annotate_long, Example: annotate_example, Run: func(cmd *cobra.Command, args []string) { - if err := options.Complete(f, args); err != nil { + if err := options.Complete(f, out, cmd, args); err != nil { cmdutil.CheckErr(err) } if err := options.Validate(args); err != nil { cmdutil.CheckErr(cmdutil.UsageError(cmd, err.Error())) } - if err := options.RunAnnotate(f); err != nil { + if err := options.RunAnnotate(); err != nil { cmdutil.CheckErr(err) } }, } + cmdutil.AddPrinterFlags(cmd) + cmd.Flags().StringVarP(&options.selector, "selector", "l", "", "Selector (label query) to filter on") cmd.Flags().BoolVar(&options.overwrite, "overwrite", false, "If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations.") cmd.Flags().BoolVar(&options.all, "all", false, "select all resources in the namespace of the specified resource types") cmd.Flags().StringVar(&options.resourceVersion, "resource-version", "", "If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.") usage := "Filename, directory, or URL to a file identifying the resource to update the annotation" kubectl.AddJsonFilenameFlag(cmd, &options.filenames, usage) + cmdutil.AddRecordFlag(cmd) return cmd } // Complete adapts from the command line args and factory to the data required. -func (o *AnnotateOptions) Complete(f *cmdutil.Factory, args []string) (err error) { +func (o *AnnotateOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) (err error) { + namespace, enforceNamespace, err := f.DefaultNamespace() if err != nil { return err @@ -142,15 +155,23 @@ func (o *AnnotateOptions) Complete(f *cmdutil.Factory, args []string) (err error return err } + o.recordChangeCause = cmdutil.GetRecordFlag(cmd) + o.changeCause = f.Command() + mapper, typer := f.Object() - o.builder = resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + o.builder = resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(namespace).DefaultNamespace(). FilenameParam(enforceNamespace, o.filenames...). + SelectorParam(o.selector). ResourceTypeOrNameArgs(o.all, o.resources...). Flatten(). Latest() + o.f = f + o.out = out + o.cmd = cmd + return nil } @@ -169,7 +190,7 @@ func (o AnnotateOptions) Validate(args []string) error { } // RunAnnotate does the work -func (o AnnotateOptions) RunAnnotate(f *cmdutil.Factory) error { +func (o AnnotateOptions) RunAnnotate() error { r := o.builder.Do() if err := r.Err(); err != nil { return err @@ -185,6 +206,10 @@ func (o AnnotateOptions) RunAnnotate(f *cmdutil.Factory) error { if err != nil { return err } + // If we should record change-cause, add it to new annotations + if cmdutil.ContainsChangeCause(info) || o.recordChangeCause { + o.newAnnotations[kubectl.ChangeCauseAnnotation] = o.changeCause + } if err := o.updateAnnotations(obj); err != nil { return err } @@ -193,19 +218,34 @@ func (o AnnotateOptions) RunAnnotate(f *cmdutil.Factory) error { return err } patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, obj) + createdPatch := err == nil if err != nil { - return err + glog.V(2).Infof("couldn't compute patch: %v", err) } mapping := info.ResourceMapping() - client, err := f.RESTClient(mapping) + client, err := o.f.ClientForMapping(mapping) if err != nil { return err } helper := resource.NewHelper(client, mapping) - _, err = helper.Patch(namespace, name, api.StrategicMergePatchType, patchBytes) - return err + var outputObj runtime.Object + if createdPatch { + outputObj, err = helper.Patch(namespace, name, api.StrategicMergePatchType, patchBytes) + } else { + outputObj, err = helper.Replace(namespace, name, false, obj) + } + if err != nil { + return err + } + outputFormat := cmdutil.GetFlagString(o.cmd, "output") + if outputFormat != "" { + return o.f.PrintObject(o.cmd, outputObj, o.out) + } + mapper, _ := o.f.Object() + cmdutil.PrintSuccess(mapper, false, o.out, info.Mapping.Resource, info.Name, "annotated") + return nil }) } @@ -263,6 +303,10 @@ func validateAnnotations(removeAnnotations []string, newAnnotations map[string]s func validateNoAnnotationOverwrites(meta *api.ObjectMeta, annotations map[string]string) error { var buf bytes.Buffer for key := range annotations { + // change-cause annotation can always be overwritten + if key == kubectl.ChangeCauseAnnotation { + continue + } if value, found := meta.Annotations[key]; found { if buf.Len() > 0 { buf.WriteString("; ") diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/annotate_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/annotate_test.go index 5060a4dc4..d2f58bf65 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/annotate_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/annotate_test.go @@ -392,7 +392,7 @@ func TestAnnotateErrors(t *testing.T) { f, tf, _ := NewAPIFactory() tf.Printer = &testPrinter{} tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdAnnotate(f, buf) @@ -402,7 +402,7 @@ func TestAnnotateErrors(t *testing.T) { cmd.Flags().Set(k, v) } options := &AnnotateOptions{} - err := options.Complete(f, testCase.args) + err := options.Complete(f, buf, cmd, testCase.args) if !testCase.errFn(err) { t.Errorf("%s: unexpected error: %v", k, err) continue @@ -423,7 +423,7 @@ func TestAnnotateObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.Method { case "GET": switch req.URL.Path { @@ -448,17 +448,20 @@ func TestAnnotateObject(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} + buf := bytes.NewBuffer([]byte{}) + cmd := NewCmdAnnotate(f, buf) + cmd.SetOutput(buf) options := &AnnotateOptions{} args := []string{"pods/foo", "a=b", "c-"} - if err := options.Complete(f, args); err != nil { + if err := options.Complete(f, buf, cmd, args); err != nil { t.Fatalf("unexpected error: %v", err) } if err := options.Validate(args); err != nil { t.Fatalf("unexpected error: %v", err) } - if err := options.RunAnnotate(f); err != nil { + if err := options.RunAnnotate(); err != nil { t.Fatalf("unexpected error: %v", err) } } @@ -470,7 +473,7 @@ func TestAnnotateObjectFromFile(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.Method { case "GET": switch req.URL.Path { @@ -495,18 +498,21 @@ func TestAnnotateObjectFromFile(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} + buf := bytes.NewBuffer([]byte{}) + cmd := NewCmdAnnotate(f, buf) + cmd.SetOutput(buf) options := &AnnotateOptions{} options.filenames = []string{"../../../examples/cassandra/cassandra.yaml"} args := []string{"a=b", "c-"} - if err := options.Complete(f, args); err != nil { + if err := options.Complete(f, buf, cmd, args); err != nil { t.Fatalf("unexpected error: %v", err) } if err := options.Validate(args); err != nil { t.Fatalf("unexpected error: %v", err) } - if err := options.RunAnnotate(f); err != nil { + if err := options.RunAnnotate(); err != nil { t.Fatalf("unexpected error: %v", err) } } @@ -518,7 +524,7 @@ func TestAnnotateMultipleObjects(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.Method { case "GET": switch req.URL.Path { @@ -545,18 +551,21 @@ func TestAnnotateMultipleObjects(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} + buf := bytes.NewBuffer([]byte{}) + cmd := NewCmdAnnotate(f, buf) + cmd.SetOutput(buf) options := &AnnotateOptions{} options.all = true args := []string{"pods", "a=b", "c-"} - if err := options.Complete(f, args); err != nil { + if err := options.Complete(f, buf, cmd, args); err != nil { t.Fatalf("unexpected error: %v", err) } if err := options.Validate(args); err != nil { t.Fatalf("unexpected error: %v", err) } - if err := options.RunAnnotate(f); err != nil { + if err := options.RunAnnotate(); err != nil { t.Fatalf("unexpected error: %v", err) } } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apiversions.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apiversions.go index fd5a4faa7..bc04d3eb5 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apiversions.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apiversions.go @@ -20,10 +20,11 @@ import ( "fmt" "io" "os" + "sort" "github.com/spf13/cobra" - "k8s.io/kubernetes/pkg/api/unversioned" + unversioned_client "k8s.io/kubernetes/pkg/client/unversioned" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ) @@ -32,7 +33,7 @@ func NewCmdApiVersions(f *cmdutil.Factory, out io.Writer) *cobra.Command { Use: "api-versions", // apiversions is deprecated. Aliases: []string{"apiversions"}, - Short: "Print available API versions.", + Short: "Print the supported API versions on the server, in the form of \"group/version\".", Run: func(cmd *cobra.Command, args []string) { err := RunApiVersions(f, out) cmdutil.CheckErr(err) @@ -51,19 +52,14 @@ func RunApiVersions(f *cmdutil.Factory, w io.Writer) error { return err } - apiVersions, err := client.ServerAPIVersions() + groupList, err := client.Discovery().ServerGroups() if err != nil { - fmt.Printf("Couldn't get available api versions from server: %v\n", err) - os.Exit(1) + return fmt.Errorf("Couldn't get available api versions from server: %v\n", err) } - - var expAPIVersions *unversioned.APIVersions - expAPIVersions, err = client.Extensions().ServerAPIVersions() - - fmt.Fprintf(w, "Available Server Api Versions: %#v\n", *apiVersions) - if err == nil { - fmt.Fprintf(w, "Available Server Experimental Api Versions: %#v\n", *expAPIVersions) + apiVersions := unversioned_client.ExtractGroupVersions(groupList) + sort.Strings(apiVersions) + for _, v := range apiVersions { + fmt.Fprintln(w, v) } - return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apply.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apply.go index b9da21052..54aabc86b 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apply.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apply.go @@ -23,9 +23,11 @@ import ( "github.com/spf13/cobra" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util/strategicpatch" ) @@ -37,6 +39,7 @@ type ApplyOptions struct { const ( apply_long = `Apply a configuration to a resource by filename or stdin. +The resource will be created if it doesn't exist yet. JSON and YAML formats are accepted.` apply_example = `# Apply the configuration in pod.json to a pod. @@ -66,6 +69,7 @@ func NewCmdApply(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd.MarkFlagRequired("filename") cmdutil.AddValidateFlags(cmd) cmdutil.AddOutputFlagsForMutation(cmd) + cmdutil.AddRecordFlag(cmd) return cmd } @@ -90,7 +94,7 @@ func RunApply(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *Ap } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). Schema(schema). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). @@ -102,6 +106,9 @@ func RunApply(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *Ap return err } + encoder := f.JSONEncoder() + decoder := f.Decoder(false) + count := 0 err = r.Visit(func(info *resource.Info, err error) error { // In this method, info.Object contains the object retrieved from the server @@ -113,17 +120,38 @@ func RunApply(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *Ap // Get the modified configuration of the object. Embed the result // as an annotation in the modified configuration, so that it will appear // in the patch sent to the server. - modified, err := kubectl.GetModifiedConfiguration(info, true) + modified, err := kubectl.GetModifiedConfiguration(info, true, encoder) if err != nil { return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving modified configuration from:\n%v\nfor:", info), info.Source, err) } if err := info.Get(); err != nil { - return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving current configuration of:\n%v\nfrom server for:", info), info.Source, err) + if !errors.IsNotFound(err) { + return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving current configuration of:\n%v\nfrom server for:", info), info.Source, err) + } + // Create the resource if it doesn't exist + // First, update the annotation used by kubectl apply + if err := kubectl.CreateApplyAnnotation(info, encoder); err != nil { + return cmdutil.AddSourceToErr("creating", info.Source, err) + } + + if cmdutil.ShouldRecord(cmd, info) { + if err := cmdutil.RecordChangeCause(info.Object, f.Command()); err != nil { + return cmdutil.AddSourceToErr("creating", info.Source, err) + } + } + + // Then create the resource and skip the three-way merge + if err := createAndRefresh(info); err != nil { + return cmdutil.AddSourceToErr("creating", info.Source, err) + } + count++ + cmdutil.PrintSuccess(mapper, shortOutput, out, info.Mapping.Resource, info.Name, "created") + return nil } // Serialize the current configuration of the object from the server. - current, err := info.Mapping.Codec.Encode(info.Object) + current, err := runtime.Encode(encoder, info.Object) if err != nil { return cmdutil.AddSourceToErr(fmt.Sprintf("serializing current configuration from:\n%v\nfor:", info), info.Source, err) } @@ -134,8 +162,18 @@ func RunApply(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *Ap return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving original configuration from:\n%v\nfor:", info), info.Source, err) } + // Create the versioned struct from the original from the server for + // strategic patch. + // TODO: Move all structs in apply to use raw data. Can be done once + // builder has a RawResult method which delivers raw data instead of + // internal objects. + versionedObject, _, err := decoder.Decode(current, nil, nil) + if err != nil { + return cmdutil.AddSourceToErr(fmt.Sprintf("converting encoded server-side object back to versioned struct:\n%v\nfor:", info), info.Source, err) + } + // Compute a three way strategic merge patch to send to server. - patch, err := strategicpatch.CreateThreeWayMergePatch(original, modified, current, info.VersionedObject, false) + patch, err := strategicpatch.CreateThreeWayMergePatch(original, modified, current, versionedObject, true) if err != nil { format := "creating patch with:\noriginal:\n%s\nmodified:\n%s\ncurrent:\n%s\nfrom:\n%v\nfor:" return cmdutil.AddSourceToErr(fmt.Sprintf(format, original, modified, current, info), info.Source, err) @@ -147,6 +185,17 @@ func RunApply(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *Ap return cmdutil.AddSourceToErr(fmt.Sprintf("applying patch:\n%s\nto:\n%v\nfor:", patch, info), info.Source, err) } + if cmdutil.ShouldRecord(cmd, info) { + patch, err = cmdutil.ChangeResourcePatch(info, f.Command()) + if err != nil { + return err + } + _, err = helper.Patch(info.Namespace, info.Name, api.StrategicMergePatchType, patch) + if err != nil { + return cmdutil.AddSourceToErr(fmt.Sprintf("applying patch:\n%s\nto:\n%v\nfor:", patch, info), info.Source, err) + } + } + count++ cmdutil.PrintSuccess(mapper, shortOutput, out, info.Mapping.Resource, info.Name, "configured") return nil diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apply_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apply_test.go index 505a32400..93a4d304e 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apply_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/apply_test.go @@ -52,8 +52,9 @@ func validateApplyArgs(cmd *cobra.Command, args []string) error { } const ( - filenameRC = "../../../examples/guestbook/redis-master-controller.yaml" - filenameSVC = "../../../examples/guestbook/frontend-service.yaml" + filenameRC = "../../../test/fixtures/pkg/kubectl/cmd/apply/rc.yaml" + filenameSVC = "../../../test/fixtures/pkg/kubectl/cmd/apply/service.yaml" + filenameRCSVC = "../../../test/fixtures/pkg/kubectl/cmd/apply/rc-service.yaml" ) func readBytesFromFile(t *testing.T, filename string) []byte { @@ -170,6 +171,7 @@ func walkMapPath(t *testing.T, start map[string]interface{}, path []string) map[ } func TestApplyObject(t *testing.T) { + initTestErrorHandler(t) nameRC, currentRC := readAndAnnotateReplicationController(t, filenameRC) pathRC := "/namespaces/test/replicationcontrollers/" + nameRC @@ -177,7 +179,7 @@ func TestApplyObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == pathRC && m == "GET": bodyRC := ioutil.NopCloser(bytes.NewReader(currentRC)) @@ -207,7 +209,52 @@ func TestApplyObject(t *testing.T) { } } -func TestApplyMultipleObject(t *testing.T) { +func TestApplyNonExistObject(t *testing.T) { + nameRC, currentRC := readAndAnnotateReplicationController(t, filenameRC) + pathRC := "/namespaces/test/replicationcontrollers" + pathNameRC := pathRC + "/" + nameRC + + f, tf, codec := NewAPIFactory() + tf.Printer = &testPrinter{} + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + switch p, m := req.URL.Path, req.Method; { + case p == pathNameRC && m == "GET": + return &http.Response{StatusCode: 404, Body: ioutil.NopCloser(bytes.NewReader(nil))}, nil + case p == pathRC && m == "POST": + bodyRC := ioutil.NopCloser(bytes.NewReader(currentRC)) + return &http.Response{StatusCode: 201, Body: bodyRC}, nil + default: + t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) + return nil, nil + } + }), + } + tf.Namespace = "test" + buf := bytes.NewBuffer([]byte{}) + + cmd := NewCmdApply(f, buf) + cmd.Flags().Set("filename", filenameRC) + cmd.Flags().Set("output", "name") + cmd.Run(cmd, []string{}) + + // uses the name from the file, not the response + expectRC := "replicationcontroller/" + nameRC + "\n" + if buf.String() != expectRC { + t.Errorf("unexpected output: %s\nexpected: %s", buf.String(), expectRC) + } +} + +func TestApplyMultipleObjectsAsList(t *testing.T) { + testApplyMultipleObjects(t, true) +} + +func TestApplyMultipleObjectsAsFiles(t *testing.T) { + testApplyMultipleObjects(t, false) +} + +func testApplyMultipleObjects(t *testing.T, asList bool) { nameRC, currentRC := readAndAnnotateReplicationController(t, filenameRC) pathRC := "/namespaces/test/replicationcontrollers/" + nameRC @@ -218,7 +265,7 @@ func TestApplyMultipleObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == pathRC && m == "GET": bodyRC := ioutil.NopCloser(bytes.NewReader(currentRC)) @@ -244,8 +291,12 @@ func TestApplyMultipleObject(t *testing.T) { buf := bytes.NewBuffer([]byte{}) cmd := NewCmdApply(f, buf) - cmd.Flags().Set("filename", filenameRC) - cmd.Flags().Set("filename", filenameSVC) + if asList { + cmd.Flags().Set("filename", filenameRCSVC) + } else { + cmd.Flags().Set("filename", filenameRC) + cmd.Flags().Set("filename", filenameSVC) + } cmd.Flags().Set("output", "name") cmd.Run(cmd, []string{}) @@ -253,8 +304,10 @@ func TestApplyMultipleObject(t *testing.T) { // Names should come from the REST response, NOT the files expectRC := "replicationcontroller/" + nameRC + "\n" expectSVC := "service/" + nameSVC + "\n" - expect := expectRC + expectSVC - if buf.String() != expect { - t.Fatalf("unexpected output: %s\nexpected: %s", buf.String(), expect) + // Test both possible orders since output is non-deterministic. + expectOne := expectRC + expectSVC + expectTwo := expectSVC + expectRC + if buf.String() != expectOne && buf.String() != expectTwo { + t.Fatalf("unexpected output: %s\nexpected: %s OR %s", buf.String(), expectOne, expectTwo) } } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/attach.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/attach.go index 611cc0b65..22f1ddb3b 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/attach.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/attach.go @@ -31,6 +31,7 @@ import ( client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/remotecommand" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + utilerrors "k8s.io/kubernetes/pkg/util/errors" ) const ( @@ -38,7 +39,7 @@ const ( $ kubectl attach 123456-7890 # Get output from ruby-container from pod 123456-7890 -$ kubectl attach 123456-7890 -c ruby-container date +$ kubectl attach 123456-7890 -c ruby-container # Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-7890 # and sends stdout/stderr from 'bash' back to the client @@ -56,7 +57,7 @@ func NewCmdAttach(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) cmd := &cobra.Command{ Use: "attach POD -c CONTAINER", Short: "Attach to a running container.", - Long: "Attach to a a process that is already running inside an existing container.", + Long: "Attach to a process that is already running inside an existing container.", Example: attach_example, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(options.Complete(f, cmd, args)) @@ -137,16 +138,17 @@ func (p *AttachOptions) Complete(f *cmdutil.Factory, cmd *cobra.Command, argsIn // Validate checks that the provided attach options are specified. func (p *AttachOptions) Validate() error { + allErrs := []error{} if len(p.PodName) == 0 { - return fmt.Errorf("pod name must be specified") + allErrs = append(allErrs, fmt.Errorf("pod name must be specified")) } if p.Out == nil || p.Err == nil { - return fmt.Errorf("both output and error output must be provided") + allErrs = append(allErrs, fmt.Errorf("both output and error output must be provided")) } if p.Attach == nil || p.Client == nil || p.Config == nil { - return fmt.Errorf("client, client config, and attach must be provided") + allErrs = append(allErrs, fmt.Errorf("client, client config, and attach must be provided")) } - return nil + return utilerrors.NewAggregate(allErrs) } // Run executes a validated remote execution against a pod. @@ -160,9 +162,16 @@ func (p *AttachOptions) Run() error { return fmt.Errorf("pod %s is not running and cannot be attached to; current phase is %s", p.PodName, pod.Status.Phase) } - // TODO: refactor with terminal helpers from the edit utility once that is merged var stdin io.Reader tty := p.TTY + + containerToAttach := p.GetContainer(pod) + if tty && !containerToAttach.TTY { + tty = false + fmt.Fprintf(p.Err, "Unable to use a TTY - container %s doesn't allocate one\n", containerToAttach.Name) + } + + // TODO: refactor with terminal helpers from the edit utility once that is merged if p.Stdin { stdin = p.In if tty { @@ -173,6 +182,7 @@ func (p *AttachOptions) Run() error { if err != nil { glog.Fatal(err) } + fmt.Fprintln(p.Out, "\nHit enter for command prompt") // this handles a clean exit, where the command finished defer term.RestoreTerminal(inFd, oldState) @@ -204,22 +214,38 @@ func (p *AttachOptions) Run() error { Namespace(pod.Namespace). SubResource("attach") req.VersionedParams(&api.PodAttachOptions{ - Container: p.GetContainerName(pod), + Container: containerToAttach.Name, Stdin: stdin != nil, Stdout: p.Out != nil, Stderr: p.Err != nil, TTY: tty, - }, api.Scheme) + }, api.ParameterCodec) - return p.Attach.Attach("POST", req.URL(), p.Config, stdin, p.Out, p.Err, tty) + err = p.Attach.Attach("POST", req.URL(), p.Config, stdin, p.Out, p.Err, tty) + if err != nil { + return err + } + if p.Stdin && tty && pod.Spec.RestartPolicy == api.RestartPolicyAlways { + fmt.Fprintf(p.Out, "Session ended, resume using 'kubectl attach %s -c %s -i -t' command when the pod is running\n", pod.Name, containerToAttach.Name) + } + return nil +} + +// GetContainer returns the container to attach to, with a fallback. +func (p *AttachOptions) GetContainer(pod *api.Pod) api.Container { + if len(p.ContainerName) > 0 { + for _, container := range pod.Spec.Containers { + if container.Name == p.ContainerName { + return container + } + } + } + + glog.V(4).Infof("defaulting container name to %s", pod.Spec.Containers[0].Name) + return pod.Spec.Containers[0] } // GetContainerName returns the name of the container to attach to, with a fallback. func (p *AttachOptions) GetContainerName(pod *api.Pod) string { - if len(p.ContainerName) > 0 { - return p.ContainerName - } - - glog.V(4).Infof("defaulting container name to %s", pod.Spec.Containers[0].Name) - return pod.Spec.Containers[0].Name + return p.GetContainer(pod).Name } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/attach_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/attach_test.go index c508fcf27..7fc4b7fe6 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/attach_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/attach_test.go @@ -22,12 +22,14 @@ import ( "io" "net/http" "net/url" + "strings" "testing" "github.com/spf13/cobra" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/api/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/fake" ) @@ -82,7 +84,7 @@ func TestPodAndContainerAttach(t *testing.T) { f, tf, codec := NewAPIFactory() tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { return nil, nil }), + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { return nil, nil }), } tf.Namespace = "test" tf.ClientConfig = &client.Config{} @@ -109,7 +111,7 @@ func TestPodAndContainerAttach(t *testing.T) { } func TestAttach(t *testing.T) { - version := testapi.Default.Version() + version := testapi.Default.GroupVersion().Version tests := []struct { name, version, podPath, attachPath, container string pod *api.Pod @@ -135,7 +137,7 @@ func TestAttach(t *testing.T) { f, tf, codec := NewAPIFactory() tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == test.podPath && m == "GET": body := objBody(codec, test.pod) @@ -148,7 +150,7 @@ func TestAttach(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: test.version} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: test.version}}} bufOut := bytes.NewBuffer([]byte{}) bufErr := bytes.NewBuffer([]byte{}) bufIn := bytes.NewBuffer([]byte{}) @@ -192,6 +194,72 @@ func TestAttach(t *testing.T) { } } +func TestAttachWarnings(t *testing.T) { + version := testapi.Default.GroupVersion().Version + tests := []struct { + name, container, version, podPath, expectedErr, expectedOut string + pod *api.Pod + stdin, tty bool + }{ + { + name: "fallback tty if not supported", + version: version, + podPath: "/api/" + version + "/namespaces/test/pods/foo", + pod: attachPod(), + stdin: true, + tty: true, + expectedErr: "Unable to use a TTY - container bar doesn't allocate one", + }, + } + for _, test := range tests { + f, tf, codec := NewAPIFactory() + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + switch p, m := req.URL.Path, req.Method; { + case p == test.podPath && m == "GET": + body := objBody(codec, test.pod) + return &http.Response{StatusCode: 200, Body: body}, nil + default: + t.Errorf("%s: unexpected request: %s %#v\n%#v", test.name, req.Method, req.URL, req) + return nil, fmt.Errorf("unexpected request") + } + }), + } + tf.Namespace = "test" + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: test.version}}} + bufOut := bytes.NewBuffer([]byte{}) + bufErr := bytes.NewBuffer([]byte{}) + bufIn := bytes.NewBuffer([]byte{}) + ex := &fakeRemoteAttach{} + params := &AttachOptions{ + ContainerName: test.container, + In: bufIn, + Out: bufOut, + Err: bufErr, + Stdin: test.stdin, + TTY: test.tty, + Attach: ex, + } + cmd := &cobra.Command{} + if err := params.Complete(f, cmd, []string{"foo"}); err != nil { + t.Fatal(err) + } + if err := params.Run(); err != nil { + t.Fatal(err) + } + + if test.stdin && test.tty { + if !test.pod.Spec.Containers[0].TTY { + if !strings.Contains(bufErr.String(), test.expectedErr) { + t.Errorf("%s: Expected TTY fallback warning for attach request: %s", test.name, bufErr.String()) + continue + } + } + } + } +} + func attachPod() *api.Pod { return &api.Pod{ ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test", ResourceVersion: "10"}, diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/autoscale.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/autoscale.go index 9cf4a3f5f..343c3a8a5 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/autoscale.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/autoscale.go @@ -31,22 +31,21 @@ import ( const ( autoscaleLong = `Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster. -Looks up a replication controller by name and creates an autoscaler that uses this replication controller as a reference. +Looks up a deployment or replication controller by name and creates an autoscaler that uses this deployment or replication controller as a reference. An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.` - autoscaleExample = `# Auto scale a replication controller "foo", with the number of pods between 2 to 10, target CPU utilization at a default value that server applies: -$ kubectl autoscale rc foo --min=2 --max=10 + autoscaleExample = `# Auto scale a deployment "foo", with the number of pods between 2 to 10, target CPU utilization at a default value that server applies: +$ kubectl autoscale deployment foo --min=2 --max=10 # Auto scale a replication controller "foo", with the number of pods between 1 to 5, target CPU utilization at 80%: $ kubectl autoscale rc foo --max=5 --cpu-percent=80` ) -// TODO: support autoscale for deployments func NewCmdAutoscale(f *cmdutil.Factory, out io.Writer) *cobra.Command { filenames := []string{} cmd := &cobra.Command{ Use: "autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]", - Short: "Auto-scale a replication controller", + Short: "Auto-scale a deployment or replication controller", Long: autoscaleLong, Example: autoscaleExample, Run: func(cmd *cobra.Command, args []string) { @@ -62,8 +61,10 @@ func NewCmdAutoscale(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd.Flags().Int("cpu-percent", -1, fmt.Sprintf("The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it's not specified or negative, the server will apply a default value.")) cmd.Flags().String("name", "", "The name for the newly created object. If not specified, the name of the input resource will be used.") cmd.Flags().Bool("dry-run", false, "If true, only print the object that would be sent, without creating it.") - usage := "Filename, directory, or URL to a file identifying the resource to get from a server." + usage := "Filename, directory, or URL to a file identifying the resource to autoscale." kubectl.AddJsonFilenameFlag(cmd, &filenames, usage) + cmdutil.AddApplyAnnotationFlags(cmd) + cmdutil.AddRecordFlag(cmd) return cmd } @@ -79,7 +80,7 @@ func RunAutoscale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args [] } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(namespace).DefaultNamespace(). FilenameParam(enforceNamespace, filenames...). @@ -95,13 +96,14 @@ func RunAutoscale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args [] } info := infos[0] mapping := info.ResourceMapping() - if err := f.CanBeAutoscaled(mapping.Kind); err != nil { + if err := f.CanBeAutoscaled(mapping.GroupVersionKind.GroupKind()); err != nil { return err } // Get the generator, setup and validate all required parameters generatorName := cmdutil.GetFlagString(cmd, "generator") - generator, found := f.Generator(generatorName) + generators := f.Generators("autoscale") + generator, found := generators[generatorName] if !found { return cmdutil.UsageError(cmd, fmt.Sprintf("generator %q not found.", generatorName)) } @@ -110,14 +112,17 @@ func RunAutoscale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args [] name := info.Name params["default-name"] = name - params["scaleRef-kind"] = mapping.Kind - params["scaleRef-namespace"] = namespace + params["scaleRef-kind"] = mapping.GroupVersionKind.Kind params["scaleRef-name"] = name - params["scaleRef-apiVersion"] = mapping.APIVersion + params["scaleRef-apiVersion"] = mapping.GroupVersionKind.GroupVersion().String() if err = kubectl.ValidateParams(names, params); err != nil { return err } + // Check for invalid flags used against the present generator. + if err := kubectl.EnsureFlagsValid(cmd, generators, generatorName); err != nil { + return err + } // Generate new object object, err := generator.Generate(params) @@ -125,27 +130,32 @@ func RunAutoscale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args [] return err } - resourceMapper := &resource.Mapper{ObjectTyper: typer, RESTMapper: mapper, ClientMapper: f.ClientMapperForCommand()} + resourceMapper := &resource.Mapper{ + ObjectTyper: typer, + RESTMapper: mapper, + ClientMapper: resource.ClientMapperFunc(f.ClientForMapping), + Decoder: f.Decoder(true), + } hpa, err := resourceMapper.InfoForObject(object) if err != nil { return err } + if cmdutil.ShouldRecord(cmd, hpa) { + if err := cmdutil.RecordChangeCause(hpa.Object, f.Command()); err != nil { + return err + } + object = hpa.Object + } // TODO: extract this flag to a central location, when such a location exists. if cmdutil.GetFlagBool(cmd, "dry-run") { return f.PrintObject(cmd, object, out) } - // Serialize the configuration into an annotation. - if err := kubectl.UpdateApplyAnnotation(hpa); err != nil { + if err := kubectl.CreateOrUpdateAnnotation(cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag), hpa, f.JSONEncoder()); err != nil { return err } - // Serialize the object with the annotation applied. - data, err := hpa.Mapping.Codec.Encode(object) - if err != nil { - return err - } - object, err = resource.NewHelper(hpa.Client, hpa.Mapping).Create(namespace, false, data) + object, err = resource.NewHelper(hpa.Client, hpa.Mapping).Create(namespace, false, object) if err != nil { return err } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/clusterinfo.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/clusterinfo.go index da2e582ef..c76e28f7c 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/clusterinfo.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/clusterinfo.go @@ -45,25 +45,25 @@ func NewCmdClusterInfo(f *cmdutil.Factory, out io.Writer) *cobra.Command { return cmd } -func RunClusterInfo(factory *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error { +func RunClusterInfo(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error { if len(os.Args) > 1 && os.Args[1] == "clusterinfo" { printDeprecationWarning("cluster-info", "clusterinfo") } - client, err := factory.ClientConfig() + client, err := f.ClientConfig() if err != nil { return err } printService(out, "Kubernetes master", client.Host) - mapper, typer := factory.Object() + mapper, typer := f.Object() cmdNamespace := cmdutil.GetFlagString(cmd, "namespace") if cmdNamespace == "" { cmdNamespace = api.NamespaceSystem } // TODO use generalized labels once they are implemented (#341) - b := resource.NewBuilder(mapper, typer, factory.ClientMapperForCommand()). + b := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). NamespaceParam(cmdNamespace).DefaultNamespace(). SelectorParam("kubernetes.io/cluster-service=true"). ResourceTypeOrNameArgs(false, []string{"services"}...). @@ -85,7 +85,12 @@ func RunClusterInfo(factory *cmdutil.Factory, out io.Writer, cmd *cobra.Command) link += "http://" + ip + ":" + strconv.Itoa(port.Port) + " " } } else { - link = client.Host + "/api/" + client.Version + "/proxy/namespaces/" + service.ObjectMeta.Namespace + "/services/" + service.ObjectMeta.Name + if len(client.GroupVersion.Group) == 0 { + link = client.Host + "/api/" + client.GroupVersion.Version + "/proxy/namespaces/" + service.ObjectMeta.Namespace + "/services/" + service.ObjectMeta.Name + } else { + link = client.Host + "/api/" + client.GroupVersion.Group + "/" + client.GroupVersion.Version + "/proxy/namespaces/" + service.ObjectMeta.Namespace + "/services/" + service.ObjectMeta.Name + + } } name := service.ObjectMeta.Labels["kubernetes.io/name"] if len(name) == 0 { diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/cmd.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/cmd.go index ddc14ffcb..2abffaf37 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/cmd.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/cmd.go @@ -21,6 +21,7 @@ import ( "github.com/golang/glog" cmdconfig "k8s.io/kubernetes/pkg/kubectl/cmd/config" + "k8s.io/kubernetes/pkg/kubectl/cmd/rollout" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/util" @@ -110,18 +111,25 @@ __custom_func() { } ` valid_resources = `Valid resource types include: - * pods (aka 'po') - * replicationcontrollers (aka 'rc') - * daemonsets (aka 'ds') - * services (aka 'svc') + * componentstatuses (aka 'cs') * events (aka 'ev') + * endpoints (aka 'ep') + * horizontalpodautoscalers (aka 'hpa') + * ingress (aka 'ing') + * jobs + * limitranges (aka 'limits') * nodes (aka 'no') * namespaces (aka 'ns') - * secrets + * pods (aka 'po') * persistentvolumes (aka 'pv') * persistentvolumeclaims (aka 'pvc') - * limitranges (aka 'limits') + * quota * resourcequotas (aka 'quota') + * replicasets (aka 'rs') + * replicationcontrollers (aka 'rc') + * secrets + * serviceaccounts + * services (aka 'svc') ` ) @@ -153,9 +161,12 @@ Find more information at https://github.com/kubernetes/kubernetes.`, cmds.AddCommand(NewCmdApply(f, out)) cmds.AddCommand(NewCmdNamespace(out)) - cmds.AddCommand(NewCmdLog(f, out)) + cmds.AddCommand(NewCmdLogs(f, out)) cmds.AddCommand(NewCmdRollingUpdate(f, out)) cmds.AddCommand(NewCmdScale(f, out)) + cmds.AddCommand(NewCmdCordon(f, out)) + cmds.AddCommand(NewCmdDrain(f, out)) + cmds.AddCommand(NewCmdUncordon(f, out)) cmds.AddCommand(NewCmdAttach(f, in, out, err)) cmds.AddCommand(NewCmdExec(f, in, out, err)) @@ -166,6 +177,7 @@ Find more information at https://github.com/kubernetes/kubernetes.`, cmds.AddCommand(NewCmdStop(f, out)) cmds.AddCommand(NewCmdExposeService(f, out)) cmds.AddCommand(NewCmdAutoscale(f, out)) + cmds.AddCommand(rollout.NewCmdRollout(f, out)) cmds.AddCommand(NewCmdLabel(f, out)) cmds.AddCommand(NewCmdAnnotate(f, out)) diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/cmd_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/cmd_test.go index b7377dcd0..82783c34f 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/cmd_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/cmd_test.go @@ -24,7 +24,6 @@ import ( "io/ioutil" "os" "reflect" - "strconv" "testing" "time" @@ -39,9 +38,16 @@ import ( cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer" "k8s.io/kubernetes/pkg/util" ) +func initTestErrorHandler(t *testing.T) { + cmdutil.BehaviorOnFatal(func(str string) { + t.Errorf("Error running command: %s", str) + }) +} + type internalType struct { Kind string APIVersion string @@ -63,9 +69,27 @@ type ExternalType2 struct { Name string `json:"name"` } -func (*internalType) IsAnAPIObject() {} -func (*externalType) IsAnAPIObject() {} -func (*ExternalType2) IsAnAPIObject() {} +func (obj *internalType) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *internalType) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() +} +func (obj *internalType) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) +} +func (obj *externalType) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *externalType) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() +} +func (obj *externalType) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) +} +func (obj *ExternalType2) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *ExternalType2) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() +} +func (obj *ExternalType2) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) +} var versionErr = errors.New("not a version") @@ -76,27 +100,32 @@ func versionErrIfFalse(b bool) error { return versionErr } +var validVersion = testapi.Default.GroupVersion().Version +var internalGV = unversioned.GroupVersion{Group: "apitest", Version: runtime.APIVersionInternal} +var unlikelyGV = unversioned.GroupVersion{Group: "apitest", Version: "unlikelyversion"} +var validVersionGV = unversioned.GroupVersion{Group: "apitest", Version: validVersion} + func newExternalScheme() (*runtime.Scheme, meta.RESTMapper, runtime.Codec) { scheme := runtime.NewScheme() - scheme.AddKnownTypeWithName("", "Type", &internalType{}) - scheme.AddKnownTypeWithName("unlikelyversion", "Type", &externalType{}) + scheme.AddKnownTypeWithName(internalGV.WithKind("Type"), &internalType{}) + scheme.AddKnownTypeWithName(unlikelyGV.WithKind("Type"), &externalType{}) //This tests that kubectl will not confuse the external scheme with the internal scheme, even when they accidentally have versions of the same name. - scheme.AddKnownTypeWithName(testapi.Default.Version(), "Type", &ExternalType2{}) + scheme.AddKnownTypeWithName(validVersionGV.WithKind("Type"), &ExternalType2{}) - codec := runtime.CodecFor(scheme, "unlikelyversion") - validVersion := testapi.Default.Version() - mapper := meta.NewDefaultRESTMapper("apitest", []string{"unlikelyversion", validVersion}, func(version string) (*meta.VersionInterfaces, error) { + codecs := serializer.NewCodecFactory(scheme) + codec := codecs.LegacyCodec(unlikelyGV) + mapper := meta.NewDefaultRESTMapper([]unversioned.GroupVersion{unlikelyGV, validVersionGV}, func(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { return &meta.VersionInterfaces{ - Codec: runtime.CodecFor(scheme, version), ObjectConvertor: scheme, MetadataAccessor: meta.NewAccessor(), - }, versionErrIfFalse(version == validVersion || version == "unlikelyversion") + }, versionErrIfFalse(version == validVersionGV || version == unlikelyGV) }) - for _, version := range []string{"unlikelyversion", validVersion} { - for kind := range scheme.KnownTypes(version) { - mixedCase := false + for _, gv := range []unversioned.GroupVersion{unlikelyGV, validVersionGV} { + for kind := range scheme.KnownTypes(gv) { + gvk := gv.WithKind(kind) + scope := meta.RESTScopeNamespace - mapper.Add(scope, kind, version, mixedCase) + mapper.Add(gvk, scope) } } @@ -153,13 +182,19 @@ func NewTestFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) { Object: func() (meta.RESTMapper, runtime.ObjectTyper) { return t.Mapper, t.Typer }, - RESTClient: func(*meta.RESTMapping) (resource.RESTClient, error) { + ClientForMapping: func(*meta.RESTMapping) (resource.RESTClient, error) { return t.Client, t.Err }, + Decoder: func(bool) runtime.Decoder { + return codec + }, + JSONEncoder: func() runtime.Encoder { + return codec + }, Describer: func(*meta.RESTMapping) (kubectl.Describer, error) { return t.Describer, t.Err }, - Printer: func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, columnLabels []string) (kubectl.ResourcePrinter, error) { + Printer: func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, showLabels bool, absoluteTimestamps bool, columnLabels []string) (kubectl.ResourcePrinter, error) { return t.Printer, t.Err }, Validator: func(validate bool, cacheDir string) (validation.Schema, error) { @@ -179,7 +214,7 @@ func NewMixedFactory(apiClient resource.RESTClient) (*cmdutil.Factory, *testFact f.Object = func() (meta.RESTMapper, runtime.ObjectTyper) { return meta.MultiRESTMapper{t.Mapper, testapi.Default.RESTMapper()}, runtime.MultiObjectTyper{t.Typer, api.Scheme} } - f.RESTClient = func(m *meta.RESTMapping) (resource.RESTClient, error) { + f.ClientForMapping = func(m *meta.RESTMapping) (resource.RESTClient, error) { if m.ObjectConvertor == api.Scheme { return apiClient, t.Err } @@ -192,13 +227,7 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) { t := &testFactory{ Validator: validation.NullSchema{}, } - generators := map[string]kubectl.Generator{ - "run/v1": kubectl.BasicReplicationController{}, - "run-pod/v1": kubectl.BasicPod{}, - "service/v1": kubectl.ServiceGeneratorV1{}, - "service/v2": kubectl.ServiceGeneratorV2{}, - "service/test": testServiceGenerator{}, - } + f := &cmdutil.Factory{ Object: func() (meta.RESTMapper, runtime.ObjectTyper) { return testapi.Default.RESTMapper(), api.Scheme @@ -208,15 +237,22 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) { fakeClient := t.Client.(*fake.RESTClient) c := client.NewOrDie(t.ClientConfig) c.Client = fakeClient.Client + c.ExtensionsClient.Client = fakeClient.Client return c, t.Err }, - RESTClient: func(*meta.RESTMapping) (resource.RESTClient, error) { + ClientForMapping: func(*meta.RESTMapping) (resource.RESTClient, error) { return t.Client, t.Err }, + Decoder: func(bool) runtime.Decoder { + return testapi.Default.Codec() + }, + JSONEncoder: func() runtime.Encoder { + return testapi.Default.Codec() + }, Describer: func(*meta.RESTMapping) (kubectl.Describer, error) { return t.Describer, t.Err }, - Printer: func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, columnLabels []string) (kubectl.ResourcePrinter, error) { + Printer: func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, showLabels bool, absoluteTimestamps bool, columnLabels []string) (kubectl.ResourcePrinter, error) { return t.Printer, t.Err }, Validator: func(validate bool, cacheDir string) (validation.Schema, error) { @@ -228,13 +264,35 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) { ClientConfig: func() (*client.Config, error) { return t.ClientConfig, t.Err }, - Generator: func(name string) (kubectl.Generator, bool) { - generator, ok := generators[name] - return generator, ok + Generators: func(cmdName string) map[string]kubectl.Generator { + return cmdutil.DefaultGenerators(cmdName) + }, + LogsForObject: func(object, options runtime.Object) (*client.Request, error) { + fakeClient := t.Client.(*fake.RESTClient) + c := client.NewOrDie(t.ClientConfig) + c.Client = fakeClient.Client + + switch t := object.(type) { + case *api.Pod: + opts, ok := options.(*api.PodLogOptions) + if !ok { + return nil, errors.New("provided options object is not a PodLogOptions") + } + return c.Pods(t.Namespace).GetLogs(t.Name, opts), nil + default: + fqKind, err := api.Scheme.ObjectKind(object) + if err != nil { + return nil, err + } + return nil, fmt.Errorf("cannot get the logs from %v", fqKind) + } }, } rf := cmdutil.NewFactory(nil) f.PodSelectorForObject = rf.PodSelectorForObject + f.MapBasedSelectorForObject = rf.MapBasedSelectorForObject + f.PortsForObject = rf.PortsForObject + f.LabelsForObject = rf.LabelsForObject f.CanBeExposed = rf.CanBeExposed return f, t, testapi.Default.Codec() } @@ -257,7 +315,7 @@ func stringBody(body string) io.ReadCloser { // mapping := &meta.RESTMapping{ // APIVersion: version, // } -// c, err := f.RESTClient(mapping) +// c, err := f.ClientForMapping(mapping) // if err != nil { // t.Errorf("unexpected error: %v", err) // } @@ -269,7 +327,7 @@ func stringBody(body string) io.ReadCloser { func ExamplePrintReplicationControllerWithNamespace() { f, tf, codec := NewAPIFactory() - tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, []string{}) + tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, false, false, []string{}) tf.Client = &fake.RESTClient{ Codec: codec, Client: nil, @@ -305,13 +363,54 @@ func ExamplePrintReplicationControllerWithNamespace() { fmt.Printf("Unexpected error: %v", err) } // Output: - // NAMESPACE CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE - // beep foo foo someimage foo=bar 1 10y + // NAMESPACE CONTROLLER REPLICAS AGE + // beep foo 1 10y +} + +func ExamplePrintReplicationControllerWithWide() { + f, tf, codec := NewAPIFactory() + tf.Printer = kubectl.NewHumanReadablePrinter(false, false, true, false, false, false, []string{}) + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: nil, + } + cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) + ctrl := &api.ReplicationController{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{"foo": "bar"}, + CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, + }, + Spec: api.ReplicationControllerSpec{ + Replicas: 1, + Selector: map[string]string{"foo": "bar"}, + Template: &api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: map[string]string{"foo": "bar"}, + }, + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Name: "foo", + Image: "someimage", + }, + }, + }, + }, + }, + } + err := f.PrintObject(cmd, ctrl, os.Stdout) + if err != nil { + fmt.Printf("Unexpected error: %v", err) + } + // Output: + // CONTROLLER REPLICAS AGE CONTAINER(S) IMAGE(S) SELECTOR + // foo 1 10y foo someimage foo=bar } func ExamplePrintPodWithWideFormat() { f, tf, codec := NewAPIFactory() - tf.Printer = kubectl.NewHumanReadablePrinter(false, false, true, false, []string{}) + tf.Printer = kubectl.NewHumanReadablePrinter(false, false, true, false, false, false, []string{}) tf.Client = &fake.RESTClient{ Codec: codec, Client: nil, @@ -344,6 +443,45 @@ func ExamplePrintPodWithWideFormat() { // test1 1/2 podPhase 6 10y kubernetes-minion-abcd } +func ExamplePrintPodWithShowLabels() { + f, tf, codec := NewAPIFactory() + tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, true, false, []string{}) + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: nil, + } + nodeName := "kubernetes-minion-abcd" + cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) + pod := &api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "test1", + CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, + Labels: map[string]string{ + "l1": "key", + "l2": "value", + }, + }, + Spec: api.PodSpec{ + Containers: make([]api.Container, 2), + NodeName: nodeName, + }, + Status: api.PodStatus{ + Phase: "podPhase", + ContainerStatuses: []api.ContainerStatus{ + {Ready: true, RestartCount: 3, State: api.ContainerState{Running: &api.ContainerStateRunning{}}}, + {RestartCount: 3}, + }, + }, + } + err := f.PrintObject(cmd, pod, os.Stdout) + if err != nil { + fmt.Printf("Unexpected error: %v", err) + } + // Output: + // NAME READY STATUS RESTARTS AGE LABELS + // test1 1/2 podPhase 6 10y l1=key,l2=value +} + func newAllPhasePodList() *api.PodList { nodeName := "kubernetes-minion-abcd" return &api.PodList{ @@ -438,7 +576,7 @@ func newAllPhasePodList() *api.PodList { func ExamplePrintPodHideTerminated() { f, tf, codec := NewAPIFactory() - tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, []string{}) + tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, false, false, []string{}) tf.Client = &fake.RESTClient{ Codec: codec, Client: nil, @@ -458,7 +596,7 @@ func ExamplePrintPodHideTerminated() { func ExamplePrintPodShowAll() { f, tf, codec := NewAPIFactory() - tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, true, []string{}) + tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, true, false, false, []string{}) tf.Client = &fake.RESTClient{ Codec: codec, Client: nil, @@ -480,7 +618,7 @@ func ExamplePrintPodShowAll() { func ExamplePrintServiceWithNamespacesAndLabels() { f, tf, codec := NewAPIFactory() - tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, []string{"l1"}) + tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, false, false, []string{"l1"}) tf.Client = &fake.RESTClient{ Codec: codec, Client: nil, @@ -538,9 +676,9 @@ func ExamplePrintServiceWithNamespacesAndLabels() { fmt.Printf("Unexpected error: %v", err) } // Output: - // |NAMESPACE NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE L1| - // |ns1 svc1 10.1.1.1 unknown 53/UDP,53/TCP s=magic 10y value| - // |ns2 svc2 10.1.1.2 unknown 80/TCP,8080/TCP s=kazam 10y dolla-bill-yall| + // |NAMESPACE NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE L1| + // |ns1 svc1 10.1.1.1 unknown 53/UDP,53/TCP 10y value| + // |ns2 svc2 10.1.1.2 unknown 80/TCP,8080/TCP 10y dolla-bill-yall| // || } @@ -569,111 +707,3 @@ func TestNormalizationFuncGlobalExistence(t *testing.T) { t.Fatal("child and root commands should have the same normalization functions") } } - -type testServiceGenerator struct{} - -func (testServiceGenerator) ParamNames() []kubectl.GeneratorParam { - return []kubectl.GeneratorParam{ - {"default-name", true}, - {"name", false}, - {"port", true}, - {"labels", false}, - {"public-ip", false}, - {"create-external-load-balancer", false}, - {"type", false}, - {"protocol", false}, - {"container-port", false}, // alias of target-port - {"target-port", false}, - {"port-name", false}, - {"session-affinity", false}, - } -} - -func (testServiceGenerator) Generate(genericParams map[string]interface{}) (runtime.Object, error) { - params := map[string]string{} - for key, value := range genericParams { - strVal, isString := value.(string) - if !isString { - return nil, fmt.Errorf("expected string, saw %v for '%s'", value, key) - } - params[key] = strVal - } - labelsString, found := params["labels"] - var labels map[string]string - var err error - if found && len(labelsString) > 0 { - labels, err = kubectl.ParseLabels(labelsString) - if err != nil { - return nil, err - } - } - - name, found := params["name"] - if !found || len(name) == 0 { - name, found = params["default-name"] - if !found || len(name) == 0 { - return nil, fmt.Errorf("'name' is a required parameter.") - } - } - portString, found := params["port"] - if !found { - return nil, fmt.Errorf("'port' is a required parameter.") - } - port, err := strconv.Atoi(portString) - if err != nil { - return nil, err - } - servicePortName, found := params["port-name"] - if !found { - // Leave the port unnamed. - servicePortName = "" - } - service := api.Service{ - ObjectMeta: api.ObjectMeta{ - Name: name, - Labels: labels, - }, - Spec: api.ServiceSpec{ - Ports: []api.ServicePort{ - { - Name: servicePortName, - Port: port, - Protocol: api.Protocol(params["protocol"]), - }, - }, - }, - } - targetPort, found := params["target-port"] - if !found { - targetPort, found = params["container-port"] - } - if found && len(targetPort) > 0 { - if portNum, err := strconv.Atoi(targetPort); err != nil { - service.Spec.Ports[0].TargetPort = util.NewIntOrStringFromString(targetPort) - } else { - service.Spec.Ports[0].TargetPort = util.NewIntOrStringFromInt(portNum) - } - } else { - service.Spec.Ports[0].TargetPort = util.NewIntOrStringFromInt(port) - } - if params["create-external-load-balancer"] == "true" { - service.Spec.Type = api.ServiceTypeLoadBalancer - } - if len(params["external-ip"]) > 0 { - service.Spec.ExternalIPs = []string{params["external-ip"]} - } - if len(params["type"]) != 0 { - service.Spec.Type = api.ServiceType(params["type"]) - } - if len(params["session-affinity"]) != 0 { - switch api.ServiceAffinity(params["session-affinity"]) { - case api.ServiceAffinityNone: - service.Spec.SessionAffinity = api.ServiceAffinityNone - case api.ServiceAffinityClientIP: - service.Spec.SessionAffinity = api.ServiceAffinityClientIP - default: - return nil, fmt.Errorf("unknown session affinity: %s", params["session-affinity"]) - } - } - return &service, nil -} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/config.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/config.go index d73ea2680..47eeecf5c 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/config.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/config.go @@ -71,9 +71,9 @@ func NewCmdConfig(pathOptions *PathOptions, out io.Writer) *cobra.Command { Long: `config modifies kubeconfig files using subcommands like "kubectl config set current-context my-context" The loading order follows these rules: - 1. If the --` + pathOptions.ExplicitFileFlag + ` flag is set, then only that file is loaded. The flag may only be set once and no merging takes place. - 2. If $` + pathOptions.EnvVar + ` environment variable is set, then it is used a list of paths (normal path delimitting rules for your system). These paths are merged together. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list. - 3. Otherwise, ` + path.Join("${HOME}", pathOptions.GlobalFileSubpath) + ` is used and no merging takes place. +1. If the --` + pathOptions.ExplicitFileFlag + ` flag is set, then only that file is loaded. The flag may only be set once and no merging takes place. +2. If $` + pathOptions.EnvVar + ` environment variable is set, then it is used a list of paths (normal path delimitting rules for your system). These paths are merged together. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list. +3. Otherwise, ` + path.Join("${HOME}", pathOptions.GlobalFileSubpath) + ` is used and no merging takes place. `, Run: func(cmd *cobra.Command, args []string) { cmd.Help() @@ -89,6 +89,7 @@ The loading order follows these rules: cmd.AddCommand(NewCmdConfigSetContext(out, pathOptions)) cmd.AddCommand(NewCmdConfigSet(out, pathOptions)) cmd.AddCommand(NewCmdConfigUnset(out, pathOptions)) + cmd.AddCommand(NewCmdConfigCurrentContext(out, pathOptions)) cmd.AddCommand(NewCmdConfigUseContext(out, pathOptions)) return cmd @@ -225,6 +226,7 @@ func ModifyConfig(configAccess ConfigAccess, newConfig clientcmdapi.Config, rela configToWrite := getConfigFromFileOrDie(destinationFile) t := *cluster + configToWrite.Clusters[key] = &t configToWrite.Clusters[key].LocationOfOrigin = destinationFile if relativizePaths { diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/config_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/config_test.go index eb7401fa8..8f33734a0 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/config_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/config_test.go @@ -75,6 +75,17 @@ func ExampleView() { // token: red-token } +func TestCurrentContext(t *testing.T) { + startingConfig := newRedFederalCowHammerConfig() + test := configCommandTest{ + args: []string{"current-context"}, + startingConfig: startingConfig, + expectedConfig: startingConfig, + expectedOutputs: []string{startingConfig.CurrentContext}, + } + test.run(t) +} + func TestSetCurrentContext(t *testing.T) { expectedConfig := newRedFederalCowHammerConfig() startingConfig := newRedFederalCowHammerConfig() @@ -134,14 +145,10 @@ func TestSetWithPathPrefixIntoExistingStruct(t *testing.T) { if err != nil { t.Fatalf("unexpected error: %v", err) } - expectedHost := "http://cow.org:8080" + expectedHost := "http://cow.org:8080/foo/baz" if expectedHost != dcc.Host { t.Fatalf("expected client.Config.Host = %q instead of %q", expectedHost, dcc.Host) } - expectedPrefix := "/foo/baz" - if expectedPrefix != dcc.Prefix { - t.Fatalf("expected client.Config.Prefix = %q instead of %q", expectedPrefix, dcc.Prefix) - } } func TestUnsetStruct(t *testing.T) { @@ -577,13 +584,13 @@ func TestNewEmptyCluster(t *testing.T) { func TestAdditionalCluster(t *testing.T) { expectedConfig := newRedFederalCowHammerConfig() cluster := clientcmdapi.NewCluster() - cluster.APIVersion = testapi.Default.Version() + cluster.APIVersion = testapi.Default.GroupVersion().String() cluster.CertificateAuthority = "/ca-location" cluster.InsecureSkipTLSVerify = false cluster.Server = "serverlocation" expectedConfig.Clusters["different-cluster"] = cluster test := configCommandTest{ - args: []string{"set-cluster", "different-cluster", "--" + clientcmd.FlagAPIServer + "=serverlocation", "--" + clientcmd.FlagInsecure + "=false", "--" + clientcmd.FlagCAFile + "=/ca-location", "--" + clientcmd.FlagAPIVersion + "=" + testapi.Default.Version()}, + args: []string{"set-cluster", "different-cluster", "--" + clientcmd.FlagAPIServer + "=serverlocation", "--" + clientcmd.FlagInsecure + "=false", "--" + clientcmd.FlagCAFile + "=/ca-location", "--" + clientcmd.FlagAPIVersion + "=" + testapi.Default.GroupVersion().String()}, startingConfig: newRedFederalCowHammerConfig(), expectedConfig: expectedConfig, } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/create_authinfo.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/create_authinfo.go index 65422668f..c61cd8c12 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/create_authinfo.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/create_authinfo.go @@ -95,7 +95,8 @@ func NewCmdConfigSetAuthInfo(out io.Writer, configAccess ConfigAccess) *cobra.Co cmd.Flags().Var(&options.token, clientcmd.FlagBearerToken, clientcmd.FlagBearerToken+" for the user entry in kubeconfig") cmd.Flags().Var(&options.username, clientcmd.FlagUsername, clientcmd.FlagUsername+" for the user entry in kubeconfig") cmd.Flags().Var(&options.password, clientcmd.FlagPassword, clientcmd.FlagPassword+" for the user entry in kubeconfig") - cmd.Flags().Var(&options.embedCertData, clientcmd.FlagEmbedCerts, "embed client cert/key for the user entry in kubeconfig") + f := cmd.Flags().VarPF(&options.embedCertData, clientcmd.FlagEmbedCerts, "", "embed client cert/key for the user entry in kubeconfig") + f.NoOptDefVal = "true" return cmd } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/create_cluster.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/create_cluster.go index fb1d086c3..6f463a1b4 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/create_cluster.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/create_cluster.go @@ -79,9 +79,11 @@ func NewCmdConfigSetCluster(out io.Writer, configAccess ConfigAccess) *cobra.Com cmd.Flags().Var(&options.server, clientcmd.FlagAPIServer, clientcmd.FlagAPIServer+" for the cluster entry in kubeconfig") cmd.Flags().Var(&options.apiVersion, clientcmd.FlagAPIVersion, clientcmd.FlagAPIVersion+" for the cluster entry in kubeconfig") - cmd.Flags().Var(&options.insecureSkipTLSVerify, clientcmd.FlagInsecure, clientcmd.FlagInsecure+" for the cluster entry in kubeconfig") + f := cmd.Flags().VarPF(&options.insecureSkipTLSVerify, clientcmd.FlagInsecure, "", clientcmd.FlagInsecure+" for the cluster entry in kubeconfig") + f.NoOptDefVal = "true" cmd.Flags().Var(&options.certificateAuthority, clientcmd.FlagCAFile, "path to "+clientcmd.FlagCAFile+" for the cluster entry in kubeconfig") - cmd.Flags().Var(&options.embedCAData, clientcmd.FlagEmbedCerts, clientcmd.FlagEmbedCerts+" for the cluster entry in kubeconfig") + f = cmd.Flags().VarPF(&options.embedCAData, clientcmd.FlagEmbedCerts, "", clientcmd.FlagEmbedCerts+" for the cluster entry in kubeconfig") + f.NoOptDefVal = "true" return cmd } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/current_context.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/current_context.go new file mode 100644 index 000000000..66e8f78b3 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/current_context.go @@ -0,0 +1,67 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +import ( + "fmt" + "io" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + + "github.com/spf13/cobra" +) + +type CurrentContextOptions struct { + ConfigAccess ConfigAccess +} + +const ( + current_context_long = `Displays the current-context` + current_context_example = `# Display the current-context +$ kubectl config current-context` +) + +func NewCmdConfigCurrentContext(out io.Writer, configAccess ConfigAccess) *cobra.Command { + options := &CurrentContextOptions{ConfigAccess: configAccess} + + cmd := &cobra.Command{ + Use: "current-context", + Short: "Displays the current-context", + Long: current_context_long, + Example: current_context_example, + Run: func(cmd *cobra.Command, args []string) { + err := RunCurrentContext(out, args, options) + cmdutil.CheckErr(err) + }, + } + + return cmd +} + +func RunCurrentContext(out io.Writer, args []string, options *CurrentContextOptions) error { + config, err := options.ConfigAccess.GetStartingConfig() + if err != nil { + return err + } + + if config.CurrentContext == "" { + err = fmt.Errorf("current-context is not set\n") + return err + } + + fmt.Fprintf(out, "%s\n", config.CurrentContext) + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/current_context_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/current_context_test.go new file mode 100644 index 000000000..169c65443 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/current_context_test.go @@ -0,0 +1,90 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +import ( + "bytes" + "io/ioutil" + "os" + "strings" + "testing" + + "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" + clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" +) + +type currentContextTest struct { + startingConfig clientcmdapi.Config + expectedError string +} + +func newFederalContextConfig() clientcmdapi.Config { + return clientcmdapi.Config{ + CurrentContext: "federal-context", + } +} + +func TestCurrentContextWithSetContext(t *testing.T) { + test := currentContextTest{ + startingConfig: newFederalContextConfig(), + expectedError: "", + } + + test.run(t) +} + +func TestCurrentContextWithUnsetContext(t *testing.T) { + test := currentContextTest{ + startingConfig: *clientcmdapi.NewConfig(), + expectedError: "current-context is not set", + } + + test.run(t) +} + +func (test currentContextTest) run(t *testing.T) { + fakeKubeFile, _ := ioutil.TempFile("", "") + defer os.Remove(fakeKubeFile.Name()) + err := clientcmd.WriteToFile(test.startingConfig, fakeKubeFile.Name()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + pathOptions := NewDefaultPathOptions() + pathOptions.GlobalFile = fakeKubeFile.Name() + pathOptions.EnvVar = "" + options := CurrentContextOptions{ + ConfigAccess: pathOptions, + } + + buf := bytes.NewBuffer([]byte{}) + err = RunCurrentContext(buf, []string{}, &options) + if len(test.expectedError) != 0 { + if err == nil { + t.Errorf("Did not get %v", test.expectedError) + } else { + if !strings.Contains(err.Error(), test.expectedError) { + t.Errorf("Expected %v, but got %v", test.expectedError, err) + } + } + return + } + + if err != nil { + t.Errorf("Unexpected error: %v", err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/navigation_step_parser.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/navigation_step_parser.go index 1d4272a81..0be5f241e 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/navigation_step_parser.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/navigation_step_parser.go @@ -55,7 +55,7 @@ func newNavigationSteps(path string) (*navigationSteps, error) { if err != nil { return nil, err } - nextPart := findNameStep(individualParts[currPartIndex:], sets.KeySet(reflect.ValueOf(mapValueOptions))) + nextPart := findNameStep(individualParts[currPartIndex:], sets.StringKeySet(mapValueOptions)) steps = append(steps, navigationStep{nextPart, mapValueType}) currPartIndex += len(strings.Split(nextPart, ".")) diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/view.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/view.go index 8220645ea..50bdb30ad 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/view.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/config/view.go @@ -18,9 +18,9 @@ package config import ( "errors" + "fmt" "io" - "github.com/golang/glog" "github.com/spf13/cobra" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" @@ -42,16 +42,18 @@ type ViewOptions struct { const ( view_long = `Displays merged kubeconfig settings or a specified kubeconfig file. -You can use --output=template --template=TEMPLATE to extract specific values.` +You can use --output jsonpath={...} to extract specific values using a jsonpath expression.` view_example = `# Show Merged kubeconfig settings. $ kubectl config view # Get the password for the e2e user -$ kubectl config view -o template --template='{{range .users}}{{ if eq .name "e2e" }}{{ index .user.password }}{{end}}{{end}}'` +$ kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'` ) func NewCmdConfigView(out io.Writer, ConfigAccess ConfigAccess) *cobra.Command { options := &ViewOptions{ConfigAccess: ConfigAccess} + // Default to yaml + defaultOutputFormat := "yaml" cmd := &cobra.Command{ Use: "view", @@ -60,27 +62,28 @@ func NewCmdConfigView(out io.Writer, ConfigAccess ConfigAccess) *cobra.Command { Example: view_example, Run: func(cmd *cobra.Command, args []string) { options.Complete() + outputFormat := cmdutil.GetFlagString(cmd, "output") + if outputFormat == "wide" { + fmt.Printf("--output wide is not available in kubectl config view; reset to default output format (%s)\n\n", defaultOutputFormat) + cmd.Flags().Set("output", defaultOutputFormat) + } printer, _, err := cmdutil.PrinterForCommand(cmd) - if err != nil { - glog.FatalDepth(1, err) - } - version := cmdutil.OutputVersion(cmd, latest.Version) + cmdutil.CheckErr(err) + version, err := cmdutil.OutputVersion(cmd, &latest.ExternalVersion) + cmdutil.CheckErr(err) printer = kubectl.NewVersionedPrinter(printer, clientcmdapi.Scheme, version) - if err := options.Run(out, printer); err != nil { - glog.FatalDepth(1, err) - } - + cmdutil.CheckErr(options.Run(out, printer)) }, } cmdutil.AddPrinterFlags(cmd) - // Default to yaml - cmd.Flags().Set("output", "yaml") + cmd.Flags().Set("output", defaultOutputFormat) options.Merge.Default(true) - cmd.Flags().Var(&options.Merge, "merge", "merge together the full hierarchy of kubeconfig files") + f := cmd.Flags().VarPF(&options.Merge, "merge", "", "merge together the full hierarchy of kubeconfig files") + f.NoOptDefVal = "true" cmd.Flags().BoolVar(&options.RawByteData, "raw", false, "display raw byte data") cmd.Flags().BoolVar(&options.Flatten, "flatten", false, "flatten the resulting kubeconfig file into self contained output (useful for creating portable kubeconfig files)") cmd.Flags().BoolVar(&options.Minify, "minify", false, "remove all information not used by current-context from the output") diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/convert.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/convert.go index 8421b46c5..e7e04d5b9 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/convert.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/convert.go @@ -20,11 +20,13 @@ import ( "fmt" "io" - "k8s.io/kubernetes/pkg/api/latest" - "k8s.io/kubernetes/pkg/api/registered" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery/registered" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" "github.com/spf13/cobra" ) @@ -86,26 +88,31 @@ type ConvertOptions struct { filenames []string local bool + encoder runtime.Encoder out io.Writer printer kubectl.ResourcePrinter - outputVersion string + outputVersion unversioned.GroupVersion } // Complete collects information required to run Convert command from command line. func (o *ConvertOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) (err error) { - o.outputVersion = cmdutil.OutputVersion(cmd, latest.GroupOrDie("").Version) - if !registered.IsRegisteredAPIVersion(o.outputVersion) { + o.outputVersion, err = cmdutil.OutputVersion(cmd, ®istered.EnabledVersionsForGroup(api.GroupName)[0]) + if err != nil { + return err + } + if !registered.IsEnabledVersion(o.outputVersion) { cmdutil.UsageError(cmd, "'%s' is not a registered version.", o.outputVersion) } // build the builder mapper, typer := f.Object() + clientMapper := resource.ClientMapperFunc(f.ClientForMapping) if o.local { fmt.Fprintln(out, "running in local mode...") - o.builder = resource.NewBuilder(mapper, typer, f.NilClientMapperForCommand()) + o.builder = resource.NewBuilder(mapper, typer, resource.DisabledClientForMapping{clientMapper}, f.Decoder(true)) } else { - o.builder = resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()) + o.builder = resource.NewBuilder(mapper, typer, clientMapper, f.Decoder(true)) schema, err := f.Validator(cmdutil.GetFlagBool(cmd, "validate"), cmdutil.GetFlagString(cmd, "schema-cache-dir")) if err != nil { return err @@ -132,6 +139,7 @@ func (o *ConvertOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra. outputFormat = "template" } } + o.encoder = f.JSONEncoder() o.printer, _, err = kubectl.GetPrinter(outputFormat, templateFile) if err != nil { return err @@ -147,7 +155,7 @@ func (o *ConvertOptions) RunConvert() error { return err } - objects, err := resource.AsVersionedObject(infos, false, o.outputVersion) + objects, err := resource.AsVersionedObject(infos, false, o.outputVersion.String(), o.encoder) if err != nil { return err } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create.go index 7693dce9e..6c4061ea0 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create.go @@ -24,6 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" @@ -56,6 +57,10 @@ func NewCmdCreate(f *cmdutil.Factory, out io.Writer) *cobra.Command { Long: create_long, Example: create_example, Run: func(cmd *cobra.Command, args []string) { + if len(options.Filenames) == 0 { + cmd.Help() + return + } cmdutil.CheckErr(ValidateArgs(cmd, args)) cmdutil.CheckErr(cmdutil.ValidateOutputArgs(cmd)) cmdutil.CheckErr(RunCreate(f, cmd, out, options)) @@ -67,6 +72,12 @@ func NewCmdCreate(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd.MarkFlagRequired("filename") cmdutil.AddValidateFlags(cmd) cmdutil.AddOutputFlagsForMutation(cmd) + cmdutil.AddApplyAnnotationFlags(cmd) + cmdutil.AddRecordFlag(cmd) + + // create subcommands + cmd.AddCommand(NewCmdCreateNamespace(f, out)) + cmd.AddCommand(NewCmdCreateSecret(f, out)) return cmd } @@ -89,7 +100,7 @@ func RunCreate(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *C } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). Schema(schema). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). @@ -106,25 +117,21 @@ func RunCreate(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *C if err != nil { return err } - - // Update the annotation used by kubectl apply - if err := kubectl.UpdateApplyAnnotation(info); err != nil { + if err := kubectl.CreateOrUpdateAnnotation(cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag), info, f.JSONEncoder()); err != nil { return cmdutil.AddSourceToErr("creating", info.Source, err) } - // Serialize the object with the annotation applied. - data, err := info.Mapping.Codec.Encode(info.Object) - if err != nil { - return cmdutil.AddSourceToErr("creating", info.Source, err) + if cmdutil.ShouldRecord(cmd, info) { + if err := cmdutil.RecordChangeCause(info.Object, f.Command()); err != nil { + return cmdutil.AddSourceToErr("creating", info.Source, err) + } } - obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, data) - if err != nil { + if err := createAndRefresh(info); err != nil { return cmdutil.AddSourceToErr("creating", info.Source, err) } count++ - info.Refresh(obj, true) shortOutput := cmdutil.GetFlagString(cmd, "output") == "name" if !shortOutput { printObjectSpecificMessage(info.Object, out) @@ -171,3 +178,80 @@ func makePortsString(ports []api.ServicePort, useNodePort bool) string { } return strings.Join(pieces, ",") } + +// createAndRefresh creates an object from input info and refreshes info with that object +func createAndRefresh(info *resource.Info) error { + obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, info.Object) + if err != nil { + return err + } + info.Refresh(obj, true) + return nil +} + +// NameFromCommandArgs is a utility function for commands that assume the first argument is a resource name +func NameFromCommandArgs(cmd *cobra.Command, args []string) (string, error) { + if len(args) == 0 { + return "", cmdutil.UsageError(cmd, "NAME is required") + } + return args[0], nil +} + +// CreateSubcommandOptions is an options struct to support create subcommands +type CreateSubcommandOptions struct { + // Name of resource being created + Name string + // StructuredGenerator is the resource generator for the object being created + StructuredGenerator kubectl.StructuredGenerator + // DryRun is true if the command should be simulated but not run against the server + DryRun bool + // OutputFormat + OutputFormat string +} + +// RunCreateSubcommand executes a create subcommand using the specified options +func RunCreateSubcommand(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *CreateSubcommandOptions) error { + namespace, _, err := f.DefaultNamespace() + if err != nil { + return err + } + obj, err := options.StructuredGenerator.StructuredGenerate() + if err != nil { + return err + } + mapper, typer := f.Object() + gvk, err := typer.ObjectKind(obj) + mapping, err := mapper.RESTMapping(unversioned.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version) + if err != nil { + return err + } + client, err := f.ClientForMapping(mapping) + if err != nil { + return err + } + resourceMapper := &resource.Mapper{ + ObjectTyper: typer, + RESTMapper: mapper, + ClientMapper: resource.ClientMapperFunc(f.ClientForMapping), + } + info, err := resourceMapper.InfoForObject(obj) + if err != nil { + return err + } + if err := kubectl.UpdateApplyAnnotation(info, f.JSONEncoder()); err != nil { + return err + } + if !options.DryRun { + obj, err = resource.NewHelper(client, mapping).Create(namespace, false, info.Object) + if err != nil { + return err + } + } + + if useShortOutput := options.OutputFormat == "name"; useShortOutput || len(options.OutputFormat) == 0 { + cmdutil.PrintSuccess(mapper, useShortOutput, out, mapping.Resource, options.Name, "created") + return nil + } + + return f.PrintObject(cmd, obj, out) +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_namespace.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_namespace.go new file mode 100644 index 000000000..a66055fb1 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_namespace.go @@ -0,0 +1,76 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cmd + +import ( + "fmt" + "io" + + "github.com/spf13/cobra" + + "k8s.io/kubernetes/pkg/kubectl" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" +) + +const ( + namespaceLong = ` +Create a namespace with the specified name.` + + namespaceExample = ` # Create a new namespace named my-namespace + $ kubectl create namespace my-namespace` +) + +// NewCmdCreateNamespace is a macro command to create a new namespace +func NewCmdCreateNamespace(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command { + cmd := &cobra.Command{ + Use: "namespace NAME [--dry-run]", + Aliases: []string{"ns"}, + Short: "Create a namespace with the specified name.", + Long: namespaceLong, + Example: namespaceExample, + Run: func(cmd *cobra.Command, args []string) { + err := CreateNamespace(f, cmdOut, cmd, args) + cmdutil.CheckErr(err) + }, + } + cmdutil.AddApplyAnnotationFlags(cmd) + cmdutil.AddValidateFlags(cmd) + cmdutil.AddPrinterFlags(cmd) + cmdutil.AddGeneratorFlags(cmd, cmdutil.NamespaceV1GeneratorName) + return cmd +} + +// CreateNamespace implements the behavior to run the create namespace command +func CreateNamespace(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error { + name, err := NameFromCommandArgs(cmd, args) + if err != nil { + return err + } + var generator kubectl.StructuredGenerator + switch generatorName := cmdutil.GetFlagString(cmd, "generator"); generatorName { + case cmdutil.NamespaceV1GeneratorName: + generator = &kubectl.NamespaceGeneratorV1{Name: name} + default: + return cmdutil.UsageError(cmd, fmt.Sprintf("Generator: %s not supported.", generatorName)) + } + return RunCreateSubcommand(f, cmd, cmdOut, &CreateSubcommandOptions{ + Name: name, + StructuredGenerator: generator, + DryRun: cmdutil.GetFlagBool(cmd, "dry-run"), + OutputFormat: cmdutil.GetFlagString(cmd, "output"), + }) +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_namespace_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_namespace_test.go new file mode 100644 index 000000000..dd74eec4b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_namespace_test.go @@ -0,0 +1,53 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cmd + +import ( + "bytes" + "net/http" + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/client/unversioned/fake" +) + +func TestCreateNamespace(t *testing.T) { + namespaceObject := &api.Namespace{} + namespaceObject.Name = "my-namespace" + f, tf, codec := NewAPIFactory() + tf.Printer = &testPrinter{} + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + switch p, m := req.URL.Path, req.Method; { + case p == "/namespaces" && m == "POST": + return &http.Response{StatusCode: 201, Body: objBody(codec, namespaceObject)}, nil + default: + t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) + return nil, nil + } + }), + } + buf := bytes.NewBuffer([]byte{}) + cmd := NewCmdCreateNamespace(f, buf) + cmd.Flags().Set("output", "name") + cmd.Run(cmd, []string{namespaceObject.Name}) + expectedOutput := "namespace/" + namespaceObject.Name + "\n" + if buf.String() != expectedOutput { + t.Errorf("expected output: %s, but got: %s", buf.String(), expectedOutput) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_secret.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_secret.go new file mode 100644 index 000000000..0a4c66b18 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_secret.go @@ -0,0 +1,192 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cmd + +import ( + "fmt" + "io" + + "github.com/spf13/cobra" + + "k8s.io/kubernetes/pkg/kubectl" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" +) + +// NewCmdCreateSecret groups subcommands to create various types of secrets +func NewCmdCreateSecret(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command { + cmd := &cobra.Command{ + Use: "secret", + Short: "Create a secret using specified subcommand.", + Long: "Create a secret using specified subcommand.", + Run: func(cmd *cobra.Command, args []string) { + cmd.Help() + }, + } + cmd.AddCommand(NewCmdCreateSecretDockerRegistry(f, cmdOut)) + cmd.AddCommand(NewCmdCreateSecretGeneric(f, cmdOut)) + return cmd +} + +const ( + secretLong = ` +Create a secret based on a file, directory, or specified literal value + +A single secret may package one or more key/value pairs. + +When creating a secret based on a file, the key will default to the basename of the file, and the value will +default to the file content. If the basename is an invalid key, you may specify an alternate key. + +When creating a secret based on a directory, each file whose basename is a valid key in the directory will be +packaged into the secret. Any directory entries except regular files are ignored (e.g. subdirectories, +symlinks, devices, pipes, etc). +` + + secretExample = ` # Create a new secret named my-secret with keys for each file in folder bar + $ kubectl create secret generic my-secret --from-file=path/to/bar + + # Create a new secret named my-secret with specified keys instead of names on disk + $ kubectl create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub + + # Create a new secret named my-secret with key1=supersecret and key2=topsecret + $ kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret` +) + +// NewCmdCreateSecretGeneric is a command to create generic secrets from files, directories, or literal values +func NewCmdCreateSecretGeneric(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command { + cmd := &cobra.Command{ + Use: "generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]", + Short: "Create a secret from a local file, directory or literal value.", + Long: secretLong, + Example: secretExample, + Run: func(cmd *cobra.Command, args []string) { + err := CreateSecretGeneric(f, cmdOut, cmd, args) + cmdutil.CheckErr(err) + }, + } + cmdutil.AddApplyAnnotationFlags(cmd) + cmdutil.AddValidateFlags(cmd) + cmdutil.AddPrinterFlags(cmd) + cmdutil.AddGeneratorFlags(cmd, cmdutil.SecretV1GeneratorName) + cmd.Flags().StringSlice("from-file", []string{}, "Key files can be specified using their file path, in which case a default name will be given to them, or optionally with a name and file path, in which case the given name will be used. Specifying a directory will iterate each named file in the directory that is a valid secret key.") + cmd.Flags().StringSlice("from-literal", []string{}, "Specify a key and literal value to insert in secret (i.e. mykey=somevalue)") + cmd.Flags().String("type", "", "The type of secret to create") + return cmd +} + +// CreateSecretGeneric is the implementation the create secret generic command +func CreateSecretGeneric(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error { + name, err := NameFromCommandArgs(cmd, args) + if err != nil { + return err + } + var generator kubectl.StructuredGenerator + switch generatorName := cmdutil.GetFlagString(cmd, "generator"); generatorName { + case cmdutil.SecretV1GeneratorName: + generator = &kubectl.SecretGeneratorV1{ + Name: name, + Type: cmdutil.GetFlagString(cmd, "type"), + FileSources: cmdutil.GetFlagStringSlice(cmd, "from-file"), + LiteralSources: cmdutil.GetFlagStringSlice(cmd, "from-literal"), + } + default: + return cmdutil.UsageError(cmd, fmt.Sprintf("Generator: %s not supported.", generatorName)) + } + return RunCreateSubcommand(f, cmd, cmdOut, &CreateSubcommandOptions{ + Name: name, + StructuredGenerator: generator, + DryRun: cmdutil.GetFlagBool(cmd, "dry-run"), + OutputFormat: cmdutil.GetFlagString(cmd, "output"), + }) +} + +const ( + secretForDockerRegistryLong = ` +Create a new secret for use with Docker registries. + +Dockercfg secrets are used to authenticate against Docker registries. + +When using the Docker command line to push images, you can authenticate to a given registry by running + 'docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL'. +That produces a ~/.dockercfg file that is used by subsequent 'docker push' and 'docker pull' commands to +authenticate to the registry. + +When creating applications, you may have a Docker registry that requires authentication. In order for the +nodes to pull images on your behalf, they have to have the credentials. You can provide this information +by creating a dockercfg secret and attaching it to your service account.` + + secretForDockerRegistryExample = ` # If you don't already have a .dockercfg file, you can create a dockercfg secret directly by using: + $ kubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL` +) + +// NewCmdCreateSecretDockerRegistry is a macro command for creating secrets to work with Docker registries +func NewCmdCreateSecretDockerRegistry(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command { + cmd := &cobra.Command{ + Use: "docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-literal=key1=value1] [--dry-run]", + Short: "Create a secret for use with a Docker registry.", + Long: secretForDockerRegistryLong, + Example: secretForDockerRegistryExample, + Run: func(cmd *cobra.Command, args []string) { + err := CreateSecretDockerRegistry(f, cmdOut, cmd, args) + cmdutil.CheckErr(err) + }, + } + cmdutil.AddApplyAnnotationFlags(cmd) + cmdutil.AddValidateFlags(cmd) + cmdutil.AddPrinterFlags(cmd) + cmdutil.AddGeneratorFlags(cmd, cmdutil.SecretForDockerRegistryV1GeneratorName) + cmd.Flags().String("docker-username", "", "Username for Docker registry authentication") + cmd.MarkFlagRequired("docker-username") + cmd.Flags().String("docker-password", "", "Password for Docker registry authentication") + cmd.MarkFlagRequired("docker-password") + cmd.Flags().String("docker-email", "", "Email for Docker registry") + cmd.MarkFlagRequired("docker-email") + cmd.Flags().String("docker-server", "https://index.docker.io/v1/", "Server location for Docker registry") + return cmd +} + +// CreateSecretDockerRegistry is the implementation of the create secret docker-registry command +func CreateSecretDockerRegistry(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error { + name, err := NameFromCommandArgs(cmd, args) + if err != nil { + return err + } + requiredFlags := []string{"docker-username", "docker-password", "docker-email", "docker-server"} + for _, requiredFlag := range requiredFlags { + if value := cmdutil.GetFlagString(cmd, requiredFlag); len(value) == 0 { + return cmdutil.UsageError(cmd, "flag %s is required", requiredFlag) + } + } + var generator kubectl.StructuredGenerator + switch generatorName := cmdutil.GetFlagString(cmd, "generator"); generatorName { + case cmdutil.SecretForDockerRegistryV1GeneratorName: + generator = &kubectl.SecretForDockerRegistryGeneratorV1{ + Name: name, + Username: cmdutil.GetFlagString(cmd, "docker-username"), + Email: cmdutil.GetFlagString(cmd, "docker-email"), + Password: cmdutil.GetFlagString(cmd, "docker-password"), + Server: cmdutil.GetFlagString(cmd, "docker-server"), + } + default: + return cmdutil.UsageError(cmd, fmt.Sprintf("Generator: %s not supported.", generatorName)) + } + return RunCreateSubcommand(f, cmd, cmdOut, &CreateSubcommandOptions{ + Name: name, + StructuredGenerator: generator, + DryRun: cmdutil.GetFlagBool(cmd, "dry-run"), + OutputFormat: cmdutil.GetFlagString(cmd, "output"), + }) +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_secret_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_secret_test.go new file mode 100644 index 000000000..8365513eb --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_secret_test.go @@ -0,0 +1,85 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cmd + +import ( + "bytes" + "net/http" + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/client/unversioned/fake" +) + +func TestCreateSecretGeneric(t *testing.T) { + secretObject := &api.Secret{} + secretObject.Name = "my-secret" + f, tf, codec := NewAPIFactory() + tf.Printer = &testPrinter{} + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + switch p, m := req.URL.Path, req.Method; { + case p == "/namespaces/test/secrets" && m == "POST": + return &http.Response{StatusCode: 201, Body: objBody(codec, secretObject)}, nil + default: + t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) + return nil, nil + } + }), + } + tf.Namespace = "test" + buf := bytes.NewBuffer([]byte{}) + cmd := NewCmdCreateSecretGeneric(f, buf) + cmd.Flags().Set("output", "name") + cmd.Run(cmd, []string{secretObject.Name}) + expectedOutput := "secret/" + secretObject.Name + "\n" + if buf.String() != expectedOutput { + t.Errorf("expected output: %s, but got: %s", buf.String(), expectedOutput) + } +} + +func TestCreateSecretDockerRegistry(t *testing.T) { + secretObject := &api.Secret{} + secretObject.Name = "my-secret" + f, tf, codec := NewAPIFactory() + tf.Printer = &testPrinter{} + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + switch p, m := req.URL.Path, req.Method; { + case p == "/namespaces/test/secrets" && m == "POST": + return &http.Response{StatusCode: 201, Body: objBody(codec, secretObject)}, nil + default: + t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) + return nil, nil + } + }), + } + tf.Namespace = "test" + buf := bytes.NewBuffer([]byte{}) + cmd := NewCmdCreateSecretDockerRegistry(f, buf) + cmd.Flags().Set("docker-username", "test-user") + cmd.Flags().Set("docker-password", "test-pass") + cmd.Flags().Set("docker-email", "test-email") + cmd.Flags().Set("output", "name") + cmd.Run(cmd, []string{secretObject.Name}) + expectedOutput := "secret/" + secretObject.Name + "\n" + if buf.String() != expectedOutput { + t.Errorf("expected output: %s, but got: %s", buf.String(), expectedOutput) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_test.go index d1f2cfe0f..9fdee69f1 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/create_test.go @@ -27,6 +27,7 @@ import ( ) func TestExtraArgsFail(t *testing.T) { + initTestErrorHandler(t) buf := bytes.NewBuffer([]byte{}) f, _, _ := NewAPIFactory() @@ -37,6 +38,7 @@ func TestExtraArgsFail(t *testing.T) { } func TestCreateObject(t *testing.T) { + initTestErrorHandler(t) _, _, rc := testData() rc.Items[0].Name = "redis-master-controller" @@ -44,7 +46,7 @@ func TestCreateObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers" && m == "POST": return &http.Response{StatusCode: 201, Body: objBody(codec, &rc.Items[0])}, nil @@ -69,13 +71,14 @@ func TestCreateObject(t *testing.T) { } func TestCreateMultipleObject(t *testing.T) { + initTestErrorHandler(t) _, svc, rc := testData() f, tf, codec := NewAPIFactory() tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/services" && m == "POST": return &http.Response{StatusCode: 201, Body: objBody(codec, &svc.Items[0])}, nil @@ -103,6 +106,7 @@ func TestCreateMultipleObject(t *testing.T) { } func TestCreateDirectory(t *testing.T) { + initTestErrorHandler(t) _, svc, rc := testData() rc.Items[0].Name = "name" @@ -110,7 +114,7 @@ func TestCreateDirectory(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/services" && m == "POST": return &http.Response{StatusCode: 201, Body: objBody(codec, &svc.Items[0])}, nil @@ -136,6 +140,7 @@ func TestCreateDirectory(t *testing.T) { } func TestPrintObjectSpecificMessage(t *testing.T) { + initTestErrorHandler(t) tests := []struct { obj runtime.Object expectOutput bool @@ -170,6 +175,7 @@ func TestPrintObjectSpecificMessage(t *testing.T) { } func TestMakePortsString(t *testing.T) { + initTestErrorHandler(t) tests := []struct { ports []api.ServicePort useNodePort bool diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/delete.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/delete.go index 7baaba396..7dffd4f99 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/delete.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/delete.go @@ -71,7 +71,7 @@ func NewCmdDelete(f *cmdutil.Factory, out io.Writer) *cobra.Command { // retrieve a list of handled resources from printer as valid args validArgs := []string{} - p, err := f.Printer(nil, false, false, false, false, []string{}) + p, err := f.Printer(nil, false, false, false, false, false, false, []string{}) cmdutil.CheckErr(err) if p != nil { validArgs = p.HandledResources() @@ -108,7 +108,7 @@ func RunDelete(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str } deleteAll := cmdutil.GetFlagBool(cmd, "all") mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). FilenameParam(enforceNamespace, options.Filenames...). @@ -165,7 +165,7 @@ func ReapResult(r *resource.Result, f *cmdutil.Factory, out io.Writer, isDefault if gracePeriod >= 0 { options = api.NewDeleteOptions(int64(gracePeriod)) } - if _, err := reaper.Stop(info.Namespace, info.Name, timeout, options); err != nil { + if err := reaper.Stop(info.Namespace, info.Name, timeout, options); err != nil { return cmdutil.AddSourceToErr("stopping", info.Source, err) } cmdutil.PrintSuccess(mapper, shortOutput, out, info.Mapping.Resource, info.Name, "deleted") diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/delete_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/delete_test.go index c74a1c079..61da45f4f 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/delete_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/delete_test.go @@ -36,7 +36,7 @@ func TestDeleteObjectByTuple(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master-controller" && m == "DELETE": return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil @@ -68,7 +68,7 @@ func TestDeleteNamedObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master-controller" && m == "DELETE": return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil @@ -100,7 +100,7 @@ func TestDeleteObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE": return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil @@ -130,7 +130,7 @@ func TestDeleteObjectNotFound(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE": return &http.Response{StatusCode: 404, Body: stringBody("")}, nil @@ -160,7 +160,7 @@ func TestDeleteObjectIgnoreNotFound(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE": return &http.Response{StatusCode: 404, Body: stringBody("")}, nil @@ -192,12 +192,12 @@ func TestDeleteAllNotFound(t *testing.T) { // Add an item to the list which will result in a 404 on delete svc.Items = append(svc.Items, api.Service{ObjectMeta: api.ObjectMeta{Name: "foo"}}) - notFoundError := &errors.NewNotFound("Service", "foo").(*errors.StatusError).ErrStatus + notFoundError := &errors.NewNotFound(api.Resource("services"), "foo").(*errors.StatusError).ErrStatus tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/services" && m == "GET": return &http.Response{StatusCode: 200, Body: objBody(codec, svc)}, nil @@ -234,12 +234,12 @@ func TestDeleteAllIgnoreNotFound(t *testing.T) { // Add an item to the list which will result in a 404 on delete svc.Items = append(svc.Items, api.Service{ObjectMeta: api.ObjectMeta{Name: "foo"}}) - notFoundError := &errors.NewNotFound("Service", "foo").(*errors.StatusError).ErrStatus + notFoundError := &errors.NewNotFound(api.Resource("services"), "foo").(*errors.StatusError).ErrStatus tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/services" && m == "GET": return &http.Response{StatusCode: 200, Body: objBody(codec, svc)}, nil @@ -274,7 +274,7 @@ func TestDeleteMultipleObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE": return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil @@ -308,7 +308,7 @@ func TestDeleteMultipleObjectContinueOnMissing(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE": return &http.Response{StatusCode: 404, Body: stringBody("")}, nil @@ -345,7 +345,7 @@ func TestDeleteMultipleResourcesWithTheSameName(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/baz" && m == "DELETE": return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil @@ -381,7 +381,7 @@ func TestDeleteDirectory(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case strings.HasPrefix(p, "/namespaces/test/services/") && m == "DELETE": return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil @@ -414,15 +414,15 @@ func TestDeleteMultipleSelector(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/pods" && m == "GET": - if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" { + if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String())) != "a=b" { t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) } return &http.Response{StatusCode: 200, Body: objBody(codec, pods)}, nil case p == "/namespaces/test/services" && m == "GET": - if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" { + if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String())) != "a=b" { t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) } return &http.Response{StatusCode: 200, Body: objBody(codec, svc)}, nil diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/describe.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/describe.go index eaa061014..3ea83ecdc 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/describe.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/describe.go @@ -52,7 +52,8 @@ exists, it will output details for every resource that has a name prefixed with Possible resource types include (case insensitive): pods (po), services (svc), replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), -namespaces (ns), serviceaccounts or secrets.` +namespaces (ns), serviceaccounts, horizontalpodautoscalers (hpa), +endpoints (ep) or secrets.` describe_example = `# Describe a node $ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal @@ -105,7 +106,7 @@ func RunDescribe(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []s } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). FilenameParam(enforceNamespace, options.Filenames...). @@ -146,7 +147,7 @@ func RunDescribe(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []s } func DescribeMatchingResources(mapper meta.RESTMapper, typer runtime.ObjectTyper, f *cmdutil.Factory, namespace, rsrc, prefix string, out io.Writer, originalError error) error { - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). NamespaceParam(namespace).DefaultNamespace(). ResourceTypeOrNameArgs(true, rsrc). SingleResourceType(). diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/describe_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/describe_test.go index 4c473eb9e..35a87f2e5 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/describe_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/describe_test.go @@ -56,7 +56,7 @@ func TestDescribeObject(t *testing.T) { tf.Describer = d tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "GET": return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/drain.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/drain.go new file mode 100644 index 000000000..89cba686d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/drain.go @@ -0,0 +1,373 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cmd + +import ( + "errors" + "fmt" + "io" + "reflect" + "strings" + + "github.com/spf13/cobra" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/controller" + // "k8s.io/kubernetes/pkg/api/unversioned" + client "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/fields" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/kubelet/types" + "k8s.io/kubernetes/pkg/runtime" +) + +type DrainOptions struct { + client *client.Client + factory *cmdutil.Factory + Force bool + GracePeriodSeconds int + IgnoreDaemonsets bool + mapper meta.RESTMapper + nodeInfo *resource.Info + out io.Writer + typer runtime.ObjectTyper +} + +const ( + cordon_long = `Mark node as unschedulable. +` + cordon_example = `# Mark node "foo" as unschedulable. +$ kubectl cordon foo +` +) + +func NewCmdCordon(f *cmdutil.Factory, out io.Writer) *cobra.Command { + options := &DrainOptions{factory: f, out: out} + + return &cobra.Command{ + Use: "cordon NODE", + Short: "Mark node as unschedulable", + Long: cordon_long, + Example: cordon_example, + Run: func(cmd *cobra.Command, args []string) { + cmdutil.CheckErr(options.SetupDrain(cmd, args)) + cmdutil.CheckErr(options.RunCordonOrUncordon(true)) + }, + } +} + +const ( + uncordon_long = `Mark node as schedulable. +` + uncordon_example = `# Mark node "foo" as schedulable. +$ kubectl uncordon foo +` +) + +func NewCmdUncordon(f *cmdutil.Factory, out io.Writer) *cobra.Command { + options := &DrainOptions{factory: f, out: out} + + return &cobra.Command{ + Use: "uncordon NODE", + Short: "Mark node as schedulable", + Long: uncordon_long, + Example: uncordon_example, + Run: func(cmd *cobra.Command, args []string) { + cmdutil.CheckErr(options.SetupDrain(cmd, args)) + cmdutil.CheckErr(options.RunCordonOrUncordon(false)) + }, + } +} + +const ( + drain_long = `Drain node in preparation for maintenance. + +The given node will be marked unschedulable to prevent new pods from arriving. +Then drain deletes all pods except mirror pods (which cannot be deleted through +the API server). If there are DaemonSet-managed pods, drain will not proceed +without --ignore-daemonsets, and regardless it will not delete any +DaemonSet-managed pods, because those pods would be immediately replaced by the +DaemonSet controller, which ignores unschedulable marknigs. If there are any +pods that are neither mirror pods nor managed--by ReplicationController, +DaemonSet or Job--, then drain will not delete any pods unless you use --force. + +When you are ready to put the node back into service, use kubectl uncordon, which +will make the node schedulable again. +` + drain_example = `# Drain node "foo", even if there are pods not managed by a ReplicationController, Job, or DaemonSet on it. +$ kubectl drain foo --force + +# As above, but abort if there are pods not managed by a ReplicationController, Job, or DaemonSet, and use a grace period of 15 minutes. +$ kubectl drain foo --grace-period=900 +` +) + +func NewCmdDrain(f *cmdutil.Factory, out io.Writer) *cobra.Command { + options := &DrainOptions{factory: f, out: out} + + cmd := &cobra.Command{ + Use: "drain NODE", + Short: "Drain node in preparation for maintenance", + Long: drain_long, + Example: drain_example, + Run: func(cmd *cobra.Command, args []string) { + cmdutil.CheckErr(options.SetupDrain(cmd, args)) + cmdutil.CheckErr(options.RunDrain()) + }, + } + cmd.Flags().BoolVar(&options.Force, "force", false, "Continue even if there are pods not managed by a ReplicationController, Job, or DaemonSet.") + cmd.Flags().BoolVar(&options.IgnoreDaemonsets, "ignore-daemonsets", false, "Ignore DaemonSet-managed pods.") + cmd.Flags().IntVar(&options.GracePeriodSeconds, "grace-period", -1, "Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used.") + return cmd +} + +// SetupDrain populates some fields from the factory, grabs command line +// arguments and looks up the node using Builder +func (o *DrainOptions) SetupDrain(cmd *cobra.Command, args []string) error { + var err error + if len(args) != 1 { + return cmdutil.UsageError(cmd, fmt.Sprintf("USAGE: %s [flags]", cmd.Use)) + } + + if o.client, err = o.factory.Client(); err != nil { + return err + } + + o.mapper, o.typer = o.factory.Object() + + cmdNamespace, _, err := o.factory.DefaultNamespace() + if err != nil { + return err + } + + r := o.factory.NewBuilder(). + NamespaceParam(cmdNamespace).DefaultNamespace(). + ResourceNames("node", args[0]). + Do() + + if err = r.Err(); err != nil { + return err + } + + return r.Visit(func(info *resource.Info, err error) error { + if err != nil { + return err + } + o.nodeInfo = info + return nil + }) +} + +// RunDrain runs the 'drain' command +func (o *DrainOptions) RunDrain() error { + if err := o.RunCordonOrUncordon(true); err != nil { + return err + } + + pods, err := o.getPodsForDeletion() + if err != nil { + return err + } + + if err = o.deletePods(pods); err != nil { + return err + } + cmdutil.PrintSuccess(o.mapper, false, o.out, "node", o.nodeInfo.Name, "drained") + return nil +} + +// getPodsForDeletion returns all the pods we're going to delete. If there are +// any unmanaged pods and the user didn't pass --force, we return that list in +// an error. +func (o *DrainOptions) getPodsForDeletion() ([]api.Pod, error) { + pods := []api.Pod{} + podList, err := o.client.Pods(api.NamespaceAll).List(api.ListOptions{FieldSelector: fields.SelectorFromSet(fields.Set{"spec.nodeName": o.nodeInfo.Name})}) + if err != nil { + return pods, err + } + unreplicatedPodNames := []string{} + daemonSetPodNames := []string{} + + for _, pod := range podList.Items { + _, found := pod.ObjectMeta.Annotations[types.ConfigMirrorAnnotationKey] + if found { + // Skip mirror pod + continue + } + replicated := false + daemonset_pod := false + + creatorRef, found := pod.ObjectMeta.Annotations[controller.CreatedByAnnotation] + if found { + // Now verify that the specified creator actually exists. + var sr api.SerializedReference + if err := runtime.DecodeInto(o.factory.Decoder(true), []byte(creatorRef), &sr); err != nil { + return pods, err + } + if sr.Reference.Kind == "ReplicationController" { + rc, err := o.client.ReplicationControllers(sr.Reference.Namespace).Get(sr.Reference.Name) + // Assume the only reason for an error is because the RC is + // gone/missing, not for any other cause. TODO(mml): something more + // sophisticated than this + if err == nil && rc != nil { + replicated = true + } + } else if sr.Reference.Kind == "DaemonSet" { + ds, err := o.client.DaemonSets(sr.Reference.Namespace).Get(sr.Reference.Name) + + // Assume the only reason for an error is because the DaemonSet is + // gone/missing, not for any other cause. TODO(mml): something more + // sophisticated than this + if err == nil && ds != nil { + // Otherwise, treat daemonset-managed pods as unmanaged since + // DaemonSet Controller currently ignores the unschedulable bit. + // FIXME(mml): Add link to the issue concerning a proper way to drain + // daemonset pods, probably using taints. + daemonset_pod = true + } + } else if sr.Reference.Kind == "Job" { + job, err := o.client.Jobs(sr.Reference.Namespace).Get(sr.Reference.Name) + + // Assume the only reason for an error is because the Job is + // gone/missing, not for any other cause. TODO(mml): something more + // sophisticated than this + if err == nil && job != nil { + replicated = true + } + } + } + + switch { + case daemonset_pod: + daemonSetPodNames = append(daemonSetPodNames, pod.Name) + case !replicated: + unreplicatedPodNames = append(unreplicatedPodNames, pod.Name) + if o.Force { + pods = append(pods, pod) + } + default: + pods = append(pods, pod) + } + } + + daemonSetErrors := !o.IgnoreDaemonsets && len(daemonSetPodNames) > 0 + unreplicatedErrors := !o.Force && len(unreplicatedPodNames) > 0 + + switch { + case daemonSetErrors && unreplicatedErrors: + return []api.Pod{}, errors.New(unmanagedMsg(unreplicatedPodNames, daemonSetPodNames, true)) + case daemonSetErrors && !unreplicatedErrors: + return []api.Pod{}, errors.New(unmanagedMsg([]string{}, daemonSetPodNames, true)) + case unreplicatedErrors && !daemonSetErrors: + return []api.Pod{}, errors.New(unmanagedMsg(unreplicatedPodNames, []string{}, true)) + } + + if len(unreplicatedPodNames) > 0 { + fmt.Fprintf(o.out, "WARNING: About to delete these %s\n", unmanagedMsg(unreplicatedPodNames, []string{}, false)) + } + if len(daemonSetPodNames) > 0 { + fmt.Fprintf(o.out, "WARNING: Skipping %s\n", unmanagedMsg([]string{}, daemonSetPodNames, false)) + } + + return pods, nil +} + +// Helper for generating errors or warnings about unmanaged pods. +func unmanagedMsg(unreplicatedNames []string, daemonSetNames []string, include_guidance bool) string { + msgs := []string{} + if len(unreplicatedNames) > 0 { + msg := fmt.Sprintf("pods not managed by ReplicationController, Job, or DaemonSet: %s", strings.Join(unreplicatedNames, ",")) + if include_guidance { + msg += " (use --force to override)" + } + msgs = append(msgs, msg) + } + if len(daemonSetNames) > 0 { + msg := fmt.Sprintf("DaemonSet-managed pods: %s", strings.Join(daemonSetNames, ",")) + if include_guidance { + msg += " (use --ignore-daemonsets to ignore)" + } + msgs = append(msgs, msg) + } + + return strings.Join(msgs, " and ") +} + +// deletePods deletes the pods on the api server +func (o *DrainOptions) deletePods(pods []api.Pod) error { + deleteOptions := api.DeleteOptions{} + if o.GracePeriodSeconds >= 0 { + gracePeriodSeconds := int64(o.GracePeriodSeconds) + deleteOptions.GracePeriodSeconds = &gracePeriodSeconds + } + + for _, pod := range pods { + err := o.client.Pods(pod.Namespace).Delete(pod.Name, &deleteOptions) + if err != nil { + return err + } + cmdutil.PrintSuccess(o.mapper, false, o.out, "pod", pod.Name, "deleted") + } + + return nil +} + +// RunCordonOrUncordon runs either Cordon or Uncordon. The desired value for +// "Unschedulable" is passed as the first arg. +func (o *DrainOptions) RunCordonOrUncordon(desired bool) error { + cmdNamespace, _, err := o.factory.DefaultNamespace() + if err != nil { + return err + } + + if o.nodeInfo.Mapping.GroupVersionKind.Kind == "Node" { + unsched := reflect.ValueOf(o.nodeInfo.Object).Elem().FieldByName("Spec").FieldByName("Unschedulable") + if unsched.Bool() == desired { + cmdutil.PrintSuccess(o.mapper, false, o.out, o.nodeInfo.Mapping.Resource, o.nodeInfo.Name, already(desired)) + } else { + helper := resource.NewHelper(o.client, o.nodeInfo.Mapping) + unsched.SetBool(desired) + _, err := helper.Replace(cmdNamespace, o.nodeInfo.Name, true, o.nodeInfo.Object) + if err != nil { + return err + } + cmdutil.PrintSuccess(o.mapper, false, o.out, o.nodeInfo.Mapping.Resource, o.nodeInfo.Name, changed(desired)) + } + } else { + cmdutil.PrintSuccess(o.mapper, false, o.out, o.nodeInfo.Mapping.Resource, o.nodeInfo.Name, "skipped") + } + + return nil +} + +// already() and changed() return suitable strings for {un,}cordoning + +func already(desired bool) string { + if desired { + return "already cordoned" + } + return "already uncordoned" +} + +func changed(desired bool) string { + if desired { + return "cordoned" + } + return "uncordoned" +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/drain_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/drain_test.go new file mode 100644 index 000000000..b0aa36649 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/drain_test.go @@ -0,0 +1,494 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cmd + +import ( + "bytes" + "io" + "io/ioutil" + "net/http" + "net/url" + "os" + "reflect" + "strings" + "testing" + "time" + + "github.com/spf13/cobra" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" + client "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/unversioned/fake" + "k8s.io/kubernetes/pkg/controller" + "k8s.io/kubernetes/pkg/conversion" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + "k8s.io/kubernetes/pkg/runtime" +) + +var node *api.Node +var cordoned_node *api.Node + +func TestMain(m *testing.M) { + // Create a node. + node = &api.Node{ + ObjectMeta: api.ObjectMeta{ + Name: "node", + CreationTimestamp: unversioned.Time{time.Now()}, + }, + Spec: api.NodeSpec{ + ExternalID: "node", + }, + Status: api.NodeStatus{}, + } + clone, _ := conversion.NewCloner().DeepCopy(node) + + // A copy of the same node, but cordoned. + cordoned_node = clone.(*api.Node) + cordoned_node.Spec.Unschedulable = true + os.Exit(m.Run()) +} + +func TestCordon(t *testing.T) { + tests := []struct { + description string + node *api.Node + expected *api.Node + cmd func(*cmdutil.Factory, io.Writer) *cobra.Command + arg string + expectFatal bool + }{ + { + description: "node/node syntax", + node: cordoned_node, + expected: node, + cmd: NewCmdUncordon, + arg: "node/node", + expectFatal: false, + }, + { + description: "uncordon for real", + node: cordoned_node, + expected: node, + cmd: NewCmdUncordon, + arg: "node", + expectFatal: false, + }, + { + description: "uncordon does nothing", + node: node, + expected: node, + cmd: NewCmdUncordon, + arg: "node", + expectFatal: false, + }, + { + description: "cordon does nothing", + node: cordoned_node, + expected: cordoned_node, + cmd: NewCmdCordon, + arg: "node", + expectFatal: false, + }, + { + description: "cordon for real", + node: node, + expected: cordoned_node, + cmd: NewCmdCordon, + arg: "node", + expectFatal: false, + }, + { + description: "cordon missing node", + node: node, + expected: node, + cmd: NewCmdCordon, + arg: "bar", + expectFatal: true, + }, + { + description: "uncordon missing node", + node: node, + expected: node, + cmd: NewCmdUncordon, + arg: "bar", + expectFatal: true, + }, + } + + for _, test := range tests { + f, tf, codec := NewAPIFactory() + new_node := &api.Node{} + updated := false + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + m := &MyReq{req} + switch { + case m.isFor("GET", "/nodes/node"): + return &http.Response{StatusCode: 200, Body: objBody(codec, test.node)}, nil + case m.isFor("GET", "/nodes/bar"): + return &http.Response{StatusCode: 404, Body: stringBody("nope")}, nil + case m.isFor("PUT", "/nodes/node"): + data, err := ioutil.ReadAll(req.Body) + if err != nil { + t.Fatalf("%s: unexpected error: %v", test.description, err) + } + defer req.Body.Close() + if err := runtime.DecodeInto(codec, data, new_node); err != nil { + t.Fatalf("%s: unexpected error: %v", test.description, err) + } + if !reflect.DeepEqual(test.expected.Spec, new_node.Spec) { + t.Fatalf("%s: expected:\n%v\nsaw:\n%v\n", test.description, test.expected.Spec, new_node.Spec) + } + updated = true + return &http.Response{StatusCode: 200, Body: objBody(codec, new_node)}, nil + default: + t.Fatalf("%s: unexpected request: %v %#v\n%#v", test.description, req.Method, req.URL, req) + return nil, nil + } + }), + } + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} + + buf := bytes.NewBuffer([]byte{}) + cmd := test.cmd(f, buf) + + saw_fatal := false + func() { + defer func() { + // Recover from the panic below. + _ = recover() + // Restore cmdutil behavior + cmdutil.DefaultBehaviorOnFatal() + }() + cmdutil.BehaviorOnFatal(func(e string) { saw_fatal = true; panic(e) }) + cmd.SetArgs([]string{test.arg}) + cmd.Execute() + }() + + if test.expectFatal { + if !saw_fatal { + t.Fatalf("%s: unexpected non-error", test.description) + } + if updated { + t.Fatalf("%s: unexpcted update", test.description) + } + } + + if !test.expectFatal && saw_fatal { + t.Fatalf("%s: unexpected error", test.description) + } + if !reflect.DeepEqual(test.expected.Spec, test.node.Spec) && !updated { + t.Fatalf("%s: node never updated", test.description) + } + } +} + +func TestDrain(t *testing.T) { + labels := make(map[string]string) + labels["my_key"] = "my_value" + + rc := api.ReplicationController{ + ObjectMeta: api.ObjectMeta{ + Name: "rc", + Namespace: "default", + CreationTimestamp: unversioned.Time{time.Now()}, + Labels: labels, + SelfLink: testapi.Default.SelfLink("replicationcontrollers", "rc"), + }, + Spec: api.ReplicationControllerSpec{ + Selector: labels, + }, + } + + rc_anno := make(map[string]string) + rc_anno[controller.CreatedByAnnotation] = refJson(t, &rc) + + replicated_pod := api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "bar", + Namespace: "default", + CreationTimestamp: unversioned.Time{time.Now()}, + Labels: labels, + Annotations: rc_anno, + }, + Spec: api.PodSpec{ + NodeName: "node", + }, + } + + ds := extensions.DaemonSet{ + ObjectMeta: api.ObjectMeta{ + Name: "ds", + Namespace: "default", + CreationTimestamp: unversioned.Time{time.Now()}, + SelfLink: "/apis/extensions/v1beta1/namespaces/default/daemonsets/ds", + }, + Spec: extensions.DaemonSetSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: labels}, + }, + } + + ds_anno := make(map[string]string) + ds_anno[controller.CreatedByAnnotation] = refJson(t, &ds) + + ds_pod := api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "bar", + Namespace: "default", + CreationTimestamp: unversioned.Time{time.Now()}, + Labels: labels, + Annotations: ds_anno, + }, + Spec: api.PodSpec{ + NodeName: "node", + }, + } + + job := extensions.Job{ + ObjectMeta: api.ObjectMeta{ + Name: "job", + Namespace: "default", + CreationTimestamp: unversioned.Time{time.Now()}, + SelfLink: "/apis/extensions/v1beta1/namespaces/default/jobs/job", + }, + Spec: extensions.JobSpec{ + Selector: &unversioned.LabelSelector{MatchLabels: labels}, + }, + } + + job_pod := api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "bar", + Namespace: "default", + CreationTimestamp: unversioned.Time{time.Now()}, + Labels: labels, + Annotations: map[string]string{controller.CreatedByAnnotation: refJson(t, &job)}, + }, + } + + naked_pod := api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "bar", + Namespace: "default", + CreationTimestamp: unversioned.Time{time.Now()}, + Labels: labels, + }, + Spec: api.PodSpec{ + NodeName: "node", + }, + } + + tests := []struct { + description string + node *api.Node + expected *api.Node + pods []api.Pod + rcs []api.ReplicationController + args []string + expectFatal bool + expectDelete bool + }{ + { + description: "RC-managed pod", + node: node, + expected: cordoned_node, + pods: []api.Pod{replicated_pod}, + rcs: []api.ReplicationController{rc}, + args: []string{"node"}, + expectFatal: false, + expectDelete: true, + }, + { + description: "DS-managed pod", + node: node, + expected: cordoned_node, + pods: []api.Pod{ds_pod}, + rcs: []api.ReplicationController{rc}, + args: []string{"node"}, + expectFatal: true, + expectDelete: false, + }, + { + description: "DS-managed pod with --ignore-daemonsets", + node: node, + expected: cordoned_node, + pods: []api.Pod{ds_pod}, + rcs: []api.ReplicationController{rc}, + args: []string{"node", "--ignore-daemonsets"}, + expectFatal: false, + expectDelete: false, + }, + { + description: "Job-managed pod", + node: node, + expected: cordoned_node, + pods: []api.Pod{job_pod}, + rcs: []api.ReplicationController{rc}, + args: []string{"node"}, + expectFatal: false, + expectDelete: true, + }, + { + description: "naked pod", + node: node, + expected: cordoned_node, + pods: []api.Pod{naked_pod}, + rcs: []api.ReplicationController{}, + args: []string{"node"}, + expectFatal: true, + expectDelete: false, + }, + { + description: "naked pod with --force", + node: node, + expected: cordoned_node, + pods: []api.Pod{naked_pod}, + rcs: []api.ReplicationController{}, + args: []string{"node", "--force"}, + expectFatal: false, + expectDelete: true, + }, + { + description: "empty node", + node: node, + expected: cordoned_node, + pods: []api.Pod{}, + rcs: []api.ReplicationController{rc}, + args: []string{"node"}, + expectFatal: false, + expectDelete: false, + }, + } + + for _, test := range tests { + new_node := &api.Node{} + deleted := false + f, tf, codec := NewAPIFactory() + + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + m := &MyReq{req} + switch { + case m.isFor("GET", "/nodes/node"): + return &http.Response{StatusCode: 200, Body: objBody(codec, test.node)}, nil + case m.isFor("GET", "/namespaces/default/replicationcontrollers/rc"): + return &http.Response{StatusCode: 200, Body: objBody(codec, &test.rcs[0])}, nil + case m.isFor("GET", "/namespaces/default/daemonsets/ds"): + return &http.Response{StatusCode: 200, Body: objBody(testapi.Extensions.Codec(), &ds)}, nil + case m.isFor("GET", "/namespaces/default/jobs/job"): + return &http.Response{StatusCode: 200, Body: objBody(testapi.Extensions.Codec(), &job)}, nil + case m.isFor("GET", "/pods"): + values, err := url.ParseQuery(req.URL.RawQuery) + if err != nil { + t.Fatalf("%s: unexpected error: %v", test.description, err) + } + get_params := make(url.Values) + get_params["fieldSelector"] = []string{"spec.nodeName=node"} + if !reflect.DeepEqual(get_params, values) { + t.Fatalf("%s: expected:\n%v\nsaw:\n%v\n", test.description, get_params, values) + } + return &http.Response{StatusCode: 200, Body: objBody(codec, &api.PodList{Items: test.pods})}, nil + case m.isFor("GET", "/replicationcontrollers"): + return &http.Response{StatusCode: 200, Body: objBody(codec, &api.ReplicationControllerList{Items: test.rcs})}, nil + case m.isFor("PUT", "/nodes/node"): + data, err := ioutil.ReadAll(req.Body) + if err != nil { + t.Fatalf("%s: unexpected error: %v", test.description, err) + } + defer req.Body.Close() + if err := runtime.DecodeInto(codec, data, new_node); err != nil { + t.Fatalf("%s: unexpected error: %v", test.description, err) + } + if !reflect.DeepEqual(test.expected.Spec, new_node.Spec) { + t.Fatalf("%s: expected:\n%v\nsaw:\n%v\n", test.description, test.expected.Spec, new_node.Spec) + } + return &http.Response{StatusCode: 200, Body: objBody(codec, new_node)}, nil + case m.isFor("DELETE", "/namespaces/default/pods/bar"): + deleted = true + return &http.Response{StatusCode: 204, Body: objBody(codec, &test.pods[0])}, nil + default: + t.Fatalf("%s: unexpected request: %v %#v\n%#v", test.description, req.Method, req.URL, req) + return nil, nil + } + }), + } + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} + + buf := bytes.NewBuffer([]byte{}) + cmd := NewCmdDrain(f, buf) + + saw_fatal := false + func() { + defer func() { + // Recover from the panic below. + _ = recover() + // Restore cmdutil behavior + cmdutil.DefaultBehaviorOnFatal() + }() + cmdutil.BehaviorOnFatal(func(e string) { saw_fatal = true; panic(e) }) + cmd.SetArgs(test.args) + cmd.Execute() + }() + + if test.expectFatal { + if !saw_fatal { + t.Fatalf("%s: unexpected non-error", test.description) + } + } + + if test.expectDelete { + if !deleted { + t.Fatalf("%s: pod never deleted", test.description) + } + } + if !test.expectDelete { + if deleted { + t.Fatalf("%s: unexpected delete", test.description) + } + } + } +} + +type MyReq struct { + Request *http.Request +} + +func (m *MyReq) isFor(method string, path string) bool { + req := m.Request + + return method == req.Method && (req.URL.Path == path || req.URL.Path == strings.Join([]string{"/api/v1", path}, "") || req.URL.Path == strings.Join([]string{"/apis/extensions/v1beta1", path}, "")) +} + +func refJson(t *testing.T, o runtime.Object) string { + ref, err := api.GetReference(o) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + _, _, codec := NewAPIFactory() + json, err := runtime.Encode(codec, &api.SerializedReference{Reference: *ref}) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + return string(json) +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/edit.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/edit.go index 83c5ed46a..7543c4a0e 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/edit.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/edit.go @@ -23,16 +23,19 @@ import ( "fmt" "io" "os" + gruntime "runtime" "strings" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" - client "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/cmd/util/editor" "k8s.io/kubernetes/pkg/kubectl/cmd/util/jsonmerge" "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util/strategicpatch" "k8s.io/kubernetes/pkg/util/yaml" @@ -44,15 +47,16 @@ const ( editLong = `Edit a resource from the default editor. The edit command allows you to directly edit any API resource you can retrieve via the -command line tools. It will open the editor defined by your KUBE_EDITOR, GIT_EDITOR, -or EDITOR environment variables, or fall back to 'vi'. You can edit multiple objects, -although changes are applied one at a time. The command accepts filenames as well as -command line arguments, although the files you point to must be previously saved -versions of resources. +command line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR +environment variables, or fall back to 'vi' for Linux or 'notepad' for Windows. +You can edit multiple objects, although changes are applied one at a time. The command +accepts filenames as well as command line arguments, although the files you point to must +be previously saved versions of resources. The files to edit will be output in the default API version, or a version specified by --output-version. The default format is YAML - if you would like to edit in JSON -pass -o json. +pass -o json. The flag --windows-line-endings can be used to force Windows line endings, +otherwise the default for your operating system will be used. In the event an error occurs while updating, a temporary file will be created on disk that contains your unapplied changes. The most common error when updating a resource @@ -91,6 +95,9 @@ func NewCmdEdit(f *cmdutil.Factory, out io.Writer) *cobra.Command { kubectl.AddJsonFilenameFlag(cmd, &filenames, usage) cmd.Flags().StringP("output", "o", "yaml", "Output format. One of: yaml|json.") cmd.Flags().String("output-version", "", "Output the formatted object with the given version (default api-version).") + cmd.Flags().Bool("windows-line-endings", gruntime.GOOS == "windows", "Use Windows line-endings (default Unix line-endings)") + cmdutil.AddApplyAnnotationFlags(cmd) + cmdutil.AddRecordFlag(cmd) return cmd } @@ -114,13 +121,14 @@ func RunEdit(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin } mapper, typer := f.Object() - rmap := &resource.Mapper{ + resourceMapper := &resource.Mapper{ ObjectTyper: typer, RESTMapper: mapper, - ClientMapper: f.ClientMapperForCommand(), + ClientMapper: resource.ClientMapperFunc(f.ClientForMapping), + Decoder: f.Decoder(true), } - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). NamespaceParam(cmdNamespace).DefaultNamespace(). FilenameParam(enforceNamespace, filenames...). ResourceTypeOrNameArgs(true, args...). @@ -142,142 +150,166 @@ func RunEdit(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin return err } - defaultVersion := cmdutil.OutputVersion(cmd, clientConfig.Version) + encoder := f.JSONEncoder() + + windowsLineEndings := cmdutil.GetFlagBool(cmd, "windows-line-endings") + edit := editor.NewDefaultEditor(f.EditorEnvs()) + defaultVersion, err := cmdutil.OutputVersion(cmd, clientConfig.GroupVersion) + if err != nil { + return err + } results := editResults{} for { - obj, err := resource.AsVersionedObject(infos, false, defaultVersion) + objs, err := resource.AsVersionedObjects(infos, defaultVersion.String(), encoder) if err != nil { return preservedFile(err, results.file, out) } + // if input object is a list, traverse and edit each item one at a time + for _, obj := range objs { + // TODO: add an annotating YAML printer that can print inline comments on each field, + // including descriptions or validation errors - // TODO: add an annotating YAML printer that can print inline comments on each field, - // including descriptions or validation errors - - // generate the file to edit - buf := &bytes.Buffer{} - if err := results.header.writeTo(buf); err != nil { - return preservedFile(err, results.file, out) - } - if err := printer.PrintObj(obj, buf); err != nil { - return preservedFile(err, results.file, out) - } - original := buf.Bytes() - - // launch the editor - edit := editor.NewDefaultEditor() - edited, file, err := edit.LaunchTempFile("kubectl-edit-", ext, buf) - if err != nil { - return preservedFile(err, results.file, out) - } - - // cleanup any file from the previous pass - if len(results.file) > 0 { - os.Remove(results.file) - } - - glog.V(4).Infof("User edited:\n%s", string(edited)) - fmt.Printf("User edited:\n%s", string(edited)) - lines, err := hasLines(bytes.NewBuffer(edited)) - if err != nil { - return preservedFile(err, file, out) - } - if bytes.Equal(original, edited) { - if len(results.edit) > 0 { - preservedFile(nil, file, out) - } else { - os.Remove(file) + // generate the file to edit + buf := &bytes.Buffer{} + var w io.Writer = buf + if windowsLineEndings { + w = util.NewCRLFWriter(w) } - fmt.Fprintln(out, "Edit cancelled, no changes made.") - return nil - } - if !lines { - if len(results.edit) > 0 { - preservedFile(nil, file, out) - } else { - os.Remove(file) + if err := results.header.writeTo(w); err != nil { + return preservedFile(err, results.file, out) } - fmt.Fprintln(out, "Edit cancelled, saved file was empty.") - return nil - } + if err := printer.PrintObj(obj, w); err != nil { + return preservedFile(err, results.file, out) + } + original := buf.Bytes() - results = editResults{ - file: file, - } - - // parse the edited file - updates, err := rmap.InfoForData(edited, "edited-file") - if err != nil { - return preservedFile(err, file, out) - } - - // annotate the edited object for kubectl apply - if err := kubectl.UpdateApplyAnnotation(updates); err != nil { - return preservedFile(err, file, out) - } - - visitor := resource.NewFlattenListVisitor(updates, rmap) - - // need to make sure the original namespace wasn't changed while editing - if err = visitor.Visit(resource.RequireNamespace(cmdNamespace)); err != nil { - return preservedFile(err, file, out) - } - - // use strategic merge to create a patch - originalJS, err := yaml.ToJSON(original) - if err != nil { - return preservedFile(err, file, out) - } - editedJS, err := yaml.ToJSON(edited) - if err != nil { - return preservedFile(err, file, out) - } - patch, err := strategicpatch.CreateStrategicMergePatch(originalJS, editedJS, obj) - // TODO: change all jsonmerge to strategicpatch - // for checking preconditions - preconditions := []jsonmerge.PreconditionFunc{} - if err != nil { - glog.V(4).Infof("Unable to calculate diff, no merge is possible: %v", err) - return preservedFile(err, file, out) - } else { - preconditions = append(preconditions, jsonmerge.RequireKeyUnchanged("apiVersion")) - preconditions = append(preconditions, jsonmerge.RequireKeyUnchanged("kind")) - preconditions = append(preconditions, jsonmerge.RequireMetadataKeyUnchanged("name")) - results.version = defaultVersion - } - - if hold, msg := jsonmerge.TestPreconditionsHold(patch, preconditions); !hold { - fmt.Fprintf(out, "error: %s", msg) - return preservedFile(nil, file, out) - } - - err = visitor.Visit(func(info *resource.Info, err error) error { - patched, err := resource.NewHelper(info.Client, info.Mapping).Patch(info.Namespace, info.Name, api.StrategicMergePatchType, patch) + // launch the editor + edited, file, err := edit.LaunchTempFile("kubectl-edit-", ext, buf) if err != nil { - fmt.Fprintln(out, results.addError(err, info)) - return nil + return preservedFile(err, results.file, out) } - info.Refresh(patched, true) - cmdutil.PrintSuccess(mapper, false, out, info.Mapping.Resource, info.Name, "edited") - return nil - }) - if err != nil { - return preservedFile(err, file, out) - } - if results.retryable > 0 { - fmt.Fprintf(out, "You can run `kubectl replace -f %s` to try this update again.\n", file) - return errExit - } - if results.conflict > 0 { - fmt.Fprintf(out, "You must update your local resource version and run `kubectl replace -f %s` to overwrite the remote changes.\n", file) - return errExit + // cleanup any file from the previous pass + if len(results.file) > 0 { + os.Remove(results.file) + } + + glog.V(4).Infof("User edited:\n%s", string(edited)) + lines, err := hasLines(bytes.NewBuffer(edited)) + if err != nil { + return preservedFile(err, file, out) + } + // Compare content without comments + if bytes.Equal(stripComments(original), stripComments(edited)) { + if len(results.edit) > 0 { + preservedFile(nil, file, out) + } else { + os.Remove(file) + } + fmt.Fprintln(out, "Edit cancelled, no changes made.") + continue + } + if !lines { + if len(results.edit) > 0 { + preservedFile(nil, file, out) + } else { + os.Remove(file) + } + fmt.Fprintln(out, "Edit cancelled, saved file was empty.") + continue + } + + results = editResults{ + file: file, + } + + // parse the edited file + updates, err := resourceMapper.InfoForData(edited, "edited-file") + if err != nil { + return fmt.Errorf("The edited file had a syntax error: %v", err) + } + + // put configuration annotation in "updates" + if err := kubectl.CreateOrUpdateAnnotation(cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag), updates, encoder); err != nil { + return preservedFile(err, file, out) + } + if cmdutil.ShouldRecord(cmd, updates) { + err = cmdutil.RecordChangeCause(updates.Object, f.Command()) + if err != nil { + return err + } + } + // encode updates back to "edited" since we'll only generate patch from "edited" + if edited, err = runtime.Encode(encoder, updates.Object); err != nil { + return preservedFile(err, file, out) + } + + visitor := resource.NewFlattenListVisitor(updates, resourceMapper) + + // need to make sure the original namespace wasn't changed while editing + if err = visitor.Visit(resource.RequireNamespace(cmdNamespace)); err != nil { + return preservedFile(err, file, out) + } + + // use strategic merge to create a patch + originalJS, err := yaml.ToJSON(original) + if err != nil { + return preservedFile(err, file, out) + } + editedJS, err := yaml.ToJSON(edited) + if err != nil { + return preservedFile(err, file, out) + } + patch, err := strategicpatch.CreateStrategicMergePatch(originalJS, editedJS, obj) + // TODO: change all jsonmerge to strategicpatch + // for checking preconditions + preconditions := []jsonmerge.PreconditionFunc{} + if err != nil { + glog.V(4).Infof("Unable to calculate diff, no merge is possible: %v", err) + return preservedFile(err, file, out) + } else { + preconditions = append(preconditions, jsonmerge.RequireKeyUnchanged("apiVersion")) + preconditions = append(preconditions, jsonmerge.RequireKeyUnchanged("kind")) + preconditions = append(preconditions, jsonmerge.RequireMetadataKeyUnchanged("name")) + results.version = defaultVersion + } + + if hold, msg := jsonmerge.TestPreconditionsHold(patch, preconditions); !hold { + fmt.Fprintf(out, "error: %s", msg) + return preservedFile(nil, file, out) + } + + err = visitor.Visit(func(info *resource.Info, err error) error { + patched, err := resource.NewHelper(info.Client, info.Mapping).Patch(info.Namespace, info.Name, api.StrategicMergePatchType, patch) + if err != nil { + fmt.Fprintln(out, results.addError(err, info)) + return nil + } + info.Refresh(patched, true) + cmdutil.PrintSuccess(mapper, false, out, info.Mapping.Resource, info.Name, "edited") + return nil + }) + if err != nil { + return preservedFile(err, file, out) + } + + if results.retryable > 0 { + fmt.Fprintf(out, "You can run `kubectl replace -f %s` to try this update again.\n", file) + return errExit + } + if results.conflict > 0 { + fmt.Fprintf(out, "You must update your local resource version and run `kubectl replace -f %s` to overwrite the remote changes.\n", file) + return errExit + } + if len(results.edit) == 0 { + if results.notfound == 0 { + os.Remove(file) + } else { + fmt.Fprintf(out, "The edits you made on deleted resources have been saved to %q\n", file) + } + } } if len(results.edit) == 0 { - if results.notfound == 0 { - os.Remove(file) - } else { - fmt.Fprintf(out, "The edits you made on deleted resources have been saved to %q\n", file) - } return nil } @@ -338,7 +370,7 @@ type editResults struct { edit []*resource.Info file string - version string + version unversioned.GroupVersion } func (r *editResults) addError(err error, info *resource.Info) string { @@ -348,7 +380,7 @@ func (r *editResults) addError(err error, info *resource.Info) string { reason := editReason{ head: fmt.Sprintf("%s %s was not valid", info.Mapping.Kind, info.Name), } - if err, ok := err.(client.APIStatus); ok { + if err, ok := err.(errors.APIStatus); ok { if details := err.Status().Details; details != nil { for _, cause := range details.Causes { reason.other = append(reason.other, cause.Message) @@ -395,3 +427,27 @@ func hasLines(r io.Reader) (bool, error) { } return false, nil } + +// stripComments will transform a YAML file into JSON, thus dropping any comments +// in it. Note that if the given file has a syntax error, the transformation will +// fail and we will manually drop all comments from the file. +func stripComments(file []byte) []byte { + stripped, err := yaml.ToJSON(file) + if err != nil { + stripped = manualStrip(file) + } + return stripped +} + +// manualStrip is used for dropping comments from a YAML file +func manualStrip(file []byte) []byte { + stripped := []byte{} + for _, line := range bytes.Split(file, []byte("\n")) { + if bytes.HasPrefix(bytes.TrimSpace(line), []byte("#")) { + continue + } + stripped = append(stripped, line...) + stripped = append(stripped, '\n') + } + return stripped +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/exec.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/exec.go index eef02355b..eec6da62f 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/exec.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/exec.go @@ -233,7 +233,7 @@ func (p *ExecOptions) Run() error { Stdout: p.Out != nil, Stderr: p.Err != nil, TTY: tty, - }, api.Scheme) + }, api.ParameterCodec) return p.Executor.Execute("POST", req.URL(), p.Config, stdin, p.Out, p.Err, tty) } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/exec_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/exec_test.go index 0090dcd6a..8317db936 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/exec_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/exec_test.go @@ -29,6 +29,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/api/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/fake" ) @@ -126,7 +127,7 @@ func TestPodAndContainer(t *testing.T) { f, tf, codec := NewAPIFactory() tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { return nil, nil }), + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { return nil, nil }), } tf.Namespace = "test" tf.ClientConfig = &client.Config{} @@ -156,7 +157,7 @@ func TestPodAndContainer(t *testing.T) { } func TestExec(t *testing.T) { - version := testapi.Default.Version() + version := testapi.Default.GroupVersion().Version tests := []struct { name, version, podPath, execPath, container string pod *api.Pod @@ -182,7 +183,7 @@ func TestExec(t *testing.T) { f, tf, codec := NewAPIFactory() tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == test.podPath && m == "GET": body := objBody(codec, test.pod) @@ -195,7 +196,7 @@ func TestExec(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: test.version} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: test.version}}} bufOut := bytes.NewBuffer([]byte{}) bufErr := bytes.NewBuffer([]byte{}) bufIn := bytes.NewBuffer([]byte{}) diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/explain.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/explain.go index 94abb923d..765091c03 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/explain.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/explain.go @@ -21,7 +21,8 @@ import ( "github.com/spf13/cobra" - "k8s.io/kubernetes/pkg/api/latest" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery/registered" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ) @@ -38,7 +39,8 @@ $ kubectl explain pods.spec.containers` Possible resource types include: pods (po), services (svc), replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), -resourcequotas (quota), namespaces (ns) or endpoints (ep).` +resourcequotas (quota), namespaces (ns), horizontalpodautoscalers (hpa) +or endpoints (ep).` ) // NewCmdExplain returns a cobra command for swagger docs @@ -63,39 +65,43 @@ func RunExplain(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []st return cmdutil.UsageError(cmd, "We accept only this format: explain RESOURCE") } - client, err := f.Client() - if err != nil { - return err - } - recursive := cmdutil.GetFlagBool(cmd, "recursive") - apiV := cmdutil.GetFlagString(cmd, "api-version") + apiVersionString := cmdutil.GetFlagString(cmd, "api-version") + apiVersion := unversioned.GroupVersion{} mapper, _ := f.Object() - group, inModel, fieldsPath, err := kubectl.SplitAndParseResourceRequest(args[0], mapper) + // TODO: After we figured out the new syntax to separate group and resource, allow + // the users to use it in explain (kubectl explain ). + // Refer to issue #16039 for why we do this. Refer to PR #15808 that used "/" syntax. + inModel, fieldsPath, err := kubectl.SplitAndParseResourceRequest(args[0], mapper) if err != nil { return err } - if len(group) == 0 { - // TODO: We should deduce the group for a resource by discovering the supported resources at server. - group, err = mapper.GroupForResource(inModel) - if err != nil { - return err - } - } - - if len(apiV) == 0 { - groupMeta, err := latest.Group(group) - if err != nil { - return err - } - apiV = groupMeta.GroupVersion - } - swagSchema, err := kubectl.GetSwaggerSchema(apiV, client) + // TODO: We should deduce the group for a resource by discovering the supported resources at server. + gvk, err := mapper.KindFor(unversioned.GroupVersionResource{Resource: inModel}) if err != nil { return err } - return kubectl.PrintModelDescription(inModel, fieldsPath, out, swagSchema, recursive) + if len(apiVersionString) == 0 { + groupMeta, err := registered.Group(gvk.Group) + if err != nil { + return err + } + apiVersion = groupMeta.GroupVersion + + } else { + apiVersion, err = unversioned.ParseGroupVersion(apiVersionString) + if err != nil { + return nil + } + } + + schema, err := f.SwaggerSchema(apiVersion.WithKind(gvk.Kind)) + if err != nil { + return err + } + + return kubectl.PrintModelDescription(inModel, fieldsPath, out, schema, recursive) } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/expose.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/expose.go index 3cc960fdc..48b624436 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/expose.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/expose.go @@ -19,12 +19,14 @@ package cmd import ( "fmt" "io" + "strings" "github.com/spf13/cobra" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util/validation" ) @@ -35,11 +37,14 @@ type ExposeOptions struct { } const ( - expose_long = `Take a replication controller, service or pod and expose it as a new Kubernetes Service. + expose_long = `Take a replication controller, service, replica set or pod and expose it as a new Kubernetes service. -Looks up a replication controller, service or pod by name and uses the selector for that resource as the -selector for a new Service on the specified port. If no labels are specified, the new service will -re-use the labels from the resource it exposes.` +Looks up a replication controller, service, replica set or pod by name and uses the selector for that +resource as the selector for a new service on the specified port. A replica set will be exposed as a +service only if it's selector is convertible to a selector that service supports, i.e. when the +replica set selector contains only the matchLabels component. Note that if no port is specified +via --port and the exposed resource has multiple ports, all will be re-used by the new service. Also +if no labels are specified, the new service will re-use the labels from the resource it exposes.` expose_example = `# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000. $ kubectl expose rc nginx --port=80 --target-port=8000 @@ -54,14 +59,17 @@ $ kubectl expose pod valid-pod --port=444 --name=frontend $ kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https # Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'. -$ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream` +$ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream + +# Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000. +$ kubectl expose rs nginx --port=80 --target-port=8000` ) func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command { options := &ExposeOptions{} cmd := &cobra.Command{ - Use: "expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [----external-ip=external-ip-of-service] [--type=type]", + Use: "expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]", Short: "Take a replication controller, service or pod and expose it as a new Kubernetes Service", Long: expose_long, Example: expose_example, @@ -78,19 +86,21 @@ func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command { // TODO: remove create-external-load-balancer in code on or after Aug 25, 2016. cmd.Flags().Bool("create-external-load-balancer", false, "If true, create an external load balancer for this service (trumped by --type). Implementation is cloud provider dependent. Default is 'false'.") cmd.Flags().MarkDeprecated("create-external-load-balancer", "use --type=\"LoadBalancer\" instead") - cmd.Flags().String("load-balancer-ip", "", "IP to assign to to the Load Balancer. If empty, an ephemeral IP will be created and used(cloud-provider specific).") - cmd.Flags().String("selector", "", "A label selector to use for this service. If empty (the default) infer the selector from the replication controller.") + cmd.Flags().String("load-balancer-ip", "", "IP to assign to to the Load Balancer. If empty, an ephemeral IP will be created and used (cloud-provider specific).") + cmd.Flags().String("selector", "", "A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set.") cmd.Flags().StringP("labels", "l", "", "Labels to apply to the service created by this call.") cmd.Flags().Bool("dry-run", false, "If true, only print the object that would be sent, without creating it.") cmd.Flags().String("container-port", "", "Synonym for --target-port") cmd.Flags().String("target-port", "", "Name or number for the port on the container that the service should direct traffic to. Optional.") - cmd.Flags().String("external-ip", "", "External IP address to set for the service. The service can be accessed by this IP in addition to its generated service IP.") + cmd.Flags().String("external-ip", "", "Additional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP.") cmd.Flags().String("overrides", "", "An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.") cmd.Flags().String("name", "", "The name for the newly created object.") cmd.Flags().String("session-affinity", "", "If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP'") usage := "Filename, directory, or URL to a file identifying the resource to expose a service" kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) + cmdutil.AddApplyAnnotationFlags(cmd) + cmdutil.AddRecordFlag(cmd) return cmd } @@ -101,7 +111,7 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(namespace).DefaultNamespace(). FilenameParam(enforceNamespace, options.Filenames...). @@ -117,7 +127,7 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str } info := infos[0] mapping := info.ResourceMapping() - if err := f.CanBeExposed(mapping.Kind); err != nil { + if err := f.CanBeExposed(mapping.GroupVersionKind.GroupKind()); err != nil { return err } // Get the input object @@ -128,7 +138,8 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str // Get the generator, setup and validate all required parameters generatorName := cmdutil.GetFlagString(cmd, "generator") - generator, found := f.Generator(generatorName) + generators := f.Generators("expose") + generator, found := generators[generatorName] if !found { return cmdutil.UsageError(cmd, fmt.Sprintf("generator %q not found.", generatorName)) } @@ -143,9 +154,9 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str // For objects that need a pod selector, derive it from the exposed object in case a user // didn't explicitly specify one via --selector if s, found := params["selector"]; found && kubectl.IsZero(s) { - s, err := f.PodSelectorForObject(inputObject) + s, err := f.MapBasedSelectorForObject(inputObject) if err != nil { - return cmdutil.UsageError(cmd, fmt.Sprintf("couldn't find selectors via --selector flag or introspection: %s", err)) + return cmdutil.UsageError(cmd, fmt.Sprintf("couldn't retrieve selectors via --selector flag or introspection: %s", err)) } params["selector"] = s } @@ -163,7 +174,7 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str case 1: params["port"] = ports[0] default: - return cmdutil.UsageError(cmd, fmt.Sprintf("multiple ports to choose from: %v, please explicitly specify a port using the --port flag.", ports)) + params["ports"] = strings.Join(ports, ",") } } if kubectl.IsZero(params["labels"]) { @@ -176,6 +187,10 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str if err = kubectl.ValidateParams(names, params); err != nil { return err } + // Check for invalid flags used against the present generator. + if err := kubectl.EnsureFlagsValid(cmd, generators, generatorName); err != nil { + return err + } // Generate new object object, err := generator.Generate(params) @@ -184,32 +199,39 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str } if inline := cmdutil.GetFlagString(cmd, "overrides"); len(inline) > 0 { - object, err = cmdutil.Merge(object, inline, mapping.Kind) + codec := runtime.NewCodec(f.JSONEncoder(), f.Decoder(true)) + object, err = cmdutil.Merge(codec, object, inline, mapping.GroupVersionKind.Kind) if err != nil { return err } } - resourceMapper := &resource.Mapper{ObjectTyper: typer, RESTMapper: mapper, ClientMapper: f.ClientMapperForCommand()} + resourceMapper := &resource.Mapper{ + ObjectTyper: typer, + RESTMapper: mapper, + ClientMapper: resource.ClientMapperFunc(f.ClientForMapping), + Decoder: f.Decoder(true), + } info, err = resourceMapper.InfoForObject(object) if err != nil { return err } + if cmdutil.ShouldRecord(cmd, info) { + if err := cmdutil.RecordChangeCause(object, f.Command()); err != nil { + return err + } + } + info.Refresh(object, true) // TODO: extract this flag to a central location, when such a location exists. if cmdutil.GetFlagBool(cmd, "dry-run") { return f.PrintObject(cmd, object, out) } - // Serialize the configuration into an annotation. - if err := kubectl.UpdateApplyAnnotation(info); err != nil { + if err := kubectl.CreateOrUpdateAnnotation(cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag), info, f.JSONEncoder()); err != nil { return err } // Serialize the object with the annotation applied. - data, err := info.Mapping.Codec.Encode(object) - if err != nil { - return err - } - object, err = resource.NewHelper(info.Client, info.Mapping).Create(namespace, false, data) + object, err = resource.NewHelper(info.Client, info.Mapping).Create(namespace, false, object) if err != nil { return err } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/expose_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/expose_test.go index 6a03cac4c..6bad24357 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/expose_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/expose_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/kubernetes/pkg/client/unversioned/fake" "k8s.io/kubernetes/pkg/kubectl" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) func TestRunExposeService(t *testing.T) { @@ -63,7 +63,7 @@ func TestRunExposeService(t *testing.T) { { Protocol: api.ProtocolUDP, Port: 14, - TargetPort: util.NewIntOrStringFromInt(14), + TargetPort: intstr.FromInt(14), }, }, Selector: map[string]string{"app": "go"}, @@ -94,7 +94,7 @@ func TestRunExposeService(t *testing.T) { { Protocol: api.ProtocolUDP, Port: 14, - TargetPort: util.NewIntOrStringFromInt(14), + TargetPort: intstr.FromInt(14), }, }, Selector: map[string]string{"func": "stream"}, @@ -126,7 +126,7 @@ func TestRunExposeService(t *testing.T) { { Protocol: api.ProtocolTCP, Port: 80, - TargetPort: util.NewIntOrStringFromInt(80), + TargetPort: intstr.FromInt(80), }, }, Selector: map[string]string{"run": "this"}, @@ -157,7 +157,7 @@ func TestRunExposeService(t *testing.T) { { Protocol: api.ProtocolUDP, Port: 14, - TargetPort: util.NewIntOrStringFromInt(14), + TargetPort: intstr.FromInt(14), }, }, Selector: map[string]string{"func": "stream"}, @@ -188,7 +188,7 @@ func TestRunExposeService(t *testing.T) { { Protocol: api.ProtocolUDP, Port: 14, - TargetPort: util.NewIntOrStringFromInt(14), + TargetPort: intstr.FromInt(14), }, }, Selector: map[string]string{"func": "stream"}, @@ -198,36 +198,6 @@ func TestRunExposeService(t *testing.T) { }, status: 200, }, - { - name: "expose-external-service", - args: []string{"service", "baz"}, - ns: "test", - calls: map[string]string{ - "GET": "/namespaces/test/services/baz", - "POST": "/namespaces/test/services", - }, - input: &api.Service{ - ObjectMeta: api.ObjectMeta{Name: "baz", Namespace: "test", ResourceVersion: "12"}, - Spec: api.ServiceSpec{ - Ports: []api.ServicePort{}, - }, - }, - // Even if we specify --selector, since service/test doesn't need one it will ignore it - flags: map[string]string{"selector": "svc=fromexternal", "port": "90", "labels": "svc=fromexternal", "name": "frombaz", "generator": "service/test", "dry-run": "true"}, - output: &api.Service{ - ObjectMeta: api.ObjectMeta{Name: "frombaz", Namespace: "", Labels: map[string]string{"svc": "fromexternal"}}, - Spec: api.ServiceSpec{ - Ports: []api.ServicePort{ - { - Protocol: api.ProtocolTCP, - Port: 90, - TargetPort: util.NewIntOrStringFromInt(90), - }, - }, - }, - }, - status: 200, - }, { name: "expose-from-file", args: []string{}, @@ -250,7 +220,7 @@ func TestRunExposeService(t *testing.T) { { Protocol: api.ProtocolUDP, Port: 14, - TargetPort: util.NewIntOrStringFromInt(14), + TargetPort: intstr.FromInt(14), }, }, Selector: map[string]string{"func": "stream"}, @@ -277,7 +247,7 @@ func TestRunExposeService(t *testing.T) { { Protocol: api.ProtocolTCP, Port: 90, - TargetPort: util.NewIntOrStringFromInt(90), + TargetPort: intstr.FromInt(90), }, }, Selector: map[string]string{"svc": "frompod"}, @@ -286,6 +256,54 @@ func TestRunExposeService(t *testing.T) { expected: "service \"a-name-that-is-toooo-big\" exposed", status: 200, }, + { + name: "expose-multiport-object", + args: []string{"service", "foo"}, + ns: "test", + calls: map[string]string{ + "GET": "/namespaces/test/services/foo", + "POST": "/namespaces/test/services", + }, + input: &api.Service{ + ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "", Labels: map[string]string{"svc": "multiport"}}, + Spec: api.ServiceSpec{ + Ports: []api.ServicePort{ + { + Protocol: api.ProtocolTCP, + Port: 80, + TargetPort: intstr.FromInt(80), + }, + { + Protocol: api.ProtocolTCP, + Port: 443, + TargetPort: intstr.FromInt(443), + }, + }, + }, + }, + flags: map[string]string{"selector": "svc=fromfoo", "generator": "service/v2", "name": "fromfoo", "dry-run": "true"}, + output: &api.Service{ + ObjectMeta: api.ObjectMeta{Name: "fromfoo", Namespace: "", Labels: map[string]string{"svc": "multiport"}}, + Spec: api.ServiceSpec{ + Ports: []api.ServicePort{ + { + Name: "port-1", + Protocol: api.ProtocolTCP, + Port: 80, + TargetPort: intstr.FromInt(80), + }, + { + Name: "port-2", + Protocol: api.ProtocolTCP, + Port: 443, + TargetPort: intstr.FromInt(443), + }, + }, + Selector: map[string]string{"svc": "fromfoo"}, + }, + }, + status: 200, + }, } for _, test := range tests { @@ -293,7 +311,7 @@ func TestRunExposeService(t *testing.T) { tf.Printer = &kubectl.JSONPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == test.calls[m] && m == "GET": return &http.Response{StatusCode: test.status, Body: objBody(codec, test.input)}, nil diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get.go index 0396423a2..86fd73130 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get.go @@ -25,6 +25,7 @@ import ( "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/watch" ) @@ -40,7 +41,8 @@ const ( Possible resource types include (case insensitive): pods (po), services (svc), replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), -resourcequotas (quota), namespaces (ns), endpoints (ep), serviceaccounts or secrets. +resourcequotas (quota), namespaces (ns), endpoints (ep), +horizontalpodautoscalers (hpa), serviceaccounts or secrets. By specifying the output as 'template' and providing a Go template as the value of the --template flag, you can filter the attributes of the fetched resource(s).` @@ -50,9 +52,6 @@ $ kubectl get pods # List all pods in ps output format with more information (such as node name). $ kubectl get pods -o wide -# List all pods in resource/name format (such as pod/nginx). -$ kubectl get pods -o name - # List a single replication controller with specified NAME in ps output format. $ kubectl get replicationcontroller web @@ -79,7 +78,7 @@ func NewCmdGet(f *cmdutil.Factory, out io.Writer) *cobra.Command { // retrieve a list of handled resources from printer as valid args validArgs := []string{} - p, err := f.Printer(nil, false, false, false, false, []string{}) + p, err := f.Printer(nil, false, false, false, false, false, false, []string{}) cmdutil.CheckErr(err) if p != nil { validArgs = p.HandledResources() @@ -102,6 +101,7 @@ func NewCmdGet(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd.Flags().Bool("watch-only", false, "Watch for changes to the requested object(s), without listing/getting first.") cmd.Flags().Bool("all-namespaces", false, "If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.") cmd.Flags().StringSliceP("label-columns", "L", []string{}, "Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag statements like -L label1 -L label2...") + cmd.Flags().Bool("export", false, "If true, use 'export' for the resources. Exported resources are stripped of cluster-specific information.") usage := "Filename, directory, or URL to a file identifying the resource to get from a server." kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) return cmd @@ -119,20 +119,33 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string return err } + if allNamespaces { + enforceNamespace = false + } + if len(args) == 0 && len(options.Filenames) == 0 { - fmt.Fprint(out, "You must specify the type of resource to get. ", valid_resources, ` * componentstatuses (aka 'cs') - * endpoints (aka 'ep') -`) + fmt.Fprint(out, "You must specify the type of resource to get. ", valid_resources) return cmdutil.UsageError(cmd, "Required resource not specified.") } + // always show resources when getting by name or filename + argsHasNames, err := resource.HasNames(args) + if err != nil { + return err + } + if len(options.Filenames) > 0 || argsHasNames { + cmd.Flag("show-all").Value.Set("true") + } + export := cmdutil.GetFlagBool(cmd, "export") + // handle watch separately since we cannot watch multiple resource types isWatch, isWatchOnly := cmdutil.GetFlagBool(cmd, "watch"), cmdutil.GetFlagBool(cmd, "watch-only") if isWatch || isWatchOnly { - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). NamespaceParam(cmdNamespace).DefaultNamespace().AllNamespaces(allNamespaces). FilenameParam(enforceNamespace, options.Filenames...). SelectorParam(selector). + ExportParam(export). ResourceTypeOrNameArgs(true, args...). SingleResourceType(). Latest(). @@ -183,10 +196,11 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string return nil } - b := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + b := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). NamespaceParam(cmdNamespace).DefaultNamespace().AllNamespaces(allNamespaces). FilenameParam(enforceNamespace, options.Filenames...). SelectorParam(selector). + ExportParam(export). ResourceTypeOrNameArgs(true, args...). ContinueOnError(). Latest() @@ -200,7 +214,6 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string if err != nil { return err } - defaultVersion := clientConfig.Version singular := false r := b.Flatten().Do() @@ -211,8 +224,11 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string // the outermost object will be converted to the output-version, but inner // objects can use their mappings - version := cmdutil.OutputVersion(cmd, defaultVersion) - obj, err := resource.AsVersionedObject(infos, !singular, version) + version, err := cmdutil.OutputVersion(cmd, clientConfig.GroupVersion) + if err != nil { + return err + } + obj, err := resource.AsVersionedObject(infos, !singular, version.String(), f.JSONEncoder()) if err != nil { return err } @@ -220,25 +236,53 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string return printer.PrintObj(obj, out) } + infos, err := b.Flatten().Do().Infos() + if err != nil { + return err + } + objs := make([]runtime.Object, len(infos)) + for ix := range infos { + objs[ix] = infos[ix].Object + } + + sorting, err := cmd.Flags().GetString("sort-by") + var sorter *kubectl.RuntimeSort + if err == nil && len(sorting) > 0 && len(objs) > 1 { + // TODO: questionable + if sorter, err = kubectl.SortObjects(f.Decoder(true), objs, sorting); err != nil { + return err + } + } + // use the default printer for each object printer = nil var lastMapping *meta.RESTMapping w := kubectl.GetNewTabWriter(out) defer w.Flush() - return b.Flatten().Do().Visit(func(r *resource.Info, err error) error { - if err != nil { - return err + + for ix := range objs { + var mapping *meta.RESTMapping + if sorter != nil { + mapping = infos[sorter.OriginalPosition(ix)].Mapping + } else { + mapping = infos[ix].Mapping } - if printer == nil || lastMapping == nil || r.Mapping == nil || r.Mapping.Resource != lastMapping.Resource { - printer, err = f.PrinterForMapping(cmd, r.Mapping, allNamespaces) + if printer == nil || lastMapping == nil || mapping == nil || mapping.Resource != lastMapping.Resource { + printer, err = f.PrinterForMapping(cmd, mapping, allNamespaces) if err != nil { return err } - lastMapping = r.Mapping + lastMapping = mapping } if _, found := printer.(*kubectl.HumanReadablePrinter); found { - return printer.PrintObj(r.Object, w) + if err := printer.PrintObj(objs[ix], w); err != nil { + return err + } + continue } - return printer.PrintObj(r.Object, out) - }) + if err := printer.PrintObj(objs[ix], out); err != nil { + return err + } + } + return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get_test.go index 98864021b..4d4ac5e18 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get_test.go @@ -28,6 +28,7 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/testapi" apitesting "k8s.io/kubernetes/pkg/api/testing" "k8s.io/kubernetes/pkg/api/unversioned" @@ -88,7 +89,7 @@ func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList) func testComponentStatusData() *api.ComponentStatusList { good := api.ComponentStatus{ Conditions: []api.ComponentCondition{ - {Type: api.ComponentHealthy, Status: api.ConditionTrue, Message: "ok", Error: "nil"}, + {Type: api.ComponentHealthy, Status: api.ConditionTrue, Message: "ok"}, }, ObjectMeta: api.ObjectMeta{Name: "servergood"}, } @@ -121,7 +122,7 @@ func TestGetUnknownSchemaObject(t *testing.T) { Resp: &http.Response{StatusCode: 200, Body: objBody(codec, &internalType{Name: "foo"})}, } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdGet(f, buf) @@ -146,9 +147,9 @@ func TestGetUnknownSchemaObject(t *testing.T) { // // The expected behavior of the `kubectl get` command is: // 1. objects using unrecognized schemes will always be returned using that scheme/version, "unlikelyversion" in this test; -// 2. if the specified output-version is a recognized, valid Scheme, then the list should use that scheme, and otherwise it will default to the client version, testapi.Default.Version() in this test; +// 2. if the specified output-version is a recognized, valid Scheme, then the list should use that scheme, and otherwise it will default to the client version, testapi.Default.GroupVersion().String() in this test; // 3a. if the specified output-version is a recognized, valid Scheme, in which the requested object (replicationcontroller) can be represented, then the object should be returned using that version; -// 3b. otherwise if the specified output-version is unrecognized, but the requested object (replicationcontroller) is recognized by the client's codec, then it will be converted to the client version, testapi.Default.Version() in this test. +// 3b. otherwise if the specified output-version is unrecognized, but the requested object (replicationcontroller) is recognized by the client's codec, then it will be converted to the client version, testapi.Default.GroupVersion().String() in this test. func TestGetUnknownSchemaObjectListGeneric(t *testing.T) { testCases := map[string]struct { outputVersion string @@ -157,29 +158,29 @@ func TestGetUnknownSchemaObjectListGeneric(t *testing.T) { rcVersion string }{ "handles specific version": { - outputVersion: testapi.Default.Version(), - listVersion: testapi.Default.Version(), - testtypeVersion: "unlikelyversion", - rcVersion: testapi.Default.Version(), + outputVersion: testapi.Default.GroupVersion().String(), + listVersion: testapi.Default.GroupVersion().String(), + testtypeVersion: unlikelyGV.String(), + rcVersion: testapi.Default.GroupVersion().String(), }, "handles second specific version": { - outputVersion: "unlikelyversion", - listVersion: testapi.Default.Version(), - testtypeVersion: "unlikelyversion", - rcVersion: testapi.Default.Version(), // see expected behavior 3b + outputVersion: "unlikely.group/unlikelyversion", + listVersion: testapi.Default.GroupVersion().String(), + testtypeVersion: unlikelyGV.String(), + rcVersion: testapi.Default.GroupVersion().String(), // see expected behavior 3b }, "handles common version": { - outputVersion: testapi.Default.Version(), - listVersion: testapi.Default.Version(), - testtypeVersion: "unlikelyversion", - rcVersion: testapi.Default.Version(), + outputVersion: testapi.Default.GroupVersion().String(), + listVersion: testapi.Default.GroupVersion().String(), + testtypeVersion: unlikelyGV.String(), + rcVersion: testapi.Default.GroupVersion().String(), }, } for k, test := range testCases { - apiCodec := runtime.CodecFor(api.Scheme, testapi.Default.Version()) + apiCodec := testapi.Default.Codec() regularClient := &fake.RESTClient{ Codec: apiCodec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { return &http.Response{StatusCode: 200, Body: objBody(apiCodec, &api.ReplicationController{ObjectMeta: api.ObjectMeta{Name: "foo"}})}, nil }), } @@ -188,16 +189,17 @@ func TestGetUnknownSchemaObjectListGeneric(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { return &http.Response{StatusCode: 200, Body: objBody(codec, &internalType{Name: "foo"})}, nil }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdGet(f, buf) cmd.SetOutput(buf) cmd.Flags().Set("output", "json") + cmd.Flags().Set("output-version", test.outputVersion) err := RunGet(f, buf, cmd, []string{"type/foo", "replicationcontrollers/foo"}, &GetOptions{}) if err != nil { @@ -234,7 +236,7 @@ func TestGetSchemaObject(t *testing.T) { Resp: &http.Response{StatusCode: 200, Body: objBody(codec, &api.ReplicationController{ObjectMeta: api.ObjectMeta{Name: "foo"}})}, } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: "v1"} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: "v1"}}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdGet(f, buf) @@ -330,7 +332,7 @@ func TestGetListObjects(t *testing.T) { func extractResourceList(objs []runtime.Object) ([]runtime.Object, error) { finalObjs := []runtime.Object{} for _, obj := range objs { - items, err := runtime.ExtractList(obj) + items, err := meta.ExtractList(obj) if err != nil { return nil, err } @@ -407,7 +409,7 @@ func TestGetMultipleTypeObjects(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.URL.Path { case "/namespaces/test/pods": return &http.Response{StatusCode: 200, Body: objBody(codec, pods)}, nil @@ -446,7 +448,7 @@ func TestGetMultipleTypeObjectsAsList(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.URL.Path { case "/namespaces/test/pods": return &http.Response{StatusCode: 200, Body: objBody(codec, pods)}, nil @@ -459,7 +461,7 @@ func TestGetMultipleTypeObjectsAsList(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdGet(f, buf) @@ -472,18 +474,18 @@ func TestGetMultipleTypeObjectsAsList(t *testing.T) { t.Errorf("unexpected print to default printer") } - out, err := codec.Decode(buf.Bytes()) + out, err := runtime.Decode(codec, buf.Bytes()) if err != nil { t.Fatalf("unexpected error: %v", err) } - list, err := runtime.ExtractList(out) + list, err := meta.ExtractList(out) if err != nil { t.Fatalf("unexpected error: %v", err) } - if errs := runtime.DecodeList(list, api.Scheme); len(errs) > 0 { + if errs := runtime.DecodeList(list, codec); len(errs) > 0 { t.Fatalf("unexpected error: %v", errs) } - if err := runtime.SetList(out, list); err != nil { + if err := meta.SetList(out, list); err != nil { t.Fatalf("unexpected error: %v", err) } @@ -506,8 +508,8 @@ func TestGetMultipleTypeObjectsWithSelector(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { - if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String())) != "a=b" { t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) } switch req.URL.Path { @@ -558,7 +560,7 @@ func TestGetMultipleTypeObjectsWithDirectReference(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.URL.Path { case "/nodes/foo": return &http.Response{StatusCode: 200, Body: objBody(codec, node)}, nil @@ -587,6 +589,29 @@ func TestGetMultipleTypeObjectsWithDirectReference(t *testing.T) { t.Errorf("unexpected empty output") } } + +func TestGetByNameForcesFlag(t *testing.T) { + pods, _, _ := testData() + + f, tf, codec := NewAPIFactory() + tf.Printer = &testPrinter{} + tf.Client = &fake.RESTClient{ + Codec: codec, + Resp: &http.Response{StatusCode: 200, Body: objBody(codec, &pods.Items[0])}, + } + tf.Namespace = "test" + buf := bytes.NewBuffer([]byte{}) + + cmd := NewCmdGet(f, buf) + cmd.SetOutput(buf) + cmd.Run(cmd, []string{"pods", "foo"}) + + showAllFlag, _ := cmd.Flags().GetBool("show-all") + if !showAllFlag { + t.Errorf("expected showAll to be true when getting resource by name") + } +} + func watchTestData() ([]api.Pod, []watch.Event) { pods := []api.Pod{ { @@ -632,8 +657,8 @@ func TestWatchSelector(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { - if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String())) != "a=b" { t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) } switch req.URL.Path { @@ -674,7 +699,7 @@ func TestWatchResource(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.URL.Path { case "/namespaces/test/pods/foo": return &http.Response{StatusCode: 200, Body: objBody(codec, &pods[0])}, nil @@ -712,7 +737,7 @@ func TestWatchResourceIdentifiedByFile(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.URL.Path { case "/namespaces/test/pods/cassandra": return &http.Response{StatusCode: 200, Body: objBody(codec, &pods[0])}, nil @@ -751,7 +776,7 @@ func TestWatchOnlyResource(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.URL.Path { case "/namespaces/test/pods/foo": return &http.Response{StatusCode: 200, Body: objBody(codec, &pods[0])}, nil diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/label.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/label.go index b4bca646e..39c401d52 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/label.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/label.go @@ -20,8 +20,10 @@ import ( "encoding/json" "fmt" "io" + "reflect" "strings" + "github.com/golang/glog" "github.com/spf13/cobra" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/kubectl" @@ -70,7 +72,7 @@ func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command { // retrieve a list of handled resources from printer as valid args validArgs := []string{} - p, err := f.Printer(nil, false, false, false, false, []string{}) + p, err := f.Printer(nil, false, false, false, false, false, false, []string{}) cmdutil.CheckErr(err) if p != nil { validArgs = p.HandledResources() @@ -95,6 +97,7 @@ func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command { usage := "Filename, directory, or URL to a file identifying the resource to update the labels" kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) cmd.Flags().Bool("dry-run", false, "If true, only print the object that would be sent, without sending it.") + cmdutil.AddRecordFlag(cmd) return cmd } @@ -200,7 +203,7 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri return cmdutil.UsageError(cmd, err.Error()) } mapper, typer := f.Object() - b := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + b := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). FilenameParam(enforceNamespace, options.Filenames...). @@ -227,6 +230,7 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri } var outputObj runtime.Object + dataChangeMsg := "not labeled" if cmdutil.GetFlagBool(cmd, "dry-run") { err = labelFunc(info.Object, overwrite, resourceVersion, lbls, remove) if err != nil { @@ -239,26 +243,46 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri if err != nil { return err } + meta, err := api.ObjectMetaFor(obj) + for _, label := range remove { + if _, ok := meta.Labels[label]; !ok { + fmt.Fprintf(out, "label %q not found.\n", label) + } + } + if err := labelFunc(obj, overwrite, resourceVersion, lbls, remove); err != nil { return err } + if cmdutil.ShouldRecord(cmd, info) { + if err := cmdutil.RecordChangeCause(obj, f.Command()); err != nil { + return err + } + } newData, err := json.Marshal(obj) if err != nil { return err } + if !reflect.DeepEqual(oldData, newData) { + dataChangeMsg = "labeled" + } patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, obj) + createdPatch := err == nil if err != nil { - return err + glog.V(2).Infof("couldn't compute patch: %v", err) } mapping := info.ResourceMapping() - client, err := f.RESTClient(mapping) + client, err := f.ClientForMapping(mapping) if err != nil { return err } helper := resource.NewHelper(client, mapping) - outputObj, err = helper.Patch(namespace, name, api.StrategicMergePatchType, patchBytes) + if createdPatch { + outputObj, err = helper.Patch(namespace, name, api.StrategicMergePatchType, patchBytes) + } else { + outputObj, err = helper.Replace(namespace, name, false, obj) + } if err != nil { return err } @@ -267,7 +291,7 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri if outputFormat != "" { return f.PrintObject(cmd, outputObj, out) } - cmdutil.PrintSuccess(mapper, false, out, info.Mapping.Resource, info.Name, "labeled") + cmdutil.PrintSuccess(mapper, false, out, info.Mapping.Resource, info.Name, dataChangeMsg) return nil }) } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/label_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/label_test.go index 750f30ace..5267bc3cc 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/label_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/label_test.go @@ -301,7 +301,7 @@ func TestLabelErrors(t *testing.T) { f, tf, _ := NewAPIFactory() tf.Printer = &testPrinter{} tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdLabel(f, buf) @@ -329,7 +329,7 @@ func TestLabelForResourceFromFile(t *testing.T) { f, tf, codec := NewAPIFactory() tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.Method { case "GET": switch req.URL.Path { @@ -354,7 +354,7 @@ func TestLabelForResourceFromFile(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdLabel(f, buf) @@ -376,7 +376,7 @@ func TestLabelMultipleObjects(t *testing.T) { f, tf, codec := NewAPIFactory() tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch req.Method { case "GET": switch req.URL.Path { @@ -403,7 +403,7 @@ func TestLabelMultipleObjects(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdLabel(f, buf) diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/log.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/log.go deleted file mode 100644 index e6f150ec7..000000000 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/log.go +++ /dev/null @@ -1,243 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package cmd - -import ( - "errors" - "fmt" - "io" - "math" - "os" - "strconv" - "strings" - "time" - - "github.com/spf13/cobra" - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/unversioned" - client "k8s.io/kubernetes/pkg/client/unversioned" - cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" -) - -const ( - log_example = `# Return snapshot logs from pod nginx with only one container -$ kubectl logs nginx - -# Return snapshot of previous terminated ruby container logs from pod web-1 -$ kubectl logs -p -c ruby web-1 - -# Begin streaming the logs of the ruby container in pod web-1 -$ kubectl logs -f -c ruby web-1 - -# Display only the most recent 20 lines of output in pod nginx -$ kubectl logs --tail=20 nginx - -# Show all logs from pod nginx written in the last hour -$ kubectl logs --since=1h nginx` -) - -type LogsOptions struct { - Client *client.Client - - PodNamespace string - PodName string - ContainerName string - Follow bool - Timestamps bool - Previous bool - LimitBytes int - Tail int - SinceTime *unversioned.Time - SinceSeconds time.Duration - - Out io.Writer -} - -// NewCmdLog creates a new pod log command -func NewCmdLog(f *cmdutil.Factory, out io.Writer) *cobra.Command { - o := &LogsOptions{ - Out: out, - Tail: -1, - } - - cmd := &cobra.Command{ - Use: "logs [-f] [-p] POD [-c CONTAINER]", - Short: "Print the logs for a container in a pod.", - Long: "Print the logs for a container in a pod. If the pod has only one container, the container name is optional.", - Example: log_example, - Run: func(cmd *cobra.Command, args []string) { - if len(os.Args) > 1 && os.Args[1] == "log" { - printDeprecationWarning("logs", "log") - } - - cmdutil.CheckErr(o.Complete(f, out, cmd, args)) - if err := o.Validate(); err != nil { - cmdutil.CheckErr(cmdutil.UsageError(cmd, err.Error())) - } - cmdutil.CheckErr(o.RunLog()) - }, - Aliases: []string{"log"}, - } - cmd.Flags().BoolVarP(&o.Follow, "follow", "f", o.Follow, "Specify if the logs should be streamed.") - cmd.Flags().BoolVar(&o.Timestamps, "timestamps", o.Timestamps, "Include timestamps on each line in the log output") - cmd.Flags().Bool("interactive", true, "If true, prompt the user for input when required. Default true.") - cmd.Flags().MarkDeprecated("interactive", "This flag is no longer respected and there is no replacement.") - cmd.Flags().IntVar(&o.LimitBytes, "limit-bytes", o.LimitBytes, "Maximum bytes of logs to return. Defaults to no limit.") - cmd.Flags().BoolVarP(&o.Previous, "previous", "p", o.Previous, "If true, print the logs for the previous instance of the container in a pod if it exists.") - cmd.Flags().IntVar(&o.Tail, "tail", o.Tail, "Lines of recent log file to display. Defaults to -1, showing all log lines.") - cmd.Flags().String("since-time", "", "Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used.") - cmd.Flags().DurationVar(&o.SinceSeconds, "since", o.SinceSeconds, "Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used.") - cmd.Flags().StringVarP(&o.ContainerName, "container", "c", o.ContainerName, "Container name") - return cmd -} - -func (o *LogsOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error { - switch len(args) { - case 0: - return cmdutil.UsageError(cmd, "POD is required for log") - - case 1: - o.PodName = args[0] - case 2: - if cmd.Flag("container").Changed { - return cmdutil.UsageError(cmd, "only one of -c, [CONTAINER] arg is allowed") - } - o.PodName = args[0] - o.ContainerName = args[1] - - default: - return cmdutil.UsageError(cmd, "log POD [-c CONTAINER]") - } - - var err error - o.PodNamespace, _, err = f.DefaultNamespace() - if err != nil { - return err - } - o.Client, err = f.Client() - if err != nil { - return err - } - - sinceTime := cmdutil.GetFlagString(cmd, "since-time") - if len(sinceTime) > 0 { - t, err := api.ParseRFC3339(sinceTime, unversioned.Now) - if err != nil { - return err - } - o.SinceTime = &t - } - - return nil -} - -func (o *LogsOptions) Validate() error { - if len(o.PodName) == 0 { - return errors.New("POD must be specified") - } - if o.LimitBytes < 0 { - return errors.New("--limit-bytes must be greater than or equal to zero") - } - if o.Tail < -1 { - return errors.New("--tail must be greater than or equal to -1") - } - if o.SinceTime != nil && o.SinceSeconds > 0 { - return errors.New("only one of --since, --since-time may be specified") - } - - return nil -} - -// RunLog retrieves a pod log -func (o *LogsOptions) RunLog() error { - pod, err := o.Client.Pods(o.PodNamespace).Get(o.PodName) - if err != nil { - return err - } - - // [-c CONTAINER] - container := o.ContainerName - if len(container) == 0 { - // [CONTAINER] (container as arg not flag) is supported as legacy behavior. See PR #10519 for more details. - if len(pod.Spec.Containers) != 1 { - podContainersNames := []string{} - for _, container := range pod.Spec.Containers { - podContainersNames = append(podContainersNames, container.Name) - } - - return fmt.Errorf("Pod %s has the following containers: %s; please specify the container to print logs for with -c", pod.ObjectMeta.Name, strings.Join(podContainersNames, ", ")) - } - container = pod.Spec.Containers[0].Name - } - - logOptions := &api.PodLogOptions{ - Container: container, - Follow: o.Follow, - Previous: o.Previous, - Timestamps: o.Timestamps, - } - if o.SinceSeconds > 0 { - // round up to the nearest second - sec := int64(math.Ceil(float64(o.SinceSeconds) / float64(time.Second))) - logOptions.SinceSeconds = &sec - } - logOptions.SinceTime = o.SinceTime - if o.LimitBytes != 0 { - i := int64(o.LimitBytes) - logOptions.LimitBytes = &i - } - if o.Tail >= 0 { - i := int64(o.Tail) - logOptions.TailLines = &i - } - - return handleLog(o.Client, o.PodNamespace, o.PodName, logOptions, o.Out) -} - -func handleLog(client *client.Client, namespace, podID string, logOptions *api.PodLogOptions, out io.Writer) error { - // TODO: transform this into a PodLogOptions call - req := client.RESTClient.Get(). - Namespace(namespace). - Name(podID). - Resource("pods"). - SubResource("log"). - Param("follow", strconv.FormatBool(logOptions.Follow)). - Param("container", logOptions.Container). - Param("previous", strconv.FormatBool(logOptions.Previous)). - Param("timestamps", strconv.FormatBool(logOptions.Timestamps)) - - if logOptions.SinceSeconds != nil { - req.Param("sinceSeconds", strconv.FormatInt(*logOptions.SinceSeconds, 10)) - } - if logOptions.SinceTime != nil { - req.Param("sinceTime", logOptions.SinceTime.Format(time.RFC3339)) - } - if logOptions.LimitBytes != nil { - req.Param("limitBytes", strconv.FormatInt(*logOptions.LimitBytes, 10)) - } - if logOptions.TailLines != nil { - req.Param("tailLines", strconv.FormatInt(*logOptions.TailLines, 10)) - } - readCloser, err := req.Stream() - if err != nil { - return err - } - - defer readCloser.Close() - _, err = io.Copy(out, readCloser) - return err -} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs.go new file mode 100644 index 000000000..369d41d8a --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs.go @@ -0,0 +1,206 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cmd + +import ( + "errors" + "io" + "math" + "os" + "time" + + "github.com/spf13/cobra" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/validation" + client "k8s.io/kubernetes/pkg/client/unversioned" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" +) + +const ( + logs_example = `# Return snapshot logs from pod nginx with only one container +$ kubectl logs nginx + +# Return snapshot of previous terminated ruby container logs from pod web-1 +$ kubectl logs -p -c ruby web-1 + +# Begin streaming the logs of the ruby container in pod web-1 +$ kubectl logs -f -c ruby web-1 + +# Display only the most recent 20 lines of output in pod nginx +$ kubectl logs --tail=20 nginx + +# Show all logs from pod nginx written in the last hour +$ kubectl logs --since=1h nginx` +) + +type LogsOptions struct { + Namespace string + ResourceArg string + Options runtime.Object + + Mapper meta.RESTMapper + Typer runtime.ObjectTyper + ClientMapper resource.ClientMapper + Decoder runtime.Decoder + + LogsForObject func(object, options runtime.Object) (*client.Request, error) + + Out io.Writer +} + +// NewCmdLog creates a new pod logs command +func NewCmdLogs(f *cmdutil.Factory, out io.Writer) *cobra.Command { + o := &LogsOptions{} + cmd := &cobra.Command{ + Use: "logs [-f] [-p] POD [-c CONTAINER]", + Short: "Print the logs for a container in a pod.", + Long: "Print the logs for a container in a pod. If the pod has only one container, the container name is optional.", + Example: logs_example, + PreRun: func(cmd *cobra.Command, args []string) { + if len(os.Args) > 1 && os.Args[1] == "log" { + printDeprecationWarning("logs", "log") + } + }, + Run: func(cmd *cobra.Command, args []string) { + cmdutil.CheckErr(o.Complete(f, out, cmd, args)) + if err := o.Validate(); err != nil { + cmdutil.CheckErr(cmdutil.UsageError(cmd, err.Error())) + } + _, err := o.RunLogs() + cmdutil.CheckErr(err) + }, + Aliases: []string{"log"}, + } + cmd.Flags().BoolP("follow", "f", false, "Specify if the logs should be streamed.") + cmd.Flags().Bool("timestamps", false, "Include timestamps on each line in the log output") + cmd.Flags().Int64("limit-bytes", 0, "Maximum bytes of logs to return. Defaults to no limit.") + cmd.Flags().BoolP("previous", "p", false, "If true, print the logs for the previous instance of the container in a pod if it exists.") + cmd.Flags().Int64("tail", -1, "Lines of recent log file to display. Defaults to -1, showing all log lines.") + cmd.Flags().String("since-time", "", "Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used.") + cmd.Flags().Duration("since", 0, "Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used.") + cmd.Flags().StringP("container", "c", "", "Print the logs of this container") + + cmd.Flags().Bool("interactive", false, "If true, prompt the user for input when required.") + cmd.Flags().MarkDeprecated("interactive", "This flag is no longer respected and there is no replacement.") + return cmd +} + +func (o *LogsOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error { + containerName := cmdutil.GetFlagString(cmd, "container") + switch len(args) { + case 0: + return cmdutil.UsageError(cmd, "POD is required for logs") + case 1: + o.ResourceArg = args[0] + case 2: + if cmd.Flag("container").Changed { + return cmdutil.UsageError(cmd, "only one of -c, [CONTAINER] arg is allowed") + } + o.ResourceArg = args[0] + containerName = args[1] + default: + return cmdutil.UsageError(cmd, "logs POD [-c CONTAINER]") + } + var err error + o.Namespace, _, err = f.DefaultNamespace() + if err != nil { + return err + } + + logOptions := &api.PodLogOptions{ + Container: containerName, + Follow: cmdutil.GetFlagBool(cmd, "follow"), + Previous: cmdutil.GetFlagBool(cmd, "previous"), + Timestamps: cmdutil.GetFlagBool(cmd, "timestamps"), + } + if sinceTime := cmdutil.GetFlagString(cmd, "since-time"); len(sinceTime) > 0 { + t, err := api.ParseRFC3339(sinceTime, unversioned.Now) + if err != nil { + return err + } + logOptions.SinceTime = &t + } + if limit := cmdutil.GetFlagInt64(cmd, "limit-bytes"); limit != 0 { + logOptions.LimitBytes = &limit + } + if tail := cmdutil.GetFlagInt64(cmd, "tail"); tail != -1 { + logOptions.TailLines = &tail + } + if sinceSeconds := cmdutil.GetFlagDuration(cmd, "since"); sinceSeconds != 0 { + // round up to the nearest second + sec := int64(math.Ceil(float64(sinceSeconds) / float64(time.Second))) + logOptions.SinceSeconds = &sec + } + o.Options = logOptions + + o.Mapper, o.Typer = f.Object() + o.Decoder = f.Decoder(true) + o.ClientMapper = resource.ClientMapperFunc(f.ClientForMapping) + o.LogsForObject = f.LogsForObject + + o.Out = out + + return nil +} + +func (o LogsOptions) Validate() error { + if len(o.ResourceArg) == 0 { + return errors.New("a pod must be specified") + } + logsOptions, ok := o.Options.(*api.PodLogOptions) + if !ok { + return errors.New("unexpected logs options object") + } + if errs := validation.ValidatePodLogOptions(logsOptions); len(errs) > 0 { + return errs.ToAggregate() + } + + return nil +} + +// RunLogs retrieves a pod log +func (o LogsOptions) RunLogs() (int64, error) { + infos, err := resource.NewBuilder(o.Mapper, o.Typer, o.ClientMapper, o.Decoder). + NamespaceParam(o.Namespace).DefaultNamespace(). + ResourceNames("pods", o.ResourceArg). + SingleResourceType(). + Do().Infos() + if err != nil { + return 0, err + } + if len(infos) != 1 { + return 0, errors.New("expected a resource") + } + info := infos[0] + + req, err := o.LogsForObject(info.Object, o.Options) + if err != nil { + return 0, err + } + + readCloser, err := req.Stream() + if err != nil { + return 0, err + } + defer readCloser.Close() + + return io.Copy(o.Out, readCloser) +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/log_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs_test.go similarity index 58% rename from vendor/k8s.io/kubernetes/pkg/kubectl/cmd/log_test.go rename to vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs_test.go index 013b4ee5f..caa867031 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/log_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/logs_test.go @@ -20,9 +20,14 @@ import ( "bytes" "io/ioutil" "net/http" + "os" + "strings" "testing" + "github.com/spf13/cobra" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/fake" ) @@ -35,7 +40,7 @@ func TestLog(t *testing.T) { { name: "v1 - pod log", version: "v1", - podPath: "/api/v1/namespaces/test/pods/foo", + podPath: "/namespaces/test/pods/foo", logPath: "/api/v1/namespaces/test/pods/foo/log", pod: testPod(), }, @@ -45,7 +50,7 @@ func TestLog(t *testing.T) { f, tf, codec := NewAPIFactory() tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == test.podPath && m == "GET": body := objBody(codec, test.pod) @@ -61,10 +66,10 @@ func TestLog(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: test.version} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: test.version}}} buf := bytes.NewBuffer([]byte{}) - cmd := NewCmdLog(f, buf) + cmd := NewCmdLogs(f, buf) cmd.Flags().Set("namespace", "test") cmd.Run(cmd, []string{"foo"}) @@ -88,3 +93,49 @@ func testPod() *api.Pod { }, } } + +func TestValidateLogFlags(t *testing.T) { + f, _, _ := NewAPIFactory() + + tests := []struct { + name string + flags map[string]string + expected string + }{ + { + name: "since & since-time", + flags: map[string]string{"since": "1h", "since-time": "2006-01-02T15:04:05Z"}, + expected: "at most one of `sinceTime` or `sinceSeconds` may be specified", + }, + { + name: "negative limit-bytes", + flags: map[string]string{"limit-bytes": "-100"}, + expected: "must be greater than 0", + }, + { + name: "negative tail", + flags: map[string]string{"tail": "-100"}, + expected: "must be greater than or equal to 0", + }, + } + for _, test := range tests { + cmd := NewCmdLogs(f, bytes.NewBuffer([]byte{})) + out := "" + for flag, value := range test.flags { + cmd.Flags().Set(flag, value) + } + // checkErr breaks tests in case of errors, plus we just + // need to check errors returned by the command validation + o := &LogsOptions{} + cmd.Run = func(cmd *cobra.Command, args []string) { + o.Complete(f, os.Stdout, cmd, args) + out = o.Validate().Error() + o.RunLogs() + } + cmd.Run(cmd, []string{"foo"}) + + if !strings.Contains(out, test.expected) { + t.Errorf("%s: expected to find:\n\t%s\nfound:\n\t%s\n", test.name, test.expected, out) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/patch.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/patch.go index 13bfc8fbe..cd35b9d30 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/patch.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/patch.go @@ -19,6 +19,7 @@ package cmd import ( "fmt" "io" + "strings" "github.com/spf13/cobra" @@ -26,9 +27,12 @@ import ( "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/util/sets" "k8s.io/kubernetes/pkg/util/yaml" ) +var patchTypes = map[string]api.PatchType{"json": api.JSONPatchType, "merge": api.MergePatchType, "strategic": api.StrategicMergePatchType} + // PatchOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of // referencing the cmd.Flags() type PatchOptions struct { @@ -40,7 +44,7 @@ const ( JSON and YAML formats are accepted. -Please refer to the models in https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/HEAD/docs/api-reference/definitions.html to find if a field is mutable.` +Please refer to the models in https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html to find if a field is mutable.` patch_example = ` # Partially update a node using strategic merge patch kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}' @@ -49,7 +53,10 @@ kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}' kubectl patch -f node.json -p '{"spec":{"unschedulable":true}}' # Update a container's image; spec.containers[*].name is required because it's a merge key -kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'` +kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}' + +# Update a container's image using a json patch with positional arrays +kubectl patch pod valid-pod -type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'` ) func NewCmdPatch(f *cmdutil.Factory, out io.Writer) *cobra.Command { @@ -57,7 +64,7 @@ func NewCmdPatch(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "patch (-f FILENAME | TYPE NAME) -p PATCH", - Short: "Update field(s) of a resource by stdin.", + Short: "Update field(s) of a resource using strategic merge patch.", Long: patch_long, Example: patch_example, Run: func(cmd *cobra.Command, args []string) { @@ -69,7 +76,9 @@ func NewCmdPatch(f *cmdutil.Factory, out io.Writer) *cobra.Command { } cmd.Flags().StringP("patch", "p", "", "The patch to be applied to the resource JSON file.") cmd.MarkFlagRequired("patch") + cmd.Flags().String("type", "strategic", fmt.Sprintf("The type of patch being provided; one of %v", sets.StringKeySet(patchTypes).List())) cmdutil.AddOutputFlagsForMutation(cmd) + cmdutil.AddRecordFlag(cmd) usage := "Filename, directory, or URL to a file identifying the resource to update" kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) @@ -82,6 +91,16 @@ func RunPatch(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri return err } + patchType := api.StrategicMergePatchType + patchTypeString := strings.ToLower(cmdutil.GetFlagString(cmd, "type")) + if len(patchTypeString) != 0 { + ok := false + patchType, ok = patchTypes[patchTypeString] + if !ok { + return cmdutil.UsageError(cmd, fmt.Sprintf("--type must be one of %v, not %q", sets.StringKeySet(patchTypes).List(), patchTypeString)) + } + } + patch := cmdutil.GetFlagString(cmd, "patch") if len(patch) == 0 { return cmdutil.UsageError(cmd, "Must specify -p to patch") @@ -92,7 +111,7 @@ func RunPatch(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). FilenameParam(enforceNamespace, options.Filenames...). @@ -114,16 +133,26 @@ func RunPatch(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri info := infos[0] name, namespace := info.Name, info.Namespace mapping := info.ResourceMapping() - client, err := f.RESTClient(mapping) + client, err := f.ClientForMapping(mapping) if err != nil { return err } helper := resource.NewHelper(client, mapping) - _, err = helper.Patch(namespace, name, api.StrategicMergePatchType, patchBytes) + _, err = helper.Patch(namespace, name, patchType, patchBytes) if err != nil { return err } + if cmdutil.ShouldRecord(cmd, info) { + patchBytes, err = cmdutil.ChangeResourcePatch(info, f.Command()) + if err != nil { + return err + } + _, err = helper.Patch(namespace, name, api.StrategicMergePatchType, patchBytes) + if err != nil { + return err + } + } cmdutil.PrintSuccess(mapper, shortOutput, out, "", name, "patched") return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/patch_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/patch_test.go index 2819bb372..fd22dcaf4 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/patch_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/patch_test.go @@ -31,7 +31,7 @@ func TestPatchObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/services/frontend" && (m == "PATCH" || m == "GET"): return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil @@ -63,7 +63,7 @@ func TestPatchObjectFromFile(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/services/frontend" && (m == "PATCH" || m == "GET"): return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/portforward_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/portforward_test.go index 7092eb7aa..eebda28b8 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/portforward_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/portforward_test.go @@ -26,6 +26,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/api/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/fake" ) @@ -43,7 +44,7 @@ func (f *fakePortForwarder) ForwardPorts(method string, url *url.URL, config *cl } func TestPortForward(t *testing.T) { - version := testapi.Default.Version() + version := testapi.Default.GroupVersion().Version tests := []struct { name, version, podPath, pfPath, container string @@ -70,7 +71,7 @@ func TestPortForward(t *testing.T) { f, tf, codec := NewAPIFactory() tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == test.podPath && m == "GET": body := objBody(codec, test.pod) @@ -83,7 +84,7 @@ func TestPortForward(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: test.version} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: test.version}}} ff := &fakePortForwarder{} if test.pfErr { ff.pfErr = fmt.Errorf("pf error") @@ -113,7 +114,7 @@ func TestPortForward(t *testing.T) { } func TestPortForwardWithPFlag(t *testing.T) { - version := testapi.Default.Version() + version := testapi.Default.GroupVersion().Version tests := []struct { name, version, podPath, pfPath, container string @@ -140,7 +141,7 @@ func TestPortForwardWithPFlag(t *testing.T) { f, tf, codec := NewAPIFactory() tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == test.podPath && m == "GET": body := objBody(codec, test.pod) @@ -153,7 +154,7 @@ func TestPortForwardWithPFlag(t *testing.T) { }), } tf.Namespace = "test" - tf.ClientConfig = &client.Config{Version: test.version} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: test.version}}} ff := &fakePortForwarder{} if test.pfErr { ff.pfErr = fmt.Errorf("pf error") diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/replace.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/replace.go index 6bdf4f399..81eacecbd 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/replace.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/replace.go @@ -44,7 +44,7 @@ JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by $ kubectl get TYPE NAME -o yaml -Please refer to the models in https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/HEAD/docs/api-reference/definitions.html to find if a field is mutable.` +Please refer to the models in https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html to find if a field is mutable.` replace_example = `# Replace a pod using the data in pod.json. $ kubectl replace -f ./pod.json @@ -83,6 +83,8 @@ func NewCmdReplace(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd.Flags().Duration("timeout", 0, "Only relevant during a force replace. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object") cmdutil.AddValidateFlags(cmd) cmdutil.AddOutputFlagsForMutation(cmd) + cmdutil.AddApplyAnnotationFlags(cmd) + cmdutil.AddRecordFlag(cmd) return cmd } @@ -111,7 +113,7 @@ func RunReplace(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []st } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). Schema(schema). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). @@ -128,18 +130,18 @@ func RunReplace(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []st return err } - // Serialize the configuration into an annotation. - if err := kubectl.UpdateApplyAnnotation(info); err != nil { - return err - } - - // Serialize the object with the annotation applied. - data, err := info.Mapping.Codec.Encode(info.Object) - if err != nil { + if err := kubectl.CreateOrUpdateAnnotation(cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag), info, f.JSONEncoder()); err != nil { return cmdutil.AddSourceToErr("replacing", info.Source, err) } - obj, err := resource.NewHelper(info.Client, info.Mapping).Replace(info.Namespace, info.Name, true, data) + if cmdutil.ShouldRecord(cmd, info) { + if err := cmdutil.RecordChangeCause(info.Object, f.Command()); err != nil { + return cmdutil.AddSourceToErr("replacing", info.Source, err) + } + } + + // Serialize the object with the annotation applied. + obj, err := resource.NewHelper(info.Client, info.Mapping).Replace(info.Namespace, info.Name, true, info.Object) if err != nil { return cmdutil.AddSourceToErr("replacing", info.Source, err) } @@ -179,7 +181,7 @@ func forceReplace(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args [] } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). FilenameParam(enforceNamespace, options.Filenames...). @@ -203,7 +205,7 @@ func forceReplace(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args [] return err } - r = resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r = resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). Schema(schema). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). @@ -221,18 +223,17 @@ func forceReplace(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args [] return err } - // Serialize the configuration into an annotation. - if err := kubectl.UpdateApplyAnnotation(info); err != nil { + if err := kubectl.CreateOrUpdateAnnotation(cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag), info, f.JSONEncoder()); err != nil { return err } - // Serialize the object with the annotation applied. - data, err := info.Mapping.Codec.Encode(info.Object) - if err != nil { - return err + if cmdutil.ShouldRecord(cmd, info) { + if err := cmdutil.RecordChangeCause(info.Object, f.Command()); err != nil { + return cmdutil.AddSourceToErr("replacing", info.Source, err) + } } - obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, data) + obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, info.Object) if err != nil { return err } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/replace_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/replace_test.go index 6b7e98dcf..5ca2b2ec8 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/replace_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/replace_test.go @@ -32,7 +32,7 @@ func TestReplaceObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master" && (m == "GET" || m == "PUT" || m == "DELETE"): return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil @@ -75,7 +75,7 @@ func TestReplaceMultipleObject(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master" && (m == "GET" || m == "PUT" || m == "DELETE"): return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil @@ -122,7 +122,7 @@ func TestReplaceDirectory(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case strings.HasPrefix(p, "/namespaces/test/services/") && (m == "GET" || m == "PUT" || m == "DELETE"): return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil @@ -169,7 +169,7 @@ func TestForceReplaceObjectNotFound(t *testing.T) { tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE": return &http.Response{StatusCode: 404, Body: stringBody("")}, nil diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollingupdate.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollingupdate.go index ee109e16e..c3e796371 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollingupdate.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollingupdate.go @@ -30,10 +30,11 @@ import ( "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/apimachinery/registered" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) // RollingUpdateOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of @@ -58,8 +59,11 @@ $ cat frontend-v2.json | kubectl rolling-update frontend-v1 -f - # name of the replication controller. $ kubectl rolling-update frontend-v1 frontend-v2 --image=image:v2 -# Update the pods of frontend by just changing the image, and keeping the old name +# Update the pods of frontend by just changing the image, and keeping the old name. $ kubectl rolling-update frontend --image=image:v2 + +# Abort and reverse an existing rollout in progress (from frontend-v1 to frontend-v2). +$ kubectl rolling-update frontend-v1 frontend-v2 --rollback ` ) @@ -93,6 +97,7 @@ func NewCmdRollingUpdate(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd.Flags().String("image", "", "Image to use for upgrading the replication controller. Must be distinct from the existing image (either new image or new image tag). Can not be used with --filename/-f") cmd.MarkFlagRequired("image") cmd.Flags().String("deployment-label-key", "deployment", "The key to use to differentiate between two different controllers, default 'deployment'. Only relevant when --image is specified, ignored otherwise") + cmd.Flags().String("container", "", "Container name which will have its image upgraded. Only relevant when --image is specified, ignored otherwise. Required when using --image on a multi-container pod") cmd.Flags().Bool("dry-run", false, "If true, print out the changes that would be made, but don't actually make them.") cmd.Flags().Bool("rollback", false, "If true, this is a request to abort an existing rollout that is partially rolled out. It effectively reverses current and next and runs a rollout") cmdutil.AddValidateFlags(cmd) @@ -151,6 +156,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg timeout := cmdutil.GetFlagDuration(cmd, "timeout") dryrun := cmdutil.GetFlagBool(cmd, "dry-run") outputFormat := cmdutil.GetFlagString(cmd, "output") + container := cmdutil.GetFlagString(cmd, "container") if len(options.Filenames) > 0 { filename = options.Filenames[0] @@ -192,7 +198,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg return err } - request := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + request := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). Schema(schema). NamespaceParam(cmdNamespace).DefaultNamespace(). FilenameParam(enforceNamespace, filename). @@ -212,8 +218,8 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg } newRc, ok = obj.(*api.ReplicationController) if !ok { - if _, kind, err := typer.ObjectVersionAndKind(obj); err == nil { - return cmdutil.UsageError(cmd, "%s contains a %s not a ReplicationController", filename, kind) + if gvk, err := typer.ObjectKind(obj); err == nil { + return cmdutil.UsageError(cmd, "%s contains a %v not a ReplicationController", filename, gvk) } glog.V(4).Infof("Object %#v is not a ReplicationController", obj) return cmdutil.UsageError(cmd, "%s does not specify a valid ReplicationController", filename) @@ -229,6 +235,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg // than the old rc. This selector is the hash of the rc, which will differ because the new rc has a // different image. if len(image) != 0 { + codec := registered.GroupOrDie(client.APIVersion().Group).Codec keepOldName = len(args) == 1 newName := findNewName(args, oldRc) if newRc, err = kubectl.LoadExistingNextReplicationController(client, cmdNamespace, newName); err != nil { @@ -243,14 +250,14 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg if oldRc.Spec.Template.Spec.Containers[0].Image == image { return cmdutil.UsageError(cmd, "Specified --image must be distinct from existing container image") } - newRc, err = kubectl.CreateNewControllerFromCurrentController(client, cmdNamespace, oldName, newName, image, deploymentKey) + newRc, err = kubectl.CreateNewControllerFromCurrentController(client, codec, cmdNamespace, oldName, newName, image, container, deploymentKey) if err != nil { return err } } // Update the existing replication controller with pointers to the 'next' controller // and adding the label if necessary to distinguish it from the 'next' controller. - oldHash, err := api.HashObject(oldRc, client.Codec) + oldHash, err := api.HashObject(oldRc, codec) if err != nil { return err } @@ -326,8 +333,8 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg Interval: interval, Timeout: timeout, CleanupPolicy: updateCleanupPolicy, - MaxUnavailable: util.NewIntOrStringFromInt(0), - MaxSurge: util.NewIntOrStringFromInt(1), + MaxUnavailable: intstr.FromInt(1), + MaxSurge: intstr.FromInt(1), } if rollback { err = kubectl.AbortRollingUpdate(config) @@ -354,12 +361,12 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg if outputFormat != "" { return f.PrintObject(cmd, newRc, out) } - _, kind, err := api.Scheme.ObjectVersionAndKind(newRc) + kind, err := api.Scheme.ObjectKind(newRc) if err != nil { return err } - _, res := meta.KindToResource(kind, false) - cmdutil.PrintSuccess(mapper, false, out, res, oldName, message) + _, res := meta.KindToResource(kind) + cmdutil.PrintSuccess(mapper, false, out, res.Resource, oldName, message) return nil } @@ -379,11 +386,9 @@ func isReplicasDefaulted(info *resource.Info) bool { // was unable to recover versioned info return false } - switch info.Mapping.APIVersion { - case "v1": - if rc, ok := info.VersionedObject.(*v1.ReplicationController); ok { - return rc.Spec.Replicas == nil - } + switch t := info.VersionedObject.(type) { + case *v1.ReplicationController: + return t.Spec.Replicas == nil } return false } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout.go new file mode 100644 index 000000000..8fbb53595 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout.go @@ -0,0 +1,54 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rollout + +import ( + "io" + + "github.com/spf13/cobra" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" +) + +const ( + rollout_long = `rollout manages a deployment using subcommands like "kubectl rollout undo deployment/abc"` + rollout_example = `# Rollback to the previous deployment +$ kubectl rollout undo deployment/abc` + rollout_valid_resources = `Valid resource types include: + * deployments +` +) + +func NewCmdRollout(f *cmdutil.Factory, out io.Writer) *cobra.Command { + + cmd := &cobra.Command{ + Use: "rollout SUBCOMMAND", + Short: "rollout manages a deployment", + Long: rollout_long, + Example: rollout_example, + Run: func(cmd *cobra.Command, args []string) { + cmd.Help() + }, + } + + // subcommands + cmd.AddCommand(NewCmdRolloutHistory(f, out)) + cmd.AddCommand(NewCmdRolloutPause(f, out)) + cmd.AddCommand(NewCmdRolloutResume(f, out)) + cmd.AddCommand(NewCmdRolloutUndo(f, out)) + + return cmd +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_history.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_history.go new file mode 100644 index 000000000..f3eeb4a71 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_history.go @@ -0,0 +1,122 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rollout + +import ( + "fmt" + "io" + + "k8s.io/kubernetes/pkg/kubectl" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/util/errors" + + "github.com/spf13/cobra" +) + +// HistoryOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of +// referencing the cmd.Flags() +type HistoryOptions struct { + Filenames []string +} + +const ( + history_long = `view previous rollout revisions and configurations.` + history_example = `# View the rollout history of a deployment +$ kubectl rollout history deployment/abc` +) + +func NewCmdRolloutHistory(f *cmdutil.Factory, out io.Writer) *cobra.Command { + options := &HistoryOptions{} + + cmd := &cobra.Command{ + Use: "history (TYPE NAME | TYPE/NAME) [flags]", + Short: "view rollout history", + Long: history_long, + Example: history_example, + Run: func(cmd *cobra.Command, args []string) { + cmdutil.CheckErr(RunHistory(f, cmd, out, args, options)) + }, + } + + cmd.Flags().Int64("revision", 0, "See the details, including podTemplate of the revision specified") + usage := "Filename, directory, or URL to a file identifying the resource to get from a server." + kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) + return cmd +} + +func RunHistory(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, args []string, options *HistoryOptions) error { + if len(args) == 0 && len(options.Filenames) == 0 { + return cmdutil.UsageError(cmd, "Required resource not specified.") + } + revisionDetail := cmdutil.GetFlagInt64(cmd, "revision") + + mapper, typer := f.Object() + + cmdNamespace, enforceNamespace, err := f.DefaultNamespace() + if err != nil { + return err + } + + infos, err := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). + NamespaceParam(cmdNamespace).DefaultNamespace(). + FilenameParam(enforceNamespace, options.Filenames...). + ResourceTypeOrNameArgs(true, args...). + Latest(). + Flatten(). + Do(). + Infos() + if err != nil { + return err + } + + errs := []error{} + for _, info := range infos { + mapping := info.ResourceMapping() + historyViewer, err := f.HistoryViewer(mapping) + if err != nil { + errs = append(errs, err) + continue + } + historyInfo, err := historyViewer.History(info.Namespace, info.Name) + if err != nil { + errs = append(errs, err) + continue + } + + formattedOutput := "" + if revisionDetail > 0 { + // Print details of a specific revision + template, ok := historyInfo.RevisionToTemplate[revisionDetail] + if !ok { + return fmt.Errorf("unable to find revision %d of %s %q", revisionDetail, mapping.Resource, info.Name) + } + fmt.Fprintf(out, "%s %q revision %d\n", mapping.Resource, info.Name, revisionDetail) + formattedOutput, err = kubectl.DescribePodTemplate(template) + } else { + // Print all revisions + formattedOutput, err = kubectl.PrintRolloutHistory(historyInfo, mapping.Resource, info.Name) + } + if err != nil { + errs = append(errs, err) + continue + } + fmt.Fprintf(out, "%s\n", formattedOutput) + } + + return errors.NewAggregate(errs) +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_pause.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_pause.go new file mode 100644 index 000000000..ae07dcefd --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_pause.go @@ -0,0 +1,118 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rollout + +import ( + "fmt" + "io" + + "github.com/spf13/cobra" + + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/kubectl" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" +) + +// PauseConfig is the start of the data required to perform the operation. As new fields are added, add them here instead of +// referencing the cmd.Flags() +type PauseConfig struct { + PauseObject func(object runtime.Object) (bool, error) + Mapper meta.RESTMapper + Typer runtime.ObjectTyper + Info *resource.Info + + Out io.Writer + Filenames []string +} + +const ( + pause_long = `Mark the provided resource as paused + +Paused resources will not be reconciled by a controller. +Use \"kubectl rollout resume\" to resume a paused resource. +Currently only deployments support being paused.` + + pause_example = `# Mark the nginx deployment as paused. Any current state of +# the deployment will continue its function, new updates to the deployment will not +# have an effect as long as the deployment is paused. +$ kubectl rollout pause deployment/nginx` +) + +func NewCmdRolloutPause(f *cmdutil.Factory, out io.Writer) *cobra.Command { + opts := &PauseConfig{} + + cmd := &cobra.Command{ + Use: "pause RESOURCE", + Short: "Mark the provided resource as paused", + Long: pause_long, + Example: pause_example, + Run: func(cmd *cobra.Command, args []string) { + cmdutil.CheckErr(opts.CompletePause(f, cmd, out, args)) + cmdutil.CheckErr(opts.RunPause()) + }, + } + + usage := "Filename, directory, or URL to a file identifying the resource to get from a server." + kubectl.AddJsonFilenameFlag(cmd, &opts.Filenames, usage) + return cmd +} + +func (o *PauseConfig) CompletePause(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, args []string) error { + if len(args) == 0 && len(o.Filenames) == 0 { + return cmdutil.UsageError(cmd, cmd.Use) + } + + o.Mapper, o.Typer = f.Object() + o.PauseObject = f.PauseObject + o.Out = out + + cmdNamespace, enforceNamespace, err := f.DefaultNamespace() + if err != nil { + return err + } + + infos, err := resource.NewBuilder(o.Mapper, o.Typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). + NamespaceParam(cmdNamespace).DefaultNamespace(). + FilenameParam(enforceNamespace, o.Filenames...). + ResourceTypeOrNameArgs(true, args...). + SingleResourceType(). + Latest(). + Do().Infos() + if err != nil { + return err + } + if len(infos) != 1 { + return fmt.Errorf("rollout pause is only supported on individual resources - %d resources were found", len(infos)) + } + o.Info = infos[0] + return nil +} + +func (o PauseConfig) RunPause() error { + isAlreadyPaused, err := o.PauseObject(o.Info.Object) + if err != nil { + return err + } + if isAlreadyPaused { + cmdutil.PrintSuccess(o.Mapper, false, o.Out, o.Info.Mapping.Resource, o.Info.Name, "already paused") + return nil + } + cmdutil.PrintSuccess(o.Mapper, false, o.Out, o.Info.Mapping.Resource, o.Info.Name, "paused") + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_resume.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_resume.go new file mode 100644 index 000000000..a38147e75 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_resume.go @@ -0,0 +1,116 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rollout + +import ( + "fmt" + "io" + + "github.com/spf13/cobra" + + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/kubectl" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" +) + +// ResumeConfig is the start of the data required to perform the operation. As new fields are added, add them here instead of +// referencing the cmd.Flags() +type ResumeConfig struct { + ResumeObject func(object runtime.Object) (bool, error) + Mapper meta.RESTMapper + Typer runtime.ObjectTyper + Info *resource.Info + + Out io.Writer + Filenames []string +} + +const ( + resume_long = `Resume a paused resource + +Paused resources will not be reconciled by a controller. By resuming a +resource, we allow it to be reconciled again. +Currently only deployments support being resumed.` + + resume_example = `# Resume an already paused deployment +$ kubectl rollout resume deployment/nginx` +) + +func NewCmdRolloutResume(f *cmdutil.Factory, out io.Writer) *cobra.Command { + opts := &ResumeConfig{} + + cmd := &cobra.Command{ + Use: "resume RESOURCE", + Short: "Resume a paused resource", + Long: resume_long, + Example: resume_example, + Run: func(cmd *cobra.Command, args []string) { + cmdutil.CheckErr(opts.CompleteResume(f, cmd, out, args)) + cmdutil.CheckErr(opts.RunResume()) + }, + } + + usage := "Filename, directory, or URL to a file identifying the resource to get from a server." + kubectl.AddJsonFilenameFlag(cmd, &opts.Filenames, usage) + return cmd +} + +func (o *ResumeConfig) CompleteResume(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, args []string) error { + if len(args) == 0 && len(o.Filenames) == 0 { + return cmdutil.UsageError(cmd, cmd.Use) + } + + o.Mapper, o.Typer = f.Object() + o.ResumeObject = f.ResumeObject + o.Out = out + + cmdNamespace, enforceNamespace, err := f.DefaultNamespace() + if err != nil { + return err + } + + infos, err := resource.NewBuilder(o.Mapper, o.Typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). + NamespaceParam(cmdNamespace).DefaultNamespace(). + FilenameParam(enforceNamespace, o.Filenames...). + ResourceTypeOrNameArgs(true, args...). + SingleResourceType(). + Latest(). + Do().Infos() + if err != nil { + return err + } + if len(infos) != 1 { + return fmt.Errorf("rollout resume is only supported on individual resources - %d resources were found", len(infos)) + } + o.Info = infos[0] + return nil +} + +func (o ResumeConfig) RunResume() error { + isAlreadyResumed, err := o.ResumeObject(o.Info.Object) + if err != nil { + return err + } + if isAlreadyResumed { + cmdutil.PrintSuccess(o.Mapper, false, o.Out, o.Info.Mapping.Resource, o.Info.Name, "already resumed") + return nil + } + cmdutil.PrintSuccess(o.Mapper, false, o.Out, o.Info.Mapping.Resource, o.Info.Name, "resumed") + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_undo.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_undo.go new file mode 100644 index 000000000..ccaf429ee --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_undo.go @@ -0,0 +1,111 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package rollout + +import ( + "fmt" + "io" + + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/kubectl" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" + + "github.com/spf13/cobra" +) + +// UndoOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of +// referencing the cmd.Flags() +type UndoOptions struct { + Rollbacker kubectl.Rollbacker + Mapper meta.RESTMapper + Typer runtime.ObjectTyper + Info *resource.Info + ToRevision int64 + Out io.Writer + Filenames []string +} + +const ( + undo_long = `undo rolls back to a previous rollout.` + undo_example = `# Rollback to the previous deployment +$ kubectl rollout undo deployment/abc` +) + +func NewCmdRolloutUndo(f *cmdutil.Factory, out io.Writer) *cobra.Command { + options := &UndoOptions{} + + cmd := &cobra.Command{ + Use: "undo (TYPE NAME | TYPE/NAME) [flags]", + Short: "undoes a previous rollout", + Long: undo_long, + Example: undo_example, + Run: func(cmd *cobra.Command, args []string) { + cmdutil.CheckErr(options.CompleteUndo(f, cmd, out, args)) + cmdutil.CheckErr(options.RunUndo()) + }, + } + + cmd.Flags().Int64("to-revision", 0, "The revision to rollback to. Default to 0 (last revision).") + usage := "Filename, directory, or URL to a file identifying the resource to get from a server." + kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) + return cmd +} + +func (o *UndoOptions) CompleteUndo(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, args []string) error { + if len(args) == 0 && len(o.Filenames) == 0 { + return cmdutil.UsageError(cmd, "Required resource not specified.") + } + + o.ToRevision = cmdutil.GetFlagInt64(cmd, "to-revision") + o.Mapper, o.Typer = f.Object() + o.Out = out + + cmdNamespace, enforceNamespace, err := f.DefaultNamespace() + if err != nil { + return err + } + + infos, err := resource.NewBuilder(o.Mapper, o.Typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). + NamespaceParam(cmdNamespace).DefaultNamespace(). + FilenameParam(enforceNamespace, o.Filenames...). + ResourceTypeOrNameArgs(true, args...). + Latest(). + Flatten(). + Do(). + Infos() + if err != nil { + return err + } + + if len(infos) != 1 { + return fmt.Errorf("rollout undo is only supported on individual resources - %d resources were found", len(infos)) + } + o.Info = infos[0] + o.Rollbacker, err = f.Rollbacker(o.Info.ResourceMapping()) + return err +} + +func (o *UndoOptions) RunUndo() error { + result, err := o.Rollbacker.Rollback(o.Info.Namespace, o.Info.Name, nil, o.ToRevision, o.Info.Object) + if err != nil { + return err + } + cmdutil.PrintSuccess(o.Mapper, false, o.Out, o.Info.Mapping.Resource, o.Info.Name, result) + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/run.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/run.go index 3e5e84ca8..f95759a58 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/run.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/run.go @@ -26,17 +26,15 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" client "k8s.io/kubernetes/pkg/client/unversioned" - "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" - "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" ) const ( run_long = `Create and run a particular image, possibly replicated. -Creates a replication controller to manage the created container(s).` +Creates a deployment or job to manage the created container(s).` run_example = `# Start a single instance of nginx. $ kubectl run nginx --image=nginx @@ -52,42 +50,49 @@ $ kubectl run nginx --image=nginx --replicas=5 # Dry run. Print the corresponding API objects without creating them. $ kubectl run nginx --image=nginx --dry-run -# Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON. +# Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON. $ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }' -# Start a single instance of nginx and keep it in the foreground, don't restart it if it exits. -$ kubectl run -i -tty nginx --image=nginx --restart=Never +# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits. +$ kubectl run -i --tty busybox --image=busybox --restart=Never # Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command. $ kubectl run nginx --image=nginx -- ... -# Start the nginx container using a different command and custom arguments -$ kubectl run nginx --image=nginx --command -- ... ` +# Start the nginx container using a different command and custom arguments. +$ kubectl run nginx --image=nginx --command -- ... + +# Start the perl container to compute π to 2000 places and print it out. +$ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'` ) func NewCmdRun(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "run NAME --image=image [--env=\"key=value\"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json]", + Use: "run NAME --image=image [--env=\"key=value\"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]", // run-container is deprecated Aliases: []string{"run-container"}, Short: "Run a particular image on the cluster.", Long: run_long, Example: run_example, Run: func(cmd *cobra.Command, args []string) { - err := Run(f, cmdIn, cmdOut, cmdErr, cmd, args) + argsLenAtDash := cmd.ArgsLenAtDash() + err := Run(f, cmdIn, cmdOut, cmdErr, cmd, args, argsLenAtDash) cmdutil.CheckErr(err) }, } cmdutil.AddPrinterFlags(cmd) addRunFlags(cmd) + cmdutil.AddApplyAnnotationFlags(cmd) + cmdutil.AddRecordFlag(cmd) return cmd } func addRunFlags(cmd *cobra.Command) { - cmd.Flags().String("generator", "", "The name of the API generator to use. Default is 'run/v1' if --restart=Always, otherwise the default is 'run-pod/v1'.") + cmd.Flags().String("generator", "", "The name of the API generator to use. Default is 'deployment/v1beta1' if --restart=Always, otherwise the default is 'job/v1beta1'.") cmd.Flags().String("image", "", "The image for the container to run.") cmd.MarkFlagRequired("image") cmd.Flags().IntP("replicas", "r", 1, "Number of replicas to create for this container. Default is 1.") + cmd.Flags().Bool("rm", false, "If true, delete resources created in this command for attached containers.") cmd.Flags().Bool("dry-run", false, "If true, only print the object that would be sent, without sending it.") cmd.Flags().String("overrides", "", "An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.") cmd.Flags().StringSlice("env", []string{}, "Environment variables to set in the container") @@ -98,7 +103,7 @@ func addRunFlags(cmd *cobra.Command) { cmd.Flags().Bool("tty", false, "Allocated a TTY for each container in the pod. Because -t is currently shorthand for --template, -t is not supported for --tty. This shorthand is deprecated and we expect to adopt -t for --tty soon.") cmd.Flags().Bool("attach", false, "If true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...' were called. Default false, unless '-i/--interactive' is set, in which case the default is true.") cmd.Flags().Bool("leave-stdin-open", false, "If the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach completes.") - cmd.Flags().String("restart", "Always", "The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a replication controller is created for this pod, if set to OnFailure or Never, only the Pod is created and --replicas must be 1. Default 'Always'") + cmd.Flags().String("restart", "Always", "The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'") cmd.Flags().Bool("command", false, "If true and extra arguments are present, use them as the 'command' field in the container, rather than the 'args' field which is the default.") cmd.Flags().String("requests", "", "The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'") cmd.Flags().String("limits", "", "The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'") @@ -107,12 +112,13 @@ func addRunFlags(cmd *cobra.Command) { cmd.Flags().String("service-overrides", "", "An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. Only used if --expose is true.") } -func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobra.Command, args []string) error { +func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobra.Command, args []string, argsLenAtDash int) error { if len(os.Args) > 1 && os.Args[1] == "run-container" { printDeprecationWarning("run", "run-container") } - if len(args) == 0 { + // Let kubectl run follow rules for `--`, see #13004 issue + if len(args) == 0 || argsLenAtDash == 0 { return cmdutil.UsageError(cmd, "NAME is required for run") } @@ -130,7 +136,6 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob if err != nil { return err } - restartPolicy, err := getRestartPolicy(cmd, interactive) if err != nil { return err @@ -142,14 +147,15 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob generatorName := cmdutil.GetFlagString(cmd, "generator") if len(generatorName) == 0 { if restartPolicy == api.RestartPolicyAlways { - generatorName = "run/v1" + generatorName = "deployment/v1beta1" } else { - generatorName = "run-pod/v1" + generatorName = "job/v1beta1" } } - generator, found := f.Generator(generatorName) + generators := f.Generators("run") + generator, found := generators[generatorName] if !found { - return cmdutil.UsageError(cmd, fmt.Sprintf("Generator: %s not found.", generatorName)) + return cmdutil.UsageError(cmd, fmt.Sprintf("generator %q not found.", generatorName)) } names := generator.ParamNames() params := kubectl.MakeParams(cmd, names) @@ -160,6 +166,11 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob params["env"] = cmdutil.GetFlagStringSlice(cmd, "env") + obj, _, mapper, mapping, err := createGeneratedObject(f, cmd, generator, names, params, cmdutil.GetFlagString(cmd, "overrides"), namespace) + if err != nil { + return err + } + if cmdutil.GetFlagBool(cmd, "expose") { serviceGenerator := cmdutil.GetFlagString(cmd, "service-generator") if len(serviceGenerator) == 0 { @@ -170,10 +181,6 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob } } - obj, kind, mapper, mapping, err := createGeneratedObject(f, cmd, generator, names, params, cmdutil.GetFlagString(cmd, "overrides"), namespace) - if err != nil { - return err - } attachFlag := cmd.Flags().Lookup("attach") attach := cmdutil.GetFlagBool(cmd, "attach") @@ -181,6 +188,11 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob attach = true } + remove := cmdutil.GetFlagBool(cmd, "rm") + if !attach && remove { + return cmdutil.UsageError(cmd, "--rm should only be used for attached containers") + } + if attach { opts := &AttachOptions{ In: cmdIn, @@ -202,15 +214,36 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob return err } opts.Client = client - // TODO: this should be abstracted into Factory to support other types - switch t := obj.(type) { - case *api.ReplicationController: - return handleAttachReplicationController(client, t, opts) - case *api.Pod: - return handleAttachPod(client, t, opts) - default: - return fmt.Errorf("cannot attach to %s: not implemented", kind) + + attachablePod, err := f.AttachablePodForObject(obj) + if err != nil { + return err } + err = handleAttachPod(f, client, attachablePod, opts) + if err != nil { + return err + } + + if remove { + namespace, err = mapping.MetadataAccessor.Namespace(obj) + if err != nil { + return err + } + var name string + name, err = mapping.MetadataAccessor.Name(obj) + if err != nil { + return err + } + _, typer := f.Object() + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). + ContinueOnError(). + NamespaceParam(namespace).DefaultNamespace(). + ResourceNames(mapping.Resource, name). + Flatten(). + Do() + return ReapResult(r, f, cmdOut, true, true, 0, -1, false, mapper) + } + return nil } outputFormat := cmdutil.GetFlagString(cmd, "output") @@ -249,36 +282,40 @@ func waitForPodRunning(c *client.Client, pod *api.Pod, out io.Writer) (status ap } } -func handleAttachReplicationController(c *client.Client, controller *api.ReplicationController, opts *AttachOptions) error { - var pods *api.PodList - for pods == nil || len(pods.Items) == 0 { - var err error - if pods, err = c.Pods(controller.Namespace).List(labels.SelectorFromSet(controller.Spec.Selector), fields.Everything()); err != nil { - return err - } - if len(pods.Items) == 0 { - fmt.Fprint(opts.Out, "Waiting for pod to be scheduled\n") - time.Sleep(2 * time.Second) - } - } - pod := &pods.Items[0] - return handleAttachPod(c, pod, opts) -} - -func handleAttachPod(c *client.Client, pod *api.Pod, opts *AttachOptions) error { +func handleAttachPod(f *cmdutil.Factory, c *client.Client, pod *api.Pod, opts *AttachOptions) error { status, err := waitForPodRunning(c, pod, opts.Out) if err != nil { return err } if status == api.PodSucceeded || status == api.PodFailed { - return handleLog(c, pod.Namespace, pod.Name, &api.PodLogOptions{Container: opts.GetContainerName(pod)}, opts.Out) + req, err := f.LogsForObject(pod, &api.PodLogOptions{Container: opts.GetContainerName(pod)}) + if err != nil { + return err + } + readCloser, err := req.Stream() + if err != nil { + return err + } + defer readCloser.Close() + _, err = io.Copy(opts.Out, readCloser) + return err } opts.Client = c opts.PodName = pod.Name opts.Namespace = pod.Namespace if err := opts.Run(); err != nil { fmt.Fprintf(opts.Out, "Error attaching, falling back to logs: %v\n", err) - return handleLog(c, pod.Namespace, pod.Name, &api.PodLogOptions{Container: opts.GetContainerName(pod)}, opts.Out) + req, err := f.LogsForObject(pod, &api.PodLogOptions{Container: opts.GetContainerName(pod)}) + if err != nil { + return err + } + readCloser, err := req.Stream() + if err != nil { + return err + } + defer readCloser.Close() + _, err = io.Copy(opts.Out, readCloser) + return err } return nil } @@ -305,7 +342,8 @@ func getRestartPolicy(cmd *cobra.Command, interactive bool) (api.RestartPolicy, } func generateService(f *cmdutil.Factory, cmd *cobra.Command, args []string, serviceGenerator string, paramsIn map[string]interface{}, namespace string, out io.Writer) error { - generator, found := f.Generator(serviceGenerator) + generators := f.Generators("expose") + generator, found := generators[serviceGenerator] if !found { return fmt.Errorf("missing service generator: %s", serviceGenerator) } @@ -357,56 +395,65 @@ func createGeneratedObject(f *cmdutil.Factory, cmd *cobra.Command, generator kub return nil, "", nil, nil, err } + // TODO: Validate flag usage against selected generator. More tricky since --expose was added. obj, err := generator.Generate(params) if err != nil { return nil, "", nil, nil, err } mapper, typer := f.Object() - version, kind, err := typer.ObjectVersionAndKind(obj) + groupVersionKind, err := typer.ObjectKind(obj) if err != nil { return nil, "", nil, nil, err } if len(overrides) > 0 { - obj, err = cmdutil.Merge(obj, overrides, kind) + codec := runtime.NewCodec(f.JSONEncoder(), f.Decoder(true)) + obj, err = cmdutil.Merge(codec, obj, overrides, groupVersionKind.Kind) if err != nil { return nil, "", nil, nil, err } } - mapping, err := mapper.RESTMapping(kind, version) + mapping, err := mapper.RESTMapping(groupVersionKind.GroupKind(), groupVersionKind.Version) if err != nil { return nil, "", nil, nil, err } - client, err := f.RESTClient(mapping) + client, err := f.ClientForMapping(mapping) if err != nil { return nil, "", nil, nil, err } + annotations, err := mapping.MetadataAccessor.Annotations(obj) + if err != nil { + return nil, "", nil, nil, err + } + if cmdutil.GetRecordFlag(cmd) || len(annotations[kubectl.ChangeCauseAnnotation]) > 0 { + if err := cmdutil.RecordChangeCause(obj, f.Command()); err != nil { + return nil, "", nil, nil, err + } + } // TODO: extract this flag to a central location, when such a location exists. if !cmdutil.GetFlagBool(cmd, "dry-run") { - resourceMapper := &resource.Mapper{ObjectTyper: typer, RESTMapper: mapper, ClientMapper: f.ClientMapperForCommand()} + resourceMapper := &resource.Mapper{ + ObjectTyper: typer, + RESTMapper: mapper, + ClientMapper: resource.ClientMapperFunc(f.ClientForMapping), + Decoder: f.Decoder(true), + } info, err := resourceMapper.InfoForObject(obj) if err != nil { return nil, "", nil, nil, err } - // Serialize the configuration into an annotation. - if err := kubectl.UpdateApplyAnnotation(info); err != nil { + if err := kubectl.CreateOrUpdateAnnotation(cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag), info, f.JSONEncoder()); err != nil { return nil, "", nil, nil, err } - // Serialize the object with the annotation applied. - data, err := mapping.Codec.Encode(info.Object) - if err != nil { - return nil, "", nil, nil, err - } - - obj, err = resource.NewHelper(client, mapping).Create(namespace, false, data) + obj, err = resource.NewHelper(client, mapping).Create(namespace, false, info.Object) if err != nil { return nil, "", nil, nil, err } } - return obj, kind, mapper, mapping, err + return obj, groupVersionKind.Kind, mapper, mapping, err } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/run_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/run_test.go index 422da9eb7..a728a810e 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/run_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/run_test.go @@ -21,6 +21,7 @@ import ( "fmt" "io/ioutil" "net/http" + "os" "reflect" "testing" @@ -30,7 +31,8 @@ import ( client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/fake" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/intstr" ) func TestGetRestartPolicy(t *testing.T) { @@ -106,6 +108,69 @@ func TestGetEnv(t *testing.T) { } } +func TestRunArgsFollowDashRules(t *testing.T) { + _, _, rc := testData() + + tests := []struct { + args []string + argsLenAtDash int + expectError bool + name string + }{ + { + args: []string{}, + argsLenAtDash: -1, + expectError: true, + name: "empty", + }, + { + args: []string{"foo"}, + argsLenAtDash: -1, + expectError: false, + name: "no cmd", + }, + { + args: []string{"foo", "sleep"}, + argsLenAtDash: -1, + expectError: false, + name: "cmd no dash", + }, + { + args: []string{"foo", "sleep"}, + argsLenAtDash: 1, + expectError: false, + name: "cmd has dash", + }, + { + args: []string{"foo", "sleep"}, + argsLenAtDash: 0, + expectError: true, + name: "no name", + }, + } + for _, test := range tests { + f, tf, codec := NewAPIFactory() + tf.Client = &fake.RESTClient{ + Codec: codec, + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { + return &http.Response{StatusCode: 201, Body: objBody(codec, &rc.Items[0])}, nil + }), + } + tf.Namespace = "test" + tf.ClientConfig = &client.Config{} + cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) + cmd.Flags().Set("image", "nginx") + cmd.Flags().Set("generator", "run/v1") + err := Run(f, os.Stdin, os.Stdout, os.Stderr, cmd, test.args, test.argsLenAtDash) + if test.expectError && err == nil { + t.Errorf("unexpected non-error (%s)", test.name) + } + if !test.expectError && err != nil { + t.Errorf("unexpected error: %v (%s)", err, test.name) + } + } +} + func TestGenerateService(t *testing.T) { tests := []struct { @@ -136,7 +201,7 @@ func TestGenerateService(t *testing.T) { { Port: 80, Protocol: "TCP", - TargetPort: util.NewIntOrStringFromInt(80), + TargetPort: intstr.FromInt(80), }, }, Selector: map[string]string{ @@ -168,7 +233,7 @@ func TestGenerateService(t *testing.T) { { Port: 80, Protocol: "TCP", - TargetPort: util.NewIntOrStringFromInt(80), + TargetPort: intstr.FromInt(80), }, }, Selector: map[string]string{ @@ -200,10 +265,10 @@ func TestGenerateService(t *testing.T) { for _, test := range tests { sawPOST := false f, tf, codec := NewAPIFactory() - tf.ClientConfig = &client.Config{Version: testapi.Default.Version()} + tf.ClientConfig = &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} tf.Client = &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case test.expectPOST && m == "POST" && p == "/namespaces/namespace/services": sawPOST = true @@ -215,7 +280,7 @@ func TestGenerateService(t *testing.T) { } defer req.Body.Close() svc := &api.Service{} - if err := codec.DecodeInto(data, svc); err != nil { + if err := runtime.DecodeInto(codec, data, svc); err != nil { t.Errorf("unexpected error: %v", err) t.FailNow() } @@ -235,6 +300,8 @@ func TestGenerateService(t *testing.T) { } cmd := &cobra.Command{} cmd.Flags().String("output", "", "") + cmd.Flags().Bool(cmdutil.ApplyAnnotationsFlag, false, "") + cmd.Flags().Bool("record", false, "Record current kubectl command in the resource annotation.") addRunFlags(cmd) if !test.expectPOST { diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/scale.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/scale.go index 19471b4ef..6ffd43566 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/scale.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/scale.go @@ -23,6 +23,7 @@ import ( "github.com/spf13/cobra" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" @@ -36,23 +37,26 @@ type ScaleOptions struct { } const ( - scale_long = `Set a new size for a Replication Controller. + scale_long = `Set a new size for a Replication Controller, Job, or Deployment. Scale also allows users to specify one or more preconditions for the scale action. If --current-replicas or --resource-version is specified, it is validated before the scale is attempted, and it is guaranteed that the precondition holds true when the scale is sent to the server.` scale_example = `# Scale replication controller named 'foo' to 3. -$ kubectl scale --replicas=3 replicationcontrollers foo +$ kubectl scale --replicas=3 rc/foo -# Scale a replication controller identified by type and name specified in "foo-controller.yaml" to 3. -$ kubectl scale --replicas=3 -f foo-controller.yaml +# Scale a resource identified by type and name specified in "foo.yaml" to 3. +$ kubectl scale --replicas=3 -f foo.yaml -# If the replication controller named foo's current size is 2, scale foo to 3. -$ kubectl scale --current-replicas=2 --replicas=3 replicationcontrollers foo +# If the deployment named mysql's current size is 2, scale mysql to 3. +$ kubectl scale --current-replicas=2 --replicas=3 deployment/mysql # Scale multiple replication controllers. -$ kubectl scale --replicas=5 rc/foo rc/bar` +$ kubectl scale --replicas=5 rc/foo rc/bar rc/baz + +# Scale job named 'cron' to 3. +$ kubectl scale --replicas=3 job/cron` ) // NewCmdScale returns a cobra command with the appropriate configuration and flags to run scale @@ -63,7 +67,7 @@ func NewCmdScale(f *cmdutil.Factory, out io.Writer) *cobra.Command { Use: "scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)", // resize is deprecated Aliases: []string{"resize"}, - Short: "Set a new size for a Replication Controller.", + Short: "Set a new size for a Replication Controller, Job, or Deployment.", Long: scale_long, Example: scale_example, Run: func(cmd *cobra.Command, args []string) { @@ -74,13 +78,14 @@ func NewCmdScale(f *cmdutil.Factory, out io.Writer) *cobra.Command { }, } cmd.Flags().String("resource-version", "", "Precondition for resource version. Requires that the current resource version match this value in order to scale.") - cmd.Flags().Int("current-replicas", -1, "Precondition for current size. Requires that the current size of the replication controller match this value in order to scale.") + cmd.Flags().Int("current-replicas", -1, "Precondition for current size. Requires that the current size of the resource match this value in order to scale.") cmd.Flags().Int("replicas", -1, "The new desired number of replicas. Required.") cmd.MarkFlagRequired("replicas") cmd.Flags().Duration("timeout", 0, "The length of time to wait before giving up on a scale operation, zero means don't wait.") cmdutil.AddOutputFlagsForMutation(cmd) + cmdutil.AddRecordFlag(cmd) - usage := "Filename, directory, or URL to a file identifying the replication controller to set a new size" + usage := "Filename, directory, or URL to a file identifying the resource to set a new size" kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) return cmd } @@ -102,7 +107,7 @@ func RunScale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). FilenameParam(enforceNamespace, options.Filenames...). @@ -127,11 +132,11 @@ func RunScale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri resourceVersion := cmdutil.GetFlagString(cmd, "resource-version") if len(resourceVersion) != 0 && len(infos) > 1 { - return fmt.Errorf("cannot use --resource-version with multiple controllers") + return fmt.Errorf("cannot use --resource-version with multiple resources") } currentSize := cmdutil.GetFlagInt(cmd, "current-replicas") if currentSize != -1 && len(infos) > 1 { - return fmt.Errorf("cannot use --current-replicas with multiple controllers") + return fmt.Errorf("cannot use --current-replicas with multiple resources") } precondition := &kubectl.ScalePrecondition{Size: currentSize, ResourceVersion: resourceVersion} retry := kubectl.NewRetryParams(kubectl.Interval, kubectl.Timeout) @@ -146,6 +151,24 @@ func RunScale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri errs = append(errs, err) continue } + if cmdutil.ShouldRecord(cmd, info) { + patchBytes, err := cmdutil.ChangeResourcePatch(info, f.Command()) + if err != nil { + errs = append(errs, err) + continue + } + mapping := info.ResourceMapping() + client, err := f.ClientForMapping(mapping) + if err != nil { + return err + } + helper := resource.NewHelper(client, mapping) + _, err = helper.Patch(info.Namespace, info.Name, api.StrategicMergePatchType, patchBytes) + if err != nil { + errs = append(errs, err) + continue + } + } cmdutil.PrintSuccess(mapper, shortOutput, out, info.Mapping.Resource, info.Name, "scaled") } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/stop.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/stop.go index 3919c22e1..606986617 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/stop.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/stop.go @@ -17,6 +17,7 @@ limitations under the License. package cmd import ( + "fmt" "io" "github.com/spf13/cobra" @@ -56,10 +57,11 @@ func NewCmdStop(f *cmdutil.Factory, out io.Writer) *cobra.Command { options := &StopOptions{} cmd := &cobra.Command{ - Use: "stop (-f FILENAME | TYPE (NAME | -l label | --all))", - Short: "Deprecated: Gracefully shut down a resource by name or filename.", - Long: stop_long, - Example: stop_example, + Use: "stop (-f FILENAME | TYPE (NAME | -l label | --all))", + Short: "Deprecated: Gracefully shut down a resource by name or filename.", + Long: stop_long, + Example: stop_example, + Deprecated: fmt.Sprintf("use %q instead.", "delete"), Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(cmdutil.ValidateOutputArgs(cmd)) cmdutil.CheckErr(RunStop(f, cmd, args, out, options)) @@ -83,7 +85,7 @@ func RunStop(f *cmdutil.Factory, cmd *cobra.Command, args []string, out io.Write } mapper, typer := f.Object() - r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()). + r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(cmdNamespace).DefaultNamespace(). ResourceTypeOrNameArgs(false, args...). diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/clientcache.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/clientcache.go index c43fcca26..523c57750 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/clientcache.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/clientcache.go @@ -17,15 +17,16 @@ limitations under the License. package util import ( - "k8s.io/kubernetes/pkg/api/registered" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery/registered" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" ) func NewClientCache(loader clientcmd.ClientConfig) *ClientCache { return &ClientCache{ - clients: make(map[string]*client.Client), - configs: make(map[string]*client.Config), + clients: make(map[unversioned.GroupVersion]*client.Client), + configs: make(map[unversioned.GroupVersion]*client.Config), loader: loader, } } @@ -34,15 +35,15 @@ func NewClientCache(loader clientcmd.ClientConfig) *ClientCache { // is invoked only once type ClientCache struct { loader clientcmd.ClientConfig - clients map[string]*client.Client - configs map[string]*client.Config + clients map[unversioned.GroupVersion]*client.Client + configs map[unversioned.GroupVersion]*client.Config defaultConfig *client.Config defaultClient *client.Client matchVersion bool } // ClientConfigForVersion returns the correct config for a server -func (c *ClientCache) ClientConfigForVersion(version string) (*client.Config, error) { +func (c *ClientCache) ClientConfigForVersion(version *unversioned.GroupVersion) (*client.Config, error) { if c.defaultConfig == nil { config, err := c.loader.ClientConfig() if err != nil { @@ -55,37 +56,71 @@ func (c *ClientCache) ClientConfigForVersion(version string) (*client.Config, er } } } - if config, ok := c.configs[version]; ok { - return config, nil + if version != nil { + if config, ok := c.configs[*version]; ok { + return config, nil + } } + // TODO: have a better config copy method config := *c.defaultConfig - negotiatedVersion, err := client.NegotiateVersion(c.defaultClient, &config, version, registered.RegisteredVersions) + + // TODO these fall out when we finish the refactor + var preferredGV *unversioned.GroupVersion + if version != nil { + versionCopy := *version + preferredGV = &versionCopy + } + + negotiatedVersion, err := client.NegotiateVersion(c.defaultClient, &config, preferredGV, registered.EnabledVersions()) if err != nil { return nil, err } - config.Version = negotiatedVersion + config.GroupVersion = negotiatedVersion client.SetKubernetesDefaults(&config) - c.configs[version] = &config + + if version != nil { + c.configs[*version] = &config + } + + // `version` does not necessarily equal `config.Version`. However, we know that we call this method again with + // `config.Version`, we should get the the config we've just built. + configCopy := config + c.configs[*config.GroupVersion] = &configCopy return &config, nil } // ClientForVersion initializes or reuses a client for the specified version, or returns an // error if that is not possible -func (c *ClientCache) ClientForVersion(version string) (*client.Client, error) { - if client, ok := c.clients[version]; ok { - return client, nil +func (c *ClientCache) ClientForVersion(version *unversioned.GroupVersion) (*client.Client, error) { + if version != nil { + if client, ok := c.clients[*version]; ok { + return client, nil + } } config, err := c.ClientConfigForVersion(version) if err != nil { return nil, err } - client, err := client.New(config) + + kubeclient, err := client.New(config) if err != nil { return nil, err } + c.clients[*config.GroupVersion] = kubeclient - c.clients[config.Version] = client - return client, nil + // `version` does not necessarily equal `config.Version`. However, we know that if we call this method again with + // `version`, we should get a client based on the same config we just found. There's no guarantee that a client + // is copiable, so create a new client and save it in the cache. + if version != nil { + configCopy := *config + kubeclient, err := client.New(&configCopy) + if err != nil { + return nil, err + } + c.clients[*version] = kubeclient + } + + return kubeclient, nil } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/editor/editor.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/editor/editor.go index 2145792e9..f77f8e137 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/editor/editor.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/editor/editor.go @@ -25,6 +25,7 @@ import ( "os/exec" "os/signal" "path/filepath" + "runtime" "strings" "github.com/docker/docker/pkg/term" @@ -33,8 +34,13 @@ import ( const ( // sorry, blame Git + // TODO: on Windows rely on 'start' to launch the editor associated + // with the given file type. If we can't because of the need of + // blocking, use a script with 'ftype' and 'assoc' to detect it. defaultEditor = "vi" defaultShell = "/bin/bash" + windowsEditor = "notepad" + windowsShell = "cmd" ) type Editor struct { @@ -47,8 +53,8 @@ type Editor struct { // the proper command line. If the provided editor has no spaces, or no quotes, // it is treated as a bare command to be loaded. Otherwise, the string will // be passed to the user's shell for execution. -func NewDefaultEditor() Editor { - args, shell := defaultEnvEditor() +func NewDefaultEditor(envs []string) Editor { + args, shell := defaultEnvEditor(envs) return Editor{ Args: args, Shell: shell, @@ -58,15 +64,27 @@ func NewDefaultEditor() Editor { func defaultEnvShell() []string { shell := os.Getenv("SHELL") if len(shell) == 0 { - shell = defaultShell + shell = platformize(defaultShell, windowsShell) } - return []string{shell, "-c"} + flag := "-c" + if shell == windowsShell { + flag = "/C" + } + return []string{shell, flag} } -func defaultEnvEditor() ([]string, bool) { - editor := os.Getenv("EDITOR") +func defaultEnvEditor(envs []string) ([]string, bool) { + var editor string + for _, env := range envs { + if len(env) > 0 { + editor = os.Getenv(env) + } + if len(editor) > 0 { + break + } + } if len(editor) == 0 { - editor = defaultEditor + editor = platformize(defaultEditor, windowsEditor) } if !strings.Contains(editor, " ") { return []string{editor}, false @@ -133,6 +151,8 @@ func (e Editor) LaunchTempFile(prefix, suffix string, r io.Reader) ([]byte, stri os.Remove(path) return nil, path, err } + // This file descriptor needs to close so the next process (Launch) can claim it. + f.Close() if err := e.Launch(path); err != nil { return nil, path, err } @@ -197,3 +217,10 @@ func randSeq(n int) string { } return string(b) } + +func platformize(linux, windows string) string { + if runtime.GOOS == "windows" { + return windows + } + return linux +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/factory.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/factory.go index 97416009b..ce75c476b 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/factory.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/factory.go @@ -27,19 +27,27 @@ import ( "os/user" "path" "strconv" + "strings" + "time" + "github.com/emicklei/go-restful/swagger" "github.com/spf13/cobra" "github.com/spf13/pflag" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" - "k8s.io/kubernetes/pkg/api/registered" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/validation" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/apis/extensions" + clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" "k8s.io/kubernetes/pkg/kubectl" "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer/json" "k8s.io/kubernetes/pkg/util" ) @@ -53,45 +61,114 @@ const ( // TODO: pass the various interfaces on the factory directly into the command constructors (so the // commands are decoupled from the factory). type Factory struct { - clients *ClientCache - flags *pflag.FlagSet - generators map[string]kubectl.Generator + clients *ClientCache + flags *pflag.FlagSet + cmd string // Returns interfaces for dealing with arbitrary runtime.Objects. Object func() (meta.RESTMapper, runtime.ObjectTyper) + // Returns interfaces for decoding objects - if toInternal is set, decoded objects will be converted + // into their internal form (if possible). Eventually the internal form will be removed as an option, + // and only versioned objects will be returned. + Decoder func(toInternal bool) runtime.Decoder + // Returns an encoder capable of encoding a provided object into JSON in the default desired version. + JSONEncoder func() runtime.Encoder // Returns a client for accessing Kubernetes resources or an error. Client func() (*client.Client, error) // Returns a client.Config for accessing the Kubernetes server. ClientConfig func() (*client.Config, error) // Returns a RESTClient for working with the specified RESTMapping or an error. This is intended // for working with arbitrary resources and is not guaranteed to point to a Kubernetes APIServer. - RESTClient func(mapping *meta.RESTMapping) (resource.RESTClient, error) + ClientForMapping func(mapping *meta.RESTMapping) (resource.RESTClient, error) // Returns a Describer for displaying the specified RESTMapping type or an error. Describer func(mapping *meta.RESTMapping) (kubectl.Describer, error) // Returns a Printer for formatting objects of the given type or an error. - Printer func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, columnLabels []string) (kubectl.ResourcePrinter, error) + Printer func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, showLabels bool, absoluteTimestamps bool, columnLabels []string) (kubectl.ResourcePrinter, error) // Returns a Scaler for changing the size of the specified RESTMapping type or an error Scaler func(mapping *meta.RESTMapping) (kubectl.Scaler, error) // Returns a Reaper for gracefully shutting down resources. Reaper func(mapping *meta.RESTMapping) (kubectl.Reaper, error) + // Returns a HistoryViewer for viewing change history + HistoryViewer func(mapping *meta.RESTMapping) (kubectl.HistoryViewer, error) + // Returns a Rollbacker for changing the rollback version of the specified RESTMapping type or an error + Rollbacker func(mapping *meta.RESTMapping) (kubectl.Rollbacker, error) // PodSelectorForObject returns the pod selector associated with the provided object PodSelectorForObject func(object runtime.Object) (string, error) + // MapBasedSelectorForObject returns the map-based selector associated with the provided object. If a + // new set-based selector is provided, an error is returned if the selector cannot be converted to a + // map-based selector + MapBasedSelectorForObject func(object runtime.Object) (string, error) // PortsForObject returns the ports associated with the provided object PortsForObject func(object runtime.Object) ([]string, error) // LabelsForObject returns the labels associated with the provided object LabelsForObject func(object runtime.Object) (map[string]string, error) + // LogsForObject returns a request for the logs associated with the provided object + LogsForObject func(object, options runtime.Object) (*client.Request, error) + // PauseObject marks the provided object as paused ie. it will not be reconciled by its controller. + PauseObject func(object runtime.Object) (bool, error) + // ResumeObject resumes a paused object ie. it will be reconciled by its controller. + ResumeObject func(object runtime.Object) (bool, error) // Returns a schema that can validate objects stored on disk. Validator func(validate bool, cacheDir string) (validation.Schema, error) + // SwaggerSchema returns the schema declaration for the provided group version kind. + SwaggerSchema func(unversioned.GroupVersionKind) (*swagger.ApiDeclaration, error) // Returns the default namespace to use in cases where no // other namespace is specified and whether the namespace was // overriden. DefaultNamespace func() (string, bool, error) - // Returns the generator for the provided generator name - Generator func(name string) (kubectl.Generator, bool) + // Generators returns the generators for the provided command + Generators func(cmdName string) map[string]kubectl.Generator // Check whether the kind of resources could be exposed - CanBeExposed func(kind string) error + CanBeExposed func(kind unversioned.GroupKind) error // Check whether the kind of resources could be autoscaled - CanBeAutoscaled func(kind string) error + CanBeAutoscaled func(kind unversioned.GroupKind) error + // AttachablePodForObject returns the pod to which to attach given an object. + AttachablePodForObject func(object runtime.Object) (*api.Pod, error) + // EditorEnvs returns a group of environment variables that the edit command + // can range over in order to determine if the user has specified an editor + // of their choice. + EditorEnvs func() []string +} + +const ( + RunV1GeneratorName = "run/v1" + RunPodV1GeneratorName = "run-pod/v1" + ServiceV1GeneratorName = "service/v1" + ServiceV2GeneratorName = "service/v2" + HorizontalPodAutoscalerV1Beta1GeneratorName = "horizontalpodautoscaler/v1beta1" + DeploymentV1Beta1GeneratorName = "deployment/v1beta1" + JobV1Beta1GeneratorName = "job/v1beta1" + NamespaceV1GeneratorName = "namespace/v1" + SecretV1GeneratorName = "secret/v1" + SecretForDockerRegistryV1GeneratorName = "secret-for-docker-registry/v1" +) + +// DefaultGenerators returns the set of default generators for use in Factory instances +func DefaultGenerators(cmdName string) map[string]kubectl.Generator { + generators := map[string]map[string]kubectl.Generator{} + generators["expose"] = map[string]kubectl.Generator{ + ServiceV1GeneratorName: kubectl.ServiceGeneratorV1{}, + ServiceV2GeneratorName: kubectl.ServiceGeneratorV2{}, + } + generators["run"] = map[string]kubectl.Generator{ + RunV1GeneratorName: kubectl.BasicReplicationController{}, + RunPodV1GeneratorName: kubectl.BasicPod{}, + DeploymentV1Beta1GeneratorName: kubectl.DeploymentV1Beta1{}, + JobV1Beta1GeneratorName: kubectl.JobV1Beta1{}, + } + generators["autoscale"] = map[string]kubectl.Generator{ + HorizontalPodAutoscalerV1Beta1GeneratorName: kubectl.HorizontalPodAutoscalerV1Beta1{}, + } + generators["namespace"] = map[string]kubectl.Generator{ + NamespaceV1GeneratorName: kubectl.NamespaceGeneratorV1{}, + } + generators["secret"] = map[string]kubectl.Generator{ + SecretV1GeneratorName: kubectl.SecretGeneratorV1{}, + } + generators["secret-for-docker-registry"] = map[string]kubectl.Generator{ + SecretForDockerRegistryV1GeneratorName: kubectl.SecretForDockerRegistryGeneratorV1{}, + } + return generators[cmdName] } // NewFactory creates a factory with the default Kubernetes resources defined @@ -103,14 +180,6 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { flags := pflag.NewFlagSet("", pflag.ContinueOnError) flags.SetNormalizeFunc(util.WarnWordSepNormalizeFunc) // Warn for "_" flags - generators := map[string]kubectl.Generator{ - "run/v1": kubectl.BasicReplicationController{}, - "run-pod/v1": kubectl.BasicPod{}, - "service/v1": kubectl.ServiceGeneratorV1{}, - "service/v2": kubectl.ServiceGeneratorV2{}, - "horizontalpodautoscaler/v1beta1": kubectl.HorizontalPodAutoscalerV1Beta1{}, - } - clientConfig := optionalClientConfig if optionalClientConfig == nil { clientConfig = DefaultClientConfig(flags) @@ -119,56 +188,62 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { clients := NewClientCache(clientConfig) return &Factory{ - clients: clients, - flags: flags, - generators: generators, + clients: clients, + flags: flags, + cmd: recordCommand(os.Args), Object: func() (meta.RESTMapper, runtime.ObjectTyper) { cfg, err := clientConfig.ClientConfig() CheckErr(err) - cmdApiVersion := cfg.Version + cmdApiVersion := unversioned.GroupVersion{} + if cfg.GroupVersion != nil { + cmdApiVersion = *cfg.GroupVersion + } - return kubectl.OutputVersionMapper{RESTMapper: mapper, OutputVersion: cmdApiVersion}, api.Scheme + return kubectl.OutputVersionMapper{RESTMapper: mapper, OutputVersions: []unversioned.GroupVersion{cmdApiVersion}}, api.Scheme }, Client: func() (*client.Client, error) { - return clients.ClientForVersion("") + return clients.ClientForVersion(nil) }, ClientConfig: func() (*client.Config, error) { - return clients.ClientConfigForVersion("") + return clients.ClientConfigForVersion(nil) }, - RESTClient: func(mapping *meta.RESTMapping) (resource.RESTClient, error) { - group, err := api.RESTMapper.GroupForResource(mapping.Resource) + ClientForMapping: func(mapping *meta.RESTMapping) (resource.RESTClient, error) { + mappingVersion := mapping.GroupVersionKind.GroupVersion() + client, err := clients.ClientForVersion(&mappingVersion) if err != nil { return nil, err } - client, err := clients.ClientForVersion(mapping.APIVersion) - if err != nil { - return nil, err - } - switch group { - case "": + switch mapping.GroupVersionKind.Group { + case api.GroupName: return client.RESTClient, nil - case "extensions": + case extensions.GroupName: return client.ExtensionsClient.RESTClient, nil } return nil, fmt.Errorf("unable to get RESTClient for resource '%s'", mapping.Resource) }, Describer: func(mapping *meta.RESTMapping) (kubectl.Describer, error) { - group, err := api.RESTMapper.GroupForResource(mapping.Resource) + mappingVersion := mapping.GroupVersionKind.GroupVersion() + client, err := clients.ClientForVersion(&mappingVersion) if err != nil { return nil, err } - client, err := clients.ClientForVersion(mapping.APIVersion) - if err != nil { - return nil, err - } - if describer, ok := kubectl.DescriberFor(group, mapping.Kind, client); ok { + if describer, ok := kubectl.DescriberFor(mapping.GroupVersionKind.GroupKind(), client); ok { return describer, nil } - return nil, fmt.Errorf("no description has been implemented for %q", mapping.Kind) + return nil, fmt.Errorf("no description has been implemented for %q", mapping.GroupVersionKind.Kind) }, - Printer: func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, columnLabels []string) (kubectl.ResourcePrinter, error) { - return kubectl.NewHumanReadablePrinter(noHeaders, withNamespace, wide, showAll, columnLabels), nil + Decoder: func(toInternal bool) runtime.Decoder { + if toInternal { + return api.Codecs.UniversalDecoder() + } + return api.Codecs.UniversalDeserializer() + }, + JSONEncoder: func() runtime.Encoder { + return api.Codecs.LegacyCodec(registered.EnabledVersions()...) + }, + Printer: func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, showLabels bool, absoluteTimestamps bool, columnLabels []string) (kubectl.ResourcePrinter, error) { + return kubectl.NewHumanReadablePrinter(noHeaders, withNamespace, wide, showAll, showLabels, absoluteTimestamps, columnLabels), nil }, PodSelectorForObject: func(object runtime.Object) (string, error) { // TODO: replace with a swagger schema based approach (identify pod selector via schema introspection) @@ -185,12 +260,61 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { return "", fmt.Errorf("the service has no pod selector set") } return kubectl.MakeLabels(t.Spec.Selector), nil + case *extensions.Deployment: + selector, err := unversioned.LabelSelectorAsSelector(t.Spec.Selector) + if err != nil { + return "", fmt.Errorf("invalid label selector: %v", err) + } + return selector.String(), nil + case *extensions.ReplicaSet: + selector, err := unversioned.LabelSelectorAsSelector(t.Spec.Selector) + if err != nil { + return "", fmt.Errorf("failed to convert label selector to selector: %v", err) + } + return selector.String(), nil default: - _, kind, err := api.Scheme.ObjectVersionAndKind(object) + gvk, err := api.Scheme.ObjectKind(object) if err != nil { return "", err } - return "", fmt.Errorf("cannot extract pod selector from %s", kind) + return "", fmt.Errorf("cannot extract pod selector from %v", gvk) + } + }, + MapBasedSelectorForObject: func(object runtime.Object) (string, error) { + // TODO: replace with a swagger schema based approach (identify pod selector via schema introspection) + switch t := object.(type) { + case *api.ReplicationController: + return kubectl.MakeLabels(t.Spec.Selector), nil + case *api.Pod: + if len(t.Labels) == 0 { + return "", fmt.Errorf("the pod has no labels and cannot be exposed") + } + return kubectl.MakeLabels(t.Labels), nil + case *api.Service: + if t.Spec.Selector == nil { + return "", fmt.Errorf("the service has no pod selector set") + } + return kubectl.MakeLabels(t.Spec.Selector), nil + case *extensions.Deployment: + // TODO(madhusudancs): Make this smarter by admitting MatchExpressions with Equals + // operator, DoubleEquals operator and In operator with only one element in the set. + if len(t.Spec.Selector.MatchExpressions) > 0 { + return "", fmt.Errorf("couldn't convert expressions - \"%+v\" to map-based selector format") + } + return kubectl.MakeLabels(t.Spec.Selector.MatchLabels), nil + case *extensions.ReplicaSet: + // TODO(madhusudancs): Make this smarter by admitting MatchExpressions with Equals + // operator, DoubleEquals operator and In operator with only one element in the set. + if len(t.Spec.Selector.MatchExpressions) > 0 { + return "", fmt.Errorf("couldn't convert expressions - \"%+v\" to map-based selector format") + } + return kubectl.MakeLabels(t.Spec.Selector.MatchLabels), nil + default: + gvk, err := api.Scheme.ObjectKind(object) + if err != nil { + return "", err + } + return "", fmt.Errorf("cannot extract pod selector from %v", gvk) } }, PortsForObject: func(object runtime.Object) ([]string, error) { @@ -202,34 +326,122 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { return getPorts(t.Spec), nil case *api.Service: return getServicePorts(t.Spec), nil + case *extensions.Deployment: + return getPorts(t.Spec.Template.Spec), nil + case *extensions.ReplicaSet: + return getPorts(t.Spec.Template.Spec), nil default: - _, kind, err := api.Scheme.ObjectVersionAndKind(object) + gvk, err := api.Scheme.ObjectKind(object) if err != nil { return nil, err } - return nil, fmt.Errorf("cannot extract ports from %s", kind) + return nil, fmt.Errorf("cannot extract ports from %v", gvk) } }, LabelsForObject: func(object runtime.Object) (map[string]string, error) { return meta.NewAccessor().Labels(object) }, - Scaler: func(mapping *meta.RESTMapping) (kubectl.Scaler, error) { - client, err := clients.ClientForVersion(mapping.APIVersion) + LogsForObject: func(object, options runtime.Object) (*client.Request, error) { + c, err := clients.ClientForVersion(nil) if err != nil { return nil, err } - return kubectl.ScalerFor(mapping.Kind, client) + + switch t := object.(type) { + case *api.Pod: + opts, ok := options.(*api.PodLogOptions) + if !ok { + return nil, errors.New("provided options object is not a PodLogOptions") + } + return c.Pods(t.Namespace).GetLogs(t.Name, opts), nil + default: + gvk, err := api.Scheme.ObjectKind(object) + if err != nil { + return nil, err + } + return nil, fmt.Errorf("cannot get the logs from %v", gvk) + } + }, + PauseObject: func(object runtime.Object) (bool, error) { + c, err := clients.ClientForVersion(nil) + if err != nil { + return false, err + } + + switch t := object.(type) { + case *extensions.Deployment: + if t.Spec.Paused { + return true, nil + } + t.Spec.Paused = true + _, err := c.Extensions().Deployments(t.Namespace).Update(t) + return false, err + default: + gvk, err := api.Scheme.ObjectKind(object) + if err != nil { + return false, err + } + return false, fmt.Errorf("cannot pause %v", gvk) + } + }, + ResumeObject: func(object runtime.Object) (bool, error) { + c, err := clients.ClientForVersion(nil) + if err != nil { + return false, err + } + + switch t := object.(type) { + case *extensions.Deployment: + if !t.Spec.Paused { + return true, nil + } + t.Spec.Paused = false + _, err := c.Extensions().Deployments(t.Namespace).Update(t) + return false, err + default: + gvk, err := api.Scheme.ObjectKind(object) + if err != nil { + return false, err + } + return false, fmt.Errorf("cannot resume %v", gvk) + } + }, + Scaler: func(mapping *meta.RESTMapping) (kubectl.Scaler, error) { + mappingVersion := mapping.GroupVersionKind.GroupVersion() + client, err := clients.ClientForVersion(&mappingVersion) + if err != nil { + return nil, err + } + return kubectl.ScalerFor(mapping.GroupVersionKind.GroupKind(), client) }, Reaper: func(mapping *meta.RESTMapping) (kubectl.Reaper, error) { - client, err := clients.ClientForVersion(mapping.APIVersion) + mappingVersion := mapping.GroupVersionKind.GroupVersion() + client, err := clients.ClientForVersion(&mappingVersion) if err != nil { return nil, err } - return kubectl.ReaperFor(mapping.Kind, client) + return kubectl.ReaperFor(mapping.GroupVersionKind.GroupKind(), client) + }, + HistoryViewer: func(mapping *meta.RESTMapping) (kubectl.HistoryViewer, error) { + mappingVersion := mapping.GroupVersionKind.GroupVersion() + client, err := clients.ClientForVersion(&mappingVersion) + clientset := clientset.FromUnversionedClient(client) + if err != nil { + return nil, err + } + return kubectl.HistoryViewerFor(mapping.GroupVersionKind.GroupKind(), clientset) + }, + Rollbacker: func(mapping *meta.RESTMapping) (kubectl.Rollbacker, error) { + mappingVersion := mapping.GroupVersionKind.GroupVersion() + client, err := clients.ClientForVersion(&mappingVersion) + if err != nil { + return nil, err + } + return kubectl.RollbackerFor(mapping.GroupVersionKind.GroupKind(), client) }, Validator: func(validate bool, cacheDir string) (validation.Schema, error) { if validate { - client, err := clients.ClientForVersion("") + client, err := clients.ClientForVersion(nil) if err != nil { return nil, err } @@ -249,28 +461,103 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { } return validation.NullSchema{}, nil }, + SwaggerSchema: func(gvk unversioned.GroupVersionKind) (*swagger.ApiDeclaration, error) { + version := gvk.GroupVersion() + client, err := clients.ClientForVersion(&version) + if err != nil { + return nil, err + } + return client.Discovery().SwaggerSchema(version) + }, DefaultNamespace: func() (string, bool, error) { return clientConfig.Namespace() }, - Generator: func(name string) (kubectl.Generator, bool) { - generator, ok := generators[name] - return generator, ok + Generators: func(cmdName string) map[string]kubectl.Generator { + return DefaultGenerators(cmdName) }, - CanBeExposed: func(kind string) error { - if kind != "ReplicationController" && kind != "Service" && kind != "Pod" { - return fmt.Errorf("invalid resource provided: %v, only a replication controller, service or pod is accepted", kind) + CanBeExposed: func(kind unversioned.GroupKind) error { + switch kind { + case api.Kind("ReplicationController"), api.Kind("Service"), api.Kind("Pod"), extensions.Kind("Deployment"), extensions.Kind("ReplicaSet"): + // nothing to do here + default: + return fmt.Errorf("cannot expose a %s", kind) } return nil }, - CanBeAutoscaled: func(kind string) error { // TODO: support autoscale for deployments - if kind != "ReplicationController" { - return fmt.Errorf("invalid resource provided: %v, only a replication controller is accepted", kind) + CanBeAutoscaled: func(kind unversioned.GroupKind) error { + switch kind { + case api.Kind("ReplicationController"), extensions.Kind("Deployment"): + // nothing to do here + default: + return fmt.Errorf("cannot autoscale a %v", kind) } return nil }, + AttachablePodForObject: func(object runtime.Object) (*api.Pod, error) { + client, err := clients.ClientForVersion(nil) + if err != nil { + return nil, err + } + switch t := object.(type) { + case *api.ReplicationController: + selector := labels.SelectorFromSet(t.Spec.Selector) + return GetFirstPod(client, t.Namespace, selector) + case *extensions.Deployment: + selector, err := unversioned.LabelSelectorAsSelector(t.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + return GetFirstPod(client, t.Namespace, selector) + case *extensions.Job: + selector, err := unversioned.LabelSelectorAsSelector(t.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + return GetFirstPod(client, t.Namespace, selector) + case *api.Pod: + return t, nil + default: + gvk, err := api.Scheme.ObjectKind(object) + if err != nil { + return nil, err + } + return nil, fmt.Errorf("cannot attach to %v: not implemented", gvk) + } + }, + EditorEnvs: func() []string { + return []string{"KUBE_EDITOR", "EDITOR"} + }, } } +// GetFirstPod returns the first pod of an object from its namespace and selector +func GetFirstPod(client *client.Client, namespace string, selector labels.Selector) (*api.Pod, error) { + var pods *api.PodList + for pods == nil || len(pods.Items) == 0 { + var err error + options := api.ListOptions{LabelSelector: selector} + if pods, err = client.Pods(namespace).List(options); err != nil { + return nil, err + } + if len(pods.Items) == 0 { + time.Sleep(2 * time.Second) + } + } + pod := &pods.Items[0] + return pod, nil +} + +func recordCommand(args []string) string { + if len(args) > 0 { + args[0] = "kubectl" + } + return strings.Join(args, " ") +} + +func (f *Factory) Command() string { + return f.cmd +} + // BindFlags adds any flags that are common to all kubectl sub commands. func (f *Factory) BindFlags(flags *pflag.FlagSet) { // any flags defined by external projects (not part of pflags) @@ -406,25 +693,20 @@ func getSchemaAndValidate(c schemaClient, data []byte, prefix, groupVersion, cac } func (c *clientSwaggerSchema) ValidateBytes(data []byte) error { - version, kind, err := runtime.UnstructuredJSONScheme.DataVersionAndKind(data) + gvk, err := json.DefaultMetaFactory.Interpret(data) if err != nil { return err } - if ok := registered.IsRegisteredAPIVersion(version); !ok { - return fmt.Errorf("API version %q isn't supported, only supports API versions %q", version, registered.RegisteredVersions) + if ok := registered.IsEnabledVersion(gvk.GroupVersion()); !ok { + return fmt.Errorf("API version %q isn't supported, only supports API versions %q", gvk.GroupVersion().String(), registered.EnabledVersions()) } - resource, _ := meta.KindToResource(kind, false) - group, err := c.mapper.GroupForResource(resource) - if err != nil { - return fmt.Errorf("could not find api group for %s: %v", kind, err) - } - if group == "extensions" { + if gvk.Group == extensions.GroupName { if c.c.ExtensionsClient == nil { return errors.New("unable to validate: no experimental client") } - return getSchemaAndValidate(c.c.ExtensionsClient.RESTClient, data, "apis/", version, c.cacheDir) + return getSchemaAndValidate(c.c.ExtensionsClient.RESTClient, data, "apis/", gvk.GroupVersion().String(), c.cacheDir) } - return getSchemaAndValidate(c.c.RESTClient, data, "api", version, c.cacheDir) + return getSchemaAndValidate(c.c.RESTClient, data, "api", gvk.GroupVersion().String(), c.cacheDir) } // DefaultClientConfig creates a clientcmd.ClientConfig with the following hierarchy: @@ -484,12 +766,12 @@ func DefaultClientConfig(flags *pflag.FlagSet) clientcmd.ClientConfig { // PrintObject prints an api object given command line flags to modify the output format func (f *Factory) PrintObject(cmd *cobra.Command, obj runtime.Object, out io.Writer) error { mapper, _ := f.Object() - _, kind, err := api.Scheme.ObjectVersionAndKind(obj) + gvk, err := api.Scheme.ObjectKind(obj) if err != nil { return err } - mapping, err := mapper.RESTMapping(kind) + mapping, err := mapper.RESTMapping(gvk.GroupKind()) if err != nil { return err } @@ -513,42 +795,39 @@ func (f *Factory) PrinterForMapping(cmd *cobra.Command, mapping *meta.RESTMappin if err != nil { return nil, err } - defaultVersion := clientConfig.Version - version := OutputVersion(cmd, defaultVersion) - if len(version) == 0 { - version = mapping.APIVersion + version, err := OutputVersion(cmd, clientConfig.GroupVersion) + if err != nil { + return nil, err } - if len(version) == 0 { + if version.IsEmpty() { + version = mapping.GroupVersionKind.GroupVersion() + } + if version.IsEmpty() { return nil, fmt.Errorf("you must specify an output-version when using this output format") } - printer = kubectl.NewVersionedPrinter(printer, mapping.ObjectConvertor, version, mapping.APIVersion) + + printer = kubectl.NewVersionedPrinter(printer, mapping.ObjectConvertor, version, mapping.GroupVersionKind.GroupVersion()) + } else { // Some callers do not have "label-columns" so we can't use the GetFlagStringSlice() helper columnLabel, err := cmd.Flags().GetStringSlice("label-columns") if err != nil { columnLabel = []string{} } - printer, err = f.Printer(mapping, GetFlagBool(cmd, "no-headers"), withNamespace, GetWideFlag(cmd), GetFlagBool(cmd, "show-all"), columnLabel) + printer, err = f.Printer(mapping, GetFlagBool(cmd, "no-headers"), withNamespace, GetWideFlag(cmd), GetFlagBool(cmd, "show-all"), GetFlagBool(cmd, "show-labels"), isWatch(cmd), columnLabel) if err != nil { return nil, err } printer = maybeWrapSortingPrinter(cmd, printer) } + return printer, nil } -// ClientMapperForCommand returns a ClientMapper for the factory. -func (f *Factory) ClientMapperForCommand() resource.ClientMapper { - return resource.ClientMapperFunc(func(mapping *meta.RESTMapping) (resource.RESTClient, error) { - return f.RESTClient(mapping) - }) -} +// One stop shopping for a Builder +func (f *Factory) NewBuilder() *resource.Builder { + mapper, typer := f.Object() -// NilClientMapperForCommand returns a ClientMapper which always returns nil. -// When command is running locally and client isn't needed, this mapper can be parsed to NewBuilder. -func (f *Factory) NilClientMapperForCommand() resource.ClientMapper { - return resource.ClientMapperFunc(func(mapping *meta.RESTMapping) (resource.RESTClient, error) { - return nil, nil - }) + return resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)) } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/factory_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/factory_test.go index 41af6303e..be9484fae 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/factory_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/factory_test.go @@ -170,15 +170,15 @@ func TestLabelsForObject(t *testing.T) { func TestCanBeExposed(t *testing.T) { factory := NewFactory(nil) tests := []struct { - kind string + kind unversioned.GroupKind expectErr bool }{ { - kind: "ReplicationController", + kind: api.Kind("ReplicationController"), expectErr: false, }, { - kind: "Node", + kind: api.Kind("Node"), expectErr: true, }, } @@ -207,7 +207,7 @@ func TestFlagUnderscoreRenaming(t *testing.T) { } func loadSchemaForTest() (validation.Schema, error) { - pathToSwaggerSpec := "../../../../api/swagger-spec/" + testapi.Default.Version() + ".json" + pathToSwaggerSpec := "../../../../api/swagger-spec/" + testapi.Default.GroupVersion().Version + ".json" data, err := ioutil.ReadFile(pathToSwaggerSpec) if err != nil { return nil, err @@ -230,7 +230,7 @@ func TestValidateCachesSchema(t *testing.T) { c := &fake.RESTClient{ Codec: testapi.Default.Codec(), - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case strings.HasPrefix(p, "/swaggerapi") && m == "GET": requests[p] = requests[p] + 1 @@ -245,7 +245,7 @@ func TestValidateCachesSchema(t *testing.T) { os.RemoveAll(dir) obj := &api.Pod{} - data, err := testapi.Default.Codec().Encode(obj) + data, err := runtime.Encode(testapi.Default.Codec(), obj) if err != nil { t.Errorf("unexpected error: %v", err) t.FailNow() diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go index 9e3283fa4..6b2ef69dc 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go @@ -28,22 +28,27 @@ import ( "strings" "time" - "github.com/evanphx/json-patch" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" - "k8s.io/kubernetes/pkg/api/latest" + "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/unversioned" - client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" "k8s.io/kubernetes/pkg/kubectl" "k8s.io/kubernetes/pkg/kubectl/resource" "k8s.io/kubernetes/pkg/runtime" utilerrors "k8s.io/kubernetes/pkg/util/errors" + "k8s.io/kubernetes/pkg/util/strategicpatch" + "github.com/evanphx/json-patch" "github.com/golang/glog" "github.com/spf13/cobra" "github.com/spf13/pflag" ) +const ( + ApplyAnnotationsFlag = "save-config" +) + type debugError interface { DebugError() (msg string, args []interface{}) } @@ -53,7 +58,7 @@ type debugError interface { // souce is the filename or URL to the template file(*.json or *.yaml), or stdin to use to handle the resource. func AddSourceToErr(verb string, source string, err error) error { if source != "" { - if statusError, ok := err.(*errors.StatusError); ok { + if statusError, ok := err.(errors.APIStatus); ok { status := statusError.Status() status.Message = fmt.Sprintf("error when %s %q: %v", verb, source, status.Message) return &errors.StatusError{ErrStatus: status} @@ -72,6 +77,12 @@ func BehaviorOnFatal(f func(string)) { fatalErrHandler = f } +// DefaultBehaviorOnFatal allows you to undo any previous override. Useful in +// tests. +func DefaultBehaviorOnFatal() { + fatalErrHandler = fatal +} + // fatal prints the message and then exits. If V(2) or greater, glog.Fatal // is invoked for extended information. func fatal(msg string) { @@ -108,6 +119,22 @@ func checkErr(err error, handleErr func(string)) { handleErr(MultilineError(prefix, errs)) } + if meta.IsNoResourceMatchError(err) { + noMatch := err.(*meta.NoResourceMatchError) + + switch { + case len(noMatch.PartialResource.Group) > 0 && len(noMatch.PartialResource.Version) > 0: + handleErr(fmt.Sprintf("the server doesn't have a resource type %q in group %q and version %q", noMatch.PartialResource.Resource, noMatch.PartialResource.Group, noMatch.PartialResource.Version)) + case len(noMatch.PartialResource.Group) > 0: + handleErr(fmt.Sprintf("the server doesn't have a resource type %q in group %q", noMatch.PartialResource.Resource, noMatch.PartialResource.Group)) + case len(noMatch.PartialResource.Version) > 0: + handleErr(fmt.Sprintf("the server doesn't have a resource type %q in version %q", noMatch.PartialResource.Resource, noMatch.PartialResource.Version)) + default: + handleErr(fmt.Sprintf("the server doesn't have a resource type %q", noMatch.PartialResource.Resource)) + } + return + } + // handle multiline errors if clientcmd.IsConfigurationInvalid(err) { handleErr(MultilineError("Error in configuration: ", err)) @@ -118,7 +145,10 @@ func checkErr(err error, handleErr func(string)) { msg, ok := StandardErrorMessage(err) if !ok { - msg = fmt.Sprintf("error: %s", err.Error()) + msg = err.Error() + if !strings.HasPrefix(msg, "error: ") { + msg = fmt.Sprintf("error: %s", msg) + } } handleErr(msg) } @@ -141,7 +171,7 @@ func StandardErrorMessage(err error) (string, bool) { if debugErr, ok := err.(debugError); ok { glog.V(4).Infof(debugErr.DebugError()) } - _, isStatus := err.(client.APIStatus) + _, isStatus := err.(errors.APIStatus) switch { case isStatus: return fmt.Sprintf("Error from server: %s", err.Error()), true @@ -207,7 +237,20 @@ func messageForError(err error) string { func UsageError(cmd *cobra.Command, format string, args ...interface{}) error { msg := fmt.Sprintf(format, args...) - return fmt.Errorf("%s\nsee '%s -h' for help.", msg, cmd.CommandPath()) + return fmt.Errorf("%s\nSee '%s -h' for help and examples.", msg, cmd.CommandPath()) +} + +// Whether this cmd need watching objects. +func isWatch(cmd *cobra.Command) bool { + if w, err := cmd.Flags().GetBool("watch"); w && err == nil { + return true + } + + if wo, err := cmd.Flags().GetBool("watch-only"); wo && err == nil { + return true + } + + return false } func getFlag(cmd *cobra.Command, flag string) *pflag.Flag { @@ -283,6 +326,17 @@ func AddValidateFlags(cmd *cobra.Command) { cmd.Flags().String("schema-cache-dir", fmt.Sprintf("~/%s/%s", clientcmd.RecommendedHomeDir, clientcmd.RecommendedSchemaName), fmt.Sprintf("If non-empty, load/store cached API schemas in this directory, default is '$HOME/%s/%s'", clientcmd.RecommendedHomeDir, clientcmd.RecommendedSchemaName)) } +func AddApplyAnnotationFlags(cmd *cobra.Command) { + cmd.Flags().Bool(ApplyAnnotationsFlag, false, "If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future.") +} + +// AddGeneratorFlags adds flags common to resource generation commands +// TODO: need to take a pass at other generator commands to use this set of flags +func AddGeneratorFlags(cmd *cobra.Command, defaultGenerator string) { + cmd.Flags().String("generator", defaultGenerator, "The name of the API generator to use.") + cmd.Flags().Bool("dry-run", false, "If true, only print the object that would be sent, without sending it.") +} + func ReadConfigDataFromReader(reader io.Reader, source string) ([]byte, error) { data, err := ioutil.ReadAll(reader) if err != nil { @@ -335,33 +389,11 @@ func ReadConfigDataFromLocation(location string) ([]byte, error) { } } -func Merge(dst runtime.Object, fragment, kind string) (runtime.Object, error) { - // Ok, this is a little hairy, we'd rather not force the user to specify a kind for their JSON - // So we pull it into a map, add the Kind field, and then reserialize. - // We also pull the apiVersion for proper parsing - var intermediate interface{} - if err := json.Unmarshal([]byte(fragment), &intermediate); err != nil { - return nil, err - } - dataMap, ok := intermediate.(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("Expected a map, found something else: %s", fragment) - } - version, found := dataMap["apiVersion"] - if !found { - return nil, fmt.Errorf("Inline JSON requires an apiVersion field") - } - versionString, ok := version.(string) - if !ok { - return nil, fmt.Errorf("apiVersion must be a string") - } - i, err := latest.GroupOrDie("").InterfacesFor(versionString) - if err != nil { - return nil, err - } - +// Merge requires JSON serialization +// TODO: merge assumes JSON serialization, and does not properly abstract API retrieval +func Merge(codec runtime.Codec, dst runtime.Object, fragment, kind string) (runtime.Object, error) { // encode dst into versioned json and apply fragment directly too it - target, err := i.Codec.Encode(dst) + target, err := runtime.Encode(codec, dst) if err != nil { return nil, err } @@ -369,7 +401,7 @@ func Merge(dst runtime.Object, fragment, kind string) (runtime.Object, error) { if err != nil { return nil, err } - out, err := i.Codec.Decode(patched) + out, err := runtime.Decode(codec, patched) if err != nil { return nil, err } @@ -402,7 +434,7 @@ func DumpReaderToFile(reader io.Reader, filename string) error { } // UpdateObject updates resource object with updateFn -func UpdateObject(info *resource.Info, updateFn func(runtime.Object) error) (runtime.Object, error) { +func UpdateObject(info *resource.Info, codec runtime.Codec, updateFn func(runtime.Object) error) (runtime.Object, error) { helper := resource.NewHelper(info.Client, info.Mapping) if err := updateFn(info.Object); err != nil { @@ -410,18 +442,66 @@ func UpdateObject(info *resource.Info, updateFn func(runtime.Object) error) (run } // Update the annotation used by kubectl apply - if err := kubectl.UpdateApplyAnnotation(info); err != nil { + if err := kubectl.UpdateApplyAnnotation(info, codec); err != nil { return nil, err } - data, err := helper.Codec.Encode(info.Object) - if err != nil { - return nil, err - } - - if _, err := helper.Replace(info.Namespace, info.Name, true, data); err != nil { + if _, err := helper.Replace(info.Namespace, info.Name, true, info.Object); err != nil { return nil, err } return info.Object, nil } + +// AddCmdRecordFlag adds --record flag to command +func AddRecordFlag(cmd *cobra.Command) { + cmd.Flags().Bool("record", false, "Record current kubectl command in the resource annotation.") +} + +func GetRecordFlag(cmd *cobra.Command) bool { + return GetFlagBool(cmd, "record") +} + +// RecordChangeCause annotate change-cause to input runtime object. +func RecordChangeCause(obj runtime.Object, changeCause string) error { + meta, err := api.ObjectMetaFor(obj) + if err != nil { + return err + } + if meta.Annotations == nil { + meta.Annotations = make(map[string]string) + } + meta.Annotations[kubectl.ChangeCauseAnnotation] = changeCause + return nil +} + +// ChangeResourcePatch creates a strategic merge patch between the origin input resource info +// and the annotated with change-cause input resource info. +func ChangeResourcePatch(info *resource.Info, changeCause string) ([]byte, error) { + oldData, err := json.Marshal(info.Object) + if err != nil { + return nil, err + } + if err := RecordChangeCause(info.Object, changeCause); err != nil { + return nil, err + } + newData, err := json.Marshal(info.Object) + if err != nil { + return nil, err + } + return strategicpatch.CreateTwoWayMergePatch(oldData, newData, info.Object) +} + +// containsChangeCause checks if input resource info contains change-cause annotation. +func ContainsChangeCause(info *resource.Info) bool { + annotations, err := info.Mapping.MetadataAccessor.Annotations(info.Object) + if err != nil { + return false + } + return len(annotations[kubectl.ChangeCauseAnnotation]) > 0 +} + +// ShouldRecord checks if we should record current change cause +func ShouldRecord(cmd *cobra.Command, info *resource.Info) bool { + return GetRecordFlag(cmd) || ContainsChangeCause(info) +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers_test.go index a0e7d6299..10422e676 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers_test.go @@ -28,10 +28,12 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" + "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/testapi" apitesting "k8s.io/kubernetes/pkg/api/testing" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/validation/field" ) func TestMerge(t *testing.T) { @@ -50,7 +52,7 @@ func TestMerge(t *testing.T) { Name: "foo", }, }, - fragment: fmt.Sprintf(`{ "apiVersion": "%s" }`, testapi.Default.Version()), + fragment: fmt.Sprintf(`{ "apiVersion": "%s" }`, testapi.Default.GroupVersion().String()), expected: &api.Pod{ ObjectMeta: api.ObjectMeta{ Name: "foo", @@ -79,7 +81,7 @@ func TestMerge(t *testing.T) { }, }, }, - fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "containers": [ { "name": "c1", "image": "green-image" } ] } }`, testapi.Default.Version()), + fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "containers": [ { "name": "c1", "image": "green-image" } ] } }`, testapi.Default.GroupVersion().String()), expected: &api.Pod{ ObjectMeta: api.ObjectMeta{ Name: "foo", @@ -105,7 +107,7 @@ func TestMerge(t *testing.T) { Name: "foo", }, }, - fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "volumes": [ {"name": "v1"}, {"name": "v2"} ] } }`, testapi.Default.Version()), + fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "volumes": [ {"name": "v1"}, {"name": "v2"} ] } }`, testapi.Default.GroupVersion().String()), expected: &api.Pod{ ObjectMeta: api.ObjectMeta{ Name: "foo", @@ -146,7 +148,7 @@ func TestMerge(t *testing.T) { obj: &api.Service{ Spec: api.ServiceSpec{}, }, - fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "ports": [ { "port": 0 } ] } }`, testapi.Default.Version()), + fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "ports": [ { "port": 0 } ] } }`, testapi.Default.GroupVersion().String()), expected: &api.Service{ Spec: api.ServiceSpec{ SessionAffinity: "None", @@ -169,7 +171,7 @@ func TestMerge(t *testing.T) { }, }, }, - fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "selector": { "version": "v2" } } }`, testapi.Default.Version()), + fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "selector": { "version": "v2" } } }`, testapi.Default.GroupVersion().String()), expected: &api.Service{ Spec: api.ServiceSpec{ SessionAffinity: "None", @@ -183,7 +185,7 @@ func TestMerge(t *testing.T) { } for i, test := range tests { - out, err := Merge(test.obj, test.fragment, test.kind) + out, err := Merge(testapi.Default.Codec(), test.obj, test.fragment, test.kind) if !test.expectErr { if err != nil { t.Errorf("testcase[%d], unexpected error: %v", i, err) @@ -212,6 +214,7 @@ func (f *fileHandler) ServeHTTP(res http.ResponseWriter, req *http.Request) { func TestReadConfigData(t *testing.T) { httpData := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} + // TODO: Close() this server when fix #19254 server := httptest.NewServer(&fileHandler{data: httpData}) fileData := []byte{11, 12, 13, 14, 15, 16, 17, 18, 19} @@ -274,15 +277,15 @@ func TestCheckInvalidErr(t *testing.T) { expected string }{ { - errors.NewInvalid("Invalid1", "invalidation", fielderrors.ValidationErrorList{fielderrors.NewFieldInvalid("Cause", "single", "details")}), - `Error from server: Invalid1 "invalidation" is invalid: Cause: invalid value 'single', Details: details`, + errors.NewInvalid(api.Kind("Invalid1"), "invalidation", field.ErrorList{field.Invalid(field.NewPath("field"), "single", "details")}), + `Error from server: Invalid1 "invalidation" is invalid: field: Invalid value: "single": details`, }, { - errors.NewInvalid("Invalid2", "invalidation", fielderrors.ValidationErrorList{fielderrors.NewFieldInvalid("Cause", "multi1", "details"), fielderrors.NewFieldInvalid("Cause", "multi2", "details")}), - `Error from server: Invalid2 "invalidation" is invalid: [Cause: invalid value 'multi1', Details: details, Cause: invalid value 'multi2', Details: details]`, + errors.NewInvalid(api.Kind("Invalid2"), "invalidation", field.ErrorList{field.Invalid(field.NewPath("field1"), "multi1", "details"), field.Invalid(field.NewPath("field2"), "multi2", "details")}), + `Error from server: Invalid2 "invalidation" is invalid: [field1: Invalid value: "multi1": details, field2: Invalid value: "multi2": details]`, }, { - errors.NewInvalid("Invalid3", "invalidation", fielderrors.ValidationErrorList{}), + errors.NewInvalid(api.Kind("Invalid3"), "invalidation", field.ErrorList{}), `Error from server: Invalid3 "invalidation" is invalid: `, }, } @@ -301,6 +304,43 @@ func TestCheckInvalidErr(t *testing.T) { } } +func TestCheckNoResourceMatchError(t *testing.T) { + tests := []struct { + err error + expected string + }{ + { + &meta.NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Resource: "foo"}}, + `the server doesn't have a resource type "foo"`, + }, + { + &meta.NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Version: "theversion", Resource: "foo"}}, + `the server doesn't have a resource type "foo" in version "theversion"`, + }, + { + &meta.NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Group: "thegroup", Version: "theversion", Resource: "foo"}}, + `the server doesn't have a resource type "foo" in group "thegroup" and version "theversion"`, + }, + { + &meta.NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Group: "thegroup", Resource: "foo"}}, + `the server doesn't have a resource type "foo" in group "thegroup"`, + }, + } + + var errReturned string + errHandle := func(err string) { + errReturned = err + } + + for _, test := range tests { + checkErr(test.err, errHandle) + + if errReturned != test.expected { + t.Fatalf("Got: %s, expected: %s", errReturned, test.expected) + } + } +} + func TestDumpReaderToFile(t *testing.T) { testString := "TEST STRING" tempFile, err := ioutil.TempFile("", "hlpers_test_dump_") diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/printing.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/printing.go index 3a4803d9c..40d7c07fa 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/printing.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/printing.go @@ -22,6 +22,7 @@ import ( "strings" "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/kubectl" "github.com/spf13/cobra" @@ -32,6 +33,7 @@ func AddPrinterFlags(cmd *cobra.Command) { cmd.Flags().StringP("output", "o", "", "Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].") cmd.Flags().String("output-version", "", "Output the formatted object with the given version (default api-version).") cmd.Flags().Bool("no-headers", false, "When using the default output, don't print headers.") + cmd.Flags().Bool("show-labels", false, "When printing, show all labels as the last column (default hide labels column)") // template shorthand -t is deprecated to support -t for --tty // TODO: remove template flag shorthand -t cmd.Flags().StringP("template", "t", "", "Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].") @@ -75,12 +77,18 @@ func ValidateOutputArgs(cmd *cobra.Command) error { } // OutputVersion returns the preferred output version for generic content (JSON, YAML, or templates) -func OutputVersion(cmd *cobra.Command, defaultVersion string) string { - outputVersion := GetFlagString(cmd, "output-version") - if len(outputVersion) == 0 { - outputVersion = defaultVersion +// defaultVersion is never mutated. Nil simply allows clean passing in common usage from client.Config +func OutputVersion(cmd *cobra.Command, defaultVersion *unversioned.GroupVersion) (unversioned.GroupVersion, error) { + outputVersionString := GetFlagString(cmd, "output-version") + if len(outputVersionString) == 0 { + if defaultVersion == nil { + return unversioned.GroupVersion{}, nil + } + + return *defaultVersion, nil } - return outputVersion + + return unversioned.ParseGroupVersion(outputVersionString) } // PrinterForCommand returns the default printer for this command. @@ -95,7 +103,9 @@ func PrinterForCommand(cmd *cobra.Command) (kubectl.ResourcePrinter, bool, error outputFormat = "template" } - templateFormat := []string{"go-template=", "go-template-file=", "jsonpath=", "jsonpath-file="} + templateFormat := []string{ + "go-template=", "go-template-file=", "jsonpath=", "jsonpath-file=", "custom-columns=", "custom-columns-file=", + } for _, format := range templateFormat { if strings.HasPrefix(outputFormat, format) { templateFile = outputFormat[len(format):] diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/custom_column_printer.go b/vendor/k8s.io/kubernetes/pkg/kubectl/custom_column_printer.go index c73feba8f..fb29a0a7e 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/custom_column_printer.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/custom_column_printer.go @@ -26,7 +26,7 @@ import ( "strings" "text/tabwriter" - "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util/jsonpath" ) @@ -73,7 +73,7 @@ func massageJSONPath(pathExpression string) (string, error) { // // NAME API_VERSION // foo bar -func NewCustomColumnsPrinterFromSpec(spec string) (*CustomColumnsPrinter, error) { +func NewCustomColumnsPrinterFromSpec(spec string, decoder runtime.Decoder) (*CustomColumnsPrinter, error) { if len(spec) == 0 { return nil, fmt.Errorf("custom-columns format specified but no custom columns given") } @@ -90,7 +90,7 @@ func NewCustomColumnsPrinterFromSpec(spec string) (*CustomColumnsPrinter, error) } columns[ix] = Column{Header: colSpec[0], FieldSpec: spec} } - return &CustomColumnsPrinter{Columns: columns}, nil + return &CustomColumnsPrinter{Columns: columns, Decoder: decoder}, nil } func splitOnWhitespace(line string) []string { @@ -108,7 +108,7 @@ func splitOnWhitespace(line string) []string { // For example the template below: // NAME API_VERSION // {metadata.name} {apiVersion} -func NewCustomColumnsPrinterFromTemplate(templateReader io.Reader) (*CustomColumnsPrinter, error) { +func NewCustomColumnsPrinterFromTemplate(templateReader io.Reader, decoder runtime.Decoder) (*CustomColumnsPrinter, error) { scanner := bufio.NewScanner(templateReader) if !scanner.Scan() { return nil, fmt.Errorf("invalid template, missing header line. Expected format is one line of space separated headers, one line of space separated column specs.") @@ -135,7 +135,7 @@ func NewCustomColumnsPrinterFromTemplate(templateReader io.Reader) (*CustomColum FieldSpec: spec, } } - return &CustomColumnsPrinter{Columns: columns}, nil + return &CustomColumnsPrinter{Columns: columns, Decoder: decoder}, nil } // Column represents a user specified column @@ -151,6 +151,7 @@ type Column struct { // of data from templates specified in the `Columns` array type CustomColumnsPrinter struct { Columns []Column + Decoder runtime.Decoder } func (s *CustomColumnsPrinter) PrintObj(obj runtime.Object, out io.Writer) error { @@ -168,8 +169,8 @@ func (s *CustomColumnsPrinter) PrintObj(obj runtime.Object, out io.Writer) error } } - if runtime.IsListType(obj) { - objs, err := runtime.ExtractList(obj) + if meta.IsListType(obj) { + objs, err := meta.ExtractList(obj) if err != nil { return err } @@ -190,9 +191,11 @@ func (s *CustomColumnsPrinter) printOneObject(obj runtime.Object, parsers []*jso columns := make([]string, len(parsers)) switch u := obj.(type) { case *runtime.Unknown: - var err error - if obj, err = api.Codec.Decode(u.RawJSON); err != nil { - return err + if len(u.RawJSON) > 0 { + var err error + if obj, err = runtime.Decode(s.Decoder, u.RawJSON); err != nil { + return fmt.Errorf("can't decode object for printing: %v (%s)", err, u.RawJSON) + } } } for ix := range parsers { diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/custom_column_printer_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/custom_column_printer_test.go index 41897f4b2..531881a73 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/custom_column_printer_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/custom_column_printer_test.go @@ -21,6 +21,7 @@ import ( "reflect" "testing" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/runtime" @@ -103,7 +104,7 @@ func TestNewColumnPrinterFromSpec(t *testing.T) { }, } for _, test := range tests { - printer, err := NewCustomColumnsPrinterFromSpec(test.spec) + printer, err := NewCustomColumnsPrinterFromSpec(test.spec, api.Codecs.UniversalDecoder()) if test.expectErr { if err == nil { t.Errorf("[%s] unexpected non-error", test.name) @@ -186,7 +187,7 @@ func TestNewColumnPrinterFromTemplate(t *testing.T) { } for _, test := range tests { reader := bytes.NewBufferString(test.spec) - printer, err := NewCustomColumnsPrinterFromTemplate(reader) + printer, err := NewCustomColumnsPrinterFromTemplate(reader, api.Codecs.UniversalDecoder()) if test.expectErr { if err == nil { t.Errorf("[%s] unexpected non-error", test.name) @@ -262,6 +263,7 @@ foo baz for _, test := range tests { printer := &CustomColumnsPrinter{ Columns: test.columns, + Decoder: api.Codecs.UniversalDecoder(), } buffer := &bytes.Buffer{} if err := printer.PrintObj(test.obj, buffer); err != nil { diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/describe.go b/vendor/k8s.io/kubernetes/pkg/kubectl/describe.go index 3f13ec4f9..72a60e72e 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/describe.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/describe.go @@ -18,6 +18,7 @@ package kubectl import ( "bytes" + "encoding/json" "fmt" "io" "reflect" @@ -27,8 +28,11 @@ import ( "github.com/golang/glog" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/resource" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" + clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/fieldpath" "k8s.io/kubernetes/pkg/fields" @@ -36,6 +40,7 @@ import ( "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/types" deploymentutil "k8s.io/kubernetes/pkg/util/deployment" + "k8s.io/kubernetes/pkg/util/intstr" "k8s.io/kubernetes/pkg/util/sets" ) @@ -66,30 +71,31 @@ func (e ErrNoDescriber) Error() string { return fmt.Sprintf("no describer has been defined for %v", e.Types) } -func describerMap(c *client.Client) map[string]Describer { - m := map[string]Describer{ - "Pod": &PodDescriber{c}, - "ReplicationController": &ReplicationControllerDescriber{c}, - "Secret": &SecretDescriber{c}, - "Service": &ServiceDescriber{c}, - "ServiceAccount": &ServiceAccountDescriber{c}, - "Node": &NodeDescriber{c}, - "LimitRange": &LimitRangeDescriber{c}, - "ResourceQuota": &ResourceQuotaDescriber{c}, - "PersistentVolume": &PersistentVolumeDescriber{c}, - "PersistentVolumeClaim": &PersistentVolumeClaimDescriber{c}, - "Namespace": &NamespaceDescriber{c}, - } - return m -} +func describerMap(c *client.Client) map[unversioned.GroupKind]Describer { + m := map[unversioned.GroupKind]Describer{ + api.Kind("Pod"): &PodDescriber{c}, + api.Kind("ReplicationController"): &ReplicationControllerDescriber{c}, + api.Kind("Secret"): &SecretDescriber{c}, + api.Kind("Service"): &ServiceDescriber{c}, + api.Kind("ServiceAccount"): &ServiceAccountDescriber{c}, + api.Kind("Node"): &NodeDescriber{c}, + api.Kind("LimitRange"): &LimitRangeDescriber{c}, + api.Kind("ResourceQuota"): &ResourceQuotaDescriber{c}, + api.Kind("PersistentVolume"): &PersistentVolumeDescriber{c}, + api.Kind("PersistentVolumeClaim"): &PersistentVolumeClaimDescriber{c}, + api.Kind("Namespace"): &NamespaceDescriber{c}, + api.Kind("Endpoints"): &EndpointsDescriber{c}, + api.Kind("ConfigMap"): &ConfigMapDescriber{c}, -func expDescriberMap(c *client.Client) map[string]Describer { - return map[string]Describer{ - "HorizontalPodAutoscaler": &HorizontalPodAutoscalerDescriber{c}, - "DaemonSet": &DaemonSetDescriber{c}, - "Job": &JobDescriber{c}, - "Deployment": &DeploymentDescriber{c}, + extensions.Kind("ReplicaSet"): &ReplicaSetDescriber{c}, + extensions.Kind("HorizontalPodAutoscaler"): &HorizontalPodAutoscalerDescriber{c}, + extensions.Kind("DaemonSet"): &DaemonSetDescriber{c}, + extensions.Kind("Deployment"): &DeploymentDescriber{clientset.FromUnversionedClient(c)}, + extensions.Kind("Job"): &JobDescriber{c}, + extensions.Kind("Ingress"): &IngressDescriber{c}, } + + return m } // List of all resource types we can describe @@ -97,7 +103,7 @@ func DescribableResources() []string { keys := make([]string, 0) for k := range describerMap(nil) { - resource := strings.ToLower(k) + resource := strings.ToLower(k.Kind) keys = append(keys, resource) } return keys @@ -105,17 +111,8 @@ func DescribableResources() []string { // Describer returns the default describe functions for each of the standard // Kubernetes types. -func DescriberFor(group string, kind string, c *client.Client) (Describer, bool) { - var f Describer - var ok bool - - switch group { - case "": - f, ok = describerMap(c)[kind] - case "extensions": - f, ok = expDescriberMap(c)[kind] - } - +func DescriberFor(kind unversioned.GroupKind, c *client.Client) (Describer, bool) { + f, ok := describerMap(c)[kind] return f, ok } @@ -150,11 +147,11 @@ func (d *NamespaceDescriber) Describe(namespace, name string) (string, error) { if err != nil { return "", err } - resourceQuotaList, err := d.ResourceQuotas(name).List(labels.Everything(), fields.Everything()) + resourceQuotaList, err := d.ResourceQuotas(name).List(api.ListOptions{}) if err != nil { return "", err } - limitRangeList, err := d.LimitRanges(name).List(labels.Everything(), fields.Everything()) + limitRangeList, err := d.LimitRanges(name).List(api.ListOptions{}) if err != nil { return "", err } @@ -185,8 +182,8 @@ func DescribeLimitRanges(limitRanges *api.LimitRangeList, w io.Writer) { fmt.Fprint(w, "No resource limits.\n") return } - fmt.Fprintf(w, "Resource Limits\n Type\tResource\tMin\tMax\tRequest\tLimit\tLimit/Request\n") - fmt.Fprintf(w, " ----\t--------\t---\t---\t-------\t-----\t-------------\n") + fmt.Fprintf(w, "Resource Limits\n Type\tResource\tMin\tMax\tDefault Request\tDefault Limit\tMax Limit/Request Ratio\n") + fmt.Fprintf(w, " ----\t--------\t---\t---\t---------------\t-------------\t-----------------------\n") for _, limitRange := range limitRanges.Items { for i := range limitRange.Spec.Limits { item := limitRange.Spec.Limits[i] @@ -310,8 +307,8 @@ func describeLimitRange(limitRange *api.LimitRange) (string, error) { return tabbedString(func(out io.Writer) error { fmt.Fprintf(out, "Name:\t%s\n", limitRange.Name) fmt.Fprintf(out, "Namespace:\t%s\n", limitRange.Namespace) - fmt.Fprintf(out, "Type\tResource\tMin\tMax\tRequest\tLimit\tLimit/Request\n") - fmt.Fprintf(out, "----\t--------\t---\t---\t-------\t-----\t-------------\n") + fmt.Fprintf(out, "Type\tResource\tMin\tMax\tDefault Request\tDefault Limit\tMax Limit/Request Ratio\n") + fmt.Fprintf(out, "----\t--------\t---\t---\t---------------\t-------------\t-----------------------\n") for i := range limitRange.Spec.Limits { item := limitRange.Spec.Limits[i] maxResources := item.Max @@ -425,15 +422,12 @@ type PodDescriber struct { } func (d *PodDescriber) Describe(namespace, name string) (string, error) { - rc := d.ReplicationControllers(namespace) - pc := d.Pods(namespace) - - pod, err := pc.Get(name) + pod, err := d.Pods(namespace).Get(name) if err != nil { eventsInterface := d.Events(namespace) - events, err2 := eventsInterface.List( - labels.Everything(), - eventsInterface.GetFieldSelector(&name, &namespace, nil, nil)) + selector := eventsInterface.GetFieldSelector(&name, &namespace, nil, nil) + options := api.ListOptions{FieldSelector: selector} + events, err2 := eventsInterface.List(options) if err2 == nil && len(events.Items) > 0 { return tabbedString(func(out io.Writer) error { fmt.Fprintf(out, "Pod '%v': error '%v', but found events.\n", name, err) @@ -452,15 +446,10 @@ func (d *PodDescriber) Describe(namespace, name string) (string, error) { events, _ = d.Events(namespace).Search(ref) } - rcs, err := getReplicationControllersForLabels(rc, labels.Set(pod.Labels)) - if err != nil { - return "", err - } - - return describePod(pod, rcs, events) + return describePod(pod, events) } -func describePod(pod *api.Pod, rcs []api.ReplicationController, events *api.EventList) (string, error) { +func describePod(pod *api.Pod, events *api.EventList) (string, error) { return tabbedString(func(out io.Writer) error { fmt.Fprintf(out, "Name:\t%s\n", pod.Name) fmt.Fprintf(out, "Namespace:\t%s\n", pod.Namespace) @@ -479,11 +468,7 @@ func describePod(pod *api.Pod, rcs []api.ReplicationController, events *api.Even fmt.Fprintf(out, "Reason:\t%s\n", pod.Status.Reason) fmt.Fprintf(out, "Message:\t%s\n", pod.Status.Message) fmt.Fprintf(out, "IP:\t%s\n", pod.Status.PodIP) - var matchingRCs []*api.ReplicationController - for _, rc := range rcs { - matchingRCs = append(matchingRCs, &rc) - } - fmt.Fprintf(out, "Replication Controllers:\t%s\n", printReplicationControllersByLabels(matchingRCs)) + fmt.Fprintf(out, "Controllers:\t%s\n", printControllers(pod.Annotations)) fmt.Fprintf(out, "Containers:\n") describeContainers(pod, out) if len(pod.Status.Conditions) > 0 { @@ -502,6 +487,18 @@ func describePod(pod *api.Pod, rcs []api.ReplicationController, events *api.Even }) } +func printControllers(annotation map[string]string) string { + value, ok := annotation["kubernetes.io/created-by"] + if ok { + var r api.SerializedReference + err := json.Unmarshal([]byte(value), &r) + if err == nil { + return fmt.Sprintf("%s/%s", r.Reference.Kind, r.Reference.Name) + } + } + return "" +} + func describeVolumes(volumes []api.Volume, out io.Writer) { if volumes == nil || len(volumes) == 0 { fmt.Fprint(out, "No volumes.\n") @@ -592,9 +589,10 @@ func printISCSIVolumeSource(iscsi *api.ISCSIVolumeSource, out io.Writer) { " TargetPortal:\t%v\n"+ " IQN:\t%v\n"+ " Lun:\t%v\n"+ + " ISCSIInterface\t%v\n"+ " FSType:\t%v\n"+ " ReadOnly:\t%v\n", - iscsi.TargetPortal, iscsi.IQN, iscsi.Lun, iscsi.FSType, iscsi.ReadOnly) + iscsi.TargetPortal, iscsi.IQN, iscsi.Lun, iscsi.ISCSIInterface, iscsi.FSType, iscsi.ReadOnly) } func printGlusterfsVolumeSource(glusterfs *api.GlusterfsVolumeSource, out io.Writer) { @@ -843,7 +841,7 @@ func (d *ReplicationControllerDescriber) Describe(namespace, name string) (strin return "", err } - running, waiting, succeeded, failed, err := getPodStatusForController(pc, controller.Spec.Selector) + running, waiting, succeeded, failed, err := getPodStatusForController(pc, labels.SelectorFromSet(controller.Spec.Selector)) if err != nil { return "", err } @@ -876,6 +874,72 @@ func describeReplicationController(controller *api.ReplicationController, events }) } +func DescribePodTemplate(template *api.PodTemplateSpec) (string, error) { + return tabbedString(func(out io.Writer) error { + if template == nil { + fmt.Fprintf(out, "") + return nil + } + fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(template.Labels)) + fmt.Fprintf(out, "Annotations:\t%s\n", labels.FormatLabels(template.Annotations)) + fmt.Fprintf(out, "Image(s):\t%s\n", makeImageList(&template.Spec)) + describeVolumes(template.Spec.Volumes, out) + return nil + }) +} + +// ReplicaSetDescriber generates information about a ReplicaSet and the pods it has created. +type ReplicaSetDescriber struct { + client.Interface +} + +func (d *ReplicaSetDescriber) Describe(namespace, name string) (string, error) { + rsc := d.Extensions().ReplicaSets(namespace) + pc := d.Pods(namespace) + + rs, err := rsc.Get(name) + if err != nil { + return "", err + } + + selector, err := unversioned.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return "", err + } + + running, waiting, succeeded, failed, err := getPodStatusForController(pc, selector) + if err != nil { + return "", err + } + + events, _ := d.Events(namespace).Search(rs) + + return describeReplicaSet(rs, events, running, waiting, succeeded, failed) +} + +func describeReplicaSet(rs *extensions.ReplicaSet, events *api.EventList, running, waiting, succeeded, failed int) (string, error) { + return tabbedString(func(out io.Writer) error { + fmt.Fprintf(out, "Name:\t%s\n", rs.Name) + fmt.Fprintf(out, "Namespace:\t%s\n", rs.Namespace) + if rs.Spec.Template != nil { + fmt.Fprintf(out, "Image(s):\t%s\n", makeImageList(&rs.Spec.Template.Spec)) + } else { + fmt.Fprintf(out, "Image(s):\t%s\n", "") + } + fmt.Fprintf(out, "Selector:\t%s\n", unversioned.FormatLabelSelector(rs.Spec.Selector)) + fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(rs.Labels)) + fmt.Fprintf(out, "Replicas:\t%d current / %d desired\n", rs.Status.Replicas, rs.Spec.Replicas) + fmt.Fprintf(out, "Pods Status:\t%d Running / %d Waiting / %d Succeeded / %d Failed\n", running, waiting, succeeded, failed) + if rs.Spec.Template != nil { + describeVolumes(rs.Spec.Template.Spec.Volumes, out) + } + if events != nil { + DescribeEvents(events, out) + } + return nil + }) +} + // JobDescriber generates information about a job and the pods it has created. type JobDescriber struct { client *client.Client @@ -897,10 +961,20 @@ func describeJob(job *extensions.Job, events *api.EventList) (string, error) { fmt.Fprintf(out, "Name:\t%s\n", job.Name) fmt.Fprintf(out, "Namespace:\t%s\n", job.Namespace) fmt.Fprintf(out, "Image(s):\t%s\n", makeImageList(&job.Spec.Template.Spec)) - selector, _ := extensions.PodSelectorAsSelector(job.Spec.Selector) + selector, _ := unversioned.LabelSelectorAsSelector(job.Spec.Selector) fmt.Fprintf(out, "Selector:\t%s\n", selector) fmt.Fprintf(out, "Parallelism:\t%d\n", *job.Spec.Parallelism) - fmt.Fprintf(out, "Completions:\t%d\n", *job.Spec.Completions) + if job.Spec.Completions != nil { + fmt.Fprintf(out, "Completions:\t%d\n", *job.Spec.Completions) + } else { + fmt.Fprintf(out, "Completions:\tNot Set\n") + } + if job.Status.StartTime != nil { + fmt.Fprintf(out, "Start Time:\t%s\n", job.Status.StartTime.Time.Format(time.RFC1123Z)) + } + if job.Spec.ActiveDeadlineSeconds != nil { + fmt.Fprintf(out, "Active Deadline Seconds:\t%ds\n", *job.Spec.ActiveDeadlineSeconds) + } fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(job.Labels)) fmt.Fprintf(out, "Pods Statuses:\t%d Running / %d Succeeded / %d Failed\n", job.Status.Active, job.Status.Succeeded, job.Status.Failed) describeVolumes(job.Spec.Template.Spec.Volumes, out) @@ -925,7 +999,11 @@ func (d *DaemonSetDescriber) Describe(namespace, name string) (string, error) { return "", err } - running, waiting, succeeded, failed, err := getPodStatusForController(pc, daemon.Spec.Selector) + selector, err := unversioned.LabelSelectorAsSelector(daemon.Spec.Selector) + if err != nil { + return "", err + } + running, waiting, succeeded, failed, err := getPodStatusForController(pc, selector) if err != nil { return "", err } @@ -938,12 +1016,13 @@ func (d *DaemonSetDescriber) Describe(namespace, name string) (string, error) { func describeDaemonSet(daemon *extensions.DaemonSet, events *api.EventList, running, waiting, succeeded, failed int) (string, error) { return tabbedString(func(out io.Writer) error { fmt.Fprintf(out, "Name:\t%s\n", daemon.Name) - if daemon.Spec.Template != nil { - fmt.Fprintf(out, "Image(s):\t%s\n", makeImageList(&daemon.Spec.Template.Spec)) - } else { - fmt.Fprintf(out, "Image(s):\t%s\n", "") + fmt.Fprintf(out, "Image(s):\t%s\n", makeImageList(&daemon.Spec.Template.Spec)) + selector, err := unversioned.LabelSelectorAsSelector(daemon.Spec.Selector) + if err != nil { + // this shouldn't happen if LabelSelector passed validation + return err } - fmt.Fprintf(out, "Selector:\t%s\n", labels.FormatLabels(daemon.Spec.Selector)) + fmt.Fprintf(out, "Selector:\t%s\n", selector) fmt.Fprintf(out, "Node-Selector:\t%s\n", labels.FormatLabels(daemon.Spec.Template.Spec.NodeSelector)) fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(daemon.Labels)) fmt.Fprintf(out, "Desired Number of Nodes Scheduled: %d\n", daemon.Status.DesiredNumberScheduled) @@ -996,6 +1075,102 @@ func describeSecret(secret *api.Secret) (string, error) { }) } +type IngressDescriber struct { + client.Interface +} + +func (i *IngressDescriber) Describe(namespace, name string) (string, error) { + c := i.Extensions().Ingress(namespace) + ing, err := c.Get(name) + if err != nil { + return "", err + } + return i.describeIngress(ing) +} + +func (i *IngressDescriber) describeBackend(ns string, backend *extensions.IngressBackend) string { + endpoints, _ := i.Endpoints(ns).Get(backend.ServiceName) + service, _ := i.Services(ns).Get(backend.ServiceName) + spName := "" + for i := range service.Spec.Ports { + sp := &service.Spec.Ports[i] + switch backend.ServicePort.Type { + case intstr.String: + if backend.ServicePort.StrVal == sp.Name { + spName = sp.Name + } + case intstr.Int: + if int(backend.ServicePort.IntVal) == sp.Port { + spName = sp.Name + } + } + } + return formatEndpoints(endpoints, sets.NewString(spName)) +} + +func (i *IngressDescriber) describeIngress(ing *extensions.Ingress) (string, error) { + return tabbedString(func(out io.Writer) error { + fmt.Fprintf(out, "Name:\t%v\n", ing.Name) + fmt.Fprintf(out, "Namespace:\t%v\n", ing.Namespace) + fmt.Fprintf(out, "Address:\t%v\n", loadBalancerStatusStringer(ing.Status.LoadBalancer)) + def := ing.Spec.Backend + ns := ing.Namespace + if def == nil { + // Ingresses that don't specify a default backend inherit the + // default backend in the kube-system namespace. + def = &extensions.IngressBackend{ + ServiceName: "default-http-backend", + ServicePort: intstr.IntOrString{Type: intstr.Int, IntVal: 80}, + } + ns = api.NamespaceSystem + } + fmt.Fprintf(out, "Default backend:\t%s (%s)\n", backendStringer(def), i.describeBackend(ns, def)) + if len(ing.Spec.TLS) != 0 { + describeIngressTLS(out, ing.Spec.TLS) + } + fmt.Fprint(out, "Rules:\n Host\tPath\tBackends\n") + fmt.Fprint(out, " ----\t----\t--------\n") + for _, rules := range ing.Spec.Rules { + if rules.HTTP == nil { + continue + } + fmt.Fprintf(out, " %s\t\n", rules.Host) + for _, path := range rules.HTTP.Paths { + fmt.Fprintf(out, " \t%s \t%s (%s)\n", path.Path, backendStringer(&path.Backend), i.describeBackend(ing.Namespace, &path.Backend)) + } + } + describeIngressAnnotations(out, ing.Annotations) + + events, _ := i.Events(ing.Namespace).Search(ing) + if events != nil { + DescribeEvents(events, out) + } + return nil + }) +} + +func describeIngressTLS(out io.Writer, ingTLS []extensions.IngressTLS) { + fmt.Fprintf(out, "TLS:\n") + for _, t := range ingTLS { + fmt.Fprintf(out, " %v terminates %v\n", t.SecretName, strings.Join(t.Hosts, ",")) + } + return +} + +// TODO: Move from annotations into Ingress status. +func describeIngressAnnotations(out io.Writer, annotations map[string]string) { + fmt.Fprintf(out, "Annotations:\n") + for k, v := range annotations { + if !strings.HasPrefix(k, "ingress") { + continue + } + parts := strings.Split(k, "/") + name := parts[len(parts)-1] + fmt.Fprintf(out, " %v:\t%s\n", name, v) + } + return +} + // ServiceDescriber generates information about a service. type ServiceDescriber struct { client.Interface @@ -1067,6 +1242,76 @@ func describeService(service *api.Service, endpoints *api.Endpoints, events *api }) } +// EndpointsDescriber generates information about an Endpoint. +type EndpointsDescriber struct { + client.Interface +} + +func (d *EndpointsDescriber) Describe(namespace, name string) (string, error) { + c := d.Endpoints(namespace) + + ep, err := c.Get(name) + if err != nil { + return "", err + } + + events, _ := d.Events(namespace).Search(ep) + + return describeEndpoints(ep, events) +} + +func describeEndpoints(ep *api.Endpoints, events *api.EventList) (string, error) { + return tabbedString(func(out io.Writer) error { + fmt.Fprintf(out, "Name:\t%s\n", ep.Name) + fmt.Fprintf(out, "Namespace:\t%s\n", ep.Namespace) + fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(ep.Labels)) + + fmt.Fprintf(out, "Subsets:\n") + for i := range ep.Subsets { + subset := &ep.Subsets[i] + + addresses := []string{} + for _, addr := range subset.Addresses { + addresses = append(addresses, addr.IP) + } + addressesString := strings.Join(addresses, ",") + if len(addressesString) == 0 { + addressesString = "" + } + fmt.Fprintf(out, " Addresses:\t%s\n", addressesString) + + notReadyAddresses := []string{} + for _, addr := range subset.NotReadyAddresses { + notReadyAddresses = append(notReadyAddresses, addr.IP) + } + notReadyAddressesString := strings.Join(notReadyAddresses, ",") + if len(notReadyAddressesString) == 0 { + notReadyAddressesString = "" + } + fmt.Fprintf(out, " NotReadyAddresses:\t%s\n", notReadyAddressesString) + + if len(subset.Ports) > 0 { + fmt.Fprintf(out, " Ports:\n") + fmt.Fprintf(out, " Name\tPort\tProtocol\n") + fmt.Fprintf(out, " ----\t----\t--------\n") + for _, port := range subset.Ports { + name := port.Name + if len(name) == 0 { + name = "" + } + fmt.Fprintf(out, " %s\t%d\t%s\n", name, port.Port, port.Protocol) + } + } + fmt.Fprintf(out, "\n") + } + + if events != nil { + DescribeEvents(events, out) + } + return nil + }) +} + // ServiceAccountDescriber generates information about a service. type ServiceAccountDescriber struct { client.Interface @@ -1083,7 +1328,8 @@ func (d *ServiceAccountDescriber) Describe(namespace, name string) (string, erro tokens := []api.Secret{} tokenSelector := fields.SelectorFromSet(map[string]string{client.SecretType: string(api.SecretTypeServiceAccountToken)}) - secrets, err := d.Secrets(namespace).List(labels.Everything(), tokenSelector) + options := api.ListOptions{FieldSelector: tokenSelector} + secrets, err := d.Secrets(namespace).List(options) if err == nil { for _, s := range secrets.Items { name, _ := s.Annotations[api.ServiceAccountNameKey] @@ -1159,17 +1405,19 @@ func (d *NodeDescriber) Describe(namespace, name string) (string, error) { return "", err } - var pods []*api.Pod - allPods, err := d.Pods(namespace).List(labels.Everything(), fields.Everything()) + fieldSelector, err := fields.ParseSelector("spec.nodeName=" + name + ",status.phase!=" + string(api.PodSucceeded) + ",status.phase!=" + string(api.PodFailed)) if err != nil { return "", err } - for i := range allPods.Items { - pod := &allPods.Items[i] - if pod.Spec.NodeName != name { - continue + // in a policy aware setting, users may have access to a node, but not all pods + // in that case, we note that the user does not have access to the pods + canViewPods := true + nodeNonTerminatedPodsList, err := d.Pods(namespace).List(api.ListOptions{FieldSelector: fieldSelector}) + if err != nil { + if !errors.IsForbidden(err) { + return "", err } - pods = append(pods, pod) + canViewPods = false } var events *api.EventList @@ -1181,10 +1429,10 @@ func (d *NodeDescriber) Describe(namespace, name string) (string, error) { events, _ = d.Events("").Search(ref) } - return describeNode(node, pods, events) + return describeNode(node, nodeNonTerminatedPodsList, events, canViewPods) } -func describeNode(node *api.Node, pods []*api.Pod, events *api.EventList) (string, error) { +func describeNode(node *api.Node, nodeNonTerminatedPodsList *api.PodList, events *api.EventList, canViewPods bool) (string, error) { return tabbedString(func(out io.Writer) error { fmt.Fprintf(out, "Name:\t%s\n", node.Name) fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(node.Labels)) @@ -1192,7 +1440,7 @@ func describeNode(node *api.Node, pods []*api.Pod, events *api.EventList) (strin fmt.Fprintf(out, "Phase:\t%v\n", node.Status.Phase) if len(node.Status.Conditions) > 0 { fmt.Fprint(out, "Conditions:\n Type\tStatus\tLastHeartbeatTime\tLastTransitionTime\tReason\tMessage\n") - fmt.Fprint(out, " ────\t──────\t─────────────────\t──────────────────\t──────\t───────\n") + fmt.Fprint(out, " ----\t------\t-----------------\t------------------\t------\t-------\n") for _, c := range node.Status.Conditions { fmt.Fprintf(out, " %v \t%v \t%s \t%s \t%v \t%v\n", c.Type, @@ -1220,7 +1468,7 @@ func describeNode(node *api.Node, pods []*api.Pod, events *api.EventList) (strin fmt.Fprintf(out, " System UUID:\t%s\n", node.Status.NodeInfo.SystemUUID) fmt.Fprintf(out, " Boot ID:\t%s\n", node.Status.NodeInfo.BootID) fmt.Fprintf(out, " Kernel Version:\t%s\n", node.Status.NodeInfo.KernelVersion) - fmt.Fprintf(out, " OS Image:\t%s\n", node.Status.NodeInfo.OsImage) + fmt.Fprintf(out, " OS Image:\t%s\n", node.Status.NodeInfo.OSImage) fmt.Fprintf(out, " Container Runtime Version:\t%s\n", node.Status.NodeInfo.ContainerRuntimeVersion) fmt.Fprintf(out, " Kubelet Version:\t%s\n", node.Status.NodeInfo.KubeletVersion) fmt.Fprintf(out, " Kube-Proxy Version:\t%s\n", node.Status.NodeInfo.KubeProxyVersion) @@ -1231,10 +1479,13 @@ func describeNode(node *api.Node, pods []*api.Pod, events *api.EventList) (strin if len(node.Spec.ExternalID) > 0 { fmt.Fprintf(out, "ExternalID:\t%s\n", node.Spec.ExternalID) } - if err := describeNodeResource(pods, node, out); err != nil { - return err + if canViewPods && nodeNonTerminatedPodsList != nil { + if err := describeNodeResource(nodeNonTerminatedPodsList, node, out); err != nil { + return err + } + } else { + fmt.Fprintf(out, "Pods:\tnot authorized\n") } - if events != nil { DescribeEvents(events, out) } @@ -1257,9 +1508,8 @@ func (d *HorizontalPodAutoscalerDescriber) Describe(namespace, name string) (str fmt.Fprintf(out, "Namespace:\t%s\n", hpa.Namespace) fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(hpa.Labels)) fmt.Fprintf(out, "CreationTimestamp:\t%s\n", hpa.CreationTimestamp.Time.Format(time.RFC1123Z)) - fmt.Fprintf(out, "Reference:\t%s/%s/%s/%s\n", + fmt.Fprintf(out, "Reference:\t%s/%s/%s\n", hpa.Spec.ScaleRef.Kind, - hpa.Spec.ScaleRef.Namespace, hpa.Spec.ScaleRef.Name, hpa.Spec.ScaleRef.Subresource) if hpa.Spec.CPUUtilization != nil { @@ -1281,7 +1531,7 @@ func (d *HorizontalPodAutoscalerDescriber) Describe(namespace, name string) (str // TODO: switch to scale subresource once the required code is submitted. if strings.ToLower(hpa.Spec.ScaleRef.Kind) == "replicationcontroller" { fmt.Fprintf(out, "ReplicationController pods:\t") - rc, err := d.client.ReplicationControllers(hpa.Spec.ScaleRef.Namespace).Get(hpa.Spec.ScaleRef.Name) + rc, err := d.client.ReplicationControllers(hpa.Namespace).Get(hpa.Spec.ScaleRef.Name) if err == nil { fmt.Fprintf(out, "%d current / %d desired\n", rc.Status.Replicas, rc.Spec.Replicas) } else { @@ -1292,13 +1542,12 @@ func (d *HorizontalPodAutoscalerDescriber) Describe(namespace, name string) (str }) } -func describeNodeResource(pods []*api.Pod, node *api.Node, out io.Writer) error { - nonTerminatedPods := filterTerminatedPods(pods) - fmt.Fprintf(out, "Non-terminated Pods:\t(%d in total)\n", len(nonTerminatedPods)) +func describeNodeResource(nodeNonTerminatedPodsList *api.PodList, node *api.Node, out io.Writer) error { + fmt.Fprintf(out, "Non-terminated Pods:\t(%d in total)\n", len(nodeNonTerminatedPodsList.Items)) fmt.Fprint(out, " Namespace\tName\t\tCPU Requests\tCPU Limits\tMemory Requests\tMemory Limits\n") - fmt.Fprint(out, " ─────────\t────\t\t────────────\t──────────\t───────────────\t─────────────\n") - for _, pod := range nonTerminatedPods { - req, limit, err := getSinglePodTotalRequestsAndLimits(pod) + fmt.Fprint(out, " ---------\t----\t\t------------\t----------\t---------------\t-------------\n") + for _, pod := range nodeNonTerminatedPodsList.Items { + req, limit, err := api.PodRequestsAndLimits(&pod) if err != nil { return err } @@ -1313,8 +1562,8 @@ func describeNodeResource(pods []*api.Pod, node *api.Node, out io.Writer) error } fmt.Fprint(out, "Allocated resources:\n (Total limits may be over 100%, i.e., overcommitted. More info: http://releases.k8s.io/HEAD/docs/user-guide/compute-resources.md)\n CPU Requests\tCPU Limits\tMemory Requests\tMemory Limits\n") - fmt.Fprint(out, " ────────────\t──────────\t───────────────\t─────────────\n") - reqs, limits, err := getPodsTotalRequestsAndLimits(nonTerminatedPods) + fmt.Fprint(out, " ------------\t----------\t---------------\t-------------\n") + reqs, limits, err := getPodsTotalRequestsAndLimits(nodeNonTerminatedPodsList) if err != nil { return err } @@ -1343,10 +1592,10 @@ func filterTerminatedPods(pods []*api.Pod) []*api.Pod { return result } -func getPodsTotalRequestsAndLimits(pods []*api.Pod) (reqs map[api.ResourceName]resource.Quantity, limits map[api.ResourceName]resource.Quantity, err error) { +func getPodsTotalRequestsAndLimits(podList *api.PodList) (reqs map[api.ResourceName]resource.Quantity, limits map[api.ResourceName]resource.Quantity, err error) { reqs, limits = map[api.ResourceName]resource.Quantity{}, map[api.ResourceName]resource.Quantity{} - for _, pod := range pods { - podReqs, podLimits, err := getSinglePodTotalRequestsAndLimits(pod) + for _, pod := range podList.Items { + podReqs, podLimits, err := api.PodRequestsAndLimits(&pod) if err != nil { return nil, nil, err } @@ -1368,42 +1617,22 @@ func getPodsTotalRequestsAndLimits(pods []*api.Pod) (reqs map[api.ResourceName]r return } -func getSinglePodTotalRequestsAndLimits(pod *api.Pod) (reqs map[api.ResourceName]resource.Quantity, limits map[api.ResourceName]resource.Quantity, err error) { - reqs, limits = map[api.ResourceName]resource.Quantity{}, map[api.ResourceName]resource.Quantity{} - for _, container := range pod.Spec.Containers { - for name, quantity := range container.Resources.Requests { - if value, ok := reqs[name]; !ok { - reqs[name] = *quantity.Copy() - } else if err = value.Add(quantity); err != nil { - return nil, nil, err - } - } - for name, quantity := range container.Resources.Limits { - if value, ok := limits[name]; !ok { - limits[name] = *quantity.Copy() - } else if err = value.Add(quantity); err != nil { - return nil, nil, err - } - } - } - return -} - func DescribeEvents(el *api.EventList, w io.Writer) { if len(el.Items) == 0 { fmt.Fprint(w, "No events.") return } sort.Sort(SortableEvents(el.Items)) - fmt.Fprint(w, "Events:\n FirstSeen\tLastSeen\tCount\tFrom\tSubobjectPath\tReason\tMessage\n") - fmt.Fprint(w, " ─────────\t────────\t─────\t────\t─────────────\t──────\t───────\n") + fmt.Fprint(w, "Events:\n FirstSeen\tLastSeen\tCount\tFrom\tSubobjectPath\tType\tReason\tMessage\n") + fmt.Fprint(w, " ---------\t--------\t-----\t----\t-------------\t--------\t------\t-------\n") for _, e := range el.Items { - fmt.Fprintf(w, " %s\t%s\t%d\t%v\t%v\t%v\t%v\n", + fmt.Fprintf(w, " %s\t%s\t%d\t%v\t%v\t%v\t%v\t%v\n", translateTimestamp(e.FirstTimestamp), translateTimestamp(e.LastTimestamp), e.Count, e.Source, e.InvolvedObject.FieldPath, + e.Type, e.Reason, e.Message) } @@ -1411,7 +1640,7 @@ func DescribeEvents(el *api.EventList, w io.Writer) { // DeploymentDescriber generates information about a deployment. type DeploymentDescriber struct { - client.Interface + clientset.Interface } func (dd *DeploymentDescriber) Describe(namespace, name string) (string, error) { @@ -1419,31 +1648,36 @@ func (dd *DeploymentDescriber) Describe(namespace, name string) (string, error) if err != nil { return "", err } + selector, err := unversioned.LabelSelectorAsSelector(d.Spec.Selector) + if err != nil { + return "", err + } return tabbedString(func(out io.Writer) error { fmt.Fprintf(out, "Name:\t%s\n", d.ObjectMeta.Name) fmt.Fprintf(out, "Namespace:\t%s\n", d.ObjectMeta.Namespace) fmt.Fprintf(out, "CreationTimestamp:\t%s\n", d.CreationTimestamp.Time.Format(time.RFC1123Z)) fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(d.Labels)) - fmt.Fprintf(out, "Selector:\t%s\n", labels.FormatLabels(d.Spec.Selector)) - fmt.Fprintf(out, "Replicas:\t%d updated / %d total\n", d.Status.UpdatedReplicas, d.Spec.Replicas) + fmt.Fprintf(out, "Selector:\t%s\n", selector) + fmt.Fprintf(out, "Replicas:\t%d updated | %d total | %d available | %d unavailable\n", d.Status.UpdatedReplicas, d.Spec.Replicas, d.Status.AvailableReplicas, d.Status.UnavailableReplicas) fmt.Fprintf(out, "StrategyType:\t%s\n", d.Spec.Strategy.Type) + fmt.Fprintf(out, "MinReadySeconds:\t%d\n", d.Spec.MinReadySeconds) if d.Spec.Strategy.RollingUpdate != nil { ru := d.Spec.Strategy.RollingUpdate - fmt.Fprintf(out, "RollingUpdateStrategy:\t%s max unavailable, %s max surge, %d min ready seconds\n", ru.MaxUnavailable.String(), ru.MaxSurge.String(), ru.MinReadySeconds) + fmt.Fprintf(out, "RollingUpdateStrategy:\t%s max unavailable, %s max surge\n", ru.MaxUnavailable.String(), ru.MaxSurge.String()) } - oldRCs, err := deploymentutil.GetOldRCs(*d, dd) + oldRSs, _, err := deploymentutil.GetOldReplicaSets(*d, dd) if err == nil { - fmt.Fprintf(out, "OldReplicationControllers:\t%s\n", printReplicationControllersByLabels(oldRCs)) + fmt.Fprintf(out, "OldReplicaSets:\t%s\n", printReplicaSetsByLabels(oldRSs)) } - newRC, err := deploymentutil.GetNewRC(*d, dd) + newRS, err := deploymentutil.GetNewReplicaSet(*d, dd) if err == nil { - var newRCs []*api.ReplicationController - if newRC != nil { - newRCs = append(newRCs, newRC) + var newRSs []*extensions.ReplicaSet + if newRS != nil { + newRSs = append(newRSs, newRS) } - fmt.Fprintf(out, "NewReplicationController:\t%s\n", printReplicationControllersByLabels(newRCs)) + fmt.Fprintf(out, "NewReplicaSet:\t%s\n", printReplicaSetsByLabels(newRSs)) } - events, err := dd.Events(namespace).Search(d) + events, err := dd.Core().Events(namespace).Search(d) if err == nil && events != nil { DescribeEvents(events, out) } @@ -1459,7 +1693,7 @@ func (dd *DeploymentDescriber) Describe(namespace, name string) (string, error) func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.Labels) ([]extensions.DaemonSet, error) { // Get all daemon sets // TODO: this needs a namespace scope as argument - dss, err := c.List(labels.Everything(), fields.Everything()) + dss, err := c.List(api.ListOptions{}) if err != nil { return nil, fmt.Errorf("error getting daemon set: %v", err) } @@ -1467,7 +1701,11 @@ func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.La // Find the ones that match labelsToMatch. var matchingDaemonSets []extensions.DaemonSet for _, ds := range dss.Items { - selector := labels.SelectorFromSet(ds.Spec.Selector) + selector, err := unversioned.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + // this should never happen if the DaemonSet passed validation + return nil, err + } if selector.Matches(labelsToMatch) { matchingDaemonSets = append(matchingDaemonSets, ds) } @@ -1475,29 +1713,6 @@ func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.La return matchingDaemonSets, nil } -// Get all replication controllers whose selectors would match a given set of -// labels. -// TODO Move this to pkg/client and ideally implement it server-side (instead -// of getting all RC's and searching through them manually). -func getReplicationControllersForLabels(c client.ReplicationControllerInterface, labelsToMatch labels.Labels) ([]api.ReplicationController, error) { - // Get all replication controllers. - // TODO this needs a namespace scope as argument - rcs, err := c.List(labels.Everything(), fields.Everything()) - if err != nil { - return nil, fmt.Errorf("error getting replication controllers: %v", err) - } - - // Find the ones that match labelsToMatch. - var matchingRCs []api.ReplicationController - for _, controller := range rcs.Items { - selector := labels.SelectorFromSet(controller.Spec.Selector) - if selector.Matches(labelsToMatch) { - matchingRCs = append(matchingRCs, controller) - } - } - return matchingRCs, nil -} - func printReplicationControllersByLabels(matchingRCs []*api.ReplicationController) string { // Format the matching RC's into strings. var rcStrings []string @@ -1512,8 +1727,23 @@ func printReplicationControllersByLabels(matchingRCs []*api.ReplicationControlle return list } -func getPodStatusForController(c client.PodInterface, selector map[string]string) (running, waiting, succeeded, failed int, err error) { - rcPods, err := c.List(labels.SelectorFromSet(selector), fields.Everything()) +func printReplicaSetsByLabels(matchingRSs []*extensions.ReplicaSet) string { + // Format the matching ReplicaSets into strings. + var rsStrings []string + for _, rs := range matchingRSs { + rsStrings = append(rsStrings, fmt.Sprintf("%s (%d/%d replicas created)", rs.Name, rs.Status.Replicas, rs.Spec.Replicas)) + } + + list := strings.Join(rsStrings, ", ") + if list == "" { + return "" + } + return list +} + +func getPodStatusForController(c client.PodInterface, selector labels.Selector) (running, waiting, succeeded, failed int, err error) { + options := api.ListOptions{LabelSelector: selector} + rcPods, err := c.List(options) if err != nil { return } @@ -1532,6 +1762,38 @@ func getPodStatusForController(c client.PodInterface, selector map[string]string return } +// ConfigMapDescriber generates information about a ConfigMap +type ConfigMapDescriber struct { + client.Interface +} + +func (d *ConfigMapDescriber) Describe(namespace, name string) (string, error) { + c := d.ConfigMaps(namespace) + + configMap, err := c.Get(name) + if err != nil { + return "", err + } + + return describeConfigMap(configMap) +} + +func describeConfigMap(configMap *api.ConfigMap) (string, error) { + return tabbedString(func(out io.Writer) error { + fmt.Fprintf(out, "Name:\t%s\n", configMap.Name) + fmt.Fprintf(out, "Namespace:\t%s\n", configMap.Namespace) + fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(configMap.Labels)) + fmt.Fprintf(out, "Annotations:\t%s\n", labels.FormatLabels(configMap.Annotations)) + + fmt.Fprintf(out, "\nData\n====\n") + for k, v := range configMap.Data { + fmt.Fprintf(out, "%s:\t%d bytes\n", k, len(v)) + } + + return nil + }) +} + // newErrNoDescriber creates a new ErrNoDescriber with the names of the provided types. func newErrNoDescriber(types ...reflect.Type) error { names := []string{} @@ -1639,13 +1901,18 @@ type typeFunc struct { } // Matches returns true when the passed types exactly match the Extra list. -// TODO: allow unordered types to be matched and reorderd. func (fn typeFunc) Matches(types []reflect.Type) bool { if len(fn.Extra) != len(types) { return false } + // reorder the items in array types and fn.Extra + // convert the type into string and sort them, check if they are matched + varMap := make(map[reflect.Type]bool) + for i := range fn.Extra { + varMap[fn.Extra[i]] = true + } for i := range types { - if fn.Extra[i] != types[i] { + if _, found := varMap[types[i]]; !found { return false } } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/describe_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/describe_test.go index 076f51d1a..43420fa14 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/describe_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/describe_test.go @@ -28,6 +28,7 @@ import ( "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/client/testing/fake" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/testclient" ) @@ -39,10 +40,6 @@ type describeClient struct { client.Interface } -func init() { - api.ForTesting_ReferencesAllowBlankSelfLinks = true -} - func TestDescribePod(t *testing.T) { fake := testclient.NewSimpleFake(&api.Pod{ ObjectMeta: api.ObjectMeta{ @@ -89,6 +86,7 @@ func TestPodDescribeResultsSorted(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(2014, time.January, 15, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(2014, time.January, 15, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, { Source: api.EventSource{Component: "scheduler"}, @@ -96,6 +94,7 @@ func TestPodDescribeResultsSorted(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(1987, time.June, 17, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(1987, time.June, 17, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, { Source: api.EventSource{Component: "kubelet"}, @@ -103,6 +102,7 @@ func TestPodDescribeResultsSorted(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(2002, time.December, 25, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(2002, time.December, 25, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, }, }) @@ -360,53 +360,55 @@ func TestDefaultDescribers(t *testing.T) { func TestGetPodsTotalRequests(t *testing.T) { testCases := []struct { - pods []*api.Pod + pods *api.PodList expectedReqs, expectedLimits map[api.ResourceName]resource.Quantity }{ { - pods: []*api.Pod{ - { - Spec: api.PodSpec{ - Containers: []api.Container{ - { - Resources: api.ResourceRequirements{ - Requests: api.ResourceList{ - api.ResourceName(api.ResourceCPU): resource.MustParse("1"), - api.ResourceName(api.ResourceMemory): resource.MustParse("300Mi"), - api.ResourceName(api.ResourceStorage): resource.MustParse("1G"), + pods: &api.PodList{ + Items: []api.Pod{ + { + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceCPU): resource.MustParse("1"), + api.ResourceName(api.ResourceMemory): resource.MustParse("300Mi"), + api.ResourceName(api.ResourceStorage): resource.MustParse("1G"), + }, }, }, - }, - { - Resources: api.ResourceRequirements{ - Requests: api.ResourceList{ - api.ResourceName(api.ResourceCPU): resource.MustParse("90m"), - api.ResourceName(api.ResourceMemory): resource.MustParse("120Mi"), - api.ResourceName(api.ResourceStorage): resource.MustParse("200M"), + { + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceCPU): resource.MustParse("90m"), + api.ResourceName(api.ResourceMemory): resource.MustParse("120Mi"), + api.ResourceName(api.ResourceStorage): resource.MustParse("200M"), + }, }, }, }, }, }, - }, - { - Spec: api.PodSpec{ - Containers: []api.Container{ - { - Resources: api.ResourceRequirements{ - Requests: api.ResourceList{ - api.ResourceName(api.ResourceCPU): resource.MustParse("60m"), - api.ResourceName(api.ResourceMemory): resource.MustParse("43Mi"), - api.ResourceName(api.ResourceStorage): resource.MustParse("500M"), + { + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceCPU): resource.MustParse("60m"), + api.ResourceName(api.ResourceMemory): resource.MustParse("43Mi"), + api.ResourceName(api.ResourceStorage): resource.MustParse("500M"), + }, }, }, - }, - { - Resources: api.ResourceRequirements{ - Requests: api.ResourceList{ - api.ResourceName(api.ResourceCPU): resource.MustParse("34m"), - api.ResourceName(api.ResourceMemory): resource.MustParse("83Mi"), - api.ResourceName(api.ResourceStorage): resource.MustParse("700M"), + { + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceCPU): resource.MustParse("34m"), + api.ResourceName(api.ResourceMemory): resource.MustParse("83Mi"), + api.ResourceName(api.ResourceStorage): resource.MustParse("700M"), + }, }, }, }, @@ -501,17 +503,16 @@ func TestPersistentVolumeDescriber(t *testing.T) { } func TestDescribeDeployment(t *testing.T) { - fake := testclient.NewSimpleFake(&extensions.Deployment{ + fake := fake.NewSimpleClientset(&extensions.Deployment{ ObjectMeta: api.ObjectMeta{ Name: "bar", Namespace: "foo", }, Spec: extensions.DeploymentSpec{ - Template: &api.PodTemplateSpec{}, + Template: api.PodTemplateSpec{}, }, }) - c := &describeClient{T: t, Namespace: "foo", Interface: fake} - d := DeploymentDescriber{c} + d := DeploymentDescriber{fake} out, err := d.Describe("foo", "bar") if err != nil { t.Errorf("unexpected error: %v", err) diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/explain.go b/vendor/k8s.io/kubernetes/pkg/kubectl/explain.go index fa8da7834..d8b9a1472 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/explain.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/explain.go @@ -25,27 +25,16 @@ import ( "k8s.io/kubernetes/pkg/api/meta" apiutil "k8s.io/kubernetes/pkg/api/util" - client "k8s.io/kubernetes/pkg/client/unversioned" ) var allModels = make(map[string]*swagger.NamedModel) var recursive = false // this is global for convenience, can become int for multiple levels -// GetSwaggerSchema returns the swagger spec from master -func GetSwaggerSchema(apiVer string, kubeClient client.Interface) (*swagger.ApiDeclaration, error) { - swaggerSchema, err := kubeClient.SwaggerSchema(apiVer) - if err != nil { - return nil, fmt.Errorf("couldn't read swagger schema from server: %v", err) - } - return swaggerSchema, nil -} - // SplitAndParseResourceRequest separates the users input into a model and fields -func SplitAndParseResourceRequest(inResource string, mapper meta.RESTMapper) (string, string, []string, error) { +func SplitAndParseResourceRequest(inResource string, mapper meta.RESTMapper) (string, []string, error) { inResource, fieldsPath := splitDotNotation(inResource) - group, inResource := splitGroupFromResource(inResource) - inResource, _ = mapper.ResourceSingularizer(expandResourceShortcut(inResource)) - return group, inResource, fieldsPath, nil + inResource, _ = mapper.ResourceSingularizer(inResource) + return inResource, fieldsPath, nil } // PrintModelDescription prints the description of a specific model or dot path @@ -63,7 +52,7 @@ func PrintModelDescription(inModel string, fieldsPath []string, w io.Writer, swa } } if pointedModel == nil { - return fmt.Errorf("Requested resource: %s doesn't exist", inModel) + return fmt.Errorf("requested resource %q is not defined", inModel) } if len(fieldsPath) == 0 { @@ -80,21 +69,12 @@ func PrintModelDescription(inModel string, fieldsPath []string, w io.Writer, swa return printPrimitive(w, prop) } } else { - return fmt.Errorf("field: %s doesn't exist", field) + return fmt.Errorf("field %q does not exist", field) } } return printModelInfo(w, pointedModel, pointedModelAsProp) } -func splitGroupFromResource(resource string) (string, string) { - seg := strings.SplitN(resource, "/", 2) - if len(seg) == 1 { - return "", seg[0] - } else { - return seg[0], seg[1] - } -} - func splitDotNotation(model string) (string, []string) { var fieldsPath []string dotModel := strings.Split(model, ".") diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/generate.go b/vendor/k8s.io/kubernetes/pkg/kubectl/generate.go index 3528e5e46..6a71b619d 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/generate.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/generate.go @@ -23,6 +23,7 @@ import ( "strings" "github.com/spf13/cobra" + "github.com/spf13/pflag" "k8s.io/kubernetes/pkg/runtime" utilerrors "k8s.io/kubernetes/pkg/util/errors" ) @@ -42,6 +43,12 @@ type Generator interface { ParamNames() []GeneratorParam } +// StructuredGenerator is an interface for things that can generate API objects not using parameter injection +type StructuredGenerator interface { + // StructuredGenerator creates an API object using pre-configured parameters + StructuredGenerate() (runtime.Object, error) +} + func IsZero(i interface{}) bool { if i == nil { return true @@ -63,6 +70,58 @@ func ValidateParams(paramSpec []GeneratorParam, params map[string]interface{}) e return utilerrors.NewAggregate(allErrs) } +// AnnotateFlags annotates all flags that are used by generators. +func AnnotateFlags(cmd *cobra.Command, generators map[string]Generator) { + // Iterate over all generators and mark any flags used by them. + for name, generator := range generators { + generatorParams := map[string]struct{}{} + for _, param := range generator.ParamNames() { + generatorParams[param.Name] = struct{}{} + } + + cmd.Flags().VisitAll(func(flag *pflag.Flag) { + if _, found := generatorParams[flag.Name]; !found { + // This flag is not used by the current generator + // so skip it. + return + } + if flag.Annotations == nil { + flag.Annotations = map[string][]string{} + } + if annotations := flag.Annotations["generator"]; annotations == nil { + flag.Annotations["generator"] = []string{} + } + flag.Annotations["generator"] = append(flag.Annotations["generator"], name) + }) + } +} + +// EnsureFlagsValid ensures that no invalid flags are being used against a generator. +func EnsureFlagsValid(cmd *cobra.Command, generators map[string]Generator, generatorInUse string) error { + AnnotateFlags(cmd, generators) + + allErrs := []error{} + cmd.Flags().VisitAll(func(flag *pflag.Flag) { + // If the flag hasn't changed, don't validate it. + if !flag.Changed { + return + } + // Look into the flag annotations for the generators that can use it. + if annotations := flag.Annotations["generator"]; len(annotations) > 0 { + annotationMap := map[string]struct{}{} + for _, ann := range annotations { + annotationMap[ann] = struct{}{} + } + // If the current generator is not annotated, then this flag shouldn't + // be used with it. + if _, found := annotationMap[generatorInUse]; !found { + allErrs = append(allErrs, fmt.Errorf("cannot use --%s with --generator=%s", flag.Name, generatorInUse)) + } + } + }) + return utilerrors.NewAggregate(allErrs) +} + // MakeParams is a utility that creates generator parameters from a command line func MakeParams(cmd *cobra.Command, params []GeneratorParam) map[string]interface{} { result := map[string]interface{}{} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/history.go b/vendor/k8s.io/kubernetes/pkg/kubectl/history.go new file mode 100644 index 000000000..01995f376 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/history.go @@ -0,0 +1,134 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kubectl + +import ( + "fmt" + "io" + "sort" + "strconv" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" + clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/kubernetes/pkg/runtime" + deploymentutil "k8s.io/kubernetes/pkg/util/deployment" + "k8s.io/kubernetes/pkg/util/errors" +) + +const ( + ChangeCauseAnnotation = "kubernetes.io/change-cause" +) + +// HistoryViewer provides an interface for resources that can be rolled back. +type HistoryViewer interface { + History(namespace, name string) (HistoryInfo, error) +} + +func HistoryViewerFor(kind unversioned.GroupKind, c clientset.Interface) (HistoryViewer, error) { + switch kind { + case extensions.Kind("Deployment"): + return &DeploymentHistoryViewer{c}, nil + } + return nil, fmt.Errorf("no history viewer has been implemented for %q", kind) +} + +// HistoryInfo stores the mapping from revision to podTemplate; +// note that change-cause annotation should be copied to podTemplate +type HistoryInfo struct { + RevisionToTemplate map[int64]*api.PodTemplateSpec +} + +type DeploymentHistoryViewer struct { + c clientset.Interface +} + +// History returns a revision-to-replicaset map as the revision history of a deployment +func (h *DeploymentHistoryViewer) History(namespace, name string) (HistoryInfo, error) { + historyInfo := HistoryInfo{ + RevisionToTemplate: make(map[int64]*api.PodTemplateSpec), + } + deployment, err := h.c.Extensions().Deployments(namespace).Get(name) + if err != nil { + return historyInfo, fmt.Errorf("failed to retrieve deployment %s: %v", name, err) + } + _, allOldRSs, err := deploymentutil.GetOldReplicaSets(*deployment, h.c) + if err != nil { + return historyInfo, fmt.Errorf("failed to retrieve old replica sets from deployment %s: %v", name, err) + } + newRS, err := deploymentutil.GetNewReplicaSet(*deployment, h.c) + if err != nil { + return historyInfo, fmt.Errorf("failed to retrieve new replica set from deployment %s: %v", name, err) + } + allRSs := append(allOldRSs, newRS) + for _, rs := range allRSs { + v, err := deploymentutil.Revision(rs) + if err != nil { + continue + } + historyInfo.RevisionToTemplate[v] = rs.Spec.Template + changeCause := getChangeCause(rs) + if historyInfo.RevisionToTemplate[v].Annotations == nil { + historyInfo.RevisionToTemplate[v].Annotations = make(map[string]string) + } + historyInfo.RevisionToTemplate[v].Annotations[ChangeCauseAnnotation] = changeCause + } + return historyInfo, nil +} + +// PrintRolloutHistory prints a formatted table of the input revision history of the deployment +func PrintRolloutHistory(historyInfo HistoryInfo, resource, name string) (string, error) { + if len(historyInfo.RevisionToTemplate) == 0 { + return fmt.Sprintf("No rollout history found in %s %q", resource, name), nil + } + // Sort the revisionToChangeCause map by revision + var revisions []string + for k := range historyInfo.RevisionToTemplate { + revisions = append(revisions, strconv.FormatInt(k, 10)) + } + sort.Strings(revisions) + + return tabbedString(func(out io.Writer) error { + fmt.Fprintf(out, "%s %q:\n", resource, name) + fmt.Fprintf(out, "REVISION\tCHANGE-CAUSE\n") + errs := []error{} + for _, r := range revisions { + // Find the change-cause of revision r + r64, err := strconv.ParseInt(r, 10, 64) + if err != nil { + errs = append(errs, err) + continue + } + changeCause := historyInfo.RevisionToTemplate[r64].Annotations[ChangeCauseAnnotation] + if len(changeCause) == 0 { + changeCause = "" + } + fmt.Fprintf(out, "%s\t%s\n", r, changeCause) + } + return errors.NewAggregate(errs) + }) +} + +// getChangeCause returns the change-cause annotation of the input object +func getChangeCause(obj runtime.Object) string { + meta, err := api.ObjectMetaFor(obj) + if err != nil { + return "" + } + return meta.Annotations[ChangeCauseAnnotation] +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/kubectl.go b/vendor/k8s.io/kubernetes/pkg/kubectl/kubectl.go index 691866ec6..2f9c7c4e8 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/kubectl.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/kubectl.go @@ -22,6 +22,8 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" ) const kubectlAnnotationPrefix = "kubectl.kubernetes.io/" @@ -46,26 +48,27 @@ func makeImageList(spec *api.PodSpec) string { // correspond to a preferred output version (if feasible) type OutputVersionMapper struct { meta.RESTMapper - OutputVersion string + + // output versions takes a list of preferred GroupVersions. Only the first + // hit for a given group will have effect. This allows different output versions + // depending upon the group of the kind being requested + OutputVersions []unversioned.GroupVersion } // RESTMapping implements meta.RESTMapper by prepending the output version to the preferred version list. -func (m OutputVersionMapper) RESTMapping(kind string, versions ...string) (*meta.RESTMapping, error) { - preferred := []string{m.OutputVersion} - for _, version := range versions { - if len(version) > 0 { - preferred = append(preferred, version) +func (m OutputVersionMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (*meta.RESTMapping, error) { + for _, preferredVersion := range m.OutputVersions { + if gk.Group == preferredVersion.Group { + mapping, err := m.RESTMapper.RESTMapping(gk, preferredVersion.Version) + if err == nil { + return mapping, nil + } + + break } } - // if the caller wants to use the default version list, try with the preferred version, and on - // error, use the default behavior. - if len(preferred) == 1 { - if m, err := m.RESTMapper.RESTMapping(kind, preferred...); err == nil { - return m, nil - } - preferred = nil - } - return m.RESTMapper.RESTMapping(kind, preferred...) + + return m.RESTMapper.RESTMapping(gk, versions...) } // ShortcutExpander is a RESTMapper that can be used for Kubernetes @@ -74,43 +77,45 @@ type ShortcutExpander struct { meta.RESTMapper } -// VersionAndKindForResource implements meta.RESTMapper. It expands the resource first, then invokes the wrapped +var _ meta.RESTMapper = &ShortcutExpander{} + +// KindFor implements meta.RESTMapper. It expands the resource first, then invokes the wrapped // mapper. -func (e ShortcutExpander) VersionAndKindForResource(resource string) (defaultVersion, kind string, err error) { +func (e ShortcutExpander) KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) { resource = expandResourceShortcut(resource) - defaultVersion, kind, err = e.RESTMapper.VersionAndKindForResource(resource) - return defaultVersion, kind, err + return e.RESTMapper.KindFor(resource) } -// ResourceIsValid takes a string (kind) and checks if it's a valid resource. -// It expands the resource first, then invokes the wrapped mapper. -func (e ShortcutExpander) ResourceIsValid(resource string) bool { - return e.RESTMapper.ResourceIsValid(expandResourceShortcut(resource)) +// ResourceSingularizer expands the named resource and then singularizes it. +func (e ShortcutExpander) ResourceSingularizer(resource string) (string, error) { + return e.RESTMapper.ResourceSingularizer(expandResourceShortcut(unversioned.GroupVersionResource{Resource: resource}).Resource) } // expandResourceShortcut will return the expanded version of resource // (something that a pkg/api/meta.RESTMapper can understand), if it is // indeed a shortcut. Otherwise, will return resource unmodified. -func expandResourceShortcut(resource string) string { - shortForms := map[string]string{ +func expandResourceShortcut(resource unversioned.GroupVersionResource) unversioned.GroupVersionResource { + shortForms := map[string]unversioned.GroupVersionResource{ // Please keep this alphabetized - "cs": "componentstatuses", - "ev": "events", - "ep": "endpoints", - "hpa": "horizontalpodautoscalers", - "limits": "limitranges", - "no": "nodes", - "ns": "namespaces", - "po": "pods", - "pv": "persistentvolumes", - "pvc": "persistentvolumeclaims", - "quota": "resourcequotas", - "rc": "replicationcontrollers", - "ds": "daemonsets", - "svc": "services", - "ing": "ingress", + "cs": api.SchemeGroupVersion.WithResource("componentstatuses"), + "ds": extensions.SchemeGroupVersion.WithResource("daemonsets"), + "ep": api.SchemeGroupVersion.WithResource("endpoints"), + "ev": api.SchemeGroupVersion.WithResource("events"), + "hpa": extensions.SchemeGroupVersion.WithResource("horizontalpodautoscalers"), + "ing": extensions.SchemeGroupVersion.WithResource("ingresses"), + "limits": api.SchemeGroupVersion.WithResource("limitranges"), + "no": api.SchemeGroupVersion.WithResource("nodes"), + "ns": api.SchemeGroupVersion.WithResource("namespaces"), + "po": api.SchemeGroupVersion.WithResource("pods"), + "psp": api.SchemeGroupVersion.WithResource("podSecurityPolicies"), + "pvc": api.SchemeGroupVersion.WithResource("persistentvolumeclaims"), + "pv": api.SchemeGroupVersion.WithResource("persistentvolumes"), + "quota": api.SchemeGroupVersion.WithResource("resourcequotas"), + "rc": api.SchemeGroupVersion.WithResource("replicationcontrollers"), + "rs": extensions.SchemeGroupVersion.WithResource("replicasets"), + "svc": api.SchemeGroupVersion.WithResource("services"), } - if expanded, ok := shortForms[resource]; ok { + if expanded, ok := shortForms[resource.Resource]; ok { return expanded } return resource diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/namespace.go b/vendor/k8s.io/kubernetes/pkg/kubectl/namespace.go new file mode 100644 index 000000000..c6011d38b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/namespace.go @@ -0,0 +1,79 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kubectl + +import ( + "fmt" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/runtime" +) + +// NamespaceGeneratorV1 supports stable generation of a namespace +type NamespaceGeneratorV1 struct { + // Name of namespace + Name string +} + +// Ensure it supports the generator pattern that uses parameter injection +var _ Generator = &NamespaceGeneratorV1{} + +// Ensure it supports the generator pattern that uses parameters specified during construction +var _ StructuredGenerator = &NamespaceGeneratorV1{} + +// Generate returns a namespace using the specified parameters +func (g NamespaceGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error) { + err := ValidateParams(g.ParamNames(), genericParams) + if err != nil { + return nil, err + } + params := map[string]string{} + for key, value := range genericParams { + strVal, isString := value.(string) + if !isString { + return nil, fmt.Errorf("expected string, saw %v for '%s'", value, key) + } + params[key] = strVal + } + delegate := &NamespaceGeneratorV1{Name: params["name"]} + return delegate.StructuredGenerate() +} + +// ParamNames returns the set of supported input parameters when using the parameter injection generator pattern +func (g NamespaceGeneratorV1) ParamNames() []GeneratorParam { + return []GeneratorParam{ + {"name", true}, + } +} + +// StructuredGenerate outputs a namespace object using the configured fields +func (g *NamespaceGeneratorV1) StructuredGenerate() (runtime.Object, error) { + if err := g.validate(); err != nil { + return nil, err + } + namespace := &api.Namespace{} + namespace.Name = g.Name + return namespace, nil +} + +// validate validates required fields are set to support structured generation +func (g *NamespaceGeneratorV1) validate() error { + if len(g.Name) == 0 { + return fmt.Errorf("name must be specified") + } + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/namespace_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/namespace_test.go new file mode 100644 index 000000000..b0445bd29 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/namespace_test.go @@ -0,0 +1,61 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kubectl + +import ( + "reflect" + "testing" + + "k8s.io/kubernetes/pkg/api" +) + +func TestNamespaceGenerate(t *testing.T) { + tests := []struct { + params map[string]interface{} + expected *api.Namespace + expectErr bool + }{ + { + params: map[string]interface{}{ + "name": "foo", + }, + expected: &api.Namespace{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + }, + expectErr: false, + }, + { + params: map[string]interface{}{}, + expectErr: true, + }, + } + generator := NamespaceGeneratorV1{} + for _, test := range tests { + obj, err := generator.Generate(test.params) + if !test.expectErr && err != nil { + t.Errorf("unexpected error: %v", err) + } + if test.expectErr && err != nil { + continue + } + if !reflect.DeepEqual(obj.(*api.Namespace), test.expected) { + t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*api.Namespace)) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/proxy_server_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/proxy_server_test.go index cdbf3caf3..494b926cc 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/proxy_server_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/proxy_server_test.go @@ -205,7 +205,8 @@ func TestFileServing(t *testing.T) { const prefix = "/foo/" handler := newFileHandler(prefix, dir) server := httptest.NewServer(handler) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() url := server.URL + prefix + fname res, err := http.Get(url) @@ -235,7 +236,8 @@ func TestAPIRequests(t *testing.T) { } fmt.Fprintf(w, "%s %s %s", r.Method, r.RequestURI, string(b)) })) - defer ts.Close() + // TODO: Uncomment when fix #19254 + // defer ts.Close() // httptest.NewServer should always generate a valid URL. target, _ := url.Parse(ts.URL) @@ -271,7 +273,8 @@ func TestPathHandling(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, r.URL.Path) })) - defer ts.Close() + // TODO: Uncomment when fix #19254 + // defer ts.Close() table := []struct { prefix string @@ -301,7 +304,8 @@ func TestPathHandling(t *testing.T) { t.Fatalf("%#v: %v", item, err) } pts := httptest.NewServer(p.handler) - defer pts.Close() + // TODO: Uncomment when fix #19254 + // defer pts.Close() r, err := http.Get(pts.URL + item.reqPath) if err != nil { diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/builder.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/builder.go index 8a898100f..61b0f1131 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/builder.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/builder.go @@ -25,6 +25,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/validation" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" @@ -32,7 +33,8 @@ import ( "k8s.io/kubernetes/pkg/util/sets" ) -var FileExtensions = []string{".json", ".stdin", ".yaml", ".yml"} +var FileExtensions = []string{".json", ".yaml", ".yml"} +var InputExtensions = append(FileExtensions, "stdin") // Builder provides convenience functions for taking arguments and parameters // from the command line and converting them to a list of resources to iterate @@ -67,6 +69,8 @@ type Builder struct { singleResourceType bool continueOnError bool + export bool + schema validation.Schema } @@ -76,9 +80,9 @@ type resourceTuple struct { } // NewBuilder creates a builder that operates on generic objects. -func NewBuilder(mapper meta.RESTMapper, typer runtime.ObjectTyper, clientMapper ClientMapper) *Builder { +func NewBuilder(mapper meta.RESTMapper, typer runtime.ObjectTyper, clientMapper ClientMapper, decoder runtime.Decoder) *Builder { return &Builder{ - mapper: &Mapper{typer, mapper, clientMapper}, + mapper: &Mapper{typer, mapper, clientMapper, decoder}, requireObject: true, } } @@ -186,12 +190,12 @@ func (b *Builder) ResourceTypes(types ...string) *Builder { return b } -// ResourceNames accepts a default type or group/type and one or more names, and creates tuples of +// ResourceNames accepts a default type and one or more names, and creates tuples of // resources func (b *Builder) ResourceNames(resource string, names ...string) *Builder { for _, name := range names { - // See if this input string is of type/name or group/type/name format - tuple, ok, err := splitGroupResourceTypeName(name) + // See if this input string is of type/name format + tuple, ok, err := splitResourceTypeName(name) if err != nil { b.errs = append(b.errs, err) return b @@ -233,6 +237,12 @@ func (b *Builder) Selector(selector labels.Selector) *Builder { return b } +// ExportParam accepts the export boolean for these resources +func (b *Builder) ExportParam(export bool) *Builder { + b.export = export + return b +} + // NamespaceParam accepts the namespace that these resources should be // considered under from - used by DefaultNamespace() and RequireNamespace() func (b *Builder) NamespaceParam(namespace string) *Builder { @@ -274,71 +284,20 @@ func (b *Builder) SelectAllParam(selectAll bool) *Builder { return b } -func (b *Builder) hasNamesArg(args []string) bool { - if len(args) > 1 { - return true - } - if len(args) != 1 { - return false - } - // the first (and the only) arg could be (type[,group/type]), type/name, or group/type/name - s := args[0] - // type or group/type (no name) - if strings.Contains(s, ",") { - return false - } - // type (no name) - if !strings.Contains(s, "/") { - return false - } - // group/type/name, type/name or group/type - tuple := strings.Split(s, "/") - if len(tuple) != 3 && !b.mapper.ResourceIsValid(tuple[0]) { - // TODO: prints warning/error message here when tuple[0] may be resource or group (name duplication)? - return false - } - return true -} - -func getResource(groupResource string) string { - if strings.Contains(groupResource, "/") { - return strings.Split(groupResource, "/")[1] - } - return groupResource -} - -// ResourceTypeOrNameArgs indicates that the builder should accept arguments of the form -// `([,,...] [[ ...]]|/ [/...]|)` -// When one argument is received, the types provided will be retrieved from the server (and be comma delimited). +// ResourceTypeOrNameArgs indicates that the builder should accept arguments +// of the form `([,,...]| [,,...])`. When one argument is +// received, the types provided will be retrieved from the server (and be comma delimited). +// When two or more arguments are received, they must be a single type and resource name(s). // The allowEmptySelector permits to select all the resources (via Everything func). -// = (/ | ) func (b *Builder) ResourceTypeOrNameArgs(allowEmptySelector bool, args ...string) *Builder { - hasNames := b.hasNamesArg(args) - - // convert multiple resources to resource tuples, a,b,c d as a transform to a/d b/d c/d - if len(args) >= 2 { - resources := []string{} - resources = append(resources, SplitResourceArgument(args[0])...) - if len(resources) > 1 { - names := []string{} - names = append(names, args[1:]...) - newArgs := []string{} - for _, resource := range resources { - for _, name := range names { - newArgs = append(newArgs, strings.Join([]string{resource, name}, "/")) - } - } - args = newArgs - } - } - - if ok, err := hasCombinedTypeArgs(args); ok && hasNames { + args = normalizeMultipleResourcesArgs(args) + if ok, err := hasCombinedTypeArgs(args); ok { if err != nil { b.errs = append(b.errs, err) return b } for _, s := range args { - tuple, ok, err := splitGroupResourceTypeName(s) + tuple, ok, err := splitResourceTypeName(s) if err != nil { b.errs = append(b.errs, err) return b @@ -377,7 +336,7 @@ func (b *Builder) ResourceTypeOrNameArgs(allowEmptySelector bool, args ...string func (b *Builder) replaceAliases(input string) string { replaced := []string{} for _, arg := range strings.Split(input, ",") { - if aliases, ok := b.mapper.AliasesForResource(getResource(arg)); ok { + if aliases, ok := b.mapper.AliasesForResource(arg); ok { arg = strings.Join(aliases, ",") } replaced = append(replaced, arg) @@ -395,31 +354,32 @@ func hasCombinedTypeArgs(args []string) (bool, error) { switch { case hasSlash > 0 && hasSlash == len(args): return true, nil + case hasSlash > 0 && hasSlash != len(args): + return true, fmt.Errorf("when passing arguments in resource/name form, all arguments must include the resource") default: return false, nil } } -// splitGroupResourceTypeName handles group/type/name resource formats and returns a resource tuple -// (empty or not), whether it successfully found one, and an error -func splitGroupResourceTypeName(s string) (resourceTuple, bool, error) { - if !strings.Contains(s, "/") { - return resourceTuple{}, false, nil +// Normalize args convert multiple resources to resource tuples, a,b,c d +// as a transform to a/d b/d c/d +func normalizeMultipleResourcesArgs(args []string) []string { + if len(args) >= 2 { + resources := []string{} + resources = append(resources, SplitResourceArgument(args[0])...) + if len(resources) > 1 { + names := []string{} + names = append(names, args[1:]...) + newArgs := []string{} + for _, resource := range resources { + for _, name := range names { + newArgs = append(newArgs, strings.Join([]string{resource, name}, "/")) + } + } + return newArgs + } } - seg := strings.Split(s, "/") - if len(seg) != 2 && len(seg) != 3 { - return resourceTuple{}, false, fmt.Errorf("arguments in group/resource/name form may not have more than two slashes") - } - resource, name := "", "" - if len(seg) == 2 { - resource, name = seg[0], seg[1] - } else { - resource, name = fmt.Sprintf("%s/%s", seg[0], seg[1]), seg[2] - } - if len(resource) == 0 || len(name) == 0 || len(SplitResourceArgument(resource)) != 1 { - return resourceTuple{}, false, fmt.Errorf("arguments in group/resource/name form must have a single resource and name") - } - return resourceTuple{Resource: resource, Name: name}, true, nil + return args } // splitResourceTypeName handles type/name resource formats and returns a resource tuple @@ -480,11 +440,11 @@ func (b *Builder) resourceMappings() ([]*meta.RESTMapping, error) { } mappings := []*meta.RESTMapping{} for _, r := range b.resources { - version, kind, err := b.mapper.VersionAndKindForResource(r) + gvk, err := b.mapper.KindFor(unversioned.GroupVersionResource{Resource: r}) if err != nil { return nil, err } - mapping, err := b.mapper.RESTMapping(kind, version) + mapping, err := b.mapper.RESTMapping(gvk.GroupKind(), gvk.Version) if err != nil { return nil, err } @@ -500,11 +460,11 @@ func (b *Builder) resourceTupleMappings() (map[string]*meta.RESTMapping, error) if _, ok := mappings[r.Resource]; ok { continue } - version, kind, err := b.mapper.VersionAndKindForResource(r.Resource) + gvk, err := b.mapper.KindFor(unversioned.GroupVersionResource{Resource: r.Resource}) if err != nil { return nil, err } - mapping, err := b.mapper.RESTMapping(kind, version) + mapping, err := b.mapper.RESTMapping(gvk.GroupKind(), gvk.Version) if err != nil { return nil, err } @@ -561,7 +521,7 @@ func (b *Builder) visitorResult() *Result { if mapping.Scope.Name() != meta.RESTScopeNameNamespace { selectorNamespace = "" } - visitors = append(visitors, NewSelector(client, mapping, selectorNamespace, b.selector)) + visitors = append(visitors, NewSelector(client, mapping, selectorNamespace, b.selector, b.export)) } if b.continueOnError { return &Result{visitor: EagerVisitorList(visitors), sources: visitors} @@ -587,7 +547,7 @@ func (b *Builder) visitorResult() *Result { } clients := make(map[string]RESTClient) for _, mapping := range mappings { - s := fmt.Sprintf("%s/%s", mapping.APIVersion, mapping.Resource) + s := fmt.Sprintf("%s/%s", mapping.GroupVersionKind.GroupVersion().String(), mapping.Resource) if _, ok := clients[s]; ok { continue } @@ -604,7 +564,7 @@ func (b *Builder) visitorResult() *Result { if !ok { return &Result{singular: isSingular, err: fmt.Errorf("resource %q is not recognized: %v", tuple.Resource, mappings)} } - s := fmt.Sprintf("%s/%s", mapping.APIVersion, mapping.Resource) + s := fmt.Sprintf("%s/%s", mapping.GroupVersionKind.GroupVersion().String(), mapping.Resource) client, ok := clients[s] if !ok { return &Result{singular: isSingular, err: fmt.Errorf("could not find a client for resource %q", tuple.Resource)} @@ -619,7 +579,7 @@ func (b *Builder) visitorResult() *Result { } } - info := NewInfo(client, mapping, selectorNamespace, tuple.Name) + info := NewInfo(client, mapping, selectorNamespace, tuple.Name, b.export) items = append(items, info) } @@ -668,7 +628,7 @@ func (b *Builder) visitorResult() *Result { visitors := []Visitor{} for _, name := range b.names { - info := NewInfo(client, mapping, selectorNamespace, name) + info := NewInfo(client, mapping, selectorNamespace, name, b.export) visitors = append(visitors, info) } return &Result{singular: isSingular, visitor: VisitorList(visitors), sources: visitors} @@ -703,7 +663,7 @@ func (b *Builder) visitorResult() *Result { return &Result{singular: singular, visitor: visitors, sources: b.paths} } - return &Result{err: fmt.Errorf("you must provide one or more resources by argument or filename (%s)", strings.Join(FileExtensions, "|"))} + return &Result{err: fmt.Errorf("you must provide one or more resources by argument or filename (%s)", strings.Join(InputExtensions, "|"))} } // Do returns a Result object with a Visitor for the resources identified by the Builder. @@ -750,3 +710,13 @@ func SplitResourceArgument(arg string) []string { } return out } + +// HasNames returns true if the provided args contain resource names +func HasNames(args []string) (bool, error) { + args = normalizeMultipleResourcesArgs(args) + hasCombinedTypes, err := hasCombinedTypeArgs(args) + if err != nil { + return false, err + } + return hasCombinedTypes || len(args) > 1, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/builder_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/builder_test.go index 5f7d839e9..1fad662b6 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/builder_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/builder_test.go @@ -34,6 +34,7 @@ import ( "k8s.io/kubernetes/pkg/api/testapi" apitesting "k8s.io/kubernetes/pkg/api/testing" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/unversioned/fake" "k8s.io/kubernetes/pkg/runtime" utilerrors "k8s.io/kubernetes/pkg/util/errors" @@ -64,7 +65,7 @@ func fakeClientWith(testName string, t *testing.T, data map[string]string) Clien return ClientMapperFunc(func(*meta.RESTMapping) (RESTClient, error) { return &fake.RESTClient{ Codec: testapi.Default.Codec(), - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { p := req.URL.Path q := req.URL.RawQuery if len(q) != 0 { @@ -177,9 +178,9 @@ func (v *testVisitor) Objects() []runtime.Object { return objects } -func TestPathBuilder(t *testing.T) { - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). - FilenameParam(false, "../../../examples/guestbook/redis-master-controller.yaml") +func TestPathBuilderAndVersionedObjectNotDefaulted(t *testing.T) { + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). + FilenameParam(false, "../../../docs/user-guide/update-demo/kitten-rc.yaml") test := &testVisitor{} singular := false @@ -190,9 +191,14 @@ func TestPathBuilder(t *testing.T) { } info := test.Infos[0] - if info.Name != "redis-master" || info.Namespace != "" || info.Object == nil { + if info.Name != "update-demo-kitten" || info.Namespace != "" || info.Object == nil { t.Errorf("unexpected info: %#v", info) } + version, ok := info.VersionedObject.(*v1.ReplicationController) + // versioned object does not have defaulting applied + if info.VersionedObject == nil || !ok || version.Spec.Replicas != nil { + t.Errorf("unexpected versioned object: %#v", info.VersionedObject) + } } func TestNodeBuilder(t *testing.T) { @@ -212,7 +218,7 @@ func TestNodeBuilder(t *testing.T) { w.Write([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), node))) }() - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). NamespaceParam("test").Stream(r, "STDIN") test := &testVisitor{} @@ -228,7 +234,7 @@ func TestNodeBuilder(t *testing.T) { } func TestPathBuilderWithMultiple(t *testing.T) { - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). FilenameParam(false, "../../../examples/guestbook/redis-master-controller.yaml"). FilenameParam(false, "../../../examples/pod"). NamespaceParam("test").DefaultNamespace() @@ -252,7 +258,7 @@ func TestPathBuilderWithMultiple(t *testing.T) { } func TestDirectoryBuilder(t *testing.T) { - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). FilenameParam(false, "../../../examples/guestbook"). NamespaceParam("test").DefaultNamespace() @@ -280,9 +286,10 @@ func TestNamespaceOverride(t *testing.T) { w.WriteHeader(http.StatusOK) w.Write([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: "foo", Name: "test"}}))) })) - defer s.Close() + // TODO: Uncomment when fix #19254 + // defer s.Close() - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). FilenameParam(false, s.URL). NamespaceParam("test") @@ -293,7 +300,7 @@ func TestNamespaceOverride(t *testing.T) { t.Fatalf("unexpected response: %v %#v", err, test.Infos) } - b = NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b = NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). FilenameParam(true, s.URL). NamespaceParam("test") @@ -310,9 +317,10 @@ func TestURLBuilder(t *testing.T) { w.WriteHeader(http.StatusOK) w.Write([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: "foo", Name: "test"}}))) })) - defer s.Close() + // TODO: Uncomment when fix #19254 + // defer s.Close() - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). FilenameParam(false, s.URL). NamespaceParam("test") @@ -334,9 +342,10 @@ func TestURLBuilderRequireNamespace(t *testing.T) { w.WriteHeader(http.StatusOK) w.Write([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: "foo", Name: "test"}}))) })) - defer s.Close() + // TODO: Uncomment when fix #19254 + // defer s.Close() - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). FilenameParam(false, s.URL). NamespaceParam("test").RequireNamespace() @@ -353,7 +362,7 @@ func TestResourceByName(t *testing.T) { pods, _ := testData() b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith("", t, map[string]string{ "/namespaces/test/pods/foo": runtime.EncodeOrDie(testapi.Default.Codec(), &pods.Items[0]), - })). + }), testapi.Default.Codec()). NamespaceParam("test") test := &testVisitor{} @@ -389,7 +398,7 @@ func TestMultipleResourceByTheSameName(t *testing.T) { "/namespaces/test/pods/baz": runtime.EncodeOrDie(testapi.Default.Codec(), &pods.Items[1]), "/namespaces/test/services/foo": runtime.EncodeOrDie(testapi.Default.Codec(), &svcs.Items[0]), "/namespaces/test/services/baz": runtime.EncodeOrDie(testapi.Default.Codec(), &svcs.Items[0]), - })). + }), testapi.Default.Codec()). NamespaceParam("test") test := &testVisitor{} @@ -419,7 +428,7 @@ func TestResourceNames(t *testing.T) { b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith("", t, map[string]string{ "/namespaces/test/pods/foo": runtime.EncodeOrDie(testapi.Default.Codec(), &pods.Items[0]), "/namespaces/test/services/baz": runtime.EncodeOrDie(testapi.Default.Codec(), &svc.Items[0]), - })). + }), testapi.Default.Codec()). NamespaceParam("test") test := &testVisitor{} @@ -443,7 +452,7 @@ func TestResourceNames(t *testing.T) { } func TestResourceByNameWithoutRequireObject(t *testing.T) { - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith("", t, map[string]string{})). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith("", t, map[string]string{}), testapi.Default.Codec()). NamespaceParam("test") test := &testVisitor{} @@ -470,7 +479,7 @@ func TestResourceByNameWithoutRequireObject(t *testing.T) { if err != nil { t.Fatalf("unexpected error: %v", err) } - if mapping.Kind != "Pod" || mapping.Resource != "pods" { + if mapping.GroupVersionKind.Kind != "Pod" || mapping.Resource != "pods" { t.Errorf("unexpected resource mapping: %#v", mapping) } } @@ -479,7 +488,7 @@ func TestResourceByNameAndEmptySelector(t *testing.T) { pods, _ := testData() b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith("", t, map[string]string{ "/namespaces/test/pods/foo": runtime.EncodeOrDie(testapi.Default.Codec(), &pods.Items[0]), - })). + }), testapi.Default.Codec()). NamespaceParam("test"). SelectorParam(""). ResourceTypeOrNameArgs(true, "pods", "foo") @@ -504,11 +513,11 @@ func TestResourceByNameAndEmptySelector(t *testing.T) { func TestSelector(t *testing.T) { pods, svc := testData() - labelKey := unversioned.LabelSelectorQueryParam(testapi.Default.Version()) + labelKey := unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()) b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith("", t, map[string]string{ "/namespaces/test/pods?" + labelKey + "=a%3Db": runtime.EncodeOrDie(testapi.Default.Codec(), pods), "/namespaces/test/services?" + labelKey + "=a%3Db": runtime.EncodeOrDie(testapi.Default.Codec(), svc), - })). + }), testapi.Default.Codec()). SelectorParam("a=b"). NamespaceParam("test"). Flatten() @@ -536,7 +545,7 @@ func TestSelector(t *testing.T) { } func TestSelectorRequiresKnownTypes(t *testing.T) { - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). SelectorParam("a=b"). NamespaceParam("test"). ResourceTypes("unknown") @@ -547,7 +556,7 @@ func TestSelectorRequiresKnownTypes(t *testing.T) { } func TestSingleResourceType(t *testing.T) { - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). SelectorParam("a=b"). SingleResourceType(). ResourceTypeOrNameArgs(true, "pods,services") @@ -557,112 +566,6 @@ func TestSingleResourceType(t *testing.T) { } } -func TestHasNamesArg(t *testing.T) { - testCases := map[string]struct { - args []string - expected bool - }{ - "resource/name": { - args: []string{"pods/foo"}, - expected: true, - }, - "resource name": { - args: []string{"pods", "foo"}, - expected: true, - }, - "resource1,resource2 name": { - args: []string{"pods,rc", "foo"}, - expected: true, - }, - "resource1,group2/resource2 name": { - args: []string{"pods,experimental/deployments", "foo"}, - expected: true, - }, - "group/resource name": { - args: []string{"experimental/deployments", "foo"}, - expected: true, - }, - "group/resource/name": { - args: []string{"experimental/deployments/foo"}, - expected: true, - }, - "group1/resource1,group2/resource2": { - args: []string{"experimental/daemonsets,experimental/deployments"}, - expected: false, - }, - "resource1,group2/resource2": { - args: []string{"pods,experimental/deployments"}, - expected: false, - }, - "group/resource/name,group2/resource2": { - args: []string{"experimental/deployments/foo,controller/deamonset"}, - expected: false, - }, - } - for k, testCase := range testCases { - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()) - if testCase.expected != b.hasNamesArg(testCase.args) { - t.Errorf("%s: unexpected argument - expected: %v", k, testCase.expected) - } - } -} - -func TestSplitGroupResourceTypeName(t *testing.T) { - expectNoErr := func(err error) bool { return err == nil } - expectErr := func(err error) bool { return err != nil } - testCases := map[string]struct { - arg string - expectedTuple resourceTuple - expectedOK bool - errFn func(error) bool - }{ - "group/type/name": { - arg: "experimental/deployments/foo", - expectedTuple: resourceTuple{Resource: "experimental/deployments", Name: "foo"}, - expectedOK: true, - errFn: expectNoErr, - }, - "type/name": { - arg: "pods/foo", - expectedTuple: resourceTuple{Resource: "pods", Name: "foo"}, - expectedOK: true, - errFn: expectNoErr, - }, - "type": { - arg: "pods", - expectedOK: false, - errFn: expectNoErr, - }, - "": { - arg: "", - expectedOK: false, - errFn: expectNoErr, - }, - "/": { - arg: "/", - expectedOK: false, - errFn: expectErr, - }, - "group/type/name/something": { - arg: "experimental/deployments/foo/something", - expectedOK: false, - errFn: expectErr, - }, - } - for k, testCase := range testCases { - tuple, ok, err := splitGroupResourceTypeName(testCase.arg) - if !testCase.errFn(err) { - t.Errorf("%s: unexpected error: %v", k, err) - } - if ok != testCase.expectedOK { - t.Errorf("%s: unexpected ok: %v", k, ok) - } - if testCase.expectedOK && !reflect.DeepEqual(tuple, testCase.expectedTuple) { - t.Errorf("%s: unexpected tuple - expected: %v, got: %v", k, testCase.expectedTuple, tuple) - } - } -} - func TestResourceTuple(t *testing.T) { expectNoErr := func(err error) bool { return err == nil } expectErr := func(err error) bool { return err != nil } @@ -723,7 +626,7 @@ func TestResourceTuple(t *testing.T) { } } - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith(k, t, expectedRequests)). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith(k, t, expectedRequests), testapi.Default.Codec()). NamespaceParam("test").DefaultNamespace(). ResourceTypeOrNameArgs(true, testCase.args...).RequireObject(requireObject) @@ -754,7 +657,7 @@ func TestResourceTuple(t *testing.T) { func TestStream(t *testing.T) { r, pods, rc := streamTestData() - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). NamespaceParam("test").Stream(r, "STDIN").Flatten() test := &testVisitor{} @@ -771,7 +674,7 @@ func TestStream(t *testing.T) { func TestYAMLStream(t *testing.T) { r, pods, rc := streamYAMLTestData() - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). NamespaceParam("test").Stream(r, "STDIN").Flatten() test := &testVisitor{} @@ -788,7 +691,7 @@ func TestYAMLStream(t *testing.T) { func TestMultipleObject(t *testing.T) { r, pods, svc := streamTestData() - obj, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + obj, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). NamespaceParam("test").Stream(r, "STDIN").Flatten(). Do().Object() @@ -810,7 +713,7 @@ func TestMultipleObject(t *testing.T) { func TestContinueOnErrorVisitor(t *testing.T) { r, _, _ := streamTestData() - req := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + req := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). ContinueOnError(). NamespaceParam("test").Stream(r, "STDIN").Flatten(). Do() @@ -839,7 +742,7 @@ func TestContinueOnErrorVisitor(t *testing.T) { } func TestSingularObject(t *testing.T) { - obj, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + obj, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). NamespaceParam("test").DefaultNamespace(). FilenameParam(false, "../../../examples/guestbook/redis-master-controller.yaml"). Flatten(). @@ -859,7 +762,7 @@ func TestSingularObject(t *testing.T) { } func TestSingularObjectNoExtension(t *testing.T) { - obj, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + obj, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). NamespaceParam("test").DefaultNamespace(). FilenameParam(false, "../../../examples/pod"). Flatten(). @@ -881,7 +784,7 @@ func TestSingularObjectNoExtension(t *testing.T) { func TestSingularRootScopedObject(t *testing.T) { node := &api.Node{ObjectMeta: api.ObjectMeta{Name: "test"}, Spec: api.NodeSpec{ExternalID: "test"}} r := streamTestObject(node) - infos, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + infos, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). NamespaceParam("test").DefaultNamespace(). Stream(r, "STDIN"). Flatten(). @@ -905,10 +808,10 @@ func TestSingularRootScopedObject(t *testing.T) { func TestListObject(t *testing.T) { pods, _ := testData() - labelKey := unversioned.LabelSelectorQueryParam(testapi.Default.Version()) + labelKey := unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()) b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith("", t, map[string]string{ "/namespaces/test/pods?" + labelKey + "=a%3Db": runtime.EncodeOrDie(testapi.Default.Codec(), pods), - })). + }), testapi.Default.Codec()). SelectorParam("a=b"). NamespaceParam("test"). ResourceTypeOrNameArgs(true, "pods"). @@ -938,11 +841,11 @@ func TestListObject(t *testing.T) { func TestListObjectWithDifferentVersions(t *testing.T) { pods, svc := testData() - labelKey := unversioned.LabelSelectorQueryParam(testapi.Default.Version()) + labelKey := unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String()) obj, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClientWith("", t, map[string]string{ "/namespaces/test/pods?" + labelKey + "=a%3Db": runtime.EncodeOrDie(testapi.Default.Codec(), pods), "/namespaces/test/services?" + labelKey + "=a%3Db": runtime.EncodeOrDie(testapi.Default.Codec(), svc), - })). + }), testapi.Default.Codec()). SelectorParam("a=b"). NamespaceParam("test"). ResourceTypeOrNameArgs(true, "pods,services"). @@ -970,7 +873,7 @@ func TestWatch(t *testing.T) { Type: watch.Added, Object: &svc.Items[0], }), - })). + }), testapi.Default.Codec()). NamespaceParam("test").DefaultNamespace(). FilenameParam(false, "../../../examples/guestbook/redis-master-service.yaml").Flatten(). Do().Watch("12") @@ -997,7 +900,7 @@ func TestWatch(t *testing.T) { } func TestWatchMultipleError(t *testing.T) { - _, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + _, err := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). NamespaceParam("test").DefaultNamespace(). FilenameParam(false, "../../../examples/guestbook/redis-master-controller.yaml").Flatten(). FilenameParam(false, "../../../examples/guestbook/redis-master-controller.yaml").Flatten(). @@ -1024,7 +927,7 @@ func TestLatest(t *testing.T) { "/namespaces/test/pods/foo": runtime.EncodeOrDie(testapi.Default.Codec(), newPod), "/namespaces/test/pods/bar": runtime.EncodeOrDie(testapi.Default.Codec(), newPod2), "/namespaces/test/services/baz": runtime.EncodeOrDie(testapi.Default.Codec(), newSvc), - })). + }), testapi.Default.Codec()). NamespaceParam("other").Stream(r, "STDIN").Flatten().Latest() test := &testVisitor{} @@ -1056,7 +959,7 @@ func TestReceiveMultipleErrors(t *testing.T) { w2.Write([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &svc.Items[0]))) }() - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()). + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()). Stream(r, "1").Stream(r2, "2"). ContinueOnError() @@ -1100,7 +1003,7 @@ func TestReplaceAliases(t *testing.T) { }, } - b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient()) + b := NewBuilder(testapi.Default.RESTMapper(), api.Scheme, fakeClient(), testapi.Default.Codec()) for _, test := range tests { replaced := b.replaceAliases(test.arg) @@ -1109,3 +1012,61 @@ func TestReplaceAliases(t *testing.T) { } } } + +func TestHasNames(t *testing.T) { + tests := []struct { + args []string + expectedHasName bool + expectedError error + }{ + { + args: []string{""}, + expectedHasName: false, + expectedError: nil, + }, + { + args: []string{"rc"}, + expectedHasName: false, + expectedError: nil, + }, + { + args: []string{"rc,pod,svc"}, + expectedHasName: false, + expectedError: nil, + }, + { + args: []string{"rc/foo"}, + expectedHasName: true, + expectedError: nil, + }, + { + args: []string{"rc", "foo"}, + expectedHasName: true, + expectedError: nil, + }, + { + args: []string{"rc,pod,svc", "foo"}, + expectedHasName: true, + expectedError: nil, + }, + { + args: []string{"rc/foo", "rc/bar", "rc/zee"}, + expectedHasName: true, + expectedError: nil, + }, + { + args: []string{"rc/foo", "bar"}, + expectedHasName: false, + expectedError: fmt.Errorf("when passing arguments in resource/name form, all arguments must include the resource"), + }, + } + for _, test := range tests { + hasNames, err := HasNames(test.args) + if !reflect.DeepEqual(test.expectedError, err) { + t.Errorf("expected HasName to error %v, got %s", test.expectedError, err) + } + if hasNames != test.expectedHasName { + t.Errorf("expected HasName to return %v for %s", test.expectedHasName, test.args) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/helper.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/helper.go index 4af6c8272..fcce5b0ca 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/helper.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/helper.go @@ -17,6 +17,8 @@ limitations under the License. package resource import ( + "strconv" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/labels" @@ -31,8 +33,6 @@ type Helper struct { Resource string // A RESTClient capable of mutating this resource. RESTClient RESTClient - // A codec for decoding and encoding objects of this resource type. - Codec runtime.Codec // An interface for reading or writing the resource version of this // type. Versioner runtime.ResourceVersioner @@ -43,31 +43,34 @@ type Helper struct { // NewHelper creates a Helper from a ResourceMapping func NewHelper(client RESTClient, mapping *meta.RESTMapping) *Helper { return &Helper{ - RESTClient: client, Resource: mapping.Resource, - Codec: mapping.Codec, + RESTClient: client, Versioner: mapping.MetadataAccessor, NamespaceScoped: mapping.Scope.Name() == meta.RESTScopeNameNamespace, } } -func (m *Helper) Get(namespace, name string) (runtime.Object, error) { - return m.RESTClient.Get(). +func (m *Helper) Get(namespace, name string, export bool) (runtime.Object, error) { + req := m.RESTClient.Get(). NamespaceIfScoped(namespace, m.NamespaceScoped). Resource(m.Resource). - Name(name). - Do(). - Get() + Name(name) + if export { + req.Param("export", strconv.FormatBool(export)) + } + return req.Do().Get() } // TODO: add field selector -func (m *Helper) List(namespace, apiVersion string, selector labels.Selector) (runtime.Object, error) { - return m.RESTClient.Get(). +func (m *Helper) List(namespace, apiVersion string, selector labels.Selector, export bool) (runtime.Object, error) { + req := m.RESTClient.Get(). NamespaceIfScoped(namespace, m.NamespaceScoped). Resource(m.Resource). - LabelsSelectorParam(selector). - Do(). - Get() + LabelsSelectorParam(selector) + if export { + req.Param("export", strconv.FormatBool(export)) + } + return req.Do().Get() } func (m *Helper) Watch(namespace, resourceVersion, apiVersion string, labelSelector labels.Selector) (watch.Interface, error) { @@ -99,37 +102,26 @@ func (m *Helper) Delete(namespace, name string) error { Error() } -func (m *Helper) Create(namespace string, modify bool, data []byte) (runtime.Object, error) { +func (m *Helper) Create(namespace string, modify bool, obj runtime.Object) (runtime.Object, error) { if modify { - obj, err := m.Codec.Decode(data) - if err != nil { - // We don't know how to check a version on this object, but create it anyway - return m.createResource(m.RESTClient, m.Resource, namespace, data) - } - // Attempt to version the object based on client logic. version, err := m.Versioner.ResourceVersion(obj) if err != nil { // We don't know how to clear the version on this object, so send it to the server as is - return m.createResource(m.RESTClient, m.Resource, namespace, data) + return m.createResource(m.RESTClient, m.Resource, namespace, obj) } if version != "" { if err := m.Versioner.SetResourceVersion(obj, ""); err != nil { return nil, err } - newData, err := m.Codec.Encode(obj) - if err != nil { - return nil, err - } - data = newData } } - return m.createResource(m.RESTClient, m.Resource, namespace, data) + return m.createResource(m.RESTClient, m.Resource, namespace, obj) } -func (m *Helper) createResource(c RESTClient, resource, namespace string, data []byte) (runtime.Object, error) { - return c.Post().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Body(data).Do().Get() +func (m *Helper) createResource(c RESTClient, resource, namespace string, obj runtime.Object) (runtime.Object, error) { + return c.Post().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Body(obj).Do().Get() } func (m *Helper) Patch(namespace, name string, pt api.PatchType, data []byte) (runtime.Object, error) { return m.RESTClient.Patch(pt). @@ -141,27 +133,21 @@ func (m *Helper) Patch(namespace, name string, pt api.PatchType, data []byte) (r Get() } -func (m *Helper) Replace(namespace, name string, overwrite bool, data []byte) (runtime.Object, error) { +func (m *Helper) Replace(namespace, name string, overwrite bool, obj runtime.Object) (runtime.Object, error) { c := m.RESTClient - obj, err := m.Codec.Decode(data) - if err != nil { - // We don't know how to handle this object, but replace it anyway - return m.replaceResource(c, m.Resource, namespace, name, data) - } - // Attempt to version the object based on client logic. version, err := m.Versioner.ResourceVersion(obj) if err != nil { // We don't know how to version this object, so send it to the server as is - return m.replaceResource(c, m.Resource, namespace, name, data) + return m.replaceResource(c, m.Resource, namespace, name, obj) } if version == "" && overwrite { // Retrieve the current version of the object to overwrite the server object serverObj, err := c.Get().Namespace(namespace).Resource(m.Resource).Name(name).Do().Get() if err != nil { // The object does not exist, but we want it to be created - return m.replaceResource(c, m.Resource, namespace, name, data) + return m.replaceResource(c, m.Resource, namespace, name, obj) } serverVersion, err := m.Versioner.ResourceVersion(serverObj) if err != nil { @@ -170,16 +156,11 @@ func (m *Helper) Replace(namespace, name string, overwrite bool, data []byte) (r if err := m.Versioner.SetResourceVersion(obj, serverVersion); err != nil { return nil, err } - newData, err := m.Codec.Encode(obj) - if err != nil { - return nil, err - } - data = newData } - return m.replaceResource(c, m.Resource, namespace, name, data) + return m.replaceResource(c, m.Resource, namespace, name, obj) } -func (m *Helper) replaceResource(c RESTClient, resource, namespace, name string, data []byte) (runtime.Object, error) { - return c.Put().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Name(name).Body(data).Do().Get() +func (m *Helper) replaceResource(c RESTClient, resource, namespace, name string, obj runtime.Object) (runtime.Object, error) { + return c.Put().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Name(name).Body(obj).Do().Get() } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/helper_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/helper_test.go index 8566f3c68..541daf880 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/helper_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/helper_test.go @@ -131,11 +131,10 @@ func TestHelperCreate(t *testing.T) { } tests := []struct { - Resp *http.Response - RespFunc fake.HTTPClientFunc - HttpErr error - Modify bool - Object runtime.Object + Resp *http.Response + HttpErr error + Modify bool + Object runtime.Object ExpectObject runtime.Object Err bool @@ -170,7 +169,10 @@ func TestHelperCreate(t *testing.T) { }, { Modify: true, - Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}}, + Object: &api.Pod{ + ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}, + Spec: apitesting.DeepEqualSafePodSpec(), + }, ExpectObject: &api.Pod{ ObjectMeta: api.ObjectMeta{Name: "foo"}, Spec: apitesting.DeepEqualSafePodSpec(), @@ -185,20 +187,12 @@ func TestHelperCreate(t *testing.T) { Resp: test.Resp, Err: test.HttpErr, } - if test.RespFunc != nil { - client.Client = test.RespFunc - } modifier := &Helper{ RESTClient: client, - Codec: testapi.Default.Codec(), Versioner: testapi.Default.MetadataAccessor(), NamespaceScoped: true, } - data := []byte{} - if test.Object != nil { - data = []byte(runtime.EncodeOrDie(testapi.Default.Codec(), test.Object)) - } - _, err := modifier.Create("bar", test.Modify, data) + _, err := modifier.Create("bar", test.Modify, test.Object) if (err != nil) != test.Err { t.Errorf("%d: unexpected error: %t %v", i, test.Err, err) } @@ -218,7 +212,7 @@ func TestHelperCreate(t *testing.T) { expect = []byte(runtime.EncodeOrDie(testapi.Default.Codec(), test.ExpectObject)) } if !reflect.DeepEqual(expect, body) { - t.Errorf("%d: unexpected body: %s", i, string(body)) + t.Errorf("%d: unexpected body: %s (expected %s)", i, string(body), string(expect)) } } @@ -275,7 +269,7 @@ func TestHelperGet(t *testing.T) { RESTClient: client, NamespaceScoped: true, } - obj, err := modifier.Get("bar", "foo") + obj, err := modifier.Get("bar", "foo", false) if (err != nil) != test.Err { t.Errorf("unexpected error: %t %v", test.Err, err) } @@ -328,7 +322,7 @@ func TestHelperList(t *testing.T) { t.Errorf("url doesn't contain name: %#v", req.URL) return false } - if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != labels.SelectorFromSet(labels.Set{"foo": "baz"}).String() { + if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.GroupVersion().String())) != labels.SelectorFromSet(labels.Set{"foo": "baz"}).String() { t.Errorf("url doesn't contain query parameters: %#v", req.URL) return false } @@ -346,7 +340,7 @@ func TestHelperList(t *testing.T) { RESTClient: client, NamespaceScoped: true, } - obj, err := modifier.List("bar", testapi.Default.Version(), labels.SelectorFromSet(labels.Set{"foo": "baz"})) + obj, err := modifier.List("bar", testapi.Default.GroupVersion().String(), labels.SelectorFromSet(labels.Set{"foo": "baz"}), false) if (err != nil) != test.Err { t.Errorf("unexpected error: %t %v", test.Err, err) } @@ -381,11 +375,11 @@ func TestHelperReplace(t *testing.T) { } tests := []struct { - Resp *http.Response - RespFunc fake.HTTPClientFunc - HttpErr error - Overwrite bool - Object runtime.Object + Resp *http.Response + HTTPClient *http.Client + HttpErr error + Overwrite bool + Object runtime.Object ExpectObject runtime.Object Err bool @@ -413,18 +407,21 @@ func TestHelperReplace(t *testing.T) { Req: expectPut, }, { - Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}}, + Object: &api.Pod{ + ObjectMeta: api.ObjectMeta{Name: "foo"}, + Spec: apitesting.DeepEqualSafePodSpec(), + }, ExpectObject: &api.Pod{ ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}, Spec: apitesting.DeepEqualSafePodSpec(), }, Overwrite: true, - RespFunc: func(req *http.Request) (*http.Response, error) { + HTTPClient: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { if req.Method == "PUT" { return &http.Response{StatusCode: http.StatusOK, Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess})}, nil } return &http.Response{StatusCode: http.StatusOK, Body: objBody(&api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}})}, nil - }, + }), Req: expectPut, }, { @@ -436,24 +433,17 @@ func TestHelperReplace(t *testing.T) { } for i, test := range tests { client := &fake.RESTClient{ - Codec: testapi.Default.Codec(), - Resp: test.Resp, - Err: test.HttpErr, - } - if test.RespFunc != nil { - client.Client = test.RespFunc + Client: test.HTTPClient, + Codec: testapi.Default.Codec(), + Resp: test.Resp, + Err: test.HttpErr, } modifier := &Helper{ RESTClient: client, - Codec: testapi.Default.Codec(), Versioner: testapi.Default.MetadataAccessor(), NamespaceScoped: true, } - data := []byte{} - if test.Object != nil { - data = []byte(runtime.EncodeOrDie(testapi.Default.Codec(), test.Object)) - } - _, err := modifier.Replace("bar", "foo", test.Overwrite, data) + _, err := modifier.Replace("bar", "foo", test.Overwrite, test.Object) if (err != nil) != test.Err { t.Errorf("%d: unexpected error: %t %v", i, test.Err, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/interfaces.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/interfaces.go index 3d6460998..54d20dfbf 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/interfaces.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/interfaces.go @@ -32,7 +32,7 @@ type RESTClient interface { Put() *client.Request } -// ClientMapper retrieves a client object for a given mapping +// ClientMapper abstracts retrieving a Client for mapped objects. type ClientMapper interface { ClientForMapping(mapping *meta.RESTMapping) (RESTClient, error) } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/mapper.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/mapper.go index a3fc32845..0839ca4a8 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/mapper.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/mapper.go @@ -20,69 +20,63 @@ import ( "fmt" "reflect" - "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" - "k8s.io/kubernetes/pkg/api/registered" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util/yaml" ) +// DisabledClientForMapping allows callers to avoid allowing remote calls when handling +// resources. +type DisabledClientForMapping struct { + ClientMapper +} + +func (f DisabledClientForMapping) ClientForMapping(mapping *meta.RESTMapping) (RESTClient, error) { + return nil, nil +} + // Mapper is a convenience struct for holding references to the three interfaces // needed to create Info for arbitrary objects. type Mapper struct { runtime.ObjectTyper meta.RESTMapper ClientMapper + runtime.Decoder } // InfoForData creates an Info object for the given data. An error is returned // if any of the decoding or client lookup steps fail. Name and namespace will be // set into Info if the mapping's MetadataAccessor can retrieve them. func (m *Mapper) InfoForData(data []byte, source string) (*Info, error) { - json, err := yaml.ToJSON(data) + versions := &runtime.VersionedObjects{} + _, gvk, err := m.Decode(data, nil, versions) if err != nil { - return nil, fmt.Errorf("unable to parse %q: %v", source, err) + return nil, fmt.Errorf("unable to decode %q: %v", source, err) } - data = json - version, kind, err := runtime.UnstructuredJSONScheme.DataVersionAndKind(data) - if err != nil { - return nil, fmt.Errorf("unable to get type info from %q: %v", source, err) - } - if ok := registered.IsRegisteredAPIVersion(version); !ok { - return nil, fmt.Errorf("API version %q in %q isn't supported, only supports API versions %q", version, source, registered.RegisteredVersions) - } - if kind == "" { - return nil, fmt.Errorf("kind not set in %q", source) - } - mapping, err := m.RESTMapping(kind, version) + mapping, err := m.RESTMapping(gvk.GroupKind(), gvk.Version) if err != nil { return nil, fmt.Errorf("unable to recognize %q: %v", source, err) } - obj, err := mapping.Codec.Decode(data) - if err != nil { - return nil, fmt.Errorf("unable to load %q: %v", source, err) - } + client, err := m.ClientForMapping(mapping) if err != nil { return nil, fmt.Errorf("unable to connect to a server to handle %q: %v", mapping.Resource, err) } + // TODO: decoding the version object is convenient, but questionable. This is used by apply + // and rolling-update today, but both of those cases should probably be requesting the raw + // object and performing their own decoding. + obj, versioned := versions.Last(), versions.First() name, _ := mapping.MetadataAccessor.Name(obj) namespace, _ := mapping.MetadataAccessor.Namespace(obj) resourceVersion, _ := mapping.MetadataAccessor.ResourceVersion(obj) - var versionedObject interface{} - - if vo, _, _, err := api.Scheme.Raw().DecodeToVersionedObject(data); err == nil { - versionedObject = vo - } return &Info{ Mapping: mapping, Client: client, Namespace: namespace, Name: name, Source: source, - VersionedObject: versionedObject, + VersionedObject: versioned, Object: obj, ResourceVersion: resourceVersion, }, nil @@ -92,13 +86,13 @@ func (m *Mapper) InfoForData(data []byte, source string) (*Info, error) { // if the object cannot be introspected. Name and namespace will be set into Info // if the mapping's MetadataAccessor can retrieve them. func (m *Mapper) InfoForObject(obj runtime.Object) (*Info, error) { - version, kind, err := m.ObjectVersionAndKind(obj) + groupVersionKind, err := m.ObjectKind(obj) if err != nil { return nil, fmt.Errorf("unable to get type info from the object %q: %v", reflect.TypeOf(obj), err) } - mapping, err := m.RESTMapping(kind, version) + mapping, err := m.RESTMapping(groupVersionKind.GroupKind(), groupVersionKind.Version) if err != nil { - return nil, fmt.Errorf("unable to recognize %q: %v", kind, err) + return nil, fmt.Errorf("unable to recognize %v: %v", groupVersionKind, err) } client, err := m.ClientForMapping(mapping) if err != nil { diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/result.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/result.go index aaf7fd07e..8d726ab7b 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/result.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/result.go @@ -21,9 +21,9 @@ import ( "reflect" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/latest" "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apimachinery/registered" "k8s.io/kubernetes/pkg/runtime" utilerrors "k8s.io/kubernetes/pkg/util/errors" "k8s.io/kubernetes/pkg/util/sets" @@ -138,7 +138,7 @@ func (r *Result) Object() (runtime.Object, error) { return objects[0], nil } // if the item is a list already, don't create another list - if runtime.IsListType(objects[0]) { + if meta.IsListType(objects[0]) { return objects[0], nil } } @@ -210,8 +210,8 @@ func (r *Result) Watch(resourceVersion string) (watch.Interface, error) { // the objects as children, or if only a single Object is present, as that object. The provided // version will be preferred as the conversion target, but the Object's mapping version will be // used if that version is not present. -func AsVersionedObject(infos []*Info, forceList bool, version string) (runtime.Object, error) { - objects, err := AsVersionedObjects(infos, version) +func AsVersionedObject(infos []*Info, forceList bool, version string, encoder runtime.Encoder) (runtime.Object, error) { + objects, err := AsVersionedObjects(infos, version, encoder) if err != nil { return nil, err } @@ -221,7 +221,7 @@ func AsVersionedObject(infos []*Info, forceList bool, version string) (runtime.O object = objects[0] } else { object = &api.List{Items: objects} - converted, err := tryConvert(api.Scheme, object, version, latest.GroupOrDie("").Version) + converted, err := tryConvert(api.Scheme, object, version, registered.GroupOrDie(api.GroupName).GroupVersion.Version) if err != nil { return nil, err } @@ -233,19 +233,21 @@ func AsVersionedObject(infos []*Info, forceList bool, version string) (runtime.O // AsVersionedObjects converts a list of infos into versioned objects. The provided // version will be preferred as the conversion target, but the Object's mapping version will be // used if that version is not present. -func AsVersionedObjects(infos []*Info, version string) ([]runtime.Object, error) { +func AsVersionedObjects(infos []*Info, version string, encoder runtime.Encoder) ([]runtime.Object, error) { objects := []runtime.Object{} for _, info := range infos { if info.Object == nil { continue } + // TODO: use info.VersionedObject as the value? + // objects that are not part of api.Scheme must be converted to JSON // TODO: convert to map[string]interface{}, attach to runtime.Unknown? if len(version) > 0 { - if _, _, err := api.Scheme.ObjectVersionAndKind(info.Object); runtime.IsNotRegisteredError(err) { + if _, err := api.Scheme.ObjectKind(info.Object); runtime.IsNotRegisteredError(err) { // TODO: ideally this would encode to version, but we don't expose multiple codecs here. - data, err := info.Mapping.Codec.Encode(info.Object) + data, err := runtime.Encode(encoder, info.Object) if err != nil { return nil, err } @@ -254,7 +256,7 @@ func AsVersionedObjects(infos []*Info, version string) ([]runtime.Object, error) } } - converted, err := tryConvert(info.Mapping.ObjectConvertor, info.Object, version, info.Mapping.APIVersion) + converted, err := tryConvert(info.Mapping.ObjectConvertor, info.Object, version, info.Mapping.GroupVersionKind.GroupVersion().String()) if err != nil { return nil, err } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/selector.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/selector.go index 75e417f02..047a814ae 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/selector.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/selector.go @@ -31,21 +31,23 @@ type Selector struct { Mapping *meta.RESTMapping Namespace string Selector labels.Selector + Export bool } // NewSelector creates a resource selector which hides details of getting items by their label selector. -func NewSelector(client RESTClient, mapping *meta.RESTMapping, namespace string, selector labels.Selector) *Selector { +func NewSelector(client RESTClient, mapping *meta.RESTMapping, namespace string, selector labels.Selector, export bool) *Selector { return &Selector{ Client: client, Mapping: mapping, Namespace: namespace, Selector: selector, + Export: export, } } // Visit implements Visitor func (r *Selector) Visit(fn VisitorFunc) error { - list, err := NewHelper(r.Client, r.Mapping).List(r.Namespace, r.ResourceMapping().APIVersion, r.Selector) + list, err := NewHelper(r.Client, r.Mapping).List(r.Namespace, r.ResourceMapping().GroupVersionKind.GroupVersion().String(), r.Selector, r.Export) if err != nil { if errors.IsBadRequest(err) || errors.IsNotFound(err) { if r.Selector.Empty() { @@ -70,7 +72,7 @@ func (r *Selector) Visit(fn VisitorFunc) error { } func (r *Selector) Watch(resourceVersion string) (watch.Interface, error) { - return NewHelper(r.Client, r.Mapping).Watch(r.Namespace, resourceVersion, r.ResourceMapping().APIVersion, r.Selector) + return NewHelper(r.Client, r.Mapping).Watch(r.Namespace, resourceVersion, r.ResourceMapping().GroupVersionKind.GroupVersion().String(), r.Selector) } // ResourceMapping returns the mapping for this resource and implements ResourceMapping diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/visitor.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/visitor.go index 79dbe26d7..a187919a4 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource/visitor.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource/visitor.go @@ -85,15 +85,18 @@ type Info struct { // but if set it should be equal to or newer than the resource version of the // object (however the server defines resource version). ResourceVersion string + // Optional, should this resource be exported, stripped of cluster-specific and instance specific fields + Export bool } // NewInfo returns a new info object -func NewInfo(client RESTClient, mapping *meta.RESTMapping, namespace, name string) *Info { +func NewInfo(client RESTClient, mapping *meta.RESTMapping, namespace, name string, export bool) *Info { return &Info{ Client: client, Mapping: mapping, Namespace: namespace, Name: name, + Export: export, } } @@ -103,8 +106,8 @@ func (i *Info) Visit(fn VisitorFunc) error { } // Get retrieves the object from the Namespace and Name fields -func (i *Info) Get() error { - obj, err := NewHelper(i.Client, i.Mapping).Get(i.Namespace, i.Name) +func (i *Info) Get() (err error) { + obj, err := NewHelper(i.Client, i.Mapping).Get(i.Namespace, i.Name, i.Export) if err != nil { return err } @@ -335,14 +338,14 @@ func (v FlattenListVisitor) Visit(fn VisitorFunc) error { if info.Object == nil { return fn(info, nil) } - items, err := runtime.ExtractList(info.Object) + items, err := meta.ExtractList(info.Object) if err != nil { return fn(info, nil) } if errs := runtime.DecodeList(items, struct { runtime.ObjectTyper runtime.Decoder - }{v.Mapper, info.Mapping.Codec}); len(errs) > 0 { + }{v.Mapper, v.Mapper.Decoder}); len(errs) > 0 { return utilerrors.NewAggregate(errs) } for i := range items { @@ -564,7 +567,7 @@ func RetrieveLatest(info *Info, err error) error { if err != nil { return err } - if runtime.IsListType(info.Object) { + if meta.IsListType(info.Object) { return fmt.Errorf("watch is only supported on individual resources and resource collections, but a list of resources is found") } if len(info.Name) == 0 { @@ -573,7 +576,7 @@ func RetrieveLatest(info *Info, err error) error { if info.Namespaced() && len(info.Namespace) == 0 { return fmt.Errorf("no namespace set on resource %s %q", info.Mapping.Resource, info.Name) } - obj, err := NewHelper(info.Client, info.Mapping).Get(info.Namespace, info.Name) + obj, err := NewHelper(info.Client, info.Mapping).Get(info.Namespace, info.Name, info.Export) if err != nil { return err } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource_printer.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource_printer.go index 8752d6e61..d33bb92f0 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource_printer.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource_printer.go @@ -19,7 +19,6 @@ package kubectl import ( "bytes" "encoding/json" - "errors" "fmt" "io" "io/ioutil" @@ -36,11 +35,10 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/unversioned" - "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" + utilerrors "k8s.io/kubernetes/pkg/util/errors" "k8s.io/kubernetes/pkg/util/jsonpath" "k8s.io/kubernetes/pkg/util/sets" ) @@ -66,7 +64,10 @@ func GetPrinter(format, formatArgument string) (ResourcePrinter, bool, error) { case "yaml": printer = &YAMLPrinter{} case "name": - printer = &NamePrinter{} + printer = &NamePrinter{ + Typer: runtime.ObjectTyperToTyper(api.Scheme), + Decoder: api.Codecs.UniversalDecoder(), + } case "template", "go-template": if len(formatArgument) == 0 { return nil, false, fmt.Errorf("template format specified but no template given") @@ -111,7 +112,7 @@ func GetPrinter(format, formatArgument string) (ResourcePrinter, bool, error) { } case "custom-columns": var err error - if printer, err = NewCustomColumnsPrinterFromSpec(formatArgument); err != nil { + if printer, err = NewCustomColumnsPrinterFromSpec(formatArgument, api.Codecs.UniversalDecoder()); err != nil { return nil, false, err } case "custom-columns-file": @@ -119,7 +120,7 @@ func GetPrinter(format, formatArgument string) (ResourcePrinter, bool, error) { if err != nil { return nil, false, fmt.Errorf("error reading template %s, %v\n", formatArgument, err) } - if printer, err = NewCustomColumnsPrinterFromTemplate(file); err != nil { + if printer, err = NewCustomColumnsPrinterFromTemplate(file, api.Codecs.UniversalDecoder()); err != nil { return nil, false, err } case "wide": @@ -157,29 +158,29 @@ func (fn ResourcePrinterFunc) HandledResources() []string { type VersionedPrinter struct { printer ResourcePrinter convertor runtime.ObjectConvertor - version []string + versions []unversioned.GroupVersion } // NewVersionedPrinter wraps a printer to convert objects to a known API version prior to printing. -func NewVersionedPrinter(printer ResourcePrinter, convertor runtime.ObjectConvertor, version ...string) ResourcePrinter { +func NewVersionedPrinter(printer ResourcePrinter, convertor runtime.ObjectConvertor, versions ...unversioned.GroupVersion) ResourcePrinter { return &VersionedPrinter{ printer: printer, convertor: convertor, - version: version, + versions: versions, } } // PrintObj implements ResourcePrinter func (p *VersionedPrinter) PrintObj(obj runtime.Object, w io.Writer) error { - if len(p.version) == 0 { + if len(p.versions) == 0 { return fmt.Errorf("no version specified, object cannot be converted") } - for _, version := range p.version { - if len(version) == 0 { + for _, version := range p.versions { + if version.IsEmpty() { continue } - converted, err := p.convertor.ConvertToVersion(obj, version) - if conversion.IsNotRegisteredError(err) { + converted, err := p.convertor.ConvertToVersion(obj, version.String()) + if runtime.IsNotRegisteredError(err) { continue } if err != nil { @@ -187,7 +188,7 @@ func (p *VersionedPrinter) PrintObj(obj runtime.Object, w io.Writer) error { } return p.printer.PrintObj(converted, w) } - return fmt.Errorf("the object cannot be converted to any of the versions: %v", p.version) + return fmt.Errorf("the object cannot be converted to any of the versions: %v", p.versions) } // TODO: implement HandledResources() @@ -197,49 +198,47 @@ func (p *VersionedPrinter) HandledResources() []string { // NamePrinter is an implementation of ResourcePrinter which outputs "resource/name" pair of an object. type NamePrinter struct { + Decoder runtime.Decoder + Typer runtime.Typer } // PrintObj is an implementation of ResourcePrinter.PrintObj which decodes the object // and print "resource/name" pair. If the object is a List, print all items in it. func (p *NamePrinter) PrintObj(obj runtime.Object, w io.Writer) error { - objvalue := reflect.ValueOf(obj).Elem() - kind := objvalue.FieldByName("Kind") - if !kind.IsValid() { - kind = reflect.ValueOf("") - } - if kind.String() == "List" { - items := objvalue.FieldByName("Items") - if items.Type().String() == "[]runtime.RawExtension" { - for i := 0; i < items.Len(); i++ { - rawObj := items.Index(i).FieldByName("RawJSON").Interface().([]byte) - scheme := api.Scheme - version, kind, err := scheme.DataVersionAndKind(rawObj) - if err != nil { - return err - } - decodedObj, err := scheme.DecodeToVersion(rawObj, "") - if err != nil { - return err - } - tpmeta := unversioned.TypeMeta{ - APIVersion: version, - Kind: kind, - } - s := reflect.ValueOf(decodedObj).Elem() - s.FieldByName("TypeMeta").Set(reflect.ValueOf(tpmeta)) - p.PrintObj(decodedObj, w) - } - } else { - return errors.New("the list object contains unrecognized items.") - } - } else { - name := objvalue.FieldByName("Name") - if !name.IsValid() { - name = reflect.ValueOf("") - } - _, resource := meta.KindToResource(kind.String(), false) + gvk, _, _ := p.Typer.ObjectKind(obj) - fmt.Fprintf(w, "%s/%s\n", resource, name) + if meta.IsListType(obj) { + items, err := meta.ExtractList(obj) + if err != nil { + return err + } + if errs := runtime.DecodeList(items, p.Decoder, runtime.UnstructuredJSONScheme); len(errs) > 0 { + return utilerrors.NewAggregate(errs) + } + for _, obj := range items { + if err := p.PrintObj(obj, w); err != nil { + return err + } + } + return nil + } + + // TODO: this is wrong, runtime.Unknown and runtime.Unstructured are not handled properly here. + + name := "" + if acc, err := meta.Accessor(obj); err == nil { + if n := acc.GetName(); len(n) > 0 { + name = n + } + } + + if gvk != nil { + // TODO: this is wrong, it assumes that meta knows about all Kinds - should take a RESTMapper + _, resource := meta.KindToResource(*gvk) + + fmt.Fprintf(w, "%s/%s\n", resource.Resource, name) + } else { + fmt.Fprintf(w, "/%s\n", name) } return nil @@ -300,29 +299,39 @@ type handlerEntry struct { printFunc reflect.Value } +type PrintOptions struct { + NoHeaders bool + WithNamespace bool + Wide bool + ShowAll bool + ShowLabels bool + AbsoluteTimestamps bool + ColumnLabels []string +} + // HumanReadablePrinter is an implementation of ResourcePrinter which attempts to provide // more elegant output. It is not threadsafe, but you may call PrintObj repeatedly; headers // will only be printed if the object type changes. This makes it useful for printing items // received from watches. type HumanReadablePrinter struct { - handlerMap map[reflect.Type]*handlerEntry - noHeaders bool - withNamespace bool - wide bool - showAll bool - columnLabels []string - lastType reflect.Type + handlerMap map[reflect.Type]*handlerEntry + options PrintOptions + lastType reflect.Type } // NewHumanReadablePrinter creates a HumanReadablePrinter. -func NewHumanReadablePrinter(noHeaders, withNamespace bool, wide bool, showAll bool, columnLabels []string) *HumanReadablePrinter { +func NewHumanReadablePrinter(noHeaders, withNamespace bool, wide bool, showAll bool, showLabels bool, absoluteTimestamps bool, columnLabels []string) *HumanReadablePrinter { printer := &HumanReadablePrinter{ - handlerMap: make(map[reflect.Type]*handlerEntry), - noHeaders: noHeaders, - withNamespace: withNamespace, - wide: wide, - showAll: showAll, - columnLabels: columnLabels, + handlerMap: make(map[reflect.Type]*handlerEntry), + options: PrintOptions{ + NoHeaders: noHeaders, + WithNamespace: withNamespace, + Wide: wide, + ShowAll: showAll, + ShowLabels: showLabels, + AbsoluteTimestamps: absoluteTimestamps, + ColumnLabels: columnLabels, + }, } printer.addDefaultHandlers() return printer @@ -347,22 +356,22 @@ func (h *HumanReadablePrinter) Handler(columns []string, printFunc interface{}) // validatePrintHandlerFunc validates print handler signature. // printFunc is the function that will be called to print an object. // It must be of the following type: -// func printFunc(object ObjectType, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error +// func printFunc(object ObjectType, w io.Writer, options PrintOptions) error // where ObjectType is the type of the object that will be printed. func (h *HumanReadablePrinter) validatePrintHandlerFunc(printFunc reflect.Value) error { if printFunc.Kind() != reflect.Func { return fmt.Errorf("invalid print handler. %#v is not a function", printFunc) } funcType := printFunc.Type() - if funcType.NumIn() != 6 || funcType.NumOut() != 1 { + if funcType.NumIn() != 3 || funcType.NumOut() != 1 { return fmt.Errorf("invalid print handler." + - "Must accept 6 parameters and return 1 value.") + "Must accept 3 parameters and return 1 value.") } if funcType.In(1) != reflect.TypeOf((*io.Writer)(nil)).Elem() || - funcType.In(5) != reflect.TypeOf((*[]string)(nil)).Elem() || + funcType.In(2) != reflect.TypeOf((*PrintOptions)(nil)).Elem() || funcType.Out(0) != reflect.TypeOf((*error)(nil)).Elem() { return fmt.Errorf("invalid print handler. The expected signature is: "+ - "func handler(obj %v, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error", funcType.In(0)) + "func handler(obj %v, w io.Writer, options PrintOptions) error", funcType.In(0)) } return nil } @@ -387,26 +396,29 @@ func (h *HumanReadablePrinter) HandledResources() []string { // pkg/kubectl/cmd/get.go to reflect the new resource type. var podColumns = []string{"NAME", "READY", "STATUS", "RESTARTS", "AGE"} var podTemplateColumns = []string{"TEMPLATE", "CONTAINER(S)", "IMAGE(S)", "PODLABELS"} -var replicationControllerColumns = []string{"CONTROLLER", "CONTAINER(S)", "IMAGE(S)", "SELECTOR", "REPLICAS", "AGE"} -var jobColumns = []string{"JOB", "CONTAINER(S)", "IMAGE(S)", "SELECTOR", "SUCCESSFUL"} -var serviceColumns = []string{"NAME", "CLUSTER_IP", "EXTERNAL_IP", "PORT(S)", "SELECTOR", "AGE"} +var replicationControllerColumns = []string{"CONTROLLER", "REPLICAS", "AGE"} +var replicaSetColumns = []string{"CONTROLLER", "REPLICAS", "AGE"} +var jobColumns = []string{"JOB", "SUCCESSFUL"} +var serviceColumns = []string{"NAME", "CLUSTER-IP", "EXTERNAL-IP", "PORT(S)", "AGE"} var ingressColumns = []string{"NAME", "RULE", "BACKEND", "ADDRESS"} var endpointColumns = []string{"NAME", "ENDPOINTS", "AGE"} -var nodeColumns = []string{"NAME", "LABELS", "STATUS", "AGE"} -var daemonSetColumns = []string{"NAME", "CONTAINER(S)", "IMAGE(S)", "SELECTOR", "NODE-SELECTOR"} -var eventColumns = []string{"FIRSTSEEN", "LASTSEEN", "COUNT", "NAME", "KIND", "SUBOBJECT", "REASON", "SOURCE", "MESSAGE"} +var nodeColumns = []string{"NAME", "STATUS", "AGE"} +var daemonSetColumns = []string{"NAME", "NODE-SELECTOR"} +var eventColumns = []string{"FIRSTSEEN", "LASTSEEN", "COUNT", "NAME", "KIND", "SUBOBJECT", "TYPE", "REASON", "SOURCE", "MESSAGE"} var limitRangeColumns = []string{"NAME", "AGE"} var resourceQuotaColumns = []string{"NAME", "AGE"} -var namespaceColumns = []string{"NAME", "LABELS", "STATUS", "AGE"} +var namespaceColumns = []string{"NAME", "STATUS", "AGE"} var secretColumns = []string{"NAME", "TYPE", "DATA", "AGE"} var serviceAccountColumns = []string{"NAME", "SECRETS", "AGE"} -var persistentVolumeColumns = []string{"NAME", "LABELS", "CAPACITY", "ACCESSMODES", "STATUS", "CLAIM", "REASON", "AGE"} -var persistentVolumeClaimColumns = []string{"NAME", "LABELS", "STATUS", "VOLUME", "CAPACITY", "ACCESSMODES", "AGE"} +var persistentVolumeColumns = []string{"NAME", "CAPACITY", "ACCESSMODES", "STATUS", "CLAIM", "REASON", "AGE"} +var persistentVolumeClaimColumns = []string{"NAME", "STATUS", "VOLUME", "CAPACITY", "ACCESSMODES", "AGE"} var componentStatusColumns = []string{"NAME", "STATUS", "MESSAGE", "ERROR"} var thirdPartyResourceColumns = []string{"NAME", "DESCRIPTION", "VERSION(S)"} var horizontalPodAutoscalerColumns = []string{"NAME", "REFERENCE", "TARGET", "CURRENT", "MINPODS", "MAXPODS", "AGE"} var withNamespacePrefixColumns = []string{"NAMESPACE"} // TODO(erictune): print cluster name too. -var deploymentColumns = []string{"NAME", "UPDATEDREPLICAS", "AGE"} +var deploymentColumns = []string{"NAME", "DESIRED", "CURRENT", "UP-TO-DATE", "AVAILABLE", "AGE"} +var configMapColumns = []string{"NAME", "DATA", "AGE"} +var podSecurityPolicyColumns = []string{"NAME", "PRIV", "CAPS", "VOLUMEPLUGINS", "SELINUX", "RUNASUSER"} // addDefaultHandlers adds print handlers for default Kubernetes types. func (h *HumanReadablePrinter) addDefaultHandlers() { @@ -416,6 +428,8 @@ func (h *HumanReadablePrinter) addDefaultHandlers() { h.Handler(podTemplateColumns, printPodTemplateList) h.Handler(replicationControllerColumns, printReplicationController) h.Handler(replicationControllerColumns, printReplicationControllerList) + h.Handler(replicaSetColumns, printReplicaSet) + h.Handler(replicaSetColumns, printReplicaSetList) h.Handler(daemonSetColumns, printDaemonSet) h.Handler(daemonSetColumns, printDaemonSetList) h.Handler(jobColumns, printJob) @@ -452,6 +466,10 @@ func (h *HumanReadablePrinter) addDefaultHandlers() { h.Handler(deploymentColumns, printDeploymentList) h.Handler(horizontalPodAutoscalerColumns, printHorizontalPodAutoscaler) h.Handler(horizontalPodAutoscalerColumns, printHorizontalPodAutoscalerList) + h.Handler(configMapColumns, printConfigMap) + h.Handler(configMapColumns, printConfigMapList) + h.Handler(podSecurityPolicyColumns, printPodSecurityPolicy) + h.Handler(podSecurityPolicyColumns, printPodSecurityPolicyList) } func (h *HumanReadablePrinter) unknown(data []byte, w io.Writer) error { @@ -500,13 +518,6 @@ func formatEndpoints(endpoints *api.Endpoints, ports sets.String) string { return ret } -func podHostString(host, ip string) string { - if host == "" && ip == "" { - return "" - } - return host + "/" + ip -} - func shortHumanDuration(d time.Duration) string { // Allow deviation no more than 2 seconds(excluded) to tolerate machine time // inconsistence, it can be considered as almost now. @@ -535,11 +546,11 @@ func translateTimestamp(timestamp unversioned.Time) string { return shortHumanDuration(time.Now().Sub(timestamp.Time)) } -func printPod(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { - return printPodBase(pod, w, withNamespace, wide, showAll, true, columnLabels) +func printPod(pod *api.Pod, w io.Writer, options PrintOptions) error { + return printPodBase(pod, w, options) } -func printPodBase(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, showAll bool, showIfTerminating bool, columnLabels []string) error { +func printPodBase(pod *api.Pod, w io.Writer, options PrintOptions) error { name := pod.Name namespace := pod.Namespace @@ -549,7 +560,7 @@ func printPodBase(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, show reason := string(pod.Status.Phase) // if not printing all pods, skip terminated pods (default) - if !showIfTerminating && !showAll && (reason == string(api.PodSucceeded) || reason == string(api.PodFailed)) { + if !options.ShowAll && (reason == string(api.PodSucceeded) || reason == string(api.PodFailed)) { return nil } if pod.Status.Reason != "" { @@ -578,7 +589,7 @@ func printPodBase(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, show reason = "Terminating" } - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } @@ -594,7 +605,7 @@ func printPodBase(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, show return err } - if wide { + if options.Wide { nodeName := pod.Spec.NodeName if _, err := fmt.Fprintf(w, "\t%s", nodeName, @@ -603,20 +614,26 @@ func printPodBase(pod *api.Pod, w io.Writer, withNamespace bool, wide bool, show } } - _, err := fmt.Fprint(w, appendLabels(pod.Labels, columnLabels)) - return err + if _, err := fmt.Fprint(w, appendLabels(pod.Labels, options.ColumnLabels)); err != nil { + return err + } + if _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, pod.Labels)); err != nil { + return err + } + + return nil } -func printPodList(podList *api.PodList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printPodList(podList *api.PodList, w io.Writer, options PrintOptions) error { for _, pod := range podList.Items { - if err := printPodBase(&pod, w, withNamespace, wide, showAll, false, columnLabels); err != nil { + if err := printPodBase(&pod, w, options); err != nil { return err } } return nil } -func printPodTemplate(pod *api.PodTemplate, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printPodTemplate(pod *api.PodTemplate, w io.Writer, options PrintOptions) error { name := pod.Name namespace := pod.Namespace @@ -626,7 +643,7 @@ func printPodTemplate(pod *api.PodTemplate, w io.Writer, withNamespace bool, wid firstContainer, containers = containers[0], containers[1:] } - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } @@ -639,13 +656,16 @@ func printPodTemplate(pod *api.PodTemplate, w io.Writer, withNamespace bool, wid ); err != nil { return err } - if _, err := fmt.Fprint(w, appendLabels(pod.Labels, columnLabels)); err != nil { + if _, err := fmt.Fprint(w, appendLabels(pod.Labels, options.ColumnLabels)); err != nil { + return err + } + if _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, pod.Labels)); err != nil { return err } // Lay out all the other containers on separate lines. extraLinePrefix := "\t" - if withNamespace { + if options.WithNamespace { extraLinePrefix = "\t\t" } for _, container := range containers { @@ -653,23 +673,23 @@ func printPodTemplate(pod *api.PodTemplate, w io.Writer, withNamespace bool, wid if err != nil { return err } - if _, err := fmt.Fprint(w, appendLabelTabs(columnLabels)); err != nil { + if _, err := fmt.Fprint(w, appendLabelTabs(options.ColumnLabels)); err != nil { return err } } return nil } -func printPodTemplateList(podList *api.PodTemplateList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printPodTemplateList(podList *api.PodTemplateList, w io.Writer, options PrintOptions) error { for _, pod := range podList.Items { - if err := printPodTemplate(&pod, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printPodTemplate(&pod, w, options); err != nil { return err } } return nil } -func printReplicationController(controller *api.ReplicationController, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printReplicationController(controller *api.ReplicationController, w io.Writer, options PrintOptions) error { name := controller.Name namespace := controller.Namespace containers := controller.Spec.Template.Spec.Containers @@ -678,28 +698,37 @@ func printReplicationController(controller *api.ReplicationController, w io.Writ firstContainer, containers = containers[0], containers[1:] } - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } } - if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\t%s", + if _, err := fmt.Fprintf(w, "%s\t%d\t%s", name, - firstContainer.Name, - firstContainer.Image, - labels.FormatLabels(controller.Spec.Selector), controller.Spec.Replicas, translateTimestamp(controller.CreationTimestamp), ); err != nil { return err } - if _, err := fmt.Fprint(w, appendLabels(controller.Labels, columnLabels)); err != nil { + if options.Wide { + if _, err := fmt.Fprintf(w, "\t%s\t%s\t%s", + firstContainer.Name, + firstContainer.Image, + labels.FormatLabels(controller.Spec.Selector), + ); err != nil { + return err + } + } + if _, err := fmt.Fprint(w, appendLabels(controller.Labels, options.ColumnLabels)); err != nil { + return err + } + if _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, controller.Labels)); err != nil { return err } // Lay out all the other containers on separate lines. extraLinePrefix := "\t" - if withNamespace { + if options.WithNamespace { extraLinePrefix = "\t\t" } for _, container := range containers { @@ -707,23 +736,86 @@ func printReplicationController(controller *api.ReplicationController, w io.Writ if err != nil { return err } - if _, err := fmt.Fprint(w, appendLabelTabs(columnLabels)); err != nil { + if _, err := fmt.Fprint(w, appendLabelTabs(options.ColumnLabels)); err != nil { return err } } return nil } -func printReplicationControllerList(list *api.ReplicationControllerList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printReplicationControllerList(list *api.ReplicationControllerList, w io.Writer, options PrintOptions) error { for _, controller := range list.Items { - if err := printReplicationController(&controller, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printReplicationController(&controller, w, options); err != nil { return err } } return nil } -func printJob(job *extensions.Job, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printReplicaSet(rs *extensions.ReplicaSet, w io.Writer, options PrintOptions) error { + name := rs.Name + namespace := rs.Namespace + containers := rs.Spec.Template.Spec.Containers + var firstContainer api.Container + if len(containers) > 0 { + firstContainer, containers = containers[0], containers[1:] + } + + if options.WithNamespace { + if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { + return err + } + } + if _, err := fmt.Fprintf(w, "%s\t%d\t%s", + name, + rs.Spec.Replicas, + translateTimestamp(rs.CreationTimestamp), + ); err != nil { + return err + } + if options.Wide { + if _, err := fmt.Fprintf(w, "\t%s\t%s\t%s", + firstContainer.Name, + firstContainer.Image, + unversioned.FormatLabelSelector(rs.Spec.Selector), + ); err != nil { + return err + } + } + if _, err := fmt.Fprint(w, appendLabels(rs.Labels, options.ColumnLabels)); err != nil { + return err + } + if _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, rs.Labels)); err != nil { + return err + } + + // Lay out all the other containers on separate lines. + extraLinePrefix := "\t" + if options.WithNamespace { + extraLinePrefix = "\t\t" + } + for _, container := range containers { + _, err := fmt.Fprintf(w, "%s%s\t%s\t%s\t%s", extraLinePrefix, container.Name, container.Image, "", "") + if err != nil { + return err + } + if _, err := fmt.Fprint(w, appendLabelTabs(options.ColumnLabels)); err != nil { + return err + } + } + return nil +} + +func printReplicaSetList(list *extensions.ReplicaSetList, w io.Writer, options PrintOptions) error { + for _, rs := range list.Items { + if err := printReplicaSet(&rs, w, options); err != nil { + return err + } + } + return nil +} + +func printJob(job *extensions.Job, w io.Writer, options PrintOptions) error { name := job.Name namespace := job.Namespace containers := job.Spec.Template.Spec.Containers @@ -731,29 +823,38 @@ func printJob(job *extensions.Job, w io.Writer, withNamespace bool, wide bool, s if len(containers) > 0 { firstContainer, containers = containers[0], containers[1:] } - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } } - selector, _ := extensions.PodSelectorAsSelector(job.Spec.Selector) - _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\n", + selector, _ := unversioned.LabelSelectorAsSelector(job.Spec.Selector) + _, err := fmt.Fprintf(w, "%s\t%d", name, - firstContainer.Name, - firstContainer.Image, - selector.String(), job.Status.Succeeded) if err != nil { return err } - if _, err := fmt.Fprint(w, appendLabels(job.Labels, columnLabels)); err != nil { + if options.Wide { + if _, err := fmt.Fprintf(w, "\t%s\t%s\t%s", + firstContainer.Name, + firstContainer.Image, + selector.String(), + ); err != nil { + return err + } + } + if _, err := fmt.Fprint(w, appendLabels(job.Labels, options.ColumnLabels)); err != nil { + return err + } + if _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, job.Labels)); err != nil { return err } // Lay out all the other containers on separate lines. extraLinePrefix := "\t" - if withNamespace { + if options.WithNamespace { extraLinePrefix = "\t\t" } for _, container := range containers { @@ -761,16 +862,16 @@ func printJob(job *extensions.Job, w io.Writer, withNamespace bool, wide bool, s if err != nil { return err } - if _, err := fmt.Fprint(w, appendLabelTabs(columnLabels)); err != nil { + if _, err := fmt.Fprint(w, appendLabelTabs(options.ColumnLabels)); err != nil { return err } } return nil } -func printJobList(list *extensions.JobList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printJobList(list *extensions.JobList, w io.Writer, options PrintOptions) error { for _, job := range list.Items { - if err := printJob(&job, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printJob(&job, w, options); err != nil { return err } } @@ -821,37 +922,42 @@ func makePortString(ports []api.ServicePort) string { return strings.Join(pieces, ",") } -func printService(svc *api.Service, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printService(svc *api.Service, w io.Writer, options PrintOptions) error { name := svc.Name namespace := svc.Namespace internalIP := svc.Spec.ClusterIP externalIP := getServiceExternalIP(svc) - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } } - if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s", + if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s", name, internalIP, externalIP, makePortString(svc.Spec.Ports), - labels.FormatLabels(svc.Spec.Selector), translateTimestamp(svc.CreationTimestamp), ); err != nil { return err } - if _, err := fmt.Fprint(w, appendLabels(svc.Labels, columnLabels)); err != nil { + if options.Wide { + if _, err := fmt.Fprintf(w, "\t%s", labels.FormatLabels(svc.Spec.Selector)); err != nil { + return err + } + } + if _, err := fmt.Fprint(w, appendLabels(svc.Labels, options.ColumnLabels)); err != nil { return err } - return nil + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, svc.Labels)) + return err } -func printServiceList(list *api.ServiceList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printServiceList(list *api.ServiceList, w io.Writer, options PrintOptions) error { for _, svc := range list.Items { - if err := printService(&svc, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printService(&svc, w, options); err != nil { return err } } @@ -866,28 +972,35 @@ func backendStringer(backend *extensions.IngressBackend) string { return fmt.Sprintf("%v:%v", backend.ServiceName, backend.ServicePort.String()) } -func printIngress(ingress *extensions.Ingress, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error { +func printIngress(ingress *extensions.Ingress, w io.Writer, options PrintOptions) error { name := ingress.Name namespace := ingress.Namespace hostRules := ingress.Spec.Rules - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } } - if _, err := fmt.Fprintf(w, "%s\t%v\t%v\t%v\n", + if _, err := fmt.Fprintf(w, "%s\t%v\t%v\t%v", name, "-", backendStringer(ingress.Spec.Backend), loadBalancerStatusStringer(ingress.Status.LoadBalancer)); err != nil { return err } + if _, err := fmt.Fprint(w, appendLabels(ingress.Labels, options.ColumnLabels)); err != nil { + return err + } + + if _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, ingress.Labels)); err != nil { + return err + } // Lay out all the rules on separate lines. extraLinePrefix := "" - if withNamespace { + if options.WithNamespace { extraLinePrefix = "\t" } for _, rules := range hostRules { @@ -898,7 +1011,7 @@ func printIngress(ingress *extensions.Ingress, w io.Writer, withNamespace, wide if err != nil { return err } - if _, err := fmt.Fprint(w, appendLabelTabs(columnLabels)); err != nil { + if _, err := fmt.Fprint(w, appendLabelTabs(options.ColumnLabels)); err != nil { return err } for _, rule := range rules.HTTP.Paths { @@ -906,7 +1019,7 @@ func printIngress(ingress *extensions.Ingress, w io.Writer, withNamespace, wide if err != nil { return err } - if _, err := fmt.Fprint(w, appendLabelTabs(columnLabels)); err != nil { + if _, err := fmt.Fprint(w, appendLabelTabs(options.ColumnLabels)); err != nil { return err } } @@ -914,16 +1027,16 @@ func printIngress(ingress *extensions.Ingress, w io.Writer, withNamespace, wide return nil } -func printIngressList(ingressList *extensions.IngressList, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error { +func printIngressList(ingressList *extensions.IngressList, w io.Writer, options PrintOptions) error { for _, ingress := range ingressList.Items { - if err := printIngress(&ingress, w, withNamespace, wide, true, columnLabels); err != nil { + if err := printIngress(&ingress, w, options); err != nil { return err } } return nil } -func printDaemonSet(ds *extensions.DaemonSet, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printDaemonSet(ds *extensions.DaemonSet, w io.Writer, options PrintOptions) error { name := ds.Name namespace := ds.Namespace @@ -933,27 +1046,41 @@ func printDaemonSet(ds *extensions.DaemonSet, w io.Writer, withNamespace bool, w firstContainer, containers = containers[0], containers[1:] } - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } } - if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s", + selector, err := unversioned.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + // this shouldn't happen if LabelSelector passed validation + return err + } + if _, err := fmt.Fprintf(w, "%s\t%s", name, - firstContainer.Name, - firstContainer.Image, - labels.FormatLabels(ds.Spec.Selector), labels.FormatLabels(ds.Spec.Template.Spec.NodeSelector), ); err != nil { return err } - if _, err := fmt.Fprint(w, appendLabels(ds.Labels, columnLabels)); err != nil { + if options.Wide { + if _, err := fmt.Fprintf(w, "\t%s\t%s\t%s", + firstContainer.Name, + firstContainer.Image, + selector, + ); err != nil { + return err + } + } + if _, err := fmt.Fprint(w, appendLabels(ds.Labels, options.ColumnLabels)); err != nil { + return err + } + if _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, ds.Labels)); err != nil { return err } // Lay out all the other containers on separate lines. extraLinePrefix := "\t" - if withNamespace { + if options.WithNamespace { extraLinePrefix = "\t\t" } for _, container := range containers { @@ -961,27 +1088,27 @@ func printDaemonSet(ds *extensions.DaemonSet, w io.Writer, withNamespace bool, w if err != nil { return err } - if _, err := fmt.Fprint(w, appendLabelTabs(columnLabels)); err != nil { + if _, err := fmt.Fprint(w, appendLabelTabs(options.ColumnLabels)); err != nil { return err } } return nil } -func printDaemonSetList(list *extensions.DaemonSetList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printDaemonSetList(list *extensions.DaemonSetList, w io.Writer, options PrintOptions) error { for _, ds := range list.Items { - if err := printDaemonSet(&ds, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printDaemonSet(&ds, w, options); err != nil { return err } } return nil } -func printEndpoints(endpoints *api.Endpoints, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printEndpoints(endpoints *api.Endpoints, w io.Writer, options PrintOptions) error { name := endpoints.Name namespace := endpoints.Namespace - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } @@ -989,45 +1116,51 @@ func printEndpoints(endpoints *api.Endpoints, w io.Writer, withNamespace bool, w if _, err := fmt.Fprintf(w, "%s\t%s\t%s", name, formatEndpoints(endpoints, nil), translateTimestamp(endpoints.CreationTimestamp)); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(endpoints.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(endpoints.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, endpoints.Labels)) return err } -func printEndpointsList(list *api.EndpointsList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printEndpointsList(list *api.EndpointsList, w io.Writer, options PrintOptions) error { for _, item := range list.Items { - if err := printEndpoints(&item, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printEndpoints(&item, w, options); err != nil { return err } } return nil } -func printNamespace(item *api.Namespace, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { - if withNamespace { +func printNamespace(item *api.Namespace, w io.Writer, options PrintOptions) error { + if options.WithNamespace { return fmt.Errorf("namespace is not namespaced") } - if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s", item.Name, labels.FormatLabels(item.Labels), item.Status.Phase, translateTimestamp(item.CreationTimestamp)); err != nil { + if _, err := fmt.Fprintf(w, "%s\t%s\t%s", item.Name, item.Status.Phase, translateTimestamp(item.CreationTimestamp)); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(item.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(item.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, item.Labels)) return err } -func printNamespaceList(list *api.NamespaceList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printNamespaceList(list *api.NamespaceList, w io.Writer, options PrintOptions) error { for _, item := range list.Items { - if err := printNamespace(&item, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printNamespace(&item, w, options); err != nil { return err } } return nil } -func printSecret(item *api.Secret, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printSecret(item *api.Secret, w io.Writer, options PrintOptions) error { name := item.Name namespace := item.Namespace - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } @@ -1035,13 +1168,16 @@ func printSecret(item *api.Secret, w io.Writer, withNamespace bool, wide bool, s if _, err := fmt.Fprintf(w, "%s\t%s\t%v\t%s", name, item.Type, len(item.Data), translateTimestamp(item.CreationTimestamp)); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(item.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(item.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, item.Labels)) return err } -func printSecretList(list *api.SecretList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printSecretList(list *api.SecretList, w io.Writer, options PrintOptions) error { for _, item := range list.Items { - if err := printSecret(&item, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printSecret(&item, w, options); err != nil { return err } } @@ -1049,11 +1185,11 @@ func printSecretList(list *api.SecretList, w io.Writer, withNamespace bool, wide return nil } -func printServiceAccount(item *api.ServiceAccount, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printServiceAccount(item *api.ServiceAccount, w io.Writer, options PrintOptions) error { name := item.Name namespace := item.Namespace - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } @@ -1061,13 +1197,16 @@ func printServiceAccount(item *api.ServiceAccount, w io.Writer, withNamespace bo if _, err := fmt.Fprintf(w, "%s\t%d\t%s", name, len(item.Secrets), translateTimestamp(item.CreationTimestamp)); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(item.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(item.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, item.Labels)) return err } -func printServiceAccountList(list *api.ServiceAccountList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printServiceAccountList(list *api.ServiceAccountList, w io.Writer, options PrintOptions) error { for _, item := range list.Items { - if err := printServiceAccount(&item, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printServiceAccount(&item, w, options); err != nil { return err } } @@ -1075,8 +1214,8 @@ func printServiceAccountList(list *api.ServiceAccountList, w io.Writer, withName return nil } -func printNode(node *api.Node, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { - if withNamespace { +func printNode(node *api.Node, w io.Writer, options PrintOptions) error { + if options.WithNamespace { return fmt.Errorf("node is not namespaced") } conditionMap := make(map[api.NodeConditionType]*api.NodeCondition) @@ -1102,24 +1241,28 @@ func printNode(node *api.Node, w io.Writer, withNamespace bool, wide bool, showA status = append(status, "SchedulingDisabled") } - if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s", node.Name, labels.FormatLabels(node.Labels), strings.Join(status, ","), translateTimestamp(node.CreationTimestamp)); err != nil { + if _, err := fmt.Fprintf(w, "%s\t%s\t%s", node.Name, strings.Join(status, ","), translateTimestamp(node.CreationTimestamp)); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(node.Labels, columnLabels)) + // Display caller specify column labels first. + if _, err := fmt.Fprint(w, appendLabels(node.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, node.Labels)) return err } -func printNodeList(list *api.NodeList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printNodeList(list *api.NodeList, w io.Writer, options PrintOptions) error { for _, node := range list.Items { - if err := printNode(&node, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printNode(&node, w, options); err != nil { return err } } return nil } -func printPersistentVolume(pv *api.PersistentVolume, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { - if withNamespace { +func printPersistentVolume(pv *api.PersistentVolume, w io.Writer, options PrintOptions) error { + if options.WithNamespace { return fmt.Errorf("persistentVolume is not namespaced") } name := pv.Name @@ -1136,9 +1279,8 @@ func printPersistentVolume(pv *api.PersistentVolume, w io.Writer, withNamespace aQty := pv.Spec.Capacity[api.ResourceStorage] aSize := aQty.String() - if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s", + if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s", name, - labels.FormatLabels(pv.Labels), aSize, modesStr, pv.Status.Phase, claimRefUID, @@ -1147,30 +1289,32 @@ func printPersistentVolume(pv *api.PersistentVolume, w io.Writer, withNamespace ); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(pv.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(pv.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, pv.Labels)) return err } -func printPersistentVolumeList(list *api.PersistentVolumeList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printPersistentVolumeList(list *api.PersistentVolumeList, w io.Writer, options PrintOptions) error { for _, pv := range list.Items { - if err := printPersistentVolume(&pv, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printPersistentVolume(&pv, w, options); err != nil { return err } } return nil } -func printPersistentVolumeClaim(pvc *api.PersistentVolumeClaim, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printPersistentVolumeClaim(pvc *api.PersistentVolumeClaim, w io.Writer, options PrintOptions) error { name := pvc.Name namespace := pvc.Namespace - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } } - labels := labels.FormatLabels(pvc.Labels) phase := pvc.Status.Phase storage := pvc.Spec.Resources.Requests[api.ResourceStorage] capacity := "" @@ -1181,63 +1325,81 @@ func printPersistentVolumeClaim(pvc *api.PersistentVolumeClaim, w io.Writer, wit capacity = storage.String() } - if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s", name, labels, phase, pvc.Spec.VolumeName, capacity, accessModes, translateTimestamp(pvc.CreationTimestamp)); err != nil { + if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s", name, phase, pvc.Spec.VolumeName, capacity, accessModes, translateTimestamp(pvc.CreationTimestamp)); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(pvc.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(pvc.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, pvc.Labels)) return err } -func printPersistentVolumeClaimList(list *api.PersistentVolumeClaimList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printPersistentVolumeClaimList(list *api.PersistentVolumeClaimList, w io.Writer, options PrintOptions) error { for _, psd := range list.Items { - if err := printPersistentVolumeClaim(&psd, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printPersistentVolumeClaim(&psd, w, options); err != nil { return err } } return nil } -func printEvent(event *api.Event, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printEvent(event *api.Event, w io.Writer, options PrintOptions) error { namespace := event.Namespace - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } } + + // While watching event, we should print absolute time. + var FirstTimestamp, LastTimestamp string + if options.AbsoluteTimestamps { + FirstTimestamp = event.FirstTimestamp.String() + LastTimestamp = event.LastTimestamp.String() + } else { + FirstTimestamp = translateTimestamp(event.FirstTimestamp) + LastTimestamp = translateTimestamp(event.LastTimestamp) + } + if _, err := fmt.Fprintf( - w, "%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s", - translateTimestamp(event.FirstTimestamp), - translateTimestamp(event.LastTimestamp), + w, "%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s", + FirstTimestamp, + LastTimestamp, event.Count, event.InvolvedObject.Name, event.InvolvedObject.Kind, event.InvolvedObject.FieldPath, + event.Type, event.Reason, event.Source, event.Message, ); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(event.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(event.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, event.Labels)) return err } // Sorts and prints the EventList in a human-friendly format. -func printEventList(list *api.EventList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printEventList(list *api.EventList, w io.Writer, options PrintOptions) error { sort.Sort(SortableEvents(list.Items)) for i := range list.Items { - if err := printEvent(&list.Items[i], w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printEvent(&list.Items[i], w, options); err != nil { return err } } return nil } -func printLimitRange(limitRange *api.LimitRange, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printLimitRange(limitRange *api.LimitRange, w io.Writer, options PrintOptions) error { name := limitRange.Name namespace := limitRange.Namespace - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } @@ -1250,25 +1412,28 @@ func printLimitRange(limitRange *api.LimitRange, w io.Writer, withNamespace bool ); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(limitRange.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(limitRange.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, limitRange.Labels)) return err } // Prints the LimitRangeList in a human-friendly format. -func printLimitRangeList(list *api.LimitRangeList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printLimitRangeList(list *api.LimitRangeList, w io.Writer, options PrintOptions) error { for i := range list.Items { - if err := printLimitRange(&list.Items[i], w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printLimitRange(&list.Items[i], w, options); err != nil { return err } } return nil } -func printResourceQuota(resourceQuota *api.ResourceQuota, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printResourceQuota(resourceQuota *api.ResourceQuota, w io.Writer, options PrintOptions) error { name := resourceQuota.Name namespace := resourceQuota.Namespace - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } @@ -1281,22 +1446,25 @@ func printResourceQuota(resourceQuota *api.ResourceQuota, w io.Writer, withNames ); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(resourceQuota.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(resourceQuota.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, resourceQuota.Labels)) return err } // Prints the ResourceQuotaList in a human-friendly format. -func printResourceQuotaList(list *api.ResourceQuotaList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printResourceQuotaList(list *api.ResourceQuotaList, w io.Writer, options PrintOptions) error { for i := range list.Items { - if err := printResourceQuota(&list.Items[i], w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printResourceQuota(&list.Items[i], w, options); err != nil { return err } } return nil } -func printComponentStatus(item *api.ComponentStatus, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { - if withNamespace { +func printComponentStatus(item *api.ComponentStatus, w io.Writer, options PrintOptions) error { + if options.WithNamespace { return fmt.Errorf("componentStatus is not namespaced") } status := "Unknown" @@ -1318,13 +1486,16 @@ func printComponentStatus(item *api.ComponentStatus, w io.Writer, withNamespace if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s", item.Name, status, message, error); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(item.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(item.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, item.Labels)) return err } -func printComponentStatusList(list *api.ComponentStatusList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printComponentStatusList(list *api.ComponentStatusList, w io.Writer, options PrintOptions) error { for _, item := range list.Items { - if err := printComponentStatus(&item, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printComponentStatus(&item, w, options); err != nil { return err } } @@ -1332,22 +1503,22 @@ func printComponentStatusList(list *api.ComponentStatusList, w io.Writer, withNa return nil } -func printThirdPartyResource(rsrc *extensions.ThirdPartyResource, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printThirdPartyResource(rsrc *extensions.ThirdPartyResource, w io.Writer, options PrintOptions) error { versions := make([]string, len(rsrc.Versions)) for ix := range rsrc.Versions { version := &rsrc.Versions[ix] - versions[ix] = fmt.Sprint("%s/%s", version.APIGroup, version.Name) + versions[ix] = fmt.Sprintf("%s/%s", version.APIGroup, version.Name) } versionsString := strings.Join(versions, ",") - if _, err := fmt.Fprintf(w, "%s\t%s\t%s", rsrc.Name, rsrc.Description, versionsString); err != nil { + if _, err := fmt.Fprintf(w, "%s\t%s\t%s\n", rsrc.Name, rsrc.Description, versionsString); err != nil { return err } return nil } -func printThirdPartyResourceList(list *extensions.ThirdPartyResourceList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printThirdPartyResourceList(list *extensions.ThirdPartyResourceList, w io.Writer, options PrintOptions) error { for _, item := range list.Items { - if err := printThirdPartyResource(&item, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printThirdPartyResource(&item, w, options); err != nil { return err } } @@ -1355,37 +1526,42 @@ func printThirdPartyResourceList(list *extensions.ThirdPartyResourceList, w io.W return nil } -func printDeployment(deployment *extensions.Deployment, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { - if withNamespace { +func printDeployment(deployment *extensions.Deployment, w io.Writer, options PrintOptions) error { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", deployment.Namespace); err != nil { return err } } - updatedReplicas := fmt.Sprintf("%d/%d", deployment.Status.UpdatedReplicas, deployment.Spec.Replicas) + desiredReplicas := deployment.Spec.Replicas + currentReplicas := deployment.Status.Replicas + updatedReplicas := deployment.Status.UpdatedReplicas + availableReplicas := deployment.Status.AvailableReplicas age := translateTimestamp(deployment.CreationTimestamp) - if _, err := fmt.Fprintf(w, "%s\t%s\t%s", deployment.Name, updatedReplicas, age); err != nil { + if _, err := fmt.Fprintf(w, "%s\t%d\t%d\t%d\t%d\t%s", deployment.Name, desiredReplicas, currentReplicas, updatedReplicas, availableReplicas, age); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(deployment.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(deployment.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, deployment.Labels)) return err } -func printDeploymentList(list *extensions.DeploymentList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printDeploymentList(list *extensions.DeploymentList, w io.Writer, options PrintOptions) error { for _, item := range list.Items { - if err := printDeployment(&item, w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printDeployment(&item, w, options); err != nil { return err } } return nil } -func printHorizontalPodAutoscaler(hpa *extensions.HorizontalPodAutoscaler, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printHorizontalPodAutoscaler(hpa *extensions.HorizontalPodAutoscaler, w io.Writer, options PrintOptions) error { namespace := hpa.Namespace name := hpa.Name - reference := fmt.Sprintf("%s/%s/%s/%s", + reference := fmt.Sprintf("%s/%s/%s", hpa.Spec.ScaleRef.Kind, - hpa.Spec.ScaleRef.Namespace, hpa.Spec.ScaleRef.Name, hpa.Spec.ScaleRef.Subresource) target := "" @@ -1401,7 +1577,7 @@ func printHorizontalPodAutoscaler(hpa *extensions.HorizontalPodAutoscaler, w io. minPods = fmt.Sprintf("%d", *hpa.Spec.MinReplicas) } maxPods := hpa.Spec.MaxReplicas - if withNamespace { + if options.WithNamespace { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { return err } @@ -1418,19 +1594,67 @@ func printHorizontalPodAutoscaler(hpa *extensions.HorizontalPodAutoscaler, w io. ); err != nil { return err } - _, err := fmt.Fprint(w, appendLabels(hpa.Labels, columnLabels)) + if _, err := fmt.Fprint(w, appendLabels(hpa.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, hpa.Labels)) return err } -func printHorizontalPodAutoscalerList(list *extensions.HorizontalPodAutoscalerList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func printHorizontalPodAutoscalerList(list *extensions.HorizontalPodAutoscalerList, w io.Writer, options PrintOptions) error { for i := range list.Items { - if err := printHorizontalPodAutoscaler(&list.Items[i], w, withNamespace, wide, showAll, columnLabels); err != nil { + if err := printHorizontalPodAutoscaler(&list.Items[i], w, options); err != nil { return err } } return nil } +func printConfigMap(configMap *api.ConfigMap, w io.Writer, options PrintOptions) error { + name := configMap.Name + namespace := configMap.Namespace + + if options.WithNamespace { + if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { + return err + } + } + if _, err := fmt.Fprintf(w, "%s\t%v\t%s", name, len(configMap.Data), translateTimestamp(configMap.CreationTimestamp)); err != nil { + return err + } + if _, err := fmt.Fprint(w, appendLabels(configMap.Labels, options.ColumnLabels)); err != nil { + return err + } + _, err := fmt.Fprint(w, appendAllLabels(options.ShowLabels, configMap.Labels)) + return err +} + +func printConfigMapList(list *api.ConfigMapList, w io.Writer, options PrintOptions) error { + for i := range list.Items { + if err := printConfigMap(&list.Items[i], w, options); err != nil { + return err + } + } + return nil +} + +func printPodSecurityPolicy(item *extensions.PodSecurityPolicy, w io.Writer, options PrintOptions) error { + _, err := fmt.Fprintf(w, "%s\t%t\t%v\t%t\t%s\t%s\n", item.Name, item.Spec.Privileged, + item.Spec.Capabilities, item.Spec.Volumes, item.Spec.SELinuxContext.Type, + item.Spec.RunAsUser.Type) + return err +} + +func printPodSecurityPolicyList(list *extensions.PodSecurityPolicyList, w io.Writer, options PrintOptions) error { + for _, item := range list.Items { + if err := printPodSecurityPolicy(&item, w, options); err != nil { + return err + } + } + + return nil +} + func appendLabels(itemLabels map[string]string, columnLabels []string) string { var buffer bytes.Buffer @@ -1442,6 +1666,19 @@ func appendLabels(itemLabels map[string]string, columnLabels []string) string { buffer.WriteString("") } } + + return buffer.String() +} + +// Append all labels to a single column. We need this even when show-labels flag* is +// false, since this adds newline delimiter to the end of each row. +func appendAllLabels(showLabels bool, itemLabels map[string]string) string { + var buffer bytes.Buffer + + if showLabels { + buffer.WriteString(fmt.Sprint("\t")) + buffer.WriteString(labels.FormatLabels(itemLabels)) + } buffer.WriteString("\n") return buffer.String() @@ -1478,6 +1715,31 @@ func formatWideHeaders(wide bool, t reflect.Type) []string { if t.String() == "*api.Pod" || t.String() == "*api.PodList" { return []string{"NODE"} } + if t.String() == "*api.ReplicationController" || t.String() == "*api.ReplicationControllerList" { + return []string{"CONTAINER(S)", "IMAGE(S)", "SELECTOR"} + } + if t.String() == "*extensions.Job" || t.String() == "*extensions.JobList" { + return []string{"CONTAINER(S)", "IMAGE(S)", "SELECTOR"} + } + if t.String() == "*api.Service" || t.String() == "*api.ServiceList" { + return []string{"SELECTOR"} + } + if t.String() == "*extensions.DaemonSet" || t.String() == "*extensions.DaemonSetList" { + return []string{"CONTAINER(S)", "IMAGE(S)", "SELECTOR"} + } + if t.String() == "*extensions.ReplicaSet" || t.String() == "*extensions.ReplicaSetList" { + return []string{"CONTAINER(S)", "IMAGE(S)", "SELECTOR"} + } + } + return nil +} + +// headers for --show-labels=true +func formatShowLabelsHeader(showLabels bool, t reflect.Type) []string { + if showLabels { + if t.String() != "*api.ThirdPartyResource" && t.String() != "*api.ThirdPartyResourceList" { + return []string{"LABELS"} + } } return nil } @@ -1497,16 +1759,18 @@ func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) er } t := reflect.TypeOf(obj) if handler := h.handlerMap[t]; handler != nil { - if !h.noHeaders && t != h.lastType { - headers := append(handler.columns, formatWideHeaders(h.wide, t)...) - headers = append(headers, formatLabelHeaders(h.columnLabels)...) - if h.withNamespace { + if !h.options.NoHeaders && t != h.lastType { + headers := append(handler.columns, formatWideHeaders(h.options.Wide, t)...) + headers = append(headers, formatLabelHeaders(h.options.ColumnLabels)...) + // LABELS is always the last column. + headers = append(headers, formatShowLabelsHeader(h.options.ShowLabels, t)...) + if h.options.WithNamespace { headers = append(withNamespacePrefixColumns, headers...) } h.printHeader(headers, w) h.lastType = t } - args := []reflect.Value{reflect.ValueOf(obj), reflect.ValueOf(w), reflect.ValueOf(h.withNamespace), reflect.ValueOf(h.wide), reflect.ValueOf(h.showAll), reflect.ValueOf(h.columnLabels)} + args := []reflect.Value{reflect.ValueOf(obj), reflect.ValueOf(w), reflect.ValueOf(h.options)} resultValue := handler.printFunc.Call(args)[0] if resultValue.IsNil() { return nil @@ -1549,11 +1813,11 @@ func (p *TemplatePrinter) PrintObj(obj runtime.Object, w io.Writer) error { // It is way easier to debug this stuff when it shows up in // stdout instead of just stdin. So in addition to returning // a nice error, also print useful stuff with the writer. - fmt.Fprintf(w, "Error executing template: %v\n", err) - fmt.Fprintf(w, "template was:\n\t%v\n", p.rawTemplate) - fmt.Fprintf(w, "raw data was:\n\t%v\n", string(data)) - fmt.Fprintf(w, "object given to template engine was:\n\t%+v\n", out) - return fmt.Errorf("error executing template '%v': '%v'\n----data----\n%+v\n", p.rawTemplate, err, out) + fmt.Fprintf(w, "Error executing template: %v. Printing more information for debugging the template:\n", err) + fmt.Fprintf(w, "\ttemplate was:\n\t\t%v\n", p.rawTemplate) + fmt.Fprintf(w, "\traw data was:\n\t\t%v\n", string(data)) + fmt.Fprintf(w, "\tobject given to template engine was:\n\t\t%+v\n\n", out) + return fmt.Errorf("error executing template %q: %v", p.rawTemplate, err) } return nil } @@ -1684,9 +1948,8 @@ func NewJSONPathPrinter(tmpl string) (*JSONPathPrinter, error) { // PrintObj formats the obj with the JSONPath Template. func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error { - var queryObj interface{} - switch obj.(type) { - case *v1.List, *api.List: + var queryObj interface{} = obj + if meta.IsListType(obj) { data, err := json.Marshal(obj) if err != nil { return err @@ -1695,15 +1958,13 @@ func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error { if err := json.Unmarshal(data, &queryObj); err != nil { return err } - default: - queryObj = obj } if err := j.JSONPath.Execute(w, queryObj); err != nil { - fmt.Fprintf(w, "Error executing template: %v\n", err) - fmt.Fprintf(w, "template was:\n\t%v\n", j.rawTemplate) - fmt.Fprintf(w, "object given to jsonpath engine was:\n\t%#v\n", queryObj) - return fmt.Errorf("error executing jsonpath '%v': '%v'\n----data----\n%+v\n", j.rawTemplate, err, obj) + fmt.Fprintf(w, "Error executing template: %v. Printing more information for debugging the template:\n", err) + fmt.Fprintf(w, "\ttemplate was:\n\t\t%v\n", j.rawTemplate) + fmt.Fprintf(w, "\tobject given to jsonpath engine was:\n\t\t%#v\n\n", queryObj) + return fmt.Errorf("error executing jsonpath %q: %v\n", j.rawTemplate, err) } return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/resource_printer_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/resource_printer_test.go index fe2e2776f..52e286db1 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/resource_printer_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/resource_printer_test.go @@ -33,15 +33,17 @@ import ( "k8s.io/kubernetes/pkg/apis/extensions" kubectltesting "k8s.io/kubernetes/pkg/kubectl/testing" "k8s.io/kubernetes/pkg/runtime" + yamlserializer "k8s.io/kubernetes/pkg/runtime/serializer/yaml" "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" "k8s.io/kubernetes/pkg/util/sets" "github.com/ghodss/yaml" ) func init() { - api.Scheme.AddKnownTypes("", &kubectltesting.TestStruct{}) - api.Scheme.AddKnownTypes(testapi.Default.Version(), &kubectltesting.TestStruct{}) + api.Scheme.AddKnownTypes(testapi.Default.InternalGroupVersion(), &kubectltesting.TestStruct{}) + api.Scheme.AddKnownTypes(*testapi.Default.GroupVersion(), &kubectltesting.TestStruct{}) } var testData = kubectltesting.TestStruct{ @@ -64,7 +66,7 @@ func TestVersionedPrinter(t *testing.T) { return nil }), api.Scheme, - testapi.Default.Version(), + *testapi.Default.GroupVersion(), ) if err := p.PrintObj(original, nil); err != nil { t.Errorf("unexpected error: %v", err) @@ -85,11 +87,11 @@ type TestPrintType struct { Data string } -func (*TestPrintType) IsAnAPIObject() {} +func (obj *TestPrintType) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } type TestUnknownType struct{} -func (*TestUnknownType) IsAnAPIObject() {} +func (obj *TestUnknownType) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } func TestPrinter(t *testing.T) { //test inputs @@ -102,7 +104,7 @@ func TestPrinter(t *testing.T) { }, } emptyListTest := &api.PodList{} - testapi, err := api.Scheme.ConvertToVersion(podTest, testapi.Default.Version()) + testapi, err := api.Scheme.ConvertToVersion(podTest, testapi.Default.GroupVersion().String()) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -121,17 +123,17 @@ func TestPrinter(t *testing.T) { {"test jsonpath", "jsonpath", "{.metadata.name}", podTest, "foo"}, {"test jsonpath list", "jsonpath", "{.items[*].metadata.name}", podListTest, "foo bar"}, {"test jsonpath empty list", "jsonpath", "{.items[*].metadata.name}", emptyListTest, ""}, - {"test name", "name", "", podTest, "/foo\n"}, + {"test name", "name", "", podTest, "pod/foo\n"}, {"emits versioned objects", "template", "{{.kind}}", testapi, "Pod"}, } for _, test := range printerTests { buf := bytes.NewBuffer([]byte{}) printer, found, err := GetPrinter(test.Format, test.FormatArgument) if err != nil || !found { - t.Errorf("unexpected error: %#v", err) + t.Errorf("in %s, unexpected error: %#v", test.Name, err) } if err := printer.PrintObj(test.Input, buf); err != nil { - t.Errorf("unexpected error: %#v", err) + t.Errorf("in %s, unexpected error: %#v", test.Name, err) } if buf.String() != test.Expect { t.Errorf("in %s, expect %q, got %q", test.Name, test.Expect, buf.String()) @@ -175,8 +177,8 @@ func testPrinter(t *testing.T, printer ResourcePrinter, unmarshalFunc func(data } // Use real decode function to undo the versioning process. poutput = kubectltesting.TestStruct{} - err = runtime.YAMLDecoder(testapi.Default.Codec()).DecodeInto(buf.Bytes(), &poutput) - if err != nil { + s := yamlserializer.NewDecodingSerializer(testapi.Default.Codec()) + if err := runtime.DecodeInto(s, buf.Bytes(), &poutput); err != nil { t.Fatal(err) } if !reflect.DeepEqual(testData, poutput) { @@ -196,8 +198,7 @@ func testPrinter(t *testing.T, printer ResourcePrinter, unmarshalFunc func(data } // Use real decode function to undo the versioning process. objOut = api.Pod{} - err = runtime.YAMLDecoder(testapi.Default.Codec()).DecodeInto(buf.Bytes(), &objOut) - if err != nil { + if err := runtime.DecodeInto(s, buf.Bytes(), &objOut); err != nil { t.Fatal(err) } if !reflect.DeepEqual(obj, &objOut) { @@ -213,18 +214,18 @@ func TestJSONPrinter(t *testing.T) { testPrinter(t, &JSONPrinter{}, json.Unmarshal) } -func PrintCustomType(obj *TestPrintType, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func PrintCustomType(obj *TestPrintType, w io.Writer, options PrintOptions) error { _, err := fmt.Fprintf(w, "%s", obj.Data) return err } -func ErrorPrintHandler(obj *TestPrintType, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error { +func ErrorPrintHandler(obj *TestPrintType, w io.Writer, options PrintOptions) error { return fmt.Errorf("ErrorPrintHandler error") } func TestCustomTypePrinting(t *testing.T) { columns := []string{"Data"} - printer := NewHumanReadablePrinter(false, false, false, false, []string{}) + printer := NewHumanReadablePrinter(false, false, false, false, false, false, []string{}) printer.Handler(columns, PrintCustomType) obj := TestPrintType{"test object"} @@ -241,7 +242,7 @@ func TestCustomTypePrinting(t *testing.T) { func TestPrintHandlerError(t *testing.T) { columns := []string{"Data"} - printer := NewHumanReadablePrinter(false, false, false, false, []string{}) + printer := NewHumanReadablePrinter(false, false, false, false, false, false, []string{}) printer.Handler(columns, ErrorPrintHandler) obj := TestPrintType{"test object"} buffer := &bytes.Buffer{} @@ -252,7 +253,7 @@ func TestPrintHandlerError(t *testing.T) { } func TestUnknownTypePrinting(t *testing.T) { - printer := NewHumanReadablePrinter(false, false, false, false, []string{}) + printer := NewHumanReadablePrinter(false, false, false, false, false, false, []string{}) buffer := &bytes.Buffer{} err := printer.PrintObj(&TestUnknownType{}, buffer) if err == nil { @@ -422,7 +423,7 @@ func TestTemplateStrings(t *testing.T) { t.Fatalf("tmpl fail: %v", err) } - printer := NewVersionedPrinter(p, api.Scheme, testapi.Default.Version()) + printer := NewVersionedPrinter(p, api.Scheme, *testapi.Default.GroupVersion()) for name, item := range table { buffer := &bytes.Buffer{} @@ -456,14 +457,17 @@ func TestPrinters(t *testing.T) { t.Fatal(err) } printers := map[string]ResourcePrinter{ - "humanReadable": NewHumanReadablePrinter(true, false, false, false, []string{}), - "humanReadableHeaders": NewHumanReadablePrinter(false, false, false, false, []string{}), + "humanReadable": NewHumanReadablePrinter(true, false, false, false, false, false, []string{}), + "humanReadableHeaders": NewHumanReadablePrinter(false, false, false, false, false, false, []string{}), "json": &JSONPrinter{}, "yaml": &YAMLPrinter{}, "template": templatePrinter, "template2": templatePrinter2, "jsonpath": jsonpathPrinter, - "name": &NamePrinter{}, + "name": &NamePrinter{ + Typer: runtime.ObjectTyperToTyper(api.Scheme), + Decoder: api.Codecs.UniversalDecoder(), + }, } objects := map[string]runtime.Object{ "pod": &api.Pod{ObjectMeta: om("pod")}, @@ -497,7 +501,7 @@ func TestPrinters(t *testing.T) { func TestPrintEventsResultSorted(t *testing.T) { // Arrange - printer := NewHumanReadablePrinter(false /* noHeaders */, false, false, false, []string{}) + printer := NewHumanReadablePrinter(false /* noHeaders */, false, false, false, false, false, []string{}) obj := api.EventList{ Items: []api.Event{ @@ -507,6 +511,7 @@ func TestPrintEventsResultSorted(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(2014, time.January, 15, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(2014, time.January, 15, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, { Source: api.EventSource{Component: "scheduler"}, @@ -514,6 +519,7 @@ func TestPrintEventsResultSorted(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(1987, time.June, 17, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(1987, time.June, 17, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, { Source: api.EventSource{Component: "kubelet"}, @@ -521,6 +527,7 @@ func TestPrintEventsResultSorted(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(2002, time.December, 25, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(2002, time.December, 25, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, }, } @@ -538,7 +545,7 @@ func TestPrintEventsResultSorted(t *testing.T) { } func TestPrintNodeStatus(t *testing.T) { - printer := NewHumanReadablePrinter(false, false, false, false, []string{}) + printer := NewHumanReadablePrinter(false, false, false, false, false, false, []string{}) table := []struct { node api.Node status string @@ -635,6 +642,41 @@ func contains(fields []string, field string) bool { return false } +func TestPrintHunmanReadableIngressWithColumnLabels(t *testing.T) { + ingress := extensions.Ingress{ + ObjectMeta: api.ObjectMeta{ + Name: "test1", + CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, + Labels: map[string]string{ + "app_name": "kubectl_test_ingress", + }, + }, + Spec: extensions.IngressSpec{ + Backend: &extensions.IngressBackend{ + ServiceName: "svc", + ServicePort: intstr.FromInt(93), + }, + }, + Status: extensions.IngressStatus{ + LoadBalancer: api.LoadBalancerStatus{ + Ingress: []api.LoadBalancerIngress{ + { + IP: "2.3.4.5", + Hostname: "localhost.localdomain", + }, + }, + }, + }, + } + buff := bytes.Buffer{} + printIngress(&ingress, &buff, PrintOptions{false, false, false, false, false, false, []string{"app_name"}}) + output := string(buff.Bytes()) + appName := ingress.ObjectMeta.Labels["app_name"] + if !strings.Contains(output, appName) { + t.Errorf("expected to container app_name label value %s, but doesn't %s", appName, output) + } +} + func TestPrintHumanReadableService(t *testing.T) { tests := []api.Service{ { @@ -749,7 +791,7 @@ func TestPrintHumanReadableService(t *testing.T) { for _, svc := range tests { buff := bytes.Buffer{} - printService(&svc, &buff, false, false, false, []string{}) + printService(&svc, &buff, PrintOptions{false, false, false, false, false, false, []string{}}) output := string(buff.Bytes()) ip := svc.Spec.ClusterIP if !strings.Contains(output, ip) { @@ -902,6 +944,7 @@ func TestPrintHumanReadableWithNamespace(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(2014, time.January, 15, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(2014, time.January, 15, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, isNamespaced: true, }, @@ -930,7 +973,7 @@ func TestPrintHumanReadableWithNamespace(t *testing.T) { for _, test := range table { if test.isNamespaced { // Expect output to include namespace when requested. - printer := NewHumanReadablePrinter(false, true, false, false, []string{}) + printer := NewHumanReadablePrinter(false, true, false, false, false, false, []string{}) buffer := &bytes.Buffer{} err := printer.PrintObj(test.obj, buffer) if err != nil { @@ -942,7 +985,7 @@ func TestPrintHumanReadableWithNamespace(t *testing.T) { } } else { // Expect error when trying to get all namespaces for un-namespaced object. - printer := NewHumanReadablePrinter(false, true, false, false, []string{}) + printer := NewHumanReadablePrinter(false, true, false, false, false, false, []string{}) buffer := &bytes.Buffer{} err := printer.PrintObj(test.obj, buffer) if err == nil { @@ -1037,7 +1080,7 @@ func TestPrintPod(t *testing.T) { buf := bytes.NewBuffer([]byte{}) for _, test := range tests { - printPod(&test.pod, buf, false, false, true, []string{}) + printPod(&test.pod, buf, PrintOptions{false, false, false, true, false, false, []string{}}) // We ignore time if !strings.HasPrefix(buf.String(), test.expect) { t.Fatalf("Expected: %s, got: %s", test.expect, buf.String()) @@ -1130,7 +1173,7 @@ func TestPrintNonTerminatedPod(t *testing.T) { buf := bytes.NewBuffer([]byte{}) for _, test := range tests { - printPod(&test.pod, buf, false, false, false, []string{}) + printPod(&test.pod, buf, PrintOptions{false, false, false, false, false, false, []string{}}) // We ignore time if !strings.HasPrefix(buf.String(), test.expect) { t.Fatalf("Expected: %s, got: %s", test.expect, buf.String()) @@ -1190,7 +1233,7 @@ func TestPrintPodWithLabels(t *testing.T) { buf := bytes.NewBuffer([]byte{}) for _, test := range tests { - printPod(&test.pod, buf, false, false, false, test.labelColumns) + printPod(&test.pod, buf, PrintOptions{false, false, false, false, false, false, test.labelColumns}) // We ignore time if !strings.HasPrefix(buf.String(), test.startsWith) || !strings.HasSuffix(buf.String(), test.endsWith) { t.Fatalf("Expected to start with: %s and end with: %s, but got: %s", test.startsWith, test.endsWith, buf.String()) @@ -1213,7 +1256,7 @@ func TestTranslateTimestamp(t *testing.T) { {"5 minutes ago", translateTimestamp(unversioned.Time{Time: time.Now().Add(-3e11)}), "5m"}, {"an hour ago", translateTimestamp(unversioned.Time{Time: time.Now().Add(-6e12)}), "1h"}, {"2 days ago", translateTimestamp(unversioned.Time{Time: time.Now().AddDate(0, 0, -2)}), "2d"}, - {"months ago", translateTimestamp(unversioned.Time{Time: time.Now().AddDate(0, -3, 0)}), "92d"}, + {"months ago", translateTimestamp(unversioned.Time{Time: time.Now().AddDate(0, 0, -90)}), "90d"}, {"10 years ago", translateTimestamp(unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}), "10y"}, } for _, test := range tl { @@ -1237,25 +1280,87 @@ func TestPrintDeployment(t *testing.T) { }, Spec: extensions.DeploymentSpec{ Replicas: 5, - Template: &api.PodTemplateSpec{ + Template: api.PodTemplateSpec{ Spec: api.PodSpec{Containers: make([]api.Container, 2)}, }, }, Status: extensions.DeploymentStatus{ - Replicas: 10, - UpdatedReplicas: 2, + Replicas: 10, + UpdatedReplicas: 2, + AvailableReplicas: 1, + UnavailableReplicas: 4, }, }, - "test1\t2/5\t0s\n", + "test1\t5\t10\t2\t1\t0s\n", }, } buf := bytes.NewBuffer([]byte{}) for _, test := range tests { - printDeployment(&test.deployment, buf, false, false, true, []string{}) + printDeployment(&test.deployment, buf, PrintOptions{false, false, false, true, false, false, []string{}}) if buf.String() != test.expect { t.Fatalf("Expected: %s, got: %s", test.expect, buf.String()) } buf.Reset() } } + +func TestPrintPodShowLabels(t *testing.T) { + tests := []struct { + pod api.Pod + startsWith string + endsWith string + showLabels bool + }{ + { + // Test name, num of containers, restarts, container ready status + api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "test1", + Labels: map[string]string{"col1": "asd", "COL2": "zxc"}, + }, + Spec: api.PodSpec{Containers: make([]api.Container, 2)}, + Status: api.PodStatus{ + Phase: "podPhase", + ContainerStatuses: []api.ContainerStatus{ + {Ready: true, RestartCount: 3, State: api.ContainerState{Running: &api.ContainerStateRunning{}}}, + {RestartCount: 3}, + }, + }, + }, + "test1\t1/2\tpodPhase\t6\t", + "\tCOL2=zxc,col1=asd\n", + true, + }, + { + // Test name, num of containers, restarts, container ready status + api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "test1", + Labels: map[string]string{"col3": "asd", "COL4": "zxc"}, + }, + Spec: api.PodSpec{Containers: make([]api.Container, 2)}, + Status: api.PodStatus{ + Phase: "podPhase", + ContainerStatuses: []api.ContainerStatus{ + {Ready: true, RestartCount: 3, State: api.ContainerState{Running: &api.ContainerStateRunning{}}}, + {RestartCount: 3}, + }, + }, + }, + "test1\t1/2\tpodPhase\t6\t", + "\n", + false, + }, + } + + buf := bytes.NewBuffer([]byte{}) + for _, test := range tests { + printPod(&test.pod, buf, PrintOptions{false, false, false, false, test.showLabels, false, []string{}}) + // We ignore time + if !strings.HasPrefix(buf.String(), test.startsWith) || !strings.HasSuffix(buf.String(), test.endsWith) { + t.Fatalf("Expected to start with: %s and end with: %s, but got: %s", test.startsWith, test.endsWith, buf.String()) + } + buf.Reset() + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/rollback.go b/vendor/k8s.io/kubernetes/pkg/kubectl/rollback.go new file mode 100644 index 000000000..9f53b25af --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/rollback.go @@ -0,0 +1,118 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kubectl + +import ( + "fmt" + "os" + "os/signal" + "syscall" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" + client "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/runtime" + deploymentutil "k8s.io/kubernetes/pkg/util/deployment" + "k8s.io/kubernetes/pkg/watch" +) + +// Rollbacker provides an interface for resources that can be rolled back. +type Rollbacker interface { + Rollback(namespace, name string, updatedAnnotations map[string]string, toRevision int64, obj runtime.Object) (string, error) +} + +func RollbackerFor(kind unversioned.GroupKind, c client.Interface) (Rollbacker, error) { + switch kind { + case extensions.Kind("Deployment"): + return &DeploymentRollbacker{c}, nil + } + return nil, fmt.Errorf("no rollbacker has been implemented for %q", kind) +} + +type DeploymentRollbacker struct { + c client.Interface +} + +func (r *DeploymentRollbacker) Rollback(namespace, name string, updatedAnnotations map[string]string, toRevision int64, obj runtime.Object) (string, error) { + deploymentRollback := &extensions.DeploymentRollback{ + Name: name, + UpdatedAnnotations: updatedAnnotations, + RollbackTo: extensions.RollbackConfig{ + Revision: toRevision, + }, + } + result := "" + + // Get current events + events, err := r.c.Events(namespace).List(api.ListOptions{}) + if err != nil { + return result, err + } + // Do the rollback + if err := r.c.Extensions().Deployments(namespace).Rollback(deploymentRollback); err != nil { + return result, err + } + // Watch for the changes of events + watch, err := r.c.Events(namespace).Watch(api.ListOptions{Watch: true, ResourceVersion: events.ResourceVersion}) + if err != nil { + return result, err + } + result = watchRollbackEvent(watch) + return result, err +} + +// watchRollbackEvent watches for rollback events and returns rollback result +func watchRollbackEvent(w watch.Interface) string { + signals := make(chan os.Signal, 1) + signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGTERM) + for { + select { + case event, ok := <-w.ResultChan(): + if !ok { + return "" + } + obj, ok := event.Object.(*api.Event) + if !ok { + w.Stop() + return "" + } + isRollback, result := isRollbackEvent(obj) + if isRollback { + w.Stop() + return result + } + case <-signals: + w.Stop() + } + } +} + +// isRollbackEvent checks if the input event is about rollback, and returns true and +// related result string back if it is. +func isRollbackEvent(e *api.Event) (bool, string) { + rollbackEventReasons := []string{deploymentutil.RollbackRevisionNotFound, deploymentutil.RollbackTemplateUnchanged, deploymentutil.RollbackDone} + for _, reason := range rollbackEventReasons { + if e.Reason == reason { + if reason == deploymentutil.RollbackDone { + return true, "rolled back" + } + return true, fmt.Sprintf("skipped rollback (%s: %s)", e.Reason, e.Message) + } + } + return false, "" +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go b/vendor/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go index f2420456a..d734b153d 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/rolling_updater.go @@ -28,9 +28,10 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" client "k8s.io/kubernetes/pkg/client/unversioned" - "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/integer" + "k8s.io/kubernetes/pkg/util/intstr" "k8s.io/kubernetes/pkg/util/wait" ) @@ -70,7 +71,7 @@ type RollingUpdaterConfig struct { // can be scaled down further, followed by scaling up the new RC, ensuring // that the total number of pods available at all times during the update is at // least 70% of desired pods. - MaxUnavailable util.IntOrString + MaxUnavailable intstr.IntOrString // MaxSurge is the maximum number of pods that can be scheduled above the desired number of pods. // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). // This can not be 0 if MaxUnavailable is 0. @@ -81,7 +82,7 @@ type RollingUpdaterConfig struct { // 130% of desired pods. Once old pods have been killed, new RC can be scaled up // further, ensuring that total number of pods running at any time during // the update is atmost 130% of desired pods. - MaxSurge util.IntOrString + MaxSurge intstr.IntOrString } // RollingUpdaterCleanupPolicy is a cleanup action to take after the @@ -208,13 +209,20 @@ func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error { if err != nil { return err } - // Further validation. - if maxUnavailable == 0 && maxSurge == 0 { + // Validate maximums. + if desired > 0 && maxUnavailable == 0 && maxSurge == 0 { return fmt.Errorf("one of maxSurge or maxUnavailable must be specified") } // The minumum pods which must remain available througout the update // calculated for internal convenience. - minAvailable := original - maxUnavailable + minAvailable := integer.IntMax(0, desired-maxUnavailable) + // If the desired new scale is 0, then the max unavailable is necessarily + // the effective scale of the old RC regardless of the configuration + // (equivalent to 100% maxUnavailable). + if desired == 0 { + maxUnavailable = original + minAvailable = 0 + } fmt.Fprintf(out, "Scaling up %s from %d to %d, scaling down %s from %d to 0 (keep %d pods available, don't exceed %d pods)\n", newRc.Name, newRc.Spec.Replicas, desired, oldRc.Name, oldRc.Spec.Replicas, minAvailable, original+maxSurge) @@ -300,14 +308,14 @@ func (r *RollingUpdater) scaleDown(newRc, oldRc *api.ReplicationController, desi return oldRc, nil } // Block until there are any pods ready. - oldAvailable, newAvailable, err := r.waitForReadyPods(config.Interval, config.Timeout, oldRc, newRc) + _, newAvailable, err := r.waitForReadyPods(config.Interval, config.Timeout, oldRc, newRc) if err != nil { return nil, err } // The old controller is considered as part of the total because we want to // maintain minimum availability even with a volatile old controller. - // Scale down as much as possible while maintaining minimum availability. - decrement := (oldAvailable + newAvailable) - minAvailable + // Scale down as much as possible while maintaining minimum availability + decrement := oldRc.Spec.Replicas + newAvailable - minAvailable // The decrement normally shouldn't drop below 0 because the available count // always starts below the old replica count, but the old replica count can // decrement due to externalities like pods death in the replica set. This @@ -342,7 +350,7 @@ func (r *RollingUpdater) scaleDown(newRc, oldRc *api.ReplicationController, desi // scalerScaleAndWait scales a controller using a Scaler and a real client. func (r *RollingUpdater) scaleAndWaitWithScaler(rc *api.ReplicationController, retry *RetryParams, wait *RetryParams) (*api.ReplicationController, error) { - scaler, err := ScalerFor("ReplicationController", r.c) + scaler, err := ScalerFor(api.Kind("ReplicationController"), r.c) if err != nil { return nil, fmt.Errorf("Couldn't make scaler: %s", err) } @@ -363,7 +371,8 @@ func (r *RollingUpdater) pollForReadyPods(interval, timeout time.Duration, oldRc anyReady := false for _, controller := range controllers { selector := labels.Set(controller.Spec.Selector).AsSelector() - pods, err := r.c.Pods(controller.Namespace).List(selector, fields.Everything()) + options := api.ListOptions{LabelSelector: selector} + pods, err := r.c.Pods(controller.Namespace).List(options) if err != nil { return false, err } @@ -404,7 +413,7 @@ func (r *RollingUpdater) getOrCreateTargetControllerWithClient(controller *api.R return nil, false, err } if controller.Spec.Replicas <= 0 { - return nil, false, fmt.Errorf("Invalid controller spec for %s; required: > 0 replicas, actual: %d\n", controller.Name, controller.Spec) + return nil, false, fmt.Errorf("Invalid controller spec for %s; required: > 0 replicas, actual: %d\n", controller.Name, controller.Spec.Replicas) } // The controller wasn't found, so create it. if controller.Annotations == nil { @@ -430,7 +439,7 @@ func (r *RollingUpdater) getOrCreateTargetControllerWithClient(controller *api.R func (r *RollingUpdater) existingController(controller *api.ReplicationController) (*api.ReplicationController, error) { // without rc name but generate name, there's no existing rc if len(controller.Name) == 0 && len(controller.GenerateName) > 0 { - return nil, errors.NewNotFound("ReplicationController", controller.Name) + return nil, errors.NewNotFound(api.Resource("replicationcontrollers"), controller.Name) } // controller name is required to get rc back return r.c.ReplicationControllers(controller.Namespace).Get(controller.Name) @@ -483,14 +492,14 @@ func (r *RollingUpdater) cleanupWithClients(oldRc, newRc *api.ReplicationControl // func extractMaxValue is a helper to extract config max values as either // absolute numbers or based on percentages of the given value. -func extractMaxValue(field util.IntOrString, name string, value int) (int, error) { - switch field.Kind { - case util.IntstrInt: +func extractMaxValue(field intstr.IntOrString, name string, value int) (int, error) { + switch field.Type { + case intstr.Int: if field.IntVal < 0 { return 0, fmt.Errorf("%s must be >= 0", name) } - return field.IntVal, nil - case util.IntstrString: + return field.IntValue(), nil + case intstr.String: s := strings.Replace(field.StrVal, "%", "", -1) v, err := strconv.Atoi(s) if err != nil { @@ -501,7 +510,7 @@ func extractMaxValue(field util.IntOrString, name string, value int) (int, error } return int(math.Ceil(float64(value) * (float64(v)) / 100)), nil } - return 0, fmt.Errorf("invalid kind %q for %s", field.Kind, name) + return 0, fmt.Errorf("invalid kind %q for %s", field.Type, name) } func Rename(c client.ReplicationControllersNamespacer, rc *api.ReplicationController, newName string) error { @@ -531,23 +540,40 @@ func LoadExistingNextReplicationController(c client.ReplicationControllersNamesp return newRc, err } -func CreateNewControllerFromCurrentController(c *client.Client, namespace, oldName, newName, image, deploymentKey string) (*api.ReplicationController, error) { +func CreateNewControllerFromCurrentController(c client.Interface, codec runtime.Codec, namespace, oldName, newName, image, container, deploymentKey string) (*api.ReplicationController, error) { + containerIndex := 0 // load the old RC into the "new" RC newRc, err := c.ReplicationControllers(namespace).Get(oldName) if err != nil { return nil, err } - if len(newRc.Spec.Template.Spec.Containers) > 1 { - // TODO: support multi-container image update. - return nil, goerrors.New("Image update is not supported for multi-container pods") + if len(container) != 0 { + containerFound := false + + for i, c := range newRc.Spec.Template.Spec.Containers { + if c.Name == container { + containerIndex = i + containerFound = true + break + } + } + + if !containerFound { + return nil, fmt.Errorf("container %s not found in pod", container) + } } + + if len(newRc.Spec.Template.Spec.Containers) > 1 && len(container) == 0 { + return nil, goerrors.New("Must specify container to update when updating a multi-container pod") + } + if len(newRc.Spec.Template.Spec.Containers) == 0 { return nil, goerrors.New(fmt.Sprintf("Pod has no containers! (%v)", newRc)) } - newRc.Spec.Template.Spec.Containers[0].Image = image + newRc.Spec.Template.Spec.Containers[containerIndex].Image = image - newHash, err := api.HashObject(newRc, c.Codec) + newHash, err := api.HashObject(newRc, codec) if err != nil { return nil, err } @@ -627,7 +653,9 @@ func AddDeploymentKeyToReplicationController(oldRc *api.ReplicationController, c // Update all pods managed by the rc to have the new hash label, so they are correctly adopted // TODO: extract the code from the label command and re-use it here. - podList, err := client.Pods(namespace).List(labels.SelectorFromSet(oldRc.Spec.Selector), fields.Everything()) + selector := labels.SelectorFromSet(oldRc.Spec.Selector) + options := api.ListOptions{LabelSelector: selector} + podList, err := client.Pods(namespace).List(options) if err != nil { return nil, err } @@ -677,7 +705,9 @@ func AddDeploymentKeyToReplicationController(oldRc *api.ReplicationController, c // Clean up any orphaned pods that don't have the new label, this can happen if the rc manager // doesn't see the update to its pod template and creates a new pod with the old labels after // we've finished re-adopting existing pods to the rc. - podList, err = client.Pods(namespace).List(labels.SelectorFromSet(selectorCopy), fields.Everything()) + selector = labels.SelectorFromSet(selectorCopy) + options = api.ListOptions{LabelSelector: selector} + podList, err = client.Pods(namespace).List(options) for ix := range podList.Items { pod := &podList.Items[ix] if value, found := pod.Labels[deploymentKey]; !found || value != deploymentValue { @@ -718,7 +748,7 @@ func updateWithRetries(rcClient client.ReplicationControllerInterface, rc *api.R } func FindSourceController(r client.ReplicationControllersNamespacer, namespace, name string) (*api.ReplicationController, error) { - list, err := r.ReplicationControllers(namespace).List(labels.Everything(), fields.Everything()) + list, err := r.ReplicationControllers(namespace).List(api.ListOptions{}) if err != nil { return nil, err } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/rolling_updater_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/rolling_updater_test.go index f48f08d7c..4ba556847 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/rolling_updater_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/rolling_updater_test.go @@ -33,7 +33,7 @@ import ( "k8s.io/kubernetes/pkg/client/unversioned/fake" "k8s.io/kubernetes/pkg/client/unversioned/testclient" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" "k8s.io/kubernetes/pkg/util/sets" ) @@ -114,8 +114,8 @@ func TestUpdate(t *testing.T) { newRc *api.ReplicationController // whether newRc existed (false means it was created) newRcExists bool - maxUnavail util.IntOrString - maxSurge util.IntOrString + maxUnavail intstr.IntOrString + maxSurge intstr.IntOrString // expected is the sequence of up/down events that will be simulated and // verified expected []interface{} @@ -127,8 +127,8 @@ func TestUpdate(t *testing.T) { oldRc: oldRc(10, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("30%"), - maxSurge: util.NewIntOrStringFromString("0%"), + maxUnavail: intstr.FromString("30%"), + maxSurge: intstr.FromString("0%"), expected: []interface{}{ down{oldReady: 10, newReady: 0, to: 7}, up{3}, @@ -156,8 +156,8 @@ Scaling foo-v2 up to 10 oldRc: oldRc(10, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("30%"), - maxSurge: util.NewIntOrStringFromString("0%"), + maxUnavail: intstr.FromString("30%"), + maxSurge: intstr.FromString("0%"), expected: []interface{}{ down{oldReady: 10, newReady: 0, to: 7}, up{3}, @@ -185,8 +185,8 @@ Scaling foo-v2 up to 10 oldRc: oldRc(7, 10), newRc: newRc(3, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("30%"), - maxSurge: util.NewIntOrStringFromString("0%"), + maxUnavail: intstr.FromString("30%"), + maxSurge: intstr.FromString("0%"), expected: []interface{}{ down{oldReady: 7, newReady: 3, to: 4}, up{6}, @@ -209,8 +209,8 @@ Scaling foo-v2 up to 10 oldRc: oldRc(7, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("30%"), - maxSurge: util.NewIntOrStringFromString("0%"), + maxUnavail: intstr.FromString("30%"), + maxSurge: intstr.FromString("0%"), expected: []interface{}{ down{oldReady: 7, newReady: 0, noop: true}, up{3}, @@ -236,8 +236,8 @@ Scaling foo-v2 up to 10 oldRc: oldRc(10, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("0%"), - maxSurge: util.NewIntOrStringFromString("30%"), + maxUnavail: intstr.FromString("0%"), + maxSurge: intstr.FromString("30%"), expected: []interface{}{ up{3}, down{oldReady: 10, newReady: 3, to: 7}, @@ -264,8 +264,8 @@ Scaling foo-v1 down to 0 oldRc: oldRc(10, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("0%"), - maxSurge: util.NewIntOrStringFromString("30%"), + maxUnavail: intstr.FromString("0%"), + maxSurge: intstr.FromString("30%"), expected: []interface{}{ up{3}, down{oldReady: 10, newReady: 0, noop: true}, @@ -298,8 +298,8 @@ Scaling foo-v1 down to 0 oldRc: oldRc(10, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("10%"), - maxSurge: util.NewIntOrStringFromString("20%"), + maxUnavail: intstr.FromString("10%"), + maxSurge: intstr.FromString("20%"), expected: []interface{}{ up{2}, down{oldReady: 10, newReady: 2, to: 7}, @@ -308,7 +308,7 @@ Scaling foo-v1 down to 0 up{8}, down{oldReady: 4, newReady: 8, to: 1}, up{10}, - down{oldReady: 10, newReady: 1, to: 0}, + down{oldReady: 1, newReady: 10, to: 0}, }, output: `Created foo-v2 Scaling up foo-v2 from 0 to 10, scaling down foo-v1 from 10 to 0 (keep 9 pods available, don't exceed 12 pods) @@ -326,8 +326,8 @@ Scaling foo-v1 down to 0 oldRc: oldRc(10, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("10%"), - maxSurge: util.NewIntOrStringFromString("20%"), + maxUnavail: intstr.FromString("10%"), + maxSurge: intstr.FromString("20%"), expected: []interface{}{ up{2}, down{oldReady: 10, newReady: 2, to: 7}, @@ -355,8 +355,8 @@ Scaling foo-v1 down to 0 oldRc: oldRc(10, 10), newRc: newRc(2, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("10%"), - maxSurge: util.NewIntOrStringFromString("20%"), + maxUnavail: intstr.FromString("10%"), + maxSurge: intstr.FromString("20%"), expected: []interface{}{ down{oldReady: 10, newReady: 2, to: 7}, up{5}, @@ -381,8 +381,8 @@ Scaling foo-v1 down to 0 oldRc: oldRc(10, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("0%"), - maxSurge: util.NewIntOrStringFromString("100%"), + maxUnavail: intstr.FromString("0%"), + maxSurge: intstr.FromString("100%"), expected: []interface{}{ up{10}, down{oldReady: 10, newReady: 10, to: 0}, @@ -397,8 +397,8 @@ Scaling foo-v1 down to 0 oldRc: oldRc(10, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("0%"), - maxSurge: util.NewIntOrStringFromString("100%"), + maxUnavail: intstr.FromString("0%"), + maxSurge: intstr.FromString("100%"), expected: []interface{}{ up{10}, down{oldReady: 10, newReady: 0, noop: true}, @@ -418,8 +418,8 @@ Scaling foo-v1 down to 0 oldRc: oldRc(10, 10), newRc: newRc(0, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("100%"), - maxSurge: util.NewIntOrStringFromString("0%"), + maxUnavail: intstr.FromString("100%"), + maxSurge: intstr.FromString("0%"), expected: []interface{}{ down{oldReady: 10, newReady: 0, to: 0}, up{10}, @@ -434,8 +434,8 @@ Scaling foo-v2 up to 10 oldRc: oldRc(1, 1), newRc: newRc(0, 1), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("10%"), - maxSurge: util.NewIntOrStringFromString("0%"), + maxUnavail: intstr.FromString("10%"), + maxSurge: intstr.FromString("0%"), expected: []interface{}{ down{oldReady: 1, newReady: 0, to: 0}, up{1}, @@ -450,8 +450,8 @@ Scaling foo-v2 up to 1 oldRc: oldRc(1, 1), newRc: newRc(0, 1), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("0%"), - maxSurge: util.NewIntOrStringFromString("10%"), + maxUnavail: intstr.FromString("0%"), + maxSurge: intstr.FromString("10%"), expected: []interface{}{ up{1}, down{oldReady: 1, newReady: 0, noop: true}, @@ -467,8 +467,8 @@ Scaling foo-v1 down to 0 oldRc: oldRc(1, 1), newRc: newRc(0, 1), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("10%"), - maxSurge: util.NewIntOrStringFromString("10%"), + maxUnavail: intstr.FromString("10%"), + maxSurge: intstr.FromString("10%"), expected: []interface{}{ up{1}, down{oldReady: 1, newReady: 0, noop: true}, @@ -484,8 +484,8 @@ Scaling foo-v1 down to 0 oldRc: oldRc(3, 3), newRc: newRc(0, 3), newRcExists: false, - maxUnavail: util.NewIntOrStringFromInt(0), - maxSurge: util.NewIntOrStringFromInt(1), + maxUnavail: intstr.FromInt(0), + maxSurge: intstr.FromInt(1), expected: []interface{}{ up{1}, down{oldReady: 3, newReady: 1, to: 2}, @@ -508,15 +508,15 @@ Scaling foo-v1 down to 0 oldRc: oldRc(6, 10), newRc: newRc(5, 10), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("0%"), - maxSurge: util.NewIntOrStringFromString("20%"), + maxUnavail: intstr.FromString("0%"), + maxSurge: intstr.FromString("20%"), expected: []interface{}{ up{6}, down{oldReady: 6, newReady: 6, to: 4}, up{8}, down{oldReady: 4, newReady: 8, to: 2}, up{10}, - down{oldReady: 10, newReady: 2, to: 0}, + down{oldReady: 1, newReady: 10, to: 0}, }, output: `Created foo-v2 Scaling up foo-v2 from 5 to 10, scaling down foo-v1 from 6 to 0 (keep 10 pods available, don't exceed 12 pods) @@ -532,16 +532,108 @@ Scaling foo-v1 down to 0 oldRc: oldRc(10, 10), newRc: newRc(0, 20), newRcExists: false, - maxUnavail: util.NewIntOrStringFromString("0%"), - maxSurge: util.NewIntOrStringFromString("300%"), + maxUnavail: intstr.FromString("0%"), + maxSurge: intstr.FromString("300%"), expected: []interface{}{ up{20}, down{oldReady: 10, newReady: 20, to: 0}, }, output: `Created foo-v2 -Scaling up foo-v2 from 0 to 20, scaling down foo-v1 from 10 to 0 (keep 10 pods available, don't exceed 70 pods) +Scaling up foo-v2 from 0 to 20, scaling down foo-v1 from 10 to 0 (keep 20 pods available, don't exceed 70 pods) Scaling foo-v2 up to 20 Scaling foo-v1 down to 0 +`, + }, { + name: "1->1 0/1 scale down unavailable rc to a ready rc (rollback)", + oldRc: oldRc(1, 1), + newRc: newRc(1, 1), + newRcExists: true, + maxUnavail: intstr.FromInt(0), + maxSurge: intstr.FromInt(1), + expected: []interface{}{ + up{1}, + down{oldReady: 0, newReady: 1, to: 0}, + }, + output: `Continuing update with existing controller foo-v2. +Scaling up foo-v2 from 1 to 1, scaling down foo-v1 from 1 to 0 (keep 1 pods available, don't exceed 2 pods) +Scaling foo-v1 down to 0 +`, + }, + { + name: "3->0 1/1 desired 0 (absolute values)", + oldRc: oldRc(3, 3), + newRc: newRc(0, 0), + newRcExists: true, + maxUnavail: intstr.FromInt(1), + maxSurge: intstr.FromInt(1), + expected: []interface{}{ + down{oldReady: 3, newReady: 0, to: 0}, + }, + output: `Continuing update with existing controller foo-v2. +Scaling up foo-v2 from 0 to 0, scaling down foo-v1 from 3 to 0 (keep 0 pods available, don't exceed 4 pods) +Scaling foo-v1 down to 0 +`, + }, + { + name: "3->0 10/10 desired 0 (percentages)", + oldRc: oldRc(3, 3), + newRc: newRc(0, 0), + newRcExists: true, + maxUnavail: intstr.FromString("10%"), + maxSurge: intstr.FromString("10%"), + expected: []interface{}{ + down{oldReady: 3, newReady: 0, to: 0}, + }, + output: `Continuing update with existing controller foo-v2. +Scaling up foo-v2 from 0 to 0, scaling down foo-v1 from 3 to 0 (keep 0 pods available, don't exceed 3 pods) +Scaling foo-v1 down to 0 +`, + }, + { + name: "3->0 10/10 desired 0 (create new RC)", + oldRc: oldRc(3, 3), + newRc: newRc(0, 0), + newRcExists: false, + maxUnavail: intstr.FromString("10%"), + maxSurge: intstr.FromString("10%"), + expected: []interface{}{ + down{oldReady: 3, newReady: 0, to: 0}, + }, + output: `Created foo-v2 +Scaling up foo-v2 from 0 to 0, scaling down foo-v1 from 3 to 0 (keep 0 pods available, don't exceed 3 pods) +Scaling foo-v1 down to 0 +`, + }, + { + name: "0->0 1/1 desired 0 (absolute values)", + oldRc: oldRc(0, 0), + newRc: newRc(0, 0), + newRcExists: true, + maxUnavail: intstr.FromInt(1), + maxSurge: intstr.FromInt(1), + expected: []interface{}{ + down{oldReady: 0, newReady: 0, to: 0}, + }, + output: `Continuing update with existing controller foo-v2. +Scaling up foo-v2 from 0 to 0, scaling down foo-v1 from 0 to 0 (keep 0 pods available, don't exceed 1 pods) +`, + }, { + name: "30->2 50%/0", + oldRc: oldRc(30, 30), + newRc: newRc(0, 2), + newRcExists: false, + maxUnavail: intstr.FromString("50%"), + maxSurge: intstr.FromInt(0), + expected: []interface{}{ + down{oldReady: 30, newReady: 0, to: 1}, + up{2}, + down{oldReady: 1, newReady: 2, to: 0}, + }, + output: `Created foo-v2 +Scaling up foo-v2 from 0 to 2, scaling down foo-v1 from 30 to 0 (keep 1 pods available, don't exceed 30 pods) +Scaling foo-v1 down to 1 +Scaling foo-v2 up to 2 +Scaling foo-v1 down to 0 `, }, } @@ -680,8 +772,8 @@ func TestUpdate_progressTimeout(t *testing.T) { Interval: time.Millisecond, Timeout: time.Millisecond, CleanupPolicy: DeleteRollingUpdateCleanupPolicy, - MaxUnavailable: util.NewIntOrStringFromInt(0), - MaxSurge: util.NewIntOrStringFromInt(1), + MaxUnavailable: intstr.FromInt(0), + MaxSurge: intstr.FromInt(1), } err := updater.Update(config) if err == nil { @@ -733,7 +825,7 @@ func TestUpdate_assignOriginalAnnotation(t *testing.T) { Interval: time.Millisecond, Timeout: time.Millisecond, CleanupPolicy: DeleteRollingUpdateCleanupPolicy, - MaxUnavailable: util.NewIntOrStringFromString("100%"), + MaxUnavailable: intstr.FromString("100%"), } err := updater.Update(config) if err != nil { @@ -747,6 +839,166 @@ func TestUpdate_assignOriginalAnnotation(t *testing.T) { } } +func TestRollingUpdater_multipleContainersInPod(t *testing.T) { + tests := []struct { + oldRc *api.ReplicationController + newRc *api.ReplicationController + + container string + image string + deploymentKey string + }{ + { + oldRc: &api.ReplicationController{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Spec: api.ReplicationControllerSpec{ + Selector: map[string]string{ + "dk": "old", + }, + Template: &api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: map[string]string{ + "dk": "old", + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Name: "container1", + Image: "image1", + }, + { + Name: "container2", + Image: "image2", + }, + }, + }, + }, + }, + }, + newRc: &api.ReplicationController{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Spec: api.ReplicationControllerSpec{ + Selector: map[string]string{ + "dk": "old", + }, + Template: &api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: map[string]string{ + "dk": "old", + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Name: "container1", + Image: "newimage", + }, + { + Name: "container2", + Image: "image2", + }, + }, + }, + }, + }, + }, + container: "container1", + image: "newimage", + deploymentKey: "dk", + }, + { + oldRc: &api.ReplicationController{ + ObjectMeta: api.ObjectMeta{ + Name: "bar", + }, + Spec: api.ReplicationControllerSpec{ + Selector: map[string]string{ + "dk": "old", + }, + Template: &api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: map[string]string{ + "dk": "old", + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Name: "container1", + Image: "image1", + }, + }, + }, + }, + }, + }, + newRc: &api.ReplicationController{ + ObjectMeta: api.ObjectMeta{ + Name: "bar", + }, + Spec: api.ReplicationControllerSpec{ + Selector: map[string]string{ + "dk": "old", + }, + Template: &api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: map[string]string{ + "dk": "old", + }, + }, + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Name: "container1", + Image: "newimage", + }, + }, + }, + }, + }, + }, + container: "container1", + image: "newimage", + deploymentKey: "dk", + }, + } + + for _, test := range tests { + fake := &testclient.Fake{} + fake.AddReactor("*", "*", func(action testclient.Action) (handled bool, ret runtime.Object, err error) { + switch action.(type) { + case testclient.GetAction: + return true, test.oldRc, nil + } + return false, nil, nil + }) + + codec := testapi.Default.Codec() + + deploymentHash, err := api.HashObject(test.newRc, codec) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + + test.newRc.Spec.Selector[test.deploymentKey] = deploymentHash + test.newRc.Spec.Template.Labels[test.deploymentKey] = deploymentHash + test.newRc.Name = fmt.Sprintf("%s-%s", test.newRc.Name, deploymentHash) + + updatedRc, err := CreateNewControllerFromCurrentController(fake, codec, "", test.oldRc.ObjectMeta.Name, test.newRc.ObjectMeta.Name, test.image, test.container, test.deploymentKey) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + if !reflect.DeepEqual(updatedRc, test.newRc) { + t.Errorf("expected:\n%v\ngot:\n%v\n", test.newRc, updatedRc) + } + } +} + // TestRollingUpdater_cleanupWithClients ensures that the cleanup policy is // correctly implemented. func TestRollingUpdater_cleanupWithClients(t *testing.T) { @@ -1051,7 +1303,7 @@ func TestUpdateWithRetries(t *testing.T) { } fakeClient := &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == testapi.Default.ResourcePath("replicationcontrollers", "default", "rc") && m == "PUT": update := updates[0] @@ -1076,7 +1328,7 @@ func TestUpdateWithRetries(t *testing.T) { } }), } - clientConfig := &client.Config{Version: testapi.Default.Version()} + clientConfig := &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} client := client.NewOrDie(clientConfig) client.Client = fakeClient.Client @@ -1099,7 +1351,7 @@ func readOrDie(t *testing.T, req *http.Request, codec runtime.Codec) runtime.Obj t.Errorf("Error reading: %v", err) t.FailNow() } - obj, err := codec.Decode(data) + obj, err := runtime.Decode(codec, data) if err != nil { t.Errorf("error decoding: %v", err) t.FailNow() @@ -1142,7 +1394,7 @@ func TestAddDeploymentHash(t *testing.T) { updatedRc := false fakeClient := &fake.RESTClient{ Codec: codec, - Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { + Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == testapi.Default.ResourcePath("pods", "default", "") && m == "GET": if req.URL.RawQuery != "labelSelector=foo%3Dbar" { @@ -1173,7 +1425,7 @@ func TestAddDeploymentHash(t *testing.T) { } }), } - clientConfig := &client.Config{Version: testapi.Default.Version()} + clientConfig := &client.Config{ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} client := client.NewOrDie(clientConfig) client.Client = fakeClient.Client @@ -1301,54 +1553,54 @@ func TestRollingUpdater_pollForReadyPods(t *testing.T) { func TestRollingUpdater_extractMaxValue(t *testing.T) { tests := []struct { - field util.IntOrString + field intstr.IntOrString original int expected int valid bool }{ { - field: util.NewIntOrStringFromInt(1), + field: intstr.FromInt(1), original: 100, expected: 1, valid: true, }, { - field: util.NewIntOrStringFromInt(0), + field: intstr.FromInt(0), original: 100, expected: 0, valid: true, }, { - field: util.NewIntOrStringFromInt(-1), + field: intstr.FromInt(-1), original: 100, valid: false, }, { - field: util.NewIntOrStringFromString("10%"), + field: intstr.FromString("10%"), original: 100, expected: 10, valid: true, }, { - field: util.NewIntOrStringFromString("100%"), + field: intstr.FromString("100%"), original: 100, expected: 100, valid: true, }, { - field: util.NewIntOrStringFromString("200%"), + field: intstr.FromString("200%"), original: 100, expected: 200, valid: true, }, { - field: util.NewIntOrStringFromString("0%"), + field: intstr.FromString("0%"), original: 100, expected: 0, valid: true, }, { - field: util.NewIntOrStringFromString("-1%"), + field: intstr.FromString("-1%"), original: 100, valid: false, }, diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/run.go b/vendor/k8s.io/kubernetes/pkg/kubectl/run.go index 31b82bae3..e0ed8ada8 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/run.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/run.go @@ -23,10 +23,264 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util/validation" ) +type DeploymentV1Beta1 struct{} + +func (DeploymentV1Beta1) ParamNames() []GeneratorParam { + return []GeneratorParam{ + {"labels", false}, + {"default-name", false}, + {"name", true}, + {"replicas", true}, + {"image", true}, + {"port", false}, + {"hostport", false}, + {"stdin", false}, + {"tty", false}, + {"command", false}, + {"args", false}, + {"env", false}, + {"requests", false}, + {"limits", false}, + } +} + +func (DeploymentV1Beta1) Generate(genericParams map[string]interface{}) (runtime.Object, error) { + args, err := getArgs(genericParams) + if err != nil { + return nil, err + } + + envs, err := getEnvs(genericParams) + if err != nil { + return nil, err + } + + params, err := getParams(genericParams) + if err != nil { + return nil, err + } + + name, err := getName(params) + if err != nil { + return nil, err + } + + labels, err := getLabels(params, true, name) + if err != nil { + return nil, err + } + + count, err := strconv.Atoi(params["replicas"]) + if err != nil { + return nil, err + } + + podSpec, err := makePodSpec(params, name) + if err != nil { + return nil, err + } + + if err = updatePodContainers(params, args, envs, podSpec); err != nil { + return nil, err + } + + if err := updatePodPorts(params, podSpec); err != nil { + return nil, err + } + + // TODO: use versioned types for generators so that we don't need to + // set default values manually (see issue #17384) + deployment := extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + Name: name, + Labels: labels, + }, + Spec: extensions.DeploymentSpec{ + Replicas: count, + Selector: &unversioned.LabelSelector{MatchLabels: labels}, + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: labels, + }, + Spec: *podSpec, + }, + }, + } + return &deployment, nil +} + +func getLabels(params map[string]string, defaultRunLabel bool, name string) (map[string]string, error) { + labelString, found := params["labels"] + var labels map[string]string + var err error + if found && len(labelString) > 0 { + labels, err = ParseLabels(labelString) + if err != nil { + return nil, err + } + } else if defaultRunLabel { + labels = map[string]string{ + "run": name, + } + } + return labels, nil +} + +func getName(params map[string]string) (string, error) { + name, found := params["name"] + if !found || len(name) == 0 { + name, found = params["default-name"] + if !found || len(name) == 0 { + return "", fmt.Errorf("'name' is a required parameter.") + } + } + return name, nil +} + +func getParams(genericParams map[string]interface{}) (map[string]string, error) { + params := map[string]string{} + for key, value := range genericParams { + strVal, isString := value.(string) + if !isString { + return nil, fmt.Errorf("expected string, saw %v for '%s'", value, key) + } + params[key] = strVal + } + return params, nil +} + +func getArgs(genericParams map[string]interface{}) ([]string, error) { + args := []string{} + val, found := genericParams["args"] + if found { + var isArray bool + args, isArray = val.([]string) + if !isArray { + return nil, fmt.Errorf("expected []string, found: %v", val) + } + delete(genericParams, "args") + } + return args, nil +} + +func getEnvs(genericParams map[string]interface{}) ([]api.EnvVar, error) { + var envs []api.EnvVar + envStrings, found := genericParams["env"] + if found { + if envStringArray, isArray := envStrings.([]string); isArray { + var err error + envs, err = parseEnvs(envStringArray) + if err != nil { + return nil, err + } + delete(genericParams, "env") + } else { + return nil, fmt.Errorf("expected []string, found: %v", envStrings) + } + } + return envs, nil +} + +type JobV1Beta1 struct{} + +func (JobV1Beta1) ParamNames() []GeneratorParam { + return []GeneratorParam{ + {"labels", false}, + {"default-name", false}, + {"name", true}, + {"image", true}, + {"port", false}, + {"hostport", false}, + {"stdin", false}, + {"leave-stdin-open", false}, + {"tty", false}, + {"command", false}, + {"args", false}, + {"env", false}, + {"requests", false}, + {"limits", false}, + {"restart", false}, + } +} + +func (JobV1Beta1) Generate(genericParams map[string]interface{}) (runtime.Object, error) { + args, err := getArgs(genericParams) + if err != nil { + return nil, err + } + + envs, err := getEnvs(genericParams) + if err != nil { + return nil, err + } + + params, err := getParams(genericParams) + if err != nil { + return nil, err + } + + name, err := getName(params) + if err != nil { + return nil, err + } + + labels, err := getLabels(params, true, name) + if err != nil { + return nil, err + } + + podSpec, err := makePodSpec(params, name) + if err != nil { + return nil, err + } + + if err = updatePodContainers(params, args, envs, podSpec); err != nil { + return nil, err + } + + leaveStdinOpen, err := GetBool(params, "leave-stdin-open", false) + if err != nil { + return nil, err + } + podSpec.Containers[0].StdinOnce = !leaveStdinOpen && podSpec.Containers[0].Stdin + + if err := updatePodPorts(params, podSpec); err != nil { + return nil, err + } + + restartPolicy := api.RestartPolicy(params["restart"]) + if len(restartPolicy) == 0 { + restartPolicy = api.RestartPolicyAlways + } + podSpec.RestartPolicy = restartPolicy + + job := extensions.Job{ + ObjectMeta: api.ObjectMeta{ + Name: name, + Labels: labels, + }, + Spec: extensions.JobSpec{ + Selector: &unversioned.LabelSelector{ + MatchLabels: labels, + }, + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: labels, + }, + Spec: *podSpec, + }, + }, + } + + return &job, nil +} + type BasicReplicationController struct{} func (BasicReplicationController) ParamNames() []GeneratorParam { @@ -119,62 +373,31 @@ func makePodSpec(params map[string]string, name string) (*api.PodSpec, error) { } func (BasicReplicationController) Generate(genericParams map[string]interface{}) (runtime.Object, error) { - args := []string{} - val, found := genericParams["args"] - if found { - var isArray bool - args, isArray = val.([]string) - if !isArray { - return nil, fmt.Errorf("expected []string, found: %v", val) - } - delete(genericParams, "args") + args, err := getArgs(genericParams) + if err != nil { + return nil, err } - // TODO: abstract this logic so that multiple generators can handle env in the same way. Same for parse envs. - var envs []api.EnvVar - envStrings, found := genericParams["env"] - if found { - if envStringArray, isArray := envStrings.([]string); isArray { - var err error - envs, err = parseEnvs(envStringArray) - if err != nil { - return nil, err - } - delete(genericParams, "env") - } else { - return nil, fmt.Errorf("expected []string, found: %v", envStrings) - } + envs, err := getEnvs(genericParams) + if err != nil { + return nil, err } - params := map[string]string{} - for key, value := range genericParams { - strVal, isString := value.(string) - if !isString { - return nil, fmt.Errorf("expected string, saw %v for '%s'", value, key) - } - params[key] = strVal + params, err := getParams(genericParams) + if err != nil { + return nil, err } - name, found := params["name"] - if !found || len(name) == 0 { - name, found = params["default-name"] - if !found || len(name) == 0 { - return nil, fmt.Errorf("'name' is a required parameter.") - } + + name, err := getName(params) + if err != nil { + return nil, err } - // TODO: extract this flag to a central location. - labelString, found := params["labels"] - var labels map[string]string - var err error - if found && len(labelString) > 0 { - labels, err = ParseLabels(labelString) - if err != nil { - return nil, err - } - } else { - labels = map[string]string{ - "run": name, - } + + labels, err := getLabels(params, true, name) + if err != nil { + return nil, err } + count, err := strconv.Atoi(params["replicas"]) if err != nil { return nil, err @@ -184,20 +407,13 @@ func (BasicReplicationController) Generate(genericParams map[string]interface{}) if err != nil { return nil, err } - if len(args) > 0 { - command, err := GetBool(params, "command", false) - if err != nil { - return nil, err - } - if command { - podSpec.Containers[0].Command = args - } else { - podSpec.Containers[0].Args = args - } + + if err = updatePodContainers(params, args, envs, podSpec); err != nil { + return nil, err } - if len(envs) > 0 { - podSpec.Containers[0].Env = envs + if err := updatePodPorts(params, podSpec); err != nil { + return nil, err } controller := api.ReplicationController{ @@ -216,12 +432,28 @@ func (BasicReplicationController) Generate(genericParams map[string]interface{}) }, }, } - if err := updatePodPorts(params, &controller.Spec.Template.Spec); err != nil { - return nil, err - } return &controller, nil } +func updatePodContainers(params map[string]string, args []string, envs []api.EnvVar, podSpec *api.PodSpec) error { + if len(args) > 0 { + command, err := GetBool(params, "command", false) + if err != nil { + return err + } + if command { + podSpec.Containers[0].Command = args + } else { + podSpec.Containers[0].Args = args + } + } + + if len(envs) > 0 { + podSpec.Containers[0].Env = envs + } + return nil +} + func updatePodPorts(params map[string]string, podSpec *api.PodSpec) (err error) { port := -1 hostPort := -1 @@ -279,57 +511,31 @@ func (BasicPod) ParamNames() []GeneratorParam { } func (BasicPod) Generate(genericParams map[string]interface{}) (runtime.Object, error) { - args := []string{} - val, found := genericParams["args"] - if found { - var isArray bool - args, isArray = val.([]string) - if !isArray { - return nil, fmt.Errorf("expected []string, found: %v", val) - } - delete(genericParams, "args") - } - // TODO: abstract this logic so that multiple generators can handle env in the same way. Same for parse envs. - var envs []api.EnvVar - envStrings, found := genericParams["env"] - if found { - if envStringArray, isArray := envStrings.([]string); isArray { - var err error - envs, err = parseEnvs(envStringArray) - if err != nil { - return nil, err - } - delete(genericParams, "env") - } else { - return nil, fmt.Errorf("expected []string, found: %v", envStrings) - } + args, err := getArgs(genericParams) + if err != nil { + return nil, err } - params := map[string]string{} - for key, value := range genericParams { - strVal, isString := value.(string) - if !isString { - return nil, fmt.Errorf("expected string, saw %v for '%s'", value, key) - } - params[key] = strVal + envs, err := getEnvs(genericParams) + if err != nil { + return nil, err } - name, found := params["name"] - if !found || len(name) == 0 { - name, found = params["default-name"] - if !found || len(name) == 0 { - return nil, fmt.Errorf("'name' is a required parameter.") - } + + params, err := getParams(genericParams) + if err != nil { + return nil, err } - // TODO: extract this flag to a central location. - labelString, found := params["labels"] - var labels map[string]string - var err error - if found && len(labelString) > 0 { - labels, err = ParseLabels(labelString) - if err != nil { - return nil, err - } + + name, err := getName(params) + if err != nil { + return nil, err } + + labels, err := getLabels(params, false, name) + if err != nil { + return nil, err + } + stdin, err := GetBool(params, "stdin", false) if err != nil { return nil, err @@ -374,20 +580,8 @@ func (BasicPod) Generate(genericParams map[string]interface{}) (runtime.Object, RestartPolicy: restartPolicy, }, } - if len(args) > 0 { - command, err := GetBool(params, "command", false) - if err != nil { - return nil, err - } - if command { - pod.Spec.Containers[0].Command = args - } else { - pod.Spec.Containers[0].Args = args - } - } - - if len(envs) > 0 { - pod.Spec.Containers[0].Env = envs + if err = updatePodContainers(params, args, envs, &pod.Spec); err != nil { + return nil, err } if err := updatePodPorts(params, &pod.Spec); err != nil { @@ -399,11 +593,16 @@ func (BasicPod) Generate(genericParams map[string]interface{}) (runtime.Object, func parseEnvs(envArray []string) ([]api.EnvVar, error) { envs := []api.EnvVar{} for _, env := range envArray { - parts := strings.Split(env, "=") - if len(parts) != 2 || !validation.IsCIdentifier(parts[0]) || len(parts[1]) == 0 { + pos := strings.Index(env, "=") + if pos == -1 { return nil, fmt.Errorf("invalid env: %v", env) } - envVar := api.EnvVar{Name: parts[0], Value: parts[1]} + name := env[:pos] + value := env[pos+1:] + if len(name) == 0 || !validation.IsCIdentifier(name) || len(value) == 0 { + return nil, fmt.Errorf("invalid env: %v", env) + } + envVar := api.EnvVar{Name: name, Value: value} envs = append(envs, envVar) } return envs, nil diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/run_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/run_test.go index d6eab99d3..27a366c41 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/run_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/run_test.go @@ -22,6 +22,8 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" ) func TestGenerate(t *testing.T) { @@ -625,3 +627,257 @@ func TestGeneratePod(t *testing.T) { } } } + +func TestGenerateDeployment(t *testing.T) { + tests := []struct { + params map[string]interface{} + expected *extensions.Deployment + expectErr bool + }{ + { + params: map[string]interface{}{ + "labels": "foo=bar,baz=blah", + "name": "foo", + "replicas": "3", + "image": "someimage", + "port": "80", + "hostport": "80", + "stdin": "true", + "command": "true", + "args": []string{"bar", "baz", "blah"}, + "env": []string{"a=b", "c=d"}, + "requests": "cpu=100m,memory=100Mi", + "limits": "cpu=400m,memory=200Mi", + }, + expected: &extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{"foo": "bar", "baz": "blah"}, + }, + Spec: extensions.DeploymentSpec{ + Replicas: 3, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar", "baz": "blah"}}, + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: map[string]string{"foo": "bar", "baz": "blah"}, + }, + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Name: "foo", + Image: "someimage", + Stdin: true, + Ports: []api.ContainerPort{ + { + ContainerPort: 80, + HostPort: 80, + }, + }, + Command: []string{"bar", "baz", "blah"}, + Env: []api.EnvVar{ + { + Name: "a", + Value: "b", + }, + { + Name: "c", + Value: "d", + }, + }, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceCPU: resource.MustParse("100m"), + api.ResourceMemory: resource.MustParse("100Mi"), + }, + Limits: api.ResourceList{ + api.ResourceCPU: resource.MustParse("400m"), + api.ResourceMemory: resource.MustParse("200Mi"), + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + + generator := DeploymentV1Beta1{} + for _, test := range tests { + obj, err := generator.Generate(test.params) + if !test.expectErr && err != nil { + t.Errorf("unexpected error: %v", err) + } + if test.expectErr && err != nil { + continue + } + if !reflect.DeepEqual(obj.(*extensions.Deployment), test.expected) { + t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*extensions.Deployment)) + } + } +} + +func TestGenerateJob(t *testing.T) { + tests := []struct { + params map[string]interface{} + expected *extensions.Job + expectErr bool + }{ + { + params: map[string]interface{}{ + "labels": "foo=bar,baz=blah", + "name": "foo", + "image": "someimage", + "port": "80", + "hostport": "80", + "stdin": "true", + "leave-stdin-open": "true", + "command": "true", + "args": []string{"bar", "baz", "blah"}, + "env": []string{"a=b", "c=d"}, + "requests": "cpu=100m,memory=100Mi", + "limits": "cpu=400m,memory=200Mi", + "restart": "OnFailure", + }, + expected: &extensions.Job{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + Labels: map[string]string{"foo": "bar", "baz": "blah"}, + }, + Spec: extensions.JobSpec{ + Selector: &unversioned.LabelSelector{ + MatchLabels: map[string]string{"foo": "bar", "baz": "blah"}, + }, + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: map[string]string{"foo": "bar", "baz": "blah"}, + }, + Spec: api.PodSpec{ + RestartPolicy: api.RestartPolicyOnFailure, + Containers: []api.Container{ + { + Name: "foo", + Image: "someimage", + Stdin: true, + StdinOnce: false, + Ports: []api.ContainerPort{ + { + ContainerPort: 80, + HostPort: 80, + }, + }, + Command: []string{"bar", "baz", "blah"}, + Env: []api.EnvVar{ + { + Name: "a", + Value: "b", + }, + { + Name: "c", + Value: "d", + }, + }, + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceCPU: resource.MustParse("100m"), + api.ResourceMemory: resource.MustParse("100Mi"), + }, + Limits: api.ResourceList{ + api.ResourceCPU: resource.MustParse("400m"), + api.ResourceMemory: resource.MustParse("200Mi"), + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + + generator := JobV1Beta1{} + for _, test := range tests { + obj, err := generator.Generate(test.params) + if !test.expectErr && err != nil { + t.Errorf("unexpected error: %v", err) + } + if test.expectErr && err != nil { + continue + } + if !reflect.DeepEqual(obj.(*extensions.Job), test.expected) { + t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*extensions.Job)) + } + } +} + +func TestParseEnv(t *testing.T) { + tests := []struct { + envArray []string + expected []api.EnvVar + expectErr bool + test string + }{ + { + envArray: []string{ + "THIS_ENV=isOK", + "HAS_COMMAS=foo,bar", + "HAS_EQUALS=jJnro54iUu75xNy==", + }, + expected: []api.EnvVar{ + { + Name: "THIS_ENV", + Value: "isOK", + }, + { + Name: "HAS_COMMAS", + Value: "foo,bar", + }, + { + Name: "HAS_EQUALS", + Value: "jJnro54iUu75xNy==", + }, + }, + expectErr: false, + test: "test case 1", + }, + { + envArray: []string{ + "WITH_OUT_EQUALS", + }, + expected: []api.EnvVar{}, + expectErr: true, + test: "test case 2", + }, + { + envArray: []string{ + "WITH_OUT_VALUES=", + }, + expected: []api.EnvVar{}, + expectErr: true, + test: "test case 3", + }, + { + envArray: []string{ + "=WITH_OUT_NAME", + }, + expected: []api.EnvVar{}, + expectErr: true, + test: "test case 4", + }, + } + + for _, test := range tests { + envs, err := parseEnvs(test.envArray) + if !test.expectErr && err != nil { + t.Errorf("unexpected error: %v (%s)", err, test.test) + } + if test.expectErr && err != nil { + continue + } + if !reflect.DeepEqual(envs, test.expected) { + t.Errorf("\nexpected:\n%#v\nsaw:\n%#v (%s)", test.expected, envs, test.test) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/scale.go b/vendor/k8s.io/kubernetes/pkg/kubectl/scale.go index 1080e2bc5..963f3050a 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/scale.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/scale.go @@ -23,21 +23,47 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/util/wait" ) +// Scaler provides an interface for resources that can be scaled. +type Scaler interface { + // Scale scales the named resource after checking preconditions. It optionally + // retries in the event of resource version mismatch (if retry is not nil), + // and optionally waits until the status of the resource matches newSize (if wait is not nil) + Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, wait *RetryParams) error + // ScaleSimple does a simple one-shot attempt at scaling - not useful on it's own, but + // a necessary building block for Scale + ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) error +} + +func ScalerFor(kind unversioned.GroupKind, c client.Interface) (Scaler, error) { + switch kind { + case api.Kind("ReplicationController"): + return &ReplicationControllerScaler{c}, nil + case extensions.Kind("ReplicaSet"): + return &ReplicaSetScaler{c.Extensions()}, nil + case extensions.Kind("Job"): + return &JobScaler{c.Extensions()}, nil + case extensions.Kind("Deployment"): + return &DeploymentScaler{c.Extensions()}, nil + } + return nil, fmt.Errorf("no scaler has been implemented for %q", kind) +} + // ScalePrecondition describes a condition that must be true for the scale to take place // If CurrentSize == -1, it is ignored. // If CurrentResourceVersion is the empty string, it is ignored. -// Otherwise they must equal the values in the replication controller for it to be valid. +// Otherwise they must equal the values in the resource for it to be valid. type ScalePrecondition struct { Size int ResourceVersion string } -// A PreconditionError is returned when a replication controller fails to match +// A PreconditionError is returned when a resource fails to match // the scale preconditions passed to kubectl. type PreconditionError struct { Precondition string @@ -49,80 +75,28 @@ func (pe PreconditionError) Error() string { return fmt.Sprintf("Expected %s to be %s, was %s", pe.Precondition, pe.ExpectedValue, pe.ActualValue) } -type ControllerScaleErrorType int +type ScaleErrorType int const ( - ControllerScaleGetFailure ControllerScaleErrorType = iota - ControllerScaleUpdateFailure - ControllerScaleUpdateInvalidFailure + ScaleGetFailure ScaleErrorType = iota + ScaleUpdateFailure + ScaleUpdateInvalidFailure ) -// A ControllerScaleError is returned when a scale request passes +// A ScaleError is returned when a scale request passes // preconditions but fails to actually scale the controller. -type ControllerScaleError struct { - FailureType ControllerScaleErrorType +type ScaleError struct { + FailureType ScaleErrorType ResourceVersion string ActualError error } -func (c ControllerScaleError) Error() string { +func (c ScaleError) Error() string { return fmt.Sprintf( - "Scaling the controller failed with: %s; Current resource version %s", + "Scaling the resource failed with: %v; Current resource version %s", c.ActualError, c.ResourceVersion) } -// ValidateReplicationController ensures that the preconditions match. Returns nil if they are valid, an error otherwise -func (precondition *ScalePrecondition) ValidateReplicationController(controller *api.ReplicationController) error { - if precondition.Size != -1 && controller.Spec.Replicas != precondition.Size { - return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(controller.Spec.Replicas)} - } - if precondition.ResourceVersion != "" && controller.ResourceVersion != precondition.ResourceVersion { - return PreconditionError{"resource version", precondition.ResourceVersion, controller.ResourceVersion} - } - return nil -} - -// ValidateJob ensures that the preconditions match. Returns nil if they are valid, an error otherwise -func (precondition *ScalePrecondition) ValidateJob(job *extensions.Job) error { - if precondition.Size != -1 && job.Spec.Parallelism == nil { - return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), "nil"} - } - if precondition.Size != -1 && *job.Spec.Parallelism != precondition.Size { - return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), strconv.Itoa(*job.Spec.Parallelism)} - } - if precondition.ResourceVersion != "" && job.ResourceVersion != precondition.ResourceVersion { - return PreconditionError{"resource version", precondition.ResourceVersion, job.ResourceVersion} - } - return nil -} - -type Scaler interface { - // Scale scales the named resource after checking preconditions. It optionally - // retries in the event of resource version mismatch (if retry is not nil), - // and optionally waits until the status of the resource matches newSize (if wait is not nil) - Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, wait *RetryParams) error - // ScaleSimple does a simple one-shot attempt at scaling - not useful on it's own, but - // a necessary building block for Scale - ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) error -} - -func ScalerFor(kind string, c client.Interface) (Scaler, error) { - switch kind { - case "ReplicationController": - return &ReplicationControllerScaler{c}, nil - case "Job": - return &JobScaler{c}, nil - } - return nil, fmt.Errorf("no scaler has been implemented for %q", kind) -} - -type ReplicationControllerScaler struct { - c client.Interface -} -type JobScaler struct { - c client.Interface -} - // RetryParams encapsulates the retry parameters used by kubectl's scaler. type RetryParams struct { Interval, Timeout time.Duration @@ -136,15 +110,15 @@ func NewRetryParams(interval, timeout time.Duration) *RetryParams { func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name string, count uint) wait.ConditionFunc { return func() (bool, error) { err := r.ScaleSimple(namespace, name, precondition, count) - switch e, _ := err.(ControllerScaleError); err.(type) { + switch e, _ := err.(ScaleError); err.(type) { case nil: return true, nil - case ControllerScaleError: + case ScaleError: // if it's invalid we shouldn't keep waiting - if e.FailureType == ControllerScaleUpdateInvalidFailure { + if e.FailureType == ScaleUpdateInvalidFailure { return false, err } - if e.FailureType == ControllerScaleUpdateFailure { + if e.FailureType == ScaleUpdateFailure { return false, nil } } @@ -152,10 +126,25 @@ func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name s } } +// ValidateReplicationController ensures that the preconditions match. Returns nil if they are valid, an error otherwise +func (precondition *ScalePrecondition) ValidateReplicationController(controller *api.ReplicationController) error { + if precondition.Size != -1 && controller.Spec.Replicas != precondition.Size { + return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(controller.Spec.Replicas)} + } + if len(precondition.ResourceVersion) != 0 && controller.ResourceVersion != precondition.ResourceVersion { + return PreconditionError{"resource version", precondition.ResourceVersion, controller.ResourceVersion} + } + return nil +} + +type ReplicationControllerScaler struct { + c client.Interface +} + func (scaler *ReplicationControllerScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) error { controller, err := scaler.c.ReplicationControllers(namespace).Get(name) if err != nil { - return ControllerScaleError{ControllerScaleGetFailure, "Unknown", err} + return ScaleError{ScaleGetFailure, "Unknown", err} } if preconditions != nil { if err := preconditions.ValidateReplicationController(controller); err != nil { @@ -166,11 +155,10 @@ func (scaler *ReplicationControllerScaler) ScaleSimple(namespace, name string, p // TODO: do retry on 409 errors here? if _, err := scaler.c.ReplicationControllers(namespace).Update(controller); err != nil { if errors.IsInvalid(err) { - return ControllerScaleError{ControllerScaleUpdateInvalidFailure, controller.ResourceVersion, err} + return ScaleError{ScaleUpdateInvalidFailure, controller.ResourceVersion, err} } - return ControllerScaleError{ControllerScaleUpdateFailure, controller.ResourceVersion, err} + return ScaleError{ScaleUpdateFailure, controller.ResourceVersion, err} } - // TODO: do a better job of printing objects here. return nil } @@ -200,11 +188,91 @@ func (scaler *ReplicationControllerScaler) Scale(namespace, name string, newSize return nil } +// ValidateReplicaSet ensures that the preconditions match. Returns nil if they are valid, an error otherwise +func (precondition *ScalePrecondition) ValidateReplicaSet(replicaSet *extensions.ReplicaSet) error { + if precondition.Size != -1 && replicaSet.Spec.Replicas != precondition.Size { + return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(replicaSet.Spec.Replicas)} + } + if len(precondition.ResourceVersion) != 0 && replicaSet.ResourceVersion != precondition.ResourceVersion { + return PreconditionError{"resource version", precondition.ResourceVersion, replicaSet.ResourceVersion} + } + return nil +} + +type ReplicaSetScaler struct { + c client.ExtensionsInterface +} + +func (scaler *ReplicaSetScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) error { + rs, err := scaler.c.ReplicaSets(namespace).Get(name) + if err != nil { + return ScaleError{ScaleGetFailure, "Unknown", err} + } + if preconditions != nil { + if err := preconditions.ValidateReplicaSet(rs); err != nil { + return err + } + } + rs.Spec.Replicas = int(newSize) + // TODO: do retry on 409 errors here? + if _, err := scaler.c.ReplicaSets(namespace).Update(rs); err != nil { + if errors.IsInvalid(err) { + return ScaleError{ScaleUpdateInvalidFailure, rs.ResourceVersion, err} + } + return ScaleError{ScaleUpdateFailure, rs.ResourceVersion, err} + } + return nil +} + +// Scale updates a ReplicaSet to a new size, with optional precondition check (if preconditions is +// not nil), optional retries (if retry is not nil), and then optionally waits for it's replica +// count to reach the new value (if wait is not nil). +func (scaler *ReplicaSetScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error { + if preconditions == nil { + preconditions = &ScalePrecondition{-1, ""} + } + if retry == nil { + // Make it try only once, immediately + retry = &RetryParams{Interval: time.Millisecond, Timeout: time.Millisecond} + } + cond := ScaleCondition(scaler, preconditions, namespace, name, newSize) + if err := wait.Poll(retry.Interval, retry.Timeout, cond); err != nil { + return err + } + if waitForReplicas != nil { + rs, err := scaler.c.ReplicaSets(namespace).Get(name) + if err != nil { + return err + } + return wait.Poll(waitForReplicas.Interval, waitForReplicas.Timeout, + client.ReplicaSetHasDesiredReplicas(scaler.c, rs)) + } + return nil +} + +// ValidateJob ensures that the preconditions match. Returns nil if they are valid, an error otherwise. +func (precondition *ScalePrecondition) ValidateJob(job *extensions.Job) error { + if precondition.Size != -1 && job.Spec.Parallelism == nil { + return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), "nil"} + } + if precondition.Size != -1 && *job.Spec.Parallelism != precondition.Size { + return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), strconv.Itoa(*job.Spec.Parallelism)} + } + if len(precondition.ResourceVersion) != 0 && job.ResourceVersion != precondition.ResourceVersion { + return PreconditionError{"resource version", precondition.ResourceVersion, job.ResourceVersion} + } + return nil +} + +type JobScaler struct { + c client.ExtensionsInterface +} + // ScaleSimple is responsible for updating job's parallelism. func (scaler *JobScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) error { - job, err := scaler.c.Extensions().Jobs(namespace).Get(name) + job, err := scaler.c.Jobs(namespace).Get(name) if err != nil { - return ControllerScaleError{ControllerScaleGetFailure, "Unknown", err} + return ScaleError{ScaleGetFailure, "Unknown", err} } if preconditions != nil { if err := preconditions.ValidateJob(job); err != nil { @@ -213,12 +281,11 @@ func (scaler *JobScaler) ScaleSimple(namespace, name string, preconditions *Scal } parallelism := int(newSize) job.Spec.Parallelism = ¶llelism - if _, err := scaler.c.Extensions().Jobs(namespace).Update(job); err != nil { + if _, err := scaler.c.Jobs(namespace).Update(job); err != nil { if errors.IsInvalid(err) { - return ControllerScaleError{ControllerScaleUpdateInvalidFailure, job.ResourceVersion, err} + return ScaleError{ScaleUpdateInvalidFailure, job.ResourceVersion, err} } - return ControllerScaleError{ControllerScaleUpdateFailure, job.ResourceVersion, err} - + return ScaleError{ScaleUpdateFailure, job.ResourceVersion, err} } return nil } @@ -239,7 +306,7 @@ func (scaler *JobScaler) Scale(namespace, name string, newSize uint, preconditio return err } if waitForReplicas != nil { - job, err := scaler.c.Extensions().Jobs(namespace).Get(name) + job, err := scaler.c.Jobs(namespace).Get(name) if err != nil { return err } @@ -248,3 +315,67 @@ func (scaler *JobScaler) Scale(namespace, name string, newSize uint, preconditio } return nil } + +// ValidateDeployment ensures that the preconditions match. Returns nil if they are valid, an error otherwise. +func (precondition *ScalePrecondition) ValidateDeployment(deployment *extensions.Deployment) error { + if precondition.Size != -1 && deployment.Spec.Replicas != precondition.Size { + return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(deployment.Spec.Replicas)} + } + if len(precondition.ResourceVersion) != 0 && deployment.ResourceVersion != precondition.ResourceVersion { + return PreconditionError{"resource version", precondition.ResourceVersion, deployment.ResourceVersion} + } + return nil +} + +type DeploymentScaler struct { + c client.ExtensionsInterface +} + +// ScaleSimple is responsible for updating a deployment's desired replicas count. +func (scaler *DeploymentScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) error { + deployment, err := scaler.c.Deployments(namespace).Get(name) + if err != nil { + return ScaleError{ScaleGetFailure, "Unknown", err} + } + if preconditions != nil { + if err := preconditions.ValidateDeployment(deployment); err != nil { + return err + } + } + + // TODO(madhusudancs): Fix this when Scale group issues are resolved (see issue #18528). + // For now I'm falling back to regular Deployment update operation. + deployment.Spec.Replicas = int(newSize) + if _, err := scaler.c.Deployments(namespace).Update(deployment); err != nil { + if errors.IsInvalid(err) { + return ScaleError{ScaleUpdateInvalidFailure, deployment.ResourceVersion, err} + } + return ScaleError{ScaleUpdateFailure, deployment.ResourceVersion, err} + } + return nil +} + +// Scale updates a deployment to a new size, with optional precondition check (if preconditions is not nil), +// optional retries (if retry is not nil), and then optionally waits for the status to reach desired count. +func (scaler *DeploymentScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error { + if preconditions == nil { + preconditions = &ScalePrecondition{-1, ""} + } + if retry == nil { + // Make it try only once, immediately + retry = &RetryParams{Interval: time.Millisecond, Timeout: time.Millisecond} + } + cond := ScaleCondition(scaler, preconditions, namespace, name, newSize) + if err := wait.Poll(retry.Interval, retry.Timeout, cond); err != nil { + return err + } + if waitForReplicas != nil { + deployment, err := scaler.c.Deployments(namespace).Get(name) + if err != nil { + return err + } + return wait.Poll(waitForReplicas.Interval, waitForReplicas.Timeout, + client.DeploymentHasDesiredReplicas(scaler.c, deployment)) + } + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/scale_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/scale_test.go index 8bf64e70b..87b674355 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/scale_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/scale_test.go @@ -34,7 +34,7 @@ type ErrorReplicationControllers struct { func (c *ErrorReplicationControllers) Update(controller *api.ReplicationController) (*api.ReplicationController, error) { if c.invalid { - return nil, kerrors.NewInvalid(controller.Kind, controller.Name, nil) + return nil, kerrors.NewInvalid(api.Kind(controller.Kind), controller.Name, nil) } return nil, errors.New("Replication controller update failure") } @@ -48,45 +48,6 @@ func (c *ErrorReplicationControllerClient) ReplicationControllers(namespace stri return &ErrorReplicationControllers{testclient.FakeReplicationControllers{Fake: &c.Fake, Namespace: namespace}, c.invalid} } -type ErrorJobs struct { - testclient.FakeJobs - invalid bool -} - -func (c *ErrorJobs) Update(job *extensions.Job) (*extensions.Job, error) { - if c.invalid { - return nil, kerrors.NewInvalid(job.Kind, job.Name, nil) - } - return nil, errors.New("Job update failure") -} - -func (c *ErrorJobs) Get(name string) (*extensions.Job, error) { - zero := 0 - return &extensions.Job{ - Spec: extensions.JobSpec{ - Parallelism: &zero, - }, - }, nil -} - -type ErrorJobClient struct { - testclient.FakeExperimental - invalid bool -} - -func (c *ErrorJobClient) Jobs(namespace string) client.JobInterface { - return &ErrorJobs{testclient.FakeJobs{Fake: &c.FakeExperimental, Namespace: namespace}, c.invalid} -} - -type ErrorExtensionsClient struct { - testclient.Fake - invalid bool -} - -func (c *ErrorExtensionsClient) Extensions() client.ExtensionsInterface { - return &ErrorJobClient{testclient.FakeExperimental{&c.Fake}, c.invalid} -} - func TestReplicationControllerScaleRetry(t *testing.T) { fake := &ErrorReplicationControllerClient{Fake: testclient.Fake{}, invalid: false} scaler := ReplicationControllerScaler{fake} @@ -124,8 +85,8 @@ func TestReplicationControllerScaleInvalid(t *testing.T) { if pass { t.Errorf("Expected an update failure to return pass = false, got pass = %v", pass) } - e, ok := err.(ControllerScaleError) - if err == nil || !ok || e.FailureType != ControllerScaleUpdateInvalidFailure { + e, ok := err.(ScaleError) + if err == nil || !ok || e.FailureType != ScaleUpdateInvalidFailure { t.Errorf("Expected error on invalid update failure, got %v", err) } } @@ -286,8 +247,38 @@ func TestValidateReplicationController(t *testing.T) { } } +type ErrorJobs struct { + testclient.FakeJobs + invalid bool +} + +func (c *ErrorJobs) Update(job *extensions.Job) (*extensions.Job, error) { + if c.invalid { + return nil, kerrors.NewInvalid(extensions.Kind(job.Kind), job.Name, nil) + } + return nil, errors.New("Job update failure") +} + +func (c *ErrorJobs) Get(name string) (*extensions.Job, error) { + zero := 0 + return &extensions.Job{ + Spec: extensions.JobSpec{ + Parallelism: &zero, + }, + }, nil +} + +type ErrorJobClient struct { + testclient.FakeExperimental + invalid bool +} + +func (c *ErrorJobClient) Jobs(namespace string) client.JobInterface { + return &ErrorJobs{testclient.FakeJobs{Fake: &c.FakeExperimental, Namespace: namespace}, c.invalid} +} + func TestJobScaleRetry(t *testing.T) { - fake := &ErrorExtensionsClient{Fake: testclient.Fake{}, invalid: false} + fake := &ErrorJobClient{FakeExperimental: testclient.FakeExperimental{}, invalid: false} scaler := JobScaler{fake} preconditions := ScalePrecondition{-1, ""} count := uint(3) @@ -311,7 +302,7 @@ func TestJobScaleRetry(t *testing.T) { } func TestJobScale(t *testing.T) { - fake := &testclient.Fake{} + fake := &testclient.FakeExperimental{Fake: &testclient.Fake{}} scaler := JobScaler{fake} preconditions := ScalePrecondition{-1, ""} count := uint(3) @@ -331,7 +322,7 @@ func TestJobScale(t *testing.T) { } func TestJobScaleInvalid(t *testing.T) { - fake := &ErrorExtensionsClient{Fake: testclient.Fake{}, invalid: true} + fake := &ErrorJobClient{FakeExperimental: testclient.FakeExperimental{}, invalid: true} scaler := JobScaler{fake} preconditions := ScalePrecondition{-1, ""} count := uint(3) @@ -343,8 +334,8 @@ func TestJobScaleInvalid(t *testing.T) { if pass { t.Errorf("Expected an update failure to return pass = false, got pass = %v", pass) } - e, ok := err.(ControllerScaleError) - if err == nil || !ok || e.FailureType != ControllerScaleUpdateInvalidFailure { + e, ok := err.(ScaleError) + if err == nil || !ok || e.FailureType != ScaleUpdateInvalidFailure { t.Errorf("Expected error on invalid update failure, got %v", err) } } @@ -356,7 +347,7 @@ func TestJobScaleFailsPreconditions(t *testing.T) { Parallelism: &ten, }, }) - scaler := JobScaler{fake} + scaler := JobScaler{&testclient.FakeExperimental{fake}} preconditions := ScalePrecondition{2, ""} count := uint(3) name := "foo" @@ -496,3 +487,242 @@ func TestValidateJob(t *testing.T) { } } } + +type ErrorDeployments struct { + testclient.FakeDeployments + invalid bool +} + +func (c *ErrorDeployments) Update(deployment *extensions.Deployment) (*extensions.Deployment, error) { + if c.invalid { + return nil, kerrors.NewInvalid(extensions.Kind(deployment.Kind), deployment.Name, nil) + } + return nil, errors.New("deployment update failure") +} + +func (c *ErrorDeployments) Get(name string) (*extensions.Deployment, error) { + return &extensions.Deployment{ + Spec: extensions.DeploymentSpec{ + Replicas: 0, + }, + }, nil +} + +type ErrorDeploymentClient struct { + testclient.FakeExperimental + invalid bool +} + +func (c *ErrorDeploymentClient) Deployments(namespace string) client.DeploymentInterface { + return &ErrorDeployments{testclient.FakeDeployments{Fake: &c.FakeExperimental, Namespace: namespace}, c.invalid} +} + +func TestDeploymentScaleRetry(t *testing.T) { + fake := &ErrorDeploymentClient{FakeExperimental: testclient.FakeExperimental{Fake: &testclient.Fake{}}, invalid: false} + scaler := &DeploymentScaler{fake} + preconditions := &ScalePrecondition{-1, ""} + count := uint(3) + name := "foo" + namespace := "default" + + scaleFunc := ScaleCondition(scaler, preconditions, namespace, name, count) + pass, err := scaleFunc() + if pass != false { + t.Errorf("Expected an update failure to return pass = false, got pass = %v", pass) + } + if err != nil { + t.Errorf("Did not expect an error on update failure, got %v", err) + } + preconditions = &ScalePrecondition{3, ""} + scaleFunc = ScaleCondition(scaler, preconditions, namespace, name, count) + pass, err = scaleFunc() + if err == nil { + t.Errorf("Expected error on precondition failure") + } +} + +func TestDeploymentScale(t *testing.T) { + fake := &testclient.FakeExperimental{Fake: &testclient.Fake{}} + scaler := DeploymentScaler{fake} + preconditions := ScalePrecondition{-1, ""} + count := uint(3) + name := "foo" + scaler.Scale("default", name, count, &preconditions, nil, nil) + + actions := fake.Actions() + if len(actions) != 2 { + t.Errorf("unexpected actions: %v, expected 2 actions (get, update)", actions) + } + if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "deployments" || action.GetName() != name { + t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name) + } + if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "deployments" || action.GetObject().(*extensions.Deployment).Spec.Replicas != int(count) { + t.Errorf("unexpected action %v, expected update-deployment with replicas = %d", actions[1], count) + } +} + +func TestDeploymentScaleInvalid(t *testing.T) { + fake := &ErrorDeploymentClient{FakeExperimental: testclient.FakeExperimental{Fake: &testclient.Fake{}}, invalid: true} + scaler := DeploymentScaler{fake} + preconditions := ScalePrecondition{-1, ""} + count := uint(3) + name := "foo" + namespace := "default" + + scaleFunc := ScaleCondition(&scaler, &preconditions, namespace, name, count) + pass, err := scaleFunc() + if pass { + t.Errorf("Expected an update failure to return pass = false, got pass = %v", pass) + } + e, ok := err.(ScaleError) + if err == nil || !ok || e.FailureType != ScaleUpdateInvalidFailure { + t.Errorf("Expected error on invalid update failure, got %v", err) + } +} + +func TestDeploymentScaleFailsPreconditions(t *testing.T) { + fake := testclient.NewSimpleFake(&extensions.Deployment{ + Spec: extensions.DeploymentSpec{ + Replicas: 10, + }, + }) + scaler := DeploymentScaler{&testclient.FakeExperimental{fake}} + preconditions := ScalePrecondition{2, ""} + count := uint(3) + name := "foo" + scaler.Scale("default", name, count, &preconditions, nil, nil) + + actions := fake.Actions() + if len(actions) != 1 { + t.Errorf("unexpected actions: %v, expected 1 actions (get)", actions) + } + if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "deployments" || action.GetName() != name { + t.Errorf("unexpected action: %v, expected get-deployment %s", actions[0], name) + } +} + +func TestValidateDeployment(t *testing.T) { + zero, ten, twenty := 0, 10, 20 + tests := []struct { + preconditions ScalePrecondition + deployment extensions.Deployment + expectError bool + test string + }{ + { + preconditions: ScalePrecondition{-1, ""}, + expectError: false, + test: "defaults", + }, + { + preconditions: ScalePrecondition{-1, ""}, + deployment: extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + ResourceVersion: "foo", + }, + Spec: extensions.DeploymentSpec{ + Replicas: ten, + }, + }, + expectError: false, + test: "defaults 2", + }, + { + preconditions: ScalePrecondition{0, ""}, + deployment: extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + ResourceVersion: "foo", + }, + Spec: extensions.DeploymentSpec{ + Replicas: zero, + }, + }, + expectError: false, + test: "size matches", + }, + { + preconditions: ScalePrecondition{-1, "foo"}, + deployment: extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + ResourceVersion: "foo", + }, + Spec: extensions.DeploymentSpec{ + Replicas: ten, + }, + }, + expectError: false, + test: "resource version matches", + }, + { + preconditions: ScalePrecondition{10, "foo"}, + deployment: extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + ResourceVersion: "foo", + }, + Spec: extensions.DeploymentSpec{ + Replicas: ten, + }, + }, + expectError: false, + test: "both match", + }, + { + preconditions: ScalePrecondition{10, "foo"}, + deployment: extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + ResourceVersion: "foo", + }, + Spec: extensions.DeploymentSpec{ + Replicas: twenty, + }, + }, + expectError: true, + test: "size different", + }, + { + preconditions: ScalePrecondition{10, "foo"}, + deployment: extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + ResourceVersion: "foo", + }, + }, + expectError: true, + test: "no replicas", + }, + { + preconditions: ScalePrecondition{10, "foo"}, + deployment: extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + ResourceVersion: "bar", + }, + Spec: extensions.DeploymentSpec{ + Replicas: ten, + }, + }, + expectError: true, + test: "version different", + }, + { + preconditions: ScalePrecondition{10, "foo"}, + deployment: extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + ResourceVersion: "bar", + }, + Spec: extensions.DeploymentSpec{ + Replicas: twenty, + }, + }, + expectError: true, + test: "both different", + }, + } + for _, test := range tests { + err := test.preconditions.ValidateDeployment(&test.deployment) + if err != nil && !test.expectError { + t.Errorf("unexpected error: %v (%s)", err, test.test) + } + if err == nil && test.expectError { + t.Errorf("unexpected non-error: %v (%s)", err, test.test) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/secret.go b/vendor/k8s.io/kubernetes/pkg/kubectl/secret.go new file mode 100644 index 000000000..62de79008 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/secret.go @@ -0,0 +1,238 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kubectl + +import ( + "errors" + "fmt" + "io/ioutil" + "os" + "path" + "strings" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/validation" + "k8s.io/kubernetes/pkg/runtime" +) + +// SecretGeneratorV1 supports stable generation of an opaque secret +type SecretGeneratorV1 struct { + // Name of secret (required) + Name string + // Type of secret (optional) + Type string + // FileSources to derive the secret from (optional) + FileSources []string + // LiteralSources to derive the secret from (optional) + LiteralSources []string +} + +// Ensure it supports the generator pattern that uses parameter injection +var _ Generator = &SecretGeneratorV1{} + +// Ensure it supports the generator pattern that uses parameters specified during construction +var _ StructuredGenerator = &SecretGeneratorV1{} + +// Generate returns a secret using the specified parameters +func (s SecretGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error) { + err := ValidateParams(s.ParamNames(), genericParams) + if err != nil { + return nil, err + } + delegate := &SecretGeneratorV1{} + fromFileStrings, found := genericParams["from-file"] + if found { + fromFileArray, isArray := fromFileStrings.([]string) + if !isArray { + return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings) + } + delegate.FileSources = fromFileArray + delete(genericParams, "from-file") + } + fromLiteralStrings, found := genericParams["from-literal"] + if found { + fromLiteralArray, isArray := fromLiteralStrings.([]string) + if !isArray { + return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings) + } + delegate.LiteralSources = fromLiteralArray + delete(genericParams, "from-literal") + } + params := map[string]string{} + for key, value := range genericParams { + strVal, isString := value.(string) + if !isString { + return nil, fmt.Errorf("expected string, saw %v for '%s'", value, key) + } + params[key] = strVal + } + delegate.Name = params["name"] + delegate.Type = params["type"] + return delegate.StructuredGenerate() +} + +// ParamNames returns the set of supported input parameters when using the parameter injection generator pattern +func (s SecretGeneratorV1) ParamNames() []GeneratorParam { + return []GeneratorParam{ + {"name", true}, + {"type", false}, + {"from-file", false}, + {"from-literal", false}, + {"force", false}, + } +} + +// StructuredGenerate outputs a secret object using the configured fields +func (s SecretGeneratorV1) StructuredGenerate() (runtime.Object, error) { + if err := s.validate(); err != nil { + return nil, err + } + secret := &api.Secret{} + secret.Name = s.Name + secret.Data = map[string][]byte{} + if len(s.Type) > 0 { + secret.Type = api.SecretType(s.Type) + } + if len(s.FileSources) > 0 { + if err := handleFromFileSources(secret, s.FileSources); err != nil { + return nil, err + } + } + if len(s.LiteralSources) > 0 { + if err := handleFromLiteralSources(secret, s.LiteralSources); err != nil { + return nil, err + } + } + return secret, nil +} + +// validate validates required fields are set to support structured generation +func (s SecretGeneratorV1) validate() error { + if len(s.Name) == 0 { + return fmt.Errorf("name must be specified") + } + return nil +} + +// handleFromLiteralSources adds the specified literal source information into the provided secret +func handleFromLiteralSources(secret *api.Secret, literalSources []string) error { + for _, literalSource := range literalSources { + keyName, value, err := parseLiteralSource(literalSource) + if err != nil { + return err + } + err = addKeyFromLiteralToSecret(secret, keyName, []byte(value)) + if err != nil { + return err + } + } + return nil +} + +// handleFromFileSources adds the specified file source information into the provided secret +func handleFromFileSources(secret *api.Secret, fileSources []string) error { + for _, fileSource := range fileSources { + keyName, filePath, err := parseFileSource(fileSource) + if err != nil { + return err + } + info, err := os.Stat(filePath) + if err != nil { + switch err := err.(type) { + case *os.PathError: + return fmt.Errorf("error reading %s: %v", filePath, err.Err) + default: + return fmt.Errorf("error reading %s: %v", filePath, err) + } + } + if info.IsDir() { + if strings.Contains(fileSource, "=") { + return fmt.Errorf("cannot give a key name for a directory path.") + } + fileList, err := ioutil.ReadDir(filePath) + if err != nil { + return fmt.Errorf("error listing files in %s: %v", filePath, err) + } + for _, item := range fileList { + itemPath := path.Join(filePath, item.Name()) + if item.Mode().IsRegular() { + keyName = item.Name() + err = addKeyFromFileToSecret(secret, keyName, itemPath) + if err != nil { + return err + } + } + } + } else { + err = addKeyFromFileToSecret(secret, keyName, filePath) + if err != nil { + return err + } + } + } + + return nil +} + +func addKeyFromFileToSecret(secret *api.Secret, keyName, filePath string) error { + data, err := ioutil.ReadFile(filePath) + if err != nil { + return err + } + return addKeyFromLiteralToSecret(secret, keyName, data) +} + +func addKeyFromLiteralToSecret(secret *api.Secret, keyName string, data []byte) error { + if !validation.IsSecretKey(keyName) { + return fmt.Errorf("%v is not a valid key name for a secret", keyName) + } + if _, entryExists := secret.Data[keyName]; entryExists { + return fmt.Errorf("cannot add key %s, another key by that name already exists: %v.", keyName, secret.Data) + } + secret.Data[keyName] = data + return nil +} + +// parseFileSource parses the source given. Acceptable formats include: +// source-name=source-path, where source-name will become the key name and source-path is the path to the key file +// source-path, where source-path is a path to a file or directory, and key names will default to file names +// Key names cannot include '='. +func parseFileSource(source string) (keyName, filePath string, err error) { + numSeparators := strings.Count(source, "=") + switch { + case numSeparators == 0: + return path.Base(source), source, nil + case numSeparators == 1 && strings.HasPrefix(source, "="): + return "", "", fmt.Errorf("key name for file path %v missing.", strings.TrimPrefix(source, "=")) + case numSeparators == 1 && strings.HasSuffix(source, "="): + return "", "", fmt.Errorf("file path for key name %v missing.", strings.TrimSuffix(source, "=")) + case numSeparators > 1: + return "", "", errors.New("Key names or file paths cannot contain '='.") + default: + components := strings.Split(source, "=") + return components[0], components[1], nil + } +} + +// parseLiteralSource parses the source key=val pair +func parseLiteralSource(source string) (keyName, value string, err error) { + items := strings.Split(source, "=") + if len(items) != 2 { + return "", "", fmt.Errorf("invalid literal source %v, expected key=value", source) + } + return items[0], items[1], nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/secret_for_docker_registry.go b/vendor/k8s.io/kubernetes/pkg/kubectl/secret_for_docker_registry.go new file mode 100644 index 000000000..773bde386 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/secret_for_docker_registry.go @@ -0,0 +1,131 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kubectl + +import ( + "encoding/json" + "fmt" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/credentialprovider" + "k8s.io/kubernetes/pkg/runtime" +) + +// SecretForDockerRegistryGeneratorV1 supports stable generation of a docker registry secret +type SecretForDockerRegistryGeneratorV1 struct { + // Name of secret (required) + Name string + // Username for registry (required) + Username string + // Email for registry (required) + Email string + // Password for registry (required) + Password string + // Server for registry (required) + Server string +} + +// Ensure it supports the generator pattern that uses parameter injection +var _ Generator = &SecretForDockerRegistryGeneratorV1{} + +// Ensure it supports the generator pattern that uses parameters specified during construction +var _ StructuredGenerator = &SecretForDockerRegistryGeneratorV1{} + +// Generate returns a secret using the specified parameters +func (s SecretForDockerRegistryGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error) { + err := ValidateParams(s.ParamNames(), genericParams) + if err != nil { + return nil, err + } + params := map[string]string{} + for key, value := range genericParams { + strVal, isString := value.(string) + if !isString { + return nil, fmt.Errorf("expected string, saw %v for '%s'", value, key) + } + params[key] = strVal + } + delegate := &SecretForDockerRegistryGeneratorV1{ + Name: params["name"], + Username: params["docker-username"], + Email: params["docker-email"], + Password: params["docker-password"], + Server: params["docker-server"], + } + return delegate.StructuredGenerate() +} + +// StructuredGenerate outputs a secret object using the configured fields +func (s SecretForDockerRegistryGeneratorV1) StructuredGenerate() (runtime.Object, error) { + if err := s.validate(); err != nil { + return nil, err + } + dockercfgContent, err := handleDockercfgContent(s.Username, s.Password, s.Email, s.Server) + if err != nil { + return nil, err + } + secret := &api.Secret{} + secret.Name = s.Name + secret.Type = api.SecretTypeDockercfg + secret.Data = map[string][]byte{} + secret.Data[api.DockerConfigKey] = dockercfgContent + return secret, nil +} + +// ParamNames returns the set of supported input parameters when using the parameter injection generator pattern +func (s SecretForDockerRegistryGeneratorV1) ParamNames() []GeneratorParam { + return []GeneratorParam{ + {"name", true}, + {"docker-username", true}, + {"docker-email", true}, + {"docker-password", true}, + {"docker-server", true}, + } +} + +// validate validates required fields are set to support structured generation +func (s SecretForDockerRegistryGeneratorV1) validate() error { + if len(s.Name) == 0 { + return fmt.Errorf("name must be specified") + } + if len(s.Username) == 0 { + return fmt.Errorf("username must be specified") + } + if len(s.Email) == 0 { + return fmt.Errorf("email must be specified") + } + if len(s.Password) == 0 { + return fmt.Errorf("password must be specified") + } + if len(s.Server) == 0 { + return fmt.Errorf("server must be specified") + } + return nil +} + +// handleDockercfgContent serializes a dockercfg json file +func handleDockercfgContent(username, password, email, server string) ([]byte, error) { + dockercfgAuth := credentialprovider.DockerConfigEntry{ + Username: username, + Password: password, + Email: email, + } + + dockerCfg := map[string]credentialprovider.DockerConfigEntry{server: dockercfgAuth} + + return json.Marshal(dockerCfg) +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/secret_for_docker_registry_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/secret_for_docker_registry_test.go new file mode 100644 index 000000000..65d8d397d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/secret_for_docker_registry_test.go @@ -0,0 +1,81 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kubectl + +import ( + "reflect" + "testing" + + "k8s.io/kubernetes/pkg/api" +) + +func TestSecretForDockerRegistryGenerate(t *testing.T) { + username, password, email, server := "test-user", "test-password", "test-user@example.org", "https://index.docker.io/v1/" + secretData, err := handleDockercfgContent(username, password, email, server) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + + tests := map[string]struct { + params map[string]interface{} + expected *api.Secret + expectErr bool + }{ + "test-valid-use": { + params: map[string]interface{}{ + "name": "foo", + "docker-server": server, + "docker-username": username, + "docker-password": password, + "docker-email": email, + }, + expected: &api.Secret{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Data: map[string][]byte{ + api.DockerConfigKey: secretData, + }, + Type: api.SecretTypeDockercfg, + }, + expectErr: false, + }, + "test-missing-required-param": { + params: map[string]interface{}{ + "name": "foo", + "docker-server": server, + "docker-password": password, + "docker-email": email, + }, + expectErr: true, + }, + } + + generator := SecretForDockerRegistryGeneratorV1{} + for _, test := range tests { + obj, err := generator.Generate(test.params) + if !test.expectErr && err != nil { + t.Errorf("unexpected error: %v", err) + } + if test.expectErr && err != nil { + continue + } + if !reflect.DeepEqual(obj.(*api.Secret), test.expected) { + t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*api.Secret)) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/secret_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/secret_test.go new file mode 100644 index 000000000..e713c9911 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/secret_test.go @@ -0,0 +1,109 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kubectl + +import ( + "reflect" + "testing" + + "k8s.io/kubernetes/pkg/api" +) + +func TestSecretGenerate(t *testing.T) { + tests := []struct { + params map[string]interface{} + expected *api.Secret + expectErr bool + }{ + { + params: map[string]interface{}{ + "name": "foo", + }, + expected: &api.Secret{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Data: map[string][]byte{}, + }, + expectErr: false, + }, + { + params: map[string]interface{}{ + "name": "foo", + "type": "my-type", + }, + expected: &api.Secret{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Data: map[string][]byte{}, + Type: "my-type", + }, + expectErr: false, + }, + { + params: map[string]interface{}{ + "name": "foo", + "from-literal": []string{"key1=value1", "key2=value2"}, + }, + expected: &api.Secret{ + ObjectMeta: api.ObjectMeta{ + Name: "foo", + }, + Data: map[string][]byte{ + "key1": []byte("value1"), + "key2": []byte("value2"), + }, + }, + expectErr: false, + }, + { + params: map[string]interface{}{ + "name": "foo", + "from-literal": []string{"key1value1"}, + }, + expectErr: true, + }, + { + params: map[string]interface{}{ + "name": "foo", + "from-file": []string{"key1=/file=2"}, + }, + expectErr: true, + }, + { + params: map[string]interface{}{ + "name": "foo", + "from-file": []string{"key1==value"}, + }, + expectErr: true, + }, + } + generator := SecretGeneratorV1{} + for _, test := range tests { + obj, err := generator.Generate(test.params) + if !test.expectErr && err != nil { + t.Errorf("unexpected error: %v", err) + } + if test.expectErr && err != nil { + continue + } + if !reflect.DeepEqual(obj.(*api.Secret), test.expected) { + t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*api.Secret)) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/service.go b/vendor/k8s.io/kubernetes/pkg/kubectl/service.go index edee65449..57249e463 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/service.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/service.go @@ -19,10 +19,11 @@ package kubectl import ( "fmt" "strconv" + "strings" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) // The only difference between ServiceGeneratorV1 and V2 is that the service port is named "default" in V1, while it is left unnamed in V2. @@ -52,7 +53,12 @@ func paramNames() []GeneratorParam { {"default-name", true}, {"name", false}, {"selector", true}, - {"port", true}, + // port will be used if a user specifies --port OR the exposed object + // has one port + {"port", false}, + // ports will be used iff a user doesn't specify --port AND the + // exposed object has multiple ports + {"ports", false}, {"labels", false}, {"external-ip", false}, {"create-external-load-balancer", false}, @@ -100,19 +106,41 @@ func generate(genericParams map[string]interface{}) (runtime.Object, error) { return nil, fmt.Errorf("'name' is a required parameter.") } } - portString, found := params["port"] - if !found { - return nil, fmt.Errorf("'port' is a required parameter.") - } - port, err := strconv.Atoi(portString) - if err != nil { - return nil, err - } + ports := []api.ServicePort{} servicePortName, found := params["port-name"] if !found { // Leave the port unnamed. servicePortName = "" } + // ports takes precedence over port since it will be + // specified only when the user hasn't specified a port + // via --port and the exposed object has multiple ports. + var portString string + if portString, found = params["ports"]; !found { + portString, found = params["port"] + if !found { + return nil, fmt.Errorf("'port' is a required parameter.") + } + } + portStringSlice := strings.Split(portString, ",") + for i, stillPortString := range portStringSlice { + port, err := strconv.Atoi(stillPortString) + if err != nil { + return nil, err + } + name := servicePortName + // If we are going to assign multiple ports to a service, we need to + // generate a different name for each one. + if len(portStringSlice) > 1 { + name = fmt.Sprintf("port-%d", i+1) + } + ports = append(ports, api.ServicePort{ + Name: name, + Port: port, + Protocol: api.Protocol(params["protocol"]), + }) + } + service := api.Service{ ObjectMeta: api.ObjectMeta{ Name: name, @@ -120,27 +148,31 @@ func generate(genericParams map[string]interface{}) (runtime.Object, error) { }, Spec: api.ServiceSpec{ Selector: selector, - Ports: []api.ServicePort{ - { - Name: servicePortName, - Port: port, - Protocol: api.Protocol(params["protocol"]), - }, - }, + Ports: ports, }, } - targetPort, found := params["target-port"] + targetPortString, found := params["target-port"] if !found { - targetPort, found = params["container-port"] + targetPortString, found = params["container-port"] } - if found && len(targetPort) > 0 { - if portNum, err := strconv.Atoi(targetPort); err != nil { - service.Spec.Ports[0].TargetPort = util.NewIntOrStringFromString(targetPort) + if found && len(targetPortString) > 0 { + var targetPort intstr.IntOrString + if portNum, err := strconv.Atoi(targetPortString); err != nil { + targetPort = intstr.FromString(targetPortString) } else { - service.Spec.Ports[0].TargetPort = util.NewIntOrStringFromInt(portNum) + targetPort = intstr.FromInt(portNum) + } + // Use the same target-port for every port + for i := range service.Spec.Ports { + service.Spec.Ports[i].TargetPort = targetPort } } else { - service.Spec.Ports[0].TargetPort = util.NewIntOrStringFromInt(port) + // If --target-port or --container-port haven't been specified, this + // should be the same as Port + for i := range service.Spec.Ports { + port := service.Spec.Ports[i].Port + service.Spec.Ports[i].TargetPort = intstr.FromInt(port) + } } if params["create-external-load-balancer"] == "true" { service.Spec.Type = api.ServiceTypeLoadBalancer diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/service_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/service_test.go index 5345bdf70..80144239e 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/service_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/service_test.go @@ -21,7 +21,7 @@ import ( "testing" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/intstr" ) func TestGenerateService(t *testing.T) { @@ -52,7 +52,7 @@ func TestGenerateService(t *testing.T) { { Port: 80, Protocol: "TCP", - TargetPort: util.NewIntOrStringFromInt(1234), + TargetPort: intstr.FromInt(1234), }, }, }, @@ -81,7 +81,7 @@ func TestGenerateService(t *testing.T) { { Port: 80, Protocol: "UDP", - TargetPort: util.NewIntOrStringFromString("foobar"), + TargetPort: intstr.FromString("foobar"), }, }, }, @@ -114,7 +114,7 @@ func TestGenerateService(t *testing.T) { { Port: 80, Protocol: "TCP", - TargetPort: util.NewIntOrStringFromInt(1234), + TargetPort: intstr.FromInt(1234), }, }, }, @@ -143,7 +143,7 @@ func TestGenerateService(t *testing.T) { { Port: 80, Protocol: "UDP", - TargetPort: util.NewIntOrStringFromString("foobar"), + TargetPort: intstr.FromString("foobar"), }, }, ExternalIPs: []string{"1.2.3.4"}, @@ -174,7 +174,7 @@ func TestGenerateService(t *testing.T) { { Port: 80, Protocol: "UDP", - TargetPort: util.NewIntOrStringFromString("foobar"), + TargetPort: intstr.FromString("foobar"), }, }, Type: api.ServiceTypeLoadBalancer, @@ -205,7 +205,7 @@ func TestGenerateService(t *testing.T) { { Port: 80, Protocol: "UDP", - TargetPort: util.NewIntOrStringFromString("foobar"), + TargetPort: intstr.FromString("foobar"), }, }, Type: api.ServiceTypeNodePort, @@ -236,7 +236,7 @@ func TestGenerateService(t *testing.T) { { Port: 80, Protocol: "UDP", - TargetPort: util.NewIntOrStringFromString("foobar"), + TargetPort: intstr.FromString("foobar"), }, }, Type: api.ServiceTypeNodePort, @@ -266,7 +266,7 @@ func TestGenerateService(t *testing.T) { Name: "default", Port: 80, Protocol: "TCP", - TargetPort: util.NewIntOrStringFromInt(1234), + TargetPort: intstr.FromInt(1234), }, }, }, @@ -296,13 +296,114 @@ func TestGenerateService(t *testing.T) { Name: "default", Port: 80, Protocol: "TCP", - TargetPort: util.NewIntOrStringFromInt(1234), + TargetPort: intstr.FromInt(1234), }, }, SessionAffinity: api.ServiceAffinityClientIP, }, }, }, + { + generator: ServiceGeneratorV1{}, + params: map[string]interface{}{ + "selector": "foo=bar", + "name": "test", + "ports": "80,443", + "protocol": "TCP", + "container-port": "foobar", + }, + expected: api.Service{ + ObjectMeta: api.ObjectMeta{ + Name: "test", + }, + Spec: api.ServiceSpec{ + Selector: map[string]string{ + "foo": "bar", + }, + Ports: []api.ServicePort{ + { + Name: "port-1", + Port: 80, + Protocol: api.ProtocolTCP, + TargetPort: intstr.FromString("foobar"), + }, + { + Name: "port-2", + Port: 443, + Protocol: api.ProtocolTCP, + TargetPort: intstr.FromString("foobar"), + }, + }, + }, + }, + }, + { + generator: ServiceGeneratorV2{}, + params: map[string]interface{}{ + "selector": "foo=bar", + "name": "test", + "ports": "80,443", + "protocol": "UDP", + "target-port": "1234", + }, + expected: api.Service{ + ObjectMeta: api.ObjectMeta{ + Name: "test", + }, + Spec: api.ServiceSpec{ + Selector: map[string]string{ + "foo": "bar", + }, + Ports: []api.ServicePort{ + { + Name: "port-1", + Port: 80, + Protocol: api.ProtocolUDP, + TargetPort: intstr.FromInt(1234), + }, + { + Name: "port-2", + Port: 443, + Protocol: api.ProtocolUDP, + TargetPort: intstr.FromInt(1234), + }, + }, + }, + }, + }, + { + generator: ServiceGeneratorV2{}, + params: map[string]interface{}{ + "selector": "foo=bar", + "name": "test", + "ports": "80,443", + "protocol": "TCP", + }, + expected: api.Service{ + ObjectMeta: api.ObjectMeta{ + Name: "test", + }, + Spec: api.ServiceSpec{ + Selector: map[string]string{ + "foo": "bar", + }, + Ports: []api.ServicePort{ + { + Name: "port-1", + Port: 80, + Protocol: api.ProtocolTCP, + TargetPort: intstr.FromInt(80), + }, + { + Name: "port-2", + Port: 443, + Protocol: api.ProtocolTCP, + TargetPort: intstr.FromInt(443), + }, + }, + }, + }, + }, } for _, test := range tests { obj, err := test.generator.Generate(test.params) diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/sorted_event_list_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/sorted_event_list_test.go index 4d65a15dc..471069ed2 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/sorted_event_list_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/sorted_event_list_test.go @@ -60,6 +60,7 @@ func TestSortableEvents(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(2014, time.January, 15, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(2014, time.January, 15, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, { Source: api.EventSource{Component: "scheduler"}, @@ -67,6 +68,7 @@ func TestSortableEvents(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(1987, time.June, 17, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(1987, time.June, 17, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, { Source: api.EventSource{Component: "kubelet"}, @@ -74,6 +76,7 @@ func TestSortableEvents(t *testing.T) { FirstTimestamp: unversioned.NewTime(time.Date(2002, time.December, 25, 0, 0, 0, 0, time.UTC)), LastTimestamp: unversioned.NewTime(time.Date(2002, time.December, 25, 0, 0, 0, 0, time.UTC)), Count: 1, + Type: api.EventTypeNormal, }, }) diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/sorting_printer.go b/vendor/k8s.io/kubernetes/pkg/kubectl/sorting_printer.go index 2ec610d42..49e36b882 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/sorting_printer.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/sorting_printer.go @@ -22,7 +22,8 @@ import ( "reflect" "sort" - "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util/jsonpath" @@ -34,10 +35,11 @@ import ( type SortingPrinter struct { SortField string Delegate ResourcePrinter + Decoder runtime.Decoder } func (s *SortingPrinter) PrintObj(obj runtime.Object, out io.Writer) error { - if !runtime.IsListType(obj) { + if !meta.IsListType(obj) { return s.Delegate.PrintObj(obj, out) } @@ -53,47 +55,81 @@ func (p *SortingPrinter) HandledResources() []string { } func (s *SortingPrinter) sortObj(obj runtime.Object) error { - objs, err := runtime.ExtractList(obj) + objs, err := meta.ExtractList(obj) if err != nil { return err } if len(objs) == 0 { return nil } + + sorter, err := SortObjects(s.Decoder, objs, s.SortField) + if err != nil { + return err + } + + switch list := obj.(type) { + case *v1.List: + outputList := make([]runtime.RawExtension, len(objs)) + for ix := range objs { + outputList[ix] = list.Items[sorter.OriginalPosition(ix)] + } + list.Items = outputList + return nil + } + return meta.SetList(obj, objs) +} + +func SortObjects(decoder runtime.Decoder, objs []runtime.Object, fieldInput string) (*RuntimeSort, error) { parser := jsonpath.New("sorting") - parser.Parse(s.SortField) + + field, err := massageJSONPath(fieldInput) + if err != nil { + return nil, err + } + + if err := parser.Parse(field); err != nil { + return nil, err + } for ix := range objs { item := objs[ix] switch u := item.(type) { case *runtime.Unknown: var err error - if objs[ix], err = api.Codec.Decode(u.RawJSON); err != nil { - return err + if objs[ix], _, err = decoder.Decode(u.RawJSON, nil, nil); err != nil { + return nil, err } } } + values, err := parser.FindResults(reflect.ValueOf(objs[0]).Elem().Interface()) if err != nil { - return err + return nil, err } if len(values) == 0 { - return fmt.Errorf("couldn't find any field with path: %s", s.SortField) - } - sorter := &RuntimeSort{ - field: s.SortField, - objs: objs, + return nil, fmt.Errorf("couldn't find any field with path: %s", field) } + + sorter := NewRuntimeSort(field, objs) sort.Sort(sorter) - runtime.SetList(obj, sorter.objs) - return nil + return sorter, nil } // RuntimeSort is an implementation of the golang sort interface that knows how to sort // lists of runtime.Object type RuntimeSort struct { - field string - objs []runtime.Object + field string + objs []runtime.Object + origPosition []int +} + +func NewRuntimeSort(field string, objs []runtime.Object) *RuntimeSort { + sorter := &RuntimeSort{field: field, objs: objs, origPosition: make([]int, len(objs))} + for ix := range objs { + sorter.origPosition[ix] = ix + } + return sorter } func (r *RuntimeSort) Len() int { @@ -102,6 +138,7 @@ func (r *RuntimeSort) Len() int { func (r *RuntimeSort) Swap(i, j int) { r.objs[i], r.objs[j] = r.objs[j], r.objs[i] + r.origPosition[i], r.origPosition[j] = r.origPosition[j], r.origPosition[i] } func isLess(i, j reflect.Value) (bool, error) { @@ -146,3 +183,12 @@ func (r *RuntimeSort) Less(i, j int) bool { } return less } + +// Returns the starting (original) position of a particular index. e.g. If OriginalPosition(0) returns 5 than the +// the item currently at position 0 was at position 5 in the original unsorted array. +func (r *RuntimeSort) OriginalPosition(ix int) int { + if ix < 0 || ix > len(r.origPosition) { + return -1 + } + return r.origPosition[ix] +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/sorting_printer_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/sorting_printer_test.go index 9abb1e701..f1d1d0c65 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/sorting_printer_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/sorting_printer_test.go @@ -20,12 +20,39 @@ import ( "reflect" "testing" + internal "k8s.io/kubernetes/pkg/api" api "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/runtime" ) +func encodeOrDie(obj runtime.Object) []byte { + data, err := runtime.Encode(internal.Codecs.LegacyCodec(api.SchemeGroupVersion), obj) + if err != nil { + panic(err.Error()) + } + return data +} + func TestSortingPrinter(t *testing.T) { - intPtr := func(val int) *int { return &val } + intPtr := func(val int32) *int32 { return &val } + + a := &api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "a", + }, + } + + b := &api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "b", + }, + } + + c := &api.Pod{ + ObjectMeta: api.ObjectMeta{ + Name: "c", + }, + } tests := []struct { obj runtime.Object @@ -159,9 +186,45 @@ func TestSortingPrinter(t *testing.T) { }, field: "{.spec.replicas}", }, + { + name: "v1.List in order", + obj: &api.List{ + Items: []runtime.RawExtension{ + {RawJSON: encodeOrDie(a)}, + {RawJSON: encodeOrDie(b)}, + {RawJSON: encodeOrDie(c)}, + }, + }, + sort: &api.List{ + Items: []runtime.RawExtension{ + {RawJSON: encodeOrDie(a)}, + {RawJSON: encodeOrDie(b)}, + {RawJSON: encodeOrDie(c)}, + }, + }, + field: "{.metadata.name}", + }, + { + name: "v1.List in reverse", + obj: &api.List{ + Items: []runtime.RawExtension{ + {RawJSON: encodeOrDie(c)}, + {RawJSON: encodeOrDie(b)}, + {RawJSON: encodeOrDie(a)}, + }, + }, + sort: &api.List{ + Items: []runtime.RawExtension{ + {RawJSON: encodeOrDie(a)}, + {RawJSON: encodeOrDie(b)}, + {RawJSON: encodeOrDie(c)}, + }, + }, + field: "{.metadata.name}", + }, } for _, test := range tests { - sort := &SortingPrinter{SortField: test.field} + sort := &SortingPrinter{SortField: test.field, Decoder: internal.Codecs.UniversalDecoder()} if err := sort.sortObj(test.obj); err != nil { t.Errorf("unexpected error: %v (%s)", err, test.name) continue diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/stop.go b/vendor/k8s.io/kubernetes/pkg/kubectl/stop.go index f90452abc..cf7cb1a9e 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/stop.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/stop.go @@ -22,11 +22,14 @@ import ( "time" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" client "k8s.io/kubernetes/pkg/client/unversioned" - "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/util" + utilerrors "k8s.io/kubernetes/pkg/util/errors" "k8s.io/kubernetes/pkg/util/wait" ) @@ -39,15 +42,15 @@ const ( // timeout is how long we'll wait for the termination to be successful // gracePeriod is time given to an API object for it to delete itself cleanly (e.g. pod shutdown) type Reaper interface { - Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) (string, error) + Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error } type NoSuchReaperError struct { - kind string + kind unversioned.GroupKind } func (n *NoSuchReaperError) Error() string { - return fmt.Sprintf("no reaper has been implemented for %q", n.kind) + return fmt.Sprintf("no reaper has been implemented for %v", n.kind) } func IsNoSuchReaperError(err error) bool { @@ -55,18 +58,29 @@ func IsNoSuchReaperError(err error) bool { return ok } -func ReaperFor(kind string, c client.Interface) (Reaper, error) { +func ReaperFor(kind unversioned.GroupKind, c client.Interface) (Reaper, error) { switch kind { - case "ReplicationController": + case api.Kind("ReplicationController"): return &ReplicationControllerReaper{c, Interval, Timeout}, nil - case "DaemonSet": + + case extensions.Kind("ReplicaSet"): + return &ReplicaSetReaper{c, Interval, Timeout}, nil + + case extensions.Kind("DaemonSet"): return &DaemonSetReaper{c, Interval, Timeout}, nil - case "Pod": + + case api.Kind("Pod"): return &PodReaper{c}, nil - case "Service": + + case api.Kind("Service"): return &ServiceReaper{c}, nil - case "Job": + + case extensions.Kind("Job"): return &JobReaper{c, Interval, Timeout}, nil + + case extensions.Kind("Deployment"): + return &DeploymentReaper{c, Interval, Timeout}, nil + } return nil, &NoSuchReaperError{kind} } @@ -79,6 +93,10 @@ type ReplicationControllerReaper struct { client.Interface pollInterval, timeout time.Duration } +type ReplicaSetReaper struct { + client.Interface + pollInterval, timeout time.Duration +} type DaemonSetReaper struct { client.Interface pollInterval, timeout time.Duration @@ -87,6 +105,10 @@ type JobReaper struct { client.Interface pollInterval, timeout time.Duration } +type DeploymentReaper struct { + client.Interface + pollInterval, timeout time.Duration +} type PodReaper struct { client.Interface } @@ -96,12 +118,12 @@ type ServiceReaper struct { type objInterface interface { Delete(name string) error - Get(name string) (meta.Interface, error) + Get(name string) (meta.Object, error) } // getOverlappingControllers finds rcs that this controller overlaps, as well as rcs overlapping this controller. func getOverlappingControllers(c client.ReplicationControllerInterface, rc *api.ReplicationController) ([]api.ReplicationController, error) { - rcs, err := c.List(labels.Everything(), fields.Everything()) + rcs, err := c.List(api.ListOptions{}) if err != nil { return nil, fmt.Errorf("error getting replication controllers: %v", err) } @@ -116,15 +138,15 @@ func getOverlappingControllers(c client.ReplicationControllerInterface, rc *api. return matchingRCs, nil } -func (reaper *ReplicationControllerReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) (string, error) { +func (reaper *ReplicationControllerReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error { rc := reaper.ReplicationControllers(namespace) - scaler, err := ScalerFor("ReplicationController", *reaper) + scaler, err := ScalerFor(api.Kind("ReplicationController"), *reaper) if err != nil { - return "", err + return err } ctrl, err := rc.Get(name) if err != nil { - return "", err + return err } if timeout == 0 { timeout = Timeout + time.Duration(10*ctrl.Spec.Replicas)*time.Second @@ -152,7 +174,7 @@ func (reaper *ReplicationControllerReaper) Stop(namespace, name string, timeout overlappingCtrls, err := getOverlappingControllers(rc, ctrl) if err != nil { - return "", fmt.Errorf("error getting replication controllers: %v", err) + return fmt.Errorf("error getting replication controllers: %v", err) } exactMatchRCs := []api.ReplicationController{} overlapRCs := []string{} @@ -164,7 +186,7 @@ func (reaper *ReplicationControllerReaper) Stop(namespace, name string, timeout } } if len(overlapRCs) > 0 { - return "", fmt.Errorf( + return fmt.Errorf( "Detected overlapping controllers for rc %v: %v, please manage deletion individually with --cascade=false.", ctrl.Name, strings.Join(overlapRCs, ",")) } @@ -173,19 +195,91 @@ func (reaper *ReplicationControllerReaper) Stop(namespace, name string, timeout retry := NewRetryParams(reaper.pollInterval, reaper.timeout) waitForReplicas := NewRetryParams(reaper.pollInterval, timeout) if err = scaler.Scale(namespace, name, 0, nil, retry, waitForReplicas); err != nil { - return "", err + return err } } - if err := rc.Delete(name); err != nil { - return "", err - } - return fmt.Sprintf("%s stopped", name), nil + return rc.Delete(name) } -func (reaper *DaemonSetReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) (string, error) { +// TODO(madhusudancs): Implement it when controllerRef is implemented - https://github.com/kubernetes/kubernetes/issues/2210 +// getOverlappingReplicaSets finds ReplicaSets that this ReplicaSet overlaps, as well as ReplicaSets overlapping this ReplicaSet. +func getOverlappingReplicaSets(c client.ReplicaSetInterface, rs *extensions.ReplicaSet) ([]extensions.ReplicaSet, []extensions.ReplicaSet, error) { + var overlappingRSs, exactMatchRSs []extensions.ReplicaSet + return overlappingRSs, exactMatchRSs, nil +} + +func (reaper *ReplicaSetReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error { + rsc := reaper.Extensions().ReplicaSets(namespace) + scaler, err := ScalerFor(extensions.Kind("ReplicaSet"), *reaper) + if err != nil { + return err + } + rs, err := rsc.Get(name) + if err != nil { + return err + } + if timeout == 0 { + timeout = Timeout + time.Duration(10*rs.Spec.Replicas)*time.Second + } + + // The ReplicaSet controller will try and detect all matching ReplicaSets + // for a pod's labels, and only sync the oldest one. This means if we have + // a pod with labels [(k1: v1), (k2: v2)] and two ReplicaSets: rs1 with + // selector [(k1=v1)], and rs2 with selector [(k1=v1),(k2=v2)], the + // ReplicaSet controller will sync the older of the two ReplicaSets. + // + // If there are ReplicaSets with a superset of labels, eg: + // deleting: (k1=v1), superset: (k2=v2, k1=v1) + // - It isn't safe to delete the ReplicaSet because there could be a pod + // with labels (k1=v1) that isn't managed by the superset ReplicaSet. + // We can't scale it down either, because there could be a pod + // (k2=v2, k1=v1) that it deletes causing a fight with the superset + // ReplicaSet. + // If there are ReplicaSets with a subset of labels, eg: + // deleting: (k2=v2, k1=v1), subset: (k1=v1), superset: (k2=v2, k1=v1, k3=v3) + // - Even if it's safe to delete this ReplicaSet without a scale down because + // all it's pods are being controlled by the subset ReplicaSet the code + // returns an error. + + // In theory, creating overlapping ReplicaSets is user error, so the loop below + // tries to account for this logic only in the common case, where we end up + // with multiple ReplicaSets that have an exact match on selectors. + + // TODO(madhusudancs): Re-evaluate again when controllerRef is implemented - + // https://github.com/kubernetes/kubernetes/issues/2210 + overlappingRSs, exactMatchRSs, err := getOverlappingReplicaSets(rsc, rs) + if err != nil { + return fmt.Errorf("error getting ReplicaSets: %v", err) + } + + if len(overlappingRSs) > 0 { + var names []string + for _, overlappingRS := range overlappingRSs { + names = append(names, overlappingRS.Name) + } + return fmt.Errorf( + "Detected overlapping ReplicaSets for ReplicaSet %v: %v, please manage deletion individually with --cascade=false.", + rs.Name, strings.Join(names, ",")) + } + if len(exactMatchRSs) == 0 { + // No overlapping ReplicaSets. + retry := NewRetryParams(reaper.pollInterval, reaper.timeout) + waitForReplicas := NewRetryParams(reaper.pollInterval, timeout) + if err = scaler.Scale(namespace, name, 0, nil, retry, waitForReplicas); err != nil { + return err + } + } + + if err := rsc.Delete(name, gracePeriod); err != nil { + return err + } + return nil +} + +func (reaper *DaemonSetReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error { ds, err := reaper.Extensions().DaemonSets(namespace).Get(name) if err != nil { - return "", err + return err } // We set the nodeSelector to a random label. This label is nearly guaranteed @@ -199,7 +293,7 @@ func (reaper *DaemonSetReaper) Stop(namespace, name string, timeout time.Duratio ds.ResourceVersion = "" if ds, err = reaper.Extensions().DaemonSets(namespace).Update(ds); err != nil { - return "", err + return err } // Wait for the daemon set controller to kill all the daemon pods. @@ -210,24 +304,22 @@ func (reaper *DaemonSetReaper) Stop(namespace, name string, timeout time.Duratio } return updatedDS.Status.CurrentNumberScheduled+updatedDS.Status.NumberMisscheduled == 0, nil }); err != nil { - return "", err + return err } - if err := reaper.Extensions().DaemonSets(namespace).Delete(name); err != nil { - return "", err - } - return fmt.Sprintf("%s stopped", name), nil + return reaper.Extensions().DaemonSets(namespace).Delete(name) } -func (reaper *JobReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) (string, error) { +func (reaper *JobReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error { jobs := reaper.Extensions().Jobs(namespace) - scaler, err := ScalerFor("Job", *reaper) + pods := reaper.Pods(namespace) + scaler, err := ScalerFor(extensions.Kind("Job"), *reaper) if err != nil { - return "", err + return err } job, err := jobs.Get(name) if err != nil { - return "", err + return err } if timeout == 0 { // we will never have more active pods than job.Spec.Parallelism @@ -239,35 +331,130 @@ func (reaper *JobReaper) Stop(namespace, name string, timeout time.Duration, gra retry := NewRetryParams(reaper.pollInterval, reaper.timeout) waitForJobs := NewRetryParams(reaper.pollInterval, timeout) if err = scaler.Scale(namespace, name, 0, nil, retry, waitForJobs); err != nil { - return "", err + return err } - if err := jobs.Delete(name, gracePeriod); err != nil { - return "", err + // at this point only dead pods are left, that should be removed + selector, _ := unversioned.LabelSelectorAsSelector(job.Spec.Selector) + options := api.ListOptions{LabelSelector: selector} + podList, err := pods.List(options) + if err != nil { + return err } - return fmt.Sprintf("%s stopped", name), nil + errList := []error{} + for _, pod := range podList.Items { + if err := pods.Delete(pod.Name, gracePeriod); err != nil { + // ignores the error when the pod isn't found + if !errors.IsNotFound(err) { + errList = append(errList, err) + } + } + } + if len(errList) > 0 { + return utilerrors.NewAggregate(errList) + } + // once we have all the pods removed we can safely remove the job itself + return jobs.Delete(name, gracePeriod) } -func (reaper *PodReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) (string, error) { +func (reaper *DeploymentReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error { + deployments := reaper.Extensions().Deployments(namespace) + replicaSets := reaper.Extensions().ReplicaSets(namespace) + rsReaper, _ := ReaperFor(extensions.Kind("ReplicaSet"), reaper) + + deployment, err := deployments.Get(name) + if err != nil { + return err + } + + // set deployment's history and scale to 0 + // TODO replace with patch when available: https://github.com/kubernetes/kubernetes/issues/20527 + zero := 0 + deployment.Spec.RevisionHistoryLimit = &zero + deployment.Spec.Replicas = 0 + // TODO: un-pausing should not be necessary, remove when this is fixed: + // https://github.com/kubernetes/kubernetes/issues/20966 + // Instead deployment should be Paused at this point and not at next TODO. + deployment.Spec.Paused = false + deployment, err = deployments.Update(deployment) + if err != nil { + return err + } + + // wait for total no of pods drop to 0 + if err := wait.Poll(reaper.pollInterval, reaper.timeout, func() (bool, error) { + curr, err := deployments.Get(name) + // if deployment was not found it must have been deleted, error out + if err != nil && errors.IsNotFound(err) { + return false, err + } + // if other errors happen, retry + if err != nil { + return false, nil + } + // check if deployment wasn't recreated with the same name + // TODO use generations when deployment will have them + if curr.UID != deployment.UID { + return false, errors.NewNotFound(extensions.Resource("Deployment"), name) + } + return curr.Status.Replicas == 0, nil + }); err != nil { + return err + } + + // TODO: When deployments will allow running cleanup policy while being + // paused, move pausing to above update operation. Without it, we need to + // pause deployment before stopping RSs, to prevent creating new RSs. + // See https://github.com/kubernetes/kubernetes/issues/20966 + deployment, err = deployments.Get(name) + if err != nil { + return err + } + deployment.Spec.Paused = true + deployment, err = deployments.Update(deployment) + if err != nil { + return err + } + + // remove remaining RSs + selector, err := unversioned.LabelSelectorAsSelector(deployment.Spec.Selector) + if err != nil { + return err + } + options := api.ListOptions{LabelSelector: selector} + rsList, err := replicaSets.List(options) + if err != nil { + return err + } + errList := []error{} + for _, rc := range rsList.Items { + if err := rsReaper.Stop(rc.Namespace, rc.Name, timeout, gracePeriod); err != nil { + if !errors.IsNotFound(err) { + errList = append(errList, err) + } + } + } + if len(errList) > 0 { + return utilerrors.NewAggregate(errList) + } + + // and finally deployment + return deployments.Delete(name, gracePeriod) +} + +func (reaper *PodReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error { pods := reaper.Pods(namespace) _, err := pods.Get(name) if err != nil { - return "", err + return err } - if err := pods.Delete(name, gracePeriod); err != nil { - return "", err - } - - return fmt.Sprintf("%s stopped", name), nil + return pods.Delete(name, gracePeriod) } -func (reaper *ServiceReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) (string, error) { +func (reaper *ServiceReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) error { services := reaper.Services(namespace) _, err := services.Get(name) if err != nil { - return "", err + return err } - if err := services.Delete(name); err != nil { - return "", err - } - return fmt.Sprintf("%s stopped", name), nil + return services.Delete(name) } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/stop_test.go b/vendor/k8s.io/kubernetes/pkg/kubectl/stop_test.go index d5b645353..32a5f52d0 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/stop_test.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/stop_test.go @@ -19,14 +19,17 @@ package kubectl import ( "fmt" "reflect" + "strings" "testing" "time" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/client/unversioned/testclient" "k8s.io/kubernetes/pkg/runtime" + deploymentutil "k8s.io/kubernetes/pkg/util/deployment" ) func TestReplicationControllerStop(t *testing.T) { @@ -36,7 +39,6 @@ func TestReplicationControllerStop(t *testing.T) { Name string Objs []runtime.Object StopError error - StopMessage string ExpectedActions []string }{ { @@ -66,7 +68,6 @@ func TestReplicationControllerStop(t *testing.T) { }, }, StopError: nil, - StopMessage: "foo stopped", ExpectedActions: []string{"get", "list", "get", "update", "get", "get", "delete"}, }, { @@ -105,7 +106,6 @@ func TestReplicationControllerStop(t *testing.T) { }, }, StopError: nil, - StopMessage: "foo stopped", ExpectedActions: []string{"get", "list", "get", "update", "get", "get", "delete"}, }, { @@ -145,7 +145,6 @@ func TestReplicationControllerStop(t *testing.T) { }, }, StopError: fmt.Errorf("Detected overlapping controllers for rc foo: baz, please manage deletion individually with --cascade=false."), - StopMessage: "", ExpectedActions: []string{"get", "list"}, }, @@ -196,7 +195,6 @@ func TestReplicationControllerStop(t *testing.T) { }, StopError: fmt.Errorf("Detected overlapping controllers for rc foo: baz,zaz, please manage deletion individually with --cascade=false."), - StopMessage: "", ExpectedActions: []string{"get", "list"}, }, @@ -238,7 +236,6 @@ func TestReplicationControllerStop(t *testing.T) { }, StopError: nil, - StopMessage: "foo stopped", ExpectedActions: []string{"get", "list", "delete"}, }, } @@ -246,16 +243,12 @@ func TestReplicationControllerStop(t *testing.T) { for _, test := range tests { fake := testclient.NewSimpleFake(test.Objs...) reaper := ReplicationControllerReaper{fake, time.Millisecond, time.Millisecond} - s, err := reaper.Stop(ns, name, 0, nil) + err := reaper.Stop(ns, name, 0, nil) if !reflect.DeepEqual(err, test.StopError) { t.Errorf("%s unexpected error: %v", test.Name, err) continue } - if s != test.StopMessage { - t.Errorf("%s expected '%s', got '%s'", test.Name, test.StopMessage, s) - continue - } actions := fake.Actions() if len(actions) != len(test.ExpectedActions) { t.Errorf("%s unexpected actions: %v, expected %d actions got %d", test.Name, actions, len(test.ExpectedActions), len(actions)) @@ -272,6 +265,116 @@ func TestReplicationControllerStop(t *testing.T) { } } +func TestReplicaSetStop(t *testing.T) { + name := "foo" + ns := "default" + tests := []struct { + Name string + Objs []runtime.Object + StopError error + ExpectedActions []string + }{ + { + Name: "OnlyOneRS", + Objs: []runtime.Object{ + &extensions.ReplicaSet{ // GET + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: ns, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 0, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"k1": "v1"}}, + }, + }, + &extensions.ReplicaSetList{ // LIST + Items: []extensions.ReplicaSet{ + { + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: ns, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 0, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"k1": "v1"}}, + }, + }, + }, + }, + }, + StopError: nil, + ExpectedActions: []string{"get", "get", "update", "get", "get", "delete"}, + }, + { + Name: "NoOverlapping", + Objs: []runtime.Object{ + &extensions.ReplicaSet{ // GET + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: ns, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 0, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"k1": "v1"}}, + }, + }, + &extensions.ReplicaSetList{ // LIST + Items: []extensions.ReplicaSet{ + { + ObjectMeta: api.ObjectMeta{ + Name: "baz", + Namespace: ns, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 0, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"k3": "v3"}}, + }, + }, + { + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: ns, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 0, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"k1": "v1"}}, + }, + }, + }, + }, + }, + StopError: nil, + ExpectedActions: []string{"get", "get", "update", "get", "get", "delete"}, + }, + // TODO: Implement tests for overlapping replica sets, similar to replication controllers, + // when the overlapping checks are implemented for replica sets. + } + + for _, test := range tests { + fake := testclient.NewSimpleFake(test.Objs...) + reaper := ReplicaSetReaper{fake, time.Millisecond, time.Millisecond} + err := reaper.Stop(ns, name, 0, nil) + if !reflect.DeepEqual(err, test.StopError) { + t.Errorf("%s unexpected error: %v", test.Name, err) + continue + } + + actions := fake.Actions() + if len(actions) != len(test.ExpectedActions) { + t.Errorf("%s unexpected actions: %v, expected %d actions got %d", test.Name, actions, len(test.ExpectedActions), len(actions)) + continue + } + for i, verb := range test.ExpectedActions { + if actions[i].GetResource() != "replicasets" { + t.Errorf("%s unexpected action: %+v, expected %s-replicaSet", test.Name, actions[i], verb) + } + if actions[i].GetVerb() != verb { + t.Errorf("%s unexpected action: %+v, expected %s-replicaSet", test.Name, actions[i], verb) + } + } + } +} + func TestJobStop(t *testing.T) { name := "foo" ns := "default" @@ -280,7 +383,6 @@ func TestJobStop(t *testing.T) { Name string Objs []runtime.Object StopError error - StopMessage string ExpectedActions []string }{ { @@ -293,7 +395,7 @@ func TestJobStop(t *testing.T) { }, Spec: extensions.JobSpec{ Parallelism: &zero, - Selector: &extensions.PodSelector{ + Selector: &unversioned.LabelSelector{ MatchLabels: map[string]string{"k1": "v1"}, }, }, @@ -307,7 +409,7 @@ func TestJobStop(t *testing.T) { }, Spec: extensions.JobSpec{ Parallelism: &zero, - Selector: &extensions.PodSelector{ + Selector: &unversioned.LabelSelector{ MatchLabels: map[string]string{"k1": "v1"}, }, }, @@ -315,36 +417,181 @@ func TestJobStop(t *testing.T) { }, }, }, - StopError: nil, - StopMessage: "foo stopped", - ExpectedActions: []string{"get", "get", "update", "get", "get", "delete"}, + StopError: nil, + ExpectedActions: []string{"get:jobs", "get:jobs", "update:jobs", + "get:jobs", "get:jobs", "list:pods", "delete:jobs"}, + }, + { + Name: "JobWithDeadPods", + Objs: []runtime.Object{ + &extensions.Job{ // GET + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: ns, + }, + Spec: extensions.JobSpec{ + Parallelism: &zero, + Selector: &unversioned.LabelSelector{ + MatchLabels: map[string]string{"k1": "v1"}, + }, + }, + }, + &extensions.JobList{ // LIST + Items: []extensions.Job{ + { + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: ns, + }, + Spec: extensions.JobSpec{ + Parallelism: &zero, + Selector: &unversioned.LabelSelector{ + MatchLabels: map[string]string{"k1": "v1"}, + }, + }, + }, + }, + }, + &api.PodList{ // LIST + Items: []api.Pod{ + { + ObjectMeta: api.ObjectMeta{ + Name: "pod1", + Namespace: ns, + Labels: map[string]string{"k1": "v1"}, + }, + }, + }, + }, + }, + StopError: nil, + ExpectedActions: []string{"get:jobs", "get:jobs", "update:jobs", + "get:jobs", "get:jobs", "list:pods", "delete:pods", "delete:jobs"}, }, } for _, test := range tests { fake := testclient.NewSimpleFake(test.Objs...) reaper := JobReaper{fake, time.Millisecond, time.Millisecond} - s, err := reaper.Stop(ns, name, 0, nil) + err := reaper.Stop(ns, name, 0, nil) if !reflect.DeepEqual(err, test.StopError) { t.Errorf("%s unexpected error: %v", test.Name, err) continue } - if s != test.StopMessage { - t.Errorf("%s expected '%s', got '%s'", test.Name, test.StopMessage, s) - continue - } actions := fake.Actions() if len(actions) != len(test.ExpectedActions) { t.Errorf("%s unexpected actions: %v, expected %d actions got %d", test.Name, actions, len(test.ExpectedActions), len(actions)) continue } - for i, verb := range test.ExpectedActions { - if actions[i].GetResource() != "jobs" { - t.Errorf("%s unexpected action: %+v, expected %s-job", test.Name, actions[i], verb) + for i, expAction := range test.ExpectedActions { + action := strings.Split(expAction, ":") + if actions[i].GetVerb() != action[0] { + t.Errorf("%s unexpected verb: %+v, expected %s", test.Name, actions[i], expAction) } - if actions[i].GetVerb() != verb { - t.Errorf("%s unexpected action: %+v, expected %s-job", test.Name, actions[i], verb) + if actions[i].GetResource() != action[1] { + t.Errorf("%s unexpected resource: %+v, expected %s", test.Name, actions[i], expAction) + } + } + } +} + +func TestDeploymentStop(t *testing.T) { + name := "foo" + ns := "default" + deployment := extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: ns, + }, + Spec: extensions.DeploymentSpec{ + Replicas: 0, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"k1": "v1"}}, + }, + Status: extensions.DeploymentStatus{ + Replicas: 0, + }, + } + template := deploymentutil.GetNewReplicaSetTemplate(deployment) + tests := []struct { + Name string + Objs []runtime.Object + StopError error + ExpectedActions []string + }{ + { + Name: "SimpleDeployment", + Objs: []runtime.Object{ + &extensions.Deployment{ // GET + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: ns, + }, + Spec: extensions.DeploymentSpec{ + Replicas: 0, + Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"k1": "v1"}}, + }, + Status: extensions.DeploymentStatus{ + Replicas: 0, + }, + }, + }, + StopError: nil, + ExpectedActions: []string{"get:deployments", "update:deployments", + "get:deployments", "get:deployments", "update:deployments", + "list:replicasets", "delete:deployments"}, + }, + { + Name: "Deployment with single replicaset", + Objs: []runtime.Object{ + &deployment, // GET + &extensions.ReplicaSetList{ // LIST + Items: []extensions.ReplicaSet{ + { + ObjectMeta: api.ObjectMeta{ + Name: name, + Namespace: ns, + }, + Spec: extensions.ReplicaSetSpec{ + Template: &template, + }, + }, + }, + }, + }, + StopError: nil, + ExpectedActions: []string{"get:deployments", "update:deployments", + "get:deployments", "get:deployments", "update:deployments", + "list:replicasets", "get:replicasets", "get:replicasets", + "update:replicasets", "get:replicasets", "get:replicasets", + "delete:replicasets", "delete:deployments"}, + }, + } + + for _, test := range tests { + fake := testclient.NewSimpleFake(test.Objs...) + reaper := DeploymentReaper{fake, time.Millisecond, time.Millisecond} + err := reaper.Stop(ns, name, 0, nil) + if !reflect.DeepEqual(err, test.StopError) { + t.Errorf("%s unexpected error: %v", test.Name, err) + continue + } + + actions := fake.Actions() + if len(actions) != len(test.ExpectedActions) { + t.Errorf("%s unexpected actions: %v, expected %d actions got %d", test.Name, actions, len(test.ExpectedActions), len(actions)) + continue + } + for i, expAction := range test.ExpectedActions { + action := strings.Split(expAction, ":") + if actions[i].GetVerb() != action[0] { + t.Errorf("%s unexpected verb: %+v, expected %s", test.Name, actions[i], expAction) + } + if actions[i].GetResource() != action[1] { + t.Errorf("%s unexpected resource: %+v, expected %s", test.Name, actions[i], expAction) + } + if len(action) == 3 && actions[i].GetSubresource() != action[2] { + t.Errorf("%s unexpected subresource: %+v, expected %s", test.Name, actions[i], expAction) } } } @@ -390,7 +637,7 @@ func (c *reaperFake) Services(namespace string) client.ServiceInterface { func TestSimpleStop(t *testing.T) { tests := []struct { fake *reaperFake - kind string + kind unversioned.GroupKind actions []testclient.Action expectError bool test string @@ -399,7 +646,7 @@ func TestSimpleStop(t *testing.T) { fake: &reaperFake{ Fake: &testclient.Fake{}, }, - kind: "Pod", + kind: api.Kind("Pod"), actions: []testclient.Action{ testclient.NewGetAction("pods", api.NamespaceDefault, "foo"), testclient.NewDeleteAction("pods", api.NamespaceDefault, "foo"), @@ -411,7 +658,7 @@ func TestSimpleStop(t *testing.T) { fake: &reaperFake{ Fake: &testclient.Fake{}, }, - kind: "Service", + kind: api.Kind("Service"), actions: []testclient.Action{ testclient.NewGetAction("services", api.NamespaceDefault, "foo"), testclient.NewDeleteAction("services", api.NamespaceDefault, "foo"), @@ -424,7 +671,7 @@ func TestSimpleStop(t *testing.T) { Fake: &testclient.Fake{}, noSuchPod: true, }, - kind: "Pod", + kind: api.Kind("Pod"), actions: []testclient.Action{}, expectError: true, test: "stop pod fails, no pod", @@ -434,7 +681,7 @@ func TestSimpleStop(t *testing.T) { Fake: &testclient.Fake{}, noDeleteService: true, }, - kind: "Service", + kind: api.Kind("Service"), actions: []testclient.Action{ testclient.NewGetAction("services", api.NamespaceDefault, "foo"), }, @@ -448,7 +695,7 @@ func TestSimpleStop(t *testing.T) { if err != nil { t.Errorf("unexpected error: %v (%s)", err, test.test) } - s, err := reaper.Stop("default", "foo", 0, nil) + err = reaper.Stop("default", "foo", 0, nil) if err != nil && !test.expectError { t.Errorf("unexpected error: %v (%s)", err, test.test) } @@ -456,9 +703,6 @@ func TestSimpleStop(t *testing.T) { if test.expectError { t.Errorf("unexpected non-error: %v (%s)", err, test.test) } - if s != "foo stopped" { - t.Errorf("unexpected return: %s (%s)", s, test.test) - } } actions := fake.Actions() if len(test.actions) != len(actions) { diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/testing/types.generated.go b/vendor/k8s.io/kubernetes/pkg/kubectl/testing/types.generated.go index 99868deeb..b3dd3628d 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/testing/types.generated.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/testing/types.generated.go @@ -34,10 +34,18 @@ import ( ) const ( - codecSelferC_UTF81234 = 1 - codecSelferC_RAW1234 = 0 + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- codecSelferValueTypeArray1234 = 10 codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 ) var ( @@ -48,10 +56,10 @@ var ( type codecSelfer1234 struct{} func init() { - if codec1978.GenVersion != 4 { + if codec1978.GenVersion != 5 { _, file, _, _ := runtime.Caller(0) err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", - 4, codec1978.GenVersion, file) + 5, codec1978.GenVersion, file) panic(err) } if false { // reference the types, but skip this branch at build/run time @@ -80,168 +88,193 @@ func (x *TestStruct) CodecEncodeSelf(e *codec1978.Encoder) { var yyq2 [7]bool _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false - yyq2[0] = x.Kind != "" - yyq2[1] = x.APIVersion != "" - yyq2[2] = true + yyq2[0] = true + yyq2[5] = x.Kind != "" + yyq2[6] = x.APIVersion != "" + var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(7) } else { - var yynn2 int = 4 + yynn2 = 4 for _, b := range yyq2 { if b { yynn2++ } } r.EncodeMapStart(yynn2) + yynn2 = 0 } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[0] { - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2 || yy2arr2 { - if yyq2[1] { - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2 || yy2arr2 { - if yyq2[2] { - yy10 := &x.ObjectMeta - yy10.CodecEncodeSelf(e) + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { r.EncodeNil() } } else { - if yyq2[2] { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy11 := &x.ObjectMeta - yy11.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } } if yyr2 || yy2arr2 { - yym13 := z.EncBinary() - _ = yym13 + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym9 := z.EncBinary() + _ = yym9 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Key)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("Key")) - yym14 := z.EncBinary() - _ = yym14 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeString(codecSelferC_UTF81234, string(x.Key)) } } if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) if x.Map == nil { r.EncodeNil() + } else { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + z.F.EncMapStringIntV(x.Map, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("Map")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Map == nil { + r.EncodeNil() + } else { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + z.F.EncMapStringIntV(x.Map, false, e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.StringList == nil { + r.EncodeNil() + } else { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + z.F.EncSliceStringV(x.StringList, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("StringList")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.StringList == nil { + r.EncodeNil() } else { yym16 := z.EncBinary() _ = yym16 if false { } else { - z.F.EncMapStringIntV(x.Map, false, e) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("Map")) - if x.Map == nil { - r.EncodeNil() - } else { - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - z.F.EncMapStringIntV(x.Map, false, e) + z.F.EncSliceStringV(x.StringList, false, e) } } } if yyr2 || yy2arr2 { - if x.StringList == nil { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.IntList == nil { + r.EncodeNil() + } else { + yym18 := z.EncBinary() + _ = yym18 + if false { + } else { + z.F.EncSliceIntV(x.IntList, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("IntList")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.IntList == nil { r.EncodeNil() } else { yym19 := z.EncBinary() _ = yym19 if false { } else { - z.F.EncSliceStringV(x.StringList, false, e) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("StringList")) - if x.StringList == nil { - r.EncodeNil() - } else { - yym20 := z.EncBinary() - _ = yym20 - if false { - } else { - z.F.EncSliceStringV(x.StringList, false, e) + z.F.EncSliceIntV(x.IntList, false, e) } } } if yyr2 || yy2arr2 { - if x.IntList == nil { - r.EncodeNil() + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[5] { + yym21 := z.EncBinary() + _ = yym21 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) yym22 := z.EncBinary() _ = yym22 if false { } else { - z.F.EncSliceIntV(x.IntList, false, e) - } - } - } else { - r.EncodeString(codecSelferC_UTF81234, string("IntList")) - if x.IntList == nil { - r.EncodeNil() - } else { - yym23 := z.EncBinary() - _ = yym23 - if false { - } else { - z.F.EncSliceIntV(x.IntList, false, e) + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) } } } - if yysep2 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[6] { + yym24 := z.EncBinary() + _ = yym24 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -251,24 +284,25 @@ func (x *TestStruct) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym24 := z.DecBinary() - _ = yym24 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl25 := r.ReadMapStart() - if yyl25 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl25, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl25 := r.ReadArrayStart() - if yyl25 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl25, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -280,12 +314,12 @@ func (x *TestStruct) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys26Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys26Slc - var yyhl26 bool = l >= 0 - for yyj26 := 0; ; yyj26++ { - if yyhl26 { - if yyj26 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -293,9 +327,60 @@ func (x *TestStruct) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys26Slc = r.DecodeBytes(yys26Slc, true, true) - yys26 := string(yys26Slc) - switch yys26 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "Key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + x.Key = string(r.DecodeString()) + } + case "Map": + if r.TryDecodeAsNil() { + x.Map = nil + } else { + yyv6 := &x.Map + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + z.F.DecMapStringIntX(yyv6, false, d) + } + } + case "StringList": + if r.TryDecodeAsNil() { + x.StringList = nil + } else { + yyv8 := &x.StringList + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + z.F.DecSliceStringX(yyv8, false, d) + } + } + case "IntList": + if r.TryDecodeAsNil() { + x.IntList = nil + } else { + yyv10 := &x.IntList + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + z.F.DecSliceIntX(yyv10, false, d) + } + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -308,206 +393,163 @@ func (x *TestStruct) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv29 := &x.ObjectMeta - yyv29.CodecDecodeSelf(d) - } - case "Key": - if r.TryDecodeAsNil() { - x.Key = "" - } else { - x.Key = string(r.DecodeString()) - } - case "Map": - if r.TryDecodeAsNil() { - x.Map = nil - } else { - yyv31 := &x.Map - yym32 := z.DecBinary() - _ = yym32 - if false { - } else { - z.F.DecMapStringIntX(yyv31, false, d) - } - } - case "StringList": - if r.TryDecodeAsNil() { - x.StringList = nil - } else { - yyv33 := &x.StringList - yym34 := z.DecBinary() - _ = yym34 - if false { - } else { - z.F.DecSliceStringX(yyv33, false, d) - } - } - case "IntList": - if r.TryDecodeAsNil() { - x.IntList = nil - } else { - yyv35 := &x.IntList - yym36 := z.DecBinary() - _ = yym36 - if false { - } else { - z.F.DecSliceIntX(yyv35, false, d) - } - } default: - z.DecStructFieldNotFound(-1, yys26) - } // end switch yys26 - } // end for yyj26 - if !yyhl26 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *TestStruct) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj37 int - var yyb37 bool - var yyhl37 bool = l >= 0 - yyj37++ - if yyhl37 { - yyb37 = yyj37 > l + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb37 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb37 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj37++ - if yyhl37 { - yyb37 = yyj37 > l - } else { - yyb37 = r.CheckBreak() - } - if yyb37 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj37++ - if yyhl37 { - yyb37 = yyj37 > l - } else { - yyb37 = r.CheckBreak() - } - if yyb37 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = pkg2_api.ObjectMeta{} } else { - yyv40 := &x.ObjectMeta - yyv40.CodecDecodeSelf(d) + yyv15 := &x.ObjectMeta + yyv15.CodecDecodeSelf(d) } - yyj37++ - if yyhl37 { - yyb37 = yyj37 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb37 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb37 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Key = "" } else { x.Key = string(r.DecodeString()) } - yyj37++ - if yyhl37 { - yyb37 = yyj37 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb37 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb37 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Map = nil } else { - yyv42 := &x.Map - yym43 := z.DecBinary() - _ = yym43 + yyv17 := &x.Map + yym18 := z.DecBinary() + _ = yym18 if false { } else { - z.F.DecMapStringIntX(yyv42, false, d) + z.F.DecMapStringIntX(yyv17, false, d) } } - yyj37++ - if yyhl37 { - yyb37 = yyj37 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb37 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb37 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.StringList = nil } else { - yyv44 := &x.StringList - yym45 := z.DecBinary() - _ = yym45 + yyv19 := &x.StringList + yym20 := z.DecBinary() + _ = yym20 if false { } else { - z.F.DecSliceStringX(yyv44, false, d) + z.F.DecSliceStringX(yyv19, false, d) } } - yyj37++ - if yyhl37 { - yyb37 = yyj37 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb37 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb37 { - r.ReadEnd() + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.IntList = nil } else { - yyv46 := &x.IntList - yym47 := z.DecBinary() - _ = yym47 + yyv21 := &x.IntList + yym22 := z.DecBinary() + _ = yym22 if false { } else { - z.F.DecSliceIntX(yyv46, false, d) + z.F.DecSliceIntX(yyv21, false, d) } } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj37++ - if yyhl37 { - yyb37 = yyj37 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb37 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb37 { + if yyb14 { break } - z.DecStructFieldNotFound(yyj37-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj14-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/testing/types.go b/vendor/k8s.io/kubernetes/pkg/kubectl/testing/types.go index 8eefd437c..2fbc2ed45 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/testing/types.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/testing/types.go @@ -30,4 +30,4 @@ type TestStruct struct { IntList []int `json:"IntList"` } -func (ts *TestStruct) IsAnAPIObject() {} +func (obj *TestStruct) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/version.go b/vendor/k8s.io/kubernetes/pkg/kubectl/version.go index 89e68ae51..4c39b3c99 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/version.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/version.go @@ -26,7 +26,7 @@ import ( ) func GetServerVersion(w io.Writer, kubeClient client.Interface) { - serverVersion, err := kubeClient.ServerVersion() + serverVersion, err := kubeClient.Discovery().ServerVersion() if err != nil { fmt.Printf("Couldn't read server version from server: %v\n", err) os.Exit(1) diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/qos/doc.go b/vendor/k8s.io/kubernetes/pkg/kubelet/qos/doc.go new file mode 100644 index 000000000..04a25c907 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/qos/doc.go @@ -0,0 +1,25 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// package qos contains helper functions for quality of service. +// For each resource (memory, CPU) Kubelet supports three classes of containers. +// Memory guaranteed containers will receive the highest priority and will get all the resources +// they need. +// Burstable containers will be guaranteed their request and can “burst” and use more resources +// when available. +// Best-Effort containers, which don’t specify a request, can use resources only if not being used +// by other pods. +package qos diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy.go b/vendor/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy.go new file mode 100644 index 000000000..b785ab676 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy.go @@ -0,0 +1,75 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package qos + +import ( + "k8s.io/kubernetes/pkg/api" +) + +const ( + PodInfraOOMAdj int = -999 + KubeletOOMScoreAdj int = -999 + KubeProxyOOMScoreAdj int = -999 +) + +// isMemoryBestEffort returns true if the container's memory requirements are best-effort. +func isMemoryBestEffort(container *api.Container) bool { + // A container is memory best-effort if its memory request is unspecified or 0. + // If a request is specified, then the user expects some kind of resource guarantee. + return container.Resources.Requests.Memory().Value() == 0 +} + +// isMemoryGuaranteed returns true if the container's memory requirements are Guaranteed. +func isMemoryGuaranteed(container *api.Container) bool { + // A container is memory guaranteed if its memory request == memory limit. + // If memory request == memory limit, the user is very confident of resource consumption. + memoryRequest := container.Resources.Requests.Memory() + memoryLimit := container.Resources.Limits.Memory() + return (*memoryRequest).Cmp(*memoryLimit) == 0 && memoryRequest.Value() != 0 +} + +// GetContainerOOMAdjust returns the amount by which the OOM score of all processes in the +// container should be adjusted. The OOM score of a process is the percentage of memory it consumes +// multiplied by 10 (barring exceptional cases) + a configurable quantity which is between -1000 +// and 1000. Containers with higher OOM scores are killed if the system runs out of memory. +// See https://lwn.net/Articles/391222/ for more information. +func GetContainerOOMScoreAdjust(container *api.Container, memoryCapacity int64) int { + if isMemoryGuaranteed(container) { + // Memory guaranteed containers should be the last to get killed. + return -999 + } else if isMemoryBestEffort(container) { + // Memory best-effort containers should be the first to be killed. + return 1000 + } else { + // Burstable containers are a middle tier, between Guaranteed and Best-Effort. Ideally, + // we want to protect Burstable containers that consume less memory than requested. + // The formula below is a heuristic. A container requesting for 10% of a system's + // memory will have an oom score adjust of 900. If a process in container Y + // uses over 10% of memory, its OOM score will be 1000. The idea is that containers + // which use more than their request will have an OOM score of 1000 and will be prime + // targets for OOM kills. + // Note that this is a heuristic, it won't work if a container has many small processes. + memoryRequest := container.Resources.Requests.Memory().Value() + oomScoreAdjust := 1000 - (1000*memoryRequest)/memoryCapacity + // A memory guaranteed container using 100% of memory can have an OOM score of 1. Ensure + // that memory burstable containers have a higher OOM score. + if oomScoreAdjust < 2 { + return 2 + } + return int(oomScoreAdjust) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy_test.go b/vendor/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy_test.go new file mode 100644 index 000000000..27af3fd11 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/qos/memory_policy_test.go @@ -0,0 +1,187 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package qos + +import ( + "strconv" + "testing" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/resource" +) + +const ( + standardMemoryAmount = 8000000000 +) + +var ( + zeroRequestMemoryBestEffort = api.Container{ + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceCPU): resource.MustParse("5m"), + api.ResourceName(api.ResourceMemory): resource.MustParse("0G"), + }, + Limits: api.ResourceList{ + api.ResourceName(api.ResourceCPU): resource.MustParse("5m"), + api.ResourceName(api.ResourceMemory): resource.MustParse("10G"), + }, + }, + } + + edgeMemoryBestEffort = api.Container{ + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceMemory): resource.MustParse("0G"), + }, + Limits: api.ResourceList{ + api.ResourceName(api.ResourceMemory): resource.MustParse("0G"), + }, + }, + } + + noRequestMemoryBestEffort = api.Container{ + Resources: api.ResourceRequirements{ + Limits: api.ResourceList{ + api.ResourceName(api.ResourceMemory): resource.MustParse("10G"), + }, + }, + } + + noLimitMemoryBestEffort = api.Container{} + + memoryGuaranteed = api.Container{ + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceMemory): resource.MustParse("10G"), + }, + Limits: api.ResourceList{ + api.ResourceName(api.ResourceCPU): resource.MustParse("5m"), + api.ResourceName(api.ResourceMemory): resource.MustParse("10G"), + }, + }, + } + + memoryBurstable = api.Container{ + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceMemory): resource.MustParse(strconv.Itoa(standardMemoryAmount / 2)), + }, + Limits: api.ResourceList{ + api.ResourceName(api.ResourceMemory): resource.MustParse("10G"), + }, + }, + } + + memoryBurstableNoLimit = api.Container{ + Resources: api.ResourceRequirements{ + Requests: api.ResourceList{ + api.ResourceName(api.ResourceMemory): resource.MustParse(strconv.Itoa(standardMemoryAmount - 1)), + }, + }, + } +) + +func TestIsMemoryBestEffort(t *testing.T) { + validCases := []api.Container{zeroRequestMemoryBestEffort, noRequestMemoryBestEffort, noLimitMemoryBestEffort, edgeMemoryBestEffort} + for _, container := range validCases { + if !isMemoryBestEffort(&container) { + t.Errorf("container %+v is memory best-effort", container) + } + } + invalidCases := []api.Container{memoryGuaranteed, memoryBurstable} + for _, container := range invalidCases { + if isMemoryBestEffort(&container) { + t.Errorf("container %+v is not memory best-effort", container) + } + } +} + +func TestIsMemoryGuaranteed(t *testing.T) { + validCases := []api.Container{memoryGuaranteed} + for _, container := range validCases { + if !isMemoryGuaranteed(&container) { + t.Errorf("container %+v is memory guaranteed", container) + } + } + invalidCases := []api.Container{zeroRequestMemoryBestEffort, noRequestMemoryBestEffort, noLimitMemoryBestEffort, edgeMemoryBestEffort, memoryBurstable} + for _, container := range invalidCases { + if isMemoryGuaranteed(&container) { + t.Errorf("container %+v is not memory guaranteed", container) + } + } +} + +type oomTest struct { + container *api.Container + memoryCapacity int64 + lowOOMScoreAdj int // The max oom_score_adj score the container should be assigned. + highOOMScoreAdj int // The min oom_score_adj score the container should be assigned. +} + +func TestGetContainerOOMScoreAdjust(t *testing.T) { + + oomTests := []oomTest{ + { + container: &zeroRequestMemoryBestEffort, + memoryCapacity: 4000000000, + lowOOMScoreAdj: 1000, + highOOMScoreAdj: 1000, + }, + { + container: &edgeMemoryBestEffort, + memoryCapacity: 8000000000, + lowOOMScoreAdj: 1000, + highOOMScoreAdj: 1000, + }, + { + container: &noRequestMemoryBestEffort, + memoryCapacity: 7230457451, + lowOOMScoreAdj: 1000, + highOOMScoreAdj: 1000, + }, + { + container: &noLimitMemoryBestEffort, + memoryCapacity: 4000000000, + lowOOMScoreAdj: 1000, + highOOMScoreAdj: 1000, + }, + { + container: &memoryGuaranteed, + memoryCapacity: 123456789, + lowOOMScoreAdj: -999, + highOOMScoreAdj: -999, + }, + { + container: &memoryBurstable, + memoryCapacity: standardMemoryAmount, + lowOOMScoreAdj: 495, + highOOMScoreAdj: 505, + }, + { + container: &memoryBurstableNoLimit, + memoryCapacity: standardMemoryAmount, + lowOOMScoreAdj: 2, + highOOMScoreAdj: 2, + }, + } + for _, test := range oomTests { + oomScoreAdj := GetContainerOOMScoreAdjust(test.container, test.memoryCapacity) + if oomScoreAdj < test.lowOOMScoreAdj || oomScoreAdj > test.highOOMScoreAdj { + t.Errorf("oom_score_adj should be between %d and %d, but was %d", test.lowOOMScoreAdj, test.highOOMScoreAdj, oomScoreAdj) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go b/vendor/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go index 165af3fc1..af415c2ac 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/qos/util/qos.go @@ -62,15 +62,16 @@ func GetQoS(container *api.Container) map[api.ResourceName]string { return resourceToQoS } -// supportedComputeResources returns a list of supported compute resources -func supportedComputeResources() []api.ResourceName { - return []api.ResourceName{api.ResourceCPU, api.ResourceMemory} +// supportedComputeResources is the list of supported compute resources +var supportedComputeResources = []api.ResourceName{ + api.ResourceCPU, + api.ResourceMemory, } // allResources returns a set of all possible resources whose mapped key value is true if present on the container func allResources(container *api.Container) map[api.ResourceName]bool { resources := map[api.ResourceName]bool{} - for _, resource := range supportedComputeResources() { + for _, resource := range supportedComputeResources { resources[resource] = false } for resource := range container.Resources.Requests { diff --git a/vendor/k8s.io/kubernetes/pkg/labels/selector.go b/vendor/k8s.io/kubernetes/pkg/labels/selector.go index 8f6a3b5e6..520377486 100644 --- a/vendor/k8s.io/kubernetes/pkg/labels/selector.go +++ b/vendor/k8s.io/kubernetes/pkg/labels/selector.go @@ -20,9 +20,10 @@ import ( "bytes" "fmt" "sort" + "strconv" "strings" - "k8s.io/kubernetes/pkg/util/fielderrors" + "github.com/golang/glog" "k8s.io/kubernetes/pkg/util/sets" "k8s.io/kubernetes/pkg/util/validation" ) @@ -38,21 +39,21 @@ type Selector interface { // String returns a human readable string that represents this selector. String() string - // Add add a specific requirement for the selector - Add(key string, operator Operator, values []string) Selector + // Add adds requirements to the Selector + Add(r ...Requirement) Selector } // Everything returns a selector that matches all labels. func Everything() Selector { - return LabelSelector{} + return internalSelector{} } type nothingSelector struct{} -func (n nothingSelector) Matches(_ Labels) bool { return false } -func (n nothingSelector) Empty() bool { return false } -func (n nothingSelector) String() string { return "" } -func (n nothingSelector) Add(_ string, _ Operator, _ []string) Selector { return n } +func (n nothingSelector) Matches(_ Labels) bool { return false } +func (n nothingSelector) Empty() bool { return false } +func (n nothingSelector) String() string { return "" } +func (n nothingSelector) Add(_ ...Requirement) Selector { return n } // Nothing returns a selector that matches no labels func Nothing() Selector { @@ -71,12 +72,17 @@ const ( NotEqualsOperator Operator = "!=" NotInOperator Operator = "notin" ExistsOperator Operator = "exists" + GreaterThanOperator Operator = "Gt" + LessThanOperator Operator = "Lt" ) -//LabelSelector is a list of Requirements. -type LabelSelector []Requirement +func NewSelector() Selector { + return internalSelector(nil) +} -// Sort by obtain determisitic parser +type internalSelector []Requirement + +// Sort by key to obtain determisitic parser type ByKey []Requirement func (a ByKey) Len() int { return len(a) } @@ -102,7 +108,8 @@ type Requirement struct { // (2) If the operator is In or NotIn, the values set must be non-empty. // (3) If the operator is Equals, DoubleEquals, or NotEquals, the values set must contain one value. // (4) If the operator is Exists or DoesNotExist, the value set must be empty. -// (5) The key is invalid due to its length, or sequence +// (5) If the operator is Gt or Lt, the values set must contain only one value. +// (6) The key is invalid due to its length, or sequence // of characters. See validateLabelKey for more details. // // The empty string is a valid value in the input values set. @@ -123,6 +130,15 @@ func NewRequirement(key string, op Operator, vals sets.String) (*Requirement, er if len(vals) != 0 { return nil, fmt.Errorf("values set must be empty for exists and does not exist") } + case GreaterThanOperator, LessThanOperator: + if len(vals) != 1 { + return nil, fmt.Errorf("for 'Gt', 'Lt' operators, exactly one value is required") + } + for val := range vals { + if _, err := strconv.ParseFloat(val, 64); err != nil { + return nil, fmt.Errorf("for 'Gt', 'Lt' operators, the value must be a number") + } + } default: return nil, fmt.Errorf("operator '%v' is not recognized", op) } @@ -160,6 +176,31 @@ func (r *Requirement) Matches(ls Labels) bool { return ls.Has(r.key) case DoesNotExistOperator: return !ls.Has(r.key) + case GreaterThanOperator, LessThanOperator: + if !ls.Has(r.key) { + return false + } + lsValue, err := strconv.ParseFloat(ls.Get(r.key), 64) + if err != nil { + glog.V(10).Infof("Parse float failed for value %+v in label %+v, %+v", ls.Get(r.key), ls, err) + return false + } + + // There should be only one strValue in r.strValues, and can be converted to a float number. + if len(r.strValues) != 1 { + glog.V(10).Infof("Invalid values count %+v of requirement %+v, for 'Gt', 'Lt' operators, exactly one value is required", len(r.strValues), r) + return false + } + + var rValue float64 + for strValue := range r.strValues { + rValue, err = strconv.ParseFloat(strValue, 64) + if err != nil { + glog.V(10).Infof("Parse float failed for value %+v in requirement %+v, for 'Gt', 'Lt' operators, the value must be a number", strValue, r) + return false + } + } + return (r.operator == GreaterThanOperator && lsValue > rValue) || (r.operator == LessThanOperator && lsValue < rValue) default: return false } @@ -179,8 +220,8 @@ func (r *Requirement) Values() sets.String { return ret } -// Return true if the LabelSelector doesn't restrict selection space -func (lsel LabelSelector) Empty() bool { +// Return true if the internalSelector doesn't restrict selection space +func (lsel internalSelector) Empty() bool { if lsel == nil { return true } @@ -208,6 +249,10 @@ func (r *Requirement) String() string { buffer.WriteString(" in ") case NotInOperator: buffer.WriteString(" notin ") + case GreaterThanOperator: + buffer.WriteString(">") + case LessThanOperator: + buffer.WriteString("<") case ExistsOperator, DoesNotExistOperator: return buffer.String() } @@ -229,24 +274,25 @@ func (r *Requirement) String() string { return buffer.String() } -// Add adds a requirement to the selector. It copies the current selector returning a new one -func (lsel LabelSelector) Add(key string, operator Operator, values []string) Selector { - var reqs []Requirement - for _, item := range lsel { - reqs = append(reqs, item) +// Add adds requirements to the selector. It copies the current selector returning a new one +func (lsel internalSelector) Add(reqs ...Requirement) Selector { + var sel internalSelector + for ix := range lsel { + sel = append(sel, lsel[ix]) } - if r, err := NewRequirement(key, operator, sets.NewString(values...)); err == nil { - reqs = append(reqs, *r) + for _, r := range reqs { + sel = append(sel, r) } - return LabelSelector(reqs) + sort.Sort(ByKey(sel)) + return sel } -// Matches for a LabelSelector returns true if all +// Matches for a internalSelector returns true if all // its Requirements match the input Labels. If any // Requirement does not match, false is returned. -func (lsel LabelSelector) Matches(l Labels) bool { - for _, req := range lsel { - if matches := req.Matches(l); !matches { +func (lsel internalSelector) Matches(l Labels) bool { + for ix := range lsel { + if matches := lsel[ix].Matches(l); !matches { return false } } @@ -254,11 +300,11 @@ func (lsel LabelSelector) Matches(l Labels) bool { } // String returns a comma-separated string of all -// the LabelSelector Requirements' human-readable strings. -func (lsel LabelSelector) String() string { +// the internalSelector Requirements' human-readable strings. +func (lsel internalSelector) String() string { var reqs []string - for _, req := range lsel { - reqs = append(reqs, req.String()) + for ix := range lsel { + reqs = append(reqs, lsel[ix].String()) } return strings.Join(reqs, ",") } @@ -274,8 +320,10 @@ const ( DoesNotExistToken DoubleEqualsToken EqualsToken + GreaterThanToken IdentifierToken // to represent keys and values InToken + LessThanToken NotEqualsToken NotInToken OpenParToken @@ -289,7 +337,9 @@ var string2token = map[string]Token{ "!": DoesNotExistToken, "==": DoubleEqualsToken, "=": EqualsToken, + ">": GreaterThanToken, "in": InToken, + "<": LessThanToken, "!=": NotEqualsToken, "notin": NotInToken, "(": OpenParToken, @@ -309,7 +359,7 @@ func isWhitespace(ch byte) bool { // isSpecialSymbol detect if the character ch can be an operator func isSpecialSymbol(ch byte) bool { switch ch { - case '=', '!', '(', ')', ',': + case '=', '!', '(', ')', ',', '>', '<': return true } return false @@ -474,10 +524,10 @@ func (p *Parser) scan() { // parse runs the left recursive descending algorithm // on input string. It returns a list of Requirement objects. -func (p *Parser) parse() ([]Requirement, error) { +func (p *Parser) parse() (internalSelector, error) { p.scan() // init scannedItems - var requirements []Requirement + var requirements internalSelector for { tok, lit := p.lookahead(Values) switch tok { @@ -523,7 +573,7 @@ func (p *Parser) parseRequirement() (*Requirement, error) { switch operator { case InOperator, NotInOperator: values, err = p.parseValues() - case EqualsOperator, DoubleEqualsOperator, NotEqualsOperator: + case EqualsOperator, DoubleEqualsOperator, NotEqualsOperator, GreaterThanOperator, LessThanOperator: values, err = p.parseExactValue() } if err != nil { @@ -570,6 +620,10 @@ func (p *Parser) parseOperator() (op Operator, err error) { op = EqualsOperator case DoubleEqualsToken: op = DoubleEqualsOperator + case GreaterThanToken: + op = GreaterThanOperator + case LessThanToken: + op = LessThanOperator case NotInToken: op = NotInOperator case NotEqualsToken: @@ -672,8 +726,8 @@ func (p *Parser) parseExactValue() (sets.String, error) { // ::= "(" ")" // ::= VALUE | VALUE "," // ::= ["="|"=="|"!="] VALUE -// KEY is a sequence of one or more characters following [ DNS_SUBDOMAIN "/" ] DNS_LABEL -// VALUE is a sequence of zero or more characters "([A-Za-z0-9_-\.])". Max length is 64 character. +// KEY is a sequence of one or more characters following [ DNS_SUBDOMAIN "/" ] DNS_LABEL. Max length is 63 characters. +// VALUE is a sequence of zero or more characters "([A-Za-z0-9_-\.])". Max length is 63 characters. // Delimiter is white space: (' ', '\t') // Example of valid syntax: // "x in (foo,,baz),y,z notin ()" @@ -693,23 +747,24 @@ func Parse(selector string) (Selector, error) { items, error := p.parse() if error == nil { sort.Sort(ByKey(items)) // sort to grant determistic parsing - return LabelSelector(items), error + return internalSelector(items), error } return nil, error } -const qualifiedNameErrorMsg string = "must match regex [" + validation.DNS1123SubdomainFmt + " / ] " + validation.DNS1123LabelFmt +var qualifiedNameErrorMsg string = fmt.Sprintf(`must be a qualified name (at most %d characters, matching regex %s), with an optional DNS subdomain prefix (at most %d characters, matching regex %s) and slash (/): e.g. "MyName" or "example.com/MyName"`, validation.QualifiedNameMaxLength, validation.QualifiedNameFmt, validation.DNS1123SubdomainMaxLength, validation.DNS1123SubdomainFmt) +var labelValueErrorMsg string = fmt.Sprintf(`must have at most %d characters, matching regex %s: e.g. "MyValue" or ""`, validation.LabelValueMaxLength, validation.LabelValueFmt) func validateLabelKey(k string) error { if !validation.IsQualifiedName(k) { - return fielderrors.NewFieldInvalid("label key", k, qualifiedNameErrorMsg) + return fmt.Errorf("invalid label key: %s", qualifiedNameErrorMsg) } return nil } func validateLabelValue(v string) error { if !validation.IsValidLabelValue(v) { - return fielderrors.NewFieldInvalid("label value", v, qualifiedNameErrorMsg) + return fmt.Errorf("invalid label value: %s", labelValueErrorMsg) } return nil } @@ -718,16 +773,18 @@ func validateLabelValue(v string) error { // nil and empty Sets are considered equivalent to Everything(). func SelectorFromSet(ls Set) Selector { if ls == nil { - return LabelSelector{} + return internalSelector{} } - var requirements []Requirement + var requirements internalSelector for label, value := range ls { if r, err := NewRequirement(label, EqualsOperator, sets.NewString(value)); err != nil { //TODO: double check errors when input comes from serialization? - return LabelSelector{} + return internalSelector{} } else { requirements = append(requirements, *r) } } - return LabelSelector(requirements) + // sort to have deterministic string representation + sort.Sort(ByKey(requirements)) + return internalSelector(requirements) } diff --git a/vendor/k8s.io/kubernetes/pkg/labels/selector_test.go b/vendor/k8s.io/kubernetes/pkg/labels/selector_test.go index 32269c8f2..5fbb1fc76 100644 --- a/vendor/k8s.io/kubernetes/pkg/labels/selector_test.go +++ b/vendor/k8s.io/kubernetes/pkg/labels/selector_test.go @@ -34,11 +34,14 @@ func TestSelectorParse(t *testing.T) { "x=,z= ", "x= ,z= ", "!x", + "x>1.1", + "x>1.1,z<5.3", } testBadStrings := []string{ "x=a||y=b", "x==a==b", "!x=a", + "x1.1", Set{"x": "1.2"}) + expectMatch(t, "x<1.1", Set{"x": "0.8"}) expectNoMatch(t, "x=z", Set{}) expectNoMatch(t, "x=y", Set{"x": "z"}) expectNoMatch(t, "x=y,z=w", Set{"x": "w", "z": "w"}) expectNoMatch(t, "x!=y,z!=w", Set{"x": "z", "z": "w"}) expectNoMatch(t, "x", Set{"y": "z"}) expectNoMatch(t, "!x", Set{"x": "z"}) + expectNoMatch(t, "x>1.1", Set{"x": "0.8"}) + expectNoMatch(t, "x<1.1", Set{"x": "1.1"}) labelset := Set{ "foo": "bar", @@ -168,8 +175,8 @@ func TestSetIsEmpty(t *testing.T) { if !(Set{}).AsSelector().Empty() { t.Errorf("Empty set should be empty") } - if !(LabelSelector(nil)).Empty() { - t.Errorf("Nil LabelSelector should be empty") + if !(NewSelector()).Empty() { + t.Errorf("Nil Selector should be empty") } } @@ -184,6 +191,8 @@ func TestLexer(t *testing.T) { {"in", InToken}, {"=", EqualsToken}, {"==", DoubleEqualsToken}, + {">", GreaterThanToken}, + {"<", LessThanToken}, //Note that Lex returns the longest valid token found {"!", DoesNotExistToken}, {"!=", NotEqualsToken}, @@ -226,6 +235,8 @@ func TestLexerSequence(t *testing.T) { {"()", []Token{OpenParToken, ClosedParToken}}, {"x in (),y", []Token{IdentifierToken, InToken, OpenParToken, ClosedParToken, CommaToken, IdentifierToken}}, {"== != (), = notin", []Token{DoubleEqualsToken, NotEqualsToken, OpenParToken, ClosedParToken, CommaToken, EqualsToken, NotInToken}}, + {"key>1.1", []Token{IdentifierToken, GreaterThanToken, IdentifierToken}}, + {"key<0.8", []Token{IdentifierToken, LessThanToken, IdentifierToken}}, } for _, v := range testcases { var literals []string @@ -263,6 +274,8 @@ func TestParserLookahead(t *testing.T) { {"", []Token{EndOfStringToken}}, {"x in (),y", []Token{IdentifierToken, InToken, OpenParToken, ClosedParToken, CommaToken, IdentifierToken, EndOfStringToken}}, {"== != (), = notin", []Token{DoubleEqualsToken, NotEqualsToken, OpenParToken, ClosedParToken, CommaToken, EqualsToken, NotInToken, EndOfStringToken}}, + {"key>1.1", []Token{IdentifierToken, GreaterThanToken, IdentifierToken, EndOfStringToken}}, + {"key<0.8", []Token{IdentifierToken, LessThanToken, IdentifierToken, EndOfStringToken}}, } for _, v := range testcases { p := &Parser{l: &Lexer{s: v.s, pos: 0}, position: 0} @@ -299,6 +312,10 @@ func TestRequirementConstructor(t *testing.T) { {"x", DoesNotExistOperator, nil, true}, {"1foo", InOperator, sets.NewString("bar"), true}, {"1234", InOperator, sets.NewString("bar"), true}, + {"y", GreaterThanOperator, sets.NewString("1.1"), true}, + {"z", LessThanOperator, sets.NewString("5.3"), true}, + {"foo", GreaterThanOperator, sets.NewString("bar"), false}, + {"barz", LessThanOperator, sets.NewString("blah"), false}, {strings.Repeat("a", 254), ExistsOperator, nil, false}, //breaks DNS rule that len(key) <= 253 } for _, rc := range requirementConstructorTests { @@ -313,35 +330,41 @@ func TestRequirementConstructor(t *testing.T) { func TestToString(t *testing.T) { var req Requirement toStringTests := []struct { - In *LabelSelector + In *internalSelector Out string Valid bool }{ - {&LabelSelector{ + + {&internalSelector{ getRequirement("x", InOperator, sets.NewString("abc", "def"), t), getRequirement("y", NotInOperator, sets.NewString("jkl"), t), getRequirement("z", ExistsOperator, nil, t)}, "x in (abc,def),y notin (jkl),z", true}, - {&LabelSelector{ + {&internalSelector{ getRequirement("x", NotInOperator, sets.NewString("abc", "def"), t), getRequirement("y", NotEqualsOperator, sets.NewString("jkl"), t), getRequirement("z", DoesNotExistOperator, nil, t)}, "x notin (abc,def),y!=jkl,!z", true}, - {&LabelSelector{ + {&internalSelector{ getRequirement("x", InOperator, sets.NewString("abc", "def"), t), req}, // adding empty req for the trailing ',' "x in (abc,def),", false}, - {&LabelSelector{ + {&internalSelector{ getRequirement("x", NotInOperator, sets.NewString("abc"), t), getRequirement("y", InOperator, sets.NewString("jkl", "mno"), t), getRequirement("z", NotInOperator, sets.NewString(""), t)}, "x notin (abc),y in (jkl,mno),z notin ()", true}, - {&LabelSelector{ + {&internalSelector{ getRequirement("x", EqualsOperator, sets.NewString("abc"), t), getRequirement("y", DoubleEqualsOperator, sets.NewString("jkl"), t), getRequirement("z", NotEqualsOperator, sets.NewString("a"), t), getRequirement("z", ExistsOperator, nil, t)}, "x=abc,y==jkl,z!=a,z", true}, + {&internalSelector{ + getRequirement("x", GreaterThanOperator, sets.NewString("2.4"), t), + getRequirement("y", LessThanOperator, sets.NewString("7.1"), t), + getRequirement("z", ExistsOperator, nil, t)}, + "x>2.4,y<7.1,z", true}, } for _, ts := range toStringTests { if out := ts.In.String(); out == "" && ts.Valid { @@ -352,39 +375,45 @@ func TestToString(t *testing.T) { } } -func TestRequirementLabelSelectorMatching(t *testing.T) { +func TestRequirementSelectorMatching(t *testing.T) { var req Requirement labelSelectorMatchingTests := []struct { Set Set - Sel *LabelSelector + Sel Selector Match bool }{ - {Set{"x": "foo", "y": "baz"}, &LabelSelector{ + {Set{"x": "foo", "y": "baz"}, &internalSelector{ req, }, false}, - {Set{"x": "foo", "y": "baz"}, &LabelSelector{ + {Set{"x": "foo", "y": "baz"}, &internalSelector{ getRequirement("x", InOperator, sets.NewString("foo"), t), getRequirement("y", NotInOperator, sets.NewString("alpha"), t), }, true}, - {Set{"x": "foo", "y": "baz"}, &LabelSelector{ + {Set{"x": "foo", "y": "baz"}, &internalSelector{ getRequirement("x", InOperator, sets.NewString("foo"), t), getRequirement("y", InOperator, sets.NewString("alpha"), t), }, false}, - {Set{"y": ""}, &LabelSelector{ + {Set{"y": ""}, &internalSelector{ getRequirement("x", NotInOperator, sets.NewString(""), t), getRequirement("y", ExistsOperator, nil, t), }, true}, - {Set{"y": ""}, &LabelSelector{ + {Set{"y": ""}, &internalSelector{ getRequirement("x", DoesNotExistOperator, nil, t), getRequirement("y", ExistsOperator, nil, t), }, true}, - {Set{"y": ""}, &LabelSelector{ + {Set{"y": ""}, &internalSelector{ getRequirement("x", NotInOperator, sets.NewString(""), t), getRequirement("y", DoesNotExistOperator, nil, t), }, false}, - {Set{"y": "baz"}, &LabelSelector{ + {Set{"y": "baz"}, &internalSelector{ getRequirement("x", InOperator, sets.NewString(""), t), }, false}, + {Set{"z": "1.2"}, &internalSelector{ + getRequirement("z", GreaterThanOperator, sets.NewString("1.0"), t), + }, true}, + {Set{"z": "v1.2"}, &internalSelector{ + getRequirement("z", GreaterThanOperator, sets.NewString("1.0"), t), + }, false}, } for _, lsm := range labelSelectorMatchingTests { if match := lsm.Sel.Matches(lsm.Set); match != lsm.Match { @@ -400,75 +429,81 @@ func TestSetSelectorParser(t *testing.T) { Match bool Valid bool }{ - {"", LabelSelector(nil), true, true}, - {"\rx", LabelSelector{ + {"", NewSelector(), true, true}, + {"\rx", internalSelector{ getRequirement("x", ExistsOperator, nil, t), }, true, true}, - {"this-is-a-dns.domain.com/key-with-dash", LabelSelector{ + {"this-is-a-dns.domain.com/key-with-dash", internalSelector{ getRequirement("this-is-a-dns.domain.com/key-with-dash", ExistsOperator, nil, t), }, true, true}, - {"this-is-another-dns.domain.com/key-with-dash in (so,what)", LabelSelector{ + {"this-is-another-dns.domain.com/key-with-dash in (so,what)", internalSelector{ getRequirement("this-is-another-dns.domain.com/key-with-dash", InOperator, sets.NewString("so", "what"), t), }, true, true}, - {"0.1.2.domain/99 notin (10.10.100.1, tick.tack.clock)", LabelSelector{ + {"0.1.2.domain/99 notin (10.10.100.1, tick.tack.clock)", internalSelector{ getRequirement("0.1.2.domain/99", NotInOperator, sets.NewString("10.10.100.1", "tick.tack.clock"), t), }, true, true}, - {"foo in (abc)", LabelSelector{ + {"foo in (abc)", internalSelector{ getRequirement("foo", InOperator, sets.NewString("abc"), t), }, true, true}, - {"x notin\n (abc)", LabelSelector{ + {"x notin\n (abc)", internalSelector{ getRequirement("x", NotInOperator, sets.NewString("abc"), t), }, true, true}, - {"x notin \t (abc,def)", LabelSelector{ + {"x notin \t (abc,def)", internalSelector{ getRequirement("x", NotInOperator, sets.NewString("abc", "def"), t), }, true, true}, - {"x in (abc,def)", LabelSelector{ + {"x in (abc,def)", internalSelector{ getRequirement("x", InOperator, sets.NewString("abc", "def"), t), }, true, true}, - {"x in (abc,)", LabelSelector{ + {"x in (abc,)", internalSelector{ getRequirement("x", InOperator, sets.NewString("abc", ""), t), }, true, true}, - {"x in ()", LabelSelector{ + {"x in ()", internalSelector{ getRequirement("x", InOperator, sets.NewString(""), t), }, true, true}, - {"x notin (abc,,def),bar,z in (),w", LabelSelector{ + {"x notin (abc,,def),bar,z in (),w", internalSelector{ getRequirement("bar", ExistsOperator, nil, t), getRequirement("w", ExistsOperator, nil, t), getRequirement("x", NotInOperator, sets.NewString("abc", "", "def"), t), getRequirement("z", InOperator, sets.NewString(""), t), }, true, true}, - {"x,y in (a)", LabelSelector{ + {"x,y in (a)", internalSelector{ getRequirement("y", InOperator, sets.NewString("a"), t), getRequirement("x", ExistsOperator, nil, t), }, false, true}, - {"x=a", LabelSelector{ + {"x=a", internalSelector{ getRequirement("x", EqualsOperator, sets.NewString("a"), t), }, true, true}, - {"x=a,y!=b", LabelSelector{ + {"x>1.1", internalSelector{ + getRequirement("x", GreaterThanOperator, sets.NewString("1.1"), t), + }, true, true}, + {"x<7.1", internalSelector{ + getRequirement("x", LessThanOperator, sets.NewString("7.1"), t), + }, true, true}, + {"x=a,y!=b", internalSelector{ getRequirement("x", EqualsOperator, sets.NewString("a"), t), getRequirement("y", NotEqualsOperator, sets.NewString("b"), t), }, true, true}, - {"x=a,y!=b,z in (h,i,j)", LabelSelector{ + {"x=a,y!=b,z in (h,i,j)", internalSelector{ getRequirement("x", EqualsOperator, sets.NewString("a"), t), getRequirement("y", NotEqualsOperator, sets.NewString("b"), t), getRequirement("z", InOperator, sets.NewString("h", "i", "j"), t), }, true, true}, - {"x=a||y=b", LabelSelector{}, false, false}, + {"x=a||y=b", internalSelector{}, false, false}, {"x,,y", nil, true, false}, {",x,y", nil, true, false}, {"x nott in (y)", nil, true, false}, - {"x notin ( )", LabelSelector{ + {"x notin ( )", internalSelector{ getRequirement("x", NotInOperator, sets.NewString(""), t), }, true, true}, - {"x notin (, a)", LabelSelector{ + {"x notin (, a)", internalSelector{ getRequirement("x", NotInOperator, sets.NewString("", "a"), t), }, true, true}, {"a in (xyz),", nil, true, false}, {"a in (xyz)b notin ()", nil, true, false}, - {"a ", LabelSelector{ + {"a ", internalSelector{ getRequirement("a", ExistsOperator, nil, t), }, true, true}, - {"a in (x,y,notin, z,in)", LabelSelector{ + {"a in (x,y,notin, z,in)", internalSelector{ getRequirement("a", InOperator, sets.NewString("in", "notin", "x", "y", "z"), t), }, true, true}, // operator 'in' inside list of identifiers {"a in (xyz abc)", nil, false, false}, // no comma @@ -483,7 +518,7 @@ func TestSetSelectorParser(t *testing.T) { } else if err == nil && !ssp.Valid { t.Errorf("Parse(%s) => %+v expected error", ssp.In, sel) } else if ssp.Match && !reflect.DeepEqual(sel, ssp.Out) { - t.Errorf("Parse(%s) => parse output '%v' doesn't match '%v' expected match", ssp.In, sel, ssp.Out) + t.Errorf("Parse(%s) => parse output '%#v' doesn't match '%#v' expected match", ssp.In, sel, ssp.Out) } } } @@ -499,6 +534,7 @@ func getRequirement(key string, op Operator, vals sets.String, t *testing.T) Req func TestAdd(t *testing.T) { testCases := []struct { + name string sel Selector key string operator Operator @@ -506,27 +542,33 @@ func TestAdd(t *testing.T) { refSelector Selector }{ { - LabelSelector{}, + "keyInOperator", + internalSelector{}, "key", InOperator, []string{"value"}, - LabelSelector{Requirement{"key", InOperator, sets.NewString("value")}}, + internalSelector{Requirement{"key", InOperator, sets.NewString("value")}}, }, { - LabelSelector{Requirement{"key", InOperator, sets.NewString("value")}}, + "keyEqualsOperator", + internalSelector{Requirement{"key", InOperator, sets.NewString("value")}}, "key2", EqualsOperator, []string{"value2"}, - LabelSelector{ + internalSelector{ Requirement{"key", InOperator, sets.NewString("value")}, Requirement{"key2", EqualsOperator, sets.NewString("value2")}, }, }, } for _, ts := range testCases { - ts.sel = ts.sel.Add(ts.key, ts.operator, ts.values) + req, err := NewRequirement(ts.key, ts.operator, sets.NewString(ts.values...)) + if err != nil { + t.Errorf("%s - Unable to create labels.Requirement", ts.name) + } + ts.sel = ts.sel.Add(*req) if !reflect.DeepEqual(ts.sel, ts.refSelector) { - t.Errorf("Expected %v found %v", ts.refSelector, ts.sel) + t.Errorf("%s - Expected %v found %v", ts.name, ts.refSelector, ts.sel) } } } diff --git a/vendor/k8s.io/kubernetes/pkg/master/ports/doc.go b/vendor/k8s.io/kubernetes/pkg/master/ports/doc.go new file mode 100644 index 000000000..dc6c989e8 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/master/ports/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package ports defines ports used by various pieces of the kubernetes +// infrastructure. +package ports diff --git a/vendor/k8s.io/kubernetes/pkg/master/ports/ports.go b/vendor/k8s.io/kubernetes/pkg/master/ports/ports.go new file mode 100644 index 000000000..3e36603ac --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/master/ports/ports.go @@ -0,0 +1,40 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package ports + +const ( + // ProxyPort is the default port for the proxy healthz server. + // May be overriden by a flag at startup. + ProxyStatusPort = 10249 + // KubeletPort is the default port for the kubelet server on each host machine. + // May be overridden by a flag at startup. + KubeletPort = 10250 + // SchedulerPort is the default port for the scheduler status server. + // May be overridden by a flag at startup. + SchedulerPort = 10251 + // ControllerManagerPort is the default port for the controller manager status server. + // May be overridden by a flag at startup. + ControllerManagerPort = 10252 + // Port for flannel daemon. + FlannelDaemonPort = 10253 + // KubeletReadOnlyPort exposes basic read-only services from the kubelet. + // May be overridden by a flag at startup. + // This is necessary for heapster to collect monitoring stats from the kubelet + // until heapster can transition to using the SSL endpoint. + // TODO(roberthbailey): Remove this once we have a better solution for heapster. + KubeletReadOnlyPort = 10255 +) diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/codec.go b/vendor/k8s.io/kubernetes/pkg/runtime/codec.go index 5d06482ea..bde0ae975 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/codec.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/codec.go @@ -17,76 +17,155 @@ limitations under the License. package runtime import ( + "bytes" + "fmt" "io" + "net/url" + "reflect" - "k8s.io/kubernetes/pkg/util/yaml" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/conversion/queryparams" ) -// CodecFor returns a Codec that invokes Encode with the provided version. -func CodecFor(codec ObjectCodec, version string) Codec { - return &codecWrapper{codec, version} +// codec binds an encoder and decoder. +type codec struct { + Encoder + Decoder } -// yamlCodec converts YAML passed to the Decoder methods to JSON. -type yamlCodec struct { - // a Codec for JSON - Codec +// NewCodec creates a Codec from an Encoder and Decoder. +func NewCodec(e Encoder, d Decoder) Codec { + return codec{e, d} } -// yamlCodec implements Codec -var _ Codec = yamlCodec{} - -// YAMLDecoder adds YAML decoding support to a codec that supports JSON. -func YAMLDecoder(codec Codec) Codec { - return &yamlCodec{codec} -} - -func (c yamlCodec) Decode(data []byte) (Object, error) { - out, err := yaml.ToJSON(data) - if err != nil { +// Encode is a convenience wrapper for encoding to a []byte from an Encoder +func Encode(e Encoder, obj Object, overrides ...unversioned.GroupVersion) ([]byte, error) { + // TODO: reuse buffer + buf := &bytes.Buffer{} + if err := e.EncodeToStream(obj, buf, overrides...); err != nil { return nil, err } - data = out - return c.Codec.Decode(data) + return buf.Bytes(), nil } -func (c yamlCodec) DecodeInto(data []byte, obj Object) error { - out, err := yaml.ToJSON(data) +// Decode is a convenience wrapper for decoding data into an Object. +func Decode(d Decoder, data []byte) (Object, error) { + obj, _, err := d.Decode(data, nil, nil) + return obj, err +} + +// DecodeInto performs a Decode into the provided object. +func DecodeInto(d Decoder, data []byte, into Object) error { + out, gvk, err := d.Decode(data, nil, into) if err != nil { return err } - data = out - return c.Codec.DecodeInto(data, obj) + if out != into { + return fmt.Errorf("unable to decode %s into %v", gvk, reflect.TypeOf(into)) + } + return nil } // EncodeOrDie is a version of Encode which will panic instead of returning an error. For tests. -func EncodeOrDie(codec Codec, obj Object) string { - bytes, err := codec.Encode(obj) +func EncodeOrDie(e Encoder, obj Object) string { + bytes, err := Encode(e, obj) if err != nil { panic(err) } return string(bytes) } -// codecWrapper implements encoding to an alternative -// default version for a scheme. -type codecWrapper struct { - ObjectCodec - version string +// UseOrCreateObject returns obj if the canonical ObjectKind returned by the provided typer matches gvk, or +// invokes the ObjectCreator to instantiate a new gvk. Returns an error if the typer cannot find the object. +func UseOrCreateObject(t Typer, c ObjectCreater, gvk unversioned.GroupVersionKind, obj Object) (Object, error) { + if obj != nil { + into, _, err := t.ObjectKind(obj) + if err != nil { + return nil, err + } + if gvk == *into { + return obj, nil + } + } + return c.New(gvk) } -// Encode implements Codec -func (c *codecWrapper) Encode(obj Object) ([]byte, error) { - return c.EncodeToVersion(obj, c.version) +// NoopEncoder converts an Decoder to a Serializer or Codec for code that expects them but only uses decoding. +type NoopEncoder struct { + Decoder } -func (c *codecWrapper) EncodeToStream(obj Object, stream io.Writer) error { - return c.EncodeToVersionStream(obj, c.version, stream) +var _ Serializer = NoopEncoder{} + +func (n NoopEncoder) EncodeToStream(obj Object, w io.Writer, overrides ...unversioned.GroupVersion) error { + return fmt.Errorf("encoding is not allowed for this codec: %v", reflect.TypeOf(n.Decoder)) } -// TODO: Make this behaviour default when we move everyone away from -// the unversioned types. -// -// func (c *codecWrapper) Decode(data []byte) (Object, error) { -// return c.DecodeToVersion(data, c.version) -// } +// NoopDecoder converts an Encoder to a Serializer or Codec for code that expects them but only uses encoding. +type NoopDecoder struct { + Encoder +} + +var _ Serializer = NoopDecoder{} + +func (n NoopDecoder) Decode(data []byte, gvk *unversioned.GroupVersionKind, into Object) (Object, *unversioned.GroupVersionKind, error) { + return nil, nil, fmt.Errorf("decoding is not allowed for this codec: %v", reflect.TypeOf(n.Encoder)) +} + +// NewParameterCodec creates a ParameterCodec capable of transforming url values into versioned objects and back. +func NewParameterCodec(scheme *Scheme) ParameterCodec { + return ¶meterCodec{ + typer: ObjectTyperToTyper(scheme), + convertor: scheme, + creator: scheme, + } +} + +// parameterCodec implements conversion to and from query parameters and objects. +type parameterCodec struct { + typer Typer + convertor ObjectConvertor + creator ObjectCreater +} + +var _ ParameterCodec = ¶meterCodec{} + +// DecodeParameters converts the provided url.Values into an object of type From with the kind of into, and then +// converts that object to into (if necessary). Returns an error if the operation cannot be completed. +func (c *parameterCodec) DecodeParameters(parameters url.Values, from unversioned.GroupVersion, into Object) error { + if len(parameters) == 0 { + return nil + } + targetGVK, _, err := c.typer.ObjectKind(into) + if err != nil { + return err + } + if targetGVK.GroupVersion() == from { + return c.convertor.Convert(¶meters, into) + } + input, err := c.creator.New(from.WithKind(targetGVK.Kind)) + if err != nil { + return err + } + if err := c.convertor.Convert(¶meters, input); err != nil { + return err + } + return c.convertor.Convert(input, into) +} + +// EncodeParameters converts the provided object into the to version, then converts that object to url.Values. +// Returns an error if conversion is not possible. +func (c *parameterCodec) EncodeParameters(obj Object, to unversioned.GroupVersion) (url.Values, error) { + gvk, _, err := c.typer.ObjectKind(obj) + if err != nil { + return nil, err + } + if to != gvk.GroupVersion() { + out, err := c.convertor.ConvertToVersion(obj, to.String()) + if err != nil { + return nil, err + } + obj = out + } + return queryparams.Convert(obj) +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/conversion_generator.go b/vendor/k8s.io/kubernetes/pkg/runtime/conversion_generator.go index 9bfab5ddc..9971b7b20 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/conversion_generator.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/conversion_generator.go @@ -19,17 +19,19 @@ package runtime import ( "fmt" "io" + "log" "path" "reflect" + goruntime "runtime" "sort" "strings" - "k8s.io/kubernetes/pkg/conversion" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/util/sets" ) type ConversionGenerator interface { - GenerateConversionsForType(version string, reflection reflect.Type) error + GenerateConversionsForType(groupVersion unversioned.GroupVersion, reflection reflect.Type) error WriteConversionFunctions(w io.Writer) error RegisterConversionFunctions(w io.Writer, pkg string) error AddImport(pkg string) string @@ -39,10 +41,15 @@ type ConversionGenerator interface { AssumePrivateConversions() } -func NewConversionGenerator(scheme *conversion.Scheme, targetPkg string) ConversionGenerator { +func NewConversionGenerator(scheme *Scheme, targetPkg string) ConversionGenerator { g := &conversionGenerator{ - scheme: scheme, - targetPkg: targetPkg, + scheme: scheme, + + nameFormat: "Convert_%s_%s_To_%s_%s", + generatedNamePrefix: "auto", + targetPkg: targetPkg, + + publicFuncs: make(map[typePair]functionName), convertibles: make(map[reflect.Type]reflect.Type), overridden: make(map[reflect.Type]bool), pkgOverwrites: make(map[string]string), @@ -57,9 +64,19 @@ func NewConversionGenerator(scheme *conversion.Scheme, targetPkg string) Convers var complexTypes []reflect.Kind = []reflect.Kind{reflect.Map, reflect.Ptr, reflect.Slice, reflect.Interface, reflect.Struct} +type functionName struct { + name string + packageName string +} + type conversionGenerator struct { - scheme *conversion.Scheme - targetPkg string + scheme *Scheme + + nameFormat string + generatedNamePrefix string + targetPkg string + + publicFuncs map[typePair]functionName convertibles map[reflect.Type]reflect.Type overridden map[reflect.Type]bool // If pkgOverwrites is set for a given package name, that package name @@ -86,9 +103,13 @@ func (g *conversionGenerator) AddImport(pkg string) string { return g.addImportByPath(pkg) } -func (g *conversionGenerator) GenerateConversionsForType(version string, reflection reflect.Type) error { +func (g *conversionGenerator) GenerateConversionsForType(gv unversioned.GroupVersion, reflection reflect.Type) error { kind := reflection.Name() - internalObj, err := g.scheme.NewObject(g.scheme.InternalVersion, kind) + // TODO this is equivalent to what it did before, but it needs to be fixed for the proper group + internalVersion := gv + internalVersion.Version = APIVersionInternal + + internalObj, err := g.scheme.New(internalVersion.WithKind(kind)) if err != nil { return fmt.Errorf("cannot create an object of type %v in internal version", kind) } @@ -104,6 +125,22 @@ func (g *conversionGenerator) GenerateConversionsForType(version string, reflect return nil } +// primitiveConversion returns true if the two types can be converted via a cast. +func primitiveConversion(inType, outType reflect.Type) (string, bool) { + switch inType.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Float32, reflect.Float64: + switch outType.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Float32, reflect.Float64: + return outType.Name(), true + } + } + return "", false +} + func (g *conversionGenerator) generateConversionsBetween(inType, outType reflect.Type) error { existingConversion := g.scheme.Converter().HasConversionFunc(inType, outType) && g.scheme.Converter().HasConversionFunc(outType, inType) @@ -115,12 +152,26 @@ func (g *conversionGenerator) generateConversionsBetween(inType, outType reflect return nil } if inType == outType { + switch inType.Kind() { + case reflect.Ptr: + return g.generateConversionsBetween(inType.Elem(), inType.Elem()) + case reflect.Struct: + // pointers to structs invoke new(inType) + g.addImportByPath(inType.PkgPath()) + } + g.rememberConversionFunction(inType, inType, false) // Don't generate conversion methods for the same type. return nil } + if _, ok := primitiveConversion(inType, outType); ok { + return nil + } + if inType.Kind() != outType.Kind() { if existingConversion { + g.rememberConversionFunction(inType, outType, false) + g.rememberConversionFunction(outType, inType, false) return nil } return fmt.Errorf("cannot convert types of different kinds: %v %v", inType, outType) @@ -167,6 +218,7 @@ func (g *conversionGenerator) generateConversionsBetween(inType, outType reflect if !existingConversion && (inErr != nil || outErr != nil) { return inErr } + g.rememberConversionFunction(inType, outType, true) if existingConversion { g.overridden[inType] = true } @@ -187,6 +239,39 @@ func isComplexType(reflection reflect.Type) bool { return false } +func (g *conversionGenerator) rememberConversionFunction(inType, outType reflect.Type, willGenerate bool) { + if _, ok := g.publicFuncs[typePair{inType, outType}]; ok { + return + } + + if v, ok := g.scheme.Converter().ConversionFuncValue(inType, outType); ok { + if fn := goruntime.FuncForPC(v.Pointer()); fn != nil { + name := fn.Name() + var p, n string + if last := strings.LastIndex(name, "."); last != -1 { + p = name[:last] + n = name[last+1:] + } else { + n = name + } + if isPublic(n) { + g.AddImport(p) + g.publicFuncs[typePair{inType, outType}] = functionName{name: n, packageName: p} + } else { + log.Printf("WARNING: Cannot generate conversion %v -> %v, method %q is private", inType, outType, fn.Name()) + } + } else { + log.Printf("WARNING: Cannot generate conversion %v -> %v, method is not accessible", inType, outType) + } + } else if willGenerate { + g.publicFuncs[typePair{inType, outType}] = functionName{name: g.conversionFunctionName(inType, outType)} + } +} + +func isPublic(name string) bool { + return strings.ToUpper(name[:1]) == name[:1] +} + func (g *conversionGenerator) generateConversionsForMap(inType, outType reflect.Type) error { inKey := inType.Key() outKey := outType.Key() @@ -208,6 +293,8 @@ func (g *conversionGenerator) generateConversionsForMap(inType, outType reflect. func (g *conversionGenerator) generateConversionsForSlice(inType, outType reflect.Type) error { inElem := inType.Elem() outElem := outType.Elem() + // slice conversion requires the package for the destination type in order to instantiate the map + g.addImportByPath(outElem.PkgPath()) if err := g.generateConversionsBetween(inElem, outElem); err != nil { return err } @@ -478,15 +565,32 @@ func packageForName(inType reflect.Type) string { } func (g *conversionGenerator) conversionFunctionName(inType, outType reflect.Type) string { - funcNameFormat := "convert_%s_%s_To_%s_%s" + funcNameFormat := g.nameFormat inPkg := packageForName(inType) outPkg := packageForName(outType) funcName := fmt.Sprintf(funcNameFormat, inPkg, inType.Name(), outPkg, outType.Name()) return funcName } +func (g *conversionGenerator) conversionFunctionCall(inType, outType reflect.Type, scopeName string, args ...string) string { + if named, ok := g.publicFuncs[typePair{inType, outType}]; ok { + args[len(args)-1] = scopeName + name := named.name + localPackageName, ok := g.imports[named.packageName] + if !ok { + panic(fmt.Sprintf("have not defined an import for %s", named.packageName)) + } + if len(named.packageName) > 0 && len(localPackageName) > 0 { + name = localPackageName + "." + name + } + return fmt.Sprintf("%s(%s)", name, strings.Join(args, ", ")) + } + log.Printf("WARNING: Using reflection to convert %v -> %v (no public conversion)", inType, outType) + return fmt.Sprintf("%s.Convert(%s)", scopeName, strings.Join(args, ", ")) +} + func (g *conversionGenerator) generatedFunctionName(inType, outType reflect.Type) string { - return "auto" + g.conversionFunctionName(inType, outType) + return g.generatedNamePrefix + g.conversionFunctionName(inType, outType) } func (g *conversionGenerator) writeHeader(b *buffer, name, inType, outType string, indent int) { @@ -518,7 +622,8 @@ func (g *conversionGenerator) writeConversionForMap(b *buffer, inField, outField newFormat := "newVal := %s{}\n" newStmt := fmt.Sprintf(newFormat, g.typeName(outField.Type.Elem())) b.addLine(newStmt, indent+2) - convertStmt := "if err := s.Convert(&val, &newVal, 0); err != nil {\n" + call := g.conversionFunctionCall(inField.Type.Elem(), outField.Type.Elem(), "s", "&val", "&newVal", "0") + convertStmt := fmt.Sprintf("if err := %s; err != nil {\n", call) b.addLine(convertStmt, indent+2) b.addLine("return err\n", indent+3) b.addLine("}\n", indent+2) @@ -578,15 +683,8 @@ func (g *conversionGenerator) writeConversionForSlice(b *buffer, inField, outFie } } if !assigned { - assignStmt := "" - if g.existsDedicatedConversionFunction(inField.Type.Elem(), outField.Type.Elem()) { - assignFormat := "if err := %s(&in.%s[i], &out.%s[i], s); err != nil {\n" - funcName := g.conversionFunctionName(inField.Type.Elem(), outField.Type.Elem()) - assignStmt = fmt.Sprintf(assignFormat, funcName, inField.Name, outField.Name) - } else { - assignFormat := "if err := s.Convert(&in.%s[i], &out.%s[i], 0); err != nil {\n" - assignStmt = fmt.Sprintf(assignFormat, inField.Name, outField.Name) - } + call := g.conversionFunctionCall(inField.Type.Elem(), outField.Type.Elem(), "s", "&in."+inField.Name+"[i]", "&out."+outField.Name+"[i]", "0") + assignStmt := fmt.Sprintf("if err := %s; err != nil {\n", call) b.addLine(assignStmt, indent+2) b.addLine("return err\n", indent+3) b.addLine("}\n", indent+2) @@ -635,20 +733,20 @@ func (g *conversionGenerator) writeConversionForPtr(b *buffer, inField, outField } } + b.addLine(fmt.Sprintf("// unable to generate simple pointer conversion for %v -> %v\n", inField.Type.Elem(), outField.Type.Elem()), indent) ifFormat := "if in.%s != nil {\n" ifStmt := fmt.Sprintf(ifFormat, inField.Name) b.addLine(ifStmt, indent) assignStmt := "" - if g.existsDedicatedConversionFunction(inField.Type.Elem(), outField.Type.Elem()) { + if _, ok := g.publicFuncs[typePair{inField.Type.Elem(), outField.Type.Elem()}]; ok { newFormat := "out.%s = new(%s)\n" newStmt := fmt.Sprintf(newFormat, outField.Name, g.typeName(outField.Type.Elem())) b.addLine(newStmt, indent+1) - assignFormat := "if err := %s(in.%s, out.%s, s); err != nil {\n" - funcName := g.conversionFunctionName(inField.Type.Elem(), outField.Type.Elem()) - assignStmt = fmt.Sprintf(assignFormat, funcName, inField.Name, outField.Name) + call := g.conversionFunctionCall(inField.Type.Elem(), outField.Type.Elem(), "s", "in."+inField.Name, "out."+outField.Name, "0") + assignStmt = fmt.Sprintf("if err := %s; err != nil {\n", call) } else { - assignFormat := "if err := s.Convert(&in.%s, &out.%s, 0); err != nil {\n" - assignStmt = fmt.Sprintf(assignFormat, inField.Name, outField.Name) + call := g.conversionFunctionCall(inField.Type.Elem(), outField.Type.Elem(), "s", "&in."+inField.Name, "&out."+outField.Name, "0") + assignStmt = fmt.Sprintf("if err := %s; err != nil {\n", call) } b.addLine(assignStmt, indent+1) b.addLine("return err\n", indent+2) @@ -684,11 +782,19 @@ func (g *conversionGenerator) writeConversionForStruct(b *buffer, inType, outTyp continue } + if g.scheme.Converter().IsConversionIgnored(inField.Type, outField.Type) { + continue + } + existsConversion := g.scheme.Converter().HasConversionFunc(inField.Type, outField.Type) - if existsConversion && !g.existsDedicatedConversionFunction(inField.Type, outField.Type) { + _, hasPublicConversion := g.publicFuncs[typePair{inField.Type, outField.Type}] + // TODO: This allows a private conversion for a slice to take precedence over a public + // conversion for the field, even though that is technically slower. We should report when + // we generate an inefficient conversion. + if existsConversion || hasPublicConversion { // Use the conversion method that is already defined. - assignFormat := "if err := s.Convert(&in.%s, &out.%s, 0); err != nil {\n" - assignStmt := fmt.Sprintf(assignFormat, inField.Name, outField.Name) + call := g.conversionFunctionCall(inField.Type, outField.Type, "s", "&in."+inField.Name, "&out."+outField.Name, "0") + assignStmt := fmt.Sprintf("if err := %s; err != nil {\n", call) b.addLine(assignStmt, indent) b.addLine("return err\n", indent+1) b.addLine("}\n", indent) @@ -744,15 +850,8 @@ func (g *conversionGenerator) writeConversionForStruct(b *buffer, inType, outTyp } } - assignStmt := "" - if g.existsDedicatedConversionFunction(inField.Type, outField.Type) { - assignFormat := "if err := %s(&in.%s, &out.%s, s); err != nil {\n" - funcName := g.conversionFunctionName(inField.Type, outField.Type) - assignStmt = fmt.Sprintf(assignFormat, funcName, inField.Name, outField.Name) - } else { - assignFormat := "if err := s.Convert(&in.%s, &out.%s, 0); err != nil {\n" - assignStmt = fmt.Sprintf(assignFormat, inField.Name, outField.Name) - } + call := g.conversionFunctionCall(inField.Type, outField.Type, "s", "&in."+inField.Name, "&out."+outField.Name, "0") + assignStmt := fmt.Sprintf("if err := %s; err != nil {\n", call) b.addLine(assignStmt, indent) b.addLine("return err\n", indent+1) b.addLine("}\n", indent) @@ -807,39 +906,7 @@ type typePair struct { outType reflect.Type } -var defaultConversions []typePair = []typePair{ - {reflect.TypeOf([]RawExtension{}), reflect.TypeOf([]Object{})}, - {reflect.TypeOf([]Object{}), reflect.TypeOf([]RawExtension{})}, - {reflect.TypeOf(RawExtension{}), reflect.TypeOf(EmbeddedObject{})}, - {reflect.TypeOf(EmbeddedObject{}), reflect.TypeOf(RawExtension{})}, -} - -func (g *conversionGenerator) existsDedicatedConversionFunction(inType, outType reflect.Type) bool { - if inType == outType { - // Assume that conversion are not defined for "deep copies". - return false - } - - if g.existsConversionFunction(inType, outType) { - return true - } - - for _, conv := range defaultConversions { - if conv.inType == inType && conv.outType == outType { - return false - } - } - if inType.Kind() != outType.Kind() { - // TODO(wojtek-t): Currently all conversions between types of different kinds are - // unnamed. Thus we return false here. - return false - } - // TODO: no way to handle private conversions in different packages - if g.assumePrivateConversions { - return false - } - return g.scheme.Converter().HasConversionFunc(inType, outType) -} +var defaultConversions []typePair = []typePair{} func (g *conversionGenerator) OverwritePackage(pkg, overwrite string) { g.pkgOverwrites[pkg] = overwrite diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/conversion_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/conversion_test.go index b3dcc561c..6105e5aad 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/conversion_test.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/conversion_test.go @@ -20,11 +20,12 @@ import ( "reflect" "testing" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" ) type InternalComplex struct { - TypeMeta + runtime.TypeMeta String string Integer int Integer64 int64 @@ -33,22 +34,25 @@ type InternalComplex struct { } type ExternalComplex struct { - TypeMeta `json:",inline"` - String string `json:"string" description:"testing"` - Integer int `json:"int"` - Integer64 int64 `json:",omitempty"` - Int64 int64 - Bool bool `json:"bool"` + runtime.TypeMeta `json:",inline"` + String string `json:"string" description:"testing"` + Integer int `json:"int"` + Integer64 int64 `json:",omitempty"` + Int64 int64 + Bool bool `json:"bool"` } -func (*InternalComplex) IsAnAPIObject() {} -func (*ExternalComplex) IsAnAPIObject() {} +func (obj *InternalComplex) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ExternalComplex) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } func TestStringMapConversion(t *testing.T) { + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "external"} + scheme := runtime.NewScheme() scheme.Log(t) - scheme.AddKnownTypeWithName("", "Complex", &InternalComplex{}) - scheme.AddKnownTypeWithName("external", "Complex", &ExternalComplex{}) + scheme.AddKnownTypeWithName(internalGV.WithKind("Complex"), &InternalComplex{}) + scheme.AddKnownTypeWithName(externalGV.WithKind("Complex"), &ExternalComplex{}) testCases := map[string]struct { input map[string][]string diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/deep_copy_generator.go b/vendor/k8s.io/kubernetes/pkg/runtime/deep_copy_generator.go index 38fb54f5c..4790969f1 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/deep_copy_generator.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/deep_copy_generator.go @@ -24,7 +24,6 @@ import ( "sort" "strings" - "k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/util/sets" ) @@ -69,7 +68,7 @@ type DeepCopyGenerator interface { OverwritePackage(pkg, overwrite string) } -func NewDeepCopyGenerator(scheme *conversion.Scheme, targetPkg string, include sets.String) DeepCopyGenerator { +func NewDeepCopyGenerator(scheme *Scheme, targetPkg string, include sets.String) DeepCopyGenerator { g := &deepCopyGenerator{ scheme: scheme, targetPkg: targetPkg, @@ -91,7 +90,7 @@ type pkgPathNamePair struct { } type deepCopyGenerator struct { - scheme *conversion.Scheme + scheme *Scheme targetPkg string copyables map[reflect.Type]bool // map of package names to shortname diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/embedded.go b/vendor/k8s.io/kubernetes/pkg/runtime/embedded.go new file mode 100644 index 000000000..0934d6837 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/embedded.go @@ -0,0 +1,124 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package runtime + +import ( + "errors" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/conversion" +) + +type encodable struct { + e Encoder `json:"-"` + obj Object + versions []unversioned.GroupVersion `json:"-"` +} + +func (e encodable) GetObjectKind() unversioned.ObjectKind { return e.obj.GetObjectKind() } + +// NewEncodable creates an object that will be encoded with the provided codec on demand. +// Provided as a convenience for test cases dealing with internal objects. +func NewEncodable(e Encoder, obj Object, versions ...unversioned.GroupVersion) Object { + if _, ok := obj.(*Unknown); ok { + return obj + } + return encodable{e, obj, versions} +} + +func (re encodable) UnmarshalJSON(in []byte) error { + return errors.New("runtime.encodable cannot be unmarshalled from JSON") +} + +// Marshal may get called on pointers or values, so implement MarshalJSON on value. +// http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go +func (re encodable) MarshalJSON() ([]byte, error) { + return Encode(re.e, re.obj) +} + +// NewEncodableList creates an object that will be encoded with the provided codec on demand. +// Provided as a convenience for test cases dealing with internal objects. +func NewEncodableList(e Encoder, objects []Object, versions ...unversioned.GroupVersion) []Object { + out := make([]Object, len(objects)) + for i := range objects { + if _, ok := objects[i].(*Unknown); ok { + out[i] = objects[i] + continue + } + out[i] = NewEncodable(e, objects[i], versions...) + } + return out +} + +func (re *Unknown) UnmarshalJSON(in []byte) error { + if re == nil { + return errors.New("runtime.Unknown: UnmarshalJSON on nil pointer") + } + re.TypeMeta = TypeMeta{} + re.RawJSON = append(re.RawJSON[0:0], in...) + return nil +} + +// Marshal may get called on pointers or values, so implement MarshalJSON on value. +// http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go +func (re Unknown) MarshalJSON() ([]byte, error) { + if re.RawJSON == nil { + return []byte("null"), nil + } + return re.RawJSON, nil +} + +func DefaultEmbeddedConversions() []interface{} { + return []interface{}{ + func(in *Object, out *RawExtension, s conversion.Scope) error { + if in == nil { + out.RawJSON = []byte("null") + return nil + } + obj := *in + if unk, ok := obj.(*Unknown); ok { + if unk.RawJSON != nil { + out.RawJSON = unk.RawJSON + return nil + } + obj = out.Object + } + if obj == nil { + out.RawJSON = nil + return nil + } + out.Object = obj + return nil + }, + + func(in *RawExtension, out *Object, s conversion.Scope) error { + if in.Object != nil { + *out = in.Object + return nil + } + data := in.RawJSON + if len(data) == 0 || (len(data) == 4 && string(data) == "null") { + *out = nil + return nil + } + *out = &Unknown{ + RawJSON: data, + } + return nil + }, + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/embedded_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/embedded_test.go index 42995dc53..64d6d74fb 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/embedded_test.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/embedded_test.go @@ -19,18 +19,21 @@ package runtime_test import ( "encoding/json" "reflect" + "strings" "testing" - "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer" "k8s.io/kubernetes/pkg/util" ) type EmbeddedTest struct { runtime.TypeMeta ID string - Object runtime.EmbeddedObject - EmptyObject runtime.EmbeddedObject + Object runtime.Object + EmptyObject runtime.Object } type EmbeddedTestExternal struct { @@ -54,17 +57,23 @@ type ObjectTestExternal struct { Items []runtime.RawExtension `json:"items,omitempty"` } -func (*ObjectTest) IsAnAPIObject() {} -func (*ObjectTestExternal) IsAnAPIObject() {} -func (*EmbeddedTest) IsAnAPIObject() {} -func (*EmbeddedTestExternal) IsAnAPIObject() {} +func (obj *ObjectTest) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ObjectTestExternal) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *EmbeddedTest) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *EmbeddedTestExternal) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } func TestDecodeEmptyRawExtensionAsObject(t *testing.T) { - s := runtime.NewScheme() - s.AddKnownTypes("", &ObjectTest{}) - s.AddKnownTypeWithName("v1test", "ObjectTest", &ObjectTestExternal{}) + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "v1test"} + externalGVK := externalGV.WithKind("ObjectTest") - obj, err := s.Decode([]byte(`{"kind":"ObjectTest","apiVersion":"v1test","items":[{}]}`)) + s := runtime.NewScheme() + s.AddKnownTypes(internalGV, &ObjectTest{}) + s.AddKnownTypeWithName(externalGVK, &ObjectTestExternal{}) + + codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) + + obj, gvk, err := codec.Decode([]byte(`{"kind":"`+externalGVK.Kind+`","apiVersion":"`+externalGV.String()+`","items":[{}]}`), nil, nil) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -72,38 +81,51 @@ func TestDecodeEmptyRawExtensionAsObject(t *testing.T) { if unk, ok := test.Items[0].(*runtime.Unknown); !ok || unk.Kind != "" || unk.APIVersion != "" || string(unk.RawJSON) != "{}" { t.Fatalf("unexpected object: %#v", test.Items[0]) } + if *gvk != externalGVK { + t.Fatalf("unexpected kind: %#v", gvk) + } - obj, err = s.Decode([]byte(`{"kind":"ObjectTest","apiVersion":"v1test","items":[{"kind":"Other","apiVersion":"v1"}]}`)) + obj, gvk, err = codec.Decode([]byte(`{"kind":"`+externalGVK.Kind+`","apiVersion":"`+externalGV.String()+`","items":[{"kind":"Other","apiVersion":"v1"}]}`), nil, nil) if err != nil { t.Fatalf("unexpected error: %v", err) } test = obj.(*ObjectTest) - if unk, ok := test.Items[0].(*runtime.Unknown); !ok || unk.Kind != "Other" || unk.APIVersion != "v1" || string(unk.RawJSON) != `{"kind":"Other","apiVersion":"v1"}` { + if unk, ok := test.Items[0].(*runtime.Unknown); !ok || unk.Kind != "" || unk.APIVersion != "" || string(unk.RawJSON) != `{"kind":"Other","apiVersion":"v1"}` { t.Fatalf("unexpected object: %#v", test.Items[0]) } + if *gvk != externalGVK { + t.Fatalf("unexpected kind: %#v", gvk) + } } func TestArrayOfRuntimeObject(t *testing.T) { - s := runtime.NewScheme() - s.AddKnownTypes("", &EmbeddedTest{}) - s.AddKnownTypeWithName("v1test", "EmbeddedTest", &EmbeddedTestExternal{}) - s.AddKnownTypes("", &ObjectTest{}) - s.AddKnownTypeWithName("v1test", "ObjectTest", &ObjectTestExternal{}) + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "v1test"} - internal := &ObjectTest{ - Items: []runtime.Object{ - &EmbeddedTest{ID: "foo"}, - &EmbeddedTest{ID: "bar"}, - // TODO: until YAML is removed, this JSON must be in ascending key order to ensure consistent roundtrip serialization - &runtime.Unknown{RawJSON: []byte(`{"apiVersion":"unknown","foo":"bar","kind":"OtherTest"}`)}, - &ObjectTest{ - Items: []runtime.Object{ - &EmbeddedTest{ID: "baz"}, - }, - }, + s := runtime.NewScheme() + s.AddKnownTypes(internalGV, &EmbeddedTest{}) + s.AddKnownTypeWithName(externalGV.WithKind("EmbeddedTest"), &EmbeddedTestExternal{}) + s.AddKnownTypes(internalGV, &ObjectTest{}) + s.AddKnownTypeWithName(externalGV.WithKind("ObjectTest"), &ObjectTestExternal{}) + + codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) + + innerItems := []runtime.Object{ + &EmbeddedTest{ID: "baz"}, + } + items := []runtime.Object{ + &EmbeddedTest{ID: "foo"}, + &EmbeddedTest{ID: "bar"}, + // TODO: until YAML is removed, this JSON must be in ascending key order to ensure consistent roundtrip serialization + &runtime.Unknown{RawJSON: []byte(`{"apiVersion":"unknown.group/unknown","foo":"bar","kind":"OtherTest"}`)}, + &ObjectTest{ + Items: runtime.NewEncodableList(codec, innerItems), }, } - wire, err := s.EncodeToVersion(internal, "v1test") + internal := &ObjectTest{ + Items: runtime.NewEncodableList(codec, items), + } + wire, err := runtime.Encode(codec, internal) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -115,64 +137,84 @@ func TestArrayOfRuntimeObject(t *testing.T) { } t.Logf("exact wire is: %s", string(obj.Items[0].RawJSON)) - decoded, err := s.Decode(wire) + items[3] = &ObjectTest{Items: innerItems} + internal.Items = items + + decoded, err := runtime.Decode(codec, wire) if err != nil { t.Fatalf("unexpected error: %v", err) } - list, err := runtime.ExtractList(decoded) + list, err := meta.ExtractList(decoded) if err != nil { t.Fatalf("unexpected error: %v", err) } - if errs := runtime.DecodeList(list, s); len(errs) > 0 { + if errs := runtime.DecodeList(list, codec); len(errs) > 0 { t.Fatalf("unexpected error: %v", errs) } - list2, err := runtime.ExtractList(list[3]) + list2, err := meta.ExtractList(list[3]) if err != nil { t.Fatalf("unexpected error: %v", err) } - if errs := runtime.DecodeList(list2, s); len(errs) > 0 { + if errs := runtime.DecodeList(list2, codec); len(errs) > 0 { t.Fatalf("unexpected error: %v", errs) } - if err := runtime.SetList(list[3], list2); err != nil { + if err := meta.SetList(list[3], list2); err != nil { t.Fatalf("unexpected error: %v", err) } - internal.Items[2].(*runtime.Unknown).Kind = "OtherTest" - internal.Items[2].(*runtime.Unknown).APIVersion = "unknown" + // we want DecodeList to set type meta if possible, even on runtime.Unknown objects + internal.Items[2].(*runtime.Unknown).TypeMeta = runtime.TypeMeta{Kind: "OtherTest", APIVersion: "unknown.group/unknown"} if e, a := internal.Items, list; !reflect.DeepEqual(e, a) { - t.Errorf("mismatched decoded: %s", util.ObjectDiff(e, a)) + t.Errorf("mismatched decoded: %s", util.ObjectGoPrintSideBySide(e, a)) } } -func TestEmbeddedObject(t *testing.T) { - s := runtime.NewScheme() - s.AddKnownTypes("", &EmbeddedTest{}) - s.AddKnownTypeWithName("v1test", "EmbeddedTest", &EmbeddedTestExternal{}) +func TestNestedObject(t *testing.T) { + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "v1test"} + embeddedTestExternalGVK := externalGV.WithKind("EmbeddedTest") + s := runtime.NewScheme() + s.AddKnownTypes(internalGV, &EmbeddedTest{}) + s.AddKnownTypeWithName(embeddedTestExternalGVK, &EmbeddedTestExternal{}) + + codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) + + inner := &EmbeddedTest{ + ID: "inner", + } outer := &EmbeddedTest{ - ID: "outer", - Object: runtime.EmbeddedObject{ - Object: &EmbeddedTest{ - ID: "inner", - }, - }, + ID: "outer", + Object: runtime.NewEncodable(codec, inner), } - wire, err := s.EncodeToVersion(outer, "v1test") + wire, err := runtime.Encode(codec, outer) if err != nil { t.Fatalf("Unexpected encode error '%v'", err) } t.Logf("Wire format is:\n%v\n", string(wire)) - decoded, err := s.Decode(wire) + decoded, err := runtime.Decode(codec, wire) if err != nil { t.Fatalf("Unexpected decode error %v", err) } + // for later tests + outer.Object = inner + + if e, a := outer, decoded; reflect.DeepEqual(e, a) { + t.Errorf("Expected unequal %#v %#v", e, a) + } + + obj, err := runtime.Decode(codec, decoded.(*EmbeddedTest).Object.(*runtime.Unknown).RawJSON) + if err != nil { + t.Fatal(err) + } + decoded.(*EmbeddedTest).Object = obj if e, a := outer, decoded; !reflect.DeepEqual(e, a) { - t.Errorf("Expected: %#v but got %#v", e, a) + t.Errorf("Expected equal %#v %#v", e, a) } // test JSON decoding of the external object, which should preserve @@ -195,41 +237,45 @@ func TestEmbeddedObject(t *testing.T) { // the external representation var decodedViaJSON EmbeddedTest err = json.Unmarshal(wire, &decodedViaJSON) - if err != nil { + if err == nil || !strings.Contains(err.Error(), "unmarshal object into Go value of type runtime.Object") { t.Fatalf("Unexpected decode error %v", err) } - if a := decodedViaJSON; a.Object.Object != nil || a.EmptyObject.Object != nil { + if a := decodedViaJSON; a.Object != nil || a.EmptyObject != nil { t.Errorf("Expected embedded objects to be nil: %#v", a) } } -// TestDeepCopyOfEmbeddedObject checks to make sure that EmbeddedObject's can be passed through DeepCopy with fidelity -func TestDeepCopyOfEmbeddedObject(t *testing.T) { +// TestDeepCopyOfRuntimeObject checks to make sure that runtime.Objects's can be passed through DeepCopy with fidelity +func TestDeepCopyOfRuntimeObject(t *testing.T) { + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "v1test"} + embeddedTestExternalGVK := externalGV.WithKind("EmbeddedTest") + s := runtime.NewScheme() - s.AddKnownTypes("", &EmbeddedTest{}) - s.AddKnownTypeWithName("v1test", "EmbeddedTest", &EmbeddedTestExternal{}) + s.AddKnownTypes(internalGV, &EmbeddedTest{}) + s.AddKnownTypeWithName(embeddedTestExternalGVK, &EmbeddedTestExternal{}) original := &EmbeddedTest{ ID: "outer", - Object: runtime.EmbeddedObject{ - Object: &EmbeddedTest{ - ID: "inner", - }, + Object: &EmbeddedTest{ + ID: "inner", }, } - originalData, err := s.EncodeToVersion(original, "v1test") + codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) + + originalData, err := runtime.Encode(codec, original) if err != nil { t.Errorf("unexpected error: %v", err) } t.Logf("originalRole = %v\n", string(originalData)) - copyOfOriginal, err := api.Scheme.DeepCopy(original) + copyOfOriginal, err := s.DeepCopy(original) if err != nil { t.Fatalf("unexpected error: %v", err) } - copiedData, err := s.EncodeToVersion(copyOfOriginal.(runtime.Object), "v1test") + copiedData, err := runtime.Encode(codec, copyOfOriginal.(runtime.Object)) if err != nil { t.Errorf("unexpected error: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/error.go b/vendor/k8s.io/kubernetes/pkg/runtime/error.go index 40fa2437a..ca60ee813 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/error.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/error.go @@ -17,23 +17,86 @@ limitations under the License. package runtime import ( - "k8s.io/kubernetes/pkg/conversion" + "fmt" + "reflect" + + "k8s.io/kubernetes/pkg/api/unversioned" ) +type notRegisteredErr struct { + gvk unversioned.GroupVersionKind + t reflect.Type +} + +// NewNotRegisteredErr is exposed for testing. +func NewNotRegisteredErr(gvk unversioned.GroupVersionKind, t reflect.Type) error { + return ¬RegisteredErr{gvk: gvk, t: t} +} + +func (k *notRegisteredErr) Error() string { + if k.t != nil { + return fmt.Sprintf("no kind is registered for the type %v", k.t) + } + if len(k.gvk.Kind) == 0 { + return fmt.Sprintf("no version %q has been registered", k.gvk.GroupVersion()) + } + if k.gvk.Version == APIVersionInternal { + return fmt.Sprintf("no kind %q is registered for the internal version of group %q", k.gvk.Kind, k.gvk.Group) + } + + return fmt.Sprintf("no kind %q is registered for version %q", k.gvk.Kind, k.gvk.GroupVersion()) +} + // IsNotRegisteredError returns true if the error indicates the provided // object or input data is not registered. func IsNotRegisteredError(err error) bool { - return conversion.IsNotRegisteredError(err) + if err == nil { + return false + } + _, ok := err.(*notRegisteredErr) + return ok +} + +type missingKindErr struct { + data string +} + +func NewMissingKindErr(data string) error { + return &missingKindErr{data} +} + +func (k *missingKindErr) Error() string { + return fmt.Sprintf("Object 'Kind' is missing in '%s'", k.data) } // IsMissingKind returns true if the error indicates that the provided object // is missing a 'Kind' field. func IsMissingKind(err error) bool { - return conversion.IsMissingKind(err) + if err == nil { + return false + } + _, ok := err.(*missingKindErr) + return ok +} + +type missingVersionErr struct { + data string } // IsMissingVersion returns true if the error indicates that the provided object // is missing a 'Versioj' field. -func IsMissingVersion(err error) bool { - return conversion.IsMissingVersion(err) +func NewMissingVersionErr(data string) error { + return &missingVersionErr{data} +} + +func (k *missingVersionErr) Error() string { + return fmt.Sprintf("Object 'apiVersion' is missing in '%s'", k.data) +} + +func IsMissingVersion(err error) bool { + if err == nil { + return false + } + _, ok := err.(*missingVersionErr) + return ok } diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/extension.go b/vendor/k8s.io/kubernetes/pkg/runtime/extension.go index 2194ea3a9..629f675b6 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/extension.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/extension.go @@ -16,7 +16,10 @@ limitations under the License. package runtime -import "errors" +import ( + "encoding/json" + "errors" +) func (re *RawExtension) UnmarshalJSON(in []byte) error { if re == nil { @@ -29,5 +32,16 @@ func (re *RawExtension) UnmarshalJSON(in []byte) error { // Marshal may get called on pointers or values, so implement MarshalJSON on value. // http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go func (re RawExtension) MarshalJSON() ([]byte, error) { + if re.RawJSON == nil { + // TODO: this is to support legacy behavior of JSONPrinter and YAMLPrinter, which + // expect to call json.Marshal on arbitrary versioned objects (even those not in + // the scheme). pkg/kubectl/resource#AsVersionedObjects and its interaction with + // kubectl get on objects not in the scheme needs to be updated to ensure that the + // objects that are not part of the scheme are correctly put into the right form. + if re.Object != nil { + return json.Marshal(re.Object) + } + return []byte("null"), nil + } return re.RawJSON, nil } diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/helper.go b/vendor/k8s.io/kubernetes/pkg/runtime/helper.go index 4fd370ca5..4a76e81dc 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/helper.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/helper.go @@ -20,112 +20,30 @@ import ( "fmt" "reflect" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/conversion" + "k8s.io/kubernetes/pkg/util/errors" ) -// IsListType returns true if the provided Object has a slice called Items -func IsListType(obj Object) bool { - _, err := GetItemsPtr(obj) - return err == nil +type objectTyperToTyper struct { + typer ObjectTyper } -// GetItemsPtr returns a pointer to the list object's Items member. -// If 'list' doesn't have an Items member, it's not really a list type -// and an error will be returned. -// This function will either return a pointer to a slice, or an error, but not both. -func GetItemsPtr(list Object) (interface{}, error) { - v, err := conversion.EnforcePtr(list) +func (t objectTyperToTyper) ObjectKind(obj Object) (*unversioned.GroupVersionKind, bool, error) { + gvk, err := t.typer.ObjectKind(obj) if err != nil { - return nil, err + return nil, false, err } - items := v.FieldByName("Items") - if !items.IsValid() { - return nil, fmt.Errorf("no Items field in %#v", list) - } - switch items.Kind() { - case reflect.Interface, reflect.Ptr: - target := reflect.TypeOf(items.Interface()).Elem() - if target.Kind() != reflect.Slice { - return nil, fmt.Errorf("items: Expected slice, got %s", target.Kind()) - } - return items.Interface(), nil - case reflect.Slice: - return items.Addr().Interface(), nil - default: - return nil, fmt.Errorf("items: Expected slice, got %s", items.Kind()) + unversionedType, ok := t.typer.IsUnversioned(obj) + if !ok { + // ObjectTyper violates its contract + return nil, false, fmt.Errorf("typer returned a kind for %v, but then reported it was not in the scheme with IsUnversioned", reflect.TypeOf(obj)) } + return &gvk, unversionedType, nil } -// ExtractList returns obj's Items element as an array of runtime.Objects. -// Returns an error if obj is not a List type (does not have an Items member). -// TODO: move me to pkg/api/meta -func ExtractList(obj Object) ([]Object, error) { - itemsPtr, err := GetItemsPtr(obj) - if err != nil { - return nil, err - } - items, err := conversion.EnforcePtr(itemsPtr) - if err != nil { - return nil, err - } - list := make([]Object, items.Len()) - for i := range list { - raw := items.Index(i) - switch item := raw.Interface().(type) { - case Object: - list[i] = item - case RawExtension: - list[i] = &Unknown{ - RawJSON: item.RawJSON, - } - default: - var found bool - if list[i], found = raw.Addr().Interface().(Object); !found { - return nil, fmt.Errorf("%v: item[%v]: Expected object, got %#v(%s)", obj, i, raw.Interface(), raw.Kind()) - } - } - } - return list, nil -} - -// objectSliceType is the type of a slice of Objects -var objectSliceType = reflect.TypeOf([]Object{}) - -// SetList sets the given list object's Items member have the elements given in -// objects. -// Returns an error if list is not a List type (does not have an Items member), -// or if any of the objects are not of the right type. -// TODO: move me to pkg/api/meta -func SetList(list Object, objects []Object) error { - itemsPtr, err := GetItemsPtr(list) - if err != nil { - return err - } - items, err := conversion.EnforcePtr(itemsPtr) - if err != nil { - return err - } - if items.Type() == objectSliceType { - items.Set(reflect.ValueOf(objects)) - return nil - } - slice := reflect.MakeSlice(items.Type(), len(objects), len(objects)) - for i := range objects { - dest := slice.Index(i) - src, err := conversion.EnforcePtr(objects[i]) - if err != nil { - return err - } - if src.Type().AssignableTo(dest.Type()) { - dest.Set(src) - } else if src.Type().ConvertibleTo(dest.Type()) { - dest.Set(src.Convert(dest.Type())) - } else { - return fmt.Errorf("item[%d]: Type mismatch: Expected %v, got %v", i, dest.Type(), src.Type()) - } - } - items.Set(slice) - return nil +func ObjectTyperToTyper(typer ObjectTyper) Typer { + return objectTyperToTyper{typer: typer} } // fieldPtr puts the address of fieldName, which must be a member of v, @@ -152,26 +70,56 @@ func FieldPtr(v reflect.Value, fieldName string, dest interface{}) error { return fmt.Errorf("couldn't assign/convert %v to %v", field.Type(), v.Type()) } +// EncodeList ensures that each object in an array is converted to a Unknown{} in serialized form. +// TODO: accept a content type. +func EncodeList(e Encoder, objects []Object, overrides ...unversioned.GroupVersion) error { + var errs []error + for i := range objects { + data, err := Encode(e, objects[i], overrides...) + if err != nil { + errs = append(errs, err) + continue + } + objects[i] = &Unknown{RawJSON: data} + } + return errors.NewAggregate(errs) +} + +func decodeListItem(obj *Unknown, decoders []Decoder) (Object, error) { + for _, decoder := range decoders { + obj, err := Decode(decoder, obj.RawJSON) + if err != nil { + if IsNotRegisteredError(err) { + continue + } + return nil, err + } + return obj, nil + } + // could not decode, so leave the object as Unknown, but give the decoders the + // chance to set Unknown.TypeMeta if it is available. + for _, decoder := range decoders { + if err := DecodeInto(decoder, obj.RawJSON, obj); err == nil { + return obj, nil + } + } + return obj, nil +} + // DecodeList alters the list in place, attempting to decode any objects found in -// the list that have the runtime.Unknown type. Any errors that occur are returned +// the list that have the Unknown type. Any errors that occur are returned // after the entire list is processed. Decoders are tried in order. -func DecodeList(objects []Object, decoders ...ObjectDecoder) []error { +func DecodeList(objects []Object, decoders ...Decoder) []error { errs := []error(nil) for i, obj := range objects { switch t := obj.(type) { case *Unknown: - for _, decoder := range decoders { - if !decoder.Recognizes(t.APIVersion, t.Kind) { - continue - } - obj, err := decoder.Decode(t.RawJSON) - if err != nil { - errs = append(errs, err) - break - } - objects[i] = obj + decoded, err := decodeListItem(t, decoders) + if err != nil { + errs = append(errs, err) break } + objects[i] = decoded } } return errs @@ -182,9 +130,9 @@ type MultiObjectTyper []ObjectTyper var _ ObjectTyper = MultiObjectTyper{} -func (m MultiObjectTyper) DataVersionAndKind(data []byte) (version, kind string, err error) { +func (m MultiObjectTyper) ObjectKind(obj Object) (gvk unversioned.GroupVersionKind, err error) { for _, t := range m { - version, kind, err = t.DataVersionAndKind(data) + gvk, err = t.ObjectKind(obj) if err == nil { return } @@ -192,9 +140,9 @@ func (m MultiObjectTyper) DataVersionAndKind(data []byte) (version, kind string, return } -func (m MultiObjectTyper) ObjectVersionAndKind(obj Object) (version, kind string, err error) { +func (m MultiObjectTyper) ObjectKinds(obj Object) (gvks []unversioned.GroupVersionKind, err error) { for _, t := range m { - version, kind, err = t.ObjectVersionAndKind(obj) + gvks, err = t.ObjectKinds(obj) if err == nil { return } @@ -202,11 +150,20 @@ func (m MultiObjectTyper) ObjectVersionAndKind(obj Object) (version, kind string return } -func (m MultiObjectTyper) Recognizes(version, kind string) bool { +func (m MultiObjectTyper) Recognizes(gvk unversioned.GroupVersionKind) bool { for _, t := range m { - if t.Recognizes(version, kind) { + if t.Recognizes(gvk) { return true } } return false } + +func (m MultiObjectTyper) IsUnversioned(obj Object) (bool, bool) { + for _, t := range m { + if unversioned, ok := t.IsUnversioned(obj); ok { + return unversioned, true + } + } + return false, false +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/helper_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/helper_test.go index fc5810b9b..be7f0dedd 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/helper_test.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/helper_test.go @@ -17,222 +17,25 @@ limitations under the License. package runtime_test import ( - "reflect" "testing" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" - - "github.com/google/gofuzz" ) -func TestIsList(t *testing.T) { - tests := []struct { - obj runtime.Object - isList bool - }{ - {&api.PodList{}, true}, - {&api.Pod{}, false}, - } - for _, item := range tests { - if e, a := item.isList, runtime.IsListType(item.obj); e != a { - t.Errorf("%v: Expected %v, got %v", reflect.TypeOf(item.obj), e, a) - } - } -} - -func TestExtractList(t *testing.T) { - pl := &api.PodList{ - Items: []api.Pod{ - {ObjectMeta: api.ObjectMeta{Name: "1"}}, - {ObjectMeta: api.ObjectMeta{Name: "2"}}, - {ObjectMeta: api.ObjectMeta{Name: "3"}}, - }, - } - list, err := runtime.ExtractList(pl) - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - if e, a := len(list), len(pl.Items); e != a { - t.Fatalf("Expected %v, got %v", e, a) - } - for i := range list { - if e, a := list[i].(*api.Pod).Name, pl.Items[i].Name; e != a { - t.Fatalf("Expected %v, got %v", e, a) - } - } -} - -func TestExtractListGeneric(t *testing.T) { - pl := &api.List{ - Items: []runtime.Object{ - &api.Pod{ObjectMeta: api.ObjectMeta{Name: "1"}}, - &api.Service{ObjectMeta: api.ObjectMeta{Name: "2"}}, - }, - } - list, err := runtime.ExtractList(pl) - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - if e, a := len(list), len(pl.Items); e != a { - t.Fatalf("Expected %v, got %v", e, a) - } - if obj, ok := list[0].(*api.Pod); !ok { - t.Fatalf("Expected list[0] to be *api.Pod, it is %#v", obj) - } - if obj, ok := list[1].(*api.Service); !ok { - t.Fatalf("Expected list[1] to be *api.Service, it is %#v", obj) - } -} - -func TestExtractListGenericV1(t *testing.T) { - pl := &v1.List{ - Items: []runtime.RawExtension{ - {RawJSON: []byte("foo")}, - {RawJSON: []byte("bar")}, - }, - } - list, err := runtime.ExtractList(pl) - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - if e, a := len(list), len(pl.Items); e != a { - t.Fatalf("Expected %v, got %v", e, a) - } - if obj, ok := list[0].(*runtime.Unknown); !ok { - t.Fatalf("Expected list[0] to be *runtime.Unknown, it is %#v", obj) - } - if obj, ok := list[1].(*runtime.Unknown); !ok { - t.Fatalf("Expected list[1] to be *runtime.Unknown, it is %#v", obj) - } -} - -type fakePtrInterfaceList struct { - Items *[]runtime.Object -} - -func (f fakePtrInterfaceList) IsAnAPIObject() {} - -func TestExtractListOfInterfacePtrs(t *testing.T) { - pl := &fakePtrInterfaceList{ - Items: &[]runtime.Object{}, - } - list, err := runtime.ExtractList(pl) - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - if len(list) > 0 { - t.Fatalf("Expected empty list, got %#v", list) - } -} - -type fakePtrValueList struct { - Items []*api.Pod -} - -func (f fakePtrValueList) IsAnAPIObject() {} - -func TestExtractListOfValuePtrs(t *testing.T) { - pl := &fakePtrValueList{ - Items: []*api.Pod{ - {ObjectMeta: api.ObjectMeta{Name: "1"}}, - {ObjectMeta: api.ObjectMeta{Name: "2"}}, - }, - } - list, err := runtime.ExtractList(pl) - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - if e, a := len(list), len(pl.Items); e != a { - t.Fatalf("Expected %v, got %v", e, a) - } - for i := range list { - if obj, ok := list[i].(*api.Pod); !ok { - t.Fatalf("Expected list[%d] to be *api.Pod, it is %#v", i, obj) - } - } -} - func TestDecodeList(t *testing.T) { pl := &api.List{ Items: []runtime.Object{ &api.Pod{ObjectMeta: api.ObjectMeta{Name: "1"}}, - &runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "Pod", APIVersion: testapi.Default.Version()}, RawJSON: []byte(`{"kind":"Pod","apiVersion":"` + testapi.Default.Version() + `","metadata":{"name":"test"}}`)}, + &runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "Pod", APIVersion: testapi.Default.GroupVersion().String()}, RawJSON: []byte(`{"kind":"Pod","apiVersion":"` + testapi.Default.GroupVersion().String() + `","metadata":{"name":"test"}}`)}, &runtime.Unstructured{TypeMeta: runtime.TypeMeta{Kind: "Foo", APIVersion: "Bar"}, Object: map[string]interface{}{"test": "value"}}, }, } - if errs := runtime.DecodeList(pl.Items, api.Scheme); len(errs) != 0 { + if errs := runtime.DecodeList(pl.Items, testapi.Default.Codec()); len(errs) != 0 { t.Fatalf("unexpected error %v", errs) } if pod, ok := pl.Items[1].(*api.Pod); !ok || pod.Name != "test" { t.Errorf("object not converted: %#v", pl.Items[1]) } } - -func TestSetList(t *testing.T) { - pl := &api.PodList{} - list := []runtime.Object{ - &api.Pod{ObjectMeta: api.ObjectMeta{Name: "1"}}, - &api.Pod{ObjectMeta: api.ObjectMeta{Name: "2"}}, - &api.Pod{ObjectMeta: api.ObjectMeta{Name: "3"}}, - } - err := runtime.SetList(pl, list) - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - if e, a := len(list), len(pl.Items); e != a { - t.Fatalf("Expected %v, got %v", e, a) - } - for i := range list { - if e, a := list[i].(*api.Pod).Name, pl.Items[i].Name; e != a { - t.Fatalf("Expected %v, got %v", e, a) - } - } -} - -func TestSetListToRuntimeObjectArray(t *testing.T) { - pl := &api.List{} - list := []runtime.Object{ - &api.Pod{ObjectMeta: api.ObjectMeta{Name: "1"}}, - &api.Pod{ObjectMeta: api.ObjectMeta{Name: "2"}}, - &api.Pod{ObjectMeta: api.ObjectMeta{Name: "3"}}, - } - err := runtime.SetList(pl, list) - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - if e, a := len(list), len(pl.Items); e != a { - t.Fatalf("Expected %v, got %v", e, a) - } - for i := range list { - if e, a := list[i], pl.Items[i]; e != a { - t.Fatalf("%d: unmatched: %s", i, util.ObjectDiff(e, a)) - } - } -} - -func TestSetExtractListRoundTrip(t *testing.T) { - fuzzer := fuzz.New().NilChance(0).NumElements(1, 5) - for i := 0; i < 5; i++ { - start := &api.PodList{} - fuzzer.Fuzz(&start.Items) - - list, err := runtime.ExtractList(start) - if err != nil { - t.Errorf("Unexpected error %v", err) - continue - } - got := &api.PodList{} - err = runtime.SetList(got, list) - if err != nil { - t.Errorf("Unexpected error %v", err) - continue - } - if e, a := start, got; !reflect.DeepEqual(e, a) { - t.Fatalf("Expected %#v, got %#v", e, a) - } - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/interfaces.go b/vendor/k8s.io/kubernetes/pkg/runtime/interfaces.go index 12f65f8c8..67b37b440 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/interfaces.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/interfaces.go @@ -18,66 +18,91 @@ package runtime import ( "io" + "net/url" + + "k8s.io/kubernetes/pkg/api/unversioned" ) -// ObjectScheme represents common conversions between formal external API versions -// and the internal Go structs. ObjectScheme is typically used with ObjectCodec to -// transform internal Go structs into serialized versions. There may be many valid -// ObjectCodecs for each ObjectScheme. -type ObjectScheme interface { - ObjectConvertor - ObjectTyper - ObjectCreater - ObjectCopier +const ( + // APIVersionInternal may be used if you are registering a type that should not + // be considered stable or serialized - it is a convention only and has no + // special behavior in this package. + APIVersionInternal = "__internal" +) + +// Typer retrieves information about an object's group, version, and kind. +type Typer interface { + // ObjectKind returns the version and kind of the provided object, or an + // error if the object is not recognized (IsNotRegisteredError will return true). + // It returns whether the object is considered unversioned at the same time. + // TODO: align the signature of ObjectTyper with this interface + ObjectKind(Object) (*unversioned.GroupVersionKind, bool, error) } -// ObjectCodec represents the common mechanisms for converting to and from a particular -// binary representation of an object. -type ObjectCodec interface { - ObjectEncoder - Decoder -} - -// Decoder defines methods for deserializing API objects into a given type -type Decoder interface { - Decode(data []byte) (Object, error) - DecodeToVersion(data []byte, version string) (Object, error) - DecodeInto(data []byte, obj Object) error - DecodeIntoWithSpecifiedVersionKind(data []byte, obj Object, kind, version string) error -} - -// Encoder defines methods for serializing API objects into bytes type Encoder interface { - Encode(obj Object) (data []byte, err error) - EncodeToStream(obj Object, stream io.Writer) error + // EncodeToStream writes an object to a stream. Override versions may be provided for each group + // that enforce a certain versioning. Implementations may return errors if the versions are incompatible, + // or if no conversion is defined. + EncodeToStream(obj Object, stream io.Writer, overrides ...unversioned.GroupVersion) error } -// Codec defines methods for serializing and deserializing API objects. -type Codec interface { - Decoder +type Decoder interface { + // Decode attempts to deserialize the provided data using either the innate typing of the scheme or the + // default kind, group, and version provided. It returns a decoded object as well as the kind, group, and + // version from the serialized data, or an error. If into is non-nil, it will be used as the target type + // and implementations may choose to use it rather than reallocating an object. However, the object is not + // guaranteed to be populated. The returned object is not guaranteed to match into. If defaults are + // provided, they are applied to the data by default. If no defaults or partial defaults are provided, the + // type of the into may be used to guide conversion decisions. + Decode(data []byte, defaults *unversioned.GroupVersionKind, into Object) (Object, *unversioned.GroupVersionKind, error) +} + +// Serializer is the core interface for transforming objects into a serialized format and back. +// Implementations may choose to perform conversion of the object, but no assumptions should be made. +type Serializer interface { Encoder + Decoder } -// ObjectCopier duplicates an object. -type ObjectCopier interface { - // Copy returns an exact copy of the provided Object, or an error if the - // copy could not be completed. - Copy(Object) (Object, error) +// Codec is a Serializer that deals with the details of versioning objects. It offers the same +// interface as Serializer, so this is a marker to consumers that care about the version of the objects +// they receive. +type Codec Serializer + +// ParameterCodec defines methods for serializing and deserializing API objects to url.Values and +// performing any necessary conversion. Unlike the normal Codec, query parameters are not self describing +// and the desired version must be specified. +type ParameterCodec interface { + // DecodeParameters takes the given url.Values in the specified group version and decodes them + // into the provided object, or returns an error. + DecodeParameters(parameters url.Values, from unversioned.GroupVersion, into Object) error + // EncodeParameters encodes the provided object as query parameters or returns an error. + EncodeParameters(obj Object, to unversioned.GroupVersion) (url.Values, error) } -// ObjectEncoder turns an object into a byte array. This interface is a -// general form of the Encoder interface -type ObjectEncoder interface { - // EncodeToVersion convert and serializes an object in the internal format - // to a specified output version. An error is returned if the object - // cannot be converted for any reason. - EncodeToVersion(obj Object, outVersion string) ([]byte, error) - EncodeToVersionStream(obj Object, outVersion string, stream io.Writer) error +// NegotiatedSerializer is an interface used for obtaining encoders, decoders, and serializers +// for multiple supported media types. +type NegotiatedSerializer interface { + SupportedMediaTypes() []string + SerializerForMediaType(mediaType string, options map[string]string) (Serializer, bool) + EncoderForVersion(serializer Serializer, gv unversioned.GroupVersion) Encoder + DecoderToVersion(serializer Serializer, gv unversioned.GroupVersion) Decoder +} + +/////////////////////////////////////////////////////////////////////////////// +// Non-codec interfaces + +type ObjectVersioner interface { + ConvertToVersion(in Object, outVersion string) (out Object, err error) } // ObjectConvertor converts an object to a different version. type ObjectConvertor interface { + // Convert attempts to convert one object into another, or returns an error. This method does + // not guarantee the in object is not mutated. Convert(in, out interface{}) error + // ConvertToVersion takes the provided object and converts it the provided version. This + // method does not guarantee that the in object is not mutated. ConvertToVersion(in Object, outVersion string) (out Object, err error) ConvertFieldLabel(version, kind, label, value string) (string, string, error) } @@ -85,36 +110,32 @@ type ObjectConvertor interface { // ObjectTyper contains methods for extracting the APIVersion and Kind // of objects. type ObjectTyper interface { - // DataVersionAndKind returns the version and kind of the provided data, or an error - // if another problem is detected. In many cases this method can be as expensive to - // invoke as the Decode method. - DataVersionAndKind([]byte) (version, kind string, err error) - // ObjectVersionAndKind returns the version and kind of the provided object, or an + // ObjectKind returns the default group,version,kind of the provided object, or an // error if the object is not recognized (IsNotRegisteredError will return true). - ObjectVersionAndKind(Object) (version, kind string, err error) + ObjectKind(Object) (unversioned.GroupVersionKind, error) + // ObjectKinds returns the all possible group,version,kind of the provided object, or an + // error if the object is not recognized (IsNotRegisteredError will return true). + ObjectKinds(Object) ([]unversioned.GroupVersionKind, error) // Recognizes returns true if the scheme is able to handle the provided version and kind, // or more precisely that the provided version is a possible conversion or decoding // target. - Recognizes(version, kind string) bool + Recognizes(gvk unversioned.GroupVersionKind) bool + // IsUnversioned returns true if the provided object is considered unversioned and thus + // should have Version and Group suppressed in the output. If the object is not recognized + // in the scheme, ok is false. + IsUnversioned(Object) (unversioned bool, ok bool) } // ObjectCreater contains methods for instantiating an object by kind and version. type ObjectCreater interface { - New(version, kind string) (out Object, err error) + New(kind unversioned.GroupVersionKind) (out Object, err error) } -// ObjectDecoder is a convenience interface for identifying serialized versions of objects -// and transforming them into Objects. It intentionally overlaps with ObjectTyper and -// Decoder for use in decode only paths. -type ObjectDecoder interface { - Decoder - // DataVersionAndKind returns the version and kind of the provided data, or an error - // if another problem is detected. In many cases this method can be as expensive to - // invoke as the Decode method. - DataVersionAndKind([]byte) (version, kind string, err error) - // Recognizes returns true if the scheme is able to handle the provided version and kind - // of an object. - Recognizes(version, kind string) bool +// ObjectCopier duplicates an object. +type ObjectCopier interface { + // Copy returns an exact copy of the provided Object, or an error if the + // copy could not be completed. + Copy(Object) (Object, error) } // ResourceVersioner provides methods for setting and retrieving @@ -135,11 +156,10 @@ type SelfLinker interface { Namespace(obj Object) (string, error) } -// All api types must support the Object interface. It's deliberately tiny so that this is not an onerous -// burden. Implement it with a pointer receiver; this will allow us to use the go compiler to check the -// one thing about our objects that it's capable of checking for us. +// All API types registered with Scheme must support the Object interface. Since objects in a scheme are +// expected to be serialized to the wire, the interface an Object must provide to the Scheme allows +// serializers to set the kind, version, and group the object is represented as. An Object may choose +// to return a no-op ObjectKindAccessor in cases where it is not expected to be serialized. type Object interface { - // This function is used only to enforce membership. It's never called. - // TODO: Consider mass rename in the future to make it do something useful. - IsAnAPIObject() + GetObjectKind() unversioned.ObjectKind } diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/protobuf/doc.go b/vendor/k8s.io/kubernetes/pkg/runtime/protobuf/doc.go new file mode 100644 index 000000000..33316d0c4 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/protobuf/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package protobuf implements ProtoBuf serialization and deserialization. +package protobuf diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/protobuf/protobuf.go b/vendor/k8s.io/kubernetes/pkg/runtime/protobuf/protobuf.go new file mode 100644 index 000000000..cc050a50b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/protobuf/protobuf.go @@ -0,0 +1,158 @@ +// +build proto + +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package protobuf + +import ( + "fmt" + "io" + "net/url" + "reflect" + + "github.com/gogo/protobuf/proto" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +// NewCodec +func NewCodec(version string, creater runtime.ObjectCreater, typer runtime.ObjectTyper, convertor runtime.ObjectConvertor) runtime.Codec { + return &codec{ + version: version, + creater: creater, + typer: typer, + convertor: convertor, + } +} + +// codec decodes protobuf objects +type codec struct { + version string + outputVersion string + creater runtime.ObjectCreater + typer runtime.ObjectTyper + convertor runtime.ObjectConvertor +} + +var _ runtime.Codec = codec{} + +func (c codec) Decode(data []byte) (runtime.Object, error) { + unknown := &runtime.Unknown{} + if err := proto.Unmarshal(data, unknown); err != nil { + return nil, err + } + obj, err := c.creater.New(unknown.APIVersion, unknown.Kind) + if err != nil { + return nil, err + } + pobj, ok := obj.(proto.Message) + if !ok { + return nil, fmt.Errorf("runtime object is not a proto.Message: %v", reflect.TypeOf(obj)) + } + if err := proto.Unmarshal(unknown.RawJSON, pobj); err != nil { + return nil, err + } + if unknown.APIVersion != c.outputVersion { + out, err := c.convertor.ConvertToVersion(obj, c.outputVersion) + if err != nil { + return nil, err + } + obj = out + } + return obj, nil +} + +func (c codec) DecodeToVersion(data []byte, version unversioned.GroupVersion) (runtime.Object, error) { + return nil, fmt.Errorf("unimplemented") +} + +func (c codec) DecodeInto(data []byte, obj runtime.Object) error { + version, kind, err := c.typer.ObjectVersionAndKind(obj) + if err != nil { + return err + } + unknown := &runtime.Unknown{} + if err := proto.Unmarshal(data, unknown); err != nil { + return err + } + if unknown.APIVersion == version && unknown.Kind == kind { + pobj, ok := obj.(proto.Message) + if !ok { + return fmt.Errorf("runtime object is not a proto.Message: %v", reflect.TypeOf(obj)) + } + + return proto.Unmarshal(unknown.RawJSON, pobj) + } + + versioned, err := c.creater.New(unknown.APIVersion, unknown.Kind) + if err != nil { + return err + } + + pobj, ok := versioned.(proto.Message) + if !ok { + return fmt.Errorf("runtime object is not a proto.Message: %v", reflect.TypeOf(obj)) + } + + if err := proto.Unmarshal(unknown.RawJSON, pobj); err != nil { + return err + } + return c.convertor.Convert(versioned, obj) +} + +func (c codec) DecodeIntoWithSpecifiedVersionKind(data []byte, obj runtime.Object, kind unversioned.GroupVersionKind) error { + return fmt.Errorf("unimplemented") +} + +func (c codec) DecodeParametersInto(parameters url.Values, obj runtime.Object) error { + return fmt.Errorf("unimplemented") +} + +func (c codec) Encode(obj runtime.Object) (data []byte, err error) { + version, kind, err := c.typer.ObjectVersionAndKind(obj) + if err != nil { + return nil, err + } + if len(version) == 0 { + version = c.version + converted, err := c.convertor.ConvertToVersion(obj, version) + if err != nil { + return nil, err + } + obj = converted + } + m, ok := obj.(proto.Marshaler) + if !ok { + return nil, fmt.Errorf("object %v (kind: %s in version: %s) does not implement ProtoBuf marshalling", reflect.TypeOf(obj), kind, c.version) + } + b, err := m.Marshal() + if err != nil { + return nil, err + } + return (&runtime.Unknown{ + TypeMeta: runtime.TypeMeta{ + Kind: kind, + APIVersion: version, + }, + RawJSON: b, + }).Marshal() +} + +func (c codec) EncodeToStream(obj runtime.Object, stream io.Writer) error { + return fmt.Errorf("unimplemented") +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/register.go b/vendor/k8s.io/kubernetes/pkg/runtime/register.go new file mode 100644 index 000000000..95244913c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/register.go @@ -0,0 +1,64 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package runtime + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" +) + +// SetGroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta +func (obj *TypeMeta) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() +} + +// GroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta +func (obj *TypeMeta) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) +} + +func (obj *Unknown) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *Unstructured) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } + +// GetObjectKind implements Object for VersionedObjects, returning an empty ObjectKind +// interface if no objects are provided, or the ObjectKind interface of the object in the +// highest array position. +func (obj *VersionedObjects) GetObjectKind() unversioned.ObjectKind { + last := obj.Last() + if last == nil { + return unversioned.EmptyObjectKind + } + return last.GetObjectKind() +} + +// First returns the leftmost object in the VersionedObjects array, which is usually the +// object as serialized on the wire. +func (obj *VersionedObjects) First() Object { + if len(obj.Objects) == 0 { + return nil + } + return obj.Objects[0] +} + +// Last is the rightmost object in the VersionedObjects array, which is the object after +// all transformations have been applied. This is the same object that would be returned +// by Decode in a normal invocation (without VersionedObjects in the into argument). +func (obj *VersionedObjects) Last() Object { + if len(obj.Objects) == 0 { + return nil + } + return obj.Objects[len(obj.Objects)-1] +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/scheme.go b/vendor/k8s.io/kubernetes/pkg/runtime/scheme.go index 0a2bf47c3..37bd985aa 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/scheme.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/scheme.go @@ -17,322 +17,347 @@ limitations under the License. package runtime import ( - "encoding/json" "fmt" - "io" "net/url" "reflect" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/conversion" ) -// Scheme defines methods for serializing and deserializing API objects. It -// is an adaptation of conversion's Scheme for our API objects. +// Scheme defines methods for serializing and deserializing API objects, a type +// registry for converting group, version, and kind information to and from Go +// schemas, and mappings between Go schemas of different versions. A scheme is the +// foundation for a versioned API and versioned configuration over time. +// +// In a Scheme, a Type is a particular Go struct, a Version is a point-in-time +// identifier for a particular representation of that Type (typically backwards +// compatible), a Kind is the unique name for that Type within the Version, and a +// Group identifies a set of Versions, Kinds, and Types that evolve over time. An +// Unversioned Type is one that is not yet formally bound to a type and is promised +// to be backwards compatible (effectively a "v1" of a Type that does not expect +// to break in the future). +// +// Schemes are not expected to change at runtime and are only threadsafe after +// registration is complete. type Scheme struct { - raw *conversion.Scheme + // versionMap allows one to figure out the go type of an object with + // the given version and name. + gvkToType map[unversioned.GroupVersionKind]reflect.Type + + // typeToGroupVersion allows one to find metadata for a given go object. + // The reflect.Type we index by should *not* be a pointer. + typeToGVK map[reflect.Type][]unversioned.GroupVersionKind + + // unversionedTypes are transformed without conversion in ConvertToVersion. + unversionedTypes map[reflect.Type]unversioned.GroupVersionKind + + // unversionedKinds are the names of kinds that can be created in the context of any group + // or version + // TODO: resolve the status of unversioned types. + unversionedKinds map[string]reflect.Type + // Map from version and resource to the corresponding func to convert // resource field labels in that version to internal version. fieldLabelConversionFuncs map[string]map[string]FieldLabelConversionFunc + + // converter stores all registered conversion functions. It also has + // default coverting behavior. + converter *conversion.Converter + + // cloner stores all registered copy functions. It also has default + // deep copy behavior. + cloner *conversion.Cloner } // Function to convert a field selector to internal representation. type FieldLabelConversionFunc func(label, value string) (internalLabel, internalValue string, err error) -func (self *Scheme) Raw() *conversion.Scheme { - return self.raw -} - -// fromScope gets the input version, desired output version, and desired Scheme -// from a conversion.Scope. -func (self *Scheme) fromScope(s conversion.Scope) (inVersion, outVersion string, scheme *Scheme) { - scheme = self - inVersion = s.Meta().SrcVersion - outVersion = s.Meta().DestVersion - return inVersion, outVersion, scheme -} - -// emptyPlugin is used to copy the Kind field to and from plugin objects. -type emptyPlugin struct { - PluginBase `json:",inline"` -} - -// embeddedObjectToRawExtension does the conversion you would expect from the name, using the information -// given in conversion.Scope. It's placed in the DefaultScheme as a ConversionFunc to enable plugins; -// see the comment for RawExtension. -func (self *Scheme) embeddedObjectToRawExtension(in *EmbeddedObject, out *RawExtension, s conversion.Scope) error { - if in.Object == nil { - out.RawJSON = []byte("null") - return nil - } - - // Figure out the type and kind of the output object. - _, outVersion, scheme := self.fromScope(s) - _, kind, err := scheme.raw.ObjectVersionAndKind(in.Object) - if err != nil { - return err - } - - // Manufacture an object of this type and kind. - outObj, err := scheme.New(outVersion, kind) - if err != nil { - return err - } - - // Manually do the conversion. - err = s.Convert(in.Object, outObj, 0) - if err != nil { - return err - } - - // Copy the kind field into the output object. - err = s.Convert( - &emptyPlugin{PluginBase: PluginBase{Kind: kind}}, - outObj, - conversion.SourceToDest|conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames, - ) - if err != nil { - return err - } - // Because we provide the correct version, EncodeToVersion will not attempt a conversion. - raw, err := scheme.EncodeToVersion(outObj, outVersion) - if err != nil { - // TODO: if this fails, create an Unknown-- maybe some other - // component will understand it. - return err - } - out.RawJSON = raw - return nil -} - -// rawExtensionToEmbeddedObject does the conversion you would expect from the name, using the information -// given in conversion.Scope. It's placed in all schemes as a ConversionFunc to enable plugins; -// see the comment for RawExtension. -func (self *Scheme) rawExtensionToEmbeddedObject(in *RawExtension, out *EmbeddedObject, s conversion.Scope) error { - if len(in.RawJSON) == 0 || (len(in.RawJSON) == 4 && string(in.RawJSON) == "null") { - out.Object = nil - return nil - } - // Figure out the type and kind of the output object. - inVersion, outVersion, scheme := self.fromScope(s) - _, kind, err := scheme.raw.DataVersionAndKind(in.RawJSON) - if err != nil { - return err - } - - // We have to make this object ourselves because we don't store the version field for - // plugin objects. - inObj, err := scheme.New(inVersion, kind) - if err != nil { - return err - } - - err = scheme.DecodeInto(in.RawJSON, inObj) - if err != nil { - return err - } - - // Make the desired internal version, and do the conversion. - outObj, err := scheme.New(outVersion, kind) - if err != nil { - return err - } - err = scheme.Convert(inObj, outObj) - if err != nil { - return err - } - // Last step, clear the Kind field; that should always be blank in memory. - err = s.Convert( - &emptyPlugin{PluginBase: PluginBase{Kind: ""}}, - outObj, - conversion.SourceToDest|conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames, - ) - if err != nil { - return err - } - out.Object = outObj - return nil -} - -// runtimeObjectToRawExtensionArray takes a list of objects and encodes them as RawExtension in the output version -// defined by the conversion.Scope. If objects must be encoded to different schema versions than the default, you -// should encode them yourself with runtime.Unknown, or convert the object prior to invoking conversion. Objects -// outside of the current scheme must be added as runtime.Unknown. -func (self *Scheme) runtimeObjectToRawExtensionArray(in *[]Object, out *[]RawExtension, s conversion.Scope) error { - src := *in - dest := make([]RawExtension, len(src)) - - _, outVersion, scheme := self.fromScope(s) - - for i := range src { - switch t := src[i].(type) { - case *Unknown: - // TODO: this should be decoupled from the scheme (since it is JSON specific) - dest[i].RawJSON = t.RawJSON - case *Unstructured: - // TODO: this should be decoupled from the scheme (since it is JSON specific) - data, err := json.Marshal(t.Object) - if err != nil { - return err - } - dest[i].RawJSON = data - default: - version := outVersion - // if the object exists - if inVersion, _, err := scheme.ObjectVersionAndKind(src[i]); err == nil && len(inVersion) != 0 { - version = inVersion - } - data, err := scheme.EncodeToVersion(src[i], version) - if err != nil { - return err - } - dest[i].RawJSON = data - } - } - *out = dest - return nil -} - -// rawExtensionToRuntimeObjectArray attempts to decode objects from the array - if they are unrecognized objects, -// they are added as Unknown. -func (self *Scheme) rawExtensionToRuntimeObjectArray(in *[]RawExtension, out *[]Object, s conversion.Scope) error { - src := *in - dest := make([]Object, len(src)) - - _, _, scheme := self.fromScope(s) - - for i := range src { - data := src[i].RawJSON - version, kind, err := scheme.raw.DataVersionAndKind(data) - if err != nil { - return err - } - dest[i] = &Unknown{ - TypeMeta: TypeMeta{ - APIVersion: version, - Kind: kind, - }, - RawJSON: data, - } - } - *out = dest - return nil -} - // NewScheme creates a new Scheme. This scheme is pluggable by default. func NewScheme() *Scheme { - s := &Scheme{conversion.NewScheme(), map[string]map[string]FieldLabelConversionFunc{}} - s.raw.InternalVersion = "" - s.raw.MetaFactory = conversion.SimpleMetaFactory{BaseFields: []string{"TypeMeta"}, VersionField: "APIVersion", KindField: "Kind"} - if err := s.raw.AddConversionFuncs( - s.embeddedObjectToRawExtension, - s.rawExtensionToEmbeddedObject, - s.runtimeObjectToRawExtensionArray, - s.rawExtensionToRuntimeObjectArray, - ); err != nil { - panic(err) + s := &Scheme{ + gvkToType: map[unversioned.GroupVersionKind]reflect.Type{}, + typeToGVK: map[reflect.Type][]unversioned.GroupVersionKind{}, + unversionedTypes: map[reflect.Type]unversioned.GroupVersionKind{}, + unversionedKinds: map[string]reflect.Type{}, + cloner: conversion.NewCloner(), + fieldLabelConversionFuncs: map[string]map[string]FieldLabelConversionFunc{}, } + s.converter = conversion.NewConverter(s.nameFunc) + + s.AddConversionFuncs(DefaultEmbeddedConversions()...) + // Enable map[string][]string conversions by default - if err := s.raw.AddConversionFuncs(DefaultStringConversions...); err != nil { + if err := s.AddConversionFuncs(DefaultStringConversions...); err != nil { panic(err) } - if err := s.raw.RegisterInputDefaults(&map[string][]string{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields); err != nil { + if err := s.RegisterInputDefaults(&map[string][]string{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields); err != nil { panic(err) } - if err := s.raw.RegisterInputDefaults(&url.Values{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields); err != nil { + if err := s.RegisterInputDefaults(&url.Values{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields); err != nil { panic(err) } return s } -// AddKnownTypes registers the types of the arguments to the marshaller of the package api. -// Encode() refuses the object unless its type is registered with AddKnownTypes. -func (s *Scheme) AddKnownTypes(version string, types ...Object) { - interfaces := make([]interface{}, len(types)) - for i := range types { - interfaces[i] = types[i] +// nameFunc returns the name of the type that we wish to use to determine when two types attempt +// a conversion. Defaults to the go name of the type if the type is not registered. +func (s *Scheme) nameFunc(t reflect.Type) string { + // find the preferred names for this type + gvks, ok := s.typeToGVK[t] + if !ok { + return t.Name() + } + + for _, gvk := range gvks { + internalGV := gvk.GroupVersion() + internalGV.Version = "__internal" // this is hacky and maybe should be passed in + internalGVK := internalGV.WithKind(gvk.Kind) + + if internalType, exists := s.gvkToType[internalGVK]; exists { + return s.typeToGVK[internalType][0].Kind + } + } + + return gvks[0].Kind +} + +// fromScope gets the input version, desired output version, and desired Scheme +// from a conversion.Scope. +func (s *Scheme) fromScope(scope conversion.Scope) (inVersion, outVersion string, scheme *Scheme) { + scheme = s + inVersion = scope.Meta().SrcVersion + outVersion = scope.Meta().DestVersion + return inVersion, outVersion, scheme +} + +// Converter allows access to the converter for the scheme +func (s *Scheme) Converter() *conversion.Converter { + return s.converter +} + +// AddUnversionedTypes registers the provided types as "unversioned", which means that they follow special rules. +// Whenever an object of this type is serialized, it is serialized with the provided group version and is not +// converted. Thus unversioned objects are expected to remain backwards compatible forever, as if they were in an +// API group and version that would never be updated. +// +// TODO: there is discussion about removing unversioned and replacing it with objects that are manifest into +// every version with particular schemas. Resolve tihs method at that point. +func (s *Scheme) AddUnversionedTypes(version unversioned.GroupVersion, types ...Object) { + s.AddKnownTypes(version, types...) + for _, obj := range types { + t := reflect.TypeOf(obj).Elem() + gvk := version.WithKind(t.Name()) + s.unversionedTypes[t] = gvk + if _, ok := s.unversionedKinds[gvk.Kind]; ok { + panic(fmt.Sprintf("%v has already been registered as unversioned kind %q - kind name must be unique", reflect.TypeOf(t), gvk.Kind)) + } + s.unversionedKinds[gvk.Kind] = t + } +} + +// AddKnownTypes registers all types passed in 'types' as being members of version 'version'. +// All objects passed to types should be pointers to structs. The name that go reports for +// the struct becomes the "kind" field when encoding. Version may not be empty - use the +// APIVersionInternal constant if you have a type that does not have a formal version. +func (s *Scheme) AddKnownTypes(gv unversioned.GroupVersion, types ...Object) { + if len(gv.Version) == 0 { + panic(fmt.Sprintf("version is required on all types: %s %v", gv, types[0])) + } + for _, obj := range types { + t := reflect.TypeOf(obj) + if t.Kind() != reflect.Ptr { + panic("All types must be pointers to structs.") + } + t = t.Elem() + if t.Kind() != reflect.Struct { + panic("All types must be pointers to structs.") + } + + gvk := gv.WithKind(t.Name()) + s.gvkToType[gvk] = t + s.typeToGVK[t] = append(s.typeToGVK[t], gvk) } - s.raw.AddKnownTypes(version, interfaces...) } // AddKnownTypeWithName is like AddKnownTypes, but it lets you specify what this type should // be encoded as. Useful for testing when you don't want to make multiple packages to define -// your structs. -func (s *Scheme) AddKnownTypeWithName(version, kind string, obj Object) { - s.raw.AddKnownTypeWithName(version, kind, obj) +// your structs. Version may not be empty - use the APIVersionInternal constant if you have a +// type that does not have a formal version. +func (s *Scheme) AddKnownTypeWithName(gvk unversioned.GroupVersionKind, obj Object) { + t := reflect.TypeOf(obj) + if len(gvk.Version) == 0 { + panic(fmt.Sprintf("version is required on all types: %s %v", gvk, t)) + } + if t.Kind() != reflect.Ptr { + panic("All types must be pointers to structs.") + } + t = t.Elem() + if t.Kind() != reflect.Struct { + panic("All types must be pointers to structs.") + } + + s.gvkToType[gvk] = t + s.typeToGVK[t] = append(s.typeToGVK[t], gvk) } // KnownTypes returns the types known for the given version. -// Return value must be treated as read-only. -func (s *Scheme) KnownTypes(version string) map[string]reflect.Type { - return s.raw.KnownTypes(version) +func (s *Scheme) KnownTypes(gv unversioned.GroupVersion) map[string]reflect.Type { + types := make(map[string]reflect.Type) + for gvk, t := range s.gvkToType { + if gv != gvk.GroupVersion() { + continue + } + + types[gvk.Kind] = t + } + return types } -// DataVersionAndKind will return the APIVersion and Kind of the given wire-format -// encoding of an API Object, or an error. -func (s *Scheme) DataVersionAndKind(data []byte) (version, kind string, err error) { - return s.raw.DataVersionAndKind(data) +// ObjectKind returns the group,version,kind of the go object, +// or an error if it's not a pointer or is unregistered. +func (s *Scheme) ObjectKind(obj Object) (unversioned.GroupVersionKind, error) { + gvks, err := s.ObjectKinds(obj) + if err != nil { + return unversioned.GroupVersionKind{}, err + } + return gvks[0], nil } -// ObjectVersionAndKind returns the version and kind of the given Object. -func (s *Scheme) ObjectVersionAndKind(obj Object) (version, kind string, err error) { - return s.raw.ObjectVersionAndKind(obj) -} - -// Recognizes returns true if the scheme is able to handle the provided version and kind -// of an object. -func (s *Scheme) Recognizes(version, kind string) bool { - return s.raw.Recognizes(version, kind) -} - -// New returns a new API object of the given version ("" for internal -// representation) and name, or an error if it hasn't been registered. -func (s *Scheme) New(versionName, typeName string) (Object, error) { - obj, err := s.raw.NewObject(versionName, typeName) +// ObjectKinds returns all possible group,version,kind of the go object, +// or an error if it's not a pointer or is unregistered. +func (s *Scheme) ObjectKinds(obj Object) ([]unversioned.GroupVersionKind, error) { + v, err := conversion.EnforcePtr(obj) if err != nil { return nil, err } - return obj.(Object), nil + t := v.Type() + + gvks, ok := s.typeToGVK[t] + if !ok { + return nil, ¬RegisteredErr{t: t} + } + + return gvks, nil +} + +// Recognizes returns true if the scheme is able to handle the provided group,version,kind +// of an object. +func (s *Scheme) Recognizes(gvk unversioned.GroupVersionKind) bool { + _, exists := s.gvkToType[gvk] + return exists +} + +func (s *Scheme) IsUnversioned(obj Object) (bool, bool) { + v, err := conversion.EnforcePtr(obj) + if err != nil { + return false, false + } + t := v.Type() + + if _, ok := s.typeToGVK[t]; !ok { + return false, false + } + _, ok := s.unversionedTypes[t] + return ok, true +} + +// New returns a new API object of the given version and name, or an error if it hasn't +// been registered. The version and kind fields must be specified. +func (s *Scheme) New(kind unversioned.GroupVersionKind) (Object, error) { + if t, exists := s.gvkToType[kind]; exists { + return reflect.New(t).Interface().(Object), nil + } + + if t, exists := s.unversionedKinds[kind.Kind]; exists { + return reflect.New(t).Interface().(Object), nil + } + return nil, ¬RegisteredErr{gvk: kind} } // Log sets a logger on the scheme. For test purposes only func (s *Scheme) Log(l conversion.DebugLogger) { - s.raw.Log(l) + s.converter.Debug = l } -// AddConversionFuncs adds a function to the list of conversion functions. The given -// function should know how to convert between two API objects. We deduce how to call -// it from the types of its two parameters; see the comment for -// Converter.RegisterConversionFunction. +// AddIgnoredConversionType identifies a pair of types that should be skipped by +// conversion (because the data inside them is explicitly dropped during +// conversion). +func (s *Scheme) AddIgnoredConversionType(from, to interface{}) error { + return s.converter.RegisterIgnoredConversion(from, to) +} + +// AddConversionFuncs adds functions to the list of conversion functions. The given +// functions should know how to convert between two of your API objects, or their +// sub-objects. We deduce how to call these functions from the types of their two +// parameters; see the comment for Converter.Register. // -// Note that, if you need to copy sub-objects that didn't change, it's safe to call -// Convert() inside your conversionFuncs, as long as you don't start a conversion -// chain that's infinitely recursive. +// Note that, if you need to copy sub-objects that didn't change, you can use the +// conversion.Scope object that will be passed to your conversion function. +// Additionally, all conversions started by Scheme will set the SrcVersion and +// DestVersion fields on the Meta object. Example: +// +// s.AddConversionFuncs( +// func(in *InternalObject, out *ExternalObject, scope conversion.Scope) error { +// // You can depend on Meta() being non-nil, and this being set to +// // the source version, e.g., "" +// s.Meta().SrcVersion +// // You can depend on this being set to the destination version, +// // e.g., "v1". +// s.Meta().DestVersion +// // Call scope.Convert to copy sub-fields. +// s.Convert(&in.SubFieldThatMoved, &out.NewLocation.NewName, 0) +// return nil +// }, +// ) +// +// (For more detail about conversion functions, see Converter.Register's comment.) // // Also note that the default behavior, if you don't add a conversion function, is to -// sanely copy fields that have the same names. It's OK if the destination type has -// extra fields, but it must not remove any. So you only need to add a conversion -// function for things with changed/removed fields. +// sanely copy fields that have the same names and same type names. It's OK if the +// destination type has extra fields, but it must not remove any. So you only need to +// add conversion functions for things with changed/removed fields. func (s *Scheme) AddConversionFuncs(conversionFuncs ...interface{}) error { - return s.raw.AddConversionFuncs(conversionFuncs...) + for _, f := range conversionFuncs { + if err := s.converter.RegisterConversionFunc(f); err != nil { + return err + } + } + return nil } // Similar to AddConversionFuncs, but registers conversion functions that were // automatically generated. func (s *Scheme) AddGeneratedConversionFuncs(conversionFuncs ...interface{}) error { - return s.raw.AddGeneratedConversionFuncs(conversionFuncs...) + for _, f := range conversionFuncs { + if err := s.converter.RegisterGeneratedConversionFunc(f); err != nil { + return err + } + } + return nil } // AddDeepCopyFuncs adds a function to the list of deep-copy functions. // For the expected format of deep-copy function, see the comment for // Copier.RegisterDeepCopyFunction. func (s *Scheme) AddDeepCopyFuncs(deepCopyFuncs ...interface{}) error { - return s.raw.AddDeepCopyFuncs(deepCopyFuncs...) + for _, f := range deepCopyFuncs { + if err := s.cloner.RegisterDeepCopyFunc(f); err != nil { + return err + } + } + return nil } // Similar to AddDeepCopyFuncs, but registers deep-copy functions that were // automatically generated. func (s *Scheme) AddGeneratedDeepCopyFuncs(deepCopyFuncs ...interface{}) error { - return s.raw.AddGeneratedDeepCopyFuncs(deepCopyFuncs...) + for _, f := range deepCopyFuncs { + if err := s.cloner.RegisterGeneratedDeepCopyFunc(f); err != nil { + return err + } + } + return nil } // AddFieldLabelConversionFunc adds a conversion function to convert field selectors @@ -351,26 +376,78 @@ func (s *Scheme) AddFieldLabelConversionFunc(version, kind string, conversionFun // the comment in conversion.Converter.SetStructFieldCopy for parameter details. // Call as many times as needed, even on the same fields. func (s *Scheme) AddStructFieldConversion(srcFieldType interface{}, srcFieldName string, destFieldType interface{}, destFieldName string) error { - return s.raw.AddStructFieldConversion(srcFieldType, srcFieldName, destFieldType, destFieldName) + return s.converter.SetStructFieldCopy(srcFieldType, srcFieldName, destFieldType, destFieldName) } -// AddDefaultingFuncs adds a function to the list of value-defaulting functions. -// We deduce how to call it from the types of its two parameters; see the -// comment for Converter.RegisterDefaultingFunction. +// RegisterInputDefaults sets the provided field mapping function and field matching +// as the defaults for the provided input type. The fn may be nil, in which case no +// mapping will happen by default. Use this method to register a mechanism for handling +// a specific input type in conversion, such as a map[string]string to structs. +func (s *Scheme) RegisterInputDefaults(in interface{}, fn conversion.FieldMappingFunc, defaultFlags conversion.FieldMatchingFlags) error { + return s.converter.RegisterInputDefaults(in, fn, defaultFlags) +} + +// AddDefaultingFuncs adds functions to the list of default-value functions. +// Each of the given functions is responsible for applying default values +// when converting an instance of a versioned API object into an internal +// API object. These functions do not need to handle sub-objects. We deduce +// how to call these functions from the types of their two parameters. +// +// s.AddDefaultingFuncs( +// func(obj *v1.Pod) { +// if obj.OptionalField == "" { +// obj.OptionalField = "DefaultValue" +// } +// }, +// ) func (s *Scheme) AddDefaultingFuncs(defaultingFuncs ...interface{}) error { - return s.raw.AddDefaultingFuncs(defaultingFuncs...) + for _, f := range defaultingFuncs { + err := s.converter.RegisterDefaultingFunc(f) + if err != nil { + return err + } + } + return nil +} + +// Copy does a deep copy of an API object. +func (s *Scheme) Copy(src Object) (Object, error) { + dst, err := s.DeepCopy(src) + if err != nil { + return nil, err + } + return dst.(Object), nil } // Performs a deep copy of the given object. func (s *Scheme) DeepCopy(src interface{}) (interface{}, error) { - return s.raw.DeepCopy(src) + return s.cloner.DeepCopy(src) } -// Convert will attempt to convert in into out. Both must be pointers. -// For easy testing of conversion functions. Returns an error if the conversion isn't -// possible. +// Convert will attempt to convert in into out. Both must be pointers. For easy +// testing of conversion functions. Returns an error if the conversion isn't +// possible. You can call this with types that haven't been registered (for example, +// a to test conversion of types that are nested within registered types), but in +// that case, the conversion.Scope object passed to your conversion functions won't +// have SrcVersion or DestVersion fields set correctly in Meta(). func (s *Scheme) Convert(in, out interface{}) error { - return s.raw.Convert(in, out) + inVersion := unversioned.GroupVersion{Group: "unknown", Version: "unknown"} + outVersion := unversioned.GroupVersion{Group: "unknown", Version: "unknown"} + if inObj, ok := in.(Object); ok { + if gvk, err := s.ObjectKind(inObj); err == nil { + inVersion = gvk.GroupVersion() + } + } + if outObj, ok := out.(Object); ok { + if gvk, err := s.ObjectKind(outObj); err == nil { + outVersion = gvk.GroupVersion() + } + } + flags, meta := s.generateConvertMeta(inVersion, outVersion, in) + if flags == 0 { + flags = conversion.AllowDifferentFieldTypeNames + } + return s.converter.Convert(in, out, flags, meta) } // Converts the given field label and value for an kind field selector from @@ -390,109 +467,75 @@ func (s *Scheme) ConvertFieldLabel(version, kind, label, value string) (string, // version within this scheme. Will return an error if the provided version does not // contain the inKind (or a mapping by name defined with AddKnownTypeWithName). Will also // return an error if the conversion does not result in a valid Object being -// returned. +// returned. The serializer handles loading/serializing nested objects. func (s *Scheme) ConvertToVersion(in Object, outVersion string) (Object, error) { - unknown, err := s.raw.ConvertToVersion(in, outVersion) + gv, err := unversioned.ParseGroupVersion(outVersion) if err != nil { return nil, err } - obj, ok := unknown.(Object) - if !ok { - return nil, fmt.Errorf("the provided object cannot be converted to a runtime.Object: %#v", unknown) + switch in.(type) { + case *Unknown, *Unstructured: + old := in.GetObjectKind().GroupVersionKind() + defer in.GetObjectKind().SetGroupVersionKind(old) + setTargetVersion(in, s, gv) + return in, nil + } + t := reflect.TypeOf(in) + if t.Kind() != reflect.Ptr { + return nil, fmt.Errorf("only pointer types may be converted: %v", t) } - return obj, nil -} -// EncodeToVersion turns the given api object into an appropriate JSON string. -// Will return an error if the object doesn't have an embedded TypeMeta. -// Obj may be a pointer to a struct, or a struct. If a struct, a copy -// must be made. If a pointer, the object may be modified before encoding, -// but will be put back into its original state before returning. -// -// Memory/wire format differences: -// * Having to keep track of the Kind and APIVersion fields makes tests -// very annoying, so the rule is that they are set only in wire format -// (json), not when in native (memory) format. This is possible because -// both pieces of information are implicit in the go typed object. -// * An exception: note that, if there are embedded API objects of known -// type, for example, PodList{... Items []Pod ...}, these embedded -// objects must be of the same version of the object they are embedded -// within, and their APIVersion and Kind must both be empty. -// * Note that the exception does not apply to the APIObject type, which -// recursively does Encode()/Decode(), and is capable of expressing any -// API object. -// * Only versioned objects should be encoded. This means that, if you pass -// a native object, Encode will convert it to a versioned object. For -// example, an api.Pod will get converted to a v1beta1.Pod. However, if -// you pass in an object that's already versioned (v1beta1.Pod), Encode -// will not modify it. -// -// The purpose of the above complex conversion behavior is to allow us to -// change the memory format yet not break compatibility with any stored -// objects, whether they be in our storage layer (e.g., etcd), or in user's -// config files. -func (s *Scheme) EncodeToVersion(obj Object, destVersion string) (data []byte, err error) { - return s.raw.EncodeToVersion(obj, destVersion) -} + t = t.Elem() + if t.Kind() != reflect.Struct { + return nil, fmt.Errorf("only pointers to struct types may be converted: %v", t) + } -func (s *Scheme) EncodeToVersionStream(obj Object, destVersion string, stream io.Writer) error { - return s.raw.EncodeToVersionStream(obj, destVersion, stream) -} + var kind unversioned.GroupVersionKind + if unversionedKind, ok := s.unversionedTypes[t]; ok { + kind = unversionedKind + } else { + kinds, ok := s.typeToGVK[t] + if !ok || len(kinds) == 0 { + return nil, fmt.Errorf("%v is not a registered type and cannot be converted into version %q", t, outVersion) + } + kind = kinds[0] + } -// Decode converts a YAML or JSON string back into a pointer to an api object. -// Deduces the type based upon the APIVersion and Kind fields, which are set -// by Encode. Only versioned objects (APIVersion != "") are accepted. The object -// will be converted into the in-memory unversioned type before being returned. -func (s *Scheme) Decode(data []byte) (Object, error) { - obj, err := s.raw.Decode(data) + outKind := gv.WithKind(kind.Kind) + + inKind, err := s.ObjectKind(in) if err != nil { return nil, err } - return obj.(Object), nil -} -// DecodeToVersion converts a YAML or JSON string back into a pointer to an api -// object. Deduces the type based upon the APIVersion and Kind fields, which -// are set by Encode. Only versioned objects (APIVersion != "") are -// accepted. The object will be converted into the in-memory versioned type -// requested before being returned. -func (s *Scheme) DecodeToVersion(data []byte, version string) (Object, error) { - obj, err := s.raw.DecodeToVersion(data, version) + out, err := s.New(outKind) if err != nil { return nil, err } - return obj.(Object), nil -} -// DecodeInto parses a YAML or JSON string and stores it in obj. Returns an error -// if data.Kind is set and doesn't match the type of obj. Obj should be a -// pointer to an api type. -// If obj's APIVersion doesn't match that in data, an attempt will be made to convert -// data into obj's version. -// TODO: allow Decode/DecodeInto to take a default apiVersion and a default kind, to -// be applied if the provided object does not have either field (integrate external -// apis into the decoding scheme). -func (s *Scheme) DecodeInto(data []byte, obj Object) error { - return s.raw.DecodeInto(data, obj) -} - -func (s *Scheme) DecodeIntoWithSpecifiedVersionKind(data []byte, obj Object, version, kind string) error { - return s.raw.DecodeIntoWithSpecifiedVersionKind(data, obj, version, kind) -} - -// Copy does a deep copy of an API object. Useful mostly for tests. -func (s *Scheme) Copy(src Object) (Object, error) { - dst, err := s.raw.DeepCopy(src) - if err != nil { + flags, meta := s.generateConvertMeta(inKind.GroupVersion(), gv, in) + if err := s.converter.Convert(in, out, flags, meta); err != nil { return nil, err } - return dst.(Object), nil + + setTargetVersion(out, s, gv) + return out, nil } -func (s *Scheme) CopyOrDie(obj Object) Object { - newObj, err := s.Copy(obj) - if err != nil { - panic(err) - } - return newObj +// generateConvertMeta constructs the meta value we pass to Convert. +func (s *Scheme) generateConvertMeta(srcGroupVersion, destGroupVersion unversioned.GroupVersion, in interface{}) (conversion.FieldMatchingFlags, *conversion.Meta) { + flags, meta := s.converter.DefaultMeta(reflect.TypeOf(in)) + meta.SrcVersion = srcGroupVersion.String() + meta.DestVersion = destGroupVersion.String() + return flags, meta +} + +func setTargetVersion(obj Object, raw *Scheme, gv unversioned.GroupVersion) { + if gv.Version == APIVersionInternal { + // internal is a special case + obj.GetObjectKind().SetGroupVersionKind(nil) + } else { + gvk, _ := raw.ObjectKind(obj) + obj.GetObjectKind().SetGroupVersionKind(&unversioned.GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: gvk.Kind}) + } } diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/scheme_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/scheme_test.go index 83f8d4c6e..5b933d84b 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/scheme_test.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/scheme_test.go @@ -20,32 +20,41 @@ import ( "reflect" "testing" + "github.com/google/gofuzz" + flag "github.com/spf13/pflag" + + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer" + "k8s.io/kubernetes/pkg/util" ) -type TypeMeta struct { - Kind string `json:"kind,omitempty"` - APIVersion string `json:"apiVersion,omitempty"` -} +var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.") type InternalSimple struct { - TypeMeta `json:",inline"` - TestString string `json:"testString"` + runtime.TypeMeta `json:",inline"` + TestString string `json:"testString"` } type ExternalSimple struct { - TypeMeta `json:",inline"` - TestString string `json:"testString"` + runtime.TypeMeta `json:",inline"` + TestString string `json:"testString"` } -func (*InternalSimple) IsAnAPIObject() {} -func (*ExternalSimple) IsAnAPIObject() {} +func (obj *InternalSimple) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ExternalSimple) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } func TestScheme(t *testing.T) { + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "testExternal"} + scheme := runtime.NewScheme() - scheme.AddKnownTypeWithName("", "Simple", &InternalSimple{}) - scheme.AddKnownTypeWithName("externalVersion", "Simple", &ExternalSimple{}) + scheme.AddKnownTypeWithName(internalGV.WithKind("Simple"), &InternalSimple{}) + scheme.AddKnownTypeWithName(externalGV.WithKind("Simple"), &ExternalSimple{}) + + // If set, would clear TypeMeta during conversion. + //scheme.AddIgnoredConversionType(&TypeMeta{}, &TypeMeta{}) // test that scheme is an ObjectTyper var _ runtime.ObjectTyper = scheme @@ -56,10 +65,10 @@ func TestScheme(t *testing.T) { // Register functions to verify that scope.Meta() gets set correctly. err := scheme.AddConversionFuncs( func(in *InternalSimple, out *ExternalSimple, scope conversion.Scope) error { - if e, a := "", scope.Meta().SrcVersion; e != a { + if e, a := internalGV.String(), scope.Meta().SrcVersion; e != a { t.Errorf("Expected '%v', got '%v'", e, a) } - if e, a := "externalVersion", scope.Meta().DestVersion; e != a { + if e, a := externalGV.String(), scope.Meta().DestVersion; e != a { t.Errorf("Expected '%v', got '%v'", e, a) } scope.Convert(&in.TypeMeta, &out.TypeMeta, 0) @@ -68,10 +77,10 @@ func TestScheme(t *testing.T) { return nil }, func(in *ExternalSimple, out *InternalSimple, scope conversion.Scope) error { - if e, a := "externalVersion", scope.Meta().SrcVersion; e != a { + if e, a := externalGV.String(), scope.Meta().SrcVersion; e != a { t.Errorf("Expected '%v', got '%v'", e, a) } - if e, a := "", scope.Meta().DestVersion; e != a { + if e, a := internalGV.String(), scope.Meta().DestVersion; e != a { t.Errorf("Expected '%v', got '%v'", e, a) } scope.Convert(&in.TypeMeta, &out.TypeMeta, 0) @@ -81,21 +90,27 @@ func TestScheme(t *testing.T) { }, ) if err != nil { - t.Errorf("unexpected error: %v", err) + t.Fatalf("unexpected error: %v", err) } + + codecs := serializer.NewCodecFactory(scheme) + codec := codecs.LegacyCodec(externalGV) + jsonserializer, _ := codecs.SerializerForFileExtension("json") + simple := &InternalSimple{ TestString: "foo", } // Test Encode, Decode, DecodeInto, and DecodeToVersion obj := runtime.Object(simple) - data, err := scheme.EncodeToVersion(obj, "externalVersion") - obj2, err2 := scheme.Decode(data) - obj3 := &InternalSimple{} - err3 := scheme.DecodeInto(data, obj3) - obj4, err4 := scheme.DecodeToVersion(data, "externalVersion") - if err != nil || err2 != nil || err3 != nil || err4 != nil { - t.Fatalf("Failure: '%v' '%v' '%v' '%v'", err, err2, err3, err4) + data, err := runtime.Encode(codec, obj) + if err != nil { + t.Fatal(err) + } + + obj2, err := runtime.Decode(codec, data) + if err != nil { + t.Fatal(err) } if _, ok := obj2.(*InternalSimple); !ok { t.Fatalf("Got wrong type") @@ -103,9 +118,22 @@ func TestScheme(t *testing.T) { if e, a := simple, obj2; !reflect.DeepEqual(e, a) { t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a) } + + obj3 := &InternalSimple{} + if err := runtime.DecodeInto(codec, data, obj3); err != nil { + t.Fatal(err) + } + // clearing TypeMeta is a function of the scheme, which we do not test here (ConvertToVersion + // does not automatically clear TypeMeta anymore). + simple.TypeMeta = runtime.TypeMeta{Kind: "Simple", APIVersion: externalGV.String()} if e, a := simple, obj3; !reflect.DeepEqual(e, a) { t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a) } + + obj4, err := runtime.Decode(jsonserializer, data) + if err != nil { + t.Fatal(err) + } if _, ok := obj4.(*ExternalSimple); !ok { t.Fatalf("Got wrong type") } @@ -114,7 +142,7 @@ func TestScheme(t *testing.T) { external := &ExternalSimple{} err = scheme.Convert(simple, external) if err != nil { - t.Errorf("Unexpected error: %v", err) + t.Fatalf("Unexpected error: %v", err) } if e, a := simple.TestString, external.TestString; e != a { t.Errorf("Expected %v, got %v", e, a) @@ -124,34 +152,23 @@ func TestScheme(t *testing.T) { if e, a := 2, internalToExternalCalls; e != a { t.Errorf("Expected %v, got %v", e, a) } - // Decode and DecodeInto should each have caused an increment. + // DecodeInto and Decode should each have caused an increment because of a conversion if e, a := 2, externalToInternalCalls; e != a { t.Errorf("Expected %v, got %v", e, a) } } -func TestInvalidObjectValueKind(t *testing.T) { - scheme := runtime.NewScheme() - scheme.AddKnownTypeWithName("", "Simple", &InternalSimple{}) - - embedded := &runtime.EmbeddedObject{} - switch obj := embedded.Object.(type) { - default: - _, _, err := scheme.ObjectVersionAndKind(obj) - if err == nil { - t.Errorf("Expected error on invalid kind") - } - } -} - func TestBadJSONRejection(t *testing.T) { scheme := runtime.NewScheme() + codecs := serializer.NewCodecFactory(scheme) + jsonserializer, _ := codecs.SerializerForFileExtension("json") + badJSONMissingKind := []byte(`{ }`) - if _, err := scheme.Decode(badJSONMissingKind); err == nil { + if _, err := runtime.Decode(jsonserializer, badJSONMissingKind); err == nil { t.Errorf("Did not reject despite lack of kind field: %s", badJSONMissingKind) } badJSONUnknownType := []byte(`{"kind": "bar"}`) - if _, err1 := scheme.Decode(badJSONUnknownType); err1 == nil { + if _, err1 := runtime.Decode(jsonserializer, badJSONUnknownType); err1 == nil { t.Errorf("Did not reject despite use of unknown type: %s", badJSONUnknownType) } /*badJSONKindMismatch := []byte(`{"kind": "Pod"}`) @@ -161,139 +178,161 @@ func TestBadJSONRejection(t *testing.T) { } type ExtensionA struct { - runtime.PluginBase `json:",inline"` - TestString string `json:"testString"` + runtime.TypeMeta `json:",inline"` + TestString string `json:"testString"` } type ExtensionB struct { - runtime.PluginBase `json:",inline"` - TestString string `json:"testString"` + runtime.TypeMeta `json:",inline"` + TestString string `json:"testString"` } type ExternalExtensionType struct { - TypeMeta `json:",inline"` - Extension runtime.RawExtension `json:"extension"` + runtime.TypeMeta `json:",inline"` + Extension runtime.RawExtension `json:"extension"` } type InternalExtensionType struct { - TypeMeta `json:",inline"` - Extension runtime.EmbeddedObject `json:"extension"` + runtime.TypeMeta `json:",inline"` + Extension runtime.Object `json:"extension"` } type ExternalOptionalExtensionType struct { - TypeMeta `json:",inline"` - Extension runtime.RawExtension `json:"extension,omitempty"` + runtime.TypeMeta `json:",inline"` + Extension runtime.RawExtension `json:"extension,omitempty"` } type InternalOptionalExtensionType struct { - TypeMeta `json:",inline"` - Extension runtime.EmbeddedObject `json:"extension,omitempty"` + runtime.TypeMeta `json:",inline"` + Extension runtime.Object `json:"extension,omitempty"` } -func (*ExtensionA) IsAnAPIObject() {} -func (*ExtensionB) IsAnAPIObject() {} -func (*ExternalExtensionType) IsAnAPIObject() {} -func (*InternalExtensionType) IsAnAPIObject() {} -func (*ExternalOptionalExtensionType) IsAnAPIObject() {} -func (*InternalOptionalExtensionType) IsAnAPIObject() {} +func (obj *ExtensionA) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ExtensionB) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ExternalExtensionType) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *InternalExtensionType) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *ExternalOptionalExtensionType) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } +func (obj *InternalOptionalExtensionType) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } func TestExternalToInternalMapping(t *testing.T) { + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "testExternal"} + scheme := runtime.NewScheme() - scheme.AddKnownTypeWithName("", "OptionalExtensionType", &InternalOptionalExtensionType{}) - scheme.AddKnownTypeWithName("testExternal", "OptionalExtensionType", &ExternalOptionalExtensionType{}) + scheme.AddKnownTypeWithName(internalGV.WithKind("OptionalExtensionType"), &InternalOptionalExtensionType{}) + scheme.AddKnownTypeWithName(externalGV.WithKind("OptionalExtensionType"), &ExternalOptionalExtensionType{}) + + codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) table := []struct { obj runtime.Object encoded string }{ { - &InternalOptionalExtensionType{Extension: runtime.EmbeddedObject{Object: nil}}, - `{"kind":"OptionalExtensionType","apiVersion":"testExternal"}`, + &InternalOptionalExtensionType{Extension: nil}, + `{"kind":"OptionalExtensionType","apiVersion":"` + externalGV.String() + `"}`, }, } - for _, item := range table { - gotDecoded, err := scheme.Decode([]byte(item.encoded)) + for i, item := range table { + gotDecoded, err := runtime.Decode(codec, []byte(item.encoded)) if err != nil { t.Errorf("unexpected error '%v' (%v)", err, item.encoded) } else if e, a := item.obj, gotDecoded; !reflect.DeepEqual(e, a) { - var eEx, aEx runtime.Object - if obj, ok := e.(*InternalOptionalExtensionType); ok { - eEx = obj.Extension.Object - } - if obj, ok := a.(*InternalOptionalExtensionType); ok { - aEx = obj.Extension.Object - } - t.Errorf("expected %#v, got %#v (%#v, %#v)", e, a, eEx, aEx) + t.Errorf("%d: unexpected objects:\n%s", i, util.ObjectGoPrintSideBySide(e, a)) } } } func TestExtensionMapping(t *testing.T) { + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "testExternal"} + scheme := runtime.NewScheme() - scheme.AddKnownTypeWithName("", "ExtensionType", &InternalExtensionType{}) - scheme.AddKnownTypeWithName("", "OptionalExtensionType", &InternalOptionalExtensionType{}) - scheme.AddKnownTypeWithName("", "A", &ExtensionA{}) - scheme.AddKnownTypeWithName("", "B", &ExtensionB{}) - scheme.AddKnownTypeWithName("testExternal", "ExtensionType", &ExternalExtensionType{}) - scheme.AddKnownTypeWithName("testExternal", "OptionalExtensionType", &ExternalOptionalExtensionType{}) - scheme.AddKnownTypeWithName("testExternal", "A", &ExtensionA{}) - scheme.AddKnownTypeWithName("testExternal", "B", &ExtensionB{}) + scheme.AddKnownTypeWithName(internalGV.WithKind("ExtensionType"), &InternalExtensionType{}) + scheme.AddKnownTypeWithName(internalGV.WithKind("OptionalExtensionType"), &InternalOptionalExtensionType{}) + scheme.AddKnownTypeWithName(externalGV.WithKind("ExtensionType"), &ExternalExtensionType{}) + scheme.AddKnownTypeWithName(externalGV.WithKind("OptionalExtensionType"), &ExternalOptionalExtensionType{}) + + // register external first when the object is the same in both schemes, so ObjectVersionAndKind reports the + // external version. + scheme.AddKnownTypeWithName(externalGV.WithKind("A"), &ExtensionA{}) + scheme.AddKnownTypeWithName(externalGV.WithKind("B"), &ExtensionB{}) + scheme.AddKnownTypeWithName(internalGV.WithKind("A"), &ExtensionA{}) + scheme.AddKnownTypeWithName(internalGV.WithKind("B"), &ExtensionB{}) + + codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) table := []struct { - obj runtime.Object - encoded string + obj runtime.Object + expected runtime.Object + encoded string }{ { - &InternalExtensionType{Extension: runtime.EmbeddedObject{Object: &ExtensionA{TestString: "foo"}}}, - `{"kind":"ExtensionType","apiVersion":"testExternal","extension":{"kind":"A","testString":"foo"}} + &InternalExtensionType{ + Extension: runtime.NewEncodable(codec, &ExtensionA{TestString: "foo"}), + }, + &InternalExtensionType{ + Extension: &runtime.Unknown{ + RawJSON: []byte(`{"apiVersion":"test.group/testExternal","kind":"A","testString":"foo"}`), + }, + }, + // apiVersion is set in the serialized object for easier consumption by clients + `{"apiVersion":"` + externalGV.String() + `","kind":"ExtensionType","extension":{"apiVersion":"test.group/testExternal","kind":"A","testString":"foo"}} `, }, { - &InternalExtensionType{Extension: runtime.EmbeddedObject{Object: &ExtensionB{TestString: "bar"}}}, - `{"kind":"ExtensionType","apiVersion":"testExternal","extension":{"kind":"B","testString":"bar"}} + &InternalExtensionType{Extension: runtime.NewEncodable(codec, &ExtensionB{TestString: "bar"})}, + &InternalExtensionType{ + Extension: &runtime.Unknown{ + RawJSON: []byte(`{"apiVersion":"test.group/testExternal","kind":"B","testString":"bar"}`), + }, + }, + // apiVersion is set in the serialized object for easier consumption by clients + `{"apiVersion":"` + externalGV.String() + `","kind":"ExtensionType","extension":{"apiVersion":"test.group/testExternal","kind":"B","testString":"bar"}} `, }, { - &InternalExtensionType{Extension: runtime.EmbeddedObject{Object: nil}}, - `{"kind":"ExtensionType","apiVersion":"testExternal","extension":null} + &InternalExtensionType{Extension: nil}, + &InternalExtensionType{ + Extension: nil, + }, + `{"apiVersion":"` + externalGV.String() + `","kind":"ExtensionType","extension":null} `, }, } - for _, item := range table { - gotEncoded, err := scheme.EncodeToVersion(item.obj, "testExternal") + for i, item := range table { + gotEncoded, err := runtime.Encode(codec, item.obj) if err != nil { t.Errorf("unexpected error '%v' (%#v)", err, item.obj) } else if e, a := item.encoded, string(gotEncoded); e != a { t.Errorf("expected\n%#v\ngot\n%#v\n", e, a) } - gotDecoded, err := scheme.Decode([]byte(item.encoded)) + gotDecoded, err := runtime.Decode(codec, []byte(item.encoded)) if err != nil { t.Errorf("unexpected error '%v' (%v)", err, item.encoded) - } else if e, a := item.obj, gotDecoded; !reflect.DeepEqual(e, a) { - var eEx, aEx runtime.Object - if obj, ok := e.(*InternalExtensionType); ok { - eEx = obj.Extension.Object - } - if obj, ok := a.(*InternalExtensionType); ok { - aEx = obj.Extension.Object - } - t.Errorf("expected %#v, got %#v (%#v, %#v)", e, a, eEx, aEx) + } else if e, a := item.expected, gotDecoded; !reflect.DeepEqual(e, a) { + t.Errorf("%d: unexpected objects:\n%s", i, util.ObjectGoPrintSideBySide(e, a)) } } } func TestEncode(t *testing.T) { + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "testExternal"} + scheme := runtime.NewScheme() - scheme.AddKnownTypeWithName("", "Simple", &InternalSimple{}) - scheme.AddKnownTypeWithName("externalVersion", "Simple", &ExternalSimple{}) - codec := runtime.CodecFor(scheme, "externalVersion") + scheme.AddKnownTypeWithName(internalGV.WithKind("Simple"), &InternalSimple{}) + scheme.AddKnownTypeWithName(externalGV.WithKind("Simple"), &ExternalSimple{}) + + codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) + test := &InternalSimple{ TestString: "I'm the same", } obj := runtime.Object(test) - data, err := codec.Encode(obj) - obj2, err2 := codec.Decode(data) + data, err := runtime.Encode(codec, obj) + obj2, gvk, err2 := codec.Decode(data, nil, nil) if err != nil || err2 != nil { t.Fatalf("Failure: '%v' '%v'", err, err2) } @@ -301,6 +340,334 @@ func TestEncode(t *testing.T) { t.Fatalf("Got wrong type") } if !reflect.DeepEqual(obj2, test) { - t.Errorf("Expected:\n %#v,\n Got:\n %#v", &test, obj2) + t.Errorf("Expected:\n %#v,\n Got:\n %#v", test, obj2) + } + if !reflect.DeepEqual(gvk, &unversioned.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "Simple"}) { + t.Errorf("unexpected gvk returned by decode: %#v", gvk) + } +} + +func TestUnversionedTypes(t *testing.T) { + internalGV := unversioned.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "testExternal"} + otherGV := unversioned.GroupVersion{Group: "group", Version: "other"} + + scheme := runtime.NewScheme() + scheme.AddUnversionedTypes(externalGV, &InternalSimple{}) + scheme.AddKnownTypeWithName(internalGV.WithKind("Simple"), &InternalSimple{}) + scheme.AddKnownTypeWithName(externalGV.WithKind("Simple"), &ExternalSimple{}) + scheme.AddKnownTypeWithName(otherGV.WithKind("Simple"), &ExternalSimple{}) + + codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) + + if unv, ok := scheme.IsUnversioned(&InternalSimple{}); !unv || !ok { + t.Fatal("type not unversioned and in scheme: %t %t", unv, ok) + } + + kind, err := scheme.ObjectKind(&InternalSimple{}) + if err != nil { + t.Fatal(err) + } + if kind != externalGV.WithKind("InternalSimple") { + t.Fatalf("unexpected: %#v", kind) + } + + test := &InternalSimple{ + TestString: "I'm the same", + } + obj := runtime.Object(test) + data, err := runtime.Encode(codec, obj) + if err != nil { + t.Fatal(err) + } + obj2, gvk, err := codec.Decode(data, nil, nil) + if err != nil { + t.Fatal(err) + } + if _, ok := obj2.(*InternalSimple); !ok { + t.Fatalf("Got wrong type") + } + if !reflect.DeepEqual(obj2, test) { + t.Errorf("Expected:\n %#v,\n Got:\n %#v", test, obj2) + } + // object is serialized as an unversioned object (in the group and version it was defined in) + if !reflect.DeepEqual(gvk, &unversioned.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "InternalSimple"}) { + t.Errorf("unexpected gvk returned by decode: %#v", gvk) + } + + // when serialized to a different group, the object is kept in its preferred name + codec = serializer.NewCodecFactory(scheme).LegacyCodec(otherGV) + data, err = runtime.Encode(codec, obj) + if err != nil { + t.Fatal(err) + } + if string(data) != `{"apiVersion":"test.group/testExternal","kind":"InternalSimple","testString":"I'm the same"}`+"\n" { + t.Errorf("unexpected data: %s", data) + } +} + +// Test a weird version/kind embedding format. +type MyWeirdCustomEmbeddedVersionKindField struct { + ID string `json:"ID,omitempty"` + APIVersion string `json:"myVersionKey,omitempty"` + ObjectKind string `json:"myKindKey,omitempty"` + Z string `json:"Z,omitempty"` + Y uint64 `json:"Y,omitempty"` +} + +type TestType1 struct { + MyWeirdCustomEmbeddedVersionKindField `json:",inline"` + A string `json:"A,omitempty"` + B int `json:"B,omitempty"` + C int8 `json:"C,omitempty"` + D int16 `json:"D,omitempty"` + E int32 `json:"E,omitempty"` + F int64 `json:"F,omitempty"` + G uint `json:"G,omitempty"` + H uint8 `json:"H,omitempty"` + I uint16 `json:"I,omitempty"` + J uint32 `json:"J,omitempty"` + K uint64 `json:"K,omitempty"` + L bool `json:"L,omitempty"` + M map[string]int `json:"M,omitempty"` + N map[string]TestType2 `json:"N,omitempty"` + O *TestType2 `json:"O,omitempty"` + P []TestType2 `json:"Q,omitempty"` +} + +type TestType2 struct { + A string `json:"A,omitempty"` + B int `json:"B,omitempty"` +} + +type ExternalTestType2 struct { + A string `json:"A,omitempty"` + B int `json:"B,omitempty"` +} +type ExternalTestType1 struct { + MyWeirdCustomEmbeddedVersionKindField `json:",inline"` + A string `json:"A,omitempty"` + B int `json:"B,omitempty"` + C int8 `json:"C,omitempty"` + D int16 `json:"D,omitempty"` + E int32 `json:"E,omitempty"` + F int64 `json:"F,omitempty"` + G uint `json:"G,omitempty"` + H uint8 `json:"H,omitempty"` + I uint16 `json:"I,omitempty"` + J uint32 `json:"J,omitempty"` + K uint64 `json:"K,omitempty"` + L bool `json:"L,omitempty"` + M map[string]int `json:"M,omitempty"` + N map[string]ExternalTestType2 `json:"N,omitempty"` + O *ExternalTestType2 `json:"O,omitempty"` + P []ExternalTestType2 `json:"Q,omitempty"` +} + +type ExternalInternalSame struct { + MyWeirdCustomEmbeddedVersionKindField `json:",inline"` + A TestType2 `json:"A,omitempty"` +} + +func (obj *MyWeirdCustomEmbeddedVersionKindField) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *MyWeirdCustomEmbeddedVersionKindField) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.APIVersion, obj.ObjectKind = gvk.ToAPIVersionAndKind() +} +func (obj *MyWeirdCustomEmbeddedVersionKindField) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.ObjectKind) +} + +func (obj *ExternalInternalSame) GetObjectKind() unversioned.ObjectKind { + return &obj.MyWeirdCustomEmbeddedVersionKindField +} + +func (obj *TestType1) GetObjectKind() unversioned.ObjectKind { + return &obj.MyWeirdCustomEmbeddedVersionKindField +} + +func (obj *ExternalTestType1) GetObjectKind() unversioned.ObjectKind { + return &obj.MyWeirdCustomEmbeddedVersionKindField +} + +func (obj *TestType2) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } +func (obj *ExternalTestType2) GetObjectKind() unversioned.ObjectKind { + return unversioned.EmptyObjectKind +} + +// TestObjectFuzzer can randomly populate all the above objects. +var TestObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 100).Funcs( + func(j *MyWeirdCustomEmbeddedVersionKindField, c fuzz.Continue) { + // We have to customize the randomization of MyWeirdCustomEmbeddedVersionKindFields because their + // APIVersion and Kind must remain blank in memory. + j.APIVersion = "" + j.ObjectKind = "" + j.ID = c.RandString() + }, +) + +// Returns a new Scheme set up with the test objects. +func GetTestScheme() *runtime.Scheme { + internalGV := unversioned.GroupVersion{Version: "__internal"} + externalGV := unversioned.GroupVersion{Version: "v1"} + + s := runtime.NewScheme() + // Ordinarily, we wouldn't add TestType2, but because this is a test and + // both types are from the same package, we need to get it into the system + // so that converter will match it with ExternalType2. + s.AddKnownTypes(internalGV, &TestType1{}, &TestType2{}, &ExternalInternalSame{}) + s.AddKnownTypes(externalGV, &ExternalInternalSame{}) + s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &ExternalTestType1{}) + s.AddKnownTypeWithName(externalGV.WithKind("TestType2"), &ExternalTestType2{}) + s.AddKnownTypeWithName(internalGV.WithKind("TestType3"), &TestType1{}) + s.AddKnownTypeWithName(externalGV.WithKind("TestType3"), &ExternalTestType1{}) + return s +} + +func TestKnownTypes(t *testing.T) { + s := GetTestScheme() + if len(s.KnownTypes(unversioned.GroupVersion{Group: "group", Version: "v2"})) != 0 { + t.Errorf("should have no known types for v2") + } + + types := s.KnownTypes(unversioned.GroupVersion{Version: "v1"}) + for _, s := range []string{"TestType1", "TestType2", "TestType3", "ExternalInternalSame"} { + if _, ok := types[s]; !ok { + t.Errorf("missing type %q", s) + } + } +} + +func TestConvertToVersion(t *testing.T) { + s := GetTestScheme() + tt := &TestType1{A: "I'm not a pointer object"} + other, err := s.ConvertToVersion(tt, "v1") + if err != nil { + t.Fatalf("Failure: %v", err) + } + converted, ok := other.(*ExternalTestType1) + if !ok { + t.Fatalf("Got wrong type") + } + if tt.A != converted.A { + t.Fatalf("Failed to convert object correctly: %#v", converted) + } +} + +func TestMetaValues(t *testing.T) { + internalGV := unversioned.GroupVersion{Group: "test.group", Version: "__internal"} + externalGV := unversioned.GroupVersion{Group: "test.group", Version: "externalVersion"} + + s := runtime.NewScheme() + s.AddKnownTypeWithName(internalGV.WithKind("Simple"), &InternalSimple{}) + s.AddKnownTypeWithName(externalGV.WithKind("Simple"), &ExternalSimple{}) + + internalToExternalCalls := 0 + externalToInternalCalls := 0 + + // Register functions to verify that scope.Meta() gets set correctly. + err := s.AddConversionFuncs( + func(in *InternalSimple, out *ExternalSimple, scope conversion.Scope) error { + t.Logf("internal -> external") + if e, a := internalGV.String(), scope.Meta().SrcVersion; e != a { + t.Fatalf("Expected '%v', got '%v'", e, a) + } + if e, a := externalGV.String(), scope.Meta().DestVersion; e != a { + t.Fatalf("Expected '%v', got '%v'", e, a) + } + scope.Convert(&in.TestString, &out.TestString, 0) + internalToExternalCalls++ + return nil + }, + func(in *ExternalSimple, out *InternalSimple, scope conversion.Scope) error { + t.Logf("external -> internal") + if e, a := externalGV.String(), scope.Meta().SrcVersion; e != a { + t.Errorf("Expected '%v', got '%v'", e, a) + } + if e, a := internalGV.String(), scope.Meta().DestVersion; e != a { + t.Fatalf("Expected '%v', got '%v'", e, a) + } + scope.Convert(&in.TestString, &out.TestString, 0) + externalToInternalCalls++ + return nil + }, + ) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + simple := &InternalSimple{ + TestString: "foo", + } + + s.Log(t) + + out, err := s.ConvertToVersion(simple, externalGV.String()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + internal, err := s.ConvertToVersion(out, internalGV.String()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + if e, a := simple, internal; !reflect.DeepEqual(e, a) { + t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a) + } + + if e, a := 1, internalToExternalCalls; e != a { + t.Errorf("Expected %v, got %v", e, a) + } + if e, a := 1, externalToInternalCalls; e != a { + t.Errorf("Expected %v, got %v", e, a) + } +} + +func TestMetaValuesUnregisteredConvert(t *testing.T) { + type InternalSimple struct { + Version string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` + TestString string `json:"testString"` + } + type ExternalSimple struct { + Version string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` + TestString string `json:"testString"` + } + s := runtime.NewScheme() + // We deliberately don't register the types. + + internalToExternalCalls := 0 + + // Register functions to verify that scope.Meta() gets set correctly. + err := s.AddConversionFuncs( + func(in *InternalSimple, out *ExternalSimple, scope conversion.Scope) error { + if e, a := "unknown/unknown", scope.Meta().SrcVersion; e != a { + t.Fatalf("Expected '%v', got '%v'", e, a) + } + if e, a := "unknown/unknown", scope.Meta().DestVersion; e != a { + t.Fatalf("Expected '%v', got '%v'", e, a) + } + scope.Convert(&in.TestString, &out.TestString, 0) + internalToExternalCalls++ + return nil + }, + ) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + simple := &InternalSimple{TestString: "foo"} + external := &ExternalSimple{} + err = s.Convert(simple, external) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + if e, a := simple.TestString, external.TestString; e != a { + t.Errorf("Expected %v, got %v", e, a) + } + + // Verify that our conversion handler got called. + if e, a := 1, internalToExternalCalls; e != a { + t.Errorf("Expected %v, got %v", e, a) } } diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/codec_factory.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/codec_factory.go new file mode 100644 index 000000000..6f6310d9c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/codec_factory.go @@ -0,0 +1,176 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package serializer + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer/json" + "k8s.io/kubernetes/pkg/runtime/serializer/recognizer" + "k8s.io/kubernetes/pkg/runtime/serializer/versioning" +) + +type serializerType struct { + AcceptContentTypes []string + ContentType string + FileExtensions []string + Serializer runtime.Serializer + PrettySerializer runtime.Serializer +} + +// NewCodecFactory provides methods for retrieving serializers for the supported wire formats +// and conversion wrappers to define preferred internal and external versions. In the future, +// as the internal version is used less, callers may instead use a defaulting serializer and +// only convert objects which are shared internally (Status, common API machinery). +// TODO: allow other codecs to be compiled in? +// TODO: accept a scheme interface +func NewCodecFactory(scheme *runtime.Scheme) CodecFactory { + return newCodecFactory(scheme, json.DefaultMetaFactory) +} + +// newCodecFactory is a helper for testing that allows a different metafactory to be specified. +func newCodecFactory(scheme *runtime.Scheme, mf json.MetaFactory) CodecFactory { + jsonSerializer := json.NewSerializer(mf, scheme, runtime.ObjectTyperToTyper(scheme), false) + jsonPrettySerializer := json.NewSerializer(mf, scheme, runtime.ObjectTyperToTyper(scheme), true) + yamlSerializer := json.NewYAMLSerializer(mf, scheme, runtime.ObjectTyperToTyper(scheme)) + serializers := []serializerType{ + { + AcceptContentTypes: []string{"application/json"}, + ContentType: "application/json", + FileExtensions: []string{"json"}, + Serializer: jsonSerializer, + PrettySerializer: jsonPrettySerializer, + }, + { + AcceptContentTypes: []string{"application/yaml"}, + ContentType: "application/yaml", + FileExtensions: []string{"yaml"}, + Serializer: yamlSerializer, + }, + } + decoders := make([]runtime.Decoder, 0, len(serializers)) + accepts := []string{} + alreadyAccepted := make(map[string]struct{}) + for _, d := range serializers { + decoders = append(decoders, d.Serializer) + for _, mediaType := range d.AcceptContentTypes { + if _, ok := alreadyAccepted[mediaType]; ok { + continue + } + alreadyAccepted[mediaType] = struct{}{} + accepts = append(accepts, mediaType) + } + } + return CodecFactory{ + scheme: scheme, + serializers: serializers, + universal: recognizer.NewDecoder(decoders...), + accepts: accepts, + + legacySerializer: jsonSerializer, + } +} + +// CodecFactory provides methods for retrieving codecs and serializers for specific +// versions and content types. +type CodecFactory struct { + scheme *runtime.Scheme + serializers []serializerType + universal runtime.Decoder + accepts []string + + legacySerializer runtime.Serializer +} + +var _ runtime.NegotiatedSerializer = &CodecFactory{} + +// SupportedMediaTypes returns the RFC2046 media types that this factory has serializers for. +func (f CodecFactory) SupportedMediaTypes() []string { + return f.accepts +} + +// LegacyCodec encodes output to a given API version, and decodes output into the internal form from +// any recognized source. The returned codec will always encode output to JSON. +// +// This method is deprecated - clients and servers should negotiate a serializer by mime-type and +// invoke CodecForVersions. Callers that need only to read data should use UniversalDecoder(). +func (f CodecFactory) LegacyCodec(version ...unversioned.GroupVersion) runtime.Codec { + return f.CodecForVersions(runtime.NewCodec(f.legacySerializer, f.universal), version, nil) +} + +// UniversalDeserializer can convert any stored data recognized by this factory into a Go object that satisfies +// runtime.Object. It does not perform conversion. It does not perform defaulting. +func (f CodecFactory) UniversalDeserializer() runtime.Decoder { + return f.universal +} + +// UniversalDecoder returns a runtime.Decoder capable of decoding all known API objects in all known formats. Used +// by clients that do not need to encode objects but want to deserialize API objects stored on disk. Only decodes +// objects in groups registered with the scheme. The GroupVersions passed may be used to select alternate +// versions of objects to return - by default, runtime.APIVersionInternal is used. If any versions are specified, +// unrecognized groups will be returned in the version they are encoded as (no conversion). This decoder performs +// defaulting. +// +// TODO: the decoder will eventually be removed in favor of dealing with objects in their versioned form +func (f CodecFactory) UniversalDecoder(versions ...unversioned.GroupVersion) runtime.Decoder { + return f.CodecForVersions(runtime.NoopEncoder{f.universal}, nil, versions) +} + +// CodecFor creates a codec with the provided serializer. If an object is decoded and its group is not in the list, +// it will default to runtime.APIVersionInternal. If encode is not specified for an object's group, the object is not +// converted. If encode or decode are nil, no conversion is performed. +func (f CodecFactory) CodecForVersions(serializer runtime.Serializer, encode []unversioned.GroupVersion, decode []unversioned.GroupVersion) runtime.Codec { + return versioning.NewCodecForScheme(f.scheme, serializer, encode, decode) +} + +// DecoderToVersion returns a decoder that targets the provided group version. +func (f CodecFactory) DecoderToVersion(serializer runtime.Serializer, gv unversioned.GroupVersion) runtime.Decoder { + return f.CodecForVersions(serializer, nil, []unversioned.GroupVersion{gv}) +} + +// EncoderForVersion returns an encoder that targets the provided group version. +func (f CodecFactory) EncoderForVersion(serializer runtime.Serializer, gv unversioned.GroupVersion) runtime.Encoder { + return f.CodecForVersions(serializer, []unversioned.GroupVersion{gv}, nil) +} + +// SerializerForMediaType returns a serializer that matches the provided RFC2046 mediaType, or false if no such +// serializer exists +func (f CodecFactory) SerializerForMediaType(mediaType string, options map[string]string) (runtime.Serializer, bool) { + for _, s := range f.serializers { + for _, accepted := range s.AcceptContentTypes { + if accepted == mediaType { + if v, ok := options["pretty"]; ok && v == "1" && s.PrettySerializer != nil { + return s.PrettySerializer, true + } + return s.Serializer, true + } + } + } + return nil, false +} + +// SerializerForFileExtension returns a serializer for the provided extension, or false if no serializer matches. +func (f CodecFactory) SerializerForFileExtension(extension string) (runtime.Serializer, bool) { + for _, s := range f.serializers { + for _, ext := range s.FileExtensions { + if extension == ext { + return s.Serializer, true + } + } + } + return nil, false +} diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/scheme_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/codec_test.go similarity index 55% rename from vendor/k8s.io/kubernetes/pkg/conversion/scheme_test.go rename to vendor/k8s.io/kubernetes/pkg/runtime/serializer/codec_test.go index 05fd32069..6c1b2ff95 100644 --- a/vendor/k8s.io/kubernetes/pkg/conversion/scheme_test.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/codec_test.go @@ -14,15 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -package conversion +package serializer import ( "encoding/json" "fmt" + "log" + "os" "reflect" "strings" "testing" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/conversion" + "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util" "github.com/ghodss/yaml" @@ -32,6 +37,25 @@ import ( var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.") +type testMetaFactory struct{} + +func (testMetaFactory) Interpret(data []byte) (*unversioned.GroupVersionKind, error) { + findKind := struct { + APIVersion string `json:"myVersionKey,omitempty"` + ObjectKind string `json:"myKindKey,omitempty"` + }{} + // yaml is a superset of json, so we use it to decode here. That way, + // we understand both. + if err := yaml.Unmarshal(data, &findKind); err != nil { + return nil, fmt.Errorf("couldn't get version/kind: %v", err) + } + gv, err := unversioned.ParseGroupVersion(findKind.APIVersion) + if err != nil { + return nil, err + } + return &unversioned.GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: findKind.ObjectKind}, nil +} + // Test a weird version/kind embedding format. type MyWeirdCustomEmbeddedVersionKindField struct { ID string `json:"ID,omitempty"` @@ -98,49 +122,60 @@ type ExternalInternalSame struct { // TestObjectFuzzer can randomly populate all the above objects. var TestObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 100).Funcs( func(j *MyWeirdCustomEmbeddedVersionKindField, c fuzz.Continue) { - // We have to customize the randomization of MyWeirdCustomEmbeddedVersionKindFields because their - // APIVersion and Kind must remain blank in memory. + c.FuzzNoCustom(j) j.APIVersion = "" j.ObjectKind = "" - j.ID = c.RandString() }, ) +func (obj *MyWeirdCustomEmbeddedVersionKindField) GetObjectKind() unversioned.ObjectKind { return obj } +func (obj *MyWeirdCustomEmbeddedVersionKindField) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { + obj.APIVersion, obj.ObjectKind = gvk.ToAPIVersionAndKind() +} +func (obj *MyWeirdCustomEmbeddedVersionKindField) GroupVersionKind() *unversioned.GroupVersionKind { + return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.ObjectKind) +} + +func (obj *ExternalInternalSame) GetObjectKind() unversioned.ObjectKind { + return &obj.MyWeirdCustomEmbeddedVersionKindField +} + +func (obj *TestType1) GetObjectKind() unversioned.ObjectKind { + return &obj.MyWeirdCustomEmbeddedVersionKindField +} + +func (obj *ExternalTestType1) GetObjectKind() unversioned.ObjectKind { + return &obj.MyWeirdCustomEmbeddedVersionKindField +} + +func (obj *TestType2) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } +func (obj *ExternalTestType2) GetObjectKind() unversioned.ObjectKind { + return unversioned.EmptyObjectKind +} + // Returns a new Scheme set up with the test objects. -func GetTestScheme() *Scheme { - s := NewScheme() +func GetTestScheme() (*runtime.Scheme, runtime.Codec) { + internalGV := unversioned.GroupVersion{Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Version: "v1"} + externalGV2 := unversioned.GroupVersion{Version: "v2"} + + s := runtime.NewScheme() // Ordinarily, we wouldn't add TestType2, but because this is a test and // both types are from the same package, we need to get it into the system // so that converter will match it with ExternalType2. - s.AddKnownTypes("", &TestType1{}, &TestType2{}, &ExternalInternalSame{}) - s.AddKnownTypes("v1", &ExternalInternalSame{}) - s.AddKnownTypeWithName("v1", "TestType1", &ExternalTestType1{}) - s.AddKnownTypeWithName("v1", "TestType2", &ExternalTestType2{}) - s.AddKnownTypeWithName("", "TestType3", &TestType1{}) - s.AddKnownTypeWithName("v1", "TestType3", &ExternalTestType1{}) - s.InternalVersion = "" - s.MetaFactory = testMetaFactory{} - return s -} + s.AddKnownTypes(internalGV, &TestType1{}, &TestType2{}, &ExternalInternalSame{}) + s.AddKnownTypes(externalGV, &ExternalInternalSame{}) + s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &ExternalTestType1{}) + s.AddKnownTypeWithName(externalGV.WithKind("TestType2"), &ExternalTestType2{}) + s.AddKnownTypeWithName(internalGV.WithKind("TestType3"), &TestType1{}) + s.AddKnownTypeWithName(externalGV.WithKind("TestType3"), &ExternalTestType1{}) + s.AddKnownTypeWithName(externalGV2.WithKind("TestType1"), &ExternalTestType1{}) -type testMetaFactory struct{} + s.AddUnversionedTypes(externalGV, &unversioned.Status{}) -func (testMetaFactory) Interpret(data []byte) (version, kind string, err error) { - findKind := struct { - APIVersion string `json:"myVersionKey,omitempty"` - ObjectKind string `json:"myKindKey,omitempty"` - }{} - // yaml is a superset of json, so we use it to decode here. That way, - // we understand both. - err = yaml.Unmarshal(data, &findKind) - if err != nil { - return "", "", fmt.Errorf("couldn't get version/kind: %v", err) - } - return findKind.APIVersion, findKind.ObjectKind, nil -} - -func (testMetaFactory) Update(version, kind string, obj interface{}) error { - return UpdateVersionAndKind(nil, "APIVersion", version, "ObjectKind", kind, obj) + cf := newCodecFactory(s, testMetaFactory{}) + codec := cf.LegacyCodec(unversioned.GroupVersion{Version: "v1"}) + return s, codec } func objDiff(a, b interface{}) string { @@ -158,37 +193,44 @@ func objDiff(a, b interface{}) string { // the difference. (reflect.DeepEqual makes a distinction between // nil and empty slices, for example.) //return util.StringDiff( - // fmt.Sprintf("%#v", a), - // fmt.Sprintf("%#v", b), + // fmt.Sprintf("%#v", a), + // fmt.Sprintf("%#v", b), //) } +var semantic = conversion.EqualitiesOrDie( + func(a, b MyWeirdCustomEmbeddedVersionKindField) bool { + a.APIVersion, a.ObjectKind = "", "" + b.APIVersion, b.ObjectKind = "", "" + return a == b + }, +) + func runTest(t *testing.T, source interface{}) { name := reflect.TypeOf(source).Elem().Name() TestObjectFuzzer.Fuzz(source) - s := GetTestScheme() - data, err := s.EncodeToVersion(source, "v1") + _, codec := GetTestScheme() + data, err := runtime.Encode(codec, source.(runtime.Object)) if err != nil { t.Errorf("%v: %v (%#v)", name, err, source) return } - obj2, err := s.Decode(data) + obj2, err := runtime.Decode(codec, data) if err != nil { t.Errorf("%v: %v (%v)", name, err, string(data)) return } - if !reflect.DeepEqual(source, obj2) { - t.Errorf("1: %v: diff: %v", name, objDiff(source, obj2)) + if !semantic.DeepEqual(source, obj2) { + t.Errorf("1: %v: diff: %v", name, util.ObjectGoPrintSideBySide(source, obj2)) return } obj3 := reflect.New(reflect.TypeOf(source).Elem()).Interface() - err = s.DecodeInto(data, obj3) - if err != nil { + if err := runtime.DecodeInto(codec, data, obj3.(runtime.Object)); err != nil { t.Errorf("2: %v: %v", name, err) return } - if !reflect.DeepEqual(source, obj3) { + if !semantic.DeepEqual(source, obj3) { t.Errorf("3: %v: diff: %v", name, objDiff(source, obj3)) return } @@ -207,10 +249,44 @@ func TestTypes(t *testing.T) { } } -func TestMultipleNames(t *testing.T) { - s := GetTestScheme() +func TestVersionedEncoding(t *testing.T) { + s, codec := GetTestScheme() + out, err := runtime.Encode(codec, &TestType1{}, unversioned.GroupVersion{Version: "v2"}) + if err != nil { + t.Fatal(err) + } + if string(out) != `{"myVersionKey":"v2","myKindKey":"TestType1"}`+"\n" { + t.Fatal(string(out)) + } + _, err = runtime.Encode(codec, &TestType1{}, unversioned.GroupVersion{Version: "v3"}) + if err == nil { + t.Fatal(err) + } - obj, err := s.Decode([]byte(`{"myKindKey":"TestType3","myVersionKey":"v1","A":"value"}`)) + cf := newCodecFactory(s, testMetaFactory{}) + encoder, _ := cf.SerializerForFileExtension("json") + + // codec that is unversioned uses the target version + unversionedCodec := cf.CodecForVersions(encoder, nil, nil) + _, err = runtime.Encode(unversionedCodec, &TestType1{}, unversioned.GroupVersion{Version: "v3"}) + if err == nil || !runtime.IsNotRegisteredError(err) { + t.Fatal(err) + } + + // unversioned encode with no versions is written directly to wire + out, err = runtime.Encode(unversionedCodec, &TestType1{}) + if err != nil { + t.Fatal(err) + } + if string(out) != `{"myVersionKey":"__internal","myKindKey":"TestType1"}`+"\n" { + t.Fatal(string(out)) + } +} + +func TestMultipleNames(t *testing.T) { + _, codec := GetTestScheme() + + obj, _, err := codec.Decode([]byte(`{"myKindKey":"TestType3","myVersionKey":"v1","A":"value"}`), nil, nil) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -219,7 +295,7 @@ func TestMultipleNames(t *testing.T) { t.Fatalf("unexpected decoded object: %#v", internal) } - out, err := s.EncodeToVersion(internal, "v1") + out, err := runtime.Encode(codec, internal) if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -229,14 +305,16 @@ func TestMultipleNames(t *testing.T) { } func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) { - s := NewScheme() + internalGV := unversioned.GroupVersion{Version: runtime.APIVersionInternal} + externalGV := unversioned.GroupVersion{Version: "v1"} + + s := runtime.NewScheme() // create two names internally, with TestType1 being preferred - s.AddKnownTypeWithName("", "TestType1", &TestType1{}) - s.AddKnownTypeWithName("", "OtherType1", &TestType1{}) + s.AddKnownTypeWithName(internalGV.WithKind("TestType1"), &TestType1{}) + s.AddKnownTypeWithName(internalGV.WithKind("OtherType1"), &TestType1{}) // create two names externally, with TestType1 being preferred - s.AddKnownTypeWithName("v1", "TestType1", &ExternalTestType1{}) - s.AddKnownTypeWithName("v1", "OtherType1", &ExternalTestType1{}) - s.MetaFactory = testMetaFactory{} + s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &ExternalTestType1{}) + s.AddKnownTypeWithName(externalGV.WithKind("OtherType1"), &ExternalTestType1{}) ext := &ExternalTestType1{} ext.APIVersion = "v1" @@ -248,130 +326,75 @@ func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) { } expect := &TestType1{A: "test"} - obj, err := s.Decode(data) + codec := newCodecFactory(s, testMetaFactory{}).LegacyCodec(unversioned.GroupVersion{Version: "v1"}) + + obj, err := runtime.Decode(codec, data) if err != nil { t.Fatalf("unexpected error: %v", err) } - if !reflect.DeepEqual(expect, obj) { + if !semantic.DeepEqual(expect, obj) { t.Errorf("unexpected object: %#v", obj) } into := &TestType1{} - if err := s.DecodeInto(data, into); err != nil { + if err := runtime.DecodeInto(codec, data, into); err != nil { t.Fatalf("unexpected error: %v", err) } - if !reflect.DeepEqual(expect, obj) { + if !semantic.DeepEqual(expect, into) { t.Errorf("unexpected object: %#v", obj) } } -func TestKnownTypes(t *testing.T) { - s := GetTestScheme() - if len(s.KnownTypes("v2")) != 0 { - t.Errorf("should have no known types for v2") - } - - types := s.KnownTypes("v1") - for _, s := range []string{"TestType1", "TestType2", "TestType3", "ExternalInternalSame"} { - if _, ok := types[s]; !ok { - t.Errorf("missing type %q", s) - } - } -} - -func TestConvertToVersion(t *testing.T) { - s := GetTestScheme() - tt := &TestType1{A: "I'm not a pointer object"} - other, err := s.ConvertToVersion(tt, "v1") - if err != nil { - t.Fatalf("Failure: %v", err) - } - converted, ok := other.(*ExternalTestType1) - if !ok { - t.Fatalf("Got wrong type") - } - if tt.A != converted.A { - t.Fatalf("Failed to convert object correctly: %#v", converted) - } -} - -func TestConvertToVersionErr(t *testing.T) { - s := GetTestScheme() - tt := TestType1{A: "I'm not a pointer object"} - _, err := s.ConvertToVersion(tt, "v1") - if err == nil { - t.Fatalf("unexpected non-error") - } -} - -func TestEncode_NonPtr(t *testing.T) { - s := GetTestScheme() - tt := TestType1{A: "I'm not a pointer object"} - obj := interface{}(tt) - data, err := s.EncodeToVersion(obj, "v1") - obj2, err2 := s.Decode(data) - if err != nil || err2 != nil { - t.Fatalf("Failure: '%v' '%v'", err, err2) - } - if _, ok := obj2.(*TestType1); !ok { - t.Fatalf("Got wrong type") - } - if !reflect.DeepEqual(obj2, &tt) { - t.Errorf("Expected:\n %#v,\n Got:\n %#v", &tt, obj2) - } -} - func TestEncode_Ptr(t *testing.T) { - s := GetTestScheme() + _, codec := GetTestScheme() tt := &TestType1{A: "I am a pointer object"} - obj := interface{}(tt) - data, err := s.EncodeToVersion(obj, "v1") - obj2, err2 := s.Decode(data) + data, err := runtime.Encode(codec, tt) + obj2, err2 := runtime.Decode(codec, data) if err != nil || err2 != nil { - t.Fatalf("Failure: '%v' '%v'", err, err2) + t.Fatalf("Failure: '%v' '%v'\n%s", err, err2, data) } if _, ok := obj2.(*TestType1); !ok { t.Fatalf("Got wrong type") } - if !reflect.DeepEqual(obj2, tt) { - t.Errorf("Expected:\n %#v,\n Got:\n %#v", &tt, obj2) + if !semantic.DeepEqual(obj2, tt) { + t.Errorf("Expected:\n %#v,\n Got:\n %#v", tt, obj2) } } func TestBadJSONRejection(t *testing.T) { - s := GetTestScheme() + log.SetOutput(os.Stderr) + _, codec := GetTestScheme() badJSONs := [][]byte{ []byte(`{"myVersionKey":"v1"}`), // Missing kind []byte(`{"myVersionKey":"v1","myKindKey":"bar"}`), // Unknown kind []byte(`{"myVersionKey":"bar","myKindKey":"TestType1"}`), // Unknown version + []byte(`{"myKindKey":"TestType1"}`), // Missing version } for _, b := range badJSONs { - if _, err := s.Decode(b); err == nil { + if _, err := runtime.Decode(codec, b); err == nil { t.Errorf("Did not reject bad json: %s", string(b)) } } badJSONKindMismatch := []byte(`{"myVersionKey":"v1","myKindKey":"ExternalInternalSame"}`) - if err := s.DecodeInto(badJSONKindMismatch, &TestType1{}); err == nil { + if err := runtime.DecodeInto(codec, badJSONKindMismatch, &TestType1{}); err == nil { t.Errorf("Kind is set but doesn't match the object type: %s", badJSONKindMismatch) } - if err := s.DecodeInto([]byte(``), &TestType1{}); err == nil { + if err := runtime.DecodeInto(codec, []byte(``), &TestType1{}); err != nil { + t.Errorf("Should allow empty decode: %v", err) + } + if _, _, err := codec.Decode([]byte(``), &unversioned.GroupVersionKind{Kind: "ExternalInternalSame"}, nil); err == nil { + t.Errorf("Did not give error for empty data with only kind default") + } + if _, _, err := codec.Decode([]byte(`{"myVersionKey":"v1"}`), &unversioned.GroupVersionKind{Kind: "ExternalInternalSame"}, nil); err != nil { + t.Errorf("Gave error for version and kind default") + } + if _, _, err := codec.Decode([]byte(`{"myKindKey":"ExternalInternalSame"}`), &unversioned.GroupVersionKind{Version: "v1"}, nil); err != nil { + t.Errorf("Gave error for version and kind default") + } + if _, _, err := codec.Decode([]byte(``), &unversioned.GroupVersionKind{Kind: "ExternalInternalSame", Version: "v1"}, nil); err != nil { + t.Errorf("Gave error for version and kind defaulted: %v", err) + } + if _, err := runtime.Decode(codec, []byte(``)); err == nil { t.Errorf("Did not give error for empty data") } } - -func TestBadJSONRejectionForSetInternalVersion(t *testing.T) { - s := GetTestScheme() - s.InternalVersion = "v1" - badJSONs := [][]byte{ - []byte(`{"myKindKey":"TestType1"}`), // Missing version - } - for _, b := range badJSONs { - if _, err := s.Decode(b); err == nil { - t.Errorf("Did not reject bad json: %s", string(b)) - } - } - badJSONKindMismatch := []byte(`{"myVersionKey":"v1","myKindKey":"ExternalInternalSame"}`) - if err := s.DecodeInto(badJSONKindMismatch, &TestType1{}); err == nil { - t.Errorf("Kind is set but doesn't match the object type: %s", badJSONKindMismatch) - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/json.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/json.go new file mode 100644 index 000000000..f9fb4bbfb --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/json.go @@ -0,0 +1,191 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package json + +import ( + "encoding/json" + "io" + + "github.com/ghodss/yaml" + "github.com/ugorji/go/codec" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" + utilyaml "k8s.io/kubernetes/pkg/util/yaml" +) + +// NewSerializer creates a JSON serializer that handles encoding versioned objects into the proper JSON form. If typer +// is not nil, the object has the group, version, and kind fields set. +func NewSerializer(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.Typer, pretty bool) runtime.Serializer { + return &Serializer{ + meta: meta, + creater: creater, + typer: typer, + yaml: false, + pretty: pretty, + } +} + +// NewYAMLSerializer creates a YAML serializer that handles encoding versioned objects into the proper YAML form. If typer +// is not nil, the object has the group, version, and kind fields set. This serializer supports only the subset of YAML that +// matches JSON, and will error if constructs are used that do not serialize to JSON. +func NewYAMLSerializer(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.Typer) runtime.Serializer { + return &Serializer{ + meta: meta, + creater: creater, + typer: typer, + yaml: true, + } +} + +type Serializer struct { + meta MetaFactory + creater runtime.ObjectCreater + typer runtime.Typer + yaml bool + pretty bool +} + +// Decode attempts to convert the provided data into YAML or JSON, extract the stored schema kind, apply the provided default gvk, and then +// load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown, the raw data will be +// extracted and no decoding will be performed. If into is not registered with the typer, then the object will be straight decoded using +// normal JSON/YAML unmarshalling. If into is provided and the original data is not fully qualified with kind/version/group, the type of +// the into will be used to alter the returned gvk. On success or most errors, the method will return the calculated schema kind. +func (s *Serializer) Decode(originalData []byte, gvk *unversioned.GroupVersionKind, into runtime.Object) (runtime.Object, *unversioned.GroupVersionKind, error) { + if versioned, ok := into.(*runtime.VersionedObjects); ok { + into = versioned.Last() + obj, actual, err := s.Decode(originalData, gvk, into) + if err != nil { + return nil, actual, err + } + versioned.Objects = []runtime.Object{obj} + return versioned, actual, nil + } + + data := originalData + if s.yaml { + altered, err := yaml.YAMLToJSON(data) + if err != nil { + return nil, nil, err + } + data = altered + } + + actual, err := s.meta.Interpret(data) + if err != nil { + return nil, nil, err + } + + if gvk != nil { + // apply kind and version defaulting from provided default + if len(actual.Kind) == 0 { + actual.Kind = gvk.Kind + } + if len(actual.Version) == 0 && len(actual.Group) == 0 { + actual.Group = gvk.Group + actual.Version = gvk.Version + } + if len(actual.Version) == 0 && actual.Group == gvk.Group { + actual.Version = gvk.Version + } + } + + if unk, ok := into.(*runtime.Unknown); ok && unk != nil { + unk.RawJSON = originalData + // TODO: set content type here + unk.GetObjectKind().SetGroupVersionKind(actual) + return unk, actual, nil + } + + if into != nil { + typed, _, err := s.typer.ObjectKind(into) + switch { + case runtime.IsNotRegisteredError(err): + if err := codec.NewDecoderBytes(data, new(codec.JsonHandle)).Decode(into); err != nil { + return nil, actual, err + } + return into, actual, nil + case err != nil: + return nil, actual, err + default: + if len(actual.Kind) == 0 { + actual.Kind = typed.Kind + } + if len(actual.Version) == 0 && len(actual.Group) == 0 { + actual.Group = typed.Group + actual.Version = typed.Version + } + if len(actual.Version) == 0 && actual.Group == typed.Group { + actual.Version = typed.Version + } + } + } + + if len(actual.Kind) == 0 { + return nil, actual, runtime.NewMissingKindErr(string(originalData)) + } + if len(actual.Version) == 0 { + return nil, actual, runtime.NewMissingVersionErr(string(originalData)) + } + + // use the target if necessary + obj, err := runtime.UseOrCreateObject(s.typer, s.creater, *actual, into) + if err != nil { + return nil, actual, err + } + + if err := codec.NewDecoderBytes(data, new(codec.JsonHandle)).Decode(obj); err != nil { + return nil, actual, err + } + return obj, actual, nil +} + +// EncodeToStream serializes the provided object to the given writer. Overrides is ignored. +func (s *Serializer) EncodeToStream(obj runtime.Object, w io.Writer, overrides ...unversioned.GroupVersion) error { + if s.yaml { + json, err := json.Marshal(obj) + if err != nil { + return err + } + data, err := yaml.JSONToYAML(json) + if err != nil { + return err + } + _, err = w.Write(data) + return err + } + + if s.pretty { + data, err := json.MarshalIndent(obj, "", " ") + if err != nil { + return err + } + _, err = w.Write(data) + return err + } + encoder := json.NewEncoder(w) + return encoder.Encode(obj) +} + +// RecognizesData implements the RecognizingDecoder interface. +func (s *Serializer) RecognizesData(peek io.Reader) (bool, error) { + _, ok := utilyaml.GuessJSONStream(peek, 2048) + if s.yaml { + return !ok, nil + } + return ok, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/json_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/json_test.go new file mode 100644 index 000000000..b9e1319fa --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/json_test.go @@ -0,0 +1,268 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package json_test + +import ( + "fmt" + "reflect" + "strings" + "testing" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer/json" + "k8s.io/kubernetes/pkg/util" +) + +type testDecodable struct { + Other string + Value int `json:"value"` + gvk *unversioned.GroupVersionKind +} + +func (d *testDecodable) GetObjectKind() unversioned.ObjectKind { return d } +func (d *testDecodable) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { d.gvk = gvk } +func (d *testDecodable) GroupVersionKind() *unversioned.GroupVersionKind { return d.gvk } + +func TestDecode(t *testing.T) { + testCases := []struct { + creater runtime.ObjectCreater + typer runtime.Typer + yaml bool + pretty bool + + data []byte + defaultGVK *unversioned.GroupVersionKind + into runtime.Object + + errFn func(error) bool + expectedObject runtime.Object + expectedGVK *unversioned.GroupVersionKind + }{ + { + data: []byte("{}"), + + expectedGVK: &unversioned.GroupVersionKind{}, + errFn: func(err error) bool { return strings.Contains(err.Error(), "Object 'Kind' is missing in") }, + }, + { + data: []byte("{}"), + defaultGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + creater: &mockCreater{err: fmt.Errorf("fake error")}, + + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + errFn: func(err error) bool { return err.Error() == "fake error" }, + }, + { + data: []byte("{}"), + defaultGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + creater: &mockCreater{err: fmt.Errorf("fake error")}, + + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + errFn: func(err error) bool { return err.Error() == "fake error" }, + }, + { + data: []byte("{}"), + defaultGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + creater: &mockCreater{obj: &testDecodable{}}, + expectedObject: &testDecodable{ + gvk: nil, // json serializer does NOT set GVK + }, + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + }, + + // version without group is not defaulted + { + data: []byte(`{"apiVersion":"blah"}`), + defaultGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + creater: &mockCreater{obj: &testDecodable{}}, + expectedObject: &testDecodable{ + gvk: nil, // json serializer does NOT set GVK + }, + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "", Version: "blah"}, + }, + // group without version is defaulted + { + data: []byte(`{"apiVersion":"other/"}`), + defaultGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + creater: &mockCreater{obj: &testDecodable{}}, + expectedObject: &testDecodable{ + gvk: nil, // json serializer does NOT set GVK + }, + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + }, + + // accept runtime.Unknown as into and bypass creator + { + data: []byte(`{}`), + into: &runtime.Unknown{}, + + expectedGVK: &unversioned.GroupVersionKind{}, + expectedObject: &runtime.Unknown{ + RawJSON: []byte(`{}`), + }, + }, + { + data: []byte(`{"test":"object"}`), + into: &runtime.Unknown{}, + + expectedGVK: &unversioned.GroupVersionKind{}, + expectedObject: &runtime.Unknown{ + RawJSON: []byte(`{"test":"object"}`), + }, + }, + { + data: []byte(`{"test":"object"}`), + into: &runtime.Unknown{}, + defaultGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + expectedObject: &runtime.Unknown{ + TypeMeta: runtime.TypeMeta{APIVersion: "other/blah", Kind: "Test"}, + RawJSON: []byte(`{"test":"object"}`), + }, + }, + + // unregistered objects can be decoded into directly + { + data: []byte(`{"kind":"Test","apiVersion":"other/blah","value":1,"Other":"test"}`), + into: &testDecodable{}, + typer: &mockTyper{err: runtime.NewNotRegisteredErr(unversioned.GroupVersionKind{}, nil)}, + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + expectedObject: &testDecodable{ + Other: "test", + Value: 1, + }, + }, + // registered types get defaulted by the into object kind + { + data: []byte(`{"value":1,"Other":"test"}`), + into: &testDecodable{}, + typer: &mockTyper{gvk: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}}, + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + expectedObject: &testDecodable{ + Other: "test", + Value: 1, + }, + }, + // registered types get defaulted by the into object kind even without version, but return an error + { + data: []byte(`{"value":1,"Other":"test"}`), + into: &testDecodable{}, + typer: &mockTyper{gvk: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: ""}}, + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: ""}, + errFn: func(err error) bool { return strings.Contains(err.Error(), "Object 'apiVersion' is missing in") }, + expectedObject: &testDecodable{ + Other: "test", + Value: 1, + }, + }, + + // runtime.VersionedObjects are decoded + { + data: []byte(`{"value":1,"Other":"test"}`), + into: &runtime.VersionedObjects{Objects: []runtime.Object{}}, + creater: &mockCreater{obj: &testDecodable{}}, + typer: &mockTyper{gvk: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}}, + defaultGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + expectedObject: &runtime.VersionedObjects{ + Objects: []runtime.Object{ + &testDecodable{ + Other: "test", + Value: 1, + }, + }, + }, + }, + // runtime.VersionedObjects with an object are decoded into + { + data: []byte(`{"Other":"test"}`), + into: &runtime.VersionedObjects{Objects: []runtime.Object{&testDecodable{Value: 2}}}, + typer: &mockTyper{gvk: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}}, + expectedGVK: &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}, + expectedObject: &runtime.VersionedObjects{ + Objects: []runtime.Object{ + &testDecodable{ + Other: "test", + Value: 2, + }, + }, + }, + }, + } + + for i, test := range testCases { + var s runtime.Serializer + if test.yaml { + s = json.NewYAMLSerializer(json.DefaultMetaFactory, test.creater, test.typer) + } else { + s = json.NewSerializer(json.DefaultMetaFactory, test.creater, test.typer, test.pretty) + } + obj, gvk, err := s.Decode([]byte(test.data), test.defaultGVK, test.into) + + if !reflect.DeepEqual(test.expectedGVK, gvk) { + t.Errorf("%d: unexpected GVK: %v", i, gvk) + } + + switch { + case err == nil && test.errFn != nil: + t.Errorf("%d: failed: %v", i, err) + continue + case err != nil && test.errFn == nil: + t.Errorf("%d: failed: %v", i, err) + continue + case err != nil: + if !test.errFn(err) { + t.Errorf("%d: failed: %v", i, err) + } + if obj != nil { + t.Errorf("%d: should have returned nil object", i) + } + continue + } + + if test.into != nil && test.into != obj { + t.Errorf("%d: expected into to be returned: %v", i, obj) + continue + } + + if !reflect.DeepEqual(test.expectedObject, obj) { + t.Errorf("%d: unexpected object:\n%s", i, util.ObjectGoPrintSideBySide(test.expectedObject, obj)) + } + } +} + +type mockCreater struct { + apiVersion string + kind string + err error + obj runtime.Object +} + +func (c *mockCreater) New(kind unversioned.GroupVersionKind) (runtime.Object, error) { + c.apiVersion, c.kind = kind.GroupVersion().String(), kind.Kind + return c.obj, c.err +} + +type mockTyper struct { + gvk *unversioned.GroupVersionKind + err error +} + +func (t *mockTyper) ObjectKind(obj runtime.Object) (*unversioned.GroupVersionKind, bool, error) { + return t.gvk, false, t.err +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/meta.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/meta.go new file mode 100644 index 000000000..91df105ed --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/meta.go @@ -0,0 +1,61 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package json + +import ( + "encoding/json" + "fmt" + + "k8s.io/kubernetes/pkg/api/unversioned" +) + +// MetaFactory is used to store and retrieve the version and kind +// information for JSON objects in a serializer. +type MetaFactory interface { + // Interpret should return the version and kind of the wire-format of + // the object. + Interpret(data []byte) (*unversioned.GroupVersionKind, error) +} + +// DefaultMetaFactory is a default factory for versioning objects in JSON. The object +// in memory and in the default JSON serialization will use the "kind" and "apiVersion" +// fields. +var DefaultMetaFactory = SimpleMetaFactory{} + +// SimpleMetaFactory provides default methods for retrieving the type and version of objects +// that are identified with an "apiVersion" and "kind" fields in their JSON +// serialization. It may be parameterized with the names of the fields in memory, or an +// optional list of base structs to search for those fields in memory. +type SimpleMetaFactory struct { +} + +// Interpret will return the APIVersion and Kind of the JSON wire-format +// encoding of an object, or an error. +func (SimpleMetaFactory) Interpret(data []byte) (*unversioned.GroupVersionKind, error) { + findKind := struct { + APIVersion string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` + }{} + if err := json.Unmarshal(data, &findKind); err != nil { + return nil, fmt.Errorf("couldn't get version/kind; json parse error: %v", err) + } + gv, err := unversioned.ParseGroupVersion(findKind.APIVersion) + if err != nil { + return nil, err + } + return &unversioned.GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: findKind.Kind}, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/meta_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/meta_test.go new file mode 100644 index 000000000..4b6351286 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/json/meta_test.go @@ -0,0 +1,45 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package json + +import "testing" + +func TestSimpleMetaFactoryInterpret(t *testing.T) { + factory := SimpleMetaFactory{} + gvk, err := factory.Interpret([]byte(`{"apiVersion":"1","kind":"object"}`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if gvk.Version != "1" || gvk.Kind != "object" { + t.Errorf("unexpected interpret: %#v", gvk) + } + + // no kind or version + gvk, err = factory.Interpret([]byte(`{}`)) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if gvk.Version != "" || gvk.Kind != "" { + t.Errorf("unexpected interpret: %#v", gvk) + } + + // unparsable + gvk, err = factory.Interpret([]byte(`{`)) + if err == nil { + t.Errorf("unexpected non-error") + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/recognizer/recognizer.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/recognizer/recognizer.go new file mode 100644 index 000000000..14a2cb3e8 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/recognizer/recognizer.go @@ -0,0 +1,79 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package recognizer + +import ( + "bytes" + "fmt" + "io" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +type RecognizingDecoder interface { + runtime.Decoder + RecognizesData(peek io.Reader) (bool, error) +} + +func NewDecoder(decoders ...runtime.Decoder) runtime.Decoder { + recognizing, blind := []RecognizingDecoder{}, []runtime.Decoder{} + for _, d := range decoders { + if r, ok := d.(RecognizingDecoder); ok { + recognizing = append(recognizing, r) + } else { + blind = append(blind, d) + } + } + return &decoder{ + recognizing: recognizing, + blind: blind, + } +} + +type decoder struct { + recognizing []RecognizingDecoder + blind []runtime.Decoder +} + +func (d *decoder) Decode(data []byte, gvk *unversioned.GroupVersionKind, into runtime.Object) (runtime.Object, *unversioned.GroupVersionKind, error) { + var lastErr error + for _, r := range d.recognizing { + buf := bytes.NewBuffer(data) + ok, err := r.RecognizesData(buf) + if err != nil { + lastErr = err + continue + } + if !ok { + continue + } + return r.Decode(data, gvk, into) + } + for _, d := range d.blind { + out, actual, err := d.Decode(data, gvk, into) + if err != nil { + lastErr = err + continue + } + return out, actual, nil + } + if lastErr == nil { + lastErr = fmt.Errorf("no serialization format matched the provided data") + } + return nil, nil, lastErr +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/recognizer/recognizer_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/recognizer/recognizer_test.go new file mode 100644 index 000000000..c83b87aa4 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/recognizer/recognizer_test.go @@ -0,0 +1,57 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package recognizer + +import ( + "testing" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer/json" +) + +type A struct{} + +func (A) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } + +func TestRecognizer(t *testing.T) { + s := runtime.NewScheme() + s.AddKnownTypes(unversioned.GroupVersion{Version: "v1"}, &A{}) + d := NewDecoder( + json.NewSerializer(json.DefaultMetaFactory, s, runtime.ObjectTyperToTyper(s), false), + json.NewYAMLSerializer(json.DefaultMetaFactory, s, runtime.ObjectTyperToTyper(s)), + ) + out, _, err := d.Decode([]byte(` +kind: A +apiVersion: v1 +`), nil, nil) + if err != nil { + t.Fatal(err) + } + t.Logf("%#v", out) + + out, _, err = d.Decode([]byte(` +{ + "kind":"A", + "apiVersion":"v1" +} +`), nil, nil) + if err != nil { + t.Fatal(err) + } + t.Logf("%#v", out) +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/versioning/versioning.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/versioning/versioning.go new file mode 100644 index 000000000..ea255a90c --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/versioning/versioning.go @@ -0,0 +1,251 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package versioning + +import ( + "fmt" + "io" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" +) + +// NewCodecForScheme is a convenience method for callers that are using a scheme. +func NewCodecForScheme( + // TODO: I should be a scheme interface? + scheme *runtime.Scheme, + serializer runtime.Serializer, + encodeVersion []unversioned.GroupVersion, + decodeVersion []unversioned.GroupVersion, +) runtime.Codec { + return NewCodec(serializer, scheme, scheme, scheme, runtime.ObjectTyperToTyper(scheme), encodeVersion, decodeVersion) +} + +// NewCodec takes objects in their internal versions and converts them to external versions before +// serializing them. It assumes the serializer provided to it only deals with external versions. +// This class is also a serializer, but is generally used with a specific version. +func NewCodec( + serializer runtime.Serializer, + convertor runtime.ObjectConvertor, + creater runtime.ObjectCreater, + copier runtime.ObjectCopier, + typer runtime.Typer, + encodeVersion []unversioned.GroupVersion, + decodeVersion []unversioned.GroupVersion, +) runtime.Codec { + internal := &codec{ + serializer: serializer, + convertor: convertor, + creater: creater, + copier: copier, + typer: typer, + } + if encodeVersion != nil { + internal.encodeVersion = make(map[string]unversioned.GroupVersion) + for _, v := range encodeVersion { + // first one for a group wins. This is consistent with best to worst order throughout the codebase + if _, ok := internal.encodeVersion[v.Group]; ok { + continue + } + internal.encodeVersion[v.Group] = v + } + } + if decodeVersion != nil { + internal.decodeVersion = make(map[string]unversioned.GroupVersion) + for _, v := range decodeVersion { + // first one for a group wins. This is consistent with best to worst order throughout the codebase + if _, ok := internal.decodeVersion[v.Group]; ok { + continue + } + internal.decodeVersion[v.Group] = v + } + } + + return internal +} + +type codec struct { + serializer runtime.Serializer + convertor runtime.ObjectConvertor + creater runtime.ObjectCreater + copier runtime.ObjectCopier + typer runtime.Typer + + encodeVersion map[string]unversioned.GroupVersion + decodeVersion map[string]unversioned.GroupVersion +} + +// Decode attempts a decode of the object, then tries to convert it to the internal version. If into is provided and the decoding is +// successful, the returned runtime.Object will be the value passed as into. Note that this may bypass conversion if you pass an +// into that matches the serialized version. +func (c *codec) Decode(data []byte, defaultGVK *unversioned.GroupVersionKind, into runtime.Object) (runtime.Object, *unversioned.GroupVersionKind, error) { + versioned, isVersioned := into.(*runtime.VersionedObjects) + if isVersioned { + into = versioned.Last() + } + + obj, gvk, err := c.serializer.Decode(data, defaultGVK, into) + if err != nil { + return nil, gvk, err + } + + // if we specify a target, use generic conversion. + if into != nil { + if into == obj { + if isVersioned { + return versioned, gvk, nil + } + return into, gvk, nil + } + if err := c.convertor.Convert(obj, into); err != nil { + return nil, gvk, err + } + if isVersioned { + versioned.Objects = []runtime.Object{obj, into} + return versioned, gvk, nil + } + return into, gvk, nil + } + + // invoke a version conversion + group := gvk.Group + if defaultGVK != nil { + group = defaultGVK.Group + } + var targetGV unversioned.GroupVersion + if c.decodeVersion == nil { + // convert to internal by default + targetGV.Group = group + targetGV.Version = runtime.APIVersionInternal + } else { + gv, ok := c.decodeVersion[group] + if !ok { + // unknown objects are left in their original version + if isVersioned { + versioned.Objects = []runtime.Object{obj} + return versioned, gvk, nil + } + return obj, gvk, nil + } + targetGV = gv + } + + if gvk.GroupVersion() == targetGV { + if isVersioned { + versioned.Objects = []runtime.Object{obj} + return versioned, gvk, nil + } + return obj, gvk, nil + } + + if isVersioned { + // create a copy, because ConvertToVersion does not guarantee non-mutation of objects + copied, err := c.copier.Copy(obj) + if err != nil { + copied = obj + } + versioned.Objects = []runtime.Object{copied} + } + + // Convert if needed. + out, err := c.convertor.ConvertToVersion(obj, targetGV.String()) + if err != nil { + return nil, gvk, err + } + if isVersioned { + versioned.Objects = append(versioned.Objects, out) + return versioned, gvk, nil + } + return out, gvk, nil +} + +// EncodeToStream ensures the provided object is output in the right scheme. If overrides are specified, when +// encoding the object the first override that matches the object's group is used. Other overrides are ignored. +func (c *codec) EncodeToStream(obj runtime.Object, w io.Writer, overrides ...unversioned.GroupVersion) error { + if _, ok := obj.(*runtime.Unknown); ok { + return c.serializer.EncodeToStream(obj, w, overrides...) + } + gvk, isUnversioned, err := c.typer.ObjectKind(obj) + if err != nil { + return err + } + + if (c.encodeVersion == nil && len(overrides) == 0) || isUnversioned { + old := obj.GetObjectKind().GroupVersionKind() + obj.GetObjectKind().SetGroupVersionKind(gvk) + defer obj.GetObjectKind().SetGroupVersionKind(old) + return c.serializer.EncodeToStream(obj, w, overrides...) + } + + targetGV, ok := c.encodeVersion[gvk.Group] + // use override if provided + for i, override := range overrides { + if override.Group == gvk.Group { + ok = true + targetGV = override + // swap the position of the override + overrides[0], overrides[i] = targetGV, overrides[0] + break + } + } + + // attempt a conversion to the sole encode version + if !ok && len(c.encodeVersion) == 1 { + ok = true + for _, v := range c.encodeVersion { + targetGV = v + } + // ensure the target override is first + overrides = promoteOrPrependGroupVersion(targetGV, overrides) + } + + // if no fallback is available, error + if !ok { + return fmt.Errorf("the codec does not recognize group %q for kind %q and cannot encode it", gvk.Group, gvk.Kind) + } + + // Perform a conversion if necessary + if gvk.GroupVersion() != targetGV { + out, err := c.convertor.ConvertToVersion(obj, targetGV.String()) + if err != nil { + if ok { + return err + } + } else { + obj = out + } + } else { + old := obj.GetObjectKind().GroupVersionKind() + defer obj.GetObjectKind().SetGroupVersionKind(old) + obj.GetObjectKind().SetGroupVersionKind(&unversioned.GroupVersionKind{Group: targetGV.Group, Version: targetGV.Version, Kind: gvk.Kind}) + } + + return c.serializer.EncodeToStream(obj, w, overrides...) +} + +// promoteOrPrependGroupVersion finds the group version in the provided group versions that has the same group as target. +// If the group is found the returned array will have that group version in the first position - if the group is not found +// the returned array will have target in the first position. +func promoteOrPrependGroupVersion(target unversioned.GroupVersion, gvs []unversioned.GroupVersion) []unversioned.GroupVersion { + for i, gv := range gvs { + if gv.Group == target.Group { + gvs[0], gvs[i] = gvs[i], gvs[0] + return gvs + } + } + return append([]unversioned.GroupVersion{target}, gvs...) +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/versioning/versioning_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/versioning/versioning_test.go new file mode 100644 index 000000000..3d7eba27e --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/versioning/versioning_test.go @@ -0,0 +1,300 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package versioning + +import ( + "fmt" + "io" + "reflect" + "testing" + + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util" +) + +type testDecodable struct { + Other string + Value int `json:"value"` + gvk *unversioned.GroupVersionKind +} + +func (d *testDecodable) GetObjectKind() unversioned.ObjectKind { return d } +func (d *testDecodable) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { d.gvk = gvk } +func (d *testDecodable) GroupVersionKind() *unversioned.GroupVersionKind { return d.gvk } + +func TestDecode(t *testing.T) { + gvk1 := &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"} + decodable1 := &testDecodable{} + decodable2 := &testDecodable{} + decodable3 := &testDecodable{} + versionedDecodable1 := &runtime.VersionedObjects{Objects: []runtime.Object{decodable1}} + + testCases := []struct { + serializer runtime.Serializer + convertor runtime.ObjectConvertor + creater runtime.ObjectCreater + copier runtime.ObjectCopier + typer runtime.Typer + yaml bool + pretty bool + + encodes, decodes []unversioned.GroupVersion + + defaultGVK *unversioned.GroupVersionKind + into runtime.Object + + errFn func(error) bool + expectedObject runtime.Object + sameObject runtime.Object + expectedGVK *unversioned.GroupVersionKind + }{ + { + serializer: &mockSerializer{actual: gvk1}, + convertor: &checkConvertor{groupVersion: "other/__internal"}, + expectedGVK: gvk1, + }, + { + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: "other/__internal"}, + expectedGVK: gvk1, + sameObject: decodable2, + }, + // defaultGVK.Group is allowed to force a conversion to the destination group + { + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + defaultGVK: &unversioned.GroupVersionKind{Group: "force"}, + convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: "force/__internal"}, + expectedGVK: gvk1, + sameObject: decodable2, + }, + // uses direct conversion for into when objects differ + { + into: decodable3, + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + convertor: &checkConvertor{in: decodable1, obj: decodable3, directConvert: true}, + expectedGVK: gvk1, + sameObject: decodable3, + }, + { + into: versionedDecodable1, + serializer: &mockSerializer{actual: gvk1, obj: decodable3}, + convertor: &checkConvertor{in: decodable3, obj: decodable1, directConvert: true}, + expectedGVK: gvk1, + sameObject: versionedDecodable1, + }, + // returns directly when serializer returns into + { + into: decodable3, + serializer: &mockSerializer{actual: gvk1, obj: decodable3}, + expectedGVK: gvk1, + sameObject: decodable3, + }, + // returns directly when serializer returns into + { + into: versionedDecodable1, + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + expectedGVK: gvk1, + sameObject: versionedDecodable1, + }, + + // runtime.VersionedObjects are decoded + { + into: &runtime.VersionedObjects{Objects: []runtime.Object{}}, + + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + copier: &checkCopy{in: decodable1, obj: decodable1}, + convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: "other/__internal"}, + expectedGVK: gvk1, + expectedObject: &runtime.VersionedObjects{Objects: []runtime.Object{decodable1, decodable2}}, + }, + { + into: &runtime.VersionedObjects{Objects: []runtime.Object{}}, + + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + copier: &checkCopy{in: decodable1, obj: nil, err: fmt.Errorf("error on copy")}, + convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: "other/__internal"}, + expectedGVK: gvk1, + expectedObject: &runtime.VersionedObjects{Objects: []runtime.Object{decodable1, decodable2}}, + }, + + // decode into the same version as the serialized object + { + decodes: []unversioned.GroupVersion{gvk1.GroupVersion()}, + + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + expectedGVK: gvk1, + expectedObject: decodable1, + }, + { + into: &runtime.VersionedObjects{Objects: []runtime.Object{}}, + decodes: []unversioned.GroupVersion{gvk1.GroupVersion()}, + + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + expectedGVK: gvk1, + expectedObject: &runtime.VersionedObjects{Objects: []runtime.Object{decodable1}}, + }, + + // codec with non matching version skips conversion altogether + { + decodes: []unversioned.GroupVersion{{Group: "something", Version: "else"}}, + + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + expectedGVK: gvk1, + expectedObject: decodable1, + }, + { + into: &runtime.VersionedObjects{Objects: []runtime.Object{}}, + decodes: []unversioned.GroupVersion{{Group: "something", Version: "else"}}, + + serializer: &mockSerializer{actual: gvk1, obj: decodable1}, + expectedGVK: gvk1, + expectedObject: &runtime.VersionedObjects{Objects: []runtime.Object{decodable1}}, + }, + } + + for i, test := range testCases { + t.Logf("%d", i) + s := NewCodec(test.serializer, test.convertor, test.creater, test.copier, test.typer, test.encodes, test.decodes) + obj, gvk, err := s.Decode([]byte(`{}`), test.defaultGVK, test.into) + + if !reflect.DeepEqual(test.expectedGVK, gvk) { + t.Errorf("%d: unexpected GVK: %v", i, gvk) + } + + switch { + case err == nil && test.errFn != nil: + t.Errorf("%d: failed: %v", i, err) + continue + case err != nil && test.errFn == nil: + t.Errorf("%d: failed: %v", i, err) + continue + case err != nil: + if !test.errFn(err) { + t.Errorf("%d: failed: %v", i, err) + } + if obj != nil { + t.Errorf("%d: should have returned nil object", i) + } + continue + } + + if test.into != nil && test.into != obj { + t.Errorf("%d: expected into to be returned: %v", i, obj) + continue + } + + switch { + case test.expectedObject != nil: + if !reflect.DeepEqual(test.expectedObject, obj) { + t.Errorf("%d: unexpected object:\n%s", i, util.ObjectGoPrintSideBySide(test.expectedObject, obj)) + } + case test.sameObject != nil: + if test.sameObject != obj { + t.Errorf("%d: unexpected object:\n%s", i, util.ObjectGoPrintSideBySide(test.sameObject, obj)) + } + case obj != nil: + t.Errorf("%d: unexpected object: %#v", i, obj) + } + } +} + +type checkCopy struct { + in, obj runtime.Object + err error +} + +func (c *checkCopy) Copy(obj runtime.Object) (runtime.Object, error) { + if c.in != nil && c.in != obj { + return nil, fmt.Errorf("unexpected input to copy: %#v", obj) + } + return c.obj, c.err +} + +type checkConvertor struct { + err error + in, obj runtime.Object + groupVersion string + directConvert bool +} + +func (c *checkConvertor) Convert(in, out interface{}) error { + if !c.directConvert { + return fmt.Errorf("unexpected call to Convert") + } + if c.in != nil && c.in != in { + return fmt.Errorf("unexpected in: %s", in) + } + if c.obj != nil && c.obj != out { + return fmt.Errorf("unexpected out: %s", out) + } + return c.err +} +func (c *checkConvertor) ConvertToVersion(in runtime.Object, outVersion string) (out runtime.Object, err error) { + if c.directConvert { + return nil, fmt.Errorf("unexpected call to ConvertToVersion") + } + if c.in != nil && c.in != in { + return nil, fmt.Errorf("unexpected in: %s", in) + } + if c.groupVersion != outVersion { + return nil, fmt.Errorf("unexpected outversion: %s", outVersion) + } + return c.obj, c.err +} +func (c *checkConvertor) ConvertFieldLabel(version, kind, label, value string) (string, string, error) { + return "", "", fmt.Errorf("unexpected call to ConvertFieldLabel") +} + +type mockSerializer struct { + err error + obj runtime.Object + versions []unversioned.GroupVersion + + defaults, actual *unversioned.GroupVersionKind + into runtime.Object +} + +func (s *mockSerializer) Decode(data []byte, defaults *unversioned.GroupVersionKind, into runtime.Object) (runtime.Object, *unversioned.GroupVersionKind, error) { + s.defaults = defaults + s.into = into + return s.obj, s.actual, s.err +} + +func (s *mockSerializer) EncodeToStream(obj runtime.Object, w io.Writer, versions ...unversioned.GroupVersion) error { + s.obj = obj + s.versions = versions + return s.err +} + +type mockCreater struct { + err error + obj runtime.Object +} + +func (c *mockCreater) New(kind unversioned.GroupVersionKind) (runtime.Object, error) { + return c.obj, c.err +} + +type mockTyper struct { + gvk *unversioned.GroupVersionKind + err error +} + +func (t *mockTyper) ObjectKind(obj runtime.Object) (*unversioned.GroupVersionKind, bool, error) { + return t.gvk, false, t.err +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/serializer/yaml/yaml.go b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/yaml/yaml.go new file mode 100644 index 000000000..637c777be --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/runtime/serializer/yaml/yaml.go @@ -0,0 +1,46 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package yaml + +import ( + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/yaml" +) + +// yamlSerializer converts YAML passed to the Decoder methods to JSON. +type yamlSerializer struct { + // the nested serializer + runtime.Serializer +} + +// yamlSerializer implements Serializer +var _ runtime.Serializer = yamlSerializer{} + +// NewDecodingSerializer adds YAML decoding support to a serializer that supports JSON. +func NewDecodingSerializer(jsonSerializer runtime.Serializer) runtime.Serializer { + return &yamlSerializer{jsonSerializer} +} + +func (c yamlSerializer) Decode(data []byte, gvk *unversioned.GroupVersionKind, into runtime.Object) (runtime.Object, *unversioned.GroupVersionKind, error) { + out, err := yaml.ToJSON(data) + if err != nil { + return nil, nil, err + } + data = out + return c.Serializer.Decode(data, gvk, into) +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/swagger_doc_generator.go b/vendor/k8s.io/kubernetes/pkg/runtime/swagger_doc_generator.go index 829ce7b71..8d922ccd6 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/swagger_doc_generator.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/swagger_doc_generator.go @@ -65,11 +65,14 @@ func fmtRawDoc(rawDoc string) string { for _, line := range strings.Split(rawDoc, "\n") { line = strings.TrimRight(line, " ") - - if line == "" { // Keep paragraphs + leading := strings.TrimLeft(line, " ") + switch { + case len(line) == 0: // Keep paragraphs delPrevChar() buffer.WriteString("\n\n") - } else if !strings.HasPrefix(strings.TrimLeft(line, " "), "TODO") { // Ignore one line TODOs + case strings.HasPrefix(leading, "TODO"): // Ignore one line TODOs + case strings.HasPrefix(leading, "+"): // Ignore instructions to go2idl + default: if strings.HasPrefix(line, " ") || strings.HasPrefix(line, "\t") { delPrevChar() line = "\n" + line + "\n" // Replace it with newline. This is useful when we have a line with: "Example:\n\tJSON-someting..." diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/types.go b/vendor/k8s.io/kubernetes/pkg/runtime/types.go index 28a9f6603..3b8cede44 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/types.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/types.go @@ -25,49 +25,29 @@ package runtime // runtime.TypeMeta `json:",inline"` // ... // other fields // } -// func (*MyAwesomeAPIObject) IsAnAPIObject() {} +// func (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { unversioned.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind // // TypeMeta is provided here for convenience. You may use it directly from this package or define // your own with the same fields. // +// +protobuf=true type TypeMeta struct { APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` } -// PluginBase is like TypeMeta, but it's intended for plugin objects that won't ever be encoded -// except while embedded in other objects. -type PluginBase struct { - Kind string `json:"kind,omitempty"` -} - -// EmbeddedObject has appropriate encoder and decoder functions, such that on the wire, it's -// stored as a []byte, but in memory, the contained object is accessible as an Object -// via the Get() function. Only valid API objects may be stored via EmbeddedObject. -// The purpose of this is to allow an API object of type known only at runtime to be -// embedded within other API objects. -// -// Note that object assumes that you've registered all of your api types with the api package. -// -// EmbeddedObject and RawExtension can be used together to allow for API object extensions: -// see the comment for RawExtension. -type EmbeddedObject struct { - Object -} - -// RawExtension is used with EmbeddedObject to do a two-phase encoding of extension objects. +// RawExtension is used to hold extensions in external versions. // // To use this, make a field which has RawExtension as its type in your external, versioned -// struct, and EmbeddedObject in your internal struct. You also need to register your +// struct, and Object in your internal struct. You also need to register your // various plugin types. // // // Internal package: // type MyAPIObject struct { // runtime.TypeMeta `json:",inline"` -// MyPlugin runtime.EmbeddedObject `json:"myPlugin"` +// MyPlugin runtime.Object `json:"myPlugin"` // } // type PluginA struct { -// runtime.PluginBase `json:",inline"` // AOption string `json:"aOption"` // } // @@ -77,14 +57,13 @@ type EmbeddedObject struct { // MyPlugin runtime.RawExtension `json:"myPlugin"` // } // type PluginA struct { -// runtime.PluginBase `json:",inline"` // AOption string `json:"aOption"` // } // // // On the wire, the JSON will look something like this: // { // "kind":"MyAPIObject", -// "apiVersion":"v1beta1", +// "apiVersion":"v1", // "myPlugin": { // "kind":"PluginA", // "aOption":"foo", @@ -96,10 +75,16 @@ type EmbeddedObject struct { // The next step is to copy (using pkg/conversion) into the internal struct. The runtime // package's DefaultScheme has conversion functions installed which will unpack the // JSON stored in RawExtension, turning it into the correct object type, and storing it -// in the EmbeddedObject. (TODO: In the case where the object is of an unknown type, a +// in the Object. (TODO: In the case where the object is of an unknown type, a // runtime.Unknown object will be created and stored.) +// +// +protobuf=true type RawExtension struct { + // RawJSON is the underlying serialization of this object. RawJSON []byte + // Object can hold a representation of this extension - useful for working with versioned + // structs. + Object Object `json:"-"` } // Unknown allows api objects with unknown types to be passed-through. This can be used @@ -107,6 +92,8 @@ type RawExtension struct { // TypeMeta features-- kind, version, etc. // TODO: Make this object have easy access to field based accessors and settors for // metadata and field mutatation. +// +// +protobuf=true type Unknown struct { TypeMeta `json:",inline"` // RawJSON will hold the complete JSON of the object which couldn't be matched @@ -115,8 +102,6 @@ type Unknown struct { RawJSON []byte } -func (*Unknown) IsAnAPIObject() {} - // Unstructured allows objects that do not have Golang structs registered to be manipulated // generically. This can be used to deal with the API objects from a plug-in. Unstructured // objects still have functioning TypeMeta features-- kind, version, etc. @@ -129,4 +114,12 @@ type Unstructured struct { Object map[string]interface{} } -func (*Unstructured) IsAnAPIObject() {} +// VersionedObjects is used by Decoders to give callers a way to access all versions +// of an object during the decoding process. +type VersionedObjects struct { + // Objects is the set of objects retrieved during decoding, in order of conversion. + // The 0 index is the object as serialized on the wire. If conversion has occured, + // other objects may be present. The right most object is the same as would be returned + // by a normal Decode call. + Objects []Object +} diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/unstructured.go b/vendor/k8s.io/kubernetes/pkg/runtime/unstructured.go index 303300ccd..59dfa2458 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/unstructured.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/unstructured.go @@ -18,41 +18,24 @@ package runtime import ( "encoding/json" - "fmt" - "reflect" + "io" - "k8s.io/kubernetes/pkg/conversion" + "k8s.io/kubernetes/pkg/api/unversioned" ) // UnstructuredJSONScheme is capable of converting JSON data into the Unstructured // type, which can be used for generic access to objects without a predefined scheme. -var UnstructuredJSONScheme ObjectDecoder = unstructuredJSONScheme{} +// TODO: move into serializer/json. +var UnstructuredJSONScheme Codec = unstructuredJSONScheme{} type unstructuredJSONScheme struct{} -// Recognizes returns true for any version or kind that is specified (internal -// versions are specifically excluded). -func (unstructuredJSONScheme) Recognizes(version, kind string) bool { - return len(version) > 0 && len(kind) > 0 -} - -func (s unstructuredJSONScheme) Decode(data []byte) (Object, error) { +func (s unstructuredJSONScheme) Decode(data []byte, _ *unversioned.GroupVersionKind, _ Object) (Object, *unversioned.GroupVersionKind, error) { unstruct := &Unstructured{} - if err := s.DecodeInto(data, unstruct); err != nil { - return nil, err - } - return unstruct, nil -} - -func (unstructuredJSONScheme) DecodeInto(data []byte, obj Object) error { - unstruct, ok := obj.(*Unstructured) - if !ok { - return fmt.Errorf("the unstructured JSON scheme does not recognize %v", reflect.TypeOf(obj)) - } m := make(map[string]interface{}) if err := json.Unmarshal(data, &m); err != nil { - return err + return nil, nil, err } if v, ok := m["kind"]; ok { if s, ok := v.(string); ok { @@ -64,34 +47,30 @@ func (unstructuredJSONScheme) DecodeInto(data []byte, obj Object) error { unstruct.APIVersion = s } } + if len(unstruct.APIVersion) == 0 { - return conversion.NewMissingVersionErr(string(data)) + return nil, nil, NewMissingVersionErr(string(data)) } + gv, err := unversioned.ParseGroupVersion(unstruct.APIVersion) + if err != nil { + return nil, nil, err + } + gvk := gv.WithKind(unstruct.Kind) if len(unstruct.Kind) == 0 { - return conversion.NewMissingKindErr(string(data)) + return nil, &gvk, NewMissingKindErr(string(data)) } unstruct.Object = m - return nil + return unstruct, &gvk, nil } -func (unstructuredJSONScheme) DecodeIntoWithSpecifiedVersionKind(data []byte, obj Object, kind, version string) error { - return nil -} - -func (unstructuredJSONScheme) DecodeToVersion(data []byte, version string) (Object, error) { - return nil, nil -} - -func (unstructuredJSONScheme) DataVersionAndKind(data []byte) (version, kind string, err error) { - obj := TypeMeta{} - if err := json.Unmarshal(data, &obj); err != nil { - return "", "", err +func (s unstructuredJSONScheme) EncodeToStream(obj Object, w io.Writer, overrides ...unversioned.GroupVersion) error { + switch t := obj.(type) { + case *Unstructured: + return json.NewEncoder(w).Encode(t.Object) + case *Unknown: + _, err := w.Write(t.RawJSON) + return err + default: + return json.NewEncoder(w).Encode(t) } - if len(obj.APIVersion) == 0 { - return "", "", conversion.NewMissingVersionErr(string(data)) - } - if len(obj.Kind) == 0 { - return "", "", conversion.NewMissingKindErr(string(data)) - } - return obj.APIVersion, obj.Kind, nil } diff --git a/vendor/k8s.io/kubernetes/pkg/runtime/unstructured_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/unstructured_test.go index 8780ea29a..cca0fe251 100644 --- a/vendor/k8s.io/kubernetes/pkg/runtime/unstructured_test.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/unstructured_test.go @@ -26,13 +26,13 @@ import ( ) func TestDecodeUnstructured(t *testing.T) { - version := testapi.Default.Version() - rawJson := fmt.Sprintf(`{"kind":"Pod","apiVersion":"%s","metadata":{"name":"test"}}`, version) + groupVersionString := testapi.Default.GroupVersion().String() + rawJson := fmt.Sprintf(`{"kind":"Pod","apiVersion":"%s","metadata":{"name":"test"}}`, groupVersionString) pl := &api.List{ Items: []runtime.Object{ &api.Pod{ObjectMeta: api.ObjectMeta{Name: "1"}}, - &runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "Pod", APIVersion: version}, RawJSON: []byte(rawJson)}, - &runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "", APIVersion: version}, RawJSON: []byte(rawJson)}, + &runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "Pod", APIVersion: groupVersionString}, RawJSON: []byte(rawJson)}, + &runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "", APIVersion: groupVersionString}, RawJSON: []byte(rawJson)}, &runtime.Unstructured{TypeMeta: runtime.TypeMeta{Kind: "Foo", APIVersion: "Bar"}, Object: map[string]interface{}{"test": "value"}}, }, } @@ -42,7 +42,7 @@ func TestDecodeUnstructured(t *testing.T) { if pod, ok := pl.Items[1].(*runtime.Unstructured); !ok || pod.Object["kind"] != "Pod" || pod.Object["metadata"].(map[string]interface{})["name"] != "test" { t.Errorf("object not converted: %#v", pl.Items[1]) } - if _, ok := pl.Items[2].(*runtime.Unknown); !ok { - t.Errorf("object should not have been converted: %#v", pl.Items[2]) + if pod, ok := pl.Items[2].(*runtime.Unstructured); !ok || pod.Object["kind"] != "Pod" || pod.Object["metadata"].(map[string]interface{})["name"] != "test" { + t.Errorf("object not converted: %#v", pl.Items[2]) } } diff --git a/vendor/k8s.io/kubernetes/pkg/conversion/unversioned_test.go b/vendor/k8s.io/kubernetes/pkg/runtime/unversioned_test.go similarity index 87% rename from vendor/k8s.io/kubernetes/pkg/conversion/unversioned_test.go rename to vendor/k8s.io/kubernetes/pkg/runtime/unversioned_test.go index a637ee09f..7943581ea 100644 --- a/vendor/k8s.io/kubernetes/pkg/conversion/unversioned_test.go +++ b/vendor/k8s.io/kubernetes/pkg/runtime/unversioned_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package conversion_test +package runtime_test import ( "encoding/json" @@ -26,6 +26,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/runtime" ) @@ -40,7 +41,7 @@ func TestV1EncodeDecodeStatus(t *testing.T) { v1Codec := testapi.Default.Codec() - encoded, err := v1Codec.Encode(status) + encoded, err := runtime.Encode(v1Codec, status) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -54,7 +55,7 @@ func TestV1EncodeDecodeStatus(t *testing.T) { if typeMeta.APIVersion != "v1" { t.Errorf("APIVersion is not set to \"v1\". Got %v", string(encoded)) } - decoded, err := v1Codec.Decode(encoded) + decoded, err := runtime.Decode(v1Codec, encoded) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -66,9 +67,8 @@ func TestV1EncodeDecodeStatus(t *testing.T) { func TestExperimentalEncodeDecodeStatus(t *testing.T) { // TODO: caesarxuchao: use the testapi.Extensions.Codec() once the PR that // moves experimental from v1 to v1beta1 got merged. - // expCodec := testapi.Extensions.Codec() - expCodec := runtime.CodecFor(api.Scheme, "extensions/v1beta1") - encoded, err := expCodec.Encode(status) + expCodec := api.Codecs.LegacyCodec(extensions.SchemeGroupVersion) + encoded, err := runtime.Encode(expCodec, status) if err != nil { t.Errorf("unexpected error: %v", err) } @@ -79,10 +79,10 @@ func TestExperimentalEncodeDecodeStatus(t *testing.T) { if typeMeta.Kind != "Status" { t.Errorf("Kind is not set to \"Status\". Got %s", encoded) } - if typeMeta.APIVersion != "" { + if typeMeta.APIVersion != "v1" { t.Errorf("APIVersion is not set to \"\". Got %s", encoded) } - decoded, err := expCodec.Decode(encoded) + decoded, err := runtime.Decode(expCodec, encoded) if err != nil { t.Errorf("unexpected error: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/storage/cacher.go b/vendor/k8s.io/kubernetes/pkg/storage/cacher.go index 7fd1c68c0..c5bcf2448 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/cacher.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/cacher.go @@ -22,12 +22,15 @@ import ( "strconv" "strings" "sync" + "time" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/rest" "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/watch" "github.com/golang/glog" @@ -56,9 +59,6 @@ type CacherConfig struct { // NewList is a function that creates new empty object storing a list of // objects of type Type. NewListFunc func() runtime.Object - - // Cacher will be stopped when the StopChannel will be closed. - StopChannel <-chan struct{} } // Cacher is responsible for serving WATCH and LIST requests for a given @@ -99,12 +99,49 @@ type Cacher struct { // keyFunc is used to get a key in the underyling storage for a given object. keyFunc func(runtime.Object) (string, error) + + // Handling graceful termination. + stopLock sync.RWMutex + stopped bool + stopCh chan struct{} + stopWg sync.WaitGroup } // Create a new Cacher responsible from service WATCH and LIST requests from its // internal cache and updating its cache in the background based on the given // configuration. -func NewCacher(config CacherConfig) *Cacher { +func NewCacher( + storage Interface, + capacity int, + versioner Versioner, + objectType runtime.Object, + resourcePrefix string, + scopeStrategy rest.NamespaceScopedStrategy, + newListFunc func() runtime.Object) Interface { + config := CacherConfig{ + CacheCapacity: capacity, + Storage: storage, + Versioner: versioner, + Type: objectType, + ResourcePrefix: resourcePrefix, + NewListFunc: newListFunc, + } + if scopeStrategy.NamespaceScoped() { + config.KeyFunc = func(obj runtime.Object) (string, error) { + return NamespaceKeyFunc(resourcePrefix, obj) + } + } else { + config.KeyFunc = func(obj runtime.Object) (string, error) { + return NoNamespaceKeyFunc(resourcePrefix, obj) + } + } + return NewCacherFromConfig(config) +} + +// Create a new Cacher responsible from service WATCH and LIST requests from its +// internal cache and updating its cache in the background based on the given +// configuration. +func NewCacherFromConfig(config CacherConfig) *Cacher { watchCache := newWatchCache(config.CacheCapacity) listerWatcher := newCacherListerWatcher(config.Storage, config.ResourcePrefix, config.NewListFunc) @@ -117,14 +154,32 @@ func NewCacher(config CacherConfig) *Cacher { watchers: make(map[int]*cacheWatcher), versioner: config.Versioner, keyFunc: config.KeyFunc, + stopped: false, + // We need to (potentially) stop both: + // - wait.Until go-routine + // - reflector.ListAndWatch + // and there are no guarantees on the order that they will stop. + // So we will be simply closing the channel, and synchronizing on the WaitGroup. + stopCh: make(chan struct{}), + stopWg: sync.WaitGroup{}, } cacher.usable.Lock() // See startCaching method for why explanation on it. watchCache.SetOnReplace(func() { cacher.usable.Unlock() }) watchCache.SetOnEvent(cacher.processEvent) - stopCh := config.StopChannel - go util.Until(func() { cacher.startCaching(stopCh) }, 0, stopCh) + stopCh := cacher.stopCh + cacher.stopWg.Add(1) + go func() { + defer cacher.stopWg.Done() + wait.Until( + func() { + if !cacher.isStopped() { + cacher.startCaching(stopCh) + } + }, time.Second, stopCh, + ) + }() return cacher } @@ -143,12 +198,10 @@ func (c *Cacher) startCaching(stopChannel <-chan struct{}) { c.terminateAllWatchers() // Note that since onReplace may be not called due to errors, we explicitly // need to retry it on errors under lock. - for { - if err := c.reflector.ListAndWatch(stopChannel); err != nil { - glog.Errorf("unexpected ListAndWatch error: %v", err) - } else { - break - } + // Also note that startCaching is called in a loop, so there's no need + // to have another loop here. + if err := c.reflector.ListAndWatch(stopChannel); err != nil { + glog.Errorf("unexpected ListAndWatch error: %v", err) } } @@ -178,7 +231,12 @@ func (c *Cacher) Delete(ctx context.Context, key string, out runtime.Object) err } // Implements storage.Interface. -func (c *Cacher) Watch(ctx context.Context, key string, resourceVersion uint64, filter FilterFunc) (watch.Interface, error) { +func (c *Cacher) Watch(ctx context.Context, key string, resourceVersion string, filter FilterFunc) (watch.Interface, error) { + watchRV, err := ParseWatchResourceVersion(resourceVersion) + if err != nil { + return nil, err + } + // Do NOT allow Watch to start when the underlying structures are not propagated. c.usable.RLock() defer c.usable.RUnlock() @@ -190,7 +248,7 @@ func (c *Cacher) Watch(ctx context.Context, key string, resourceVersion uint64, // underlying watchCache is calling processEvent under its lock. c.watchCache.RLock() defer c.watchCache.RUnlock() - initEvents, err := c.watchCache.GetAllEventsSinceThreadUnsafe(resourceVersion) + initEvents, err := c.watchCache.GetAllEventsSinceThreadUnsafe(watchRV) if err != nil { return nil, err } @@ -204,7 +262,7 @@ func (c *Cacher) Watch(ctx context.Context, key string, resourceVersion uint64, } // Implements storage.Interface. -func (c *Cacher) WatchList(ctx context.Context, key string, resourceVersion uint64, filter FilterFunc) (watch.Interface, error) { +func (c *Cacher) WatchList(ctx context.Context, key string, resourceVersion string, filter FilterFunc) (watch.Interface, error) { return c.Watch(ctx, key, resourceVersion, filter) } @@ -219,23 +277,32 @@ func (c *Cacher) GetToList(ctx context.Context, key string, filter FilterFunc, l } // Implements storage.Interface. -func (c *Cacher) List(ctx context.Context, key string, filter FilterFunc, listObj runtime.Object) error { - return c.storage.List(ctx, key, filter, listObj) -} +func (c *Cacher) List(ctx context.Context, key string, resourceVersion string, filter FilterFunc, listObj runtime.Object) error { + if resourceVersion == "" { + // If resourceVersion is not specified, serve it from underlying + // storage (for backward compatibility). + return c.storage.List(ctx, key, resourceVersion, filter, listObj) + } -// ListFromMemory implements list operation (the same signature as List method) -// but it serves the contents from memory. -// Current we cannot use ListFromMemory() instead of List(), because it only -// guarantees eventual consistency (e.g. it's possible for Get called right after -// Create to return not-exist, before the change is propagate). -// TODO: We may consider changing to use ListFromMemory in the future, but this -// requires wider discussion as an "api semantic change". -func (c *Cacher) ListFromMemory(key string, listObj runtime.Object) error { - // Do NOT allow Watch to start when the underlying structures are not propagated. + // If resourceVersion is specified, serve it from cache. + // It's guaranteed that the returned value is at least that + // fresh as the given resourceVersion. + + listRV, err := ParseListResourceVersion(resourceVersion) + if err != nil { + return err + } + + // To avoid situation when List is processed before the underlying + // watchCache is propagated for the first time, we acquire and immediately + // release the 'usable' lock. + // We don't need to hold it all the time, because watchCache is thread-safe + // and it would complicate already very difficult locking pattern. c.usable.RLock() - defer c.usable.RUnlock() + c.usable.RUnlock() - listPtr, err := runtime.GetItemsPtr(listObj) + // List elements from cache, with at least 'listRV'. + listPtr, err := meta.GetItemsPtr(listObj) if err != nil { return err } @@ -243,20 +310,23 @@ func (c *Cacher) ListFromMemory(key string, listObj runtime.Object) error { if err != nil || listVal.Kind() != reflect.Slice { return fmt.Errorf("need a pointer to slice, got %v", listVal.Kind()) } - filter := filterFunction(key, c.keyFunc, Everything) + filterFunc := filterFunction(key, c.keyFunc, filter) - objs, resourceVersion := c.watchCache.ListWithVersion() + objs, readResourceVersion, err := c.watchCache.WaitUntilFreshAndList(listRV) + if err != nil { + return fmt.Errorf("failed to wait for fresh list: %v", err) + } for _, obj := range objs { object, ok := obj.(runtime.Object) if !ok { return fmt.Errorf("non runtime.Object returned from storage: %v", obj) } - if filter(object) { + if filterFunc(object) { listVal.Set(reflect.Append(listVal, reflect.ValueOf(object).Elem())) } } if c.versioner != nil { - if err := c.versioner.UpdateList(listObj, resourceVersion); err != nil { + if err := c.versioner.UpdateList(listObj, readResourceVersion); err != nil { return err } } @@ -290,10 +360,26 @@ func (c *Cacher) terminateAllWatchers() { } } -func forgetWatcher(c *Cacher, index int) func() { - return func() { - c.Lock() - defer c.Unlock() +func (c *Cacher) isStopped() bool { + c.stopLock.RLock() + defer c.stopLock.RUnlock() + return c.stopped +} + +func (c *Cacher) Stop() { + c.stopLock.Lock() + c.stopped = true + c.stopLock.Unlock() + close(c.stopCh) + c.stopWg.Wait() +} + +func forgetWatcher(c *Cacher, index int) func(bool) { + return func(lock bool) { + if lock { + c.Lock() + defer c.Unlock() + } // It's possible that the watcher is already not in the map (e.g. in case of // simulaneous Stop() and terminateAllWatchers(), but it doesn't break anything. delete(c.watchers, index) @@ -316,6 +402,11 @@ func filterFunction(key string, keyFunc func(runtime.Object) (string, error), fi // Returns resource version to which the underlying cache is synced. func (c *Cacher) LastSyncResourceVersion() (uint64, error) { + // To avoid situation when LastSyncResourceVersion is processed before the + // underlying watchCache is propagated, we acquire 'usable' lock. + c.usable.RLock() + defer c.usable.RUnlock() + c.RLock() defer c.RUnlock() @@ -342,21 +433,17 @@ func newCacherListerWatcher(storage Interface, resourcePrefix string, newListFun } // Implements cache.ListerWatcher interface. -func (lw *cacherListerWatcher) List() (runtime.Object, error) { +func (lw *cacherListerWatcher) List(options api.ListOptions) (runtime.Object, error) { list := lw.newListFunc() - if err := lw.storage.List(context.TODO(), lw.resourcePrefix, Everything, list); err != nil { + if err := lw.storage.List(context.TODO(), lw.resourcePrefix, "", Everything, list); err != nil { return nil, err } return list, nil } // Implements cache.ListerWatcher interface. -func (lw *cacherListerWatcher) Watch(resourceVersion string) (watch.Interface, error) { - version, err := ParseWatchResourceVersion(resourceVersion, lw.resourcePrefix) - if err != nil { - return nil, err - } - return lw.storage.WatchList(context.TODO(), lw.resourcePrefix, version, Everything) +func (lw *cacherListerWatcher) Watch(options api.ListOptions) (watch.Interface, error) { + return lw.storage.WatchList(context.TODO(), lw.resourcePrefix, options.ResourceVersion, Everything) } // cacherWatch implements watch.Interface @@ -366,10 +453,10 @@ type cacheWatcher struct { result chan watch.Event filter FilterFunc stopped bool - forget func() + forget func(bool) } -func newCacheWatcher(initEvents []watchCacheEvent, filter FilterFunc, forget func()) *cacheWatcher { +func newCacheWatcher(initEvents []watchCacheEvent, filter FilterFunc, forget func(bool)) *cacheWatcher { watcher := &cacheWatcher{ input: make(chan watchCacheEvent, 10), result: make(chan watch.Event, 10), @@ -388,7 +475,7 @@ func (c *cacheWatcher) ResultChan() <-chan watch.Event { // Implements watch.Interface. func (c *cacheWatcher) Stop() { - c.forget() + c.forget(true) c.stop() } @@ -402,7 +489,15 @@ func (c *cacheWatcher) stop() { } func (c *cacheWatcher) add(event watchCacheEvent) { - c.input <- event + select { + case c.input <- event: + case <-time.After(5 * time.Second): + // This means that we couldn't send event to that watcher. + // Since we don't want to blockin on it infinitely, + // we simply terminate it. + c.forget(false) + c.stop() + } } func (c *cacheWatcher) sendWatchCacheEvent(event watchCacheEvent) { diff --git a/vendor/k8s.io/kubernetes/pkg/storage/cacher_test.go b/vendor/k8s.io/kubernetes/pkg/storage/cacher_test.go index 6e8bdc82a..dd829739c 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/cacher_test.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/cacher_test.go @@ -17,13 +17,11 @@ limitations under the License. package storage_test import ( - "fmt" "reflect" + "strconv" "testing" "time" - "github.com/coreos/go-etcd/etcd" - "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/testapi" @@ -33,9 +31,8 @@ import ( "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/storage" etcdstorage "k8s.io/kubernetes/pkg/storage/etcd" - "k8s.io/kubernetes/pkg/tools" - "k8s.io/kubernetes/pkg/tools/etcdtest" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/storage/etcd/etcdtest" + etcdtesting "k8s.io/kubernetes/pkg/storage/etcd/testing" "k8s.io/kubernetes/pkg/util/sets" "k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/watch" @@ -43,19 +40,24 @@ import ( "golang.org/x/net/context" ) -func newTestCacher(client tools.EtcdClient) *storage.Cacher { +func newEtcdTestStorage(t *testing.T, codec runtime.Codec, prefix string) (*etcdtesting.EtcdTestServer, storage.Interface) { + server := etcdtesting.NewEtcdTestClientServer(t) + storage := etcdstorage.NewEtcdStorage(server.Client, codec, prefix, false) + return server, storage +} + +func newTestCacher(s storage.Interface) *storage.Cacher { prefix := "pods" config := storage.CacherConfig{ CacheCapacity: 10, + Storage: s, Versioner: etcdstorage.APIObjectVersioner{}, - Storage: etcdstorage.NewEtcdStorage(client, testapi.Default.Codec(), etcdtest.PathPrefix()), Type: &api.Pod{}, ResourcePrefix: prefix, KeyFunc: func(obj runtime.Object) (string, error) { return storage.NamespaceKeyFunc(prefix, obj) }, NewListFunc: func() runtime.Object { return &api.PodList{} }, - StopChannel: util.NeverStop, } - return storage.NewCacher(config) + return storage.NewCacherFromConfig(config) } func makeTestPod(name string) *api.Pod { @@ -65,23 +67,30 @@ func makeTestPod(name string) *api.Pod { } } -func waitForUpToDateCache(cacher *storage.Cacher, resourceVersion uint64) error { - ready := func() (bool, error) { - result, err := cacher.LastSyncResourceVersion() - if err != nil { - return false, err +func updatePod(t *testing.T, s storage.Interface, obj, old *api.Pod) *api.Pod { + key := etcdtest.AddPrefix("pods/ns/" + obj.Name) + result := &api.Pod{} + if old == nil { + if err := s.Create(context.TODO(), key, obj, result, 0); err != nil { + t.Errorf("unexpected error: %v", err) } - return result == resourceVersion, nil + } else { + // To force "update" behavior of Set() we need to set ResourceVersion of + // previous version of object. + obj.ResourceVersion = old.ResourceVersion + if err := s.Set(context.TODO(), key, obj, result, 0); err != nil { + t.Errorf("unexpected error: %v", err) + } + obj.ResourceVersion = "" } - return wait.Poll(10*time.Millisecond, util.ForeverTestTimeout, ready) + return result } -func TestListFromMemory(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - prefixedKey := etcdtest.AddPrefix("pods") - fakeClient.ExpectNotFoundGet(prefixedKey) - cacher := newTestCacher(fakeClient) - fakeClient.WaitForWatchCompletion() +func TestList(t *testing.T) { + server, etcdStorage := newEtcdTestStorage(t, testapi.Default.Codec(), etcdtest.PathPrefix()) + defer server.Terminate(t) + cacher := newTestCacher(etcdStorage) + defer cacher.Stop() podFoo := makeTestPod("foo") podBar := makeTestPod("bar") @@ -90,356 +99,200 @@ func TestListFromMemory(t *testing.T) { podFooPrime := makeTestPod("foo") podFooPrime.Spec.NodeName = "fakeNode" - testCases := []*etcd.Response{ - { - Action: "create", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - }, - { - Action: "create", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podBar)), - CreatedIndex: 2, - ModifiedIndex: 2, - }, - }, - { - Action: "create", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podBaz)), - CreatedIndex: 3, - ModifiedIndex: 3, - }, - }, - { - Action: "set", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFooPrime)), - CreatedIndex: 1, - ModifiedIndex: 4, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - }, - { - Action: "delete", - Node: &etcd.Node{ - CreatedIndex: 1, - ModifiedIndex: 5, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podBar)), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - }, - } + fooCreated := updatePod(t, etcdStorage, podFoo, nil) + _ = updatePod(t, etcdStorage, podBar, nil) + _ = updatePod(t, etcdStorage, podBaz, nil) - // Propagate some data to etcd. - for _, test := range testCases { - fakeClient.WatchResponse <- test - } - if err := waitForUpToDateCache(cacher, 5); err != nil { - t.Errorf("watch cache didn't propagated correctly: %v", err) + _ = updatePod(t, etcdStorage, podFooPrime, fooCreated) + + deleted := api.Pod{} + if err := etcdStorage.Delete(context.TODO(), etcdtest.AddPrefix("pods/ns/bar"), &deleted); err != nil { + t.Errorf("Unexpected error: %v", err) } result := &api.PodList{} - if err := cacher.ListFromMemory("pods/ns", result); err != nil { - t.Errorf("unexpected error: %v", err) + // TODO: We need to pass ResourceVersion of barPod deletion operation. + // However, there is no easy way to get it, so it is hardcoded to 8. + if err := cacher.List(context.TODO(), "pods/ns", "8", storage.Everything, result); err != nil { + t.Errorf("Unexpected error: %v", err) } - if result.ListMeta.ResourceVersion != "5" { - t.Errorf("incorrect resource version: %v", result.ListMeta.ResourceVersion) + if result.ListMeta.ResourceVersion != "8" { + t.Errorf("Incorrect resource version: %v", result.ListMeta.ResourceVersion) } if len(result.Items) != 2 { - t.Errorf("unexpected list result: %d", len(result.Items)) + t.Errorf("Unexpected list result: %d", len(result.Items)) } keys := sets.String{} for _, item := range result.Items { - keys.Insert(item.ObjectMeta.Name) + keys.Insert(item.Name) } if !keys.HasAll("foo", "baz") { - t.Errorf("unexpected list result: %#v", result) + t.Errorf("Unexpected list result: %#v", result) } for _, item := range result.Items { // unset fields that are set by the infrastructure - item.ObjectMeta.ResourceVersion = "" - item.ObjectMeta.CreationTimestamp = unversioned.Time{} + item.ResourceVersion = "" + item.CreationTimestamp = unversioned.Time{} var expected *api.Pod - switch item.ObjectMeta.Name { + switch item.Name { case "foo": expected = podFooPrime case "baz": expected = podBaz default: - t.Errorf("unexpected item: %v", item) + t.Errorf("Unexpected item: %v", item) } if e, a := *expected, item; !reflect.DeepEqual(e, a) { - t.Errorf("expected: %#v, got: %#v", e, a) + t.Errorf("Expected: %#v, got: %#v", e, a) } } +} - close(fakeClient.WatchResponse) +func verifyWatchEvent(t *testing.T, w watch.Interface, eventType watch.EventType, eventObject runtime.Object) { + select { + case event := <-w.ResultChan(): + if e, a := eventType, event.Type; e != a { + t.Errorf("Expected: %s, got: %s", eventType, event.Type) + } + if e, a := eventObject, event.Object; !api.Semantic.DeepDerivative(e, a) { + t.Errorf("Expected (%s): %#v, got: %#v", eventType, e, a) + } + case <-time.After(wait.ForeverTestTimeout): + t.Errorf("Timed out waiting for an event") + } } func TestWatch(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - prefixedKey := etcdtest.AddPrefix("pods") - fakeClient.ExpectNotFoundGet(prefixedKey) - cacher := newTestCacher(fakeClient) - fakeClient.WaitForWatchCompletion() + server, etcdStorage := newEtcdTestStorage(t, testapi.Default.Codec(), etcdtest.PathPrefix()) + defer server.Terminate(t) + cacher := newTestCacher(etcdStorage) + defer cacher.Stop() podFoo := makeTestPod("foo") podBar := makeTestPod("bar") - testCases := []struct { - object *api.Pod - etcdResponse *etcd.Response - event watch.EventType - filtered bool - }{ - { - object: podFoo, - etcdResponse: &etcd.Response{ - Action: "create", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 2, - ModifiedIndex: 2, - }, - }, - event: watch.Added, - filtered: true, - }, - { - object: podBar, - etcdResponse: &etcd.Response{ - Action: "create", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podBar)), - CreatedIndex: 3, - ModifiedIndex: 3, - }, - }, - event: watch.Added, - filtered: false, - }, - { - object: podFoo, - etcdResponse: &etcd.Response{ - Action: "set", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 2, - ModifiedIndex: 4, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 2, - ModifiedIndex: 2, - }, - }, - event: watch.Modified, - filtered: true, - }, + podFooPrime := makeTestPod("foo") + podFooPrime.Spec.NodeName = "fakeNode" + + podFooBis := makeTestPod("foo") + podFooBis.Spec.NodeName = "anotherFakeNode" + + // initialVersion is used to initate the watcher at the beginning of the world, + // which is not defined precisely in etcd. + initialVersion, err := cacher.LastSyncResourceVersion() + if err != nil { + t.Fatalf("Unexpected error: %v", err) } + startVersion := strconv.Itoa(int(initialVersion)) // Set up Watch for object "podFoo". - watcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", 2, storage.Everything) + watcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", startVersion, storage.Everything) if err != nil { - t.Fatalf("unexpected error: %v", err) + t.Fatalf("Unexpected error: %v", err) } + defer watcher.Stop() - for _, test := range testCases { - fakeClient.WatchResponse <- test.etcdResponse - if test.filtered { - event := <-watcher.ResultChan() - if e, a := test.event, event.Type; e != a { - t.Errorf("%v %v", e, a) - } - // unset fields that are set by the infrastructure - obj := event.Object.(*api.Pod) - obj.ObjectMeta.ResourceVersion = "" - obj.ObjectMeta.CreationTimestamp = unversioned.Time{} - if e, a := test.object, obj; !reflect.DeepEqual(e, a) { - t.Errorf("expected: %#v, got: %#v", e, a) - } - } - } + fooCreated := updatePod(t, etcdStorage, podFoo, nil) + _ = updatePod(t, etcdStorage, podBar, nil) + fooUpdated := updatePod(t, etcdStorage, podFooPrime, fooCreated) + + verifyWatchEvent(t, watcher, watch.Added, podFoo) + verifyWatchEvent(t, watcher, watch.Modified, podFooPrime) // Check whether we get too-old error. - _, err = cacher.Watch(context.TODO(), "pods/ns/foo", 1, storage.Everything) + _, err = cacher.Watch(context.TODO(), "pods/ns/foo", "1", storage.Everything) if err == nil { - t.Errorf("exepcted 'error too old' error") + t.Errorf("Expected 'error too old' error") } - // Now test watch with initial state. - initialWatcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", 2, storage.Everything) + initialWatcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", fooCreated.ResourceVersion, storage.Everything) if err != nil { - t.Fatalf("unexpected error: %v", err) - } - for _, test := range testCases { - if test.filtered { - event := <-initialWatcher.ResultChan() - if e, a := test.event, event.Type; e != a { - t.Errorf("%v %v", e, a) - } - // unset fields that are set by the infrastructure - obj := event.Object.(*api.Pod) - obj.ObjectMeta.ResourceVersion = "" - obj.ObjectMeta.CreationTimestamp = unversioned.Time{} - if e, a := test.object, obj; !reflect.DeepEqual(e, a) { - t.Errorf("expected: %#v, got: %#v", e, a) - } - } + t.Fatalf("Unexpected error: %v", err) } + defer initialWatcher.Stop() + + verifyWatchEvent(t, initialWatcher, watch.Added, podFoo) + verifyWatchEvent(t, initialWatcher, watch.Modified, podFooPrime) // Now test watch from "now". - nowWatcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", 0, storage.Everything) + nowWatcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", "0", storage.Everything) if err != nil { - t.Fatalf("unexpected error: %v", err) - } - select { - case event := <-nowWatcher.ResultChan(): - if obj := event.Object.(*api.Pod); event.Type != watch.Added || obj.ResourceVersion != "4" { - t.Errorf("unexpected event: %v", event) - } - case <-time.After(util.ForeverTestTimeout): - t.Errorf("timed out waiting for an event") - } - // Emit a new event and check if it is observed by the watcher. - fakeClient.WatchResponse <- &etcd.Response{ - Action: "set", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 2, - ModifiedIndex: 5, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 2, - ModifiedIndex: 4, - }, - } - event := <-nowWatcher.ResultChan() - obj := event.Object.(*api.Pod) - if event.Type != watch.Modified || obj.ResourceVersion != "5" { - t.Errorf("unexpected event: %v", event) + t.Fatalf("Unexpected error: %v", err) } + defer nowWatcher.Stop() - close(fakeClient.WatchResponse) + verifyWatchEvent(t, nowWatcher, watch.Added, podFooPrime) + + _ = updatePod(t, etcdStorage, podFooBis, fooUpdated) + + verifyWatchEvent(t, nowWatcher, watch.Modified, podFooBis) +} + +func TestWatcherTimeout(t *testing.T) { + server, etcdStorage := newEtcdTestStorage(t, testapi.Default.Codec(), etcdtest.PathPrefix()) + defer server.Terminate(t) + cacher := newTestCacher(etcdStorage) + defer cacher.Stop() + + // initialVersion is used to initate the watcher at the beginning of the world, + // which is not defined precisely in etcd. + initialVersion, err := cacher.LastSyncResourceVersion() + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + startVersion := strconv.Itoa(int(initialVersion)) + + // Create a watcher that will not be reading any result. + watcher, err := cacher.WatchList(context.TODO(), "pods/ns", startVersion, storage.Everything) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + defer watcher.Stop() + + // Create a second watcher that will be reading result. + readingWatcher, err := cacher.WatchList(context.TODO(), "pods/ns", startVersion, storage.Everything) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + defer readingWatcher.Stop() + + for i := 1; i <= 22; i++ { + pod := makeTestPod(strconv.Itoa(i)) + _ = updatePod(t, etcdStorage, pod, nil) + verifyWatchEvent(t, readingWatcher, watch.Added, pod) + } } func TestFiltering(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - prefixedKey := etcdtest.AddPrefix("pods") - fakeClient.ExpectNotFoundGet(prefixedKey) - cacher := newTestCacher(fakeClient) - fakeClient.WaitForWatchCompletion() + server, etcdStorage := newEtcdTestStorage(t, testapi.Default.Codec(), etcdtest.PathPrefix()) + defer server.Terminate(t) + cacher := newTestCacher(etcdStorage) + defer cacher.Stop() + + // Ensure that the cacher is initialized, before creating any pods, + // so that we are sure that all events will be present in cacher. + syncWatcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", "0", storage.Everything) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + syncWatcher.Stop() podFoo := makeTestPod("foo") - podFoo.ObjectMeta.Labels = map[string]string{"filter": "foo"} + podFoo.Labels = map[string]string{"filter": "foo"} podFooFiltered := makeTestPod("foo") + podFooPrime := makeTestPod("foo") + podFooPrime.Labels = map[string]string{"filter": "foo"} + podFooPrime.Spec.NodeName = "fakeNode" - testCases := []struct { - object *api.Pod - etcdResponse *etcd.Response - filtered bool - event watch.EventType - }{ - { - object: podFoo, - etcdResponse: &etcd.Response{ - Action: "create", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - }, - filtered: true, - event: watch.Added, - }, - { - object: podFooFiltered, - etcdResponse: &etcd.Response{ - Action: "set", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFooFiltered)), - CreatedIndex: 1, - ModifiedIndex: 2, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - }, - filtered: true, - // Deleted, because the new object doesn't match filter. - event: watch.Deleted, - }, - { - object: podFoo, - etcdResponse: &etcd.Response{ - Action: "set", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 1, - ModifiedIndex: 3, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFooFiltered)), - CreatedIndex: 1, - ModifiedIndex: 2, - }, - }, - filtered: true, - // Added, because the previous object didn't match filter. - event: watch.Added, - }, - { - object: podFoo, - etcdResponse: &etcd.Response{ - Action: "set", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 1, - ModifiedIndex: 4, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 1, - ModifiedIndex: 3, - }, - }, - filtered: true, - event: watch.Modified, - }, - { - object: podFoo, - etcdResponse: &etcd.Response{ - Action: "delete", - Node: &etcd.Node{ - CreatedIndex: 1, - ModifiedIndex: 5, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 1, - ModifiedIndex: 4, - }, - }, - filtered: true, - event: watch.Deleted, - }, + fooCreated := updatePod(t, etcdStorage, podFoo, nil) + fooFiltered := updatePod(t, etcdStorage, podFooFiltered, fooCreated) + fooUnfiltered := updatePod(t, etcdStorage, podFoo, fooFiltered) + _ = updatePod(t, etcdStorage, podFooPrime, fooUnfiltered) + + deleted := api.Pod{} + if err := etcdStorage.Delete(context.TODO(), etcdtest.AddPrefix("pods/ns/foo"), &deleted); err != nil { + t.Errorf("Unexpected error: %v", err) } // Set up Watch for object "podFoo" with label filter set. @@ -447,68 +300,20 @@ func TestFiltering(t *testing.T) { filter := func(obj runtime.Object) bool { metadata, err := meta.Accessor(obj) if err != nil { - t.Errorf("unexpected error: %v", err) + t.Errorf("Unexpected error: %v", err) return false } - return selector.Matches(labels.Set(metadata.Labels())) + return selector.Matches(labels.Set(metadata.GetLabels())) } - watcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", 1, filter) + watcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", fooCreated.ResourceVersion, filter) if err != nil { - t.Fatalf("unexpected error: %v", err) + t.Fatalf("Unexpected error: %v", err) } + defer watcher.Stop() - for _, test := range testCases { - fakeClient.WatchResponse <- test.etcdResponse - if test.filtered { - event := <-watcher.ResultChan() - if e, a := test.event, event.Type; e != a { - t.Errorf("%v %v", e, a) - } - // unset fields that are set by the infrastructure - obj := event.Object.(*api.Pod) - obj.ObjectMeta.ResourceVersion = "" - obj.ObjectMeta.CreationTimestamp = unversioned.Time{} - if e, a := test.object, obj; !reflect.DeepEqual(e, a) { - t.Errorf("expected: %#v, got: %#v", e, a) - } - } - } - - close(fakeClient.WatchResponse) -} - -func TestStorageError(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - prefixedKey := etcdtest.AddPrefix("pods") - fakeClient.ExpectNotFoundGet(prefixedKey) - cacher := newTestCacher(fakeClient) - fakeClient.WaitForWatchCompletion() - - podFoo := makeTestPod("foo") - - // Set up Watch for object "podFoo". - watcher, err := cacher.Watch(context.TODO(), "pods/ns/foo", 1, storage.Everything) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - - fakeClient.WatchResponse <- &etcd.Response{ - Action: "create", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(testapi.Default.Codec(), podFoo)), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - } - _ = <-watcher.ResultChan() - - // Injecting error is simulating error from etcd. - // This is almost the same what would happen e.g. in case of - // "error too old" when reconnecting to etcd watch. - fakeClient.WatchInjectError <- fmt.Errorf("fake error") - - _, ok := <-watcher.ResultChan() - if ok { - t.Errorf("unexpected event") - } + verifyWatchEvent(t, watcher, watch.Added, podFoo) + verifyWatchEvent(t, watcher, watch.Deleted, podFooFiltered) + verifyWatchEvent(t, watcher, watch.Added, podFoo) + verifyWatchEvent(t, watcher, watch.Modified, podFooPrime) + verifyWatchEvent(t, watcher, watch.Deleted, podFooPrime) } diff --git a/vendor/k8s.io/kubernetes/pkg/storage/errors.go b/vendor/k8s.io/kubernetes/pkg/storage/errors.go new file mode 100644 index 000000000..8fe1df643 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/storage/errors.go @@ -0,0 +1,45 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package storage + +import ( + etcdutil "k8s.io/kubernetes/pkg/storage/etcd/util" +) + +// IsNotFound returns true if and only if err is "key" not found error. +func IsNotFound(err error) bool { + // TODO: add alternate storage error here + return etcdutil.IsEtcdNotFound(err) +} + +// IsNodeExist returns true if and only if err is an node already exist error. +func IsNodeExist(err error) bool { + // TODO: add alternate storage error here + return etcdutil.IsEtcdNodeExist(err) +} + +// IsUnreachable returns true if and only if err indicates the server could not be reached. +func IsUnreachable(err error) bool { + // TODO: add alternate storage error here + return etcdutil.IsEtcdUnreachable(err) +} + +// IsTestFailed returns true if and only if err is a write conflict. +func IsTestFailed(err error) bool { + // TODO: add alternate storage error here + return etcdutil.IsEtcdTestFailed(err) +} diff --git a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_helper.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_helper.go index 2767e47e8..191c4bd61 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_helper.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_helper.go @@ -19,45 +19,90 @@ package etcd import ( "errors" "fmt" + "net" + "net/http" "path" "reflect" "strings" "time" - "github.com/coreos/go-etcd/etcd" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/storage" - "k8s.io/kubernetes/pkg/tools" - "k8s.io/kubernetes/pkg/tools/metrics" + "k8s.io/kubernetes/pkg/storage/etcd/metrics" + etcdutil "k8s.io/kubernetes/pkg/storage/etcd/util" "k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/watch" + etcd "github.com/coreos/etcd/client" "github.com/golang/glog" "golang.org/x/net/context" ) -func NewEtcdStorage(client tools.EtcdClient, codec runtime.Codec, prefix string) storage.Interface { +// storage.Config object for etcd. +type EtcdConfig struct { + ServerList []string + Codec runtime.Codec + Prefix string + Quorum bool +} + +// implements storage.Config +func (c *EtcdConfig) GetType() string { + return "etcd" +} + +// implements storage.Config +func (c *EtcdConfig) NewStorage() (storage.Interface, error) { + cfg := etcd.Config{ + Endpoints: c.ServerList, + // TODO: Determine if transport needs optimization + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + Dial: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + TLSHandshakeTimeout: 10 * time.Second, + MaxIdleConnsPerHost: 500, + }, + } + etcdClient, err := etcd.New(cfg) + if err != nil { + return nil, err + } + return NewEtcdStorage(etcdClient, c.Codec, c.Prefix, c.Quorum), nil +} + +// Creates a new storage interface from the client +// TODO: deprecate in favor of storage.Config abstraction over time +func NewEtcdStorage(client etcd.Client, codec runtime.Codec, prefix string, quorum bool) storage.Interface { return &etcdHelper{ - client: client, + etcdclient: client, + client: etcd.NewKeysAPI(client), codec: codec, versioner: APIObjectVersioner{}, copier: api.Scheme, - pathPrefix: prefix, + pathPrefix: path.Join("/", prefix), + quorum: quorum, cache: util.NewCache(maxEtcdCacheEntries), } } // etcdHelper is the reference implementation of storage.Interface. type etcdHelper struct { - client tools.EtcdClient - codec runtime.Codec - copier runtime.ObjectCopier + etcdclient etcd.Client + client etcd.KeysAPI + codec runtime.Codec + copier runtime.ObjectCopier // optional, has to be set to perform any atomic operations versioner storage.Versioner // prefix for all etcd keys pathPrefix string + // if true, perform quorum read + quorum bool // We cache objects stored in etcd. For keys we use Node.ModifiedIndex which is equivalent // to resourceVersion. @@ -83,7 +128,17 @@ func (h *etcdHelper) Backends(ctx context.Context) []string { if ctx == nil { glog.Errorf("Context is nil") } - return h.client.GetCluster() + membersAPI := etcd.NewMembersAPI(h.etcdclient) + members, err := membersAPI.List(ctx) + if err != nil { + glog.Errorf("Error obtaining etcd members list: %q", err) + return nil + } + mlist := []string{} + for _, member := range members { + mlist = append(mlist, member.ClientURLs...) + } + return mlist } // Implements storage.Interface. @@ -93,11 +148,14 @@ func (h *etcdHelper) Versioner() storage.Versioner { // Implements storage.Interface. func (h *etcdHelper) Create(ctx context.Context, key string, obj, out runtime.Object, ttl uint64) error { + trace := util.NewTrace("etcdHelper::Create " + getTypeName(obj)) + defer trace.LogIfLong(250 * time.Millisecond) if ctx == nil { glog.Errorf("Context is nil") } key = h.prefixEtcdKey(key) - data, err := h.codec.Encode(obj) + data, err := runtime.Encode(h.codec, obj) + trace.Step("Object encoded") if err != nil { return err } @@ -106,10 +164,16 @@ func (h *etcdHelper) Create(ctx context.Context, key string, obj, out runtime.Ob return errors.New("resourceVersion may not be set on objects to be created") } } + trace.Step("Version checked") startTime := time.Now() - response, err := h.client.Create(key, string(data), ttl) + opts := etcd.SetOptions{ + TTL: time.Duration(ttl) * time.Second, + PrevExist: etcd.PrevNoExist, + } + response, err := h.client.Set(ctx, key, string(data), &opts) metrics.RecordEtcdRequestLatency("create", getTypeName(obj), startTime) + trace.Step("Object created") if err != nil { return err } @@ -127,8 +191,26 @@ func (h *etcdHelper) Set(ctx context.Context, key string, obj, out runtime.Objec if ctx == nil { glog.Errorf("Context is nil") } + + version := uint64(0) + if h.versioner != nil { + var err error + if version, err = h.versioner.ObjectResourceVersion(obj); err != nil { + return errors.New("couldn't get resourceVersion from object") + } + if version != 0 { + // We cannot store object with resourceVersion in etcd, we need to clear it here. + if err := h.versioner.UpdateObject(obj, nil, 0); err != nil { + return errors.New("resourceVersion cannot be set on objects store in etcd") + } + } + } + // TODO: If versioner is nil, then we may end up with having ResourceVersion set + // in the object and this will be incorrect ResourceVersion. We should fix it by + // requiring "versioner != nil" at the constructor level for 1.3 milestone. + var response *etcd.Response - data, err := h.codec.Encode(obj) + data, err := runtime.Encode(h.codec, obj) if err != nil { return err } @@ -136,10 +218,14 @@ func (h *etcdHelper) Set(ctx context.Context, key string, obj, out runtime.Objec create := true if h.versioner != nil { - if version, err := h.versioner.ObjectResourceVersion(obj); err == nil && version != 0 { + if version != 0 { create = false startTime := time.Now() - response, err = h.client.CompareAndSwap(key, string(data), ttl, "", version) + opts := etcd.SetOptions{ + TTL: time.Duration(ttl) * time.Second, + PrevIndex: version, + } + response, err = h.client.Set(ctx, key, string(data), &opts) metrics.RecordEtcdRequestLatency("compareAndSwap", getTypeName(obj), startTime) if err != nil { return err @@ -149,7 +235,14 @@ func (h *etcdHelper) Set(ctx context.Context, key string, obj, out runtime.Objec if create { // Create will fail if a key already exists. startTime := time.Now() - response, err = h.client.Create(key, string(data), ttl) + opts := etcd.SetOptions{ + TTL: time.Duration(ttl) * time.Second, + PrevExist: etcd.PrevNoExist, + } + response, err = h.client.Set(ctx, key, string(data), &opts) + if err != nil { + return err + } metrics.RecordEtcdRequestLatency("create", getTypeName(obj), startTime) } @@ -177,9 +270,9 @@ func (h *etcdHelper) Delete(ctx context.Context, key string, out runtime.Object) } startTime := time.Now() - response, err := h.client.Delete(key, false) + response, err := h.client.Delete(ctx, key, nil) metrics.RecordEtcdRequestLatency("delete", getTypeName(out), startTime) - if !IsEtcdNotFound(err) { + if !etcdutil.IsEtcdNotFound(err) { // if the object that existed prior to the delete is returned by etcd, update out. if err != nil || response.PrevNode != nil { _, _, err = h.extractObj(response, err, out, false, true) @@ -189,24 +282,32 @@ func (h *etcdHelper) Delete(ctx context.Context, key string, out runtime.Object) } // Implements storage.Interface. -func (h *etcdHelper) Watch(ctx context.Context, key string, resourceVersion uint64, filter storage.FilterFunc) (watch.Interface, error) { +func (h *etcdHelper) Watch(ctx context.Context, key string, resourceVersion string, filter storage.FilterFunc) (watch.Interface, error) { if ctx == nil { glog.Errorf("Context is nil") } + watchRV, err := storage.ParseWatchResourceVersion(resourceVersion) + if err != nil { + return nil, err + } key = h.prefixEtcdKey(key) - w := newEtcdWatcher(false, nil, filter, h.codec, h.versioner, nil, h) - go w.etcdWatch(h.client, key, resourceVersion) + w := newEtcdWatcher(false, h.quorum, nil, filter, h.codec, h.versioner, nil, h) + go w.etcdWatch(ctx, h.client, key, watchRV) return w, nil } // Implements storage.Interface. -func (h *etcdHelper) WatchList(ctx context.Context, key string, resourceVersion uint64, filter storage.FilterFunc) (watch.Interface, error) { +func (h *etcdHelper) WatchList(ctx context.Context, key string, resourceVersion string, filter storage.FilterFunc) (watch.Interface, error) { if ctx == nil { glog.Errorf("Context is nil") } + watchRV, err := storage.ParseWatchResourceVersion(resourceVersion) + if err != nil { + return nil, err + } key = h.prefixEtcdKey(key) - w := newEtcdWatcher(true, exceptKey(key), filter, h.codec, h.versioner, nil, h) - go w.etcdWatch(h.client, key, resourceVersion) + w := newEtcdWatcher(true, h.quorum, exceptKey(key), filter, h.codec, h.versioner, nil, h) + go w.etcdWatch(ctx, h.client, key, watchRV) return w, nil } @@ -227,10 +328,15 @@ func (h *etcdHelper) bodyAndExtractObj(ctx context.Context, key string, objPtr r glog.Errorf("Context is nil") } startTime := time.Now() - response, err := h.client.Get(key, false, false) + + opts := &etcd.GetOptions{ + Quorum: h.quorum, + } + + response, err := h.client.Get(ctx, key, opts) metrics.RecordEtcdRequestLatency("get", getTypeName(objPtr), startTime) - if err != nil && !IsEtcdNotFound(err) { + if err != nil && !etcdutil.IsEtcdNotFound(err) { return "", nil, nil, err } body, node, err = h.extractObj(response, err, objPtr, ignoreNotFound, false) @@ -259,7 +365,13 @@ func (h *etcdHelper) extractObj(response *etcd.Response, inErr error, objPtr run return "", nil, fmt.Errorf("unable to locate a value on the response: %#v", response) } body = node.Value - err = h.codec.DecodeInto([]byte(body), objPtr) + out, gvk, err := h.codec.Decode([]byte(body), nil, objPtr) + if err != nil { + return body, nil, err + } + if out != objPtr { + return body, nil, fmt.Errorf("unable to decode object %s into %v", gvk.String(), reflect.TypeOf(objPtr)) + } if h.versioner != nil { _ = h.versioner.UpdateObject(objPtr, node.Expiration, node.ModifiedIndex) // being unable to set the version does not prevent the object from being extracted @@ -273,18 +385,23 @@ func (h *etcdHelper) GetToList(ctx context.Context, key string, filter storage.F glog.Errorf("Context is nil") } trace := util.NewTrace("GetToList " + getTypeName(listObj)) - listPtr, err := runtime.GetItemsPtr(listObj) + listPtr, err := meta.GetItemsPtr(listObj) if err != nil { return err } key = h.prefixEtcdKey(key) startTime := time.Now() trace.Step("About to read etcd node") - response, err := h.client.Get(key, false, false) + + opts := &etcd.GetOptions{ + Quorum: h.quorum, + } + response, err := h.client.Get(ctx, key, opts) + metrics.RecordEtcdRequestLatency("get", getTypeName(listPtr), startTime) trace.Step("Etcd node read") if err != nil { - if IsEtcdNotFound(err) { + if etcdutil.IsEtcdNotFound(err) { return nil } return err @@ -298,7 +415,7 @@ func (h *etcdHelper) GetToList(ctx context.Context, key string, filter storage.F } trace.Step("Object decoded") if h.versioner != nil { - if err := h.versioner.UpdateList(listObj, response.EtcdIndex); err != nil { + if err := h.versioner.UpdateList(listObj, response.Index); err != nil { return err } } @@ -329,19 +446,19 @@ func (h *etcdHelper) decodeNodeList(nodes []*etcd.Node, filter storage.FilterFun v.Set(reflect.Append(v, reflect.ValueOf(obj).Elem())) } } else { - obj := reflect.New(v.Type().Elem()) - if err := h.codec.DecodeInto([]byte(node.Value), obj.Interface().(runtime.Object)); err != nil { + obj, _, err := h.codec.Decode([]byte(node.Value), nil, reflect.New(v.Type().Elem()).Interface().(runtime.Object)) + if err != nil { return err } if h.versioner != nil { // being unable to set the version does not prevent the object from being extracted - _ = h.versioner.UpdateObject(obj.Interface().(runtime.Object), node.Expiration, node.ModifiedIndex) + _ = h.versioner.UpdateObject(obj, node.Expiration, node.ModifiedIndex) } - if filter(obj.Interface().(runtime.Object)) { - v.Set(reflect.Append(v, obj.Elem())) + if filter(obj) { + v.Set(reflect.Append(v, reflect.ValueOf(obj).Elem())) } if node.ModifiedIndex != 0 { - h.addToCache(node.ModifiedIndex, obj.Interface().(runtime.Object)) + h.addToCache(node.ModifiedIndex, obj) } } } @@ -350,13 +467,13 @@ func (h *etcdHelper) decodeNodeList(nodes []*etcd.Node, filter storage.FilterFun } // Implements storage.Interface. -func (h *etcdHelper) List(ctx context.Context, key string, filter storage.FilterFunc, listObj runtime.Object) error { +func (h *etcdHelper) List(ctx context.Context, key string, resourceVersion string, filter storage.FilterFunc, listObj runtime.Object) error { if ctx == nil { glog.Errorf("Context is nil") } trace := util.NewTrace("List " + getTypeName(listObj)) defer trace.LogIfLong(time.Second) - listPtr, err := runtime.GetItemsPtr(listObj) + listPtr, err := meta.GetItemsPtr(listObj) if err != nil { return err } @@ -385,20 +502,25 @@ func (h *etcdHelper) listEtcdNode(ctx context.Context, key string) ([]*etcd.Node if ctx == nil { glog.Errorf("Context is nil") } - result, err := h.client.Get(key, true, true) + opts := etcd.GetOptions{ + Recursive: true, + Sort: true, + Quorum: h.quorum, + } + result, err := h.client.Get(ctx, key, &opts) if err != nil { - index, ok := etcdErrorIndex(err) - if !ok { - index = 0 + var index uint64 + if etcdError, ok := err.(etcd.Error); ok { + index = etcdError.Index } nodes := make([]*etcd.Node, 0) - if IsEtcdNotFound(err) { + if etcdutil.IsEtcdNotFound(err) { return nodes, index, nil } else { return nodes, index, err } } - return result.Node.Nodes, result.EtcdIndex, nil + return result.Node.Nodes, result.Index, nil } // Implements storage.Interface. @@ -443,7 +565,7 @@ func (h *etcdHelper) GuaranteedUpdate(ctx context.Context, key string, ptrToType ttl = 1 } } else if res != nil { - index = res.EtcdIndex + index = res.Index } if newTTL != nil { @@ -454,7 +576,17 @@ func (h *etcdHelper) GuaranteedUpdate(ctx context.Context, key string, ptrToType ttl = *newTTL } - data, err := h.codec.Encode(ret) + // Since update object may have a resourceVersion set, we need to clear it here. + if h.versioner != nil { + if err := h.versioner.UpdateObject(ret, meta.Expiration, 0); err != nil { + return errors.New("resourceVersion cannot be set on objects store in etcd") + } + } + // TODO: If versioner is nil, then we may end up with having ResourceVersion set + // in the object and this will be incorrect ResourceVersion. We should fix it by + // requiring "versioner != nil" at the constructor level for 1.3 milestone. + + data, err := runtime.Encode(h.codec, ret) if err != nil { return err } @@ -462,9 +594,13 @@ func (h *etcdHelper) GuaranteedUpdate(ctx context.Context, key string, ptrToType // First time this key has been used, try creating new value. if index == 0 { startTime := time.Now() - response, err := h.client.Create(key, string(data), ttl) + opts := etcd.SetOptions{ + TTL: time.Duration(ttl) * time.Second, + PrevExist: etcd.PrevNoExist, + } + response, err := h.client.Set(ctx, key, string(data), &opts) metrics.RecordEtcdRequestLatency("create", getTypeName(ptrToType), startTime) - if IsEtcdNodeExist(err) { + if etcdutil.IsEtcdNodeExist(err) { continue } _, _, err = h.extractObj(response, err, ptrToType, false, false) @@ -472,14 +608,22 @@ func (h *etcdHelper) GuaranteedUpdate(ctx context.Context, key string, ptrToType } if string(data) == origBody { - return nil + // If we don't send an update, we simply return the currently existing + // version of the object. + _, _, err := h.extractObj(res, nil, ptrToType, ignoreNotFound, false) + return err } startTime := time.Now() // Swap origBody with data, if origBody is the latest etcd data. - response, err := h.client.CompareAndSwap(key, string(data), ttl, origBody, index) + opts := etcd.SetOptions{ + PrevValue: origBody, + PrevIndex: index, + TTL: time.Duration(ttl) * time.Second, + } + response, err := h.client.Set(ctx, key, string(data), &opts) metrics.RecordEtcdRequestLatency("compareAndSwap", getTypeName(ptrToType), startTime) - if IsEtcdTestFailed(err) { + if etcdutil.IsEtcdTestFailed(err) { // Try again. continue } @@ -489,10 +633,10 @@ func (h *etcdHelper) GuaranteedUpdate(ctx context.Context, key string, ptrToType } func (h *etcdHelper) prefixEtcdKey(key string) string { - if strings.HasPrefix(key, path.Join("/", h.pathPrefix)) { + if strings.HasPrefix(key, h.pathPrefix) { return key } - return path.Join("/", h.pathPrefix, key) + return path.Join(h.pathPrefix, key) } // etcdCache defines interface used for caching objects stored in etcd. Objects are keyed by diff --git a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_helper_test.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_helper_test.go index b81f9eae3..7a892b340 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_helper_test.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_helper_test.go @@ -17,342 +17,223 @@ limitations under the License. package etcd import ( - "errors" - "fmt" - "math/rand" - "net" - "net/http" - "net/http/httptest" "path" "reflect" - "strconv" "sync" "testing" "time" - "github.com/coreos/go-etcd/etcd" + etcd "github.com/coreos/etcd/client" "github.com/stretchr/testify/assert" "golang.org/x/net/context" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" apitesting "k8s.io/kubernetes/pkg/api/testing" - "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/runtime/serializer" "k8s.io/kubernetes/pkg/storage" + "k8s.io/kubernetes/pkg/storage/etcd/etcdtest" + etcdtesting "k8s.io/kubernetes/pkg/storage/etcd/testing" + etcdutil "k8s.io/kubernetes/pkg/storage/etcd/util" storagetesting "k8s.io/kubernetes/pkg/storage/testing" - "k8s.io/kubernetes/pkg/tools" - "k8s.io/kubernetes/pkg/tools/etcdtest" ) const validEtcdVersion = "etcd 2.0.9" -var scheme *runtime.Scheme -var codec runtime.Codec - -func init() { - scheme = runtime.NewScheme() - scheme.AddKnownTypes("", &storagetesting.TestResource{}) - scheme.AddKnownTypes(testapi.Default.Version(), &storagetesting.TestResource{}) - codec = runtime.CodecFor(scheme, testapi.Default.Version()) - scheme.AddConversionFuncs( +func testScheme(t *testing.T) (*runtime.Scheme, runtime.Codec) { + scheme := runtime.NewScheme() + scheme.Log(t) + scheme.AddKnownTypes(*testapi.Default.GroupVersion(), &storagetesting.TestResource{}) + scheme.AddKnownTypes(testapi.Default.InternalGroupVersion(), &storagetesting.TestResource{}) + if err := scheme.AddConversionFuncs( func(in *storagetesting.TestResource, out *storagetesting.TestResource, s conversion.Scope) error { *out = *in return nil }, - ) -} - -func newEtcdHelper(client tools.EtcdClient, codec runtime.Codec, prefix string) etcdHelper { - return *NewEtcdStorage(client, codec, prefix).(*etcdHelper) -} - -func TestIsEtcdNotFound(t *testing.T) { - try := func(err error, isNotFound bool) { - if IsEtcdNotFound(err) != isNotFound { - t.Errorf("Expected %#v to return %v, but it did not", err, isNotFound) - } + func(in, out *time.Time, s conversion.Scope) error { + *out = *in + return nil + }, + ); err != nil { + panic(err) } - try(tools.EtcdErrorNotFound, true) - try(&etcd.EtcdError{ErrorCode: 101}, false) - try(nil, false) - try(fmt.Errorf("some other kind of error"), false) + codec := serializer.NewCodecFactory(scheme).LegacyCodec(*testapi.Default.GroupVersion()) + return scheme, codec +} + +func newEtcdHelper(client etcd.Client, codec runtime.Codec, prefix string) etcdHelper { + return *NewEtcdStorage(client, codec, prefix, false).(*etcdHelper) } // Returns an encoded version of api.Pod with the given name. func getEncodedPod(name string) string { - pod, _ := testapi.Default.Codec().Encode(&api.Pod{ + pod, _ := runtime.Encode(testapi.Default.Codec(), &api.Pod{ ObjectMeta: api.ObjectMeta{Name: name}, }) return string(pod) } -func TestList(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) - key := etcdtest.AddPrefix("/some/key") - fakeClient.Data[key] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - EtcdIndex: 10, - Node: &etcd.Node{ - Dir: true, - Nodes: []*etcd.Node{ - { - Key: "/foo", - Value: getEncodedPod("foo"), - Dir: false, - ModifiedIndex: 1, - }, - { - Key: "/bar", - Value: getEncodedPod("bar"), - Dir: false, - ModifiedIndex: 2, - }, - { - Key: "/baz", - Value: getEncodedPod("baz"), - Dir: false, - ModifiedIndex: 3, - }, - }, - }, - }, +func createObj(t *testing.T, helper etcdHelper, name string, obj, out runtime.Object, ttl uint64) error { + err := helper.Create(context.TODO(), name, obj, out, ttl) + if err != nil { + t.Errorf("Unexpected error %v", err) } - expect := api.PodList{ - ListMeta: unversioned.ListMeta{ResourceVersion: "10"}, + return err +} + +func createPodList(t *testing.T, helper etcdHelper, list *api.PodList) error { + for i := range list.Items { + returnedObj := &api.Pod{} + err := createObj(t, helper, list.Items[i].Name, &list.Items[i], returnedObj, 0) + if err != nil { + return err + } + list.Items[i] = *returnedObj + } + return nil +} + +func TestList(t *testing.T) { + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + key := etcdtest.AddPrefix("/some/key") + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), key) + + list := api.PodList{ Items: []api.Pod{ { - ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"}, + ObjectMeta: api.ObjectMeta{Name: "bar"}, Spec: apitesting.DeepEqualSafePodSpec(), }, { - ObjectMeta: api.ObjectMeta{Name: "baz", ResourceVersion: "3"}, + ObjectMeta: api.ObjectMeta{Name: "baz"}, Spec: apitesting.DeepEqualSafePodSpec(), }, { - ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, + ObjectMeta: api.ObjectMeta{Name: "foo"}, Spec: apitesting.DeepEqualSafePodSpec(), }, }, } + createPodList(t, helper, &list) var got api.PodList - err := helper.List(context.TODO(), "/some/key", storage.Everything, &got) + // TODO: a sorted filter function could be applied such implied + // ordering on the returned list doesn't matter. + err := helper.List(context.TODO(), key, "", storage.Everything, &got) if err != nil { t.Errorf("Unexpected error %v", err) } - if e, a := expect, got; !reflect.DeepEqual(e, a) { + if e, a := list.Items, got.Items; !reflect.DeepEqual(e, a) { t.Errorf("Expected %#v, got %#v", e, a) } } func TestListFiltered(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) key := etcdtest.AddPrefix("/some/key") - fakeClient.Data[key] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - EtcdIndex: 10, - Node: &etcd.Node{ - Dir: true, - Nodes: []*etcd.Node{ - { - Key: "/foo", - Value: getEncodedPod("foo"), - Dir: false, - ModifiedIndex: 1, - }, - { - Key: "/bar", - Value: getEncodedPod("bar"), - Dir: false, - ModifiedIndex: 2, - }, - { - Key: "/baz", - Value: getEncodedPod("baz"), - Dir: false, - ModifiedIndex: 3, - }, - }, - }, - }, - } - expect := api.PodList{ - ListMeta: unversioned.ListMeta{ResourceVersion: "10"}, + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), key) + + list := api.PodList{ Items: []api.Pod{ { - ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"}, + ObjectMeta: api.ObjectMeta{Name: "bar"}, + Spec: apitesting.DeepEqualSafePodSpec(), + }, + { + ObjectMeta: api.ObjectMeta{Name: "baz"}, + Spec: apitesting.DeepEqualSafePodSpec(), + }, + { + ObjectMeta: api.ObjectMeta{Name: "foo"}, Spec: apitesting.DeepEqualSafePodSpec(), }, }, } + createPodList(t, helper, &list) filter := func(obj runtime.Object) bool { pod := obj.(*api.Pod) return pod.Name == "bar" } var got api.PodList - err := helper.List(context.TODO(), "/some/key", filter, &got) + err := helper.List(context.TODO(), key, "", filter, &got) if err != nil { t.Errorf("Unexpected error %v", err) } - if e, a := expect, got; !reflect.DeepEqual(e, a) { + // Check to make certain that the filter function only returns "bar" + if e, a := list.Items[0], got.Items[0]; !reflect.DeepEqual(e, a) { t.Errorf("Expected %#v, got %#v", e, a) } } // TestListAcrossDirectories ensures that the client excludes directories and flattens tree-response - simulates cross-namespace query func TestListAcrossDirectories(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) - key := etcdtest.AddPrefix("/some/key") - fakeClient.Data[key] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - EtcdIndex: 10, - Node: &etcd.Node{ - Dir: true, - Nodes: []*etcd.Node{ - { - Key: "/directory1", - Value: `{"name": "directory1"}`, - Dir: true, - Nodes: []*etcd.Node{ - { - Key: "/foo", - Value: getEncodedPod("foo"), - Dir: false, - ModifiedIndex: 1, - }, - { - Key: "/baz", - Value: getEncodedPod("baz"), - Dir: false, - ModifiedIndex: 3, - }, - }, - }, - { - Key: "/directory2", - Value: `{"name": "directory2"}`, - Dir: true, - Nodes: []*etcd.Node{ - { - Key: "/bar", - Value: getEncodedPod("bar"), - ModifiedIndex: 2, - }, - }, - }, - }, - }, - }, - } - expect := api.PodList{ - ListMeta: unversioned.ListMeta{ResourceVersion: "10"}, + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + rootkey := etcdtest.AddPrefix("/some/key") + key1 := etcdtest.AddPrefix("/some/key/directory1") + key2 := etcdtest.AddPrefix("/some/key/directory2") + + roothelper := newEtcdHelper(server.Client, testapi.Default.Codec(), rootkey) + helper1 := newEtcdHelper(server.Client, testapi.Default.Codec(), key1) + helper2 := newEtcdHelper(server.Client, testapi.Default.Codec(), key2) + + list := api.PodList{ Items: []api.Pod{ - // We expect list to be sorted by directory (e.g. namespace) first, then by name. { - ObjectMeta: api.ObjectMeta{Name: "baz", ResourceVersion: "3"}, + ObjectMeta: api.ObjectMeta{Name: "baz"}, Spec: apitesting.DeepEqualSafePodSpec(), }, { - ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, + ObjectMeta: api.ObjectMeta{Name: "foo"}, Spec: apitesting.DeepEqualSafePodSpec(), }, { - ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"}, + ObjectMeta: api.ObjectMeta{Name: "bar"}, Spec: apitesting.DeepEqualSafePodSpec(), }, }, } + returnedObj := &api.Pod{} + // create the 1st 2 elements in one directory + createObj(t, helper1, list.Items[0].Name, &list.Items[0], returnedObj, 0) + list.Items[0] = *returnedObj + createObj(t, helper1, list.Items[1].Name, &list.Items[1], returnedObj, 0) + list.Items[1] = *returnedObj + // create the last element in the other directory + createObj(t, helper2, list.Items[2].Name, &list.Items[2], returnedObj, 0) + list.Items[2] = *returnedObj + var got api.PodList - err := helper.List(context.TODO(), "/some/key", storage.Everything, &got) + err := roothelper.List(context.TODO(), rootkey, "", storage.Everything, &got) if err != nil { t.Errorf("Unexpected error %v", err) } - if e, a := expect, got; !reflect.DeepEqual(e, a) { - t.Errorf("Expected %#v, got %#v", e, a) - } -} - -func TestListExcludesDirectories(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) - key := etcdtest.AddPrefix("/some/key") - fakeClient.Data[key] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - EtcdIndex: 10, - Node: &etcd.Node{ - Dir: true, - Nodes: []*etcd.Node{ - { - Key: "/foo", - Value: getEncodedPod("foo"), - ModifiedIndex: 1, - }, - { - Key: "/bar", - Value: getEncodedPod("bar"), - ModifiedIndex: 2, - }, - { - Key: "/baz", - Value: getEncodedPod("baz"), - ModifiedIndex: 3, - }, - { - Key: "/directory", - Value: `{"name": "directory"}`, - Dir: true, - }, - }, - }, - }, - } - expect := api.PodList{ - ListMeta: unversioned.ListMeta{ResourceVersion: "10"}, - Items: []api.Pod{ - { - ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"}, - Spec: apitesting.DeepEqualSafePodSpec(), - }, - { - ObjectMeta: api.ObjectMeta{Name: "baz", ResourceVersion: "3"}, - Spec: apitesting.DeepEqualSafePodSpec(), - }, - { - ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, - Spec: apitesting.DeepEqualSafePodSpec(), - }, - }, - } - - var got api.PodList - err := helper.List(context.TODO(), "/some/key", storage.Everything, &got) - if err != nil { - t.Errorf("Unexpected error %v", err) - } - if e, a := expect, got; !reflect.DeepEqual(e, a) { + if e, a := list.Items, got.Items; !reflect.DeepEqual(e, a) { t.Errorf("Expected %#v, got %#v", e, a) } } func TestGet(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) key := etcdtest.AddPrefix("/some/key") + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), key) expect := api.Pod{ ObjectMeta: api.ObjectMeta{Name: "foo"}, Spec: apitesting.DeepEqualSafePodSpec(), } - fakeClient.Set(key, runtime.EncodeOrDie(testapi.Default.Codec(), &expect), 0) var got api.Pod - err := helper.Get(context.TODO(), "/some/key", &got, false) - if err != nil { + if err := helper.Set(context.TODO(), key, &expect, &got, 0); err != nil { + t.Errorf("Unexpected error %#v", err) + } + expect = got + if err := helper.Get(context.TODO(), key, &got, false); err != nil { t.Errorf("Unexpected error %#v", err) } if !reflect.DeepEqual(got, expect) { @@ -361,59 +242,30 @@ func TestGet(t *testing.T) { } func TestGetNotFoundErr(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) - key1 := etcdtest.AddPrefix("/some/key") - fakeClient.Data[key1] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - Node: nil, - }, - E: &etcd.EtcdError{ - ErrorCode: 100, - }, - } - key2 := etcdtest.AddPrefix("/some/key2") - fakeClient.Data[key2] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - Node: nil, - }, - } - key3 := etcdtest.AddPrefix("/some/key3") - fakeClient.Data[key3] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - Node: &etcd.Node{ - Value: "", - }, - }, - } - try := func(key string) { - var got api.Pod - err := helper.Get(context.TODO(), key, &got, false) - if err == nil { - t.Errorf("%s: wanted error but didn't get one", key) - } - err = helper.Get(context.TODO(), key, &got, true) - if err != nil { - t.Errorf("%s: didn't want error but got %#v", key, err) - } - } + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + key := etcdtest.AddPrefix("/some/key") + boguskey := etcdtest.AddPrefix("/some/boguskey") + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), key) - try("/some/key") - try("/some/key2") - try("/some/key3") + var got api.Pod + err := helper.Get(context.TODO(), boguskey, &got, false) + if !etcdutil.IsEtcdNotFound(err) { + t.Errorf("Unexpected reponse on key=%v, err=%v", key, err) + } } func TestCreate(t *testing.T) { obj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - server := NewEtcdTestClientServer(t) + server := etcdtesting.NewEtcdTestClientServer(t) defer server.Terminate(t) - helper := newEtcdHelper(server.client, testapi.Default.Codec(), etcdtest.PathPrefix()) + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), etcdtest.PathPrefix()) returnedObj := &api.Pod{} err := helper.Create(context.TODO(), "/some/key", obj, returnedObj, 5) if err != nil { t.Errorf("Unexpected error %#v", err) } - _, err = testapi.Default.Codec().Encode(obj) + _, err = runtime.Encode(testapi.Default.Codec(), obj) if err != nil { t.Errorf("Unexpected error %#v", err) } @@ -421,7 +273,7 @@ func TestCreate(t *testing.T) { if err != nil { t.Errorf("Unexpected error %#v", err) } - _, err = testapi.Default.Codec().Encode(returnedObj) + _, err = runtime.Encode(testapi.Default.Codec(), returnedObj) if err != nil { t.Errorf("Unexpected error %#v", err) } @@ -432,8 +284,9 @@ func TestCreate(t *testing.T) { func TestCreateNilOutParam(t *testing.T) { obj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), etcdtest.PathPrefix()) err := helper.Create(context.TODO(), "/some/key", obj, nil, 5) if err != nil { t.Errorf("Unexpected error %#v", err) @@ -442,36 +295,34 @@ func TestCreateNilOutParam(t *testing.T) { func TestSet(t *testing.T) { obj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), etcdtest.PathPrefix()) returnedObj := &api.Pod{} err := helper.Set(context.TODO(), "/some/key", obj, returnedObj, 5) if err != nil { t.Errorf("Unexpected error %#v", err) } - data, err := testapi.Default.Codec().Encode(obj) + + if obj.ObjectMeta.Name == returnedObj.ObjectMeta.Name { + // Set worked, now override the values. + obj = returnedObj + } + + err = helper.Get(context.TODO(), "/some/key", returnedObj, false) if err != nil { t.Errorf("Unexpected error %#v", err) } - expect := string(data) - key := etcdtest.AddPrefix("/some/key") - got := fakeClient.Data[key].R.Node.Value - if expect != got { - t.Errorf("Wanted %v, got %v", expect, got) - } - if e, a := uint64(5), fakeClient.LastSetTTL; e != a { - t.Errorf("Wanted %v, got %v", e, a) - } - if obj.ResourceVersion != returnedObj.ResourceVersion || obj.Name != returnedObj.Name { - t.Errorf("If set was successful but returned object did not have correct resource version") + if !reflect.DeepEqual(obj, returnedObj) { + t.Errorf("Wanted %#v, got %#v", obj, returnedObj) } } func TestSetFailCAS(t *testing.T) { obj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}} - fakeClient := tools.NewFakeEtcdClient(t) - fakeClient.CasErr = fakeClient.NewError(123) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), etcdtest.PathPrefix()) err := helper.Set(context.TODO(), "/some/key", obj, nil, 5) if err == nil { t.Errorf("Expecting error.") @@ -479,75 +330,49 @@ func TestSetFailCAS(t *testing.T) { } func TestSetWithVersion(t *testing.T) { - obj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}} - fakeClient := tools.NewFakeEtcdClient(t) - fakeClient.TestIndex = true - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) - key := etcdtest.AddPrefix("/some/key") - fakeClient.Data[key] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - Node: &etcd.Node{ - Value: runtime.EncodeOrDie(testapi.Default.Codec(), obj), - ModifiedIndex: 1, - }, - }, - } + obj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), etcdtest.PathPrefix()) returnedObj := &api.Pod{} err := helper.Set(context.TODO(), "/some/key", obj, returnedObj, 7) if err != nil { t.Fatalf("Unexpected error %#v", err) } - data, err := testapi.Default.Codec().Encode(obj) + // resource revision is now set, try to set again with new value to test CAS + obj = returnedObj + obj.Name = "bar" + err = helper.Set(context.TODO(), "/some/key", obj, returnedObj, 7) if err != nil { t.Fatalf("Unexpected error %#v", err) } - expect := string(data) - got := fakeClient.Data[key].R.Node.Value - if expect != got { - t.Errorf("Wanted %v, got %v", expect, got) - } - if e, a := uint64(7), fakeClient.LastSetTTL; e != a { - t.Errorf("Wanted %v, got %v", e, a) - } - if obj.ResourceVersion != returnedObj.ResourceVersion || obj.Name != returnedObj.Name { - t.Errorf("If set was successful but returned object did not have correct resource version") + if returnedObj.Name != "bar" { + t.Fatalf("Unexpected error %#v", returnedObj) } } func TestSetWithoutResourceVersioner(t *testing.T) { obj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), etcdtest.PathPrefix()) helper.versioner = nil returnedObj := &api.Pod{} err := helper.Set(context.TODO(), "/some/key", obj, returnedObj, 3) - key := etcdtest.AddPrefix("/some/key") if err != nil { t.Errorf("Unexpected error %#v", err) } - data, err := testapi.Default.Codec().Encode(obj) - if err != nil { - t.Errorf("Unexpected error %#v", err) - } - expect := string(data) - got := fakeClient.Data[key].R.Node.Value - if expect != got { - t.Errorf("Wanted %v, got %v", expect, got) - } - if e, a := uint64(3), fakeClient.LastSetTTL; e != a { - t.Errorf("Wanted %v, got %v", e, a) - } - if obj.ResourceVersion != returnedObj.ResourceVersion || obj.Name != returnedObj.Name { - t.Errorf("If set was successful but returned object did not have correct resource version") + if returnedObj.ResourceVersion != "" { + t.Errorf("Resource revision should not be set on returned objects") } } func TestSetNilOutParam(t *testing.T) { obj := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - fakeClient := tools.NewFakeEtcdClient(t) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) - helper.versioner = nil + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), etcdtest.PathPrefix()) err := helper.Set(context.TODO(), "/some/key", obj, nil, 3) if err != nil { t.Errorf("Unexpected error %#v", err) @@ -555,34 +380,24 @@ func TestSetNilOutParam(t *testing.T) { } func TestGuaranteedUpdate(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - fakeClient.TestIndex = true - helper := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) + _, codec := testScheme(t) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) key := etcdtest.AddPrefix("/some/key") + helper := newEtcdHelper(server.Client, codec, key) - // Create a new node. - fakeClient.ExpectNotFoundGet(key) obj := &storagetesting.TestResource{ObjectMeta: api.ObjectMeta{Name: "foo"}, Value: 1} - err := helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { + err := helper.GuaranteedUpdate(context.TODO(), key, &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { return obj, nil })) if err != nil { t.Errorf("Unexpected error %#v", err) } - data, err := codec.Encode(obj) - if err != nil { - t.Errorf("Unexpected error %#v", err) - } - expect := string(data) - got := fakeClient.Data[key].R.Node.Value - if expect != got { - t.Errorf("Wanted %v, got %v", expect, got) - } // Update an existing node. callbackCalled := false objUpdate := &storagetesting.TestResource{ObjectMeta: api.ObjectMeta{Name: "foo"}, Value: 2} - err = helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { + err = helper.GuaranteedUpdate(context.TODO(), key, &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { callbackCalled = true if in.(*storagetesting.TestResource).Value != 1 { @@ -592,117 +407,16 @@ func TestGuaranteedUpdate(t *testing.T) { return objUpdate, nil })) if err != nil { - t.Errorf("Unexpected error %#v", err) + t.Errorf("unexpected error: %v", err) } - data, err = codec.Encode(objUpdate) + + objCheck := &storagetesting.TestResource{} + err = helper.Get(context.TODO(), key, objCheck, false) if err != nil { t.Errorf("Unexpected error %#v", err) } - expect = string(data) - got = fakeClient.Data[key].R.Node.Value - if expect != got { - t.Errorf("Wanted %v, got %v", expect, got) - } - - if !callbackCalled { - t.Errorf("tryUpdate callback should have been called.") - } -} - -func TestGuaranteedUpdateTTL(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - fakeClient.TestIndex = true - helper := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) - key := etcdtest.AddPrefix("/some/key") - - // Create a new node. - fakeClient.ExpectNotFoundGet(key) - obj := &storagetesting.TestResource{ObjectMeta: api.ObjectMeta{Name: "foo"}, Value: 1} - err := helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, true, func(in runtime.Object, res storage.ResponseMeta) (runtime.Object, *uint64, error) { - if res.TTL != 0 { - t.Fatalf("unexpected response meta: %#v", res) - } - ttl := uint64(10) - return obj, &ttl, nil - }) - if err != nil { - t.Errorf("Unexpected error %#v", err) - } - data, err := codec.Encode(obj) - if err != nil { - t.Errorf("Unexpected error %#v", err) - } - expect := string(data) - got := fakeClient.Data[key].R.Node.Value - if expect != got { - t.Errorf("Wanted %v, got %v", expect, got) - } - if fakeClient.Data[key].R.Node.TTL != 10 { - t.Errorf("expected TTL set: %d", fakeClient.Data[key].R.Node.TTL) - } - - // Update an existing node. - callbackCalled := false - objUpdate := &storagetesting.TestResource{ObjectMeta: api.ObjectMeta{Name: "foo"}, Value: 2} - err = helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, true, func(in runtime.Object, res storage.ResponseMeta) (runtime.Object, *uint64, error) { - if res.TTL != 10 { - t.Fatalf("unexpected response meta: %#v", res) - } - callbackCalled = true - - if in.(*storagetesting.TestResource).Value != 1 { - t.Errorf("Callback input was not current set value") - } - - return objUpdate, nil, nil - }) - - if err != nil { - t.Errorf("Unexpected error %#v", err) - } - data, err = codec.Encode(objUpdate) - if err != nil { - t.Errorf("Unexpected error %#v", err) - } - expect = string(data) - got = fakeClient.Data[key].R.Node.Value - if expect != got { - t.Errorf("Wanted %v, got %v", expect, got) - } - if fakeClient.Data[key].R.Node.TTL != 10 { - t.Errorf("expected TTL remained set: %d", fakeClient.Data[key].R.Node.TTL) - } - - // Update an existing node and change ttl - callbackCalled = false - objUpdate = &storagetesting.TestResource{ObjectMeta: api.ObjectMeta{Name: "foo"}, Value: 3} - err = helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, true, func(in runtime.Object, res storage.ResponseMeta) (runtime.Object, *uint64, error) { - if res.TTL != 10 { - t.Fatalf("unexpected response meta: %#v", res) - } - callbackCalled = true - - if in.(*storagetesting.TestResource).Value != 2 { - t.Errorf("Callback input was not current set value") - } - - newTTL := uint64(20) - return objUpdate, &newTTL, nil - }) - if err != nil { - t.Errorf("Unexpected error %#v", err) - } - data, err = codec.Encode(objUpdate) - if err != nil { - t.Errorf("Unexpected error %#v", err) - } - expect = string(data) - got = fakeClient.Data[key].R.Node.Value - if expect != got { - t.Errorf("Wanted %v, got %v", expect, got) - } - if fakeClient.Data[key].R.Node.TTL != 20 { - t.Errorf("expected TTL changed: %d", fakeClient.Data[key].R.Node.TTL) + if objCheck.Value != 2 { + t.Errorf("Value should have been 2 but got %v", objCheck.Value) } if !callbackCalled { @@ -711,15 +425,14 @@ func TestGuaranteedUpdateTTL(t *testing.T) { } func TestGuaranteedUpdateNoChange(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - fakeClient.TestIndex = true - helper := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) + _, codec := testScheme(t) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) key := etcdtest.AddPrefix("/some/key") + helper := newEtcdHelper(server.Client, codec, key) - // Create a new node. - fakeClient.ExpectNotFoundGet(key) obj := &storagetesting.TestResource{ObjectMeta: api.ObjectMeta{Name: "foo"}, Value: 1} - err := helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { + err := helper.GuaranteedUpdate(context.TODO(), key, &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { return obj, nil })) if err != nil { @@ -729,8 +442,7 @@ func TestGuaranteedUpdateNoChange(t *testing.T) { // Update an existing node with the same data callbackCalled := false objUpdate := &storagetesting.TestResource{ObjectMeta: api.ObjectMeta{Name: "foo"}, Value: 1} - err = helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { - fakeClient.Err = errors.New("should not be called") + err = helper.GuaranteedUpdate(context.TODO(), key, &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { callbackCalled = true return objUpdate, nil })) @@ -743,13 +455,13 @@ func TestGuaranteedUpdateNoChange(t *testing.T) { } func TestGuaranteedUpdateKeyNotFound(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - fakeClient.TestIndex = true - helper := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) + _, codec := testScheme(t) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) key := etcdtest.AddPrefix("/some/key") + helper := newEtcdHelper(server.Client, codec, key) // Create a new node. - fakeClient.ExpectNotFoundGet(key) obj := &storagetesting.TestResource{ObjectMeta: api.ObjectMeta{Name: "foo"}, Value: 1} f := storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { @@ -757,25 +469,24 @@ func TestGuaranteedUpdateKeyNotFound(t *testing.T) { }) ignoreNotFound := false - err := helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, ignoreNotFound, f) + err := helper.GuaranteedUpdate(context.TODO(), key, &storagetesting.TestResource{}, ignoreNotFound, f) if err == nil { t.Errorf("Expected error for key not found.") } ignoreNotFound = true - err = helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, ignoreNotFound, f) + err = helper.GuaranteedUpdate(context.TODO(), key, &storagetesting.TestResource{}, ignoreNotFound, f) if err != nil { t.Errorf("Unexpected error %v.", err) } } func TestGuaranteedUpdate_CreateCollision(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - fakeClient.TestIndex = true - helper := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) + _, codec := testScheme(t) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) key := etcdtest.AddPrefix("/some/key") - - fakeClient.ExpectNotFoundGet(key) + helper := newEtcdHelper(server.Client, codec, etcdtest.PathPrefix()) const concurrency = 10 var wgDone sync.WaitGroup @@ -789,7 +500,7 @@ func TestGuaranteedUpdate_CreateCollision(t *testing.T) { defer wgDone.Done() firstCall := true - err := helper.GuaranteedUpdate(context.TODO(), "/some/key", &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { + err := helper.GuaranteedUpdate(context.TODO(), key, &storagetesting.TestResource{}, true, storage.SimpleUpdate(func(in runtime.Object) (runtime.Object, error) { defer func() { firstCall = false }() if firstCall { @@ -809,68 +520,21 @@ func TestGuaranteedUpdate_CreateCollision(t *testing.T) { } wgDone.Wait() - // Check that stored storagetesting.TestResource has received all updates. - body := fakeClient.Data[key].R.Node.Value stored := &storagetesting.TestResource{} - if err := codec.DecodeInto([]byte(body), stored); err != nil { - t.Errorf("Error decoding stored value: %v", body) + err := helper.Get(context.TODO(), key, stored, false) + if err != nil { + t.Errorf("Unexpected error %#v", stored) } if stored.Value != concurrency { t.Errorf("Some of the writes were lost. Stored value: %d", stored.Value) } } -func TestGetEtcdVersion_ValidVersion(t *testing.T) { - testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, validEtcdVersion) - })) - defer testServer.Close() - - var version string - var err error - if version, err = GetEtcdVersion(testServer.URL); err != nil { - t.Errorf("Unexpected error: %v", err) - } - assert.Equal(t, validEtcdVersion, version, "Unexpected version") - assert.Nil(t, err) -} - -func TestGetEtcdVersion_ErrorStatus(t *testing.T) { - testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusServiceUnavailable) - })) - defer testServer.Close() - - _, err := GetEtcdVersion(testServer.URL) - assert.NotNil(t, err) -} - -func TestGetEtcdVersion_NotListening(t *testing.T) { - portIsOpen := func(port int) bool { - conn, err := net.DialTimeout("tcp", "127.0.0.1:"+strconv.Itoa(port), 1*time.Second) - if err == nil { - conn.Close() - return true - } - return false - } - - port := rand.Intn((1 << 16) - 1) - for tried := 0; portIsOpen(port); tried++ { - if tried >= 10 { - t.Fatal("Couldn't find a closed TCP port to continue testing") - } - port++ - } - - _, err := GetEtcdVersion("http://127.0.0.1:" + strconv.Itoa(port)) - assert.NotNil(t, err) -} - func TestPrefixEtcdKey(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) prefix := path.Join("/", etcdtest.PathPrefix()) - helper := newEtcdHelper(fakeClient, testapi.Default.Codec(), prefix) + helper := newEtcdHelper(server.Client, testapi.Default.Codec(), prefix) baseKey := "/some/key" @@ -886,32 +550,3 @@ func TestPrefixEtcdKey(t *testing.T) { assert.Equal(t, keyBefore, keyAfter, "Prefix incorrectly added by EtcdHelper") } - -func TestEtcdHealthCheck(t *testing.T) { - tests := []struct { - data string - expectErr bool - }{ - { - data: "{\"health\": \"true\"}", - expectErr: false, - }, - { - data: "{\"health\": \"false\"}", - expectErr: true, - }, - { - data: "invalid json", - expectErr: true, - }, - } - for _, test := range tests { - err := EtcdHealthCheck([]byte(test.data)) - if err != nil && !test.expectErr { - t.Errorf("unexpected error: %v", err) - } - if err == nil && test.expectErr { - t.Error("unexpected non-error") - } - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_watcher.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_watcher.go index 9dae52658..c54e4b3ac 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_watcher.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_watcher.go @@ -17,18 +17,22 @@ limitations under the License. package etcd import ( + "fmt" + "net/http" "sync" + "sync/atomic" "time" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/storage" - "k8s.io/kubernetes/pkg/tools" - "k8s.io/kubernetes/pkg/util" + etcdutil "k8s.io/kubernetes/pkg/storage/etcd/util" + utilruntime "k8s.io/kubernetes/pkg/util/runtime" "k8s.io/kubernetes/pkg/watch" - "github.com/coreos/go-etcd/etcd" + etcd "github.com/coreos/etcd/client" "github.com/golang/glog" + "golang.org/x/net/context" ) // Etcd watch event actions @@ -41,6 +45,23 @@ const ( EtcdExpire = "expire" ) +// HighWaterMark is a thread-safe object for tracking the maximum value seen +// for some quantity. +type HighWaterMark int64 + +// Update returns true if and only if 'current' is the highest value ever seen. +func (hwm *HighWaterMark) Update(current int64) bool { + for { + old := atomic.LoadInt64((*int64)(hwm)) + if current <= old { + return false + } + if atomic.CompareAndSwapInt64((*int64)(hwm), old, current) { + return true + } + } +} + // TransformFunc attempts to convert an object to another object for use with a watcher. type TransformFunc func(runtime.Object) (runtime.Object, error) @@ -61,18 +82,22 @@ type etcdWatcher struct { transform TransformFunc list bool // If we're doing a recursive watch, should be true. + quorum bool // If we enable quorum, shoule be true include includeFunc filter storage.FilterFunc etcdIncoming chan *etcd.Response etcdError chan error - etcdStop chan bool + ctx context.Context + cancel context.CancelFunc etcdCallEnded chan struct{} outgoing chan watch.Event userStop chan struct{} stopped bool stopLock sync.Mutex + // wg is used to avoid calls to etcd after Stop() + wg sync.WaitGroup // Injectable for testing. Send the event down the outgoing channel. emit func(watch.Event) @@ -85,12 +110,13 @@ const watchWaitDuration = 100 * time.Millisecond // newEtcdWatcher returns a new etcdWatcher; if list is true, watch sub-nodes. If you provide a transform // and a versioner, the versioner must be able to handle the objects that transform creates. -func newEtcdWatcher(list bool, include includeFunc, filter storage.FilterFunc, encoding runtime.Codec, versioner storage.Versioner, transform TransformFunc, cache etcdCache) *etcdWatcher { +func newEtcdWatcher(list bool, quorum bool, include includeFunc, filter storage.FilterFunc, encoding runtime.Codec, versioner storage.Versioner, transform TransformFunc, cache etcdCache) *etcdWatcher { w := &etcdWatcher{ encoding: encoding, versioner: versioner, transform: transform, list: list, + quorum: quorum, include: include, filter: filter, // Buffer this channel, so that the etcd client is not forced @@ -105,10 +131,13 @@ func newEtcdWatcher(list bool, include includeFunc, filter storage.FilterFunc, e // monitor how much of this buffer is actually used. etcdIncoming: make(chan *etcd.Response, 100), etcdError: make(chan error, 1), - etcdStop: make(chan bool), outgoing: make(chan watch.Event), userStop: make(chan struct{}), + stopped: false, + wg: sync.WaitGroup{}, cache: cache, + ctx: nil, + cancel: nil, } w.emit = func(e watch.Event) { w.outgoing <- e } go w.translate() @@ -117,37 +146,83 @@ func newEtcdWatcher(list bool, include includeFunc, filter storage.FilterFunc, e // etcdWatch calls etcd's Watch function, and handles any errors. Meant to be called // as a goroutine. -func (w *etcdWatcher) etcdWatch(client tools.EtcdClient, key string, resourceVersion uint64) { - defer util.HandleCrash() +func (w *etcdWatcher) etcdWatch(ctx context.Context, client etcd.KeysAPI, key string, resourceVersion uint64) { + defer utilruntime.HandleCrash() defer close(w.etcdError) - if resourceVersion == 0 { - latest, err := etcdGetInitialWatchState(client, key, w.list, w.etcdIncoming) + defer close(w.etcdIncoming) + + // All calls to etcd are coming from this function - once it is finished + // no other call to etcd should be generated by this watcher. + done := func() {} + + // We need to be prepared, that Stop() can be called at any time. + // It can potentially also be called, even before this function is called. + // If that is the case, we simply skip all the code here. + // See #18928 for more details. + var watcher etcd.Watcher + returned := func() bool { + w.stopLock.Lock() + defer w.stopLock.Unlock() + if w.stopped { + // Watcher has already been stopped - don't event initiate it here. + return true + } + w.wg.Add(1) + done = w.wg.Done + // Perform initialization of watcher under lock - we want to avoid situation when + // Stop() is called in the meantime (which in tests can cause etcd termination and + // strange behavior here). + if resourceVersion == 0 { + latest, err := etcdGetInitialWatchState(ctx, client, key, w.list, w.quorum, w.etcdIncoming) + if err != nil { + w.etcdError <- err + return true + } + resourceVersion = latest + } + + opts := etcd.WatcherOptions{ + Recursive: w.list, + AfterIndex: resourceVersion, + } + watcher = client.Watcher(key, &opts) + w.ctx, w.cancel = context.WithCancel(ctx) + return false + }() + defer done() + if returned { + return + } + + for { + resp, err := watcher.Next(w.ctx) if err != nil { w.etcdError <- err return } - resourceVersion = latest + 1 - } - _, err := client.Watch(key, resourceVersion, w.list, w.etcdIncoming, w.etcdStop) - if err != nil && err != etcd.ErrWatchStoppedByUser { - w.etcdError <- err + w.etcdIncoming <- resp } } // etcdGetInitialWatchState turns an etcd Get request into a watch equivalent -func etcdGetInitialWatchState(client tools.EtcdClient, key string, recursive bool, incoming chan<- *etcd.Response) (resourceVersion uint64, err error) { - resp, err := client.Get(key, false, recursive) +func etcdGetInitialWatchState(ctx context.Context, client etcd.KeysAPI, key string, recursive bool, quorum bool, incoming chan<- *etcd.Response) (resourceVersion uint64, err error) { + opts := etcd.GetOptions{ + Recursive: recursive, + Sort: false, + Quorum: quorum, + } + resp, err := client.Get(ctx, key, &opts) if err != nil { - if !IsEtcdNotFound(err) { - glog.Errorf("watch was unable to retrieve the current index for the provided key (%q): %v", key, err) + if !etcdutil.IsEtcdNotFound(err) { + utilruntime.HandleError(fmt.Errorf("watch was unable to retrieve the current index for the provided key (%q): %v", key, err)) return resourceVersion, err } - if index, ok := etcdErrorIndex(err); ok { - resourceVersion = index + if etcdError, ok := err.(etcd.Error); ok { + resourceVersion = etcdError.Index } return resourceVersion, nil } - resourceVersion = resp.EtcdIndex + resourceVersion = resp.Index convertRecursiveResponse(resp.Node, resp, incoming) return } @@ -168,34 +243,51 @@ func convertRecursiveResponse(node *etcd.Node, response *etcd.Response, incoming } var ( - watchChannelHWM util.HighWaterMark + watchChannelHWM HighWaterMark ) // translate pulls stuff from etcd, converts, and pushes out the outgoing channel. Meant to be // called as a goroutine. func (w *etcdWatcher) translate() { defer close(w.outgoing) - defer util.HandleCrash() + defer utilruntime.HandleCrash() for { select { case err := <-w.etcdError: if err != nil { - w.emit(watch.Event{ - Type: watch.Error, - Object: &unversioned.Status{ + var status *unversioned.Status + switch { + case etcdutil.IsEtcdWatchExpired(err): + status = &unversioned.Status{ Status: unversioned.StatusFailure, Message: err.Error(), - }, + Code: http.StatusGone, // Gone + Reason: unversioned.StatusReasonExpired, + } + // TODO: need to generate errors using api/errors which has a circular dependency on this package + // no other way to inject errors + // case etcdutil.IsEtcdUnreachable(err): + // status = errors.NewServerTimeout(...) + default: + status = &unversioned.Status{ + Status: unversioned.StatusFailure, + Message: err.Error(), + Code: http.StatusInternalServerError, + Reason: unversioned.StatusReasonInternalError, + } + } + w.emit(watch.Event{ + Type: watch.Error, + Object: status, }) } return case <-w.userStop: - w.etcdStop <- true return case res, ok := <-w.etcdIncoming: if ok { - if curLen := int64(len(w.etcdIncoming)); watchChannelHWM.Check(curLen) { + if curLen := int64(len(w.etcdIncoming)); watchChannelHWM.Update(curLen) { // Monitor if this gets backed up, and how much. glog.V(2).Infof("watch: %v objects queued in channel.", curLen) } @@ -212,7 +304,7 @@ func (w *etcdWatcher) decodeObject(node *etcd.Node) (runtime.Object, error) { return obj, nil } - obj, err := w.encoding.Decode([]byte(node.Value)) + obj, err := runtime.Decode(w.encoding, []byte(node.Value)) if err != nil { return nil, err } @@ -220,7 +312,7 @@ func (w *etcdWatcher) decodeObject(node *etcd.Node) (runtime.Object, error) { // ensure resource version is set on the object we load from etcd if w.versioner != nil { if err := w.versioner.UpdateObject(obj, node.Expiration, node.ModifiedIndex); err != nil { - glog.Errorf("failure to version api object (%d) %#v: %v", node.ModifiedIndex, obj, err) + utilruntime.HandleError(fmt.Errorf("failure to version api object (%d) %#v: %v", node.ModifiedIndex, obj, err)) } } @@ -228,7 +320,7 @@ func (w *etcdWatcher) decodeObject(node *etcd.Node) (runtime.Object, error) { if w.transform != nil { obj, err = w.transform(obj) if err != nil { - glog.Errorf("failure to transform api object %#v: %v", obj, err) + utilruntime.HandleError(fmt.Errorf("failure to transform api object %#v: %v", obj, err)) return nil, err } } @@ -241,7 +333,7 @@ func (w *etcdWatcher) decodeObject(node *etcd.Node) (runtime.Object, error) { func (w *etcdWatcher) sendAdd(res *etcd.Response) { if res.Node == nil { - glog.Errorf("unexpected nil node: %#v", res) + utilruntime.HandleError(fmt.Errorf("unexpected nil node: %#v", res)) return } if w.include != nil && !w.include(res.Node.Key) { @@ -249,7 +341,7 @@ func (w *etcdWatcher) sendAdd(res *etcd.Response) { } obj, err := w.decodeObject(res.Node) if err != nil { - glog.Errorf("failure to decode api object: '%v' from %#v %#v", string(res.Node.Value), res, res.Node) + utilruntime.HandleError(fmt.Errorf("failure to decode api object: %v\n'%v' from %#v %#v", err, string(res.Node.Value), res, res.Node)) // TODO: expose an error through watch.Interface? // Ignore this value. If we stop the watch on a bad value, a client that uses // the resourceVersion to resume will never be able to get past a bad value. @@ -278,7 +370,7 @@ func (w *etcdWatcher) sendModify(res *etcd.Response) { } curObj, err := w.decodeObject(res.Node) if err != nil { - glog.Errorf("failure to decode api object: '%v' from %#v %#v", string(res.Node.Value), res, res.Node) + utilruntime.HandleError(fmt.Errorf("failure to decode api object: %v\n'%v' from %#v %#v", err, string(res.Node.Value), res, res.Node)) // TODO: expose an error through watch.Interface? // Ignore this value. If we stop the watch on a bad value, a client that uses // the resourceVersion to resume will never be able to get past a bad value. @@ -318,7 +410,7 @@ func (w *etcdWatcher) sendModify(res *etcd.Response) { func (w *etcdWatcher) sendDelete(res *etcd.Response) { if res.PrevNode == nil { - glog.Errorf("unexpected nil prev node: %#v", res) + utilruntime.HandleError(fmt.Errorf("unexpected nil prev node: %#v", res)) return } if w.include != nil && !w.include(res.PrevNode.Key) { @@ -333,7 +425,7 @@ func (w *etcdWatcher) sendDelete(res *etcd.Response) { } obj, err := w.decodeObject(&node) if err != nil { - glog.Errorf("failure to decode api object: '%v' from %#v %#v", string(res.PrevNode.Value), res, res.PrevNode) + utilruntime.HandleError(fmt.Errorf("failure to decode api object: %v\nfrom %#v %#v", err, res, res.Node)) // TODO: expose an error through watch.Interface? // Ignore this value. If we stop the watch on a bad value, a client that uses // the resourceVersion to resume will never be able to get past a bad value. @@ -357,7 +449,7 @@ func (w *etcdWatcher) sendResult(res *etcd.Response) { case EtcdDelete, EtcdExpire: w.sendDelete(res) default: - glog.Errorf("unknown action: %v", res.Action) + utilruntime.HandleError(fmt.Errorf("unknown action: %v", res.Action)) } } @@ -369,10 +461,17 @@ func (w *etcdWatcher) ResultChan() <-chan watch.Event { // Stop implements watch.Interface. func (w *etcdWatcher) Stop() { w.stopLock.Lock() - defer w.stopLock.Unlock() - // Prevent double channel closes. + if w.cancel != nil { + w.cancel() + w.cancel = nil + } if !w.stopped { w.stopped = true close(w.userStop) } + w.stopLock.Unlock() + + // Wait until all calls to etcd are finished and no other + // will be issued. + w.wg.Wait() } diff --git a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_watcher_test.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_watcher_test.go index 3f95b864f..6a304ea86 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_watcher_test.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_watcher_test.go @@ -17,21 +17,20 @@ limitations under the License. package etcd import ( - "fmt" + "math/rand" + rt "runtime" + "sync" "testing" - "time" - "github.com/coreos/go-etcd/etcd" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/storage" - "k8s.io/kubernetes/pkg/tools" - "k8s.io/kubernetes/pkg/tools/etcdtest" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/storage/etcd/etcdtest" + etcdtesting "k8s.io/kubernetes/pkg/storage/etcd/testing" "k8s.io/kubernetes/pkg/watch" + etcd "github.com/coreos/etcd/client" "golang.org/x/net/context" ) @@ -132,7 +131,7 @@ func TestWatchInterpretations(t *testing.T) { for name, item := range table { for _, action := range item.actions { - w := newEtcdWatcher(true, nil, firstLetterIsB, codec, versioner, nil, &fakeEtcdCache{}) + w := newEtcdWatcher(true, false, nil, firstLetterIsB, codec, versioner, nil, &fakeEtcdCache{}) emitCalled := false w.emit = func(event watch.Event) { emitCalled = true @@ -170,7 +169,8 @@ func TestWatchInterpretations(t *testing.T) { } func TestWatchInterpretation_ResponseNotSet(t *testing.T) { - w := newEtcdWatcher(false, nil, storage.Everything, codec, versioner, nil, &fakeEtcdCache{}) + _, codec := testScheme(t) + w := newEtcdWatcher(false, false, nil, storage.Everything, codec, versioner, nil, &fakeEtcdCache{}) w.emit = func(e watch.Event) { t.Errorf("Unexpected emit: %v", e) } @@ -182,9 +182,10 @@ func TestWatchInterpretation_ResponseNotSet(t *testing.T) { } func TestWatchInterpretation_ResponseNoNode(t *testing.T) { + _, codec := testScheme(t) actions := []string{"create", "set", "compareAndSwap", "delete"} for _, action := range actions { - w := newEtcdWatcher(false, nil, storage.Everything, codec, versioner, nil, &fakeEtcdCache{}) + w := newEtcdWatcher(false, false, nil, storage.Everything, codec, versioner, nil, &fakeEtcdCache{}) w.emit = func(e watch.Event) { t.Errorf("Unexpected emit: %v", e) } @@ -196,9 +197,10 @@ func TestWatchInterpretation_ResponseNoNode(t *testing.T) { } func TestWatchInterpretation_ResponseBadData(t *testing.T) { + _, codec := testScheme(t) actions := []string{"create", "set", "compareAndSwap", "delete"} for _, action := range actions { - w := newEtcdWatcher(false, nil, storage.Everything, codec, versioner, nil, &fakeEtcdCache{}) + w := newEtcdWatcher(false, false, nil, storage.Everything, codec, versioner, nil, &fakeEtcdCache{}) w.emit = func(e watch.Event) { t.Errorf("Unexpected emit: %v", e) } @@ -218,62 +220,25 @@ func TestWatchInterpretation_ResponseBadData(t *testing.T) { } } -func TestWatchEtcdError(t *testing.T) { - codec := testapi.Default.Codec() - fakeClient := tools.NewFakeEtcdClient(t) - fakeClient.ExpectNotFoundGet("/some/key") - fakeClient.WatchImmediateError = fmt.Errorf("immediate error") - h := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) - - watching, err := h.Watch(context.TODO(), "/some/key", 4, storage.Everything) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - defer watching.Stop() - - got := <-watching.ResultChan() - if got.Type != watch.Error { - t.Fatalf("Unexpected non-error") - } - status, ok := got.Object.(*unversioned.Status) - if !ok { - t.Fatalf("Unexpected non-error object type") - } - if status.Message != "immediate error" { - t.Errorf("Unexpected wrong error") - } - if status.Status != unversioned.StatusFailure { - t.Errorf("Unexpected wrong error status") - } -} - func TestWatch(t *testing.T) { codec := testapi.Default.Codec() - fakeClient := tools.NewFakeEtcdClient(t) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) key := "/some/key" - prefixedKey := etcdtest.AddPrefix(key) - fakeClient.ExpectNotFoundGet(prefixedKey) - h := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) + h := newEtcdHelper(server.Client, codec, etcdtest.PathPrefix()) - watching, err := h.Watch(context.TODO(), key, 0, storage.Everything) + watching, err := h.Watch(context.TODO(), key, "0", storage.Everything) if err != nil { t.Fatalf("Unexpected error: %v", err) } - - fakeClient.WaitForWatchCompletion() - // when server returns not found, the watch index starts at the next value (1) - if fakeClient.WatchIndex != 1 { - t.Errorf("Expected client to be at index %d, got %#v", 1, fakeClient) - } + // watching is explicitly closed below. // Test normal case pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - podBytes, _ := codec.Encode(pod) - fakeClient.WatchResponse <- &etcd.Response{ - Action: "set", - Node: &etcd.Node{ - Value: string(podBytes), - }, + returnObj := &api.Pod{} + err = h.Set(context.TODO(), key, pod, returnObj, 0) + if err != nil { + t.Fatalf("Unexpected error: %v", err) } event := <-watching.ResultChan() @@ -284,26 +249,17 @@ func TestWatch(t *testing.T) { t.Errorf("Expected %v, got %v", e, a) } - // Test error case - fakeClient.WatchInjectError <- fmt.Errorf("Injected error") + watching.Stop() - if errEvent, ok := <-watching.ResultChan(); !ok { - t.Errorf("no error result?") - } else { - if e, a := watch.Error, errEvent.Type; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - if e, a := "Injected error", errEvent.Object.(*unversioned.Status).Message; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - } - - // Did everything shut down? - if _, open := <-fakeClient.WatchResponse; open { - t.Errorf("An injected error did not cause a graceful shutdown") - } - if _, open := <-watching.ResultChan(); open { - t.Errorf("An injected error did not cause a graceful shutdown") + // There is a race in etcdWatcher so that after calling Stop() one of + // two things can happen: + // - ResultChan() may be closed (triggered by closing userStop channel) + // - an Error "context cancelled" may be emitted (triggered by cancelling request + // to etcd and putting that error to etcdError channel) + // We need to be prepared for both here. + event, open := <-watching.ResultChan() + if open && event.Type != watch.Error { + t.Errorf("Unexpected event from stopped watcher: %#v", event) } } @@ -320,139 +276,48 @@ func makeSubsets(ip string, port int) []api.EndpointSubset { func TestWatchEtcdState(t *testing.T) { codec := testapi.Default.Codec() - baseKey := "/somekey/foo" - prefixedKey := etcdtest.AddPrefix(baseKey) - type T struct { - Type watch.EventType - Endpoints []api.EndpointSubset + key := etcdtest.AddPrefix("/somekey/foo") + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + + h := newEtcdHelper(server.Client, codec, etcdtest.PathPrefix()) + watching, err := h.Watch(context.TODO(), key, "0", storage.Everything) + if err != nil { + t.Fatalf("Unexpected error: %v", err) } - testCases := map[string]struct { - Initial map[string]tools.EtcdResponseWithError - Responses []*etcd.Response - From uint64 - Expected []*T - }{ - "from not found": { - Initial: map[string]tools.EtcdResponseWithError{}, - Responses: []*etcd.Response{ - { - Action: "create", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(codec, &api.Endpoints{ - ObjectMeta: api.ObjectMeta{Name: "foo"}, - Subsets: emptySubsets(), - })), - }, - }, - }, - From: 1, - Expected: []*T{ - {watch.Added, nil}, - }, - }, - "from version 1": { - Responses: []*etcd.Response{ - { - Action: "compareAndSwap", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(codec, &api.Endpoints{ - ObjectMeta: api.ObjectMeta{Name: "foo"}, - Subsets: makeSubsets("127.0.0.1", 9000), - })), - CreatedIndex: 1, - ModifiedIndex: 2, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(codec, &api.Endpoints{ - ObjectMeta: api.ObjectMeta{Name: "foo"}, - Subsets: emptySubsets(), - })), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - }, - }, - From: 1, - Expected: []*T{ - {watch.Modified, makeSubsets("127.0.0.1", 9000)}, - }, - }, - "from initial state": { - Initial: map[string]tools.EtcdResponseWithError{ - prefixedKey: { - R: &etcd.Response{ - Action: "get", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(codec, &api.Endpoints{ - ObjectMeta: api.ObjectMeta{Name: "foo"}, - Subsets: emptySubsets(), - })), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - EtcdIndex: 1, - }, - }, - }, - Responses: []*etcd.Response{ - nil, - { - Action: "compareAndSwap", - Node: &etcd.Node{ - Value: string(runtime.EncodeOrDie(codec, &api.Endpoints{ - ObjectMeta: api.ObjectMeta{Name: "foo"}, - Subsets: makeSubsets("127.0.0.1", 9000), - })), - CreatedIndex: 1, - ModifiedIndex: 2, - }, - PrevNode: &etcd.Node{ - Value: string(runtime.EncodeOrDie(codec, &api.Endpoints{ - ObjectMeta: api.ObjectMeta{Name: "foo"}, - Subsets: emptySubsets(), - })), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - }, - }, - Expected: []*T{ - {watch.Added, nil}, - {watch.Modified, makeSubsets("127.0.0.1", 9000)}, - }, - }, + defer watching.Stop() + + endpoint := &api.Endpoints{ + ObjectMeta: api.ObjectMeta{Name: "foo"}, + Subsets: emptySubsets(), } - for k, testCase := range testCases { - fakeClient := tools.NewFakeEtcdClient(t) - for key, value := range testCase.Initial { - fakeClient.Data[key] = value - } + err = h.Set(context.TODO(), key, endpoint, endpoint, 0) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } - h := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) - watching, err := h.Watch(context.TODO(), baseKey, testCase.From, storage.Everything) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } + event := <-watching.ResultChan() + if event.Type != watch.Added { + t.Errorf("Unexpected event %#v", event) + } - fakeClient.WaitForWatchCompletion() + subset := makeSubsets("127.0.0.1", 9000) + endpoint.Subsets = subset - t.Logf("Testing %v", k) - for i := range testCase.Responses { - if testCase.Responses[i] != nil { - fakeClient.WatchResponse <- testCase.Responses[i] - } - event := <-watching.ResultChan() - if e, a := testCase.Expected[i].Type, event.Type; e != a { - t.Errorf("%s: expected type %v, got %v", k, e, a) - break - } - if e, a := testCase.Expected[i].Endpoints, event.Object.(*api.Endpoints).Subsets; !api.Semantic.DeepDerivative(e, a) { - t.Errorf("%s: expected type %v, got %v", k, e, a) - break - } - } - watching.Stop() + // CAS the previous value + err = h.Set(context.TODO(), key, endpoint, endpoint, 0) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + + event = <-watching.ResultChan() + if event.Type != watch.Modified { + t.Errorf("Unexpected event %#v", event) + } + + if e, a := endpoint, event.Object; !api.Semantic.DeepDerivative(e, a) { + t.Errorf("%s: expected %v, got %v", e, a) } } @@ -460,280 +325,168 @@ func TestWatchFromZeroIndex(t *testing.T) { codec := testapi.Default.Codec() pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - testCases := map[string]struct { - Response tools.EtcdResponseWithError - ExpectedVersion string - ExpectedType watch.EventType - }{ - "get value created": { - tools.EtcdResponseWithError{ - R: &etcd.Response{ - Node: &etcd.Node{ - Value: runtime.EncodeOrDie(codec, pod), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - Action: "get", - EtcdIndex: 2, - }, - }, - "1", - watch.Added, - }, - "get value modified": { - tools.EtcdResponseWithError{ - R: &etcd.Response{ - Node: &etcd.Node{ - Value: runtime.EncodeOrDie(codec, pod), - CreatedIndex: 1, - ModifiedIndex: 2, - }, - Action: "get", - EtcdIndex: 3, - }, - }, - "2", - watch.Modified, - }, + key := etcdtest.AddPrefix("/somekey/foo") + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + + h := newEtcdHelper(server.Client, codec, etcdtest.PathPrefix()) + + // set before the watch and verify events + err := h.Set(context.TODO(), key, pod, pod, 0) + if err != nil { + t.Fatalf("Unexpected error: %v", err) } - for k, testCase := range testCases { - fakeClient := tools.NewFakeEtcdClient(t) - key := "/some/key" - prefixedKey := etcdtest.AddPrefix(key) - fakeClient.Data[prefixedKey] = testCase.Response - h := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) + // check for concatenation on watch event with CAS + pod.Name = "bar" + err = h.Set(context.TODO(), key, pod, pod, 0) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } - watching, err := h.Watch(context.TODO(), key, 0, storage.Everything) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } + watching, err := h.Watch(context.TODO(), key, "0", storage.Everything) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + defer watching.Stop() - fakeClient.WaitForWatchCompletion() - if e, a := testCase.Response.R.EtcdIndex+1, fakeClient.WatchIndex; e != a { - t.Errorf("%s: expected watch index to be %d, got %d", k, e, a) - } + // marked as modified b/c of concatenation + event := <-watching.ResultChan() + if event.Type != watch.Modified { + t.Errorf("Unexpected event %#v", event) + } - // the existing node is detected and the index set - event := <-watching.ResultChan() - if e, a := testCase.ExpectedType, event.Type; e != a { - t.Errorf("%s: expected %v, got %v", k, e, a) - } - actualPod, ok := event.Object.(*api.Pod) - if !ok { - t.Fatalf("%s: expected a pod, got %#v", k, event.Object) - } - if actualPod.ResourceVersion != testCase.ExpectedVersion { - t.Errorf("%s: expected pod with resource version %v, Got %#v", k, testCase.ExpectedVersion, actualPod) - } - pod.ResourceVersion = testCase.ExpectedVersion - if e, a := pod, event.Object; !api.Semantic.DeepDerivative(e, a) { - t.Errorf("%s: expected %v, got %v", k, e, a) - } - watching.Stop() + err = h.Set(context.TODO(), key, pod, pod, 0) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + + event = <-watching.ResultChan() + if event.Type != watch.Modified { + t.Errorf("Unexpected event %#v", event) + } + + if e, a := pod, event.Object; !api.Semantic.DeepDerivative(e, a) { + t.Errorf("%s: expected %v, got %v", e, a) } } func TestWatchListFromZeroIndex(t *testing.T) { codec := testapi.Default.Codec() - pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - key := "/some/key" - prefixedKey := etcdtest.AddPrefix(key) - fakeClient := tools.NewFakeEtcdClient(t) - fakeClient.Data[prefixedKey] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - Node: &etcd.Node{ - Dir: true, - Nodes: etcd.Nodes{ - &etcd.Node{ - Value: runtime.EncodeOrDie(codec, pod), - CreatedIndex: 1, - ModifiedIndex: 1, - Nodes: etcd.Nodes{}, - }, - &etcd.Node{ - Value: runtime.EncodeOrDie(codec, pod), - CreatedIndex: 2, - ModifiedIndex: 2, - Nodes: etcd.Nodes{}, - }, - }, - }, - Action: "get", - EtcdIndex: 3, - }, - } - h := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) + key := etcdtest.AddPrefix("/some/key") + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + h := newEtcdHelper(server.Client, codec, key) - watching, err := h.WatchList(context.TODO(), key, 0, storage.Everything) + watching, err := h.WatchList(context.TODO(), key, "0", storage.Everything) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + defer watching.Stop() + + // creates key/foo which should trigger the WatchList for "key" + pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} + err = h.Create(context.TODO(), pod.Name, pod, pod, 0) if err != nil { t.Fatalf("Unexpected error: %v", err) } - // the existing node is detected and the index set - event, open := <-watching.ResultChan() - if !open { - t.Fatalf("unexpected channel close") - } - for i := 0; i < 2; i++ { - if e, a := watch.Added, event.Type; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - actualPod, ok := event.Object.(*api.Pod) - if !ok { - t.Fatalf("expected a pod, got %#v", event.Object) - } - if actualPod.ResourceVersion != "1" { - t.Errorf("Expected pod with resource version %d, Got %#v", 1, actualPod) - } - pod.ResourceVersion = "1" - if e, a := pod, event.Object; !api.Semantic.DeepDerivative(e, a) { - t.Errorf("Expected %v, got %v", e, a) - } + event, _ := <-watching.ResultChan() + if event.Type != watch.Added { + t.Errorf("Unexpected event %#v", event) } - fakeClient.WaitForWatchCompletion() - watching.Stop() + if e, a := pod, event.Object; !api.Semantic.DeepDerivative(e, a) { + t.Errorf("%s: expected %v, got %v", e, a) + } } func TestWatchListIgnoresRootKey(t *testing.T) { codec := testapi.Default.Codec() pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} - key := "/some/key" - prefixedKey := etcdtest.AddPrefix(key) + key := etcdtest.AddPrefix("/some/key") + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) + h := newEtcdHelper(server.Client, codec, key) - fakeClient := tools.NewFakeEtcdClient(t) - h := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) - - watching, err := h.WatchList(context.TODO(), key, 1, storage.Everything) + watching, err := h.WatchList(context.TODO(), key, "0", storage.Everything) if err != nil { t.Fatalf("Unexpected error: %v", err) } - fakeClient.WaitForWatchCompletion() + defer watching.Stop() - // This is the root directory of the watch, which happens to have a value encoded - fakeClient.WatchResponse <- &etcd.Response{ - Action: "delete", - PrevNode: &etcd.Node{ - Key: prefixedKey, - Value: runtime.EncodeOrDie(codec, pod), - CreatedIndex: 1, - ModifiedIndex: 1, - }, - } - // Delete of the parent directory of a key is an event that a list watch would receive, - // but will have no value so the decode will fail. - fakeClient.WatchResponse <- &etcd.Response{ - Action: "delete", - PrevNode: &etcd.Node{ - Key: prefixedKey, - Value: "", - CreatedIndex: 1, - ModifiedIndex: 1, - }, - } - close(fakeClient.WatchStop) - - // the existing node is detected and the index set - _, open := <-watching.ResultChan() - if open { - t.Fatalf("unexpected channel open") - } - - watching.Stop() -} - -func TestWatchFromNotFound(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - key := "/some/key" - prefixedKey := etcdtest.AddPrefix(key) - fakeClient.Data[prefixedKey] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - Node: nil, - }, - E: &etcd.EtcdError{ - Index: 2, - ErrorCode: 100, - }, - } - h := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) - - watching, err := h.Watch(context.TODO(), key, 0, storage.Everything) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - fakeClient.WaitForWatchCompletion() - if fakeClient.WatchIndex != 3 { - t.Errorf("Expected client to wait for %d, got %#v", 3, fakeClient) - } - - watching.Stop() -} - -func TestWatchFromOtherError(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - key := "/some/key" - prefixedKey := etcdtest.AddPrefix(key) - fakeClient.Data[prefixedKey] = tools.EtcdResponseWithError{ - R: &etcd.Response{ - Node: nil, - }, - E: &etcd.EtcdError{ - Index: 2, - ErrorCode: 101, - }, - } - h := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) - - watching, err := h.Watch(context.TODO(), key, 0, storage.Everything) + // creates key/foo which should trigger the WatchList for "key" + err = h.Create(context.TODO(), key, pod, pod, 0) if err != nil { t.Fatalf("Unexpected error: %v", err) } - errEvent := <-watching.ResultChan() - if e, a := watch.Error, errEvent.Type; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - if e, a := "101: () [2]", errEvent.Object.(*unversioned.Status).Message; e != a { - t.Errorf("Expected %v, got %v", e, a) - } + // force context switch to ensure watches would catch and notify. + rt.Gosched() select { - case _, ok := <-watching.ResultChan(): - if ok { - t.Fatalf("expected result channel to be closed") - } - case <-time.After(util.ForeverTestTimeout): - t.Fatalf("watch should have closed channel: %#v", watching) - } - - if fakeClient.WatchResponse != nil || fakeClient.WatchIndex != 0 { - t.Fatalf("Watch should not have been invoked: %#v", fakeClient) + case event, _ := <-watching.ResultChan(): + t.Fatalf("Unexpected event: %#v", event) + default: + // fall through, expected behavior } } func TestWatchPurposefulShutdown(t *testing.T) { - fakeClient := tools.NewFakeEtcdClient(t) - - h := newEtcdHelper(fakeClient, codec, etcdtest.PathPrefix()) + _, codec := testScheme(t) + server := etcdtesting.NewEtcdTestClientServer(t) + defer server.Terminate(t) key := "/some/key" - prefixedKey := etcdtest.AddPrefix(key) - fakeClient.ExpectNotFoundGet(prefixedKey) + h := newEtcdHelper(server.Client, codec, etcdtest.PathPrefix()) // Test purposeful shutdown - watching, err := h.Watch(context.TODO(), key, 0, storage.Everything) + watching, err := h.Watch(context.TODO(), key, "0", storage.Everything) if err != nil { t.Fatalf("Unexpected error: %v", err) } - fakeClient.WaitForWatchCompletion() watching.Stop() + rt.Gosched() - // Did everything shut down? - if _, open := <-fakeClient.WatchResponse; open { - t.Errorf("A stop did not cause a graceful shutdown") - } - if _, open := <-watching.ResultChan(); open { - t.Errorf("An injected error did not cause a graceful shutdown") + // There is a race in etcdWatcher so that after calling Stop() one of + // two things can happen: + // - ResultChan() may be closed (triggered by closing userStop channel) + // - an Error "context cancelled" may be emitted (triggered by cancelling request + // to etcd and putting that error to etcdError channel) + // We need to be prepared for both here. + event, open := <-watching.ResultChan() + if open && event.Type != watch.Error { + t.Errorf("Unexpected event from stopped watcher: %#v", event) + } +} + +func TestHighWaterMark(t *testing.T) { + var h HighWaterMark + + for i := int64(10); i < 20; i++ { + if !h.Update(i) { + t.Errorf("unexpected false for %v", i) + } + if h.Update(i - 1) { + t.Errorf("unexpected true for %v", i-1) + } + } + + m := int64(0) + wg := sync.WaitGroup{} + for i := 0; i < 300; i++ { + wg.Add(1) + v := rand.Int63() + go func(v int64) { + defer wg.Done() + h.Update(v) + }(v) + if v > m { + m = v + } + } + wg.Wait() + if m != int64(h) { + t.Errorf("unexpected value, wanted %v, got %v", m, int64(h)) } } diff --git a/vendor/k8s.io/kubernetes/pkg/tools/etcdtest/doc.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcdtest/doc.go similarity index 100% rename from vendor/k8s.io/kubernetes/pkg/tools/etcdtest/doc.go rename to vendor/k8s.io/kubernetes/pkg/storage/etcd/etcdtest/doc.go diff --git a/vendor/k8s.io/kubernetes/pkg/tools/etcdtest/etcdtest.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcdtest/etcdtest.go similarity index 100% rename from vendor/k8s.io/kubernetes/pkg/tools/etcdtest/etcdtest.go rename to vendor/k8s.io/kubernetes/pkg/storage/etcd/etcdtest/etcdtest.go diff --git a/vendor/k8s.io/kubernetes/pkg/tools/metrics/metrics.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/metrics/metrics.go similarity index 93% rename from vendor/k8s.io/kubernetes/pkg/tools/metrics/metrics.go rename to vendor/k8s.io/kubernetes/pkg/storage/etcd/metrics/metrics.go index 00bd35fc8..7e88e43c2 100644 --- a/vendor/k8s.io/kubernetes/pkg/tools/metrics/metrics.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/etcd/metrics/metrics.go @@ -102,3 +102,12 @@ func ObserveCacheMiss() { func ObserveNewEntry() { cacheEntryCounter.Inc() } + +func Reset() { + cacheHitCounter.Set(0) + cacheMissCounter.Set(0) + cacheEntryCounter.Set(0) + // TODO: Reset cacheAddLatency. + // TODO: Reset cacheGetLatency. + etcdRequestLatenciesSummary.Reset() +} diff --git a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_test_util.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/testing/utils.go similarity index 71% rename from vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_test_util.go rename to vendor/k8s.io/kubernetes/pkg/storage/etcd/testing/utils.go index b94eb6cba..7dc65b6de 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_test_util.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/etcd/testing/utils.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package etcd +package testing import ( "fmt" @@ -26,21 +26,21 @@ import ( "testing" "time" - "k8s.io/kubernetes/pkg/tools" - + etcd "github.com/coreos/etcd/client" "github.com/coreos/etcd/etcdserver" "github.com/coreos/etcd/etcdserver/etcdhttp" "github.com/coreos/etcd/pkg/transport" "github.com/coreos/etcd/pkg/types" "github.com/coreos/etcd/rafthttp" - goetcd "github.com/coreos/go-etcd/etcd" + "github.com/golang/glog" + "golang.org/x/net/context" ) // EtcdTestServer encapsulates the datastructures needed to start local instance for testing type EtcdTestServer struct { etcdserver.ServerConfig PeerListeners, ClientListeners []net.Listener - client tools.EtcdClient + Client etcd.Client raftHandler http.Handler s *etcdserver.EtcdServer @@ -126,13 +126,37 @@ func (m *EtcdTestServer) launch(t *testing.T) error { return nil } +// waitForEtcd wait until etcd is propagated correctly +func (m *EtcdTestServer) waitUntilUp() error { + membersAPI := etcd.NewMembersAPI(m.Client) + for start := time.Now(); time.Since(start) < 5*time.Second; time.Sleep(10 * time.Millisecond) { + members, err := membersAPI.List(context.TODO()) + if err != nil { + glog.Errorf("Error when getting etcd cluster members") + continue + } + if len(members) == 1 && len(members[0].ClientURLs) > 0 { + return nil + } + } + return fmt.Errorf("timeout on waiting for etcd cluster") +} + // Terminate will shutdown the running etcd server func (m *EtcdTestServer) Terminate(t *testing.T) { - m.client.(*goetcd.Client).Close() + m.Client = nil m.s.Stop() + // TODO: This is a pretty ugly hack to workaround races during closing + // in-memory etcd server in unit tests - see #18928 for more details. + // We should get rid of it as soon as we have a proper fix - etcd clients + // have overwritten transport counting opened connections (probably by + // overwriting Dial function) and termination function waiting for all + // connections to be closed and stopping accepting new ones. + time.Sleep(250 * time.Millisecond) for _, hs := range m.hss { hs.CloseClientConnections() - hs.Close() + // TODO: Uncomment when fix #19254 + // hs.Close() } if err := os.RemoveAll(m.ServerConfig.DataDir); err != nil { t.Fatal(err) @@ -147,10 +171,18 @@ func NewEtcdTestClientServer(t *testing.T) *EtcdTestServer { t.Fatal("Failed to start etcd server error=%v", err) return nil } - server.client = goetcd.NewClient(server.ClientURLs.StringSlice()) - if server.client == nil { - t.Errorf("Failed to connect to local etcd server") - defer server.Terminate(t) + cfg := etcd.Config{ + Endpoints: server.ClientURLs.StringSlice(), + } + server.Client, err = etcd.New(cfg) + if err != nil { + t.Errorf("Unexpected error in NewEtcdTestClientServer (%v)", err) + server.Terminate(t) + return nil + } + if err := server.waitUntilUp(); err != nil { + t.Errorf("Unexpected error in waitUntilUp (%v)", err) + server.Terminate(t) return nil } return server diff --git a/vendor/k8s.io/kubernetes/pkg/storage/etcd/util/doc.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/util/doc.go new file mode 100644 index 000000000..aa1039faf --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/storage/etcd/util/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package util holds generic etcd-related utility functions that any user of ectd might want to +// use, without pulling in kubernetes-specific code. +package util diff --git a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_util.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/util/etcd_util.go similarity index 61% rename from vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_util.go rename to vendor/k8s.io/kubernetes/pkg/storage/etcd/util/etcd_util.go index d99b3c28f..b15ec5bd0 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/etcd/etcd_util.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/etcd/util/etcd_util.go @@ -14,53 +14,54 @@ See the License for the specific language governing permissions and limitations under the License. */ -package etcd +package util import ( "encoding/json" "fmt" "io/ioutil" "net/http" - "os/exec" - goetcd "github.com/coreos/go-etcd/etcd" - "github.com/golang/glog" - "k8s.io/kubernetes/pkg/tools" + etcd "github.com/coreos/etcd/client" ) // IsEtcdNotFound returns true if and only if err is an etcd not found error. func IsEtcdNotFound(err error) bool { - return isEtcdErrorNum(err, tools.EtcdErrorCodeNotFound) + return isEtcdErrorNum(err, etcd.ErrorCodeKeyNotFound) } // IsEtcdNodeExist returns true if and only if err is an etcd node already exist error. func IsEtcdNodeExist(err error) bool { - return isEtcdErrorNum(err, tools.EtcdErrorCodeNodeExist) + return isEtcdErrorNum(err, etcd.ErrorCodeNodeExist) } // IsEtcdTestFailed returns true if and only if err is an etcd write conflict. func IsEtcdTestFailed(err error) bool { - return isEtcdErrorNum(err, tools.EtcdErrorCodeTestFailed) + return isEtcdErrorNum(err, etcd.ErrorCodeTestFailed) } -// IsEtcdWatchStoppedByUser returns true if and only if err is a client triggered stop. -func IsEtcdWatchStoppedByUser(err error) bool { - return goetcd.ErrWatchStoppedByUser == err +// IsEtcdWatchExpired returns true if and only if err indicates the watch has expired. +func IsEtcdWatchExpired(err error) bool { + // NOTE: This seems weird why it wouldn't be etcd.ErrorCodeWatcherCleared + // I'm using the previous matching value + return isEtcdErrorNum(err, etcd.ErrorCodeEventIndexCleared) +} + +// IsEtcdUnreachable returns true if and only if err indicates the server could not be reached. +func IsEtcdUnreachable(err error) bool { + // NOTE: The logic has changed previous error code no longer applies + return err == etcd.ErrClusterUnavailable } // isEtcdErrorNum returns true if and only if err is an etcd error, whose errorCode matches errorCode func isEtcdErrorNum(err error, errorCode int) bool { - etcdError, ok := err.(*goetcd.EtcdError) - return ok && etcdError != nil && etcdError.ErrorCode == errorCode -} - -// etcdErrorIndex returns the index associated with the error message and whether the -// index was available. -func etcdErrorIndex(err error) (uint64, bool) { - if etcdError, ok := err.(*goetcd.EtcdError); ok { - return etcdError.Index, true + if err != nil { + if etcdError, ok := err.(etcd.Error); ok { + return etcdError.Code == errorCode + } + // NOTE: There are other error types returned } - return 0, false + return false } // GetEtcdVersion performs a version check against the provided Etcd server, @@ -81,29 +82,6 @@ func GetEtcdVersion(host string) (string, error) { return string(versionBytes), nil } -func startEtcd() (*exec.Cmd, error) { - cmd := exec.Command("etcd") - err := cmd.Start() - if err != nil { - return nil, err - } - return cmd, nil -} - -func NewEtcdClientStartServerIfNecessary(server string) (tools.EtcdClient, error) { - _, err := GetEtcdVersion(server) - if err != nil { - glog.Infof("Failed to find etcd, attempting to start.") - _, err := startEtcd() - if err != nil { - return nil, err - } - } - - servers := []string{server} - return goetcd.NewClient(servers), nil -} - type etcdHealth struct { // Note this has to be public so the json library can modify it. Health string `json:"health"` diff --git a/vendor/k8s.io/kubernetes/pkg/storage/etcd/util/etcd_util_test.go b/vendor/k8s.io/kubernetes/pkg/storage/etcd/util/etcd_util_test.go new file mode 100644 index 000000000..455542017 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/storage/etcd/util/etcd_util_test.go @@ -0,0 +1,122 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +import ( + "fmt" + "math/rand" + "net" + "net/http" + "net/http/httptest" + "strconv" + "testing" + "time" + + etcd "github.com/coreos/etcd/client" + "github.com/stretchr/testify/assert" +) + +const validEtcdVersion = "etcd 2.0.9" + +func TestIsEtcdNotFound(t *testing.T) { + try := func(err error, isNotFound bool) { + if IsEtcdNotFound(err) != isNotFound { + t.Errorf("Expected %#v to return %v, but it did not", err, isNotFound) + } + } + try(&etcd.Error{Code: 101}, false) + try(nil, false) + try(fmt.Errorf("some other kind of error"), false) +} + +func TestGetEtcdVersion_ValidVersion(t *testing.T) { + testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, validEtcdVersion) + })) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() + + var version string + var err error + if version, err = GetEtcdVersion(testServer.URL); err != nil { + t.Errorf("Unexpected error: %v", err) + } + assert.Equal(t, validEtcdVersion, version, "Unexpected version") + assert.Nil(t, err) +} + +func TestGetEtcdVersion_ErrorStatus(t *testing.T) { + testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusServiceUnavailable) + })) + // TODO: Uncomment when fix #19254 + // defer testServer.Close() + + _, err := GetEtcdVersion(testServer.URL) + assert.NotNil(t, err) +} + +func TestGetEtcdVersion_NotListening(t *testing.T) { + portIsOpen := func(port int) bool { + conn, err := net.DialTimeout("tcp", "127.0.0.1:"+strconv.Itoa(port), 1*time.Second) + if err == nil { + conn.Close() + return true + } + return false + } + + port := rand.Intn((1 << 16) - 1) + for tried := 0; portIsOpen(port); tried++ { + if tried >= 10 { + t.Fatal("Couldn't find a closed TCP port to continue testing") + } + port++ + } + + _, err := GetEtcdVersion("http://127.0.0.1:" + strconv.Itoa(port)) + assert.NotNil(t, err) +} + +func TestEtcdHealthCheck(t *testing.T) { + tests := []struct { + data string + expectErr bool + }{ + { + data: "{\"health\": \"true\"}", + expectErr: false, + }, + { + data: "{\"health\": \"false\"}", + expectErr: true, + }, + { + data: "invalid json", + expectErr: true, + }, + } + for _, test := range tests { + err := EtcdHealthCheck([]byte(test.data)) + if err != nil && !test.expectErr { + t.Errorf("unexpected error: %v", err) + } + if err == nil && test.expectErr { + t.Error("unexpected non-error") + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/storage/interfaces.go b/vendor/k8s.io/kubernetes/pkg/storage/interfaces.go index c55f2687f..7c5b15395 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/interfaces.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/interfaces.go @@ -95,15 +95,17 @@ type Interface interface { // Watch begins watching the specified key. Events are decoded into API objects, // and any items passing 'filter' are sent down to returned watch.Interface. - // resourceVersion may be used to specify what version to begin watching + // resourceVersion may be used to specify what version to begin watching, + // which should be the current resourceVersion, and no longer rv+1 // (e.g. reconnecting without missing any updates). - Watch(ctx context.Context, key string, resourceVersion uint64, filter FilterFunc) (watch.Interface, error) + Watch(ctx context.Context, key string, resourceVersion string, filter FilterFunc) (watch.Interface, error) // WatchList begins watching the specified key's items. Items are decoded into API // objects and any item passing 'filter' are sent down to returned watch.Interface. - // resourceVersion may be used to specify what version to begin watching + // resourceVersion may be used to specify what version to begin watching, + // which should be the current resourceVersion, and no longer rv+1 // (e.g. reconnecting without missing any updates). - WatchList(ctx context.Context, key string, resourceVersion uint64, filter FilterFunc) (watch.Interface, error) + WatchList(ctx context.Context, key string, resourceVersion string, filter FilterFunc) (watch.Interface, error) // Get unmarshals json found at key into objPtr. On a not found error, will either // return a zero object of the requested type, or an error, depending on ignoreNotFound. @@ -116,7 +118,9 @@ type Interface interface { // List unmarshalls jsons found at directory defined by key and opaque them // into *List api object (an object that satisfies runtime.IsList definition). - List(ctx context.Context, key string, filter FilterFunc, listObj runtime.Object) error + // The returned contents may be delayed, but it is guaranteed that they will + // be have at least 'resourceVersion'. + List(ctx context.Context, key string, resourceVersion string, filter FilterFunc, listObj runtime.Object) error // GuaranteedUpdate keeps calling 'tryUpdate()' to update key 'key' (of type 'ptrToType') // retrying the update until success if there is index conflict. @@ -147,3 +151,13 @@ type Interface interface { // Codec provides access to the underlying codec being used by the implementation. Codec() runtime.Codec } + +// Config interface allows storage tiers to generate the proper storage.interface +// and reduce the dependencies to encapsulate storage. +type Config interface { + // Creates the Interface base on ConfigObject + NewStorage() (Interface, error) + + // This function is used to enforce membership, and return the underlying type + GetType() string +} diff --git a/vendor/k8s.io/kubernetes/pkg/storage/testing/types.generated.go b/vendor/k8s.io/kubernetes/pkg/storage/testing/types.generated.go index 7e617e213..0bdb64f47 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/testing/types.generated.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/testing/types.generated.go @@ -34,10 +34,18 @@ import ( ) const ( - codecSelferC_UTF81234 = 1 - codecSelferC_RAW1234 = 0 + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- codecSelferValueTypeArray1234 = 10 codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 ) var ( @@ -48,10 +56,10 @@ var ( type codecSelfer1234 struct{} func init() { - if codec1978.GenVersion != 4 { + if codec1978.GenVersion != 5 { _, file, _, _ := runtime.Caller(0) err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", - 4, codec1978.GenVersion, file) + 5, codec1978.GenVersion, file) panic(err) } if false { // reference the types, but skip this branch at build/run time @@ -80,89 +88,105 @@ func (x *TestResource) CodecEncodeSelf(e *codec1978.Encoder) { var yyq2 [4]bool _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false - yyq2[0] = x.Kind != "" - yyq2[1] = x.APIVersion != "" + yyq2[2] = x.Kind != "" + yyq2[3] = x.APIVersion != "" + var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(4) } else { - var yynn2 int = 2 + yynn2 = 2 for _, b := range yyq2 { if b { yynn2++ } } r.EncodeMapStart(yynn2) + yynn2 = 0 } if yyr2 || yy2arr2 { - if yyq2[0] { - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2[0] { - r.EncodeString(codecSelferC_UTF81234, string("kind")) - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) - } - } - } - if yyr2 || yy2arr2 { - if yyq2[1] { - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } else { - r.EncodeString(codecSelferC_UTF81234, "") - } - } else { - if yyq2[1] { - r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) - } - } - } - if yyr2 || yy2arr2 { - yy10 := &x.ObjectMeta - yy10.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy4 := &x.ObjectMeta + yy4.CodecEncodeSelf(e) } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("metadata")) - yy11 := &x.ObjectMeta - yy11.CodecEncodeSelf(e) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy6 := &x.ObjectMeta + yy6.CodecEncodeSelf(e) } if yyr2 || yy2arr2 { - yym13 := z.EncBinary() - _ = yym13 + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym9 := z.EncBinary() + _ = yym9 if false { } else { r.EncodeInt(int64(x.Value)) } } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("value")) - yym14 := z.EncBinary() - _ = yym14 + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym10 := z.EncBinary() + _ = yym10 if false { } else { r.EncodeInt(int64(x.Value)) } } - if yysep2 { - r.EncodeEnd() + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yym12 := z.EncBinary() + _ = yym12 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) } } } @@ -172,24 +196,25 @@ func (x *TestResource) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - yym15 := z.DecBinary() - _ = yym15 + yym1 := z.DecBinary() + _ = yym1 if false { } else if z.HasExtensions() && z.DecExt(x) { } else { - if r.IsContainerType(codecSelferValueTypeMap1234) { - yyl16 := r.ReadMapStart() - if yyl16 == 0 { - r.ReadEnd() + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } else { - x.codecDecodeSelfFromMap(yyl16, d) + x.codecDecodeSelfFromMap(yyl2, d) } - } else if r.IsContainerType(codecSelferValueTypeArray1234) { - yyl16 := r.ReadArrayStart() - if yyl16 == 0 { - r.ReadEnd() + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } else { - x.codecDecodeSelfFromArray(yyl16, d) + x.codecDecodeSelfFromArray(yyl2, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) @@ -201,12 +226,12 @@ func (x *TestResource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yys17Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys17Slc - var yyhl17 bool = l >= 0 - for yyj17 := 0; ; yyj17++ { - if yyhl17 { - if yyj17 >= l { + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { break } } else { @@ -214,9 +239,24 @@ func (x *TestResource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - yys17Slc = r.DecodeBytes(yys17Slc, true, true) - yys17 := string(yys17Slc) - switch yys17 { + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg2_api.ObjectMeta{} + } else { + yyv4 := &x.ObjectMeta + yyv4.CodecDecodeSelf(d) + } + case "value": + if r.TryDecodeAsNil() { + x.Value = 0 + } else { + x.Value = int(r.DecodeInt(codecSelferBitsize1234)) + } case "kind": if r.TryDecodeAsNil() { x.Kind = "" @@ -229,107 +269,97 @@ func (x *TestResource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } else { x.APIVersion = string(r.DecodeString()) } - case "metadata": - if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_api.ObjectMeta{} - } else { - yyv20 := &x.ObjectMeta - yyv20.CodecDecodeSelf(d) - } - case "value": - if r.TryDecodeAsNil() { - x.Value = 0 - } else { - x.Value = int(r.DecodeInt(codecSelferBitsize1234)) - } default: - z.DecStructFieldNotFound(-1, yys17) - } // end switch yys17 - } // end for yyj17 - if !yyhl17 { - r.ReadEnd() - } + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) } func (x *TestResource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj22 int - var yyb22 bool - var yyhl22 bool = l >= 0 - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb22 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb22 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.Kind = "" - } else { - x.Kind = string(r.DecodeString()) - } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - r.ReadEnd() - return - } - if r.TryDecodeAsNil() { - x.APIVersion = "" - } else { - x.APIVersion = string(r.DecodeString()) - } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l - } else { - yyb22 = r.CheckBreak() - } - if yyb22 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.ObjectMeta = pkg2_api.ObjectMeta{} } else { - yyv25 := &x.ObjectMeta - yyv25.CodecDecodeSelf(d) + yyv9 := &x.ObjectMeta + yyv9.CodecDecodeSelf(d) } - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb22 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb22 { - r.ReadEnd() + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { x.Value = 0 } else { x.Value = int(r.DecodeInt(codecSelferBitsize1234)) } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + x.Kind = string(r.DecodeString()) + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + x.APIVersion = string(r.DecodeString()) + } for { - yyj22++ - if yyhl22 { - yyb22 = yyj22 > l + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l } else { - yyb22 = r.CheckBreak() + yyb8 = r.CheckBreak() } - if yyb22 { + if yyb8 { break } - z.DecStructFieldNotFound(yyj22-1, "") + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj8-1, "") } - r.ReadEnd() + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } diff --git a/vendor/k8s.io/kubernetes/pkg/storage/testing/types.go b/vendor/k8s.io/kubernetes/pkg/storage/testing/types.go index 4fa38404c..a1377aa04 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/testing/types.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/testing/types.go @@ -27,4 +27,4 @@ type TestResource struct { Value int `json:"value"` } -func (*TestResource) IsAnAPIObject() {} +func (obj *TestResource) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta } diff --git a/vendor/k8s.io/kubernetes/pkg/storage/testing/utils.go b/vendor/k8s.io/kubernetes/pkg/storage/testing/utils.go new file mode 100644 index 000000000..e79ea9adf --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/storage/testing/utils.go @@ -0,0 +1,61 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testing + +import ( + "path" + + "golang.org/x/net/context" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/storage" +) + +// CreateObj will create a single object using the storage interface +func CreateObj(helper storage.Interface, name string, obj, out runtime.Object, ttl uint64) error { + return helper.Set(context.TODO(), name, obj, out, ttl) +} + +//CreateObjList will create a list from the array of objects +func CreateObjList(prefix string, helper storage.Interface, items []runtime.Object) error { + for i := range items { + obj := items[i] + meta, err := meta.Accessor(obj) + if err != nil { + return err + } + err = CreateObj(helper, path.Join(prefix, meta.GetName()), obj, obj, 0) + if err != nil { + return err + } + items[i] = obj + } + return nil +} + +// CreateList will properly create a list using the storage interface +func CreateList(prefix string, helper storage.Interface, list runtime.Object) error { + items, err := meta.ExtractList(list) + if err != nil { + return err + } + err = CreateObjList(prefix, helper, items) + if err != nil { + return err + } + return meta.SetList(list, items) +} diff --git a/vendor/k8s.io/kubernetes/pkg/storage/util.go b/vendor/k8s.io/kubernetes/pkg/storage/util.go index 1e12684e4..43056c3da 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/util.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/util.go @@ -22,9 +22,10 @@ import ( "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/validation" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util/fielderrors" + "k8s.io/kubernetes/pkg/util/validation/field" ) type SimpleUpdateFunc func(runtime.Object) (runtime.Object, error) @@ -41,16 +42,29 @@ func SimpleUpdate(fn SimpleUpdateFunc) UpdateFunc { // the etcd version we should pass to helper.Watch(). Because resourceVersion is // an opaque value, the default watch behavior for non-zero watch is to watch // the next value (if you pass "1", you will see updates from "2" onwards). -func ParseWatchResourceVersion(resourceVersion, kind string) (uint64, error) { +func ParseWatchResourceVersion(resourceVersion string) (uint64, error) { if resourceVersion == "" || resourceVersion == "0" { return 0, nil } version, err := strconv.ParseUint(resourceVersion, 10, 64) if err != nil { - // TODO: Does this need to be a ValidationErrorList? I can't convince myself it does. - return 0, errors.NewInvalid(kind, "", fielderrors.ValidationErrorList{fielderrors.NewFieldInvalid("resourceVersion", resourceVersion, err.Error())}) + return 0, errors.NewInvalid(unversioned.GroupKind{}, "", field.ErrorList{ + // Validation errors are supposed to return version-specific field + // paths, but this is probably close enough. + field.Invalid(field.NewPath("resourceVersion"), resourceVersion, err.Error()), + }) } - return version + 1, nil + return version, nil +} + +// ParseListResourceVersion takes a resource version argument and converts it to +// the etcd version. +func ParseListResourceVersion(resourceVersion string) (uint64, error) { + if resourceVersion == "" { + return 0, nil + } + version, err := strconv.ParseUint(resourceVersion, 10, 64) + return version, err } func NamespaceKeyFunc(prefix string, obj runtime.Object) (string, error) { @@ -58,11 +72,11 @@ func NamespaceKeyFunc(prefix string, obj runtime.Object) (string, error) { if err != nil { return "", err } - name := meta.Name() - if ok, msg := validation.ValidatePathSegmentName(name, false); !ok { + name := meta.GetName() + if ok, msg := validation.IsValidPathSegmentName(name); !ok { return "", fmt.Errorf("invalid name: %v", msg) } - return prefix + "/" + meta.Namespace() + "/" + meta.Name(), nil + return prefix + "/" + meta.GetNamespace() + "/" + name, nil } func NoNamespaceKeyFunc(prefix string, obj runtime.Object) (string, error) { @@ -70,9 +84,9 @@ func NoNamespaceKeyFunc(prefix string, obj runtime.Object) (string, error) { if err != nil { return "", err } - name := meta.Name() - if ok, msg := validation.ValidatePathSegmentName(name, false); !ok { + name := meta.GetName() + if ok, msg := validation.IsValidPathSegmentName(name); !ok { return "", fmt.Errorf("invalid name: %v", msg) } - return prefix + "/" + meta.Name(), nil + return prefix + "/" + name, nil } diff --git a/vendor/k8s.io/kubernetes/pkg/storage/util_test.go b/vendor/k8s.io/kubernetes/pkg/storage/util_test.go index 1de4f1067..d24ae5d5f 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/util_test.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/util_test.go @@ -25,18 +25,17 @@ import ( func TestEtcdParseWatchResourceVersion(t *testing.T) { testCases := []struct { Version string - Kind string ExpectVersion uint64 Err bool }{ {Version: "", ExpectVersion: 0}, {Version: "a", Err: true}, {Version: " ", Err: true}, - {Version: "1", ExpectVersion: 2}, - {Version: "10", ExpectVersion: 11}, + {Version: "1", ExpectVersion: 1}, + {Version: "10", ExpectVersion: 10}, } for _, testCase := range testCases { - version, err := ParseWatchResourceVersion(testCase.Version, testCase.Kind) + version, err := ParseWatchResourceVersion(testCase.Version) switch { case testCase.Err: if err == nil { diff --git a/vendor/k8s.io/kubernetes/pkg/storage/watch_cache.go b/vendor/k8s.io/kubernetes/pkg/storage/watch_cache.go index 1b376feec..2e842a28e 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/watch_cache.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/watch_cache.go @@ -21,14 +21,22 @@ import ( "sort" "strconv" "sync" + "time" "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/watch" ) +const ( + // MaximumListWait determines how long we're willing to wait for a + // list if a client specified a resource version in the future. + MaximumListWait = 60 * time.Second +) + // watchCacheEvent is a single "watch event" that is send to users of // watchCache. Additionally to a typical "watch.Event" it contains // the previous value of the object to enable proper filtering in the @@ -50,11 +58,15 @@ type watchCacheElement struct { // watchCache implements a Store interface. // However, it depends on the elements implementing runtime.Object interface. // -// watchCache is a "sliding window" (with a limitted capacity) of objects +// watchCache is a "sliding window" (with a limited capacity) of objects // observed from a watch. type watchCache struct { sync.RWMutex + // Condition on which lists are waiting for the fresh enough + // resource version. + cond *sync.Cond + // Maximum size of history window. capacity int @@ -81,17 +93,23 @@ type watchCache struct { // This handler is run at the end of every Add/Update/Delete method // and additionally gets the previous value of the object. onEvent func(watchCacheEvent) + + // for testing timeouts. + clock util.Clock } func newWatchCache(capacity int) *watchCache { - return &watchCache{ + wc := &watchCache{ capacity: capacity, cache: make([]watchCacheElement, capacity), startIndex: 0, endIndex: 0, store: cache.NewStore(cache.MetaNamespaceKeyFunc), resourceVersion: 0, + clock: util.RealClock{}, } + wc.cond = sync.NewCond(wc.RLocker()) + return wc } func (w *watchCache) Add(obj interface{}) error { @@ -136,7 +154,7 @@ func objectToVersionedRuntimeObject(obj interface{}) (runtime.Object, uint64, er if err != nil { return nil, 0, err } - resourceVersion, err := parseResourceVersion(meta.ResourceVersion()) + resourceVersion, err := parseResourceVersion(meta.GetResourceVersion()) if err != nil { return nil, 0, err } @@ -160,8 +178,6 @@ func (w *watchCache) processEvent(event watch.Event, resourceVersion uint64, upd var prevObject runtime.Object if exists { prevObject = previous.(runtime.Object) - } else { - prevObject = nil } watchCacheEvent := watchCacheEvent{event.Type, event.Object, prevObject} if w.onEvent != nil { @@ -169,6 +185,7 @@ func (w *watchCache) processEvent(event watch.Event, resourceVersion uint64, upd } w.updateCache(resourceVersion, watchCacheEvent) w.resourceVersion = resourceVersion + w.cond.Broadcast() return updateFunc(event.Object) } @@ -188,10 +205,29 @@ func (w *watchCache) List() []interface{} { return w.store.List() } -func (w *watchCache) ListWithVersion() ([]interface{}, uint64) { +func (w *watchCache) WaitUntilFreshAndList(resourceVersion uint64) ([]interface{}, uint64, error) { + startTime := w.clock.Now() + go func() { + // Wake us up when the time limit has expired. The docs + // promise that time.After (well, NewTimer, which it calls) + // will wait *at least* the duration given. Since this go + // routine starts sometime after we record the start time, and + // it will wake up the loop below sometime after the broadcast, + // we don't need to worry about waking it up before the time + // has expired accidentally. + <-w.clock.After(MaximumListWait) + w.cond.Broadcast() + }() + w.RLock() defer w.RUnlock() - return w.store.List(), w.resourceVersion + for w.resourceVersion < resourceVersion { + if w.clock.Since(startTime) >= MaximumListWait { + return nil, 0, fmt.Errorf("time limit exceeded while waiting for resource version %v (current value: %v)", resourceVersion, w.resourceVersion) + } + w.cond.Wait() + } + return w.store.List(), w.resourceVersion, nil } func (w *watchCache) ListKeys() []string { @@ -230,6 +266,7 @@ func (w *watchCache) Replace(objs []interface{}, resourceVersion string) error { if w.onReplace != nil { w.onReplace() } + w.cond.Broadcast() return nil } @@ -266,10 +303,10 @@ func (w *watchCache) GetAllEventsSinceThreadUnsafe(resourceVersion uint64) ([]wa return result, nil } if resourceVersion < oldest { - return nil, errors.NewInternalError(fmt.Errorf("too old resource version: %d (%d)", resourceVersion, oldest)) + return nil, errors.NewGone(fmt.Sprintf("too old resource version: %d (%d)", resourceVersion, oldest)) } - // Binary seatch the smallest index at which resourceVersion is not smaller than + // Binary search the smallest index at which resourceVersion is not smaller than // the given one. f := func(i int) bool { return w.cache[(w.startIndex+i)%w.capacity].resourceVersion >= resourceVersion diff --git a/vendor/k8s.io/kubernetes/pkg/storage/watch_cache_test.go b/vendor/k8s.io/kubernetes/pkg/storage/watch_cache_test.go index bc62ca85b..e2268fe95 100644 --- a/vendor/k8s.io/kubernetes/pkg/storage/watch_cache_test.go +++ b/vendor/k8s.io/kubernetes/pkg/storage/watch_cache_test.go @@ -19,6 +19,7 @@ package storage import ( "strconv" "testing" + "time" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" @@ -27,6 +28,7 @@ import ( "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util/sets" + "k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/watch" ) @@ -40,8 +42,15 @@ func makeTestPod(name string, resourceVersion uint64) *api.Pod { } } +// newTestWatchCache just adds a fake clock. +func newTestWatchCache(capacity int) *watchCache { + wc := newWatchCache(capacity) + wc.clock = util.NewFakeClock(time.Now()) + return wc +} + func TestWatchCacheBasic(t *testing.T) { - store := newWatchCache(2) + store := newTestWatchCache(2) // Test Add/Update/Delete. pod1 := makeTestPod("pod", 1) @@ -111,7 +120,7 @@ func TestWatchCacheBasic(t *testing.T) { } func TestEvents(t *testing.T) { - store := newWatchCache(5) + store := newTestWatchCache(5) store.Add(makeTestPod("pod", 2)) @@ -230,41 +239,94 @@ func TestEvents(t *testing.T) { } } -type testLW struct { - ListFunc func() (runtime.Object, error) - WatchFunc func(resourceVersion string) (watch.Interface, error) +func TestWaitUntilFreshAndList(t *testing.T) { + store := newTestWatchCache(3) + + // In background, update the store. + go func() { + store.Add(makeTestPod("foo", 2)) + store.Add(makeTestPod("bar", 5)) + }() + + list, resourceVersion, err := store.WaitUntilFreshAndList(5) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if resourceVersion != 5 { + t.Errorf("unexpected resourceVersion: %v, expected: 5", resourceVersion) + } + if len(list) != 2 { + t.Errorf("unexpected list returned: %#v", list) + } } -func (t *testLW) List() (runtime.Object, error) { return t.ListFunc() } -func (t *testLW) Watch(resourceVersion string) (watch.Interface, error) { - return t.WatchFunc(resourceVersion) +func TestWaitUntilFreshAndListTimeout(t *testing.T) { + store := newTestWatchCache(3) + fc := store.clock.(*util.FakeClock) + + // In background, step clock after the below call starts the timer. + go func() { + for !fc.HasWaiters() { + time.Sleep(time.Millisecond) + } + fc.Step(MaximumListWait) + + // Add an object to make sure the test would + // eventually fail instead of just waiting + // forever. + time.Sleep(30 * time.Second) + store.Add(makeTestPod("bar", 5)) + }() + + _, _, err := store.WaitUntilFreshAndList(5) + if err == nil { + t.Fatalf("unexpected lack of timeout error") + } +} + +type testLW struct { + ListFunc func(options api.ListOptions) (runtime.Object, error) + WatchFunc func(options api.ListOptions) (watch.Interface, error) +} + +func (t *testLW) List(options api.ListOptions) (runtime.Object, error) { + return t.ListFunc(options) +} +func (t *testLW) Watch(options api.ListOptions) (watch.Interface, error) { + return t.WatchFunc(options) } func TestReflectorForWatchCache(t *testing.T) { - store := newWatchCache(5) + store := newTestWatchCache(5) { - _, version := store.ListWithVersion() + _, version, err := store.WaitUntilFreshAndList(0) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } if version != 0 { t.Errorf("unexpected resource version: %d", version) } } lw := &testLW{ - WatchFunc: func(rv string) (watch.Interface, error) { + WatchFunc: func(options api.ListOptions) (watch.Interface, error) { fw := watch.NewFake() go fw.Stop() return fw, nil }, - ListFunc: func() (runtime.Object, error) { + ListFunc: func(options api.ListOptions) (runtime.Object, error) { return &api.PodList{ListMeta: unversioned.ListMeta{ResourceVersion: "10"}}, nil }, } r := cache.NewReflector(lw, &api.Pod{}, store, 0) - r.ListAndWatch(util.NeverStop) + r.ListAndWatch(wait.NeverStop) { - _, version := store.ListWithVersion() + _, version, err := store.WaitUntilFreshAndList(10) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } if version != 10 { t.Errorf("unexpected resource version: %d", version) } diff --git a/vendor/k8s.io/kubernetes/pkg/tools/fake_etcd_client.go b/vendor/k8s.io/kubernetes/pkg/tools/fake_etcd_client.go deleted file mode 100644 index 8b87b347e..000000000 --- a/vendor/k8s.io/kubernetes/pkg/tools/fake_etcd_client.go +++ /dev/null @@ -1,352 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package tools - -import ( - "errors" - "sort" - "sync" - "time" - - "github.com/coreos/go-etcd/etcd" -) - -type EtcdResponseWithError struct { - R *etcd.Response - E error - // if N is non-null, it will be assigned into the map after this response is used for an operation - N *EtcdResponseWithError -} - -// TestLogger is a type passed to Test functions to support formatted test logs. -type TestLogger interface { - Fatalf(format string, args ...interface{}) - Errorf(format string, args ...interface{}) - Logf(format string, args ...interface{}) -} - -type FakeEtcdClient struct { - watchCompletedChan chan bool - - Data map[string]EtcdResponseWithError - DeletedKeys []string - expectNotFoundGetSet map[string]struct{} - sync.Mutex - Err error - CasErr error - t TestLogger - Ix int - TestIndex bool - ChangeIndex uint64 - LastSetTTL uint64 - // Will avoid setting the expires header on objects to make comparison easier - HideExpires bool - Machines []string - - // Will become valid after Watch is called; tester may write to it. Tester may - // also read from it to verify that it's closed after injecting an error. - WatchResponse chan *etcd.Response - WatchIndex uint64 - // Write to this to prematurely stop a Watch that is running in a goroutine. - WatchInjectError chan<- error - WatchStop chan<- bool - // If non-nil, will be returned immediately when Watch is called. - WatchImmediateError error -} - -func NewFakeEtcdClient(t TestLogger) *FakeEtcdClient { - ret := &FakeEtcdClient{ - t: t, - expectNotFoundGetSet: map[string]struct{}{}, - Data: map[string]EtcdResponseWithError{}, - } - // There are three publicly accessible channels in FakeEtcdClient: - // - WatchResponse - // - WatchInjectError - // - WatchStop - // They are only available when Watch() is called. If users of - // FakeEtcdClient want to use any of these channels, they have to call - // WaitForWatchCompletion before any operation on these channels. - // Internally, FakeEtcdClient use watchCompletedChan to indicate if the - // Watch() method has been called. WaitForWatchCompletion() will wait - // on this channel. WaitForWatchCompletion() will return only when - // WatchResponse, WatchInjectError and WatchStop are ready to read/write. - ret.watchCompletedChan = make(chan bool) - return ret -} - -func (f *FakeEtcdClient) SetError(err error) { - f.Err = err -} - -func (f *FakeEtcdClient) GetCluster() []string { - return f.Machines -} - -func (f *FakeEtcdClient) ExpectNotFoundGet(key string) { - f.expectNotFoundGetSet[key] = struct{}{} -} - -func (f *FakeEtcdClient) NewError(code int) *etcd.EtcdError { - return &etcd.EtcdError{ - ErrorCode: code, - Index: f.ChangeIndex, - } -} - -func (f *FakeEtcdClient) generateIndex() uint64 { - if !f.TestIndex { - return 0 - } - - f.ChangeIndex++ - f.t.Logf("generating index %v", f.ChangeIndex) - return f.ChangeIndex -} - -// Requires that f.Mutex be held. -func (f *FakeEtcdClient) updateResponse(key string) { - resp, found := f.Data[key] - if !found || resp.N == nil { - return - } - f.Data[key] = *resp.N -} - -func (f *FakeEtcdClient) Get(key string, sort, recursive bool) (*etcd.Response, error) { - if f.Err != nil { - return nil, f.Err - } - - f.Mutex.Lock() - defer f.Mutex.Unlock() - defer f.updateResponse(key) - - result := f.Data[key] - if result.R == nil { - if _, ok := f.expectNotFoundGetSet[key]; !ok { - f.t.Logf("data for %s was not defined prior to invoking Get", key) - } - return &etcd.Response{}, f.NewError(EtcdErrorCodeNotFound) - } - f.t.Logf("returning %v: %#v %#v", key, result.R, result.E) - - // Sort response, note this will alter result.R. - if result.R.Node != nil && result.R.Node.Nodes != nil && sort { - f.sortResponse(result.R.Node.Nodes) - } - return result.R, result.E -} - -func (f *FakeEtcdClient) sortResponse(nodes etcd.Nodes) { - for i := range nodes { - if nodes[i].Dir { - f.sortResponse(nodes[i].Nodes) - } - } - sort.Sort(nodes) -} - -func (f *FakeEtcdClient) nodeExists(key string) bool { - result, ok := f.Data[key] - return ok && result.R != nil && result.R.Node != nil && result.E == nil -} - -func (f *FakeEtcdClient) setLocked(key, value string, ttl uint64) (*etcd.Response, error) { - f.LastSetTTL = ttl - if f.Err != nil { - return nil, f.Err - } - - i := f.generateIndex() - - if f.nodeExists(key) { - prevResult := f.Data[key] - createdIndex := prevResult.R.Node.CreatedIndex - f.t.Logf("updating %v, index %v -> %v (ttl: %d)", key, createdIndex, i, ttl) - var expires *time.Time - if !f.HideExpires && ttl > 0 { - now := time.Now() - expires = &now - } - result := EtcdResponseWithError{ - R: &etcd.Response{ - Node: &etcd.Node{ - Value: value, - CreatedIndex: createdIndex, - ModifiedIndex: i, - TTL: int64(ttl), - Expiration: expires, - }, - }, - } - f.Data[key] = result - return result.R, nil - } - - f.t.Logf("creating %v, index %v (ttl: %d)", key, i, ttl) - result := EtcdResponseWithError{ - R: &etcd.Response{ - Node: &etcd.Node{ - Value: value, - CreatedIndex: i, - ModifiedIndex: i, - TTL: int64(ttl), - }, - }, - } - f.Data[key] = result - return result.R, nil -} - -func (f *FakeEtcdClient) Set(key, value string, ttl uint64) (*etcd.Response, error) { - f.Mutex.Lock() - defer f.Mutex.Unlock() - defer f.updateResponse(key) - - return f.setLocked(key, value, ttl) -} - -func (f *FakeEtcdClient) CompareAndSwap(key, value string, ttl uint64, prevValue string, prevIndex uint64) (*etcd.Response, error) { - if f.Err != nil { - f.t.Logf("c&s: returning err %v", f.Err) - return nil, f.Err - } - if f.CasErr != nil { - f.t.Logf("c&s: returning err %v", f.CasErr) - return nil, f.CasErr - } - - if !f.TestIndex { - f.t.Errorf("Enable TestIndex for test involving CompareAndSwap") - return nil, errors.New("Enable TestIndex for test involving CompareAndSwap") - } - - if prevValue == "" && prevIndex == 0 { - return nil, errors.New("Either prevValue or prevIndex must be specified.") - } - - f.Mutex.Lock() - defer f.Mutex.Unlock() - defer f.updateResponse(key) - - if !f.nodeExists(key) { - f.t.Logf("c&s: node doesn't exist") - return nil, EtcdErrorNotFound - } - - prevNode := f.Data[key].R.Node - - if prevValue != "" && prevValue != prevNode.Value { - f.t.Logf("body didn't match") - return nil, EtcdErrorTestFailed - } - - if prevIndex != 0 && prevIndex != prevNode.ModifiedIndex { - f.t.Logf("got index %v but needed %v", prevIndex, prevNode.ModifiedIndex) - return nil, EtcdErrorTestFailed - } - - return f.setLocked(key, value, ttl) -} - -func (f *FakeEtcdClient) Create(key, value string, ttl uint64) (*etcd.Response, error) { - f.Mutex.Lock() - defer f.Mutex.Unlock() - defer f.updateResponse(key) - - if f.nodeExists(key) { - return nil, EtcdErrorNodeExist - } - - return f.setLocked(key, value, ttl) -} - -func (f *FakeEtcdClient) Delete(key string, recursive bool) (*etcd.Response, error) { - if f.Err != nil { - return nil, f.Err - } - - f.Mutex.Lock() - defer f.Mutex.Unlock() - existing, ok := f.Data[key] - if !ok { - return &etcd.Response{}, &etcd.EtcdError{ - ErrorCode: EtcdErrorCodeNotFound, - Index: f.ChangeIndex, - } - } - etcdError, ok := existing.E.(*etcd.EtcdError) - if ok && etcdError != nil && etcdError.ErrorCode == EtcdErrorCodeNotFound { - f.DeletedKeys = append(f.DeletedKeys, key) - return existing.R, existing.E - } - index := f.generateIndex() - f.Data[key] = EtcdResponseWithError{ - R: &etcd.Response{}, - E: &etcd.EtcdError{ - ErrorCode: EtcdErrorCodeNotFound, - Index: index, - }, - } - res := &etcd.Response{ - Action: "delete", - Node: nil, - PrevNode: nil, - EtcdIndex: index, - } - if existing.R != nil && existing.R.Node != nil { - res.PrevNode = existing.R.Node - } - - f.DeletedKeys = append(f.DeletedKeys, key) - return res, nil -} - -func (f *FakeEtcdClient) WaitForWatchCompletion() { - <-f.watchCompletedChan -} - -func (f *FakeEtcdClient) Watch(prefix string, waitIndex uint64, recursive bool, receiver chan *etcd.Response, stop chan bool) (*etcd.Response, error) { - f.Mutex.Lock() - if f.WatchImmediateError != nil { - return nil, f.WatchImmediateError - } - f.WatchResponse = receiver - f.WatchStop = stop - f.WatchIndex = waitIndex - injectedError := make(chan error) - - defer close(injectedError) - f.WatchInjectError = injectedError - - f.Mutex.Unlock() - if receiver == nil { - return f.Get(prefix, false, recursive) - } else { - // Emulate etcd's behavior. (I think.) - defer close(receiver) - } - - f.watchCompletedChan <- true - select { - case <-stop: - return nil, etcd.ErrWatchStoppedByUser - case err := <-injectedError: - return nil, err - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/tools/interfaces.go b/vendor/k8s.io/kubernetes/pkg/tools/interfaces.go deleted file mode 100644 index 02569cb28..000000000 --- a/vendor/k8s.io/kubernetes/pkg/tools/interfaces.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package tools - -import ( - "github.com/coreos/go-etcd/etcd" -) - -const ( - EtcdErrorCodeNotFound = 100 - EtcdErrorCodeTestFailed = 101 - EtcdErrorCodeNodeExist = 105 - EtcdErrorCodeValueRequired = 200 -) - -var ( - EtcdErrorNotFound = &etcd.EtcdError{ErrorCode: EtcdErrorCodeNotFound} - EtcdErrorTestFailed = &etcd.EtcdError{ErrorCode: EtcdErrorCodeTestFailed} - EtcdErrorNodeExist = &etcd.EtcdError{ErrorCode: EtcdErrorCodeNodeExist} - EtcdErrorValueRequired = &etcd.EtcdError{ErrorCode: EtcdErrorCodeValueRequired} -) - -// EtcdClient is an injectable interface for testing. -type EtcdClient interface { - GetCluster() []string - Get(key string, sort, recursive bool) (*etcd.Response, error) - Set(key, value string, ttl uint64) (*etcd.Response, error) - Create(key, value string, ttl uint64) (*etcd.Response, error) - CompareAndSwap(key, value string, ttl uint64, prevValue string, prevIndex uint64) (*etcd.Response, error) - Delete(key string, recursive bool) (*etcd.Response, error) - // I'd like to use directional channels here (e.g. <-chan) but this interface mimics - // the etcd client interface which doesn't, and it doesn't seem worth it to wrap the api. - Watch(prefix string, waitIndex uint64, recursive bool, receiver chan *etcd.Response, stop chan bool) (*etcd.Response, error) -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/atomic_value.go b/vendor/k8s.io/kubernetes/pkg/util/atomic/value.go similarity index 64% rename from vendor/k8s.io/kubernetes/pkg/util/atomic_value.go rename to vendor/k8s.io/kubernetes/pkg/util/atomic/value.go index 546e19d71..a9bc8cd81 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/atomic_value.go +++ b/vendor/k8s.io/kubernetes/pkg/util/atomic/value.go @@ -14,47 +14,29 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package atomic import ( "sync" - "sync/atomic" ) // TODO(ArtfulCoder) // sync/atomic/Value was added in golang 1.4 // Once support is dropped for go 1.3, this type must be deprecated in favor of sync/atomic/Value. // The functions are named Load/Store to match sync/atomic/Value function names. -type AtomicValue struct { +type Value struct { value interface{} valueMutex sync.RWMutex } -func (at *AtomicValue) Store(val interface{}) { +func (at *Value) Store(val interface{}) { at.valueMutex.Lock() defer at.valueMutex.Unlock() at.value = val } -func (at *AtomicValue) Load() interface{} { +func (at *Value) Load() interface{} { at.valueMutex.RLock() defer at.valueMutex.RUnlock() return at.value } - -// HighWaterMark is a thread-safe object for tracking the maximum value seen -// for some quantity. -type HighWaterMark int64 - -// Check returns true if and only if 'current' is the highest value ever seen. -func (hwm *HighWaterMark) Check(current int64) bool { - for { - old := atomic.LoadInt64((*int64)(hwm)) - if current <= old { - return false - } - if atomic.CompareAndSwapInt64((*int64)(hwm), old, current) { - return true - } - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/atomic_value_test.go b/vendor/k8s.io/kubernetes/pkg/util/atomic/value_test.go similarity index 62% rename from vendor/k8s.io/kubernetes/pkg/util/atomic_value_test.go rename to vendor/k8s.io/kubernetes/pkg/util/atomic/value_test.go index d3fb0cad7..052b35082 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/atomic_value_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/atomic/value_test.go @@ -14,16 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package atomic import ( - "math/rand" - "sync" "testing" "time" + + "k8s.io/kubernetes/pkg/util/wait" ) -func ExpectValue(t *testing.T, atomicValue *AtomicValue, expectedValue interface{}) { +func ExpectValue(t *testing.T, atomicValue *Value, expectedValue interface{}) { actualValue := atomicValue.Load() if actualValue != expectedValue { t.Errorf("Expected to find %v, found %v", expectedValue, actualValue) @@ -38,46 +38,15 @@ func ExpectValue(t *testing.T, atomicValue *AtomicValue, expectedValue interface t.Errorf("Expected to find %v, found %v", expectedValue, actualValue) return } - case <-time.After(ForeverTestTimeout): + case <-time.After(wait.ForeverTestTimeout): t.Error("Value could not be read") return } } func TestAtomicValue(t *testing.T) { - atomicValue := &AtomicValue{} + atomicValue := &Value{} ExpectValue(t, atomicValue, nil) atomicValue.Store(10) ExpectValue(t, atomicValue, 10) } - -func TestHighWaterMark(t *testing.T) { - var h HighWaterMark - - for i := int64(10); i < 20; i++ { - if !h.Check(i) { - t.Errorf("unexpected false for %v", i) - } - if h.Check(i - 1) { - t.Errorf("unexpected true for %v", i-1) - } - } - - m := int64(0) - wg := sync.WaitGroup{} - for i := 0; i < 300; i++ { - wg.Add(1) - v := rand.Int63() - go func(v int64) { - defer wg.Done() - h.Check(v) - }(v) - if v > m { - m = v - } - } - wg.Wait() - if m != int64(h) { - t.Errorf("unexpected value, wanted %v, got %v", m, int64(h)) - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/backoff.go b/vendor/k8s.io/kubernetes/pkg/util/backoff.go index 173e13187..0ac526ec9 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/backoff.go +++ b/vendor/k8s.io/kubernetes/pkg/util/backoff.go @@ -17,9 +17,10 @@ limitations under the License. package util import ( - "math" "sync" "time" + + "k8s.io/kubernetes/pkg/util/integer" ) type backoffEntry struct { @@ -65,11 +66,18 @@ func (p *Backoff) Next(id string, eventTime time.Time) { entry = p.initEntryUnsafe(id) } else { delay := entry.backoff * 2 // exponential - entry.backoff = time.Duration(math.Min(float64(delay), float64(p.maxDuration))) + entry.backoff = time.Duration(integer.Int64Min(int64(delay), int64(p.maxDuration))) } entry.lastUpdate = p.Clock.Now() } +// Reset forces clearing of all backoff data for a given key. +func (p *Backoff) Reset(id string) { + p.Lock() + defer p.Unlock() + delete(p.perItemBackoff, id) +} + // Returns True if the elapsed time since eventTime is smaller than the current backoff window func (p *Backoff) IsInBackOffSince(id string, eventTime time.Time) bool { p.Lock() diff --git a/vendor/k8s.io/kubernetes/pkg/util/backoff_test.go b/vendor/k8s.io/kubernetes/pkg/util/backoff_test.go index f2bc97715..d5b744cb3 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/backoff_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/backoff_test.go @@ -32,7 +32,7 @@ func NewFakeBackOff(initial, max time.Duration, tc *FakeClock) *Backoff { func TestSlowBackoff(t *testing.T) { id := "_idSlow" - tc := &FakeClock{Time: time.Now()} + tc := NewFakeClock(time.Now()) step := time.Second maxDuration := 50 * step @@ -46,11 +46,19 @@ func TestSlowBackoff(t *testing.T) { } b.Next(id, tc.Now()) } + + //Now confirm that the Reset cancels backoff. + b.Next(id, tc.Now()) + b.Reset(id) + if b.Get(id) != 0 { + t.Errorf("Reset didn't clear the backoff.") + } + } func TestBackoffReset(t *testing.T) { id := "_idReset" - tc := &FakeClock{Time: time.Now()} + tc := NewFakeClock(time.Now()) step := time.Second maxDuration := step * 5 b := NewFakeBackOff(step, maxDuration, tc) @@ -76,7 +84,7 @@ func TestBackoffReset(t *testing.T) { func TestBackoffHightWaterMark(t *testing.T) { id := "_idHiWaterMark" - tc := &FakeClock{Time: time.Now()} + tc := NewFakeClock(time.Now()) step := time.Second maxDuration := 5 * step b := NewFakeBackOff(step, maxDuration, tc) @@ -98,7 +106,7 @@ func TestBackoffHightWaterMark(t *testing.T) { func TestBackoffGC(t *testing.T) { id := "_idGC" - tc := &FakeClock{Time: time.Now()} + tc := NewFakeClock(time.Now()) step := time.Second maxDuration := 5 * step @@ -126,7 +134,7 @@ func TestBackoffGC(t *testing.T) { func TestIsInBackOffSinceUpdate(t *testing.T) { id := "_idIsInBackOffSinceUpdate" - tc := &FakeClock{Time: time.Now()} + tc := NewFakeClock(time.Now()) step := time.Second maxDuration := 10 * step b := NewFakeBackOff(step, maxDuration, tc) @@ -178,7 +186,7 @@ func TestIsInBackOffSinceUpdate(t *testing.T) { } for _, c := range cases { - tc.Time = startTime.Add(c.tick * step) + tc.SetTime(startTime.Add(c.tick * step)) if c.inBackOff != b.IsInBackOffSinceUpdate(id, tc.Now()) { t.Errorf("expected IsInBackOffSinceUpdate %v got %v at tick %s", c.inBackOff, b.IsInBackOffSinceUpdate(id, tc.Now()), c.tick*step) } diff --git a/vendor/k8s.io/kubernetes/pkg/util/bandwidth/linux.go b/vendor/k8s.io/kubernetes/pkg/util/bandwidth/linux.go index dd45e822b..b5aeaa714 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/bandwidth/linux.go +++ b/vendor/k8s.io/kubernetes/pkg/util/bandwidth/linux.go @@ -224,6 +224,12 @@ func (t *tcShaper) interfaceExists() (bool, string, error) { if len(value) == 0 { return false, "", nil } + // Newer versions of tc and/or the kernel return the following instead of nothing: + // qdisc noqueue 0: root refcnt 2 + fields := strings.Fields(value) + if len(fields) > 1 && fields[1] == "noqueue" { + return false, "", nil + } return true, value, nil } diff --git a/vendor/k8s.io/kubernetes/pkg/util/bandwidth/linux_test.go b/vendor/k8s.io/kubernetes/pkg/util/bandwidth/linux_test.go index f725570ff..b6d2b559c 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/bandwidth/linux_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/bandwidth/linux_test.go @@ -492,11 +492,11 @@ func TestReconcileInterfaceExists(t *testing.T) { } } -func TestReconcileInterfaceDoesntExist(t *testing.T) { +func testReconcileInterfaceHasNoData(t *testing.T, output string) { fcmd := exec.FakeCmd{ CombinedOutputScript: []exec.FakeCombinedOutputAction{ - func() ([]byte, error) { return []byte("\n"), nil }, - func() ([]byte, error) { return []byte("\n"), nil }, + func() ([]byte, error) { return []byte(output), nil }, + func() ([]byte, error) { return []byte(output), nil }, }, } @@ -549,6 +549,16 @@ func TestReconcileInterfaceDoesntExist(t *testing.T) { } } +func TestReconcileInterfaceDoesntExist(t *testing.T) { + testReconcileInterfaceHasNoData(t, "\n") +} + +var tcQdiscNoqueue = "qdisc noqueue 0: root refcnt 2 \n" + +func TestReconcileInterfaceExistsWithNoqueue(t *testing.T) { + testReconcileInterfaceHasNoData(t, tcQdiscNoqueue) +} + var tcQdiscWrong = []string{ "qdisc htb 2: root refcnt 2 r2q 10 default 30 direct_packets_stat 0\n", "qdisc foo 1: root refcnt 2 r2q 10 default 30 direct_packets_stat 0\n", diff --git a/vendor/k8s.io/kubernetes/pkg/util/bool_flag.go b/vendor/k8s.io/kubernetes/pkg/util/bool_flag.go index 410e5ed96..768fc3035 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/bool_flag.go +++ b/vendor/k8s.io/kubernetes/pkg/util/bool_flag.go @@ -22,8 +22,9 @@ import ( ) // BoolFlag is a boolean flag compatible with flags and pflags that keeps track of whether it had a value supplied or not. -// Beware! If you use this type, you must actually specify --flag-name=true, you cannot leave it as --flag-name and still have -// the value set +// Getting this flag to act like a normal bool, where true/false are not required needs a little bit of extra code, example: +// f := cmd.Flags().VarPF(&BoolFlagVar, "flagname", "", "help about the flag") +// f.NoOptDefVal = "true" type BoolFlag struct { // If Set has been invoked this value is true provided bool diff --git a/vendor/k8s.io/kubernetes/pkg/util/chmod/chmod.go b/vendor/k8s.io/kubernetes/pkg/util/chmod/chmod.go new file mode 100644 index 000000000..5b646c95b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/chmod/chmod.go @@ -0,0 +1,39 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package chmod + +import ( + "os" +) + +// Interface is something that knows how to run the chmod system call. +// It is non-recursive. +type Interface interface { + // Chmod changes the mode of the given file, implementing the same + // semantics as os.Chmod. + Chmod(path string, filemode os.FileMode) error +} + +func New() Interface { + return &chmodRunner{} +} + +type chmodRunner struct{} + +func (_ *chmodRunner) Chmod(path string, mode os.FileMode) error { + return os.Chmod(path, mode) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/chmod/doc.go b/vendor/k8s.io/kubernetes/pkg/util/chmod/doc.go new file mode 100644 index 000000000..a230e98fd --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/chmod/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package chown provides an interface and implementations +// for things that run run the chmod system call. +package chmod diff --git a/vendor/k8s.io/kubernetes/pkg/util/chown/chown.go b/vendor/k8s.io/kubernetes/pkg/util/chown/chown.go new file mode 100644 index 000000000..0d90629de --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/chown/chown.go @@ -0,0 +1,39 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package chown + +import ( + "os" +) + +// Interface is something that knows how to run the chown system call. +// It is non-recursive. +type Interface interface { + // Chown changes the owning UID and GID of a file, implementing + // the exact same semantics as os.Chown. + Chown(path string, uid, gid int) error +} + +func New() Interface { + return &chownRunner{} +} + +type chownRunner struct{} + +func (_ *chownRunner) Chown(path string, uid, gid int) error { + return os.Chown(path, uid, gid) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/chown/doc.go b/vendor/k8s.io/kubernetes/pkg/util/chown/doc.go new file mode 100644 index 000000000..3c41f5ed3 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/chown/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package chown provides utilities to chown a path +package chown diff --git a/vendor/k8s.io/kubernetes/pkg/util/clock.go b/vendor/k8s.io/kubernetes/pkg/util/clock.go index ba19b0676..56ea16c69 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/clock.go +++ b/vendor/k8s.io/kubernetes/pkg/util/clock.go @@ -17,6 +17,7 @@ limitations under the License. package util import ( + "sync" "time" ) @@ -25,37 +26,136 @@ import ( type Clock interface { Now() time.Time Since(time.Time) time.Duration + After(d time.Duration) <-chan time.Time } +var ( + _ = Clock(RealClock{}) + _ = Clock(&FakeClock{}) + _ = Clock(&IntervalClock{}) +) + // RealClock really calls time.Now() type RealClock struct{} // Now returns the current time. -func (r RealClock) Now() time.Time { +func (RealClock) Now() time.Time { return time.Now() } // Since returns time since the specified timestamp. -func (r RealClock) Since(ts time.Time) time.Duration { +func (RealClock) Since(ts time.Time) time.Duration { return time.Since(ts) } +// Same as time.After(d). +func (RealClock) After(d time.Duration) <-chan time.Time { + return time.After(d) +} + // FakeClock implements Clock, but returns an arbitrary time. type FakeClock struct { - Time time.Time + lock sync.RWMutex + time time.Time + + // waiters are waiting for the fake time to pass their specified time + waiters []fakeClockWaiter +} + +type fakeClockWaiter struct { + targetTime time.Time + destChan chan<- time.Time +} + +func NewFakeClock(t time.Time) *FakeClock { + return &FakeClock{ + time: t, + } } // Now returns f's time. func (f *FakeClock) Now() time.Time { - return f.Time + f.lock.RLock() + defer f.lock.RUnlock() + return f.time } // Since returns time since the time in f. func (f *FakeClock) Since(ts time.Time) time.Duration { - return f.Time.Sub(ts) + f.lock.RLock() + defer f.lock.RUnlock() + return f.time.Sub(ts) } -// Move clock by Duration -func (f *FakeClock) Step(d time.Duration) { - f.Time = f.Time.Add(d) +// Fake version of time.After(d). +func (f *FakeClock) After(d time.Duration) <-chan time.Time { + f.lock.Lock() + defer f.lock.Unlock() + stopTime := f.time.Add(d) + ch := make(chan time.Time, 1) // Don't block! + f.waiters = append(f.waiters, fakeClockWaiter{ + targetTime: stopTime, + destChan: ch, + }) + return ch +} + +// Move clock by Duration, notify anyone that's called After +func (f *FakeClock) Step(d time.Duration) { + f.lock.Lock() + defer f.lock.Unlock() + f.setTimeLocked(f.time.Add(d)) +} + +// Sets the time. +func (f *FakeClock) SetTime(t time.Time) { + f.lock.Lock() + defer f.lock.Unlock() + f.setTimeLocked(t) +} + +// Actually changes the time and checks any waiters. f must be write-locked. +func (f *FakeClock) setTimeLocked(t time.Time) { + f.time = t + newWaiters := make([]fakeClockWaiter, 0, len(f.waiters)) + for i := range f.waiters { + w := &f.waiters[i] + if !w.targetTime.After(t) { + w.destChan <- t + } else { + newWaiters = append(newWaiters, f.waiters[i]) + } + } + f.waiters = newWaiters +} + +// Returns true if After has been called on f but not yet satisfied (so you can +// write race-free tests). +func (f *FakeClock) HasWaiters() bool { + f.lock.RLock() + defer f.lock.RUnlock() + return len(f.waiters) > 0 +} + +// IntervalClock implements Clock, but each invocation of Now steps the clock forward the specified duration +type IntervalClock struct { + Time time.Time + Duration time.Duration +} + +// Now returns i's time. +func (i *IntervalClock) Now() time.Time { + i.Time = i.Time.Add(i.Duration) + return i.Time +} + +// Since returns time since the time in i. +func (i *IntervalClock) Since(ts time.Time) time.Duration { + return i.Time.Sub(ts) +} + +// Unimplemented, will panic. +// TODO: make interval clock use FakeClock so this can be implemented. +func (*IntervalClock) After(d time.Duration) <-chan time.Time { + panic("IntervalClock doesn't implement After") } diff --git a/vendor/k8s.io/kubernetes/pkg/util/clock_test.go b/vendor/k8s.io/kubernetes/pkg/util/clock_test.go index d3523ffda..db0cce40a 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/clock_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/clock_test.go @@ -23,7 +23,7 @@ import ( func TestFakeClock(t *testing.T) { startTime := time.Now() - tc := &FakeClock{Time: startTime} + tc := NewFakeClock(startTime) tc.Step(time.Second) now := tc.Now() if now.Sub(startTime) != time.Second { @@ -31,8 +31,66 @@ func TestFakeClock(t *testing.T) { } tt := tc.Now() - tc.Time = tt.Add(time.Hour) + tc.SetTime(tt.Add(time.Hour)) if tc.Now().Sub(tt) != time.Hour { t.Errorf("input: %s now=%s gap=%s expected=%s", tt, tc.Now(), tc.Now().Sub(tt), time.Hour) } } + +func TestFakeAfter(t *testing.T) { + tc := NewFakeClock(time.Now()) + if tc.HasWaiters() { + t.Errorf("unexpected waiter?") + } + oneSec := tc.After(time.Second) + if !tc.HasWaiters() { + t.Errorf("unexpected lack of waiter?") + } + + oneOhOneSec := tc.After(time.Second + time.Millisecond) + twoSec := tc.After(2 * time.Second) + select { + case <-oneSec: + t.Errorf("unexpected channel read") + case <-oneOhOneSec: + t.Errorf("unexpected channel read") + case <-twoSec: + t.Errorf("unexpected channel read") + default: + } + + tc.Step(999 * time.Millisecond) + select { + case <-oneSec: + t.Errorf("unexpected channel read") + case <-oneOhOneSec: + t.Errorf("unexpected channel read") + case <-twoSec: + t.Errorf("unexpected channel read") + default: + } + + tc.Step(time.Millisecond) + select { + case <-oneSec: + // Expected! + case <-oneOhOneSec: + t.Errorf("unexpected channel read") + case <-twoSec: + t.Errorf("unexpected channel read") + default: + t.Errorf("unexpected non-channel read") + } + tc.Step(time.Millisecond) + select { + case <-oneSec: + // should not double-trigger! + t.Errorf("unexpected channel read") + case <-oneOhOneSec: + // Expected! + case <-twoSec: + t.Errorf("unexpected channel read") + default: + t.Errorf("unexpected non-channel read") + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/config/config.go b/vendor/k8s.io/kubernetes/pkg/util/config/config.go index 7bb49b383..37f6f6ab1 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/config/config.go +++ b/vendor/k8s.io/kubernetes/pkg/util/config/config.go @@ -19,7 +19,7 @@ package config import ( "sync" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/wait" ) type Merger interface { @@ -74,7 +74,7 @@ func (m *Mux) Channel(source string) chan interface{} { } newChannel := make(chan interface{}) m.sources[source] = newChannel - go util.Until(func() { m.listen(source, newChannel) }, 0, util.NeverStop) + go wait.Until(func() { m.listen(source, newChannel) }, 0, wait.NeverStop) return newChannel } diff --git a/vendor/k8s.io/kubernetes/pkg/util/crlf.go b/vendor/k8s.io/kubernetes/pkg/util/crlf.go new file mode 100644 index 000000000..935785ce9 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/crlf.go @@ -0,0 +1,57 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +import ( + "bytes" + "io" +) + +type crlfWriter struct { + io.Writer +} + +// NewCRLFWriter implements a CR/LF line ending writer used for normalizing +// text for Windows platforms. +func NewCRLFWriter(w io.Writer) io.Writer { + return crlfWriter{w} +} + +func (w crlfWriter) Write(b []byte) (n int, err error) { + for i, written := 0, 0; ; { + next := bytes.Index(b[i:], []byte("\n")) + if next == -1 { + n, err := w.Writer.Write(b[i:]) + return written + n, err + } + next = next + i + n, err := w.Writer.Write(b[i:next]) + if err != nil { + return written + n, err + } + written += n + n, err = w.Writer.Write([]byte("\r\n")) + if err != nil { + if n > 1 { + n = 1 + } + return written + n, err + } + written += 1 + i = next + 1 + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/dbus/dbus.go b/vendor/k8s.io/kubernetes/pkg/util/dbus/dbus.go index 3858aec28..13da1469e 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/dbus/dbus.go +++ b/vendor/k8s.io/kubernetes/pkg/util/dbus/dbus.go @@ -68,7 +68,7 @@ type connImpl struct { // Implements Object as a godbus.Object type objectImpl struct { - object *godbus.Object + object godbus.BusObject } // Implements Call as a godbus.Call diff --git a/vendor/k8s.io/kubernetes/pkg/util/deadlock-detector.go b/vendor/k8s.io/kubernetes/pkg/util/deadlock-detector.go new file mode 100644 index 000000000..b89fb23de --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/deadlock-detector.go @@ -0,0 +1,120 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +import ( + "os" + "sync" + "time" + + "github.com/golang/glog" +) + +type rwMutexToLockableAdapter struct { + rw *sync.RWMutex +} + +func (r *rwMutexToLockableAdapter) Lock() { + r.rw.RLock() +} + +func (r *rwMutexToLockableAdapter) Unlock() { + r.rw.RUnlock() +} + +type deadlockDetector struct { + name string + lock sync.Locker + maxLockPeriod time.Duration + exiter exiter + exitChannelFn func() <-chan time.Time + // Really only useful for testing + stopChannel <-chan bool +} + +// DeadlockWatchdogReadLock creates a watchdog on read/write mutex. If the mutex can not be acquired +// for read access within 'maxLockPeriod', the program exits via glog.Exitf() or os.Exit() if that fails +// 'name' is a semantic name that is useful for the user and is printed on exit. +func DeadlockWatchdogReadLock(lock *sync.RWMutex, name string, maxLockPeriod time.Duration) { + DeadlockWatchdog(&rwMutexToLockableAdapter{lock}, name, maxLockPeriod) +} + +func DeadlockWatchdog(lock sync.Locker, name string, maxLockPeriod time.Duration) { + if maxLockPeriod <= 0 { + panic("maxLockPeriod is <= 0, that can't be what you wanted") + } + detector := &deadlockDetector{ + lock: lock, + name: name, + maxLockPeriod: maxLockPeriod, + exitChannelFn: func() <-chan time.Time { return time.After(maxLockPeriod) }, + stopChannel: make(chan bool), + } + go detector.run() +} + +// Useful for injecting tests +type exiter interface { + Exitf(format string, args ...interface{}) +} + +type realExiter struct{} + +func (realExiter) Exitf(format string, args ...interface{}) { + func() { + defer func() { + // Let's just be extra sure we die, even if Exitf panics + if r := recover(); r != nil { + glog.Errorf(format, args...) + os.Exit(2) + } + }() + glog.Exitf(format, args...) + }() +} + +func (d *deadlockDetector) run() { + for { + if !d.runOnce() { + return + } + time.Sleep(d.maxLockPeriod / 2) + } +} + +func (d *deadlockDetector) runOnce() bool { + ch := make(chan bool, 1) + go func() { + d.lock.Lock() + d.lock.Unlock() + + ch <- true + }() + exitCh := d.exitChannelFn() + select { + case <-exitCh: + d.exiter.Exitf("Deadlock on %s, exiting", d.name) + // return is here for when we use a fake exiter in testing + return false + case <-ch: + glog.V(6).Infof("%s is not deadlocked", d.name) + case <-d.stopChannel: + glog.V(4).Infof("Stopping deadlock detector for %s", d.name) + return false + } + return true +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/deadlock-detector_test.go b/vendor/k8s.io/kubernetes/pkg/util/deadlock-detector_test.go new file mode 100644 index 000000000..51d111245 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/deadlock-detector_test.go @@ -0,0 +1,127 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +import ( + "sync" + "testing" + "time" +) + +type fakeExiter struct { + format string + args []interface{} + exited bool +} + +func (f *fakeExiter) Exitf(format string, args ...interface{}) { + f.format = format + f.args = args + f.exited = true +} + +func TestMaxLockPeriod(t *testing.T) { + lock := &sync.RWMutex{} + panicked := false + func() { + defer func() { + if r := recover(); r != nil { + panicked = true + } + }() + DeadlockWatchdogReadLock(lock, "test lock", 0) + }() + if !panicked { + t.Errorf("expected a panic for a zero max lock period") + } +} + +func TestDeadlockWatchdogLocked(t *testing.T) { + lock := &sync.RWMutex{} + lock.Lock() + + exitCh := make(chan time.Time, 1) + fake := fakeExiter{} + + detector := &deadlockDetector{ + lock: &rwMutexToLockableAdapter{lock}, + name: "test deadlock", + exitChannelFn: func() <-chan time.Time { return exitCh }, + exiter: &fake, + } + + exitCh <- time.Time{} + + detector.run() + + if !fake.exited { + t.Errorf("expected to have exited") + } + + if len(fake.args) != 1 || fake.args[0].(string) != detector.name { + t.Errorf("unexpected args: %v", fake.args) + } +} + +func TestDeadlockWatchdogUnlocked(t *testing.T) { + lock := &sync.RWMutex{} + + fake := fakeExiter{} + + detector := &deadlockDetector{ + lock: &rwMutexToLockableAdapter{lock}, + name: "test deadlock", + exitChannelFn: func() <-chan time.Time { return time.After(time.Second * 5) }, + exiter: &fake, + } + + for i := 0; i < 100; i++ { + detector.runOnce() + } + + if fake.exited { + t.Errorf("expected to have not exited") + } +} + +func TestDeadlockWatchdogLocking(t *testing.T) { + lock := &sync.RWMutex{} + + fake := fakeExiter{} + + go func() { + for { + lock.Lock() + lock.Unlock() + } + }() + + detector := &deadlockDetector{ + lock: &rwMutexToLockableAdapter{lock}, + name: "test deadlock", + exitChannelFn: func() <-chan time.Time { return time.After(time.Second * 5) }, + exiter: &fake, + } + + for i := 0; i < 100; i++ { + detector.runOnce() + } + + if fake.exited { + t.Errorf("expected to have not exited") + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/deployment/deployment.go b/vendor/k8s.io/kubernetes/pkg/util/deployment/deployment.go index 59ca0c95b..b02dcab19 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/deployment/deployment.go +++ b/vendor/k8s.io/kubernetes/pkg/util/deployment/deployment.go @@ -18,136 +18,205 @@ package deployment import ( "fmt" - "hash/adler32" + "strconv" + "time" "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/extensions" - client "k8s.io/kubernetes/pkg/client/unversioned" - "k8s.io/kubernetes/pkg/fields" + clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/labels" - "k8s.io/kubernetes/pkg/util" + labelsutil "k8s.io/kubernetes/pkg/util/labels" + podutil "k8s.io/kubernetes/pkg/util/pod" ) -// Returns the old RCs targetted by the given Deployment. -func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.ReplicationController, error) { +const ( + // The revision annotation of a deployment's replica sets which records its rollout sequence + RevisionAnnotation = "deployment.kubernetes.io/revision" + + // Here are the possible rollback event reasons + RollbackRevisionNotFound = "DeploymentRollbackRevisionNotFound" + RollbackTemplateUnchanged = "DeploymentRollbackTemplateUnchanged" + RollbackDone = "DeploymentRollback" +) + +// GetOldReplicaSets returns the old replica sets targeted by the given Deployment; get PodList and ReplicaSetList from client interface. +// Note that the first set of old replica sets doesn't include the ones with no pods, and the second set of old replica sets include all old replica sets. +func GetOldReplicaSets(deployment extensions.Deployment, c clientset.Interface) ([]*extensions.ReplicaSet, []*extensions.ReplicaSet, error) { + return GetOldReplicaSetsFromLists(deployment, c, + func(namespace string, options api.ListOptions) (*api.PodList, error) { + return c.Core().Pods(namespace).List(options) + }, + func(namespace string, options api.ListOptions) ([]extensions.ReplicaSet, error) { + rsList, err := c.Extensions().ReplicaSets(namespace).List(options) + return rsList.Items, err + }) +} + +// GetOldReplicaSetsFromLists returns two sets of old replica sets targeted by the given Deployment; get PodList and ReplicaSetList with input functions. +// Note that the first set of old replica sets doesn't include the ones with no pods, and the second set of old replica sets include all old replica sets. +func GetOldReplicaSetsFromLists(deployment extensions.Deployment, c clientset.Interface, getPodList func(string, api.ListOptions) (*api.PodList, error), getRSList func(string, api.ListOptions) ([]extensions.ReplicaSet, error)) ([]*extensions.ReplicaSet, []*extensions.ReplicaSet, error) { namespace := deployment.ObjectMeta.Namespace + selector, err := unversioned.LabelSelectorAsSelector(deployment.Spec.Selector) + if err != nil { + return nil, nil, fmt.Errorf("invalid label selector: %v", err) + } + // 1. Find all pods whose labels match deployment.Spec.Selector - podList, err := c.Pods(namespace).List(labels.SelectorFromSet(deployment.Spec.Selector), fields.Everything()) + options := api.ListOptions{LabelSelector: selector} + podList, err := getPodList(namespace, options) if err != nil { - return nil, fmt.Errorf("error listing pods: %v", err) + return nil, nil, fmt.Errorf("error listing pods: %v", err) } - // 2. Find the corresponding RCs for pods in podList. - // TODO: Right now we list all RCs and then filter. We should add an API for this. - oldRCs := map[string]api.ReplicationController{} - rcList, err := c.ReplicationControllers(namespace).List(labels.Everything(), fields.Everything()) + // 2. Find the corresponding replica sets for pods in podList. + // TODO: Right now we list all replica sets and then filter. We should add an API for this. + oldRSs := map[string]extensions.ReplicaSet{} + allOldRSs := map[string]extensions.ReplicaSet{} + rsList, err := getRSList(namespace, options) if err != nil { - return nil, fmt.Errorf("error listing replication controllers: %v", err) + return nil, nil, fmt.Errorf("error listing replica sets: %v", err) } + newRSTemplate := GetNewReplicaSetTemplate(deployment) for _, pod := range podList.Items { podLabelsSelector := labels.Set(pod.ObjectMeta.Labels) - for _, rc := range rcList.Items { - rcLabelsSelector := labels.SelectorFromSet(rc.Spec.Selector) - if rcLabelsSelector.Matches(podLabelsSelector) { - // Filter out RC that has the same pod template spec as the deployment - that is the new RC. - if api.Semantic.DeepEqual(rc.Spec.Template, GetNewRCTemplate(deployment)) { - continue - } - oldRCs[rc.ObjectMeta.Name] = rc + for _, rs := range rsList { + rsLabelsSelector, err := unversioned.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return nil, nil, fmt.Errorf("invalid label selector: %v", err) + } + // Filter out replica set that has the same pod template spec as the deployment - that is the new replica set. + if api.Semantic.DeepEqual(rs.Spec.Template, &newRSTemplate) { + continue + } + allOldRSs[rs.ObjectMeta.Name] = rs + if rsLabelsSelector.Matches(podLabelsSelector) { + oldRSs[rs.ObjectMeta.Name] = rs } } } - requiredRCs := []*api.ReplicationController{} - for _, value := range oldRCs { - requiredRCs = append(requiredRCs, &value) + requiredRSs := []*extensions.ReplicaSet{} + for key := range oldRSs { + value := oldRSs[key] + requiredRSs = append(requiredRSs, &value) } - return requiredRCs, nil + allRSs := []*extensions.ReplicaSet{} + for key := range allOldRSs { + value := allOldRSs[key] + allRSs = append(allRSs, &value) + } + return requiredRSs, allRSs, nil } -// Returns an RC that matches the intent of the given deployment. -// Returns nil if the new RC doesnt exist yet. -func GetNewRC(deployment extensions.Deployment, c client.Interface) (*api.ReplicationController, error) { - namespace := deployment.ObjectMeta.Namespace - rcList, err := c.ReplicationControllers(namespace).List(labels.Everything(), fields.Everything()) - if err != nil { - return nil, fmt.Errorf("error listing replication controllers: %v", err) - } - newRCTemplate := GetNewRCTemplate(deployment) +// GetNewReplicaSet returns a replica set that matches the intent of the given deployment; get ReplicaSetList from client interface. +// Returns nil if the new replica set doesnt exist yet. +func GetNewReplicaSet(deployment extensions.Deployment, c clientset.Interface) (*extensions.ReplicaSet, error) { + return GetNewReplicaSetFromList(deployment, c, + func(namespace string, options api.ListOptions) ([]extensions.ReplicaSet, error) { + rsList, err := c.Extensions().ReplicaSets(namespace).List(options) + return rsList.Items, err + }) +} - for _, rc := range rcList.Items { - if api.Semantic.DeepEqual(rc.Spec.Template, newRCTemplate) { - // This is the new RC. - return &rc, nil +// GetNewReplicaSetFromList returns a replica set that matches the intent of the given deployment; get ReplicaSetList with the input function. +// Returns nil if the new replica set doesnt exist yet. +func GetNewReplicaSetFromList(deployment extensions.Deployment, c clientset.Interface, getRSList func(string, api.ListOptions) ([]extensions.ReplicaSet, error)) (*extensions.ReplicaSet, error) { + namespace := deployment.ObjectMeta.Namespace + selector, err := unversioned.LabelSelectorAsSelector(deployment.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + + rsList, err := getRSList(namespace, api.ListOptions{LabelSelector: selector}) + if err != nil { + return nil, fmt.Errorf("error listing ReplicaSets: %v", err) + } + newRSTemplate := GetNewReplicaSetTemplate(deployment) + + for i := range rsList { + if api.Semantic.DeepEqual(rsList[i].Spec.Template, &newRSTemplate) { + // This is the new ReplicaSet. + return &rsList[i], nil } } - // new RC does not exist. + // new ReplicaSet does not exist. return nil, nil } -// Returns the desired PodTemplateSpec for the new RC corresponding to the given RC. -func GetNewRCTemplate(deployment extensions.Deployment) *api.PodTemplateSpec { - // newRC will have the same template as in deployment spec, plus a unique label in some cases. - newRCTemplate := &api.PodTemplateSpec{ +// Returns the desired PodTemplateSpec for the new ReplicaSet corresponding to the given ReplicaSet. +func GetNewReplicaSetTemplate(deployment extensions.Deployment) api.PodTemplateSpec { + // newRS will have the same template as in deployment spec, plus a unique label in some cases. + newRSTemplate := api.PodTemplateSpec{ ObjectMeta: deployment.Spec.Template.ObjectMeta, Spec: deployment.Spec.Template.Spec, } - newRCTemplate.ObjectMeta.Labels = CloneAndAddLabel( + newRSTemplate.ObjectMeta.Labels = labelsutil.CloneAndAddLabel( deployment.Spec.Template.ObjectMeta.Labels, - deployment.Spec.UniqueLabelKey, - GetPodTemplateSpecHash(newRCTemplate)) - return newRCTemplate + extensions.DefaultDeploymentUniqueLabelKey, + podutil.GetPodTemplateSpecHash(newRSTemplate)) + return newRSTemplate } -// Clones the given map and returns a new map with the given key and value added. -// Returns the given map, if labelKey is empty. -func CloneAndAddLabel(labels map[string]string, labelKey string, labelValue uint32) map[string]string { - if labelKey == "" { - // Dont need to add a label. - return labels - } - // Clone. - newLabels := map[string]string{} - for key, value := range labels { - newLabels[key] = value - } - newLabels[labelKey] = fmt.Sprintf("%d", labelValue) - return newLabels +// SetFromReplicaSetTemplate sets the desired PodTemplateSpec from a replica set template to the given deployment. +func SetFromReplicaSetTemplate(deployment *extensions.Deployment, template api.PodTemplateSpec) *extensions.Deployment { + deployment.Spec.Template.ObjectMeta = template.ObjectMeta + deployment.Spec.Template.Spec = template.Spec + deployment.Spec.Template.ObjectMeta.Labels = labelsutil.CloneAndRemoveLabel( + deployment.Spec.Template.ObjectMeta.Labels, + extensions.DefaultDeploymentUniqueLabelKey) + return deployment } -func GetPodTemplateSpecHash(template *api.PodTemplateSpec) uint32 { - podTemplateSpecHasher := adler32.New() - util.DeepHashObject(podTemplateSpecHasher, template) - return podTemplateSpecHasher.Sum32() -} - -// Returns the sum of Replicas of the given replication controllers. -func GetReplicaCountForRCs(replicationControllers []*api.ReplicationController) int { +// Returns the sum of Replicas of the given replica sets. +func GetReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int { totalReplicaCount := 0 - for _, rc := range replicationControllers { - totalReplicaCount += rc.Spec.Replicas + for _, rs := range replicaSets { + totalReplicaCount += rs.Spec.Replicas } return totalReplicaCount } -// Returns the number of available pods corresponding to the given RCs. -func GetAvailablePodsForRCs(c client.Interface, rcs []*api.ReplicationController) (int, error) { - // TODO: Use MinReadySeconds once https://github.com/kubernetes/kubernetes/pull/12894 is merged. - allPods, err := getPodsForRCs(c, rcs) +// Returns the number of available pods corresponding to the given replica sets. +func GetAvailablePodsForReplicaSets(c clientset.Interface, rss []*extensions.ReplicaSet, minReadySeconds int) (int, error) { + allPods, err := getPodsForReplicaSets(c, rss) if err != nil { return 0, err } - readyPodCount := 0 - for _, pod := range allPods { - if api.IsPodReady(&pod) { - readyPodCount++ - } - } - return readyPodCount, nil + return getReadyPodsCount(allPods, minReadySeconds), nil } -func getPodsForRCs(c client.Interface, replicationControllers []*api.ReplicationController) ([]api.Pod, error) { +func getReadyPodsCount(pods []api.Pod, minReadySeconds int) int { + readyPodCount := 0 + for _, pod := range pods { + if api.IsPodReady(&pod) { + // Check if we've passed minReadySeconds since LastTransitionTime + // If so, this pod is ready + for _, c := range pod.Status.Conditions { + // we only care about pod ready conditions + if c.Type == api.PodReady { + // 2 cases that this ready condition is valid (passed minReadySeconds, i.e. the pod is ready): + // 1. minReadySeconds <= 0 + // 2. LastTransitionTime (is set) + minReadySeconds (>0) < current time + minReadySecondsDuration := time.Duration(minReadySeconds) * time.Second + if minReadySeconds <= 0 || !c.LastTransitionTime.IsZero() && c.LastTransitionTime.Add(minReadySecondsDuration).Before(time.Now()) { + readyPodCount++ + break + } + } + } + } + } + return readyPodCount +} + +func getPodsForReplicaSets(c clientset.Interface, replicaSets []*extensions.ReplicaSet) ([]api.Pod, error) { allPods := []api.Pod{} - for _, rc := range replicationControllers { - podList, err := c.Pods(rc.ObjectMeta.Namespace).List(labels.SelectorFromSet(rc.Spec.Selector), fields.Everything()) + for _, rs := range replicaSets { + selector, err := unversioned.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + options := api.ListOptions{LabelSelector: selector} + podList, err := c.Core().Pods(rs.ObjectMeta.Namespace).List(options) if err != nil { return allPods, fmt.Errorf("error listing pods: %v", err) } @@ -155,3 +224,12 @@ func getPodsForRCs(c client.Interface, replicationControllers []*api.Replication } return allPods, nil } + +// Revision returns the revision number of the input replica set +func Revision(rs *extensions.ReplicaSet) (int64, error) { + v, ok := rs.Annotations[RevisionAnnotation] + if !ok { + return 0, nil + } + return strconv.ParseInt(v, 10, 64) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/deployment/deployment_test.go b/vendor/k8s.io/kubernetes/pkg/util/deployment/deployment_test.go new file mode 100644 index 000000000..8d7317e41 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/deployment/deployment_test.go @@ -0,0 +1,344 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package deployment + +import ( + "reflect" + "testing" + "time" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/testapi" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/apis/extensions" + "k8s.io/kubernetes/pkg/client/testing/fake" + "k8s.io/kubernetes/pkg/client/unversioned/testclient/simple" + "k8s.io/kubernetes/pkg/runtime" +) + +func newPod(now time.Time, ready bool, beforeSec int) api.Pod { + conditionStatus := api.ConditionFalse + if ready { + conditionStatus = api.ConditionTrue + } + return api.Pod{ + Status: api.PodStatus{ + Conditions: []api.PodCondition{ + { + Type: api.PodReady, + LastTransitionTime: unversioned.NewTime(now.Add(-1 * time.Duration(beforeSec) * time.Second)), + Status: conditionStatus, + }, + }, + }, + } +} + +func TestGetReadyPodsCount(t *testing.T) { + now := time.Now() + tests := []struct { + pods []api.Pod + minReadySeconds int + expected int + }{ + { + []api.Pod{ + newPod(now, true, 0), + newPod(now, true, 2), + newPod(now, false, 1), + }, + 1, + 1, + }, + { + []api.Pod{ + newPod(now, true, 2), + newPod(now, true, 11), + newPod(now, true, 5), + }, + 10, + 1, + }, + } + + for _, test := range tests { + if count := getReadyPodsCount(test.pods, test.minReadySeconds); count != test.expected { + t.Errorf("Pods = %#v, minReadySeconds = %d, expected %d, got %d", test.pods, test.minReadySeconds, test.expected, count) + } + } +} + +// generatePodFromRS creates a pod, with the input ReplicaSet's selector and its template +func generatePodFromRS(rs extensions.ReplicaSet) api.Pod { + return api.Pod{ + ObjectMeta: api.ObjectMeta{ + Labels: rs.Labels, + }, + Spec: rs.Spec.Template.Spec, + } +} + +func generatePod(labels map[string]string, image string) api.Pod { + return api.Pod{ + ObjectMeta: api.ObjectMeta{ + Labels: labels, + }, + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Name: image, + Image: image, + ImagePullPolicy: api.PullAlways, + TerminationMessagePath: api.TerminationMessagePathDefault, + }, + }, + }, + } +} + +func generateRSWithLabel(labels map[string]string, image string) extensions.ReplicaSet { + return extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{ + Name: api.SimpleNameGenerator.GenerateName("replicaset"), + Labels: labels, + }, + Spec: extensions.ReplicaSetSpec{ + Replicas: 1, + Selector: &unversioned.LabelSelector{MatchLabels: labels}, + Template: &api.PodTemplateSpec{ + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Name: image, + Image: image, + ImagePullPolicy: api.PullAlways, + TerminationMessagePath: api.TerminationMessagePathDefault, + }, + }, + }, + }, + }, + } +} + +// generateRS creates a replica set, with the input deployment's template as its template +func generateRS(deployment extensions.Deployment) extensions.ReplicaSet { + template := GetNewReplicaSetTemplate(deployment) + return extensions.ReplicaSet{ + ObjectMeta: api.ObjectMeta{ + Name: api.SimpleNameGenerator.GenerateName("replicaset"), + Labels: template.Labels, + }, + Spec: extensions.ReplicaSetSpec{ + Template: &template, + Selector: &unversioned.LabelSelector{MatchLabels: template.Labels}, + }, + } +} + +// generateDeployment creates a deployment, with the input image as its template +func generateDeployment(image string) extensions.Deployment { + podLabels := map[string]string{"name": image} + terminationSec := int64(30) + return extensions.Deployment{ + ObjectMeta: api.ObjectMeta{ + Name: image, + }, + Spec: extensions.DeploymentSpec{ + Replicas: 1, + Selector: &unversioned.LabelSelector{MatchLabels: podLabels}, + Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Labels: podLabels, + }, + Spec: api.PodSpec{ + Containers: []api.Container{ + { + Name: image, + Image: image, + ImagePullPolicy: api.PullAlways, + TerminationMessagePath: api.TerminationMessagePathDefault, + }, + }, + DNSPolicy: api.DNSClusterFirst, + TerminationGracePeriodSeconds: &terminationSec, + RestartPolicy: api.RestartPolicyAlways, + SecurityContext: &api.PodSecurityContext{}, + }, + }, + }, + } +} + +func TestGetNewRC(t *testing.T) { + newDeployment := generateDeployment("nginx") + newRC := generateRS(newDeployment) + + tests := []struct { + test string + rsList extensions.ReplicaSetList + expected *extensions.ReplicaSet + }{ + { + "No new ReplicaSet", + extensions.ReplicaSetList{ + Items: []extensions.ReplicaSet{ + generateRS(generateDeployment("foo")), + generateRS(generateDeployment("bar")), + }, + }, + nil, + }, + { + "Has new ReplicaSet", + extensions.ReplicaSetList{ + Items: []extensions.ReplicaSet{ + generateRS(generateDeployment("foo")), + generateRS(generateDeployment("bar")), + generateRS(generateDeployment("abc")), + newRC, + generateRS(generateDeployment("xyz")), + }, + }, + &newRC, + }, + } + + ns := api.NamespaceDefault + for _, test := range tests { + c := &simple.Client{ + Request: simple.Request{ + Method: "GET", + Path: testapi.Default.ResourcePath("replicaSets", ns, ""), + }, + Response: simple.Response{ + StatusCode: 200, + Body: &test.rsList, + }, + } + rs, err := GetNewReplicaSet(newDeployment, c.Setup(t).Clientset) + if err != nil { + t.Errorf("In test case %s, got unexpected error %v", test.test, err) + } + if !api.Semantic.DeepEqual(rs, test.expected) { + t.Errorf("In test case %s, expected %+v, got %+v", test.test, test.expected, rs) + } + } +} + +func TestGetOldRCs(t *testing.T) { + newDeployment := generateDeployment("nginx") + newRS := generateRS(newDeployment) + newPod := generatePodFromRS(newRS) + + // create 2 old deployments and related replica sets/pods, with the same labels but different template + oldDeployment := generateDeployment("nginx") + oldDeployment.Spec.Template.Spec.Containers[0].Name = "nginx-old-1" + oldRS := generateRS(oldDeployment) + oldPod := generatePodFromRS(oldRS) + oldDeployment2 := generateDeployment("nginx") + oldDeployment2.Spec.Template.Spec.Containers[0].Name = "nginx-old-2" + oldRS2 := generateRS(oldDeployment2) + oldPod2 := generatePodFromRS(oldRS2) + + // create 1 ReplicaSet that existed before the deployment, with the same labels as the deployment + existedPod := generatePod(newDeployment.Spec.Template.Labels, "foo") + existedRS := generateRSWithLabel(newDeployment.Spec.Template.Labels, "foo") + + tests := []struct { + test string + objs []runtime.Object + expected []*extensions.ReplicaSet + }{ + { + "No old ReplicaSets", + []runtime.Object{ + &api.PodList{ + Items: []api.Pod{ + generatePod(newDeployment.Spec.Template.Labels, "foo"), + generatePod(newDeployment.Spec.Template.Labels, "bar"), + newPod, + }, + }, + &extensions.ReplicaSetList{ + Items: []extensions.ReplicaSet{ + generateRS(generateDeployment("foo")), + newRS, + generateRS(generateDeployment("bar")), + }, + }, + }, + []*extensions.ReplicaSet{}, + }, + { + "Has old ReplicaSet", + []runtime.Object{ + &api.PodList{ + Items: []api.Pod{ + oldPod, + oldPod2, + generatePod(map[string]string{"name": "bar"}, "bar"), + generatePod(map[string]string{"name": "xyz"}, "xyz"), + existedPod, + generatePod(newDeployment.Spec.Template.Labels, "abc"), + }, + }, + &extensions.ReplicaSetList{ + Items: []extensions.ReplicaSet{ + oldRS2, + oldRS, + existedRS, + newRS, + generateRSWithLabel(map[string]string{"name": "xyz"}, "xyz"), + generateRSWithLabel(map[string]string{"name": "bar"}, "bar"), + }, + }, + }, + []*extensions.ReplicaSet{&oldRS, &oldRS2, &existedRS}, + }, + } + + for _, test := range tests { + rss, _, err := GetOldReplicaSets(newDeployment, fake.NewSimpleClientset(test.objs...)) + if err != nil { + t.Errorf("In test case %s, got unexpected error %v", test.test, err) + } + if !equal(rss, test.expected) { + t.Errorf("In test case %q, expected %v, got %v", test.test, test.expected, rss) + } + } +} + +// equal compares the equality of two ReplicaSet slices regardless of their ordering +func equal(rss1, rss2 []*extensions.ReplicaSet) bool { + if reflect.DeepEqual(rss1, rss2) { + return true + } + if rss1 == nil || rss2 == nil || len(rss1) != len(rss2) { + return false + } + count := 0 + for _, rs1 := range rss1 { + for _, rs2 := range rss2 { + if reflect.DeepEqual(rs1, rs2) { + count++ + break + } + } + } + return count == len(rss1) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/env.go b/vendor/k8s.io/kubernetes/pkg/util/env.go new file mode 100644 index 000000000..6a479bd94 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/env.go @@ -0,0 +1,51 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +import ( + "os" + "strconv" +) + +func GetEnvAsStringOrFallback(key, defaultValue string) string { + if v := os.Getenv(key); v != "" { + return v + } + return defaultValue +} + +func GetEnvAsIntOrFallback(key string, defaultValue int) (int, error) { + if v := os.Getenv(key); v != "" { + value, err := strconv.Atoi(v) + if err != nil { + return defaultValue, err + } + return value, nil + } + return defaultValue, nil +} + +func GetEnvAsFloat64OrFallback(key string, defaultValue float64) (float64, error) { + if v := os.Getenv(key); v != "" { + value, err := strconv.ParseFloat(v, 64) + if err != nil { + return defaultValue, err + } + return value, nil + } + return defaultValue, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/env_test.go b/vendor/k8s.io/kubernetes/pkg/util/env_test.go new file mode 100644 index 000000000..a640fbe2a --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/env_test.go @@ -0,0 +1,68 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +import ( + "os" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestGetEnvAsStringOrFallback(t *testing.T) { + const expected = "foo" + + assert := assert.New(t) + + key := "FLOCKER_SET_VAR" + os.Setenv(key, expected) + assert.Equal(expected, GetEnvAsStringOrFallback(key, "~"+expected)) + + key = "FLOCKER_UNSET_VAR" + assert.Equal(expected, GetEnvAsStringOrFallback(key, expected)) +} + +func TestGetEnvAsIntOrFallback(t *testing.T) { + const expected = 1 + + assert := assert.New(t) + + key := "FLOCKER_SET_VAR" + os.Setenv(key, strconv.Itoa(expected)) + returnVal, _ := GetEnvAsIntOrFallback(key, 1) + assert.Equal(expected, returnVal) + + key = "FLOCKER_UNSET_VAR" + returnVal, _ = GetEnvAsIntOrFallback(key, expected) + assert.Equal(expected, returnVal) +} + +func TestGetEnvAsFloat64OrFallback(t *testing.T) { + const expected = 1.0 + + assert := assert.New(t) + + key := "FLOCKER_SET_VAR" + os.Setenv(key, "1.0") + returnVal, _ := GetEnvAsFloat64OrFallback(key, 2.0) + assert.Equal(expected, returnVal) + + key = "FLOCKER_UNSET_VAR" + returnVal, _ = GetEnvAsFloat64OrFallback(key, 1.0) + assert.Equal(expected, returnVal) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/exec/exec.go b/vendor/k8s.io/kubernetes/pkg/util/exec/exec.go index 7a2eda26b..80444a9d8 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/exec/exec.go +++ b/vendor/k8s.io/kubernetes/pkg/util/exec/exec.go @@ -21,6 +21,9 @@ import ( "syscall" ) +// ErrExecutableNotFound is returned if the executable is not found. +var ErrExecutableNotFound = osexec.ErrNotFound + // Interface is an interface that presents a subset of the os/exec API. Use this // when you want to inject fakeable/mockable exec behavior. type Interface interface { @@ -39,6 +42,8 @@ type Cmd interface { // CombinedOutput runs the command and returns its combined standard output // and standard error. This follows the pattern of package os/exec. CombinedOutput() ([]byte, error) + // Output runs the command and returns standard output, but not standard err + Output() ([]byte, error) SetDir(dir string) } @@ -81,17 +86,33 @@ func (cmd *cmdWrapper) SetDir(dir string) { func (cmd *cmdWrapper) CombinedOutput() ([]byte, error) { out, err := (*osexec.Cmd)(cmd).CombinedOutput() if err != nil { - ee, ok := err.(*osexec.ExitError) - if !ok { - return out, err - } - // Force a compile fail if exitErrorWrapper can't convert to ExitError. - var x ExitError = &exitErrorWrapper{ee} - return out, x + return out, handleError(err) } return out, nil } +func (cmd *cmdWrapper) Output() ([]byte, error) { + out, err := (*osexec.Cmd)(cmd).Output() + if err != nil { + return out, handleError(err) + } + return out, nil +} + +func handleError(err error) error { + if ee, ok := err.(*osexec.ExitError); ok { + // Force a compile fail if exitErrorWrapper can't convert to ExitError. + var x ExitError = &exitErrorWrapper{ee} + return x + } + if ee, ok := err.(*osexec.Error); ok { + if ee.Err == osexec.ErrNotFound { + return ErrExecutableNotFound + } + } + return err +} + // exitErrorWrapper is an implementation of ExitError in terms of os/exec ExitError. // Note: standard exec.ExitError is type *os.ProcessState, which already implements Exited(). type exitErrorWrapper struct { diff --git a/vendor/k8s.io/kubernetes/pkg/util/exec/exec_test.go b/vendor/k8s.io/kubernetes/pkg/util/exec/exec_test.go index 49a432b36..d24f9cc19 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/exec/exec_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/exec/exec_test.go @@ -92,3 +92,12 @@ func TestLookPath(t *testing.T) { t.Errorf("unexpected result for LookPath: got %s, expected %s", sh, shExpected) } } + +func TestExecutableNotFound(t *testing.T) { + exec := New() + cmd := exec.Command("fake_executable_name") + _, err := cmd.CombinedOutput() + if err != ErrExecutableNotFound { + t.Errorf("Expected error ErrExecutableNotFound but got %v", err) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/exec/fake_exec.go b/vendor/k8s.io/kubernetes/pkg/util/exec/fake_exec.go index e69ed55d8..40df52921 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/exec/fake_exec.go +++ b/vendor/k8s.io/kubernetes/pkg/util/exec/fake_exec.go @@ -31,7 +31,7 @@ type FakeCommandAction func(cmd string, args ...string) Cmd func (fake *FakeExec) Command(cmd string, args ...string) Cmd { if fake.CommandCalls > len(fake.CommandScript)-1 { - panic("ran out of Command() actions") + panic(fmt.Sprintf("ran out of Command() actions. Could not handle command [%d]: %s args: %v", fake.CommandCalls, cmd, args)) } i := fake.CommandCalls fake.CommandCalls++ @@ -75,6 +75,10 @@ func (fake *FakeCmd) CombinedOutput() ([]byte, error) { return fake.CombinedOutputScript[i]() } +func (fake *FakeCmd) Output() ([]byte, error) { + return nil, fmt.Errorf("unimplemented") +} + // A simple fake ExitError type. type FakeExitError struct { Status int diff --git a/vendor/k8s.io/kubernetes/pkg/util/fielderrors/fielderrors.go b/vendor/k8s.io/kubernetes/pkg/util/fielderrors/fielderrors.go deleted file mode 100644 index aa2e022b3..000000000 --- a/vendor/k8s.io/kubernetes/pkg/util/fielderrors/fielderrors.go +++ /dev/null @@ -1,207 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fielderrors - -import ( - "fmt" - "strings" - - utilerrors "k8s.io/kubernetes/pkg/util/errors" - - "github.com/davecgh/go-spew/spew" -) - -// ValidationErrorType is a machine readable value providing more detail about why -// a field is invalid. These values are expected to match 1-1 with -// CauseType in api/types.go. -type ValidationErrorType string - -// TODO: These values are duplicated in api/types.go, but there's a circular dep. Fix it. -const ( - // ValidationErrorTypeNotFound is used to report failure to find a requested value - // (e.g. looking up an ID). - ValidationErrorTypeNotFound ValidationErrorType = "FieldValueNotFound" - // ValidationErrorTypeRequired is used to report required values that are not - // provided (e.g. empty strings, null values, or empty arrays). - ValidationErrorTypeRequired ValidationErrorType = "FieldValueRequired" - // ValidationErrorTypeDuplicate is used to report collisions of values that must be - // unique (e.g. unique IDs). - ValidationErrorTypeDuplicate ValidationErrorType = "FieldValueDuplicate" - // ValidationErrorTypeInvalid is used to report malformed values (e.g. failed regex - // match). - ValidationErrorTypeInvalid ValidationErrorType = "FieldValueInvalid" - // ValidationErrorTypeNotSupported is used to report valid (as per formatting rules) - // values that can not be handled (e.g. an enumerated string). - ValidationErrorTypeNotSupported ValidationErrorType = "FieldValueNotSupported" - // ValidationErrorTypeForbidden is used to report valid (as per formatting rules) - // values which would be accepted by some api instances, but which would invoke behavior - // not permitted by this api instance (such as due to stricter security policy). - ValidationErrorTypeForbidden ValidationErrorType = "FieldValueForbidden" - // ValidationErrorTypeTooLong is used to report that given value is too long. - ValidationErrorTypeTooLong ValidationErrorType = "FieldValueTooLong" -) - -// String converts a ValidationErrorType into its corresponding error message. -func (t ValidationErrorType) String() string { - switch t { - case ValidationErrorTypeNotFound: - return "not found" - case ValidationErrorTypeRequired: - return "required value" - case ValidationErrorTypeDuplicate: - return "duplicate value" - case ValidationErrorTypeInvalid: - return "invalid value" - case ValidationErrorTypeNotSupported: - return "unsupported value" - case ValidationErrorTypeForbidden: - return "forbidden" - case ValidationErrorTypeTooLong: - return "too long" - default: - panic(fmt.Sprintf("unrecognized validation type: %#v", t)) - return "" - } -} - -// ValidationError is an implementation of the 'error' interface, which represents an error of validation. -type ValidationError struct { - Type ValidationErrorType - Field string - BadValue interface{} - Detail string -} - -var _ error = &ValidationError{} - -func (v *ValidationError) Error() string { - return fmt.Sprintf("%s: %s", v.Field, v.ErrorBody()) -} - -func (v *ValidationError) ErrorBody() string { - var s string - switch v.Type { - case ValidationErrorTypeRequired, ValidationErrorTypeTooLong: - s = spew.Sprintf("%s", v.Type) - default: - s = spew.Sprintf("%s '%+v'", v.Type, v.BadValue) - } - if len(v.Detail) != 0 { - s += fmt.Sprintf(", Details: %s", v.Detail) - } - return s -} - -// NewFieldRequired returns a *ValidationError indicating "value required" -func NewFieldRequired(field string) *ValidationError { - return &ValidationError{ValidationErrorTypeRequired, field, "", ""} -} - -// NewFieldInvalid returns a *ValidationError indicating "invalid value" -func NewFieldInvalid(field string, value interface{}, detail string) *ValidationError { - return &ValidationError{ValidationErrorTypeInvalid, field, value, detail} -} - -// NewFieldValueNotSupported returns a *ValidationError indicating "unsupported value" -func NewFieldValueNotSupported(field string, value interface{}, validValues []string) *ValidationError { - detail := "" - if validValues != nil && len(validValues) > 0 { - detail = "supported values: " + strings.Join(validValues, ", ") - } - return &ValidationError{ValidationErrorTypeNotSupported, field, value, detail} -} - -// NewFieldForbidden returns a *ValidationError indicating "forbidden" -func NewFieldForbidden(field string, value interface{}) *ValidationError { - return &ValidationError{ValidationErrorTypeForbidden, field, value, ""} -} - -// NewFieldDuplicate returns a *ValidationError indicating "duplicate value" -func NewFieldDuplicate(field string, value interface{}) *ValidationError { - return &ValidationError{ValidationErrorTypeDuplicate, field, value, ""} -} - -// NewFieldNotFound returns a *ValidationError indicating "value not found" -func NewFieldNotFound(field string, value interface{}) *ValidationError { - return &ValidationError{ValidationErrorTypeNotFound, field, value, ""} -} - -func NewFieldTooLong(field string, value interface{}, maxLength int) *ValidationError { - return &ValidationError{ValidationErrorTypeTooLong, field, value, fmt.Sprintf("must have at most %d characters", maxLength)} -} - -type ValidationErrorList []error - -// Prefix adds a prefix to the Field of every ValidationError in the list. -// Returns the list for convenience. -func (list ValidationErrorList) Prefix(prefix string) ValidationErrorList { - for i := range list { - if err, ok := list[i].(*ValidationError); ok { - if strings.HasPrefix(err.Field, "[") { - err.Field = prefix + err.Field - } else if len(err.Field) != 0 { - err.Field = prefix + "." + err.Field - } else { - err.Field = prefix - } - list[i] = err - } else { - panic(fmt.Sprintf("Programmer error: ValidationErrorList holds non-ValidationError: %#v", list[i])) - } - } - return list -} - -// PrefixIndex adds an index to the Field of every ValidationError in the list. -// Returns the list for convenience. -func (list ValidationErrorList) PrefixIndex(index int) ValidationErrorList { - return list.Prefix(fmt.Sprintf("[%d]", index)) -} - -// NewValidationErrorFieldPrefixMatcher returns an errors.Matcher that returns true -// if the provided error is a ValidationError and has the provided ValidationErrorType. -func NewValidationErrorTypeMatcher(t ValidationErrorType) utilerrors.Matcher { - return func(err error) bool { - if e, ok := err.(*ValidationError); ok { - return e.Type == t - } - return false - } -} - -// NewValidationErrorFieldPrefixMatcher returns an errors.Matcher that returns true -// if the provided error is a ValidationError and has a field with the provided -// prefix. -func NewValidationErrorFieldPrefixMatcher(prefix string) utilerrors.Matcher { - return func(err error) bool { - if e, ok := err.(*ValidationError); ok { - return strings.HasPrefix(e.Field, prefix) - } - return false - } -} - -// Filter removes items from the ValidationErrorList that match the provided fns. -func (list ValidationErrorList) Filter(fns ...utilerrors.Matcher) ValidationErrorList { - err := utilerrors.FilterOut(utilerrors.NewAggregate(list), fns...) - if err == nil { - return nil - } - // FilterOut that takes an Aggregate returns an Aggregate - agg := err.(utilerrors.Aggregate) - return ValidationErrorList(agg.Errors()) -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/fielderrors/fielderrors_test.go b/vendor/k8s.io/kubernetes/pkg/util/fielderrors/fielderrors_test.go deleted file mode 100644 index b77c641c2..000000000 --- a/vendor/k8s.io/kubernetes/pkg/util/fielderrors/fielderrors_test.go +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fielderrors - -import ( - "strings" - "testing" -) - -func TestMakeFuncs(t *testing.T) { - testCases := []struct { - fn func() *ValidationError - expected ValidationErrorType - }{ - { - func() *ValidationError { return NewFieldInvalid("f", "v", "d") }, - ValidationErrorTypeInvalid, - }, - { - func() *ValidationError { return NewFieldValueNotSupported("f", "v", nil) }, - ValidationErrorTypeNotSupported, - }, - { - func() *ValidationError { return NewFieldDuplicate("f", "v") }, - ValidationErrorTypeDuplicate, - }, - { - func() *ValidationError { return NewFieldNotFound("f", "v") }, - ValidationErrorTypeNotFound, - }, - { - func() *ValidationError { return NewFieldRequired("f") }, - ValidationErrorTypeRequired, - }, - } - - for _, testCase := range testCases { - err := testCase.fn() - if err.Type != testCase.expected { - t.Errorf("expected Type %q, got %q", testCase.expected, err.Type) - } - } -} - -func TestValidationErrorUsefulMessage(t *testing.T) { - s := NewFieldInvalid("foo", "bar", "deet").Error() - t.Logf("message: %v", s) - for _, part := range []string{"foo", "bar", "deet", ValidationErrorTypeInvalid.String()} { - if !strings.Contains(s, part) { - t.Errorf("error message did not contain expected part '%v'", part) - } - } - - type complicated struct { - Baz int - Qux string - Inner interface{} - KV map[string]int - } - s = NewFieldInvalid( - "foo", - &complicated{ - Baz: 1, - Qux: "aoeu", - Inner: &complicated{Qux: "asdf"}, - KV: map[string]int{"Billy": 2}, - }, - "detail", - ).Error() - t.Logf("message: %v", s) - for _, part := range []string{ - "foo", ValidationErrorTypeInvalid.String(), - "Baz", "Qux", "Inner", "KV", "detail", - "1", "aoeu", "asdf", "Billy", "2", - } { - if !strings.Contains(s, part) { - t.Errorf("error message did not contain expected part '%v'", part) - } - } -} - -func TestErrListFilter(t *testing.T) { - list := ValidationErrorList{ - NewFieldInvalid("test.field", "", ""), - NewFieldInvalid("field.test", "", ""), - NewFieldDuplicate("test", "value"), - } - if len(list.Filter(NewValidationErrorTypeMatcher(ValidationErrorTypeDuplicate))) != 2 { - t.Errorf("should not filter") - } - if len(list.Filter(NewValidationErrorTypeMatcher(ValidationErrorTypeInvalid))) != 1 { - t.Errorf("should filter") - } - if len(list.Filter(NewValidationErrorFieldPrefixMatcher("test"))) != 1 { - t.Errorf("should filter") - } - if len(list.Filter(NewValidationErrorFieldPrefixMatcher("test."))) != 2 { - t.Errorf("should filter") - } - if len(list.Filter(NewValidationErrorFieldPrefixMatcher(""))) != 0 { - t.Errorf("should filter") - } - if len(list.Filter(NewValidationErrorFieldPrefixMatcher("field."), NewValidationErrorTypeMatcher(ValidationErrorTypeDuplicate))) != 1 { - t.Errorf("should filter") - } -} - -func TestErrListPrefix(t *testing.T) { - testCases := []struct { - Err *ValidationError - Expected string - }{ - { - NewFieldNotFound("[0].bar", "value"), - "foo[0].bar", - }, - { - NewFieldInvalid("field", "value", ""), - "foo.field", - }, - { - NewFieldDuplicate("", "value"), - "foo", - }, - } - for _, testCase := range testCases { - errList := ValidationErrorList{testCase.Err} - prefix := errList.Prefix("foo") - if prefix == nil || len(prefix) != len(errList) { - t.Errorf("Prefix should return self") - } - if e, a := testCase.Expected, errList[0].(*ValidationError).Field; e != a { - t.Errorf("expected %s, got %s", e, a) - } - } -} - -func TestErrListPrefixIndex(t *testing.T) { - testCases := []struct { - Err *ValidationError - Expected string - }{ - { - NewFieldNotFound("[0].bar", "value"), - "[1][0].bar", - }, - { - NewFieldInvalid("field", "value", ""), - "[1].field", - }, - { - NewFieldDuplicate("", "value"), - "[1]", - }, - } - for _, testCase := range testCases { - errList := ValidationErrorList{testCase.Err} - prefix := errList.PrefixIndex(1) - if prefix == nil || len(prefix) != len(errList) { - t.Errorf("PrefixIndex should return self") - } - if e, a := testCase.Expected, errList[0].(*ValidationError).Field; e != a { - t.Errorf("expected %s, got %s", e, a) - } - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/flock/flock_other.go b/vendor/k8s.io/kubernetes/pkg/util/flock/flock_other.go new file mode 100644 index 000000000..b80981882 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/flock/flock_other.go @@ -0,0 +1,24 @@ +// +build !linux,!darwin,!freebsd,!openbsd,!netbsd,!dragonfly + +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package flock + +// Acquire is not implemented on non-unix systems. +func Acquire(path string) error { + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/flock/flock_unix.go b/vendor/k8s.io/kubernetes/pkg/util/flock/flock_unix.go new file mode 100644 index 000000000..88ca8d700 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/flock/flock_unix.go @@ -0,0 +1,51 @@ +// +build linux darwin freebsd openbsd netbsd dragonfly + +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package flock + +import ( + "os" + "sync" + + "golang.org/x/sys/unix" +) + +var ( + // lock guards lockfile. Assignment is not atomic. + lock sync.Mutex + // os.File has a runtime.Finalizer so the fd will be closed if the struct + // is garbage collected. Let's hold onto a reference so that doesn't happen. + lockfile *os.File +) + +// Acquire acquires a lock on a file for the duration of the process. This method +// is reentrant. +func Acquire(path string) error { + lock.Lock() + defer lock.Unlock() + var err error + if lockfile, err = os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0600); err != nil { + return err + } + + opts := unix.Flock_t{Type: unix.F_WRLCK} + if err := unix.FcntlFlock(lockfile.Fd(), unix.F_SETLKW, &opts); err != nil { + return err + } + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/hash.go b/vendor/k8s.io/kubernetes/pkg/util/hash/hash.go similarity index 98% rename from vendor/k8s.io/kubernetes/pkg/util/hash.go rename to vendor/k8s.io/kubernetes/pkg/util/hash/hash.go index 53834c05e..95fd32abe 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/hash.go +++ b/vendor/k8s.io/kubernetes/pkg/util/hash/hash.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package hash import ( "hash" diff --git a/vendor/k8s.io/kubernetes/pkg/util/hash_test.go b/vendor/k8s.io/kubernetes/pkg/util/hash/hash_test.go similarity index 99% rename from vendor/k8s.io/kubernetes/pkg/util/hash_test.go rename to vendor/k8s.io/kubernetes/pkg/util/hash/hash_test.go index ac6edd23b..3bba3b074 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/hash_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/hash/hash_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package hash import ( "fmt" diff --git a/vendor/k8s.io/kubernetes/pkg/util/httpstream/httpstream.go b/vendor/k8s.io/kubernetes/pkg/util/httpstream/httpstream.go index fff6840f2..4f6b608ce 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/httpstream/httpstream.go +++ b/vendor/k8s.io/kubernetes/pkg/util/httpstream/httpstream.go @@ -17,6 +17,7 @@ limitations under the License. package httpstream import ( + "fmt" "io" "net/http" "strings" @@ -24,22 +25,27 @@ import ( ) const ( - HeaderConnection = "Connection" - HeaderUpgrade = "Upgrade" + HeaderConnection = "Connection" + HeaderUpgrade = "Upgrade" + HeaderProtocolVersion = "X-Stream-Protocol-Version" + HeaderAcceptedProtocolVersions = "X-Accepted-Stream-Protocol-Versions" ) // NewStreamHandler defines a function that is called when a new Stream is // received. If no error is returned, the Stream is accepted; otherwise, -// the stream is rejected. -type NewStreamHandler func(Stream) error +// the stream is rejected. After the reply frame has been sent, replySent is closed. +type NewStreamHandler func(stream Stream, replySent <-chan struct{}) error // NoOpNewStreamHandler is a stream handler that accepts a new stream and // performs no other logic. -func NoOpNewStreamHandler(stream Stream) error { return nil } +func NoOpNewStreamHandler(stream Stream, replySent <-chan struct{}) error { return nil } // Dialer knows how to open a streaming connection to a server. type Dialer interface { - Dial() (Connection, error) + + // Dial opens a streaming connection to a server using one of the protocols + // specified (in order of most preferred to least preferred). + Dial(protocols ...string) (Connection, string, error) } // UpgradeRoundTripper is a type of http.RoundTripper that is able to upgrade @@ -56,7 +62,7 @@ type UpgradeRoundTripper interface { // add streaming support to them. type ResponseUpgrader interface { // UpgradeResponse upgrades an HTTP response to one that supports multiplexed - // streams. newStreamHandler will be called synchronously whenever the + // streams. newStreamHandler will be called asynchronously whenever the // other end of the upgraded connection creates a new stream. UpgradeResponse(w http.ResponseWriter, req *http.Request, newStreamHandler NewStreamHandler) Connection } @@ -96,3 +102,44 @@ func IsUpgradeRequest(req *http.Request) bool { } return false } + +func negotiateProtocol(clientProtocols, serverProtocols []string) string { + for i := range clientProtocols { + for j := range serverProtocols { + if clientProtocols[i] == serverProtocols[j] { + return clientProtocols[i] + } + } + } + return "" +} + +// Handshake performs a subprotocol negotiation. If the client did not request +// a specific subprotocol, defaultProtocol is used. If the client did request a +// subprotocol, Handshake will select the first common value found in +// serverProtocols. If a match is found, Handshake adds a response header +// indicating the chosen subprotocol. If no match is found, HTTP forbidden is +// returned, along with a response header containing the list of protocols the +// server can accept. +func Handshake(req *http.Request, w http.ResponseWriter, serverProtocols []string, defaultProtocol string) (string, error) { + clientProtocols := req.Header[http.CanonicalHeaderKey(HeaderProtocolVersion)] + if len(clientProtocols) == 0 { + // Kube 1.0 client that didn't support subprotocol negotiation + // TODO remove this defaulting logic once Kube 1.0 is no longer supported + w.Header().Add(HeaderProtocolVersion, defaultProtocol) + return defaultProtocol, nil + } + + negotiatedProtocol := negotiateProtocol(clientProtocols, serverProtocols) + if len(negotiatedProtocol) == 0 { + w.WriteHeader(http.StatusForbidden) + for i := range serverProtocols { + w.Header().Add(HeaderAcceptedProtocolVersions, serverProtocols[i]) + } + fmt.Fprintf(w, "unable to upgrade: unable to negotiate protocol: client supports %v, server accepts %v", clientProtocols, serverProtocols) + return "", fmt.Errorf("unable to upgrade: unable to negotiate protocol: client supports %v, server supports %v", clientProtocols, serverProtocols) + } + + w.Header().Add(HeaderProtocolVersion, negotiatedProtocol) + return negotiatedProtocol, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/httpstream/httpstream_test.go b/vendor/k8s.io/kubernetes/pkg/util/httpstream/httpstream_test.go new file mode 100644 index 000000000..7a1bbaefb --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/httpstream/httpstream_test.go @@ -0,0 +1,120 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package httpstream + +import ( + "net/http" + "reflect" + "testing" +) + +type responseWriter struct { + header http.Header + statusCode *int +} + +func newResponseWriter() *responseWriter { + return &responseWriter{ + header: make(http.Header), + } +} + +func (r *responseWriter) Header() http.Header { + return r.header +} + +func (r *responseWriter) WriteHeader(code int) { + r.statusCode = &code +} + +func (r *responseWriter) Write([]byte) (int, error) { + return 0, nil +} + +func TestHandshake(t *testing.T) { + defaultProtocol := "default" + + tests := map[string]struct { + clientProtocols []string + serverProtocols []string + expectedProtocol string + expectError bool + }{ + "no client protocols": { + clientProtocols: []string{}, + serverProtocols: []string{"a", "b"}, + expectedProtocol: defaultProtocol, + }, + "no common protocol": { + clientProtocols: []string{"c"}, + serverProtocols: []string{"a", "b"}, + expectedProtocol: "", + expectError: true, + }, + "common protocol": { + clientProtocols: []string{"b"}, + serverProtocols: []string{"a", "b"}, + expectedProtocol: "b", + }, + } + + for name, test := range tests { + req, err := http.NewRequest("GET", "http://www.example.com/", nil) + if err != nil { + t.Fatalf("%s: error creating request: %v", name, err) + } + + for _, p := range test.clientProtocols { + req.Header.Add(HeaderProtocolVersion, p) + } + + w := newResponseWriter() + negotiated, err := Handshake(req, w, test.serverProtocols, defaultProtocol) + + // verify negotiated protocol + if e, a := test.expectedProtocol, negotiated; e != a { + t.Errorf("%s: protocol: expected %q, got %q", name, e, a) + } + + if test.expectError { + if err == nil { + t.Errorf("%s: expected error but did not get one", name) + } + if w.statusCode == nil { + t.Errorf("%s: expected w.statusCode to be set", name) + } else if e, a := http.StatusForbidden, *w.statusCode; e != a { + t.Errorf("%s: w.statusCode: expected %d, got %d", name, e, a) + } + if e, a := test.serverProtocols, w.Header()[HeaderAcceptedProtocolVersions]; !reflect.DeepEqual(e, a) { + t.Errorf("%s: accepted server protocols: expected %v, got %v", name, e, a) + } + continue + } + if !test.expectError && err != nil { + t.Errorf("%s: unexpected error: %v", name, err) + continue + } + if w.statusCode != nil { + t.Errorf("%s: unexpected non-nil w.statusCode: %d", w.statusCode) + } + + // verify response headers + if e, a := []string{test.expectedProtocol}, w.Header()[HeaderProtocolVersion]; !reflect.DeepEqual(e, a) { + t.Errorf("%s: protocol response header: expected %v, got %v", name, e, a) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/connection.go b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/connection.go index 6d4855d19..884c6e203 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/connection.go +++ b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/connection.go @@ -120,7 +120,8 @@ func (c *connection) CloseChan() <-chan bool { // the stream. If newStreamHandler returns an error, the stream is rejected. If not, the // stream is accepted and registered with the connection. func (c *connection) newSpdyStream(stream *spdystream.Stream) { - err := c.newStreamHandler(stream) + replySent := make(chan struct{}) + err := c.newStreamHandler(stream, replySent) rejectStream := (err != nil) if rejectStream { glog.Warningf("Stream rejected: %v", err) @@ -130,6 +131,7 @@ func (c *connection) newSpdyStream(stream *spdystream.Stream) { c.registerStream(stream) stream.SendReply(http.Header{}, rejectStream) + close(replySent) } // SetIdleTimeout sets the amount of time the connection may remain idle before diff --git a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/roundtripper.go b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/roundtripper.go index b3307936f..a054d30c2 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/roundtripper.go +++ b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/roundtripper.go @@ -205,14 +205,15 @@ func (s *SpdyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (httpstream.Connection, error) { connectionHeader := strings.ToLower(resp.Header.Get(httpstream.HeaderConnection)) upgradeHeader := strings.ToLower(resp.Header.Get(httpstream.HeaderUpgrade)) - if !strings.Contains(connectionHeader, strings.ToLower(httpstream.HeaderUpgrade)) || !strings.Contains(upgradeHeader, strings.ToLower(HeaderSpdy31)) { + if (resp.StatusCode != http.StatusSwitchingProtocols) || !strings.Contains(connectionHeader, strings.ToLower(httpstream.HeaderUpgrade)) || !strings.Contains(upgradeHeader, strings.ToLower(HeaderSpdy31)) { defer resp.Body.Close() responseError := "" responseErrorBytes, err := ioutil.ReadAll(resp.Body) if err != nil { responseError = "unable to read error from server response" } else { - if obj, err := api.Scheme.Decode(responseErrorBytes); err == nil { + // TODO: I don't belong here, I should be abstracted from this class + if obj, _, err := api.Codecs.UniversalDecoder().Decode(responseErrorBytes, nil, &unversioned.Status{}); err == nil { if status, ok := obj.(*unversioned.Status); ok { return nil, &apierrors.StatusError{ErrStatus: *status} } diff --git a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/roundtripper_test.go b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/roundtripper_test.go index babd23c90..7ca1d42ad 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/roundtripper_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/roundtripper_test.go @@ -39,30 +39,42 @@ func TestRoundTripAndNewConnection(t *testing.T) { clientTLS *tls.Config serverConnectionHeader string serverUpgradeHeader string + serverStatusCode int shouldError bool }{ "no headers": { serverFunc: httptest.NewServer, serverConnectionHeader: "", serverUpgradeHeader: "", + serverStatusCode: http.StatusSwitchingProtocols, shouldError: true, }, "no upgrade header": { serverFunc: httptest.NewServer, serverConnectionHeader: "Upgrade", serverUpgradeHeader: "", + serverStatusCode: http.StatusSwitchingProtocols, shouldError: true, }, "no connection header": { serverFunc: httptest.NewServer, serverConnectionHeader: "", serverUpgradeHeader: "SPDY/3.1", + serverStatusCode: http.StatusSwitchingProtocols, + shouldError: true, + }, + "no switching protocol status code": { + serverFunc: httptest.NewServer, + serverConnectionHeader: "Upgrade", + serverUpgradeHeader: "SPDY/3.1", + serverStatusCode: http.StatusForbidden, shouldError: true, }, "http": { serverFunc: httptest.NewServer, serverConnectionHeader: "Upgrade", serverUpgradeHeader: "SPDY/3.1", + serverStatusCode: http.StatusSwitchingProtocols, shouldError: false, }, "https (invalid hostname + InsecureSkipVerify)": { @@ -81,6 +93,7 @@ func TestRoundTripAndNewConnection(t *testing.T) { clientTLS: &tls.Config{InsecureSkipVerify: true}, serverConnectionHeader: "Upgrade", serverUpgradeHeader: "SPDY/3.1", + serverStatusCode: http.StatusSwitchingProtocols, shouldError: false, }, "https (valid hostname + RootCAs)": { @@ -99,6 +112,7 @@ func TestRoundTripAndNewConnection(t *testing.T) { clientTLS: &tls.Config{RootCAs: localhostPool}, serverConnectionHeader: "Upgrade", serverUpgradeHeader: "SPDY/3.1", + serverStatusCode: http.StatusSwitchingProtocols, shouldError: false, }, } @@ -112,7 +126,7 @@ func TestRoundTripAndNewConnection(t *testing.T) { w.Header().Set(httpstream.HeaderConnection, testCase.serverConnectionHeader) w.Header().Set(httpstream.HeaderUpgrade, testCase.serverUpgradeHeader) - w.WriteHeader(http.StatusSwitchingProtocols) + w.WriteHeader(testCase.serverStatusCode) return } @@ -120,7 +134,7 @@ func TestRoundTripAndNewConnection(t *testing.T) { streamCh := make(chan httpstream.Stream) responseUpgrader := NewResponseUpgrader() - spdyConn := responseUpgrader.UpgradeResponse(w, req, func(s httpstream.Stream) error { + spdyConn := responseUpgrader.UpgradeResponse(w, req, func(s httpstream.Stream, replySent <-chan struct{}) error { streamCh <- s return nil }) @@ -132,7 +146,8 @@ func TestRoundTripAndNewConnection(t *testing.T) { stream := <-streamCh io.Copy(stream, stream) })) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() req, err := http.NewRequest("GET", server.URL, nil) if err != nil { diff --git a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/upgrade.go b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/upgrade.go index 70c90c8f4..b7d126a5d 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/upgrade.go +++ b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/upgrade.go @@ -21,8 +21,8 @@ import ( "net/http" "strings" - "github.com/golang/glog" "k8s.io/kubernetes/pkg/util/httpstream" + "k8s.io/kubernetes/pkg/util/runtime" ) const HeaderSpdy31 = "SPDY/3.1" @@ -46,15 +46,15 @@ func (u responseUpgrader) UpgradeResponse(w http.ResponseWriter, req *http.Reque connectionHeader := strings.ToLower(req.Header.Get(httpstream.HeaderConnection)) upgradeHeader := strings.ToLower(req.Header.Get(httpstream.HeaderUpgrade)) if !strings.Contains(connectionHeader, strings.ToLower(httpstream.HeaderUpgrade)) || !strings.Contains(upgradeHeader, strings.ToLower(HeaderSpdy31)) { - w.Write([]byte(fmt.Sprintf("Unable to upgrade: missing upgrade headers in request: %#v", req.Header))) w.WriteHeader(http.StatusBadRequest) + fmt.Fprintf(w, "unable to upgrade: missing upgrade headers in request: %#v", req.Header) return nil } hijacker, ok := w.(http.Hijacker) if !ok { - w.Write([]byte("Unable to upgrade: unable to hijack response")) w.WriteHeader(http.StatusInternalServerError) + fmt.Fprintf(w, "unable to upgrade: unable to hijack response") return nil } @@ -64,13 +64,13 @@ func (u responseUpgrader) UpgradeResponse(w http.ResponseWriter, req *http.Reque conn, _, err := hijacker.Hijack() if err != nil { - glog.Errorf("Unable to upgrade: error hijacking response: %v", err) + runtime.HandleError(fmt.Errorf("unable to upgrade: error hijacking response: %v", err)) return nil } spdyConn, err := NewServerConnection(conn, newStreamHandler) if err != nil { - glog.Errorf("Unable to upgrade: error creating SPDY server connection: %v", err) + runtime.HandleError(fmt.Errorf("unable to upgrade: error creating SPDY server connection: %v", err)) return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/upgrade_test.go b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/upgrade_test.go index 4e111407e..2ddfd5a59 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/upgrade_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/httpstream/spdy/upgrade_test.go @@ -66,7 +66,8 @@ func TestUpgradeResponse(t *testing.T) { } defer conn.Close() })) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() req, err := http.NewRequest("GET", server.URL, nil) if err != nil { diff --git a/vendor/k8s.io/kubernetes/pkg/util/integer/integer.go b/vendor/k8s.io/kubernetes/pkg/util/integer/integer.go new file mode 100644 index 000000000..c51cd952d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/integer/integer.go @@ -0,0 +1,45 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package integer + +func IntMax(a, b int) int { + if b > a { + return b + } + return a +} + +func IntMin(a, b int) int { + if b < a { + return b + } + return a +} + +func Int64Max(a, b int64) int64 { + if b > a { + return b + } + return a +} + +func Int64Min(a, b int64) int64 { + if b < a { + return b + } + return a +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/integer/integer_test.go b/vendor/k8s.io/kubernetes/pkg/util/integer/integer_test.go new file mode 100644 index 000000000..0f8856738 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/integer/integer_test.go @@ -0,0 +1,143 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package integer + +import "testing" + +func TestIntMax(t *testing.T) { + tests := []struct { + nums []int + expectedMax int + }{ + { + nums: []int{-1, 0}, + expectedMax: 0, + }, + { + nums: []int{-1, -2}, + expectedMax: -1, + }, + { + nums: []int{0, 1}, + expectedMax: 1, + }, + { + nums: []int{1, 2}, + expectedMax: 2, + }, + } + + for i, test := range tests { + t.Logf("executing scenario %d", i) + if max := IntMax(test.nums[0], test.nums[1]); max != test.expectedMax { + t.Errorf("expected %v, got %v", test.expectedMax, max) + } + } +} + +func TestIntMin(t *testing.T) { + tests := []struct { + nums []int + expectedMin int + }{ + { + nums: []int{-1, 0}, + expectedMin: -1, + }, + { + nums: []int{-1, -2}, + expectedMin: -2, + }, + { + nums: []int{0, 1}, + expectedMin: 0, + }, + { + nums: []int{1, 2}, + expectedMin: 1, + }, + } + + for i, test := range tests { + t.Logf("executing scenario %d", i) + if min := IntMin(test.nums[0], test.nums[1]); min != test.expectedMin { + t.Errorf("expected %v, got %v", test.expectedMin, min) + } + } +} + +func TestInt64Max(t *testing.T) { + tests := []struct { + nums []int64 + expectedMax int64 + }{ + { + nums: []int64{-1, 0}, + expectedMax: 0, + }, + { + nums: []int64{-1, -2}, + expectedMax: -1, + }, + { + nums: []int64{0, 1}, + expectedMax: 1, + }, + { + nums: []int64{1, 2}, + expectedMax: 2, + }, + } + + for i, test := range tests { + t.Logf("executing scenario %d", i) + if max := Int64Max(test.nums[0], test.nums[1]); max != test.expectedMax { + t.Errorf("expected %v, got %v", test.expectedMax, max) + } + } +} + +func TestInt64Min(t *testing.T) { + tests := []struct { + nums []int64 + expectedMin int64 + }{ + { + nums: []int64{-1, 0}, + expectedMin: -1, + }, + { + nums: []int64{-1, -2}, + expectedMin: -2, + }, + { + nums: []int64{0, 1}, + expectedMin: 0, + }, + { + nums: []int64{1, 2}, + expectedMin: 1, + }, + } + + for i, test := range tests { + t.Logf("executing scenario %d", i) + if min := Int64Min(test.nums[0], test.nums[1]); min != test.expectedMin { + t.Errorf("expected %v, got %v", test.expectedMin, min) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/intstr/intstr.go b/vendor/k8s.io/kubernetes/pkg/util/intstr/intstr.go new file mode 100644 index 000000000..033d1d172 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/intstr/intstr.go @@ -0,0 +1,115 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package intstr + +import ( + "encoding/json" + "fmt" + "strconv" + + "github.com/google/gofuzz" +) + +// IntOrString is a type that can hold an int32 or a string. When used in +// JSON or YAML marshalling and unmarshalling, it produces or consumes the +// inner type. This allows you to have, for example, a JSON field that can +// accept a name or number. +// TODO: Rename to Int32OrString +// +// +protobuf=true +// +protobuf.options.(gogoproto.goproto_stringer)=false +type IntOrString struct { + Type Type + IntVal int32 + StrVal string +} + +// Type represents the stored type of IntOrString. +type Type int + +const ( + Int Type = iota // The IntOrString holds an int. + String // The IntOrString holds a string. +) + +// FromInt creates an IntOrString object with an int32 value. It is +// your responsibility not to call this method with a value greater +// than int32. +// TODO: convert to (val int32) +func FromInt(val int) IntOrString { + return IntOrString{Type: Int, IntVal: int32(val)} +} + +// FromString creates an IntOrString object with a string value. +func FromString(val string) IntOrString { + return IntOrString{Type: String, StrVal: val} +} + +// UnmarshalJSON implements the json.Unmarshaller interface. +func (intstr *IntOrString) UnmarshalJSON(value []byte) error { + if value[0] == '"' { + intstr.Type = String + return json.Unmarshal(value, &intstr.StrVal) + } + intstr.Type = Int + return json.Unmarshal(value, &intstr.IntVal) +} + +// String returns the string value, or the Itoa of the int value. +func (intstr *IntOrString) String() string { + if intstr.Type == String { + return intstr.StrVal + } + return strconv.Itoa(intstr.IntValue()) +} + +// IntValue returns the IntVal if type Int, or if +// it is a String, will attempt a conversion to int. +func (intstr *IntOrString) IntValue() int { + if intstr.Type == String { + i, _ := strconv.Atoi(intstr.StrVal) + return i + } + return int(intstr.IntVal) +} + +// MarshalJSON implements the json.Marshaller interface. +func (intstr IntOrString) MarshalJSON() ([]byte, error) { + switch intstr.Type { + case Int: + return json.Marshal(intstr.IntVal) + case String: + return json.Marshal(intstr.StrVal) + default: + return []byte{}, fmt.Errorf("impossible IntOrString.Type") + } +} + +func (intstr *IntOrString) Fuzz(c fuzz.Continue) { + if intstr == nil { + return + } + if c.RandBool() { + intstr.Type = Int + c.Fuzz(&intstr.IntVal) + intstr.StrVal = "" + } else { + intstr.Type = String + intstr.IntVal = 0 + c.Fuzz(&intstr.StrVal) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/intstr/intstr_test.go b/vendor/k8s.io/kubernetes/pkg/util/intstr/intstr_test.go new file mode 100644 index 000000000..27939e9f1 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/intstr/intstr_test.go @@ -0,0 +1,111 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package intstr + +import ( + "encoding/json" + "reflect" + "testing" + + "github.com/ghodss/yaml" +) + +func TestFromInt(t *testing.T) { + i := FromInt(93) + if i.Type != Int || i.IntVal != 93 { + t.Errorf("Expected IntVal=93, got %+v", i) + } +} + +func TestFromString(t *testing.T) { + i := FromString("76") + if i.Type != String || i.StrVal != "76" { + t.Errorf("Expected StrVal=\"76\", got %+v", i) + } +} + +type IntOrStringHolder struct { + IOrS IntOrString `json:"val"` +} + +func TestIntOrStringUnmarshalJSON(t *testing.T) { + cases := []struct { + input string + result IntOrString + }{ + {"{\"val\": 123}", FromInt(123)}, + {"{\"val\": \"123\"}", FromString("123")}, + } + + for _, c := range cases { + var result IntOrStringHolder + if err := json.Unmarshal([]byte(c.input), &result); err != nil { + t.Errorf("Failed to unmarshal input '%v': %v", c.input, err) + } + if result.IOrS != c.result { + t.Errorf("Failed to unmarshal input '%v': expected %+v, got %+v", c.input, c.result, result) + } + } +} + +func TestIntOrStringMarshalJSON(t *testing.T) { + cases := []struct { + input IntOrString + result string + }{ + {FromInt(123), "{\"val\":123}"}, + {FromString("123"), "{\"val\":\"123\"}"}, + } + + for _, c := range cases { + input := IntOrStringHolder{c.input} + result, err := json.Marshal(&input) + if err != nil { + t.Errorf("Failed to marshal input '%v': %v", input, err) + } + if string(result) != c.result { + t.Errorf("Failed to marshal input '%v': expected: %+v, got %q", input, c.result, string(result)) + } + } +} + +func TestIntOrStringMarshalJSONUnmarshalYAML(t *testing.T) { + cases := []struct { + input IntOrString + }{ + {FromInt(123)}, + {FromString("123")}, + } + + for _, c := range cases { + input := IntOrStringHolder{c.input} + jsonMarshalled, err := json.Marshal(&input) + if err != nil { + t.Errorf("1: Failed to marshal input: '%v': %v", input, err) + } + + var result IntOrStringHolder + err = yaml.Unmarshal(jsonMarshalled, &result) + if err != nil { + t.Errorf("2: Failed to unmarshal '%+v': %v", string(jsonMarshalled), err) + } + + if !reflect.DeepEqual(input, result) { + t.Errorf("3: Failed to marshal input '%+v': got %+v", input, result) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/io/io.go b/vendor/k8s.io/kubernetes/pkg/util/io/io.go index 70bc605f5..d600c08c1 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/io/io.go +++ b/vendor/k8s.io/kubernetes/pkg/util/io/io.go @@ -22,7 +22,8 @@ import ( "os" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/latest" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/runtime" ) // LoadPodFromFile will read, decode, and return a Pod from a file. @@ -39,7 +40,8 @@ func LoadPodFromFile(filePath string) (*api.Pod, error) { } pod := &api.Pod{} - if err := latest.GroupOrDie("").Codec.DecodeInto(podDef, pod); err != nil { + codec := api.Codecs.LegacyCodec(registered.GroupOrDie(api.GroupName).GroupVersion) + if err := runtime.DecodeInto(codec, podDef, pod); err != nil { return nil, fmt.Errorf("failed decoding file: %v", err) } return pod, nil @@ -50,7 +52,8 @@ func SavePodToFile(pod *api.Pod, filePath string, perm os.FileMode) error { if filePath == "" { return fmt.Errorf("file path not specified") } - data, err := latest.GroupOrDie("").Codec.Encode(pod) + codec := api.Codecs.LegacyCodec(registered.GroupOrDie(api.GroupName).GroupVersion) + data, err := runtime.Encode(codec, pod) if err != nil { return fmt.Errorf("failed encoding pod: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/util/io/io_test.go b/vendor/k8s.io/kubernetes/pkg/util/io/io_test.go index d6bd3f1f8..1b9d4c67a 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/io/io_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/io/io_test.go @@ -23,8 +23,10 @@ import ( "github.com/pborman/uuid" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/latest" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/util/io" + utiltesting "k8s.io/kubernetes/pkg/util/testing" "k8s.io/kubernetes/pkg/volume" ) @@ -32,11 +34,13 @@ func TestSavePodToFile(t *testing.T) { pod := volume.NewPersistentVolumeRecyclerPodTemplate() // sets all default values on a pod for equality comparison after decoding from file - encoded, err := latest.GroupOrDie("").Codec.Encode(pod) - latest.GroupOrDie("").Codec.DecodeInto(encoded, pod) + codec := api.Codecs.LegacyCodec(registered.GroupOrDie(api.GroupName).GroupVersion) + encoded, err := runtime.Encode(codec, pod) + runtime.DecodeInto(codec, encoded, pod) - path := fmt.Sprintf("/tmp/kube-io-test-%s", uuid.New()) - defer os.Remove(path) + tmpDir := utiltesting.MkTmpdirOrDie("kube-io-test") + defer os.RemoveAll(tmpDir) + path := fmt.Sprintf("/%s/kube-io-test-%s", tmpDir, uuid.New()) if err := io.SavePodToFile(pod, path, 777); err != nil { t.Fatalf("failed to save pod to file: %v", err) diff --git a/vendor/k8s.io/kubernetes/pkg/util/io/writer.go b/vendor/k8s.io/kubernetes/pkg/util/io/writer.go index 7e0217266..3046c4d9b 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/io/writer.go +++ b/vendor/k8s.io/kubernetes/pkg/util/io/writer.go @@ -17,6 +17,7 @@ limitations under the License. package io import ( + "bytes" "fmt" "io/ioutil" "os" @@ -49,6 +50,7 @@ func (writer *StdWriter) WriteFile(filename string, data []byte, perm os.FileMod type NsenterWriter struct { } +// TODO: should take a writer, not []byte func (writer *NsenterWriter) WriteFile(filename string, data []byte, perm os.FileMode) error { cmd := "nsenter" base_args := []string{ @@ -56,10 +58,11 @@ func (writer *NsenterWriter) WriteFile(filename string, data []byte, perm os.Fil "--", } - echo_args := append(base_args, "sh", "-c", - fmt.Sprintf("echo %q | cat > %s", data, filename)) + echo_args := append(base_args, "sh", "-c", fmt.Sprintf("cat > %s", filename)) glog.V(5).Infof("Command to write data to file: %v %v", cmd, echo_args) - outputBytes, err := exec.Command(cmd, echo_args...).CombinedOutput() + command := exec.Command(cmd, echo_args...) + command.Stdin = bytes.NewBuffer(data) + outputBytes, err := command.CombinedOutput() if err != nil { glog.Errorf("Output from writing to %q: %v", filename, string(outputBytes)) return err diff --git a/vendor/k8s.io/kubernetes/pkg/util/iptables/iptables.go b/vendor/k8s.io/kubernetes/pkg/util/iptables/iptables.go index e2fa00890..801cc8bf7 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/iptables/iptables.go +++ b/vendor/k8s.io/kubernetes/pkg/util/iptables/iptables.go @@ -41,6 +41,8 @@ const ( // An injectable interface for running iptables commands. Implementations must be goroutine-safe. type Interface interface { + // GetVersion returns the "X.Y.Z" semver string for iptables. + GetVersion() (string, error) // EnsureChain checks if the specified chain exists and, if not, creates it. If the chain existed, return true. EnsureChain(table Table, chain Chain) (bool, error) // FlushChain clears the specified chain. If the chain did not exist, return error. @@ -82,7 +84,8 @@ const ( type Table string const ( - TableNAT Table = "nat" + TableNAT Table = "nat" + TableFilter Table = "filter" ) type Chain string @@ -91,6 +94,7 @@ const ( ChainPostrouting Chain = "POSTROUTING" ChainPrerouting Chain = "PREROUTING" ChainOutput Chain = "OUTPUT" + ChainInput Chain = "INPUT" ) const ( @@ -135,7 +139,7 @@ type runner struct { // New returns a new Interface which will exec iptables. func New(exec utilexec.Interface, dbus utildbus.Interface, protocol Protocol) Interface { - vstring, err := GetIptablesVersionString(exec) + vstring, err := getIptablesVersionString(exec) if err != nil { glog.Warningf("Error checking iptables version, assuming version at least %s: %v", MinCheckVersion, err) vstring = MinCheckVersion @@ -186,6 +190,11 @@ func (runner *runner) connectToFirewallD() { go runner.dbusSignalHandler(bus) } +// GetVersion returns the version string. +func (runner *runner) GetVersion() (string, error) { + return getIptablesVersionString(runner.exec) +} + // EnsureChain is part of Interface. func (runner *runner) EnsureChain(table Table, chain Chain) (bool, error) { fullArgs := makeFullArgs(table, chain) @@ -287,6 +296,7 @@ func (runner *runner) Save(table Table) ([]byte, error) { // run and return args := []string{"-t", string(table)} + glog.V(4).Infof("running iptables-save %v", args) return runner.exec.Command(cmdIptablesSave, args...).CombinedOutput() } @@ -296,6 +306,7 @@ func (runner *runner) SaveAll() ([]byte, error) { defer runner.mu.Unlock() // run and return + glog.V(4).Infof("running iptables-save") return runner.exec.Command(cmdIptablesSave, []string{}...).CombinedOutput() } @@ -345,6 +356,7 @@ func (runner *runner) restoreInternal(args []string, data []byte, flush FlushFla return err } // run the command and return the output or an error including the output and error + glog.V(4).Infof("running iptables-restore %v", args) b, err := runner.exec.Command(cmdIptablesRestore, args...).CombinedOutput() if err != nil { return fmt.Errorf("%v (%s)", err, b) @@ -505,9 +517,9 @@ func getIptablesWaitFlag(vstring string) []string { } } -// GetIptablesVersionString runs "iptables --version" to get the version string +// getIptablesVersionString runs "iptables --version" to get the version string // in the form "X.X.X" -func GetIptablesVersionString(exec utilexec.Interface) (string, error) { +func getIptablesVersionString(exec utilexec.Interface) (string, error) { // this doesn't access mutable state so we don't need to use the interface / runner bytes, err := exec.Command(cmdIptables, "--version").CombinedOutput() if err != nil { @@ -567,3 +579,17 @@ func (runner *runner) reload() { f() } } + +// IsNotFoundError returns true if the error indicates "not found". It parses +// the error string looking for known values, which is imperfect but works in +// practice. +func IsNotFoundError(err error) bool { + es := err.Error() + if strings.Contains(es, "No such file or directory") { + return true + } + if strings.Contains(es, "No chain/target/match by that name") { + return true + } + return false +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/iptables/iptables_test.go b/vendor/k8s.io/kubernetes/pkg/util/iptables/iptables_test.go index 8bef16595..d5bb34691 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/iptables/iptables_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/iptables/iptables_test.go @@ -451,7 +451,7 @@ func TestGetIptablesHasCheckCommand(t *testing.T) { func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, }, } - version, err := GetIptablesVersionString(&fexec) + version, err := getIptablesVersionString(&fexec) if (err != nil) != testCase.Err { t.Errorf("Expected error: %v, Got error: %v", testCase.Err, err) } @@ -673,7 +673,7 @@ func TestReload(t *testing.T) { // EnsureChain func() ([]byte, error) { return []byte{}, nil }, // EnsureRule abc check - func() ([]byte, error) { return []byte{}, &exec.FakeExitError{1} }, + func() ([]byte, error) { return []byte{}, &exec.FakeExitError{Status: 1} }, // EnsureRule abc func() ([]byte, error) { return []byte{}, nil }, @@ -681,7 +681,7 @@ func TestReload(t *testing.T) { // EnsureChain func() ([]byte, error) { return []byte{}, nil }, // EnsureRule abc check - func() ([]byte, error) { return []byte{}, &exec.FakeExitError{1} }, + func() ([]byte, error) { return []byte{}, &exec.FakeExitError{Status: 1} }, // EnsureRule abc func() ([]byte, error) { return []byte{}, nil }, }, diff --git a/vendor/k8s.io/kubernetes/pkg/util/iptables/testing/fake.go b/vendor/k8s.io/kubernetes/pkg/util/iptables/testing/fake.go new file mode 100644 index 000000000..ac9967727 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/iptables/testing/fake.go @@ -0,0 +1,75 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testing + +import "k8s.io/kubernetes/pkg/util/iptables" + +// no-op implemenatation of iptables Interface +type fake struct{} + +func NewFake() *fake { + return &fake{} +} + +func (*fake) GetVersion() (string, error) { + return "0.0.0", nil +} + +func (*fake) EnsureChain(table iptables.Table, chain iptables.Chain) (bool, error) { + return true, nil +} + +func (*fake) FlushChain(table iptables.Table, chain iptables.Chain) error { + return nil +} + +func (*fake) DeleteChain(table iptables.Table, chain iptables.Chain) error { + return nil +} + +func (*fake) EnsureRule(position iptables.RulePosition, table iptables.Table, chain iptables.Chain, args ...string) (bool, error) { + return true, nil +} + +func (*fake) DeleteRule(table iptables.Table, chain iptables.Chain, args ...string) error { + return nil +} + +func (*fake) IsIpv6() bool { + return false +} + +func (*fake) Save(table iptables.Table) ([]byte, error) { + return make([]byte, 0), nil +} + +func (*fake) SaveAll() ([]byte, error) { + return make([]byte, 0), nil +} + +func (*fake) Restore(table iptables.Table, data []byte, flush iptables.FlushFlag, counters iptables.RestoreCountersFlag) error { + return nil +} + +func (*fake) RestoreAll(data []byte, flush iptables.FlushFlag, counters iptables.RestoreCountersFlag) error { + return nil +} +func (*fake) AddReloadFunc(reloadFunc func()) {} + +func (*fake) Destroy() {} + +var _ = iptables.Interface(&fake{}) diff --git a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go index 7d4b76209..35fcdd92d 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go +++ b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath.go @@ -130,7 +130,7 @@ func (j *JSONPath) walk(value []reflect.Value, node Node) ([]reflect.Value, erro case *ListNode: return j.evalList(value, node) case *TextNode: - return []reflect.Value{reflect.ValueOf(string(node.Text))}, nil + return []reflect.Value{reflect.ValueOf(node.Text)}, nil case *FieldNode: return j.evalField(value, node) case *ArrayNode: @@ -205,7 +205,7 @@ func (j *JSONPath) evalIdentifier(input []reflect.Value, node *IdentifierNode) ( return results, fmt.Errorf("not in range, nothing to end") } default: - return input, fmt.Errorf("unrecongnized identifier %v", node.Name) + return input, fmt.Errorf("unrecognized identifier %v", node.Name) } return results, nil } @@ -216,7 +216,10 @@ func (j *JSONPath) evalArray(input []reflect.Value, node *ArrayNode) ([]reflect. for _, value := range input { value, isNil := template.Indirect(value) - if isNil || (value.Kind() != reflect.Array && value.Kind() != reflect.Slice) { + if isNil { + continue + } + if value.Kind() != reflect.Array && value.Kind() != reflect.Slice { return input, fmt.Errorf("%v is not array or slice", value.Type()) } params := node.Params @@ -234,6 +237,16 @@ func (j *JSONPath) evalArray(input []reflect.Value, node *ArrayNode) ([]reflect. params[1].Value += value.Len() } + sliceLength := value.Len() + if params[1].Value != params[0].Value { // if you're requesting zero elements, allow it through. + if params[0].Value >= sliceLength { + return input, fmt.Errorf("array index out of bounds: index %d, length %d", params[0].Value, sliceLength) + } + if params[1].Value > sliceLength { + return input, fmt.Errorf("array index out of bounds: index %d, length %d", params[1].Value-1, sliceLength) + } + } + if !params[2].Known { value = value.Slice(params[0].Value, params[1].Value) } else { @@ -394,7 +407,7 @@ func (j *JSONPath) evalFilter(input []reflect.Value, node *FilterNode) ([]reflec value, _ = template.Indirect(value) if value.Kind() != reflect.Array && value.Kind() != reflect.Slice { - return input, fmt.Errorf("%v is not array or slice", value) + return input, fmt.Errorf("%v is not array or slice and cannot be filtered", value) } for i := 0; i < value.Len(); i++ { temp := []reflect.Value{value.Index(i)} diff --git a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath_test.go b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath_test.go index 3345aee85..01f07c908 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/jsonpath_test.go @@ -52,7 +52,7 @@ func testJSONPath(tests []jsonpathTest, t *testing.T) { } } -// testJSONPathSortOutput test testcases related to map, the results may print in random order +// testJSONPathSortOutput test cases related to map, the results may print in random order func testJSONPathSortOutput(tests []jsonpathTest, t *testing.T) { for _, test := range tests { j := New(test.name) @@ -66,7 +66,7 @@ func testJSONPathSortOutput(tests []jsonpathTest, t *testing.T) { t.Errorf("in %s, execute error %v", test.name, err) } out := buf.String() - //since map is itereated in random order, we need to sort the results. + //since map is visited in random order, we need to sort the results. sortedOut := strings.Fields(out) sort.Strings(sortedOut) sortedExpect := strings.Fields(test.expect) @@ -93,7 +93,7 @@ func testFailJSONPath(tests []jsonpathTest, t *testing.T) { out = err.Error() } if out != test.expect { - t.Errorf("in %s, expect to get error %s, got %s", test.name, test.expect, out) + t.Errorf("in %s, expect to get error %q, got %q", test.name, test.expect, out) } } } @@ -160,7 +160,7 @@ func TestStructInput(t *testing.T) { testJSONPath(storeTests, t) failStoreTests := []jsonpathTest{ - {"invalid identfier", "{hello}", storeData, "unrecongnized identifier hello"}, + {"invalid identfier", "{hello}", storeData, "unrecognized identifier hello"}, {"nonexistent field", "{.hello}", storeData, "hello is not found"}, {"invalid array", "{.Labels[0]}", storeData, "map[string]int is not array or slice"}, {"invalid filter operator", "{.Book[?(@.Price<>10)]}", storeData, "unrecognized filter operator <>"}, @@ -233,16 +233,17 @@ func TestKubernetes(t *testing.T) { } nodesTests := []jsonpathTest{ - {"range item", "{range .items[*]}{.metadata.name}, {end}{.kind}", nodesData, `127.0.0.1, 127.0.0.2, List`}, - {"range addresss", "{.items[*].status.addresses[*].address}", nodesData, - `127.0.0.1 127.0.0.2 127.0.0.3`}, - {"double range", "{range .items[*]}{range .status.addresses[*]}{.address}, {end}{end}", nodesData, - `127.0.0.1, 127.0.0.2, 127.0.0.3, `}, - {"item name", "{.items[*].metadata.name}", nodesData, `127.0.0.1 127.0.0.2`}, - {"union nodes capacity", "{.items[*]['metadata.name', 'status.capacity']}", nodesData, - `127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8]`}, - {"range nodes capacity", "{range .items[*]}[{.metadata.name}, {.status.capacity}] {end}", nodesData, - `[127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]] `}, + {"range item", `{range .items[*]}{.metadata.name}, {end}{.kind}`, nodesData, "127.0.0.1, 127.0.0.2, List"}, + {"range item with quote", `{range .items[*]}{.metadata.name}{"\t"}{end}`, nodesData, "127.0.0.1\t127.0.0.2\t"}, + {"range addresss", `{.items[*].status.addresses[*].address}`, nodesData, + "127.0.0.1 127.0.0.2 127.0.0.3"}, + {"double range", `{range .items[*]}{range .status.addresses[*]}{.address}, {end}{end}`, nodesData, + "127.0.0.1, 127.0.0.2, 127.0.0.3, "}, + {"item name", `{.items[*].metadata.name}`, nodesData, "127.0.0.1 127.0.0.2"}, + {"union nodes capacity", `{.items[*]['metadata.name', 'status.capacity']}`, nodesData, + "127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8]"}, + {"range nodes capacity", `{range .items[*]}[{.metadata.name}, {.status.capacity}] {end}`, nodesData, + "[127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]] "}, {"user password", `{.users[?(@.name=="e2e")].user.password}`, &nodesData, "secret"}, } testJSONPath(nodesTests, t) diff --git a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/node.go b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/node.go index bdbf0d38d..9d5242de7 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/node.go +++ b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/node.go @@ -84,11 +84,11 @@ func (l *ListNode) String() string { // TextNode holds plain text. type TextNode struct { NodeType - Text []byte // The text; may span newlines. + Text string // The text; may span newlines. } func newText(text string) *TextNode { - return &TextNode{NodeType: NodeText, Text: []byte(text)} + return &TextNode{NodeType: NodeText, Text: text} } func (t *TextNode) String() string { diff --git a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/parser.go b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/parser.go index 85aa2c131..bd1f5ecd4 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/parser.go +++ b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/parser.go @@ -63,8 +63,12 @@ func NewParser(name string) *Parser { // parseAction parsed the expression inside delimiter func parseAction(name, text string) (*Parser, error) { p, err := Parse(name, fmt.Sprintf("%s%s%s", leftDelim, text, rightDelim)) + // when error happens, p will be nil, so we need to return here + if err != nil { + return p, err + } p.Root = p.Root.Nodes[0].(*ListNode) - return p, err + return p, nil } func (p *Parser) Parse(text string) error { @@ -355,7 +359,7 @@ Loop: return p.parseInsideAction(cur) } -// parseQuote scans array index selection +// parseQuote unquotes string inside double quote func (p *Parser) parseQuote(cur *ListNode) error { Loop: for { @@ -367,7 +371,11 @@ Loop: } } value := p.consumeText() - cur.append(newText(value[1 : len(value)-1])) + s, err := strconv.Unquote(value) + if err != nil { + return fmt.Errorf("unquote string %s error %v", value, err) + } + cur.append(newText(s)) return p.parseInsideAction(cur) } diff --git a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/parser_test.go b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/parser_test.go index e0102062e..a061043b8 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/jsonpath/parser_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/jsonpath/parser_test.go @@ -21,44 +21,46 @@ import ( ) type parserTest struct { - name string - text string - nodes []Node + name string + text string + nodes []Node + shouldError bool } var parserTests = []parserTest{ - {"plain", `hello jsonpath`, []Node{newText("hello jsonpath")}}, + {"plain", `hello jsonpath`, []Node{newText("hello jsonpath")}, false}, {"variable", `hello {.jsonpath}`, - []Node{newText("hello "), newList(), newField("jsonpath")}}, + []Node{newText("hello "), newList(), newField("jsonpath")}, false}, {"arrayfiled", `hello {['jsonpath']}`, - []Node{newText("hello "), newList(), newField("jsonpath")}}, - {"quote", `{"{"}`, []Node{newList(), newText("{")}}, + []Node{newText("hello "), newList(), newField("jsonpath")}, false}, + {"quote", `{"{"}`, []Node{newList(), newText("{")}, false}, {"array", `{[1:3]}`, []Node{newList(), - newArray([3]ParamsEntry{{1, true}, {3, true}, {0, false}})}}, + newArray([3]ParamsEntry{{1, true}, {3, true}, {0, false}})}, false}, {"allarray", `{.book[*].author}`, []Node{newList(), newField("book"), - newArray([3]ParamsEntry{{0, false}, {0, false}, {0, false}}), newField("author")}}, + newArray([3]ParamsEntry{{0, false}, {0, false}, {0, false}}), newField("author")}, false}, {"wildcard", `{.bicycle.*}`, - []Node{newList(), newField("bicycle"), newWildcard()}}, + []Node{newList(), newField("bicycle"), newWildcard()}, false}, {"filter", `{[?(@.price<3)]}`, []Node{newList(), newFilter(newList(), newList(), "<"), - newList(), newField("price"), newList(), newInt(3)}}, - {"recursive", `{..}`, []Node{newList(), newRecursive()}}, + newList(), newField("price"), newList(), newInt(3)}, false}, + {"recursive", `{..}`, []Node{newList(), newRecursive()}, false}, {"recurField", `{..price}`, - []Node{newList(), newRecursive(), newField("price")}}, + []Node{newList(), newRecursive(), newField("price")}, false}, {"arraydict", `{['book.price']}`, []Node{newList(), newField("book"), newField("price"), - }}, + }, false}, {"union", `{['bicycle.price', 3, 'book.price']}`, []Node{newList(), newUnion([]*ListNode{}), newList(), newField("bicycle"), newField("price"), newList(), newArray([3]ParamsEntry{{3, true}, {4, true}, {0, false}}), newList(), newField("book"), newField("price"), - }}, + }, false}, {"range", `{range .items}{.name},{end}`, []Node{ newList(), newIdentifier("range"), newField("items"), newList(), newField("name"), newText(","), newList(), newIdentifier("end"), - }}, + }, false}, + {"malformat input", `{\\\}`, []Node{}, true}, } func collectNode(nodes []Node, cur Node) []Node { @@ -82,6 +84,12 @@ func collectNode(nodes []Node, cur Node) []Node { func TestParser(t *testing.T) { for _, test := range parserTests { parser, err := Parse(test.name, test.text) + if test.shouldError { + if err == nil { + t.Errorf("unexpected non-error when parsing %s", test.name) + } + continue + } if err != nil { t.Errorf("parse %s error %v", test.name, err) } diff --git a/vendor/k8s.io/kubernetes/pkg/util/keymutex/keymutex.go b/vendor/k8s.io/kubernetes/pkg/util/keymutex/keymutex.go new file mode 100644 index 000000000..7e644c143 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/keymutex/keymutex.go @@ -0,0 +1,82 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package keymutex + +import ( + "fmt" + "github.com/golang/glog" + "sync" +) + +// KeyMutex is a thread-safe interface for acquiring locks on arbitrary strings. +type KeyMutex interface { + // Aquires a lock associated with the specified ID, creates the lock if one doesn't already exist. + LockKey(id string) + + // Releases the lock associated with the specified ID. + // Returns an error if the specified ID doesn't exist. + UnlockKey(id string) error +} + +// Returns a new instance of a key mutex. +func NewKeyMutex() KeyMutex { + return &keyMutex{ + mutexMap: make(map[string]*sync.Mutex), + } +} + +type keyMutex struct { + sync.RWMutex + mutexMap map[string]*sync.Mutex +} + +// Aquires a lock associated with the specified ID (creates the lock if one doesn't already exist). +func (km *keyMutex) LockKey(id string) { + glog.V(5).Infof("LockKey(...) called for id %q\r\n", id) + mutex := km.getOrCreateLock(id) + mutex.Lock() + glog.V(5).Infof("LockKey(...) for id %q completed.\r\n", id) +} + +// Releases the lock associated with the specified ID. +// Returns an error if the specified ID doesn't exist. +func (km *keyMutex) UnlockKey(id string) error { + glog.V(5).Infof("UnlockKey(...) called for id %q\r\n", id) + km.RLock() + defer km.RUnlock() + mutex, exists := km.mutexMap[id] + if !exists { + return fmt.Errorf("id %q not found", id) + } + glog.V(5).Infof("UnlockKey(...) for id. Mutex found, trying to unlock it. %q\r\n", id) + + mutex.Unlock() + glog.V(5).Infof("UnlockKey(...) for id %q completed.\r\n", id) + return nil +} + +// Returns lock associated with the specified ID, or creates the lock if one doesn't already exist. +func (km *keyMutex) getOrCreateLock(id string) *sync.Mutex { + km.Lock() + defer km.Unlock() + + if _, exists := km.mutexMap[id]; !exists { + km.mutexMap[id] = &sync.Mutex{} + } + + return km.mutexMap[id] +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/keymutex/keymutex_test.go b/vendor/k8s.io/kubernetes/pkg/util/keymutex/keymutex_test.go new file mode 100644 index 000000000..faa3be16a --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/keymutex/keymutex_test.go @@ -0,0 +1,111 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package keymutex + +import ( + "testing" + "time" +) + +const ( + callbackTimeout = 1 * time.Second +) + +func Test_SingleLock_NoUnlock(t *testing.T) { + // Arrange + km := NewKeyMutex() + key := "fakeid" + callbackCh := make(chan interface{}) + + // Act + go lockAndCallback(km, key, callbackCh) + + // Assert + verifyCallbackHappens(t, callbackCh) +} + +func Test_SingleLock_SingleUnlock(t *testing.T) { + // Arrange + km := NewKeyMutex() + key := "fakeid" + callbackCh := make(chan interface{}) + + // Act & Assert + go lockAndCallback(km, key, callbackCh) + verifyCallbackHappens(t, callbackCh) + km.UnlockKey(key) +} + +func Test_DoubleLock_DoubleUnlock(t *testing.T) { + // Arrange + km := NewKeyMutex() + key := "fakeid" + callbackCh1stLock := make(chan interface{}) + callbackCh2ndLock := make(chan interface{}) + + // Act & Assert + go lockAndCallback(km, key, callbackCh1stLock) + verifyCallbackHappens(t, callbackCh1stLock) + go lockAndCallback(km, key, callbackCh2ndLock) + verifyCallbackDoesntHappens(t, callbackCh2ndLock) + km.UnlockKey(key) + verifyCallbackHappens(t, callbackCh2ndLock) + km.UnlockKey(key) +} + +func lockAndCallback(km KeyMutex, id string, callbackCh chan<- interface{}) { + km.LockKey(id) + callbackCh <- true +} + +func verifyCallbackHappens(t *testing.T, callbackCh <-chan interface{}) bool { + select { + case <-callbackCh: + return true + case <-time.After(callbackTimeout): + t.Fatalf("Timed out waiting for callback.") + return false + } +} + +func verifyCallbackDoesntHappens(t *testing.T, callbackCh <-chan interface{}) bool { + select { + case <-callbackCh: + t.Fatalf("Unexpected callback.") + return false + case <-time.After(callbackTimeout): + return true + } +} + +func verifyNoError(t *testing.T, err error, name string) { + if err != nil { + t.Fatalf("Unexpected response on %q. Expected: Actual: <%v>", name, err) + } +} + +func verifyError(t *testing.T, err error, name string) { + if err == nil { + t.Fatalf("Unexpected response on %q. Expected: Actual: ", name) + } +} + +func verifyMsg(t *testing.T, expected, actual string) { + if actual != expected { + t.Fatalf("Unexpected testMsg value. Expected: <%v> Actual: <%v>", expected, actual) + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/labels/doc.go b/vendor/k8s.io/kubernetes/pkg/util/labels/doc.go new file mode 100644 index 000000000..0746d878d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/labels/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package labels provides utilities to work with Kubernetes labels. +package labels diff --git a/vendor/k8s.io/kubernetes/pkg/util/labels/labels.go b/vendor/k8s.io/kubernetes/pkg/util/labels/labels.go new file mode 100644 index 000000000..f7f034bc2 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/labels/labels.go @@ -0,0 +1,95 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package labels + +import ( + "fmt" + + "k8s.io/kubernetes/pkg/api/unversioned" +) + +// Clones the given map and returns a new map with the given key and value added. +// Returns the given map, if labelKey is empty. +func CloneAndAddLabel(labels map[string]string, labelKey string, labelValue uint32) map[string]string { + if labelKey == "" { + // Dont need to add a label. + return labels + } + // Clone. + newLabels := map[string]string{} + for key, value := range labels { + newLabels[key] = value + } + newLabels[labelKey] = fmt.Sprintf("%d", labelValue) + return newLabels +} + +// CloneAndRemoveLabel clones the given map and returns a new map with the given key removed. +// Returns the given map, if labelKey is empty. +func CloneAndRemoveLabel(labels map[string]string, labelKey string) map[string]string { + if labelKey == "" { + // Dont need to add a label. + return labels + } + // Clone. + newLabels := map[string]string{} + for key, value := range labels { + newLabels[key] = value + } + delete(newLabels, labelKey) + return newLabels +} + +// Clones the given selector and returns a new selector with the given key and value added. +// Returns the given selector, if labelKey is empty. +func CloneSelectorAndAddLabel(selector *unversioned.LabelSelector, labelKey string, labelValue uint32) *unversioned.LabelSelector { + if labelKey == "" { + // Dont need to add a label. + return selector + } + + // Clone. + newSelector := new(unversioned.LabelSelector) + + // TODO(madhusudancs): Check if you can use deepCopy_extensions_LabelSelector here. + newSelector.MatchLabels = make(map[string]string) + if selector.MatchLabels != nil { + for key, val := range selector.MatchLabels { + newSelector.MatchLabels[key] = val + } + } + newSelector.MatchLabels[labelKey] = fmt.Sprintf("%d", labelValue) + + if selector.MatchExpressions != nil { + newMExps := make([]unversioned.LabelSelectorRequirement, len(selector.MatchExpressions)) + for i, me := range selector.MatchExpressions { + newMExps[i].Key = me.Key + newMExps[i].Operator = me.Operator + if me.Values != nil { + newMExps[i].Values = make([]string, len(me.Values)) + copy(newMExps[i].Values, me.Values) + } else { + newMExps[i].Values = nil + } + } + newSelector.MatchExpressions = newMExps + } else { + newSelector.MatchExpressions = nil + } + + return newSelector +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/labels/labels_test.go b/vendor/k8s.io/kubernetes/pkg/util/labels/labels_test.go new file mode 100644 index 000000000..9adbd4554 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/labels/labels_test.go @@ -0,0 +1,60 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package labels + +import ( + "reflect" + "testing" +) + +func TestCloneAndAddLabel(t *testing.T) { + labels := map[string]string{ + "foo1": "bar1", + "foo2": "bar2", + "foo3": "bar3", + } + + cases := []struct { + labels map[string]string + labelKey string + labelValue uint32 + want map[string]string + }{ + { + labels: labels, + want: labels, + }, + { + labels: labels, + labelKey: "foo4", + labelValue: uint32(42), + want: map[string]string{ + "foo1": "bar1", + "foo2": "bar2", + "foo3": "bar3", + "foo4": "42", + }, + }, + } + + for _, tc := range cases { + got := CloneAndAddLabel(tc.labels, tc.labelKey, tc.labelValue) + if !reflect.DeepEqual(got, tc.want) { + t.Errorf("got %v, want %v", got, tc.want) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/logs.go b/vendor/k8s.io/kubernetes/pkg/util/logs.go index 37b9b767b..c79c4903d 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/logs.go +++ b/vendor/k8s.io/kubernetes/pkg/util/logs.go @@ -23,6 +23,7 @@ import ( "github.com/golang/glog" "github.com/spf13/pflag" + "k8s.io/kubernetes/pkg/util/wait" ) var logFlushFreq = pflag.Duration("log-flush-frequency", 5*time.Second, "Maximum number of seconds between log flushes") @@ -46,7 +47,7 @@ func InitLogs() { log.SetOutput(GlogWriter{}) log.SetFlags(0) // The default glog flush interval is 30 seconds, which is frighteningly long. - go Until(glog.Flush, *logFlushFreq, NeverStop) + go wait.Until(glog.Flush, *logFlushFreq, wait.NeverStop) } // FlushLogs flushes logs immediately. diff --git a/vendor/k8s.io/kubernetes/pkg/util/mount/fake.go b/vendor/k8s.io/kubernetes/pkg/util/mount/fake.go index 35c2f36aa..115293813 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/mount/fake.go +++ b/vendor/k8s.io/kubernetes/pkg/util/mount/fake.go @@ -16,10 +16,19 @@ limitations under the License. package mount +import ( + "sync" + + "github.com/golang/glog" +) + // FakeMounter implements mount.Interface for tests. type FakeMounter struct { MountPoints []MountPoint Log []FakeAction + // Some tests run things in parallel, make sure the mounter does not produce + // any golang's DATA RACE warnings. + mutex sync.Mutex } var _ Interface = &FakeMounter{} @@ -37,21 +46,58 @@ type FakeAction struct { } func (f *FakeMounter) ResetLog() { + f.mutex.Lock() + defer f.mutex.Unlock() + f.Log = []FakeAction{} } func (f *FakeMounter) Mount(source string, target string, fstype string, options []string) error { + f.mutex.Lock() + defer f.mutex.Unlock() + + // find 'bind' option + for _, option := range options { + if option == "bind" { + // This is a bind-mount. In order to mimic linux behaviour, we must + // use the original device of the bind-mount as the real source. + // E.g. when mounted /dev/sda like this: + // $ mount /dev/sda /mnt/test + // $ mount -o bind /mnt/test /mnt/bound + // then /proc/mount contains: + // /dev/sda /mnt/test + // /dev/sda /mnt/bound + // (and not /mnt/test /mnt/bound) + // I.e. we must use /dev/sda as source instead of /mnt/test in the + // bind mount. + for _, mnt := range f.MountPoints { + if source == mnt.Path { + source = mnt.Device + break + } + } + break + } + } + f.MountPoints = append(f.MountPoints, MountPoint{Device: source, Path: target, Type: fstype}) + glog.V(5).Infof("Fake mounter: mouted %s to %s", source, target) f.Log = append(f.Log, FakeAction{Action: FakeActionMount, Target: target, Source: source, FSType: fstype}) return nil } func (f *FakeMounter) Unmount(target string) error { + f.mutex.Lock() + defer f.mutex.Unlock() + newMountpoints := []MountPoint{} for _, mp := range f.MountPoints { - if mp.Path != target { - newMountpoints = append(newMountpoints, MountPoint{Device: mp.Device, Path: mp.Path, Type: mp.Type}) + if mp.Path == target { + glog.V(5).Infof("Fake mounter: unmouted %s from %s", mp.Device, target) + // Don't copy it to newMountpoints + continue } + newMountpoints = append(newMountpoints, MountPoint{Device: mp.Device, Path: mp.Path, Type: mp.Type}) } f.MountPoints = newMountpoints f.Log = append(f.Log, FakeAction{Action: FakeActionUnmount, Target: target}) @@ -59,14 +105,22 @@ func (f *FakeMounter) Unmount(target string) error { } func (f *FakeMounter) List() ([]MountPoint, error) { + f.mutex.Lock() + defer f.mutex.Unlock() + return f.MountPoints, nil } func (f *FakeMounter) IsLikelyNotMountPoint(file string) (bool, error) { + f.mutex.Lock() + defer f.mutex.Unlock() + for _, mp := range f.MountPoints { if mp.Path == file { + glog.V(5).Infof("isLikelyMountPoint for %s: monted %s, false", file, mp.Path) return false, nil } } + glog.V(5).Infof("isLikelyMountPoint for %s: true", file) return true, nil } diff --git a/vendor/k8s.io/kubernetes/pkg/util/mount/mount.go b/vendor/k8s.io/kubernetes/pkg/util/mount/mount.go index ac5f9a57a..79f3f6ec2 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/mount/mount.go +++ b/vendor/k8s.io/kubernetes/pkg/util/mount/mount.go @@ -19,8 +19,6 @@ limitations under the License. package mount import ( - "strings" - "github.com/golang/glog" "k8s.io/kubernetes/pkg/util/exec" ) @@ -49,16 +47,20 @@ type MountPoint struct { Pass int } -// SafeFormatAndMount probes a device to see if it is formatted. If -// so it mounts it otherwise it formats it and mounts it +// SafeFormatAndMount probes a device to see if it is formatted. +// Namely it checks to see if a file system is present. If so it +// mounts it otherwise the device is formatted first then mounted. type SafeFormatAndMount struct { Interface Runner exec.Interface } -// Mount mounts the given disk. If the disk is not formatted and the disk is not being mounted as read only -// it will format the disk first then mount it. -func (mounter *SafeFormatAndMount) Mount(source string, target string, fstype string, options []string) error { +// FormatAndMount formats the given disk, if needed, and mounts it. +// That is if the disk is not formatted and it is not being mounted as +// read-only it will format it first then mount it. Otherwise, if the +// disk is already formatted or it is being mounted as read-only, it +// will be mounted without formatting. +func (mounter *SafeFormatAndMount) FormatAndMount(source string, target string, fstype string, options []string) error { // Don't attempt to format if mounting as readonly. Go straight to mounting. for _, option := range options { if option == "ro" { @@ -68,51 +70,6 @@ func (mounter *SafeFormatAndMount) Mount(source string, target string, fstype st return mounter.formatAndMount(source, target, fstype, options) } -// formatAndMount uses unix utils to format and mount the given disk -func (mounter *SafeFormatAndMount) formatAndMount(source string, target string, fstype string, options []string) error { - options = append(options, "defaults") - - // Try to mount the disk - err := mounter.Interface.Mount(source, target, fstype, options) - if err != nil { - // It is possible that this disk is not formatted. Double check using diskLooksUnformatted - notFormatted, err := mounter.diskLooksUnformatted(source) - if err == nil && notFormatted { - // Disk is unformatted so format it. - // Use 'ext4' as the default - if len(fstype) == 0 { - fstype = "ext4" - } - args := []string{"-E", "lazy_itable_init=0,lazy_journal_init=0", "-F", source} - cmd := mounter.Runner.Command("mkfs."+fstype, args...) - _, err := cmd.CombinedOutput() - if err == nil { - // the disk has been formatted sucessfully try to mount it again. - return mounter.Interface.Mount(source, target, fstype, options) - } - return err - } - } - return err -} - -// diskLooksUnformatted uses 'lsblk' to see if the given disk is unformated -func (mounter *SafeFormatAndMount) diskLooksUnformatted(disk string) (bool, error) { - args := []string{"-nd", "-o", "FSTYPE", disk} - cmd := mounter.Runner.Command("lsblk", args...) - dataOut, err := cmd.CombinedOutput() - output := strings.TrimSpace(string(dataOut)) - - // TODO (#13212): check if this disk has partitions and return false, and - // an error if so. - - if err != nil { - return false, err - } - - return output == "", nil -} - // New returns a mount.Interface for the current system. func New() Interface { return &Mounter{} diff --git a/vendor/k8s.io/kubernetes/pkg/util/mount/mount_linux.go b/vendor/k8s.io/kubernetes/pkg/util/mount/mount_linux.go index 18c16edf2..c4ff01799 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/mount/mount_linux.go +++ b/vendor/k8s.io/kubernetes/pkg/util/mount/mount_linux.go @@ -30,6 +30,7 @@ import ( "syscall" "github.com/golang/glog" + utilExec "k8s.io/kubernetes/pkg/util/exec" ) const ( @@ -41,6 +42,13 @@ const ( procMountsPath = "/proc/mounts" ) +const ( + // 'fsck' found errors and corrected them + fsckErrorsCorrected = 1 + // 'fsck' found errors but exited without correcting them + fsckErrorsUncorrected = 4 +) + // Mounter provides the default implementation of mount.Interface // for the linux platform. This implementation assumes that the // kubelet is running in the host's root mount namespace. @@ -235,3 +243,69 @@ func readProcMountsFrom(file io.Reader, out *[]MountPoint) (uint32, error) { } return hash.Sum32(), nil } + +// formatAndMount uses unix utils to format and mount the given disk +func (mounter *SafeFormatAndMount) formatAndMount(source string, target string, fstype string, options []string) error { + options = append(options, "defaults") + + // Run fsck on the disk to fix repairable issues + args := []string{"-a", source} + cmd := mounter.Runner.Command("fsck", args...) + out, err := cmd.CombinedOutput() + if err != nil { + ee, isExitError := err.(utilExec.ExitError) + switch { + case err == utilExec.ErrExecutableNotFound: + glog.Warningf("'fsck' not found on system; continuing mount without running 'fsck'.") + case isExitError && ee.ExitStatus() == fsckErrorsCorrected: + glog.Infof("Device %s has errors which were corrected by fsck.", source) + case isExitError && ee.ExitStatus() == fsckErrorsUncorrected: + return fmt.Errorf("'fsck' found errors on device %s but could not correct them: %s.", source, string(out)) + case isExitError && ee.ExitStatus() > fsckErrorsUncorrected: + glog.Infof("`fsck` error %s", string(out)) + } + } + + // Try to mount the disk + err = mounter.Interface.Mount(source, target, fstype, options) + if err != nil { + // It is possible that this disk is not formatted. Double check using diskLooksUnformatted + notFormatted, err := mounter.diskLooksUnformatted(source) + if err == nil && notFormatted { + args = []string{source} + // Disk is unformatted so format it. + // Use 'ext4' as the default + if len(fstype) == 0 { + fstype = "ext4" + } + if fstype == "ext4" || fstype == "ext3" { + args = []string{"-E", "lazy_itable_init=0,lazy_journal_init=0", "-F", source} + } + cmd := mounter.Runner.Command("mkfs."+fstype, args...) + _, err := cmd.CombinedOutput() + if err == nil { + // the disk has been formatted sucessfully try to mount it again. + return mounter.Interface.Mount(source, target, fstype, options) + } + return err + } + } + return err +} + +// diskLooksUnformatted uses 'lsblk' to see if the given disk is unformated +func (mounter *SafeFormatAndMount) diskLooksUnformatted(disk string) (bool, error) { + args := []string{"-nd", "-o", "FSTYPE", disk} + cmd := mounter.Runner.Command("lsblk", args...) + dataOut, err := cmd.CombinedOutput() + output := strings.TrimSpace(string(dataOut)) + + // TODO (#13212): check if this disk has partitions and return false, and + // an error if so. + + if err != nil { + return false, err + } + + return output == "", nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/mount/mount_unsupported.go b/vendor/k8s.io/kubernetes/pkg/util/mount/mount_unsupported.go index 25ee8a7ee..8942c0036 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/mount/mount_unsupported.go +++ b/vendor/k8s.io/kubernetes/pkg/util/mount/mount_unsupported.go @@ -35,3 +35,11 @@ func (mounter *Mounter) List() ([]MountPoint, error) { func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) { return true, nil } + +func (mounter *SafeFormatAndMount) formatAndMount(source string, target string, fstype string, options []string) error { + return nil +} + +func (mounter *SafeFormatAndMount) diskLooksUnformatted(disk string) (bool, error) { + return true, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/mount/nsenter_mount.go b/vendor/k8s.io/kubernetes/pkg/util/mount/nsenter_mount.go index c22863971..6735c024c 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/mount/nsenter_mount.go +++ b/vendor/k8s.io/kubernetes/pkg/util/mount/nsenter_mount.go @@ -176,6 +176,7 @@ func (n *NsenterMounter) IsLikelyNotMountPoint(file string) (bool, error) { exec := exec.New() out, err := exec.Command(nsenterPath, args...).CombinedOutput() if err != nil { + glog.Errorf("Failed to nsenter mount, return file doesn't exist: %v", err) // If the command itself is correct, then if we encountered error // then most likely this means that the directory does not exist. return true, os.ErrNotExist diff --git a/vendor/k8s.io/kubernetes/pkg/util/mount/safe_format_and_mount_test.go b/vendor/k8s.io/kubernetes/pkg/util/mount/safe_format_and_mount_test.go index 26a23ae6e..03c0b8442 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/mount/safe_format_and_mount_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/mount/safe_format_and_mount_test.go @@ -18,6 +18,7 @@ package mount import ( "fmt" + "runtime" "testing" "k8s.io/kubernetes/pkg/util/exec" @@ -46,65 +47,116 @@ type ExecArgs struct { } func TestSafeFormatAndMount(t *testing.T) { + if runtime.GOOS == "darwin" || runtime.GOOS == "windows" { + t.Skipf("not supported on GOOS=%s", runtime.GOOS) + } tests := []struct { + description string fstype string mountOptions []string execScripts []ExecArgs mountErrs []error expectedError error }{ - { // Test a read only mount + { + description: "Test a read only mount", fstype: "ext4", mountOptions: []string{"ro"}, }, - { // Test a normal mount - fstype: "ext4", - }, - - { // Test that 'file' is called and fails - fstype: "ext4", - mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'")}, + { + description: "Test a normal mount", + fstype: "ext4", execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", nil}, + }, + }, + { + description: "Test 'fsck' fails with exit status 4", + fstype: "ext4", + execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", &exec.FakeExitError{Status: 4}}, + }, + expectedError: fmt.Errorf("'fsck' found errors on device /dev/foo but could not correct them: ."), + }, + { + description: "Test 'fsck' fails with exit status 1 (errors found and corrected)", + fstype: "ext4", + execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", &exec.FakeExitError{Status: 1}}, + }, + }, + { + description: "Test 'fsck' fails with exit status other than 1 and 4 (likely unformatted device)", + fstype: "ext4", + execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", &exec.FakeExitError{Status: 8}}, + }, + }, + { + description: "Test that 'lsblk' is called and fails", + fstype: "ext4", + mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'")}, + execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", nil}, {"lsblk", []string{"-nd", "-o", "FSTYPE", "/dev/foo"}, "ext4", nil}, }, expectedError: fmt.Errorf("unknown filesystem type '(null)'"), }, - { // Test that 'file' is called and confirms unformatted disk, format fails - fstype: "ext4", - mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'")}, + { + description: "Test that 'lsblk' is called and confirms unformatted disk, format fails", + fstype: "ext4", + mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'")}, execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", nil}, {"lsblk", []string{"-nd", "-o", "FSTYPE", "/dev/foo"}, "", nil}, {"mkfs.ext4", []string{"-E", "lazy_itable_init=0,lazy_journal_init=0", "-F", "/dev/foo"}, "", fmt.Errorf("formatting failed")}, }, expectedError: fmt.Errorf("formatting failed"), }, - { // Test that 'file' is called and confirms unformatted disk, format passes, second mount fails - fstype: "ext4", - mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'"), fmt.Errorf("Still cannot mount")}, + { + description: "Test that 'lsblk' is called and confirms unformatted disk, format passes, second mount fails", + fstype: "ext4", + mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'"), fmt.Errorf("Still cannot mount")}, execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", nil}, {"lsblk", []string{"-nd", "-o", "FSTYPE", "/dev/foo"}, "", nil}, {"mkfs.ext4", []string{"-E", "lazy_itable_init=0,lazy_journal_init=0", "-F", "/dev/foo"}, "", nil}, }, expectedError: fmt.Errorf("Still cannot mount"), }, - { // Test that 'file' is called and confirms unformatted disk, format passes, second mount passes - fstype: "ext4", - mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'"), nil}, + { + description: "Test that 'lsblk' is called and confirms unformatted disk, format passes, second mount passes", + fstype: "ext4", + mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'"), nil}, execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", nil}, {"lsblk", []string{"-nd", "-o", "FSTYPE", "/dev/foo"}, "", nil}, {"mkfs.ext4", []string{"-E", "lazy_itable_init=0,lazy_journal_init=0", "-F", "/dev/foo"}, "", nil}, }, expectedError: nil, }, - { // Test that 'file' is called and confirms unformatted disk, format passes, second mount passes with ext3 - fstype: "ext3", - mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'"), nil}, + { + description: "Test that 'lsblk' is called and confirms unformatted disk, format passes, second mount passes with ext3", + fstype: "ext3", + mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'"), nil}, execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", nil}, {"lsblk", []string{"-nd", "-o", "FSTYPE", "/dev/foo"}, "", nil}, {"mkfs.ext3", []string{"-E", "lazy_itable_init=0,lazy_journal_init=0", "-F", "/dev/foo"}, "", nil}, }, expectedError: nil, }, + { + description: "test that none ext4 fs does not get called with ext4 options.", + fstype: "xfs", + mountErrs: []error{fmt.Errorf("unknown filesystem type '(null)'"), nil}, + execScripts: []ExecArgs{ + {"fsck", []string{"-a", "/dev/foo"}, "", nil}, + {"lsblk", []string{"-nd", "-o", "FSTYPE", "/dev/foo"}, "", nil}, + {"mkfs.xfs", []string{"/dev/foo"}, "", nil}, + }, + expectedError: nil, + }, } for _, test := range tests { @@ -146,26 +198,26 @@ func TestSafeFormatAndMount(t *testing.T) { device := "/dev/foo" dest := "/mnt/bar" - err := mounter.Mount(device, dest, test.fstype, test.mountOptions) + err := mounter.FormatAndMount(device, dest, test.fstype, test.mountOptions) if test.expectedError == nil { if err != nil { - t.Errorf("unexpected non-error: %v", err) + t.Errorf("test \"%s\" unexpected non-error: %v", test.description, err) } // Check that something was mounted on the directory isNotMountPoint, err := fakeMounter.IsLikelyNotMountPoint(dest) if err != nil || isNotMountPoint { - t.Errorf("the directory was not mounted") + t.Errorf("test \"%s\" the directory was not mounted", test.description) } //check that the correct device was mounted mountedDevice, _, err := GetDeviceNameFromMount(fakeMounter.FakeMounter, dest) if err != nil || mountedDevice != device { - t.Errorf("the correct device was not mounted") + t.Errorf("test \"%s\" the correct device was not mounted", test.description) } } else { if err == nil || test.expectedError.Error() != err.Error() { - t.Errorf("unexpected error: %v. Expecting %v", err, test.expectedError) + t.Errorf("test \"%s\" unexpected error: \n [%v]. \nExpecting [%v]", test.description, err, test.expectedError) } } } diff --git a/vendor/k8s.io/kubernetes/pkg/util/http.go b/vendor/k8s.io/kubernetes/pkg/util/net/http.go similarity index 86% rename from vendor/k8s.io/kubernetes/pkg/util/http.go rename to vendor/k8s.io/kubernetes/pkg/util/net/http.go index 8f35ce49b..1c618accf 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/http.go +++ b/vendor/k8s.io/kubernetes/pkg/util/net/http.go @@ -1,5 +1,5 @@ /* -Copyright 2014 The Kubernetes Authors All rights reserved. +Copyright 2016 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package net import ( "crypto/tls" @@ -23,6 +23,7 @@ import ( "net" "net/http" "net/url" + "strconv" "strings" ) @@ -102,3 +103,20 @@ func TLSClientConfig(transport http.RoundTripper) (*tls.Config, error) { return nil, fmt.Errorf("unknown transport type: %v", transport) } } + +func FormatURL(scheme string, host string, port int, path string) *url.URL { + return &url.URL{ + Scheme: scheme, + Host: net.JoinHostPort(host, strconv.Itoa(port)), + Path: path, + } +} + +func GetHTTPClient(req *http.Request) string { + if userAgent, ok := req.Header["User-Agent"]; ok { + if len(userAgent) > 0 { + return userAgent[0] + } + } + return "unknown" +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/net/interface.go b/vendor/k8s.io/kubernetes/pkg/util/net/interface.go new file mode 100644 index 000000000..cdf5ddb54 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/net/interface.go @@ -0,0 +1,278 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package net + +import ( + "bufio" + "encoding/hex" + "fmt" + "io" + "net" + "os" + + "strings" + + "github.com/golang/glog" +) + +type Route struct { + Interface string + Destination net.IP + Gateway net.IP + // TODO: add more fields here if needed +} + +func getRoutes(input io.Reader) ([]Route, error) { + routes := []Route{} + if input == nil { + return nil, fmt.Errorf("input is nil") + } + scanner := bufio.NewReader(input) + for { + line, err := scanner.ReadString('\n') + if err == io.EOF { + break + } + //ignore the headers in the route info + if strings.HasPrefix(line, "Iface") { + continue + } + fields := strings.Fields(line) + routes = append(routes, Route{}) + route := &routes[len(routes)-1] + route.Interface = fields[0] + ip, err := parseIP(fields[1]) + if err != nil { + return nil, err + } + route.Destination = ip + ip, err = parseIP(fields[2]) + if err != nil { + return nil, err + } + route.Gateway = ip + } + return routes, nil +} + +func parseIP(str string) (net.IP, error) { + if str == "" { + return nil, fmt.Errorf("input is nil") + } + bytes, err := hex.DecodeString(str) + if err != nil { + return nil, err + } + //TODO add ipv6 support + if len(bytes) != net.IPv4len { + return nil, fmt.Errorf("only IPv4 is supported") + } + bytes[0], bytes[1], bytes[2], bytes[3] = bytes[3], bytes[2], bytes[1], bytes[0] + return net.IP(bytes), nil +} + +func isInterfaceUp(intf *net.Interface) bool { + if intf == nil { + return false + } + if intf.Flags&net.FlagUp != 0 { + glog.V(4).Infof("Interface %v is up", intf.Name) + return true + } + return false +} + +//getFinalIP method receives all the IP addrs of a Interface +//and returns a nil if the address is Loopback, Ipv6, link-local or nil. +//It returns a valid IPv4 if an Ipv4 address is found in the array. +func getFinalIP(addrs []net.Addr) (net.IP, error) { + if len(addrs) > 0 { + for i := range addrs { + glog.V(4).Infof("Checking addr %s.", addrs[i].String()) + ip, _, err := net.ParseCIDR(addrs[i].String()) + if err != nil { + return nil, err + } + //Only IPv4 + //TODO : add IPv6 support + if ip.To4() != nil { + if !ip.IsLoopback() && !ip.IsLinkLocalMulticast() && !ip.IsLinkLocalUnicast() { + glog.V(4).Infof("IP found %v", ip) + return ip, nil + } else { + glog.V(4).Infof("Loopback/link-local found %v", ip) + } + } else { + glog.V(4).Infof("%v is not a valid IPv4 address", ip) + } + + } + } + return nil, nil +} + +func getIPFromInterface(intfName string, nw networkInterfacer) (net.IP, error) { + intf, err := nw.InterfaceByName(intfName) + if err != nil { + return nil, err + } + if isInterfaceUp(intf) { + addrs, err := nw.Addrs(intf) + if err != nil { + return nil, err + } + glog.V(4).Infof("Interface %q has %d addresses :%v.", intfName, len(addrs), addrs) + finalIP, err := getFinalIP(addrs) + if err != nil { + return nil, err + } + if finalIP != nil { + glog.V(4).Infof("valid IPv4 address for interface %q found as %v.", intfName, finalIP) + return finalIP, nil + } + } + + return nil, nil +} + +func flagsSet(flags net.Flags, test net.Flags) bool { + return flags&test != 0 +} + +func flagsClear(flags net.Flags, test net.Flags) bool { + return flags&test == 0 +} + +func chooseHostInterfaceNativeGo() (net.IP, error) { + intfs, err := net.Interfaces() + if err != nil { + return nil, err + } + i := 0 + var ip net.IP + for i = range intfs { + if flagsSet(intfs[i].Flags, net.FlagUp) && flagsClear(intfs[i].Flags, net.FlagLoopback|net.FlagPointToPoint) { + addrs, err := intfs[i].Addrs() + if err != nil { + return nil, err + } + if len(addrs) > 0 { + for _, addr := range addrs { + if addrIP, _, err := net.ParseCIDR(addr.String()); err == nil { + if addrIP.To4() != nil { + ip = addrIP.To4() + if !ip.IsLinkLocalMulticast() && !ip.IsLinkLocalUnicast() { + break + } + } + } + } + if ip != nil { + // This interface should suffice. + break + } + } + } + } + if ip == nil { + return nil, fmt.Errorf("no acceptable interface from host") + } + glog.V(4).Infof("Choosing interface %s (IP %v) as default", intfs[i].Name, ip) + return ip, nil +} + +//ChooseHostInterface is a method used fetch an IP for a daemon. +//It uses data from /proc/net/route file. +//For a node with no internet connection ,it returns error +//For a multi n/w interface node it returns the IP of the interface with gateway on it. +func ChooseHostInterface() (net.IP, error) { + inFile, err := os.Open("/proc/net/route") + if err != nil { + if os.IsNotExist(err) { + return chooseHostInterfaceNativeGo() + } + return nil, err + } + defer inFile.Close() + var nw networkInterfacer = networkInterface{} + return chooseHostInterfaceFromRoute(inFile, nw) +} + +type networkInterfacer interface { + InterfaceByName(intfName string) (*net.Interface, error) + Addrs(intf *net.Interface) ([]net.Addr, error) +} + +type networkInterface struct{} + +func (_ networkInterface) InterfaceByName(intfName string) (*net.Interface, error) { + intf, err := net.InterfaceByName(intfName) + if err != nil { + return nil, err + } + return intf, nil +} + +func (_ networkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) { + addrs, err := intf.Addrs() + if err != nil { + return nil, err + } + return addrs, nil +} + +func chooseHostInterfaceFromRoute(inFile io.Reader, nw networkInterfacer) (net.IP, error) { + routes, err := getRoutes(inFile) + if err != nil { + return nil, err + } + zero := net.IP{0, 0, 0, 0} + var finalIP net.IP + for i := range routes { + //find interface with gateway + if routes[i].Destination.Equal(zero) { + glog.V(4).Infof("Default route transits interface %q", routes[i].Interface) + finalIP, err := getIPFromInterface(routes[i].Interface, nw) + if err != nil { + return nil, err + } + if finalIP != nil { + glog.V(4).Infof("Choosing IP %v ", finalIP) + return finalIP, nil + } + } + } + glog.V(4).Infof("No valid IP found") + if finalIP == nil { + return nil, fmt.Errorf("Unable to select an IP.") + } + return nil, nil +} + +// If bind-address is usable, return it directly +// If bind-address is not usable (unset, 0.0.0.0, or loopback), we will use the host's default +// interface. +func ChooseBindAddress(bindAddress net.IP) (net.IP, error) { + if bindAddress == nil || bindAddress.IsUnspecified() || bindAddress.IsLoopback() { + hostIP, err := ChooseHostInterface() + if err != nil { + return nil, err + } + bindAddress = hostIP + } + return bindAddress, nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/net/interface_test.go b/vendor/k8s.io/kubernetes/pkg/util/net/interface_test.go new file mode 100644 index 000000000..9571e5b48 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/net/interface_test.go @@ -0,0 +1,300 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package net + +import ( + "fmt" + "io" + "net" + "strings" + "testing" +) + +const gatewayfirst = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT +eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0 +eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 +docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 +virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 +` +const gatewaylast = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT +docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 +virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 +eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 +eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0 +` +const gatewaymiddle = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT +eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 +docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 +eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0 +virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 +` +const noInternetConnection = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT +docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 +virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 +` +const nothing = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT +` +const gatewayfirstIpv6_1 = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT +eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0 +eth3 0000FE0AA1 00000000 0001 0 0 0 0080FFFF 0 0 0 +docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 +virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 +` +const gatewayfirstIpv6_2 = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT +eth3 00000000 0100FE0AA1 0003 0 0 1024 00000000 0 0 0 +eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 +docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 +virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 +` +const route_Invalidhex = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT +eth3 00000000 0100FE0AA 0003 0 0 1024 00000000 0 0 0 +eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 +docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 +virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 +` + +// Based on DigitalOcean COREOS +const gatewayfirstLinkLocal = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT +eth0 00000000 0120372D 0001 0 0 0 00000000 0 0 0 +eth0 00000000 00000000 0001 0 0 2048 00000000 0 0 0 +` + +func TestGetRoutes(t *testing.T) { + testCases := []struct { + tcase string + route string + expected int + }{ + {"gatewayfirst", gatewayfirst, 4}, + {"gatewaymiddle", gatewaymiddle, 4}, + {"gatewaylast", gatewaylast, 4}, + {"nothing", nothing, 0}, + {"gatewayfirstIpv6_1", gatewayfirstIpv6_1, 0}, + {"gatewayfirstIpv6_2", gatewayfirstIpv6_2, 0}, + {"route_Invalidhex", route_Invalidhex, 0}, + } + for _, tc := range testCases { + r := strings.NewReader(tc.route) + routes, err := getRoutes(r) + if len(routes) != tc.expected { + t.Errorf("case[%v]: expected %v, got %v .err : %v", tc.tcase, tc.expected, len(routes), err) + } + } +} + +func TestParseIP(t *testing.T) { + testCases := []struct { + tcase string + ip string + success bool + expected net.IP + }{ + {"empty", "", false, nil}, + {"too short", "AA", false, nil}, + {"too long", "0011223344", false, nil}, + {"invalid", "invalid!", false, nil}, + {"zero", "00000000", true, net.IP{0, 0, 0, 0}}, + {"ffff", "FFFFFFFF", true, net.IP{0xff, 0xff, 0xff, 0xff}}, + {"valid", "12345678", true, net.IP{120, 86, 52, 18}}, + } + for _, tc := range testCases { + ip, err := parseIP(tc.ip) + if !ip.Equal(tc.expected) { + t.Errorf("case[%v]: expected %q, got %q . err : %v", tc.tcase, tc.expected, ip, err) + } + } +} + +func TestIsInterfaceUp(t *testing.T) { + testCases := []struct { + tcase string + intf net.Interface + expected bool + }{ + {"up", net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp}, true}, + {"down", net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: 0}, false}, + {"nothing", net.Interface{}, false}, + } + for _, tc := range testCases { + it := isInterfaceUp(&tc.intf) + if it != tc.expected { + t.Errorf("case[%v]: expected %v, got %v .", tc.tcase, tc.expected, it) + } + } +} + +type addrStruct struct{ val string } + +func (a addrStruct) Network() string { + return a.val +} +func (a addrStruct) String() string { + return a.val +} + +func TestFinalIP(t *testing.T) { + testCases := []struct { + tcase string + addr []net.Addr + expected net.IP + }{ + {"ipv6", []net.Addr{addrStruct{val: "fe80::2f7:6fff:fe6e:2956/64"}}, nil}, + {"invalidCIDR", []net.Addr{addrStruct{val: "fe80::2f7:67fff:fe6e:2956/64"}}, nil}, + {"loopback", []net.Addr{addrStruct{val: "127.0.0.1/24"}}, nil}, + {"ip4", []net.Addr{addrStruct{val: "10.254.12.132/17"}}, net.ParseIP("10.254.12.132")}, + + {"nothing", []net.Addr{}, nil}, + } + for _, tc := range testCases { + ip, err := getFinalIP(tc.addr) + if !ip.Equal(tc.expected) { + t.Errorf("case[%v]: expected %v, got %v .err : %v", tc.tcase, tc.expected, ip, err) + } + } +} + +func TestAddrs(t *testing.T) { + var nw networkInterfacer = validNetworkInterface{} + intf := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: 0} + addrs, err := nw.Addrs(&intf) + if err != nil { + t.Errorf("expected no error got : %v", err) + } + if len(addrs) != 2 { + t.Errorf("expected addrs: 2 got null") + } +} + +type validNetworkInterface struct { +} + +func (_ validNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) { + c := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp} + return &c, nil +} +func (_ validNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) { + var ifat []net.Addr + ifat = []net.Addr{ + addrStruct{val: "fe80::2f7:6fff:fe6e:2956/64"}, addrStruct{val: "10.254.71.145/17"}} + return ifat, nil +} + +type validNetworkInterfaceWithLinkLocal struct { +} + +func (_ validNetworkInterfaceWithLinkLocal) InterfaceByName(intfName string) (*net.Interface, error) { + c := net.Interface{Index: 0, MTU: 0, Name: "eth0", HardwareAddr: nil, Flags: net.FlagUp} + return &c, nil +} +func (_ validNetworkInterfaceWithLinkLocal) Addrs(intf *net.Interface) ([]net.Addr, error) { + var ifat []net.Addr + ifat = []net.Addr{addrStruct{val: "169.254.162.166/16"}, addrStruct{val: "45.55.47.146/19"}} + return ifat, nil +} + +type validNetworkInterfacewithIpv6Only struct { +} + +func (_ validNetworkInterfacewithIpv6Only) InterfaceByName(intfName string) (*net.Interface, error) { + c := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp} + return &c, nil +} +func (_ validNetworkInterfacewithIpv6Only) Addrs(intf *net.Interface) ([]net.Addr, error) { + var ifat []net.Addr + ifat = []net.Addr{addrStruct{val: "fe80::2f7:6fff:fe6e:2956/64"}} + return ifat, nil +} + +type noNetworkInterface struct { +} + +func (_ noNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) { + return nil, fmt.Errorf("unable get Interface") +} +func (_ noNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) { + return nil, nil +} + +type networkInterfacewithNoAddrs struct { +} + +func (_ networkInterfacewithNoAddrs) InterfaceByName(intfName string) (*net.Interface, error) { + c := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp} + return &c, nil +} +func (_ networkInterfacewithNoAddrs) Addrs(intf *net.Interface) ([]net.Addr, error) { + return nil, fmt.Errorf("unable get Addrs") +} + +type networkInterfacewithIpv6addrs struct { +} + +func (_ networkInterfacewithIpv6addrs) InterfaceByName(intfName string) (*net.Interface, error) { + c := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp} + return &c, nil +} +func (_ networkInterfacewithIpv6addrs) Addrs(intf *net.Interface) ([]net.Addr, error) { + var ifat []net.Addr + ifat = []net.Addr{addrStruct{val: "fe80::2f7:6ffff:fe6e:2956/64"}} + return ifat, nil +} + +func TestGetIPFromInterface(t *testing.T) { + testCases := []struct { + tcase string + nwname string + nw networkInterfacer + expected net.IP + }{ + {"valid", "eth3", validNetworkInterface{}, net.ParseIP("10.254.71.145")}, + {"ipv6", "eth3", validNetworkInterfacewithIpv6Only{}, nil}, + {"nothing", "eth3", noNetworkInterface{}, nil}, + } + for _, tc := range testCases { + ip, err := getIPFromInterface(tc.nwname, tc.nw) + if !ip.Equal(tc.expected) { + t.Errorf("case[%v]: expected %v, got %+v .err : %v", tc.tcase, tc.expected, ip, err) + } + } +} + +func TestChooseHostInterfaceFromRoute(t *testing.T) { + testCases := []struct { + tcase string + inFile io.Reader + nw networkInterfacer + expected net.IP + }{ + {"valid_routefirst", strings.NewReader(gatewayfirst), validNetworkInterface{}, net.ParseIP("10.254.71.145")}, + {"valid_routelast", strings.NewReader(gatewaylast), validNetworkInterface{}, net.ParseIP("10.254.71.145")}, + {"valid_routemiddle", strings.NewReader(gatewaymiddle), validNetworkInterface{}, net.ParseIP("10.254.71.145")}, + {"valid_routemiddle_ipv6", strings.NewReader(gatewaymiddle), validNetworkInterfacewithIpv6Only{}, nil}, + {"no internet connection", strings.NewReader(noInternetConnection), validNetworkInterface{}, nil}, + {"no non-link-local ip", strings.NewReader(gatewayfirstLinkLocal), validNetworkInterfaceWithLinkLocal{}, net.ParseIP("45.55.47.146")}, + {"no route", strings.NewReader(nothing), validNetworkInterface{}, nil}, + {"no route file", nil, validNetworkInterface{}, nil}, + {"no interfaces", nil, noNetworkInterface{}, nil}, + {"no interface Addrs", strings.NewReader(gatewaymiddle), networkInterfacewithNoAddrs{}, nil}, + {"Invalid Addrs", strings.NewReader(gatewaymiddle), networkInterfacewithIpv6addrs{}, nil}, + } + for _, tc := range testCases { + ip, err := chooseHostInterfaceFromRoute(tc.inFile, tc.nw) + if !ip.Equal(tc.expected) { + t.Errorf("case[%v]: expected %v, got %+v .err : %v", tc.tcase, tc.expected, ip, err) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/port_range.go b/vendor/k8s.io/kubernetes/pkg/util/net/port_range.go similarity index 92% rename from vendor/k8s.io/kubernetes/pkg/util/port_range.go rename to vendor/k8s.io/kubernetes/pkg/util/net/port_range.go index cfdde18af..527552571 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/port_range.go +++ b/vendor/k8s.io/kubernetes/pkg/util/net/port_range.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package net import ( "fmt" @@ -98,3 +98,11 @@ func ParsePortRange(value string) (*PortRange, error) { } return pr, nil } + +func ParsePortRangeOrDie(value string) *PortRange { + pr, err := ParsePortRange(value) + if err != nil { + panic(fmt.Sprintf("couldn't parse port range %q: %v", value, err)) + } + return pr +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/port_range_test.go b/vendor/k8s.io/kubernetes/pkg/util/net/port_range_test.go similarity index 99% rename from vendor/k8s.io/kubernetes/pkg/util/port_range_test.go rename to vendor/k8s.io/kubernetes/pkg/util/net/port_range_test.go index f43451969..9eb081aa7 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/port_range_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/net/port_range_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package net import ( "testing" diff --git a/vendor/k8s.io/kubernetes/pkg/util/port_split.go b/vendor/k8s.io/kubernetes/pkg/util/net/port_split.go similarity index 99% rename from vendor/k8s.io/kubernetes/pkg/util/port_split.go rename to vendor/k8s.io/kubernetes/pkg/util/net/port_split.go index 176271189..be40eb75f 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/port_split.go +++ b/vendor/k8s.io/kubernetes/pkg/util/net/port_split.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package net import ( "strings" diff --git a/vendor/k8s.io/kubernetes/pkg/util/port_split_test.go b/vendor/k8s.io/kubernetes/pkg/util/net/port_split_test.go similarity index 99% rename from vendor/k8s.io/kubernetes/pkg/util/port_split_test.go rename to vendor/k8s.io/kubernetes/pkg/util/net/port_split_test.go index 9d9e5fb0f..2e9e135c0 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/port_split_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/net/port_split_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package net import ( "testing" diff --git a/vendor/k8s.io/kubernetes/pkg/util/oom/oom_linux.go b/vendor/k8s.io/kubernetes/pkg/util/oom/oom_linux.go index c579d6805..5503bad8c 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/oom/oom_linux.go +++ b/vendor/k8s.io/kubernetes/pkg/util/oom/oom_linux.go @@ -21,12 +21,13 @@ package oom import ( "fmt" "io/ioutil" + "os" "path" "strconv" - "github.com/docker/libcontainer/cgroups/fs" - "github.com/docker/libcontainer/configs" "github.com/golang/glog" + "github.com/opencontainers/runc/libcontainer/cgroups/fs" + "github.com/opencontainers/runc/libcontainer/configs" ) func NewOOMAdjuster() *OOMAdjuster { @@ -41,13 +42,25 @@ func NewOOMAdjuster() *OOMAdjuster { func getPids(cgroupName string) ([]int, error) { fsManager := fs.Manager{ Cgroups: &configs.Cgroup{ - Name: cgroupName, + Parent: "/", + Name: cgroupName, }, } return fsManager.GetPids() } +func syscallNotExists(err error) bool { + if err == nil { + return false + } + if e, ok := err.(*os.SyscallError); ok && os.IsNotExist(e) { + return true + } + return false +} + // Writes 'value' to /proc//oom_score_adj. PID = 0 means self +// Returns os.ErrNotExist if the `pid` does not exist. func applyOOMScoreAdj(pid int, oomScoreAdj int) error { if pid < 0 { return fmt.Errorf("invalid PID %d specified for oom_score_adj", pid) @@ -60,20 +73,18 @@ func applyOOMScoreAdj(pid int, oomScoreAdj int) error { pidStr = strconv.Itoa(pid) } - oomScoreAdjPath := path.Join("/proc", pidStr, "oom_score_adj") maxTries := 2 + oomScoreAdjPath := path.Join("/proc", pidStr, "oom_score_adj") + value := strconv.Itoa(oomScoreAdj) var err error for i := 0; i < maxTries; i++ { - _, readErr := ioutil.ReadFile(oomScoreAdjPath) - if readErr != nil { - err = fmt.Errorf("failed to read oom_score_adj: %v", readErr) - } else if writeErr := ioutil.WriteFile(oomScoreAdjPath, []byte(strconv.Itoa(oomScoreAdj)), 0700); writeErr != nil { - err = fmt.Errorf("failed to set oom_score_adj to %d: %v", oomScoreAdj, writeErr) - } else { - return nil + if err = ioutil.WriteFile(oomScoreAdjPath, []byte(value), 0700); err != nil { + if syscallNotExists(err) { + return os.ErrNotExist + } + err = fmt.Errorf("failed to apply oom-score-adj to pid %d (%v)", err) } } - return err } @@ -85,6 +96,10 @@ func (oomAdjuster *OOMAdjuster) applyOOMScoreAdjContainer(cgroupName string, oom continueAdjusting := false pidList, err := oomAdjuster.pidLister(cgroupName) if err != nil { + if syscallNotExists(err) { + // Nothing to do since the container doesn't exist anymore. + return os.ErrNotExist + } continueAdjusting = true glog.Errorf("Error getting process list for cgroup %s: %+v", cgroupName, err) } else if len(pidList) == 0 { @@ -96,6 +111,7 @@ func (oomAdjuster *OOMAdjuster) applyOOMScoreAdjContainer(cgroupName string, oom if err = oomAdjuster.ApplyOOMScoreAdj(pid, oomScoreAdj); err == nil { adjustedProcessSet[pid] = true } + // Processes can come and go while we try to apply oom score adjust value. So ignore errors here. } } } diff --git a/vendor/k8s.io/kubernetes/pkg/util/operationmanager/operationmanager.go b/vendor/k8s.io/kubernetes/pkg/util/operationmanager/operationmanager.go deleted file mode 100644 index 39ff24857..000000000 --- a/vendor/k8s.io/kubernetes/pkg/util/operationmanager/operationmanager.go +++ /dev/null @@ -1,103 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package operationmanager - -import ( - "fmt" - "sync" -) - -// Operation Manager is a thread-safe interface for keeping track of multiple pending async operations. -type OperationManager interface { - // Called when the operation with the given ID has started. - // Creates a new channel with specified buffer size tracked with the specified ID. - // Returns a read-only version of the newly created channel. - // Returns an error if an entry with the specified ID already exists (previous entry must be removed by calling Close). - Start(id string, bufferSize uint) (<-chan interface{}, error) - - // Called when the operation with the given ID has terminated. - // Closes and removes the channel associated with ID. - // Returns an error if no associated channel exists. - Close(id string) error - - // Attempts to send msg to the channel associated with ID. - // Returns an error if no associated channel exists. - Send(id string, msg interface{}) error - - // Returns true if an entry with the specified ID already exists. - Exists(id string) bool -} - -// Returns a new instance of a channel manager. -func NewOperationManager() OperationManager { - return &operationManager{ - chanMap: make(map[string]chan interface{}), - } -} - -type operationManager struct { - sync.RWMutex - chanMap map[string]chan interface{} -} - -// Called when the operation with the given ID has started. -// Creates a new channel with specified buffer size tracked with the specified ID. -// Returns a read-only version of the newly created channel. -// Returns an error if an entry with the specified ID already exists (previous entry must be removed by calling Close). -func (cm *operationManager) Start(id string, bufferSize uint) (<-chan interface{}, error) { - cm.Lock() - defer cm.Unlock() - if _, exists := cm.chanMap[id]; exists { - return nil, fmt.Errorf("id %q already exists", id) - } - cm.chanMap[id] = make(chan interface{}, bufferSize) - return cm.chanMap[id], nil -} - -// Called when the operation with the given ID has terminated. -// Closes and removes the channel associated with ID. -// Returns an error if no associated channel exists. -func (cm *operationManager) Close(id string) error { - cm.Lock() - defer cm.Unlock() - if _, exists := cm.chanMap[id]; !exists { - return fmt.Errorf("id %q not found", id) - } - close(cm.chanMap[id]) - delete(cm.chanMap, id) - return nil -} - -// Attempts to send msg to the channel associated with ID. -// Returns an error if no associated channel exists. -func (cm *operationManager) Send(id string, msg interface{}) error { - cm.RLock() - defer cm.RUnlock() - if _, exists := cm.chanMap[id]; !exists { - return fmt.Errorf("id %q not found", id) - } - cm.chanMap[id] <- msg - return nil -} - -// Returns true if an entry with the specified ID already exists. -func (cm *operationManager) Exists(id string) (exists bool) { - cm.RLock() - defer cm.RUnlock() - _, exists = cm.chanMap[id] - return -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/operationmanager/operationmanager_test.go b/vendor/k8s.io/kubernetes/pkg/util/operationmanager/operationmanager_test.go deleted file mode 100644 index ac1d4db34..000000000 --- a/vendor/k8s.io/kubernetes/pkg/util/operationmanager/operationmanager_test.go +++ /dev/null @@ -1,159 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Channel Manager keeps track of multiple channels -package operationmanager - -import ( - "testing" -) - -func TestStart(t *testing.T) { - // Arrange - cm := NewOperationManager() - chanId := "testChanId" - testMsg := "test message" - - // Act - ch, startErr := cm.Start(chanId, 1 /* bufferSize */) - sigErr := cm.Send(chanId, testMsg) - - // Assert - verifyNoError(t, startErr, "Start") - verifyNoError(t, sigErr, "Send") - actualMsg := <-ch - verifyMsg(t, testMsg /* expected */, actualMsg.(string) /* actual */) -} - -func TestStartIdExists(t *testing.T) { - // Arrange - cm := NewOperationManager() - chanId := "testChanId" - - // Act - _, startErr1 := cm.Start(chanId, 1 /* bufferSize */) - _, startErr2 := cm.Start(chanId, 1 /* bufferSize */) - - // Assert - verifyNoError(t, startErr1, "Start1") - verifyError(t, startErr2, "Start2") -} - -func TestStartAndAdd2Chans(t *testing.T) { - // Arrange - cm := NewOperationManager() - chanId1 := "testChanId1" - chanId2 := "testChanId2" - testMsg1 := "test message 1" - testMsg2 := "test message 2" - - // Act - ch1, startErr1 := cm.Start(chanId1, 1 /* bufferSize */) - ch2, startErr2 := cm.Start(chanId2, 1 /* bufferSize */) - sigErr1 := cm.Send(chanId1, testMsg1) - sigErr2 := cm.Send(chanId2, testMsg2) - - // Assert - verifyNoError(t, startErr1, "Start1") - verifyNoError(t, startErr2, "Start2") - verifyNoError(t, sigErr1, "Send1") - verifyNoError(t, sigErr2, "Send2") - actualMsg1 := <-ch1 - actualMsg2 := <-ch2 - verifyMsg(t, testMsg1 /* expected */, actualMsg1.(string) /* actual */) - verifyMsg(t, testMsg2 /* expected */, actualMsg2.(string) /* actual */) -} - -func TestStartAndAdd2ChansAndClose(t *testing.T) { - // Arrange - cm := NewOperationManager() - chanId1 := "testChanId1" - chanId2 := "testChanId2" - testMsg1 := "test message 1" - testMsg2 := "test message 2" - - // Act - ch1, startErr1 := cm.Start(chanId1, 1 /* bufferSize */) - ch2, startErr2 := cm.Start(chanId2, 1 /* bufferSize */) - sigErr1 := cm.Send(chanId1, testMsg1) - sigErr2 := cm.Send(chanId2, testMsg2) - cm.Close(chanId1) - sigErr3 := cm.Send(chanId1, testMsg1) - - // Assert - verifyNoError(t, startErr1, "Start1") - verifyNoError(t, startErr2, "Start2") - verifyNoError(t, sigErr1, "Send1") - verifyNoError(t, sigErr2, "Send2") - verifyError(t, sigErr3, "Send3") - actualMsg1 := <-ch1 - actualMsg2 := <-ch2 - verifyMsg(t, testMsg1 /* expected */, actualMsg1.(string) /* actual */) - verifyMsg(t, testMsg2 /* expected */, actualMsg2.(string) /* actual */) -} - -func TestExists(t *testing.T) { - // Arrange - cm := NewOperationManager() - chanId1 := "testChanId1" - chanId2 := "testChanId2" - - // Act & Assert - verifyExists(t, cm, chanId1, false /* expected */) - verifyExists(t, cm, chanId2, false /* expected */) - - _, startErr1 := cm.Start(chanId1, 1 /* bufferSize */) - verifyNoError(t, startErr1, "Start1") - verifyExists(t, cm, chanId1, true /* expected */) - verifyExists(t, cm, chanId2, false /* expected */) - - _, startErr2 := cm.Start(chanId2, 1 /* bufferSize */) - verifyNoError(t, startErr2, "Start2") - verifyExists(t, cm, chanId1, true /* expected */) - verifyExists(t, cm, chanId2, true /* expected */) - - cm.Close(chanId1) - verifyExists(t, cm, chanId1, false /* expected */) - verifyExists(t, cm, chanId2, true /* expected */) - - cm.Close(chanId2) - verifyExists(t, cm, chanId1, false /* expected */) - verifyExists(t, cm, chanId2, false /* expected */) -} - -func verifyExists(t *testing.T, cm OperationManager, id string, expected bool) { - if actual := cm.Exists(id); expected != actual { - t.Fatalf("Unexpected Exists(%q) response. Expected: <%v> Actual: <%v>", id, expected, actual) - } -} - -func verifyNoError(t *testing.T, err error, name string) { - if err != nil { - t.Fatalf("Unexpected response on %q. Expected: Actual: <%v>", name, err) - } -} - -func verifyError(t *testing.T, err error, name string) { - if err == nil { - t.Fatalf("Unexpected response on %q. Expected: Actual: ", name) - } -} - -func verifyMsg(t *testing.T, expected, actual string) { - if actual != expected { - t.Fatalf("Unexpected testMsg value. Expected: <%v> Actual: <%v>", expected, actual) - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/parsers/parsers.go b/vendor/k8s.io/kubernetes/pkg/util/parsers/parsers.go new file mode 100644 index 000000000..f7c352ef5 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/parsers/parsers.go @@ -0,0 +1,36 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package parsers + +import ( + "github.com/docker/docker/pkg/parsers" +) + +const ( + defaultImageTag = "latest" +) + +// parseImageName parses a docker image string into two parts: repo and tag. +// If tag is empty, return the defaultImageTag. +func ParseImageName(image string) (string, string) { + repoToPull, tag := parsers.ParseRepositoryTag(image) + // If no tag was specified, use the default "latest". + if len(tag) == 0 { + tag = defaultImageTag + } + return repoToPull, tag +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/pod/doc.go b/vendor/k8s.io/kubernetes/pkg/util/pod/doc.go new file mode 100644 index 000000000..3bad7d0b7 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/pod/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package pod provides utilities to work with Kubernetes pod and pod templates. +package pod diff --git a/vendor/k8s.io/kubernetes/pkg/util/pod/pod.go b/vendor/k8s.io/kubernetes/pkg/util/pod/pod.go new file mode 100644 index 000000000..576b0cdab --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/pod/pod.go @@ -0,0 +1,30 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pod + +import ( + "hash/adler32" + + "k8s.io/kubernetes/pkg/api" + hashutil "k8s.io/kubernetes/pkg/util/hash" +) + +func GetPodTemplateSpecHash(template api.PodTemplateSpec) uint32 { + podTemplateSpecHasher := adler32.New() + hashutil.DeepHashObject(podTemplateSpecHasher, template) + return podTemplateSpecHasher.Sum32() +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs.go b/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs.go index 22dd1470c..cc432255f 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs.go +++ b/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs.go @@ -19,15 +19,16 @@ package procfs import ( "fmt" "io/ioutil" + "os" "path" "strconv" "strings" ) -type ProcFs struct{} +type ProcFS struct{} -func NewProcFs() ProcFsInterface { - return &ProcFs{} +func NewProcFS() ProcFSInterface { + return &ProcFS{} } func containerNameFromProcCgroup(content string) (string, error) { @@ -44,10 +45,13 @@ func containerNameFromProcCgroup(content string) (string, error) { // getFullContainerName gets the container name given the root process id of the container. // Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx, // return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy. -func (pfs *ProcFs) GetFullContainerName(pid int) (string, error) { +func (pfs *ProcFS) GetFullContainerName(pid int) (string, error) { filePath := path.Join("/proc", strconv.Itoa(pid), "cgroup") content, err := ioutil.ReadFile(filePath) if err != nil { + if e, ok := err.(*os.SyscallError); ok && os.IsNotExist(e) { + return "", os.ErrNotExist + } return "", err } return containerNameFromProcCgroup(string(content)) diff --git a/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs_fake.go b/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs_fake.go index b002a9d98..8d16aa53c 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs_fake.go +++ b/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs_fake.go @@ -16,15 +16,15 @@ limitations under the License. package procfs -type FakeProcFs struct{} +type FakeProcFS struct{} -func NewFakeProcFs() ProcFsInterface { - return &FakeProcFs{} +func NewFakeProcFS() ProcFSInterface { + return &FakeProcFS{} } -// getFullContainerName gets the container name given the root process id of the container. +// GetFullContainerName gets the container name given the root process id of the container. // Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx, // return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy. -func (fakePfs *FakeProcFs) GetFullContainerName(pid int) (string, error) { +func (fakePfs *FakeProcFS) GetFullContainerName(pid int) (string, error) { return "", nil } diff --git a/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs_interface.go b/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs_interface.go index b776443db..d3bf14f0c 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs_interface.go +++ b/vendor/k8s.io/kubernetes/pkg/util/procfs/procfs_interface.go @@ -16,7 +16,7 @@ limitations under the License. package procfs -type ProcFsInterface interface { - // getFullContainerName gets the container name given the root process id of the container. +type ProcFSInterface interface { + // GetFullContainerName gets the container name given the root process id of the container. GetFullContainerName(pid int) (string, error) } diff --git a/vendor/k8s.io/kubernetes/pkg/util/proxy/dial.go b/vendor/k8s.io/kubernetes/pkg/util/proxy/dial.go index 07982b793..33cecb7ea 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/proxy/dial.go +++ b/vendor/k8s.io/kubernetes/pkg/util/proxy/dial.go @@ -25,14 +25,14 @@ import ( "github.com/golang/glog" - "k8s.io/kubernetes/pkg/util" + utilnet "k8s.io/kubernetes/pkg/util/net" "k8s.io/kubernetes/third_party/golang/netutil" ) func DialURL(url *url.URL, transport http.RoundTripper) (net.Conn, error) { dialAddr := netutil.CanonicalAddr(url) - dialer, _ := util.Dialer(transport) + dialer, _ := utilnet.Dialer(transport) switch url.Scheme { case "http": @@ -45,7 +45,7 @@ func DialURL(url *url.URL, transport http.RoundTripper) (net.Conn, error) { var tlsConfig *tls.Config var tlsConn *tls.Conn var err error - tlsConfig, _ = util.TLSClientConfig(transport) + tlsConfig, _ = utilnet.TLSClientConfig(transport) if dialer != nil { // We have a dialer; use it to open the connection, then diff --git a/vendor/k8s.io/kubernetes/pkg/util/proxy/transport.go b/vendor/k8s.io/kubernetes/pkg/util/proxy/transport.go index c869fe528..079670c0a 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/proxy/transport.go +++ b/vendor/k8s.io/kubernetes/pkg/util/proxy/transport.go @@ -31,7 +31,7 @@ import ( "golang.org/x/net/html" "golang.org/x/net/html/atom" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/net" "k8s.io/kubernetes/pkg/util/sets" ) @@ -123,7 +123,7 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { return t.rewriteResponse(req, resp) } -var _ = util.RoundTripperWrapper(&Transport{}) +var _ = net.RoundTripperWrapper(&Transport{}) func (rt *Transport) WrappedRoundTripper() http.RoundTripper { return rt.RoundTripper diff --git a/vendor/k8s.io/kubernetes/pkg/util/proxy/transport_test.go b/vendor/k8s.io/kubernetes/pkg/util/proxy/transport_test.go index fca115526..5a71bb1b5 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/proxy/transport_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/proxy/transport_test.go @@ -219,7 +219,8 @@ func TestProxyTransport(t *testing.T) { w.Header().Set("Content-Type", item.contentType) fmt.Fprint(w, item.input) })) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() // Replace source URL with our test server address. sourceURL := parseURLOrDie(item.sourceURL) diff --git a/vendor/k8s.io/kubernetes/pkg/util/rand/rand.go b/vendor/k8s.io/kubernetes/pkg/util/rand/rand.go index 4da9f6da0..fe3065066 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/rand/rand.go +++ b/vendor/k8s.io/kubernetes/pkg/util/rand/rand.go @@ -32,19 +32,12 @@ var rng = struct { rand: rand.New(rand.NewSource(time.Now().UTC().UnixNano())), } -// String generates a random alphanumeric string n characters long. This will -// panic if n is less than zero. -func String(n int) string { - if n < 0 { - panic("out-of-bounds value") - } - b := make([]rune, n) +// Intn generates an integer in range 0->max. +// By design this should panic if input is invalid, <= 0. +func Intn(max int) int { rng.Lock() defer rng.Unlock() - for i := range b { - b[i] = letters[rng.rand.Intn(numLetters)] - } - return string(b) + return rng.rand.Intn(max) } // Seed seeds the rng with the provided seed. @@ -62,3 +55,13 @@ func Perm(n int) []int { defer rng.Unlock() return rng.rand.Perm(n) } + +// String generates a random alphanumeric string n characters long. This will +// panic if n is less than zero. +func String(length int) string { + b := make([]rune, length) + for i := range b { + b[i] = letters[Intn(numLetters)] + } + return string(b) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/rand/rand_test.go b/vendor/k8s.io/kubernetes/pkg/util/rand/rand_test.go index 5ad109a3f..cc56e0d3d 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/rand/rand_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/rand/rand_test.go @@ -37,6 +37,27 @@ func TestString(t *testing.T) { } } +// Confirm that panic occurs on invalid input. +func TestRangePanic(t *testing.T) { + defer func() { + if err := recover(); err == nil { + t.Errorf("Panic didn't occur!") + } + }() + // Should result in an error... + Intn(0) +} + +func TestIntn(t *testing.T) { + // 0 is invalid. + for _, max := range []int{1, 2, 10, 123} { + inrange := Intn(max) + if inrange < 0 || inrange > max { + t.Errorf("%v out of range (0,%v)", inrange, max) + } + } +} + func TestPerm(t *testing.T) { Seed(5) rand.Seed(5) diff --git a/vendor/k8s.io/kubernetes/pkg/util/resource_container_linux.go b/vendor/k8s.io/kubernetes/pkg/util/resource_container_linux.go index 161de74a7..8d166045e 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/resource_container_linux.go +++ b/vendor/k8s.io/kubernetes/pkg/util/resource_container_linux.go @@ -22,8 +22,8 @@ import ( "os" "syscall" - "github.com/docker/libcontainer/cgroups/fs" - "github.com/docker/libcontainer/configs" + "github.com/opencontainers/runc/libcontainer/cgroups/fs" + "github.com/opencontainers/runc/libcontainer/configs" ) // Creates resource-only containerName if it does not already exist and moves @@ -33,8 +33,11 @@ import ( func RunInResourceContainer(containerName string) error { manager := fs.Manager{ Cgroups: &configs.Cgroup{ - Name: containerName, - AllowAllDevices: true, + Parent: "/", + Name: containerName, + Resources: &configs.Resources{ + AllowAllDevices: true, + }, }, } diff --git a/vendor/k8s.io/kubernetes/pkg/util/runtime/runtime.go b/vendor/k8s.io/kubernetes/pkg/util/runtime/runtime.go new file mode 100644 index 000000000..76d7cb464 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/runtime/runtime.go @@ -0,0 +1,78 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package runtime + +import ( + "fmt" + "github.com/golang/glog" + "runtime" +) + +// For testing, bypass HandleCrash. +var ReallyCrash bool + +// PanicHandlers is a list of functions which will be invoked when a panic happens. +var PanicHandlers = []func(interface{}){logPanic} + +//TODO search the public functions +// HandleCrash simply catches a crash and logs an error. Meant to be called via defer. +// Additional context-specific handlers can be provided, and will be called in case of panic +func HandleCrash(additionalHandlers ...func(interface{})) { + if ReallyCrash { + return + } + if r := recover(); r != nil { + for _, fn := range PanicHandlers { + fn(r) + } + for _, fn := range additionalHandlers { + fn(r) + } + } +} + +// logPanic logs the caller tree when a panic occurs. +func logPanic(r interface{}) { + callers := "" + for i := 0; true; i++ { + _, file, line, ok := runtime.Caller(i) + if !ok { + break + } + callers = callers + fmt.Sprintf("%v:%v\n", file, line) + } + glog.Errorf("Recovered from panic: %#v (%v)\n%v", r, r, callers) +} + +// ErrorHandlers is a list of functions which will be invoked when an unreturnable +// error occurs. +var ErrorHandlers = []func(error){logError} + +// HandlerError is a method to invoke when a non-user facing piece of code cannot +// return an error and needs to indicate it has been ignored. Invoking this method +// is preferable to logging the error - the default behavior is to log but the +// errors may be sent to a remote server for analysis. +func HandleError(err error) { + for _, fn := range ErrorHandlers { + fn(err) + } +} + +// logError prints an error with the call stack of the location it was reported +func logError(err error) { + glog.ErrorDepth(2, err) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/runtime/runtime_test.go b/vendor/k8s.io/kubernetes/pkg/util/runtime/runtime_test.go new file mode 100644 index 000000000..83a07d04d --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/runtime/runtime_test.go @@ -0,0 +1,69 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package runtime + +import ( + "fmt" + "testing" +) + +func TestHandleCrash(t *testing.T) { + count := 0 + expect := 10 + for i := 0; i < expect; i = i + 1 { + defer HandleCrash() + if i%2 == 0 { + panic("Test Panic") + } + count = count + 1 + } + if count != expect { + t.Errorf("Expected %d iterations, found %d", expect, count) + } +} +func TestCustomHandleCrash(t *testing.T) { + old := PanicHandlers + defer func() { PanicHandlers = old }() + var result interface{} + PanicHandlers = []func(interface{}){ + func(r interface{}) { + result = r + }, + } + func() { + defer HandleCrash() + panic("test") + }() + if result != "test" { + t.Errorf("did not receive custom handler") + } +} +func TestCustomHandleError(t *testing.T) { + old := ErrorHandlers + defer func() { ErrorHandlers = old }() + var result error + ErrorHandlers = []func(error){ + func(err error) { + result = err + }, + } + err := fmt.Errorf("test") + HandleError(err) + if result != err { + t.Errorf("did not receive custom handler") + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/selinux/doc.go b/vendor/k8s.io/kubernetes/pkg/util/selinux/doc.go new file mode 100644 index 000000000..9b9901504 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/selinux/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package selinux contains selinux utility functions. +package selinux diff --git a/vendor/k8s.io/kubernetes/pkg/api/latest/doc.go b/vendor/k8s.io/kubernetes/pkg/util/selinux/selinux.go similarity index 65% rename from vendor/k8s.io/kubernetes/pkg/api/latest/doc.go rename to vendor/k8s.io/kubernetes/pkg/util/selinux/selinux.go index 5028e2e27..a1ae9dfb8 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/latest/doc.go +++ b/vendor/k8s.io/kubernetes/pkg/util/selinux/selinux.go @@ -14,8 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package latest defines the default output serializations that code should -// use and imports the required schemas. It also ensures all previously known -// and supported API versions are available for conversion. Consumers may -// import this package in lieu of importing individual versions. -package latest +package selinux + +// chconRunner knows how to chcon a directory. +type ChconRunner interface { + SetContext(dir, context string) error +} + +// newChconRunner returns a new chconRunner. +func NewChconRunner() ChconRunner { + return &realChconRunner{} +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/selinux/selinux_linux.go b/vendor/k8s.io/kubernetes/pkg/util/selinux/selinux_linux.go new file mode 100644 index 000000000..78b0817b8 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/selinux/selinux_linux.go @@ -0,0 +1,34 @@ +// +build linux + +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package selinux + +import ( + "github.com/opencontainers/runc/libcontainer/selinux" +) + +type realChconRunner struct{} + +func (_ *realChconRunner) SetContext(dir, context string) error { + // If SELinux is not enabled, return an empty string + if !selinux.SelinuxEnabled() { + return nil + } + + return selinux.Setfilecon(dir, context) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/selinux/selinux_unsupported.go b/vendor/k8s.io/kubernetes/pkg/util/selinux/selinux_unsupported.go new file mode 100644 index 000000000..08d531133 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/selinux/selinux_unsupported.go @@ -0,0 +1,26 @@ +// +build !linux + +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package selinux + +type realChconRunner struct{} + +func (_ *realChconRunner) SetContext(dir, context string) error { + // NOP + return nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/sets/byte.go b/vendor/k8s.io/kubernetes/pkg/util/sets/byte.go new file mode 100644 index 000000000..fe1068cdf --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/sets/byte.go @@ -0,0 +1,194 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by set-gen. Do not edit it manually! + +package sets + +import ( + "reflect" + "sort" +) + +// sets.Byte is a set of bytes, implemented via map[byte]struct{} for minimal memory consumption. +type Byte map[byte]Empty + +// New creates a Byte from a list of values. +func NewByte(items ...byte) Byte { + ss := Byte{} + ss.Insert(items...) + return ss +} + +// ByteKeySet creates a Byte from a keys of a map[byte](? extends interface{}). +// If the value passed in is not actually a map, this will panic. +func ByteKeySet(theMap interface{}) Byte { + v := reflect.ValueOf(theMap) + ret := Byte{} + + for _, keyValue := range v.MapKeys() { + ret.Insert(keyValue.Interface().(byte)) + } + return ret +} + +// Insert adds items to the set. +func (s Byte) Insert(items ...byte) { + for _, item := range items { + s[item] = Empty{} + } +} + +// Delete removes all items from the set. +func (s Byte) Delete(items ...byte) { + for _, item := range items { + delete(s, item) + } +} + +// Has returns true if and only if item is contained in the set. +func (s Byte) Has(item byte) bool { + _, contained := s[item] + return contained +} + +// HasAll returns true if and only if all items are contained in the set. +func (s Byte) HasAll(items ...byte) bool { + for _, item := range items { + if !s.Has(item) { + return false + } + } + return true +} + +// HasAny returns true if any items are contained in the set. +func (s Byte) HasAny(items ...byte) bool { + for _, item := range items { + if s.Has(item) { + return true + } + } + return false +} + +// Difference returns a set of objects that are not in s2 +// For example: +// s1 = {a1, a2, a3} +// s2 = {a1, a2, a4, a5} +// s1.Difference(s2) = {a3} +// s2.Difference(s1) = {a4, a5} +func (s Byte) Difference(s2 Byte) Byte { + result := NewByte() + for key := range s { + if !s2.Has(key) { + result.Insert(key) + } + } + return result +} + +// Union returns a new set which includes items in either s1 or s2. +// For example: +// s1 = {a1, a2} +// s2 = {a3, a4} +// s1.Union(s2) = {a1, a2, a3, a4} +// s2.Union(s1) = {a1, a2, a3, a4} +func (s1 Byte) Union(s2 Byte) Byte { + result := NewByte() + for key := range s1 { + result.Insert(key) + } + for key := range s2 { + result.Insert(key) + } + return result +} + +// Intersection returns a new set which includes the item in BOTH s1 and s2 +// For example: +// s1 = {a1, a2} +// s2 = {a2, a3} +// s1.Intersection(s2) = {a2} +func (s1 Byte) Intersection(s2 Byte) Byte { + var walk, other Byte + result := NewByte() + if s1.Len() < s2.Len() { + walk = s1 + other = s2 + } else { + walk = s2 + other = s1 + } + for key := range walk { + if other.Has(key) { + result.Insert(key) + } + } + return result +} + +// IsSuperset returns true if and only if s1 is a superset of s2. +func (s1 Byte) IsSuperset(s2 Byte) bool { + for item := range s2 { + if !s1.Has(item) { + return false + } + } + return true +} + +// Equal returns true if and only if s1 is equal (as a set) to s2. +// Two sets are equal if their membership is identical. +// (In practice, this means same elements, order doesn't matter) +func (s1 Byte) Equal(s2 Byte) bool { + return len(s1) == len(s2) && s1.IsSuperset(s2) +} + +type sortableSliceOfByte []byte + +func (s sortableSliceOfByte) Len() int { return len(s) } +func (s sortableSliceOfByte) Less(i, j int) bool { return lessByte(s[i], s[j]) } +func (s sortableSliceOfByte) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// List returns the contents as a sorted byte slice. +func (s Byte) List() []byte { + res := make(sortableSliceOfByte, 0, len(s)) + for key := range s { + res = append(res, key) + } + sort.Sort(res) + return []byte(res) +} + +// Returns a single element from the set. +func (s Byte) PopAny() (byte, bool) { + for key := range s { + s.Delete(key) + return key, true + } + var zeroValue byte + return zeroValue, false +} + +// Len returns the size of the set. +func (s Byte) Len() int { + return len(s) +} + +func lessByte(lhs, rhs byte) bool { + return lhs < rhs +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/sets/doc.go b/vendor/k8s.io/kubernetes/pkg/util/sets/doc.go new file mode 100644 index 000000000..a27cb62f5 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/sets/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by set-gen. Do not edit it manually! + +// Package sets has auto-generated set types. +package sets diff --git a/vendor/k8s.io/kubernetes/pkg/util/sets/empty.go b/vendor/k8s.io/kubernetes/pkg/util/sets/empty.go new file mode 100644 index 000000000..73ac74c14 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/sets/empty.go @@ -0,0 +1,23 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by set-gen. Do not edit it manually! + +package sets + +// Empty is public since it is used by some internal API objects for conversions between external +// string arrays and internal sets, and conversion logic requires public types today. +type Empty struct{} diff --git a/vendor/k8s.io/kubernetes/pkg/util/sets/int.go b/vendor/k8s.io/kubernetes/pkg/util/sets/int.go new file mode 100644 index 000000000..e7a2b5db1 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/sets/int.go @@ -0,0 +1,194 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by set-gen. Do not edit it manually! + +package sets + +import ( + "reflect" + "sort" +) + +// sets.Int is a set of ints, implemented via map[int]struct{} for minimal memory consumption. +type Int map[int]Empty + +// New creates a Int from a list of values. +func NewInt(items ...int) Int { + ss := Int{} + ss.Insert(items...) + return ss +} + +// IntKeySet creates a Int from a keys of a map[int](? extends interface{}). +// If the value passed in is not actually a map, this will panic. +func IntKeySet(theMap interface{}) Int { + v := reflect.ValueOf(theMap) + ret := Int{} + + for _, keyValue := range v.MapKeys() { + ret.Insert(keyValue.Interface().(int)) + } + return ret +} + +// Insert adds items to the set. +func (s Int) Insert(items ...int) { + for _, item := range items { + s[item] = Empty{} + } +} + +// Delete removes all items from the set. +func (s Int) Delete(items ...int) { + for _, item := range items { + delete(s, item) + } +} + +// Has returns true if and only if item is contained in the set. +func (s Int) Has(item int) bool { + _, contained := s[item] + return contained +} + +// HasAll returns true if and only if all items are contained in the set. +func (s Int) HasAll(items ...int) bool { + for _, item := range items { + if !s.Has(item) { + return false + } + } + return true +} + +// HasAny returns true if any items are contained in the set. +func (s Int) HasAny(items ...int) bool { + for _, item := range items { + if s.Has(item) { + return true + } + } + return false +} + +// Difference returns a set of objects that are not in s2 +// For example: +// s1 = {a1, a2, a3} +// s2 = {a1, a2, a4, a5} +// s1.Difference(s2) = {a3} +// s2.Difference(s1) = {a4, a5} +func (s Int) Difference(s2 Int) Int { + result := NewInt() + for key := range s { + if !s2.Has(key) { + result.Insert(key) + } + } + return result +} + +// Union returns a new set which includes items in either s1 or s2. +// For example: +// s1 = {a1, a2} +// s2 = {a3, a4} +// s1.Union(s2) = {a1, a2, a3, a4} +// s2.Union(s1) = {a1, a2, a3, a4} +func (s1 Int) Union(s2 Int) Int { + result := NewInt() + for key := range s1 { + result.Insert(key) + } + for key := range s2 { + result.Insert(key) + } + return result +} + +// Intersection returns a new set which includes the item in BOTH s1 and s2 +// For example: +// s1 = {a1, a2} +// s2 = {a2, a3} +// s1.Intersection(s2) = {a2} +func (s1 Int) Intersection(s2 Int) Int { + var walk, other Int + result := NewInt() + if s1.Len() < s2.Len() { + walk = s1 + other = s2 + } else { + walk = s2 + other = s1 + } + for key := range walk { + if other.Has(key) { + result.Insert(key) + } + } + return result +} + +// IsSuperset returns true if and only if s1 is a superset of s2. +func (s1 Int) IsSuperset(s2 Int) bool { + for item := range s2 { + if !s1.Has(item) { + return false + } + } + return true +} + +// Equal returns true if and only if s1 is equal (as a set) to s2. +// Two sets are equal if their membership is identical. +// (In practice, this means same elements, order doesn't matter) +func (s1 Int) Equal(s2 Int) bool { + return len(s1) == len(s2) && s1.IsSuperset(s2) +} + +type sortableSliceOfInt []int + +func (s sortableSliceOfInt) Len() int { return len(s) } +func (s sortableSliceOfInt) Less(i, j int) bool { return lessInt(s[i], s[j]) } +func (s sortableSliceOfInt) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// List returns the contents as a sorted int slice. +func (s Int) List() []int { + res := make(sortableSliceOfInt, 0, len(s)) + for key := range s { + res = append(res, key) + } + sort.Sort(res) + return []int(res) +} + +// Returns a single element from the set. +func (s Int) PopAny() (int, bool) { + for key := range s { + s.Delete(key) + return key, true + } + var zeroValue int + return zeroValue, false +} + +// Len returns the size of the set. +func (s Int) Len() int { + return len(s) +} + +func lessInt(lhs, rhs int) bool { + return lhs < rhs +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/sets/int64.go b/vendor/k8s.io/kubernetes/pkg/util/sets/int64.go new file mode 100644 index 000000000..f31da7750 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/sets/int64.go @@ -0,0 +1,194 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by set-gen. Do not edit it manually! + +package sets + +import ( + "reflect" + "sort" +) + +// sets.Int64 is a set of int64s, implemented via map[int64]struct{} for minimal memory consumption. +type Int64 map[int64]Empty + +// New creates a Int64 from a list of values. +func NewInt64(items ...int64) Int64 { + ss := Int64{} + ss.Insert(items...) + return ss +} + +// Int64KeySet creates a Int64 from a keys of a map[int64](? extends interface{}). +// If the value passed in is not actually a map, this will panic. +func Int64KeySet(theMap interface{}) Int64 { + v := reflect.ValueOf(theMap) + ret := Int64{} + + for _, keyValue := range v.MapKeys() { + ret.Insert(keyValue.Interface().(int64)) + } + return ret +} + +// Insert adds items to the set. +func (s Int64) Insert(items ...int64) { + for _, item := range items { + s[item] = Empty{} + } +} + +// Delete removes all items from the set. +func (s Int64) Delete(items ...int64) { + for _, item := range items { + delete(s, item) + } +} + +// Has returns true if and only if item is contained in the set. +func (s Int64) Has(item int64) bool { + _, contained := s[item] + return contained +} + +// HasAll returns true if and only if all items are contained in the set. +func (s Int64) HasAll(items ...int64) bool { + for _, item := range items { + if !s.Has(item) { + return false + } + } + return true +} + +// HasAny returns true if any items are contained in the set. +func (s Int64) HasAny(items ...int64) bool { + for _, item := range items { + if s.Has(item) { + return true + } + } + return false +} + +// Difference returns a set of objects that are not in s2 +// For example: +// s1 = {a1, a2, a3} +// s2 = {a1, a2, a4, a5} +// s1.Difference(s2) = {a3} +// s2.Difference(s1) = {a4, a5} +func (s Int64) Difference(s2 Int64) Int64 { + result := NewInt64() + for key := range s { + if !s2.Has(key) { + result.Insert(key) + } + } + return result +} + +// Union returns a new set which includes items in either s1 or s2. +// For example: +// s1 = {a1, a2} +// s2 = {a3, a4} +// s1.Union(s2) = {a1, a2, a3, a4} +// s2.Union(s1) = {a1, a2, a3, a4} +func (s1 Int64) Union(s2 Int64) Int64 { + result := NewInt64() + for key := range s1 { + result.Insert(key) + } + for key := range s2 { + result.Insert(key) + } + return result +} + +// Intersection returns a new set which includes the item in BOTH s1 and s2 +// For example: +// s1 = {a1, a2} +// s2 = {a2, a3} +// s1.Intersection(s2) = {a2} +func (s1 Int64) Intersection(s2 Int64) Int64 { + var walk, other Int64 + result := NewInt64() + if s1.Len() < s2.Len() { + walk = s1 + other = s2 + } else { + walk = s2 + other = s1 + } + for key := range walk { + if other.Has(key) { + result.Insert(key) + } + } + return result +} + +// IsSuperset returns true if and only if s1 is a superset of s2. +func (s1 Int64) IsSuperset(s2 Int64) bool { + for item := range s2 { + if !s1.Has(item) { + return false + } + } + return true +} + +// Equal returns true if and only if s1 is equal (as a set) to s2. +// Two sets are equal if their membership is identical. +// (In practice, this means same elements, order doesn't matter) +func (s1 Int64) Equal(s2 Int64) bool { + return len(s1) == len(s2) && s1.IsSuperset(s2) +} + +type sortableSliceOfInt64 []int64 + +func (s sortableSliceOfInt64) Len() int { return len(s) } +func (s sortableSliceOfInt64) Less(i, j int) bool { return lessInt64(s[i], s[j]) } +func (s sortableSliceOfInt64) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// List returns the contents as a sorted int64 slice. +func (s Int64) List() []int64 { + res := make(sortableSliceOfInt64, 0, len(s)) + for key := range s { + res = append(res, key) + } + sort.Sort(res) + return []int64(res) +} + +// Returns a single element from the set. +func (s Int64) PopAny() (int64, bool) { + for key := range s { + s.Delete(key) + return key, true + } + var zeroValue int64 + return zeroValue, false +} + +// Len returns the size of the set. +func (s Int64) Len() int { + return len(s) +} + +func lessInt64(lhs, rhs int64) bool { + return lhs < rhs +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/sets/set.go b/vendor/k8s.io/kubernetes/pkg/util/sets/string.go similarity index 70% rename from vendor/k8s.io/kubernetes/pkg/util/sets/set.go rename to vendor/k8s.io/kubernetes/pkg/util/sets/string.go index 5ac72017e..572aa9157 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/sets/set.go +++ b/vendor/k8s.io/kubernetes/pkg/util/sets/string.go @@ -1,5 +1,5 @@ /* -Copyright 2014 The Kubernetes Authors All rights reserved. +Copyright 2016 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +// This file was autogenerated by set-gen. Do not edit it manually! + package sets import ( @@ -21,29 +23,25 @@ import ( "sort" ) -// Empty is public since it is used by some internal API objects for conversions between external -// string arrays and internal sets, and conversion logic requires public types today. -type Empty struct{} - -// StringSet is a set of strings, implemented via map[string]struct{} for minimal memory consumption. +// sets.String is a set of strings, implemented via map[string]struct{} for minimal memory consumption. type String map[string]Empty -// New creates a StringSet from a list of values. +// New creates a String from a list of values. func NewString(items ...string) String { ss := String{} ss.Insert(items...) return ss } -// KeySet creates a StringSet from a keys of a map[string](? extends interface{}). Since you can't describe that map type in the Go type system -// the reflected value is required. -func KeySet(theMap reflect.Value) String { +// StringKeySet creates a String from a keys of a map[string](? extends interface{}). +// If the value passed in is not actually a map, this will panic. +func StringKeySet(theMap interface{}) String { + v := reflect.ValueOf(theMap) ret := String{} - for _, keyValue := range theMap.MapKeys() { - ret.Insert(keyValue.String()) + for _, keyValue := range v.MapKeys() { + ret.Insert(keyValue.Interface().(string)) } - return ret } @@ -89,10 +87,10 @@ func (s String) HasAny(items ...string) bool { // Difference returns a set of objects that are not in s2 // For example: -// s1 = {1, 2, 3} -// s2 = {1, 2, 4, 5} -// s1.Difference(s2) = {3} -// s2.Difference(s1) = {4, 5} +// s1 = {a1, a2, a3} +// s2 = {a1, a2, a4, a5} +// s1.Difference(s2) = {a3} +// s2.Difference(s1) = {a4, a5} func (s String) Difference(s2 String) String { result := NewString() for key := range s { @@ -104,12 +102,11 @@ func (s String) Difference(s2 String) String { } // Union returns a new set which includes items in either s1 or s2. -// vof objects that are not in s2 // For example: -// s1 = {1, 2} -// s2 = {3, 4} -// s1.Union(s2) = {1, 2, 3, 4} -// s2.Union(s1) = {1, 2, 3, 4} +// s1 = {a1, a2} +// s2 = {a3, a4} +// s1.Union(s2) = {a1, a2, a3, a4} +// s2.Union(s1) = {a1, a2, a3, a4} func (s1 String) Union(s2 String) String { result := NewString() for key := range s1 { @@ -123,9 +120,9 @@ func (s1 String) Union(s2 String) String { // Intersection returns a new set which includes the item in BOTH s1 and s2 // For example: -// s1 = {1, 2} -// s2 = {2, 3} -// s1.Intersection(s2) = {2} +// s1 = {a1, a2} +// s2 = {a2, a3} +// s1.Intersection(s2) = {a2} func (s1 String) Intersection(s2 String) String { var walk, other String result := NewString() @@ -158,25 +155,23 @@ func (s1 String) IsSuperset(s2 String) bool { // Two sets are equal if their membership is identical. // (In practice, this means same elements, order doesn't matter) func (s1 String) Equal(s2 String) bool { - if len(s1) != len(s2) { - return false - } - for item := range s2 { - if !s1.Has(item) { - return false - } - } - return true + return len(s1) == len(s2) && s1.IsSuperset(s2) } +type sortableSliceOfString []string + +func (s sortableSliceOfString) Len() int { return len(s) } +func (s sortableSliceOfString) Less(i, j int) bool { return lessString(s[i], s[j]) } +func (s sortableSliceOfString) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + // List returns the contents as a sorted string slice. func (s String) List() []string { - res := make([]string, 0, len(s)) + res := make(sortableSliceOfString, 0, len(s)) for key := range s { res = append(res, key) } - sort.StringSlice(res).Sort() - return res + sort.Sort(res) + return []string(res) } // Returns a single element from the set. @@ -185,10 +180,15 @@ func (s String) PopAny() (string, bool) { s.Delete(key) return key, true } - return "", false + var zeroValue string + return zeroValue, false } // Len returns the size of the set. func (s String) Len() int { return len(s) } + +func lessString(lhs, rhs string) bool { + return lhs < rhs +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/sets/types/types.go b/vendor/k8s.io/kubernetes/pkg/util/sets/types/types.go new file mode 100644 index 000000000..4e98d28f6 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/sets/types/types.go @@ -0,0 +1,30 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package types just provides input types to the set generator. It also +// contains a "go generate" block. (You must first `go install` +// cmd/libs/go2idl/set-gen.) +package types + +//go:generate set-gen -i k8s.io/kubernetes/pkg/util/sets/types + +type ReferenceSetTypes struct { + // These types all cause files to be generated + a int64 + b int + c byte + d string +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/ssh.go b/vendor/k8s.io/kubernetes/pkg/util/ssh.go deleted file mode 100644 index cdbd67bc3..000000000 --- a/vendor/k8s.io/kubernetes/pkg/util/ssh.go +++ /dev/null @@ -1,365 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package util - -import ( - "bytes" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "errors" - "fmt" - "io" - "io/ioutil" - mathrand "math/rand" - "net" - "os" - "time" - - "github.com/golang/glog" - "github.com/prometheus/client_golang/prometheus" - "golang.org/x/crypto/ssh" -) - -var ( - tunnelOpenCounter = prometheus.NewCounter( - prometheus.CounterOpts{ - Name: "ssh_tunnel_open_count", - Help: "Counter of ssh tunnel total open attempts", - }, - ) - tunnelOpenFailCounter = prometheus.NewCounter( - prometheus.CounterOpts{ - Name: "ssh_tunnel_open_fail_count", - Help: "Counter of ssh tunnel failed open attempts", - }, - ) -) - -func init() { - prometheus.MustRegister(tunnelOpenCounter) - prometheus.MustRegister(tunnelOpenFailCounter) -} - -// TODO: Unit tests for this code, we can spin up a test SSH server with instructions here: -// https://godoc.org/golang.org/x/crypto/ssh#ServerConn -type SSHTunnel struct { - Config *ssh.ClientConfig - Host string - SSHPort string - running bool - sock net.Listener - client *ssh.Client -} - -func (s *SSHTunnel) copyBytes(out io.Writer, in io.Reader) { - if _, err := io.Copy(out, in); err != nil { - glog.Errorf("Error in SSH tunnel: %v", err) - } -} - -func NewSSHTunnel(user, keyfile, host string) (*SSHTunnel, error) { - signer, err := MakePrivateKeySignerFromFile(keyfile) - if err != nil { - return nil, err - } - return makeSSHTunnel(user, signer, host) -} - -func NewSSHTunnelFromBytes(user string, privateKey []byte, host string) (*SSHTunnel, error) { - signer, err := MakePrivateKeySignerFromBytes(privateKey) - if err != nil { - return nil, err - } - return makeSSHTunnel(user, signer, host) -} - -func makeSSHTunnel(user string, signer ssh.Signer, host string) (*SSHTunnel, error) { - config := ssh.ClientConfig{ - User: user, - Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)}, - } - return &SSHTunnel{ - Config: &config, - Host: host, - SSHPort: "22", - }, nil -} - -func (s *SSHTunnel) Open() error { - var err error - s.client, err = ssh.Dial("tcp", net.JoinHostPort(s.Host, s.SSHPort), s.Config) - tunnelOpenCounter.Inc() - if err != nil { - tunnelOpenFailCounter.Inc() - return err - } - return nil -} - -func (s *SSHTunnel) Dial(network, address string) (net.Conn, error) { - if s.client == nil { - return nil, errors.New("tunnel is not opened.") - } - return s.client.Dial(network, address) -} - -func (s *SSHTunnel) tunnel(conn net.Conn, remoteHost, remotePort string) error { - if s.client == nil { - return errors.New("tunnel is not opened.") - } - tunnel, err := s.client.Dial("tcp", net.JoinHostPort(remoteHost, remotePort)) - if err != nil { - return err - } - go s.copyBytes(tunnel, conn) - go s.copyBytes(conn, tunnel) - return nil -} - -func (s *SSHTunnel) Close() error { - if s.client == nil { - return errors.New("Cannot close tunnel. Tunnel was not opened.") - } - if err := s.client.Close(); err != nil { - return err - } - return nil -} - -// Interface to allow mocking of ssh.Dial, for testing SSH -type sshDialer interface { - Dial(network, addr string, config *ssh.ClientConfig) (*ssh.Client, error) -} - -// Real implementation of sshDialer -type realSSHDialer struct{} - -var _ sshDialer = &realSSHDialer{} - -func (d *realSSHDialer) Dial(network, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { - return ssh.Dial(network, addr, config) -} - -// RunSSHCommand returns the stdout, stderr, and exit code from running cmd on -// host as specific user, along with any SSH-level error. -// If user=="", it will default (like SSH) to os.Getenv("USER") -func RunSSHCommand(cmd, user, host string, signer ssh.Signer) (string, string, int, error) { - return runSSHCommand(&realSSHDialer{}, cmd, user, host, signer) -} - -// Internal implementation of runSSHCommand, for testing -func runSSHCommand(dialer sshDialer, cmd, user, host string, signer ssh.Signer) (string, string, int, error) { - if user == "" { - user = os.Getenv("USER") - } - // Setup the config, dial the server, and open a session. - config := &ssh.ClientConfig{ - User: user, - Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)}, - } - client, err := dialer.Dial("tcp", host, config) - if err != nil { - return "", "", 0, fmt.Errorf("error getting SSH client to %s@%s: '%v'", user, host, err) - } - session, err := client.NewSession() - if err != nil { - return "", "", 0, fmt.Errorf("error creating session to %s@%s: '%v'", user, host, err) - } - defer session.Close() - - // Run the command. - code := 0 - var bout, berr bytes.Buffer - session.Stdout, session.Stderr = &bout, &berr - if err = session.Run(cmd); err != nil { - // Check whether the command failed to run or didn't complete. - if exiterr, ok := err.(*ssh.ExitError); ok { - // If we got an ExitError and the exit code is nonzero, we'll - // consider the SSH itself successful (just that the command run - // errored on the host). - if code = exiterr.ExitStatus(); code != 0 { - err = nil - } - } else { - // Some other kind of error happened (e.g. an IOError); consider the - // SSH unsuccessful. - err = fmt.Errorf("failed running `%s` on %s@%s: '%v'", cmd, user, host, err) - } - } - return bout.String(), berr.String(), code, err -} - -func MakePrivateKeySignerFromFile(key string) (ssh.Signer, error) { - // Create an actual signer. - buffer, err := ioutil.ReadFile(key) - if err != nil { - return nil, fmt.Errorf("error reading SSH key %s: '%v'", key, err) - } - return MakePrivateKeySignerFromBytes(buffer) -} - -func MakePrivateKeySignerFromBytes(buffer []byte) (ssh.Signer, error) { - signer, err := ssh.ParsePrivateKey(buffer) - if err != nil { - return nil, fmt.Errorf("error parsing SSH key %s: '%v'", buffer, err) - } - return signer, nil -} - -func ParsePublicKeyFromFile(keyFile string) (*rsa.PublicKey, error) { - buffer, err := ioutil.ReadFile(keyFile) - if err != nil { - return nil, fmt.Errorf("error reading SSH key %s: '%v'", keyFile, err) - } - keyBlock, _ := pem.Decode(buffer) - key, err := x509.ParsePKIXPublicKey(keyBlock.Bytes) - if err != nil { - return nil, fmt.Errorf("error parsing SSH key %s: '%v'", keyFile, err) - } - rsaKey, ok := key.(*rsa.PublicKey) - if !ok { - return nil, fmt.Errorf("SSH key could not be parsed as rsa public key") - } - return rsaKey, nil -} - -// Should be thread safe. -type SSHTunnelEntry struct { - Address string - Tunnel *SSHTunnel -} - -// Not thread safe! -type SSHTunnelList struct { - entries []SSHTunnelEntry -} - -func MakeSSHTunnels(user, keyfile string, addresses []string) *SSHTunnelList { - tunnels := []SSHTunnelEntry{} - for ix := range addresses { - addr := addresses[ix] - tunnel, err := NewSSHTunnel(user, keyfile, addr) - if err != nil { - glog.Errorf("Failed to create tunnel for %q: %v", addr, err) - continue - } - tunnels = append(tunnels, SSHTunnelEntry{addr, tunnel}) - } - return &SSHTunnelList{tunnels} -} - -// Open attempts to open all tunnels in the list, and removes any tunnels that -// failed to open. -func (l *SSHTunnelList) Open() error { - var openTunnels []SSHTunnelEntry - for ix := range l.entries { - if err := l.entries[ix].Tunnel.Open(); err != nil { - glog.Errorf("Failed to open tunnel %v: %v", l.entries[ix], err) - } else { - openTunnels = append(openTunnels, l.entries[ix]) - } - } - l.entries = openTunnels - if len(l.entries) == 0 { - return errors.New("Failed to open any tunnels.") - } - return nil -} - -// Close asynchronously closes all tunnels in the list after waiting for 1 -// minute. Tunnels will still be open upon this function's return, but should -// no longer be used. -func (l *SSHTunnelList) Close() { - for ix := range l.entries { - entry := l.entries[ix] - go func() { - defer HandleCrash() - time.Sleep(1 * time.Minute) - if err := entry.Tunnel.Close(); err != nil { - glog.Errorf("Failed to close tunnel %v: %v", entry, err) - } - }() - } -} - -/* this will make sense if we move the lock into SSHTunnelList. -func (l *SSHTunnelList) Dial(network, addr string) (net.Conn, error) { - if len(l.entries) == 0 { - return nil, fmt.Errorf("empty tunnel list.") - } - n := mathrand.Intn(len(l.entries)) - return l.entries[n].Tunnel.Dial(network, addr) -} -*/ - -// Returns a random tunnel, xor an error if there are none. -func (l *SSHTunnelList) PickRandomTunnel() (SSHTunnelEntry, error) { - if len(l.entries) == 0 { - return SSHTunnelEntry{}, fmt.Errorf("empty tunnel list.") - } - n := mathrand.Intn(len(l.entries)) - return l.entries[n], nil -} - -func (l *SSHTunnelList) Has(addr string) bool { - for ix := range l.entries { - if l.entries[ix].Address == addr { - return true - } - } - return false -} - -func (l *SSHTunnelList) Len() int { - return len(l.entries) -} - -func EncodePrivateKey(private *rsa.PrivateKey) []byte { - return pem.EncodeToMemory(&pem.Block{ - Bytes: x509.MarshalPKCS1PrivateKey(private), - Type: "RSA PRIVATE KEY", - }) -} - -func EncodePublicKey(public *rsa.PublicKey) ([]byte, error) { - publicBytes, err := x509.MarshalPKIXPublicKey(public) - if err != nil { - return nil, err - } - return pem.EncodeToMemory(&pem.Block{ - Bytes: publicBytes, - Type: "PUBLIC KEY", - }), nil -} - -func EncodeSSHKey(public *rsa.PublicKey) ([]byte, error) { - publicKey, err := ssh.NewPublicKey(public) - if err != nil { - return nil, err - } - return ssh.MarshalAuthorizedKey(publicKey), nil -} - -func GenerateKey(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error) { - private, err := rsa.GenerateKey(rand.Reader, bits) - if err != nil { - return nil, nil, err - } - return private, &private.PublicKey, nil -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/ssh_test.go b/vendor/k8s.io/kubernetes/pkg/util/ssh_test.go deleted file mode 100644 index 74dc8a82b..000000000 --- a/vendor/k8s.io/kubernetes/pkg/util/ssh_test.go +++ /dev/null @@ -1,245 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package util - -import ( - "fmt" - "io" - "net" - "os" - "reflect" - "strings" - "testing" - - "github.com/golang/glog" - "golang.org/x/crypto/ssh" -) - -type testSSHServer struct { - Host string - Port string - Type string - Data []byte - PrivateKey []byte - PublicKey []byte -} - -func runTestSSHServer(user, password string) (*testSSHServer, error) { - result := &testSSHServer{} - // Largely derived from https://godoc.org/golang.org/x/crypto/ssh#example-NewServerConn - config := &ssh.ServerConfig{ - PasswordCallback: func(c ssh.ConnMetadata, pass []byte) (*ssh.Permissions, error) { - if c.User() == user && string(pass) == password { - return nil, nil - } - return nil, fmt.Errorf("password rejected for %s", c.User()) - }, - PublicKeyCallback: func(c ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) { - result.Type = key.Type() - result.Data = ssh.MarshalAuthorizedKey(key) - return nil, nil - }, - } - - privateKey, publicKey, err := GenerateKey(2048) - if err != nil { - return nil, err - } - privateBytes := EncodePrivateKey(privateKey) - signer, err := ssh.ParsePrivateKey(privateBytes) - if err != nil { - return nil, err - } - config.AddHostKey(signer) - result.PrivateKey = privateBytes - - publicBytes, err := EncodePublicKey(publicKey) - if err != nil { - return nil, err - } - result.PublicKey = publicBytes - - listener, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - return nil, err - } - - host, port, err := net.SplitHostPort(listener.Addr().String()) - if err != nil { - return nil, err - } - result.Host = host - result.Port = port - go func() { - // TODO: return this port. - defer listener.Close() - - conn, err := listener.Accept() - if err != nil { - glog.Errorf("Failed to accept: %v", err) - } - _, chans, reqs, err := ssh.NewServerConn(conn, config) - if err != nil { - glog.Errorf("Failed handshake: %v", err) - } - go ssh.DiscardRequests(reqs) - for newChannel := range chans { - if newChannel.ChannelType() != "direct-tcpip" { - newChannel.Reject(ssh.UnknownChannelType, fmt.Sprintf("unknown channel type: %s", newChannel.ChannelType())) - continue - } - channel, requests, err := newChannel.Accept() - if err != nil { - glog.Errorf("Failed to accept channel: %v", err) - } - - for req := range requests { - glog.Infof("Got request: %v", req) - } - - channel.Close() - } - }() - return result, nil -} - -func TestSSHTunnel(t *testing.T) { - private, public, err := GenerateKey(2048) - if err != nil { - t.Errorf("unexpected error: %v", err) - t.FailNow() - } - server, err := runTestSSHServer("foo", "bar") - if err != nil { - t.Errorf("unexpected error: %v", err) - t.FailNow() - } - - privateData := EncodePrivateKey(private) - tunnel, err := NewSSHTunnelFromBytes("foo", privateData, server.Host) - if err != nil { - t.Errorf("unexpected error: %v", err) - t.FailNow() - } - tunnel.SSHPort = server.Port - - if err := tunnel.Open(); err != nil { - t.Errorf("unexpected error: %v", err) - t.FailNow() - } - - _, err = tunnel.Dial("tcp", "127.0.0.1:8080") - if err != nil { - t.Errorf("unexpected error: %v", err) - } - if server.Type != "ssh-rsa" { - t.Errorf("expected %s, got %s", "ssh-rsa", server.Type) - } - - publicData, err := EncodeSSHKey(public) - if err != nil { - t.Errorf("unexpected error: %v", err) - } - if !reflect.DeepEqual(server.Data, publicData) { - t.Errorf("expected %s, got %s", string(server.Data), string(privateData)) - } - - if err := tunnel.Close(); err != nil { - t.Errorf("unexpected error: %v", err) - } -} - -type mockSSHDialer struct { - network string - addr string - config *ssh.ClientConfig -} - -func (d *mockSSHDialer) Dial(network, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { - d.network = network - d.addr = addr - d.config = config - return nil, fmt.Errorf("mock error from Dial") -} - -type mockSigner struct { -} - -func (s *mockSigner) PublicKey() ssh.PublicKey { - panic("mockSigner.PublicKey not implemented") -} - -func (s *mockSigner) Sign(rand io.Reader, data []byte) (*ssh.Signature, error) { - panic("mockSigner.Sign not implemented") -} - -func TestSSHUser(t *testing.T) { - signer := &mockSigner{} - - table := []struct { - title string - user string - host string - signer ssh.Signer - command string - expectUser string - }{ - { - title: "all values provided", - user: "testuser", - host: "testhost", - signer: signer, - command: "uptime", - expectUser: "testuser", - }, - { - title: "empty user defaults to GetEnv(USER)", - user: "", - host: "testhost", - signer: signer, - command: "uptime", - expectUser: os.Getenv("USER"), - }, - } - - for _, item := range table { - dialer := &mockSSHDialer{} - - _, _, _, err := runSSHCommand(dialer, item.command, item.user, item.host, item.signer) - if err == nil { - t.Errorf("expected error (as mock returns error); did not get one") - } - errString := err.Error() - if !strings.HasPrefix(errString, fmt.Sprintf("error getting SSH client to %s@%s:", item.expectUser, item.host)) { - t.Errorf("unexpected error: %v", errString) - } - - if dialer.network != "tcp" { - t.Errorf("unexpected network: %v", dialer.network) - } - - if dialer.config.User != item.expectUser { - t.Errorf("unexpected user: %v", dialer.config.User) - } - if len(dialer.config.Auth) != 1 { - t.Errorf("unexpected auth: %v", dialer.config.Auth) - } - // (No way to test Auth - nothing exported?) - - } - -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/strategicpatch/patch.go b/vendor/k8s.io/kubernetes/pkg/util/strategicpatch/patch.go index 0ff10ec78..effb8f9ae 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/strategicpatch/patch.go +++ b/vendor/k8s.io/kubernetes/pkg/util/strategicpatch/patch.go @@ -23,6 +23,9 @@ import ( "sort" forkedjson "k8s.io/kubernetes/third_party/forked/json" + + "github.com/davecgh/go-spew/spew" + "github.com/ghodss/yaml" ) // An alternate implementation of JSON Merge Patch @@ -66,8 +69,8 @@ type errConflict struct { message string } -func newErrConflict(patch, current []byte) errConflict { - s := fmt.Sprintf("patch:\n%s\nconflicts with current:\n%s\n", patch, current) +func newErrConflict(patch, current string) errConflict { + s := fmt.Sprintf("patch:\n%s\nconflicts with changes made from original to current:\n%s\n", patch, current) return errConflict{s} } @@ -113,7 +116,7 @@ func CreateStrategicMergePatch(original, modified []byte, dataStruct interface{} } // CreateTwoWayMergePatch creates a patch that can be passed to StrategicMergePatch from an original -// document and a modified documernt, which are passed to the method as json encoded content. It will +// document and a modified document, which are passed to the method as json encoded content. It will // return a patch that yields the modified document when applied to the original document, or an error // if either of the two documents is invalid. func CreateTwoWayMergePatch(original, modified []byte, dataStruct interface{}, fns ...PreconditionFunc) ([]byte, error) { @@ -331,7 +334,7 @@ loopB: } var errNoMergeKeyFmt = "map: %v does not contain declared merge key: %s" -var errBadArgTypeFmt = "expected a %s, but received a %t" +var errBadArgTypeFmt = "expected a %s, but received a %s" // Returns a (recursive) strategic merge patch that yields modified when applied to original, // for a pair of lists of maps with merge semantics. @@ -354,7 +357,8 @@ loopB: for ; modifiedIndex < len(modifiedSorted); modifiedIndex++ { modifiedMap, ok := modifiedSorted[modifiedIndex].(map[string]interface{}) if !ok { - return nil, fmt.Errorf(errBadArgTypeFmt, "map[string]interface{}", modifiedSorted[modifiedIndex]) + t := reflect.TypeOf(modifiedSorted[modifiedIndex]) + return nil, fmt.Errorf(errBadArgTypeFmt, "map[string]interface{}", t.Kind().String()) } modifiedValue, ok := modifiedMap[mergeKey] @@ -365,7 +369,8 @@ loopB: for ; originalIndex < len(originalSorted); originalIndex++ { originalMap, ok := originalSorted[originalIndex].(map[string]interface{}) if !ok { - return nil, fmt.Errorf(errBadArgTypeFmt, "map[string]interface{}", originalSorted[originalIndex]) + t := reflect.TypeOf(originalSorted[originalIndex]) + return nil, fmt.Errorf(errBadArgTypeFmt, "map[string]interface{}", t.Kind().String()) } originalValue, ok := originalMap[mergeKey] @@ -411,7 +416,8 @@ loopB: for ; originalIndex < len(originalSorted); originalIndex++ { originalMap, ok := originalSorted[originalIndex].(map[string]interface{}) if !ok { - return nil, fmt.Errorf(errBadArgTypeFmt, "map[string]interface{}", originalSorted[originalIndex]) + t := reflect.TypeOf(originalSorted[originalIndex]) + return nil, fmt.Errorf(errBadArgTypeFmt, "map[string]interface{}", t.Kind().String()) } originalValue, ok := originalMap[mergeKey] @@ -444,11 +450,11 @@ func StrategicMergePatchData(original, patch []byte, dataStruct interface{}) ([] // by calling CreateStrategicMergePatch. func StrategicMergePatch(original, patch []byte, dataStruct interface{}) ([]byte, error) { if original == nil { - original = []byte{} + original = []byte("{}") } if patch == nil { - patch = []byte{} + patch = []byte("{}") } originalMap := map[string]interface{}{} @@ -926,7 +932,8 @@ func sliceElementType(slices ...[]interface{}) (reflect.Type, error) { // HasConflicts returns true if the left and right JSON interface objects overlap with // different values in any key. All keys are required to be strings. Since patches of the -// same Type have congruent keys, this is valid for multiple patch types. +// same Type have congruent keys, this is valid for multiple patch types. This method +// supports JSON merge patch semantics. func HasConflicts(left, right interface{}) (bool, error) { switch typedLeft := left.(type) { case map[string]interface{}: @@ -939,6 +946,7 @@ func HasConflicts(left, right interface{}) (bool, error) { } return HasConflicts(leftValue, rightValue) } + return false, nil default: return true, nil @@ -949,9 +957,11 @@ func HasConflicts(left, right interface{}) (bool, error) { if len(typedLeft) != len(typedRight) { return true, nil } + for i := range typedLeft { return HasConflicts(typedLeft[i], typedRight[i]) } + return false, nil default: return true, nil @@ -963,14 +973,184 @@ func HasConflicts(left, right interface{}) (bool, error) { } } +// MergingMapsHaveConflicts returns true if the left and right JSON interface +// objects overlap with different values in any key. All keys are required to be +// strings. Since patches of the same Type have congruent keys, this is valid +// for multiple patch types. This method supports strategic merge patch semantics. +func MergingMapsHaveConflicts(left, right map[string]interface{}, dataStruct interface{}) (bool, error) { + t, err := getTagStructType(dataStruct) + if err != nil { + return true, err + } + + return mergingMapFieldsHaveConflicts(left, right, t, "", "") +} + +func mergingMapFieldsHaveConflicts( + left, right interface{}, + fieldType reflect.Type, + fieldPatchStrategy, fieldPatchMergeKey string, +) (bool, error) { + switch leftType := left.(type) { + case map[string]interface{}: + switch rightType := right.(type) { + case map[string]interface{}: + leftMarker, okLeft := leftType[directiveMarker] + rightMarker, okRight := rightType[directiveMarker] + // if one or the other has a directive marker, + // then we need to consider that before looking at the individual keys, + // since a directive operates on the whole map. + if okLeft || okRight { + // if one has a directive marker and the other doesn't, + // then we have a conflict, since one is deleting or replacing the whole map, + // and the other is doing things to individual keys. + if okLeft != okRight { + return true, nil + } + + // if they both have markers, but they are not the same directive, + // then we have a conflict because they're doing different things to the map. + if leftMarker != rightMarker { + return true, nil + } + } + + // Check the individual keys. + return mapsHaveConflicts(leftType, rightType, fieldType) + default: + return true, nil + } + case []interface{}: + switch rightType := right.(type) { + case []interface{}: + return slicesHaveConflicts(leftType, rightType, fieldType, fieldPatchStrategy, fieldPatchMergeKey) + default: + return true, nil + } + case string, float64, bool, int, int64, nil: + return !reflect.DeepEqual(left, right), nil + default: + return true, fmt.Errorf("unknown type: %v", reflect.TypeOf(left)) + } +} + +func mapsHaveConflicts(typedLeft, typedRight map[string]interface{}, structType reflect.Type) (bool, error) { + for key, leftValue := range typedLeft { + if key != directiveMarker { + if rightValue, ok := typedRight[key]; ok { + fieldType, fieldPatchStrategy, fieldPatchMergeKey, err := forkedjson.LookupPatchMetadata(structType, key) + if err != nil { + return true, err + } + + if hasConflicts, err := mergingMapFieldsHaveConflicts(leftValue, rightValue, + fieldType, fieldPatchStrategy, fieldPatchMergeKey); hasConflicts { + return true, err + } + } + } + } + + return false, nil +} + +func slicesHaveConflicts( + typedLeft, typedRight []interface{}, + fieldType reflect.Type, + fieldPatchStrategy, fieldPatchMergeKey string, +) (bool, error) { + elementType, err := sliceElementType(typedLeft, typedRight) + if err != nil { + return true, err + } + + valueType := fieldType.Elem() + if fieldPatchStrategy == mergeDirective { + // Merging lists of scalars have no conflicts by definition + // So we only need to check further if the elements are maps + if elementType.Kind() != reflect.Map { + return false, nil + } + + // Build a map for each slice and then compare the two maps + leftMap, err := sliceOfMapsToMapOfMaps(typedLeft, fieldPatchMergeKey) + if err != nil { + return true, err + } + + rightMap, err := sliceOfMapsToMapOfMaps(typedRight, fieldPatchMergeKey) + if err != nil { + return true, err + } + + return mapsOfMapsHaveConflicts(leftMap, rightMap, valueType) + } + + // Either we don't have type information, or these are non-merging lists + if len(typedLeft) != len(typedRight) { + return true, nil + } + + // Sort scalar slices to prevent ordering issues + // We have no way to sort non-merging lists of maps + if elementType.Kind() != reflect.Map { + typedLeft = uniqifyAndSortScalars(typedLeft) + typedRight = uniqifyAndSortScalars(typedRight) + } + + // Compare the slices element by element in order + // This test will fail if the slices are not sorted + for i := range typedLeft { + if hasConflicts, err := mergingMapFieldsHaveConflicts(typedLeft[i], typedRight[i], valueType, "", ""); hasConflicts { + return true, err + } + } + + return false, nil +} + +func sliceOfMapsToMapOfMaps(slice []interface{}, mergeKey string) (map[string]interface{}, error) { + result := make(map[string]interface{}, len(slice)) + for _, value := range slice { + typedValue, ok := value.(map[string]interface{}) + if !ok { + return nil, fmt.Errorf("invalid element type in merging list:%v", slice) + } + + mergeValue, ok := typedValue[mergeKey] + if !ok { + return nil, fmt.Errorf("cannot find merge key `%s` in merging list element:%v", mergeKey, typedValue) + } + + result[fmt.Sprintf("%s", mergeValue)] = typedValue + } + + return result, nil +} + +func mapsOfMapsHaveConflicts(typedLeft, typedRight map[string]interface{}, structType reflect.Type) (bool, error) { + for key, leftValue := range typedLeft { + if rightValue, ok := typedRight[key]; ok { + if hasConflicts, err := mergingMapFieldsHaveConflicts(leftValue, rightValue, structType, "", ""); hasConflicts { + return true, err + } + } + } + + return false, nil +} + // CreateThreeWayMergePatch reconciles a modified configuration with an original configuration, // while preserving any changes or deletions made to the original configuration in the interim, // and not overridden by the current configuration. All three documents must be passed to the // method as json encoded content. It will return a strategic merge patch, or an error if any // of the documents is invalid, or if there are any preconditions that fail against the modified -// configuration, or, if force is false and there are conflicts between the modified and current -// configurations. -func CreateThreeWayMergePatch(original, modified, current []byte, dataStruct interface{}, force bool, fns ...PreconditionFunc) ([]byte, error) { +// configuration, or, if overwrite is false and there are conflicts between the modified and current +// configurations. Conflicts are defined as keys changed differently from original to modified +// than from original to current. In other words, a conflict occurs if modified changes any key +// in a way that is different from how it is changed in current (e.g., deleting it, changing its +// value). +func CreateThreeWayMergePatch(original, modified, current []byte, dataStruct interface{}, overwrite bool, fns ...PreconditionFunc) ([]byte, error) { originalMap := map[string]interface{}{} if len(original) > 0 { if err := json.Unmarshal(original, &originalMap); err != nil { @@ -1023,8 +1203,41 @@ func CreateThreeWayMergePatch(original, modified, current []byte, dataStruct int } } - // TODO(jackgr): If force is false, and the patch contains any keys that are also in current, + // If overwrite is false, and the patch contains any keys that were changed differently, // then return a conflict error. + if !overwrite { + changedMap, err := diffMaps(originalMap, currentMap, t, false, false) + if err != nil { + return nil, err + } + + hasConflicts, err := MergingMapsHaveConflicts(patchMap, changedMap, dataStruct) + if err != nil { + return nil, err + } + + if hasConflicts { + return nil, newErrConflict(toYAMLOrError(patchMap), toYAMLOrError(changedMap)) + } + } return json.Marshal(patchMap) } + +func toYAMLOrError(v interface{}) string { + y, err := toYAML(v) + if err != nil { + return err.Error() + } + + return y +} + +func toYAML(v interface{}) (string, error) { + y, err := yaml.Marshal(v) + if err != nil { + return "", fmt.Errorf("yaml marshal failed:%v\n%v\n", err, spew.Sdump(v)) + } + + return string(y), nil +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/strategicpatch/patch_test.go b/vendor/k8s.io/kubernetes/pkg/util/strategicpatch/patch_test.go index 3fff3e52f..753d0d724 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/strategicpatch/patch_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/strategicpatch/patch_test.go @@ -20,6 +20,7 @@ import ( "encoding/json" "fmt" "reflect" + "strings" "testing" "github.com/davecgh/go-spew/spew" @@ -230,7 +231,7 @@ func TestSortMergeLists(t *testing.T) { tc := SortMergeListTestCases{} err := yaml.Unmarshal(sortMergeListTestCaseData, &tc) if err != nil { - t.Errorf("can't unmarshal test cases:%s\n", err) + t.Errorf("can't unmarshal test cases: %s\n", err) return } @@ -263,6 +264,17 @@ testCases: - 1 - 2 - 3 + - description: delete map from nested map + original: + simpleMap: + key1: 1 + key2: 1 + twoWay: + simpleMap: + $patch: delete + modified: + simpleMap: + {} - description: delete all items from merging list original: mergingList: @@ -302,7 +314,7 @@ func TestCustomStrategicMergePatch(t *testing.T) { tc := StrategicMergePatchTestCases{} err := yaml.Unmarshal(customStrategicMergePatchTestCaseData, &tc) if err != nil { - t.Errorf("can't unmarshal test cases:%v\n", err) + t.Errorf("can't unmarshal test cases: %v\n", err) return } @@ -319,6 +331,35 @@ func TestCustomStrategicMergePatch(t *testing.T) { // var createStrategicMergePatchTestCaseData = []byte(` testCases: + - description: nil original + twoWay: + name: 1 + value: 1 + modified: + name: 1 + value: 1 + current: + name: 1 + other: a + threeWay: + value: 1 + result: + name: 1 + value: 1 + other: a + - description: nil patch + original: + name: 1 + twoWay: + {} + modified: + name: 1 + current: + name: 1 + threeWay: + {} + result: + name: 1 - description: add field to map original: name: 1 @@ -371,6 +412,23 @@ testCases: result: value: 1 other: a + - description: add field and delete field from map with conflict + original: + name: 1 + twoWay: + name: null + value: 1 + modified: + value: 1 + current: + name: a + other: a + threeWay: + name: null + value: 1 + result: + value: 1 + other: a - description: delete field from nested map original: simpleMap: @@ -435,6 +493,23 @@ testCases: value: null result: other: a + - description: delete all fields from map with conflict + original: + name: 1 + value: 1 + twoWay: + name: null + value: null + modified: {} + current: + name: 1 + value: a + other: a + threeWay: + name: null + value: null + result: + other: a - description: add field and delete all fields from map original: name: 1 @@ -447,7 +522,26 @@ testCases: other: a current: name: 1 - value: a + value: 1 + other: a + threeWay: + name: null + value: null + result: + other: a + - description: add field and delete all fields from map with conflict + original: + name: 1 + value: 1 + twoWay: + name: null + value: null + other: a + modified: + other: a + current: + name: 1 + value: 1 other: b threeWay: name: null @@ -471,6 +565,32 @@ testCases: current: nonMergingIntList: - 1 + - 2 + threeWay: + nonMergingIntList: + - 2 + - 3 + result: + nonMergingIntList: + - 2 + - 3 + - description: replace list of scalars with conflict + original: + nonMergingIntList: + - 1 + - 2 + twoWay: + nonMergingIntList: + - 2 + - 3 + modified: + nonMergingIntList: + - 2 + - 3 + current: + nonMergingIntList: + - 1 + - 4 threeWay: nonMergingIntList: - 2 @@ -543,6 +663,45 @@ testCases: other: b - name: 3 value: 3 + - description: merge lists of maps with conflict + original: + mergingList: + - name: 1 + - name: 2 + value: 2 + twoWay: + mergingList: + - name: 3 + value: 3 + modified: + mergingList: + - name: 1 + - name: 2 + value: 2 + - name: 3 + value: 3 + current: + mergingList: + - name: 1 + other: a + - name: 2 + value: 3 + other: b + threeWay: + mergingList: + - name: 2 + value: 2 + - name: 3 + value: 3 + result: + mergingList: + - name: 1 + other: a + - name: 2 + value: 2 + other: b + - name: 3 + value: 3 - description: add field to map in merging list original: mergingList: @@ -578,6 +737,45 @@ testCases: - name: 2 value: 2 other: b + - description: add field to map in merging list with conflict + original: + mergingList: + - name: 1 + - name: 2 + value: 2 + twoWay: + mergingList: + - name: 1 + value: 1 + modified: + mergingList: + - name: 1 + value: 1 + - name: 2 + value: 2 + current: + mergingList: + - name: 1 + other: a + - name: 3 + value: 2 + other: b + threeWay: + mergingList: + - name: 1 + value: 1 + - name: 2 + value: 2 + result: + mergingList: + - name: 1 + value: 1 + other: a + - name: 2 + value: 2 + - name: 3 + value: 2 + other: b - description: add duplicate field to map in merging list original: mergingList: @@ -612,6 +810,42 @@ testCases: - name: 2 value: 2 other: b + - description: add duplicate field to map in merging list with conflict + original: + mergingList: + - name: 1 + - name: 2 + value: 2 + twoWay: + mergingList: + - name: 1 + value: 1 + modified: + mergingList: + - name: 1 + value: 1 + - name: 2 + value: 2 + current: + mergingList: + - name: 1 + value: 1 + other: a + - name: 2 + value: 3 + other: b + threeWay: + mergingList: + - name: 2 + value: 2 + result: + mergingList: + - name: 1 + value: 1 + other: a + - name: 2 + value: 2 + other: b - description: replace map field value in merging list original: mergingList: @@ -669,17 +903,15 @@ testCases: current: mergingList: - name: 1 - value: 1 + value: 3 other: a - name: 2 - value: b + value: 2 other: b threeWay: mergingList: - name: 1 value: a - - name: 2 - value: 2 result: mergingList: - name: 1 @@ -689,6 +921,31 @@ testCases: value: 2 other: b - description: delete map from merging list + original: + mergingList: + - name: 1 + - name: 2 + twoWay: + mergingList: + - name: 1 + $patch: delete + modified: + mergingList: + - name: 2 + current: + mergingList: + - name: 1 + - name: 2 + other: b + threeWay: + mergingList: + - name: 1 + $patch: delete + result: + mergingList: + - name: 2 + other: b + - description: delete map from merging list with conflict original: mergingList: - name: 1 @@ -738,7 +995,7 @@ testCases: mergingList: - name: 2 other: b - - description: delete map from merging list with conflict + - description: delete missing map from merging list with conflict original: mergingList: - name: 1 @@ -752,7 +1009,7 @@ testCases: - name: 2 current: mergingList: - - name: 1 + - name: 3 other: a threeWay: mergingList: @@ -762,6 +1019,8 @@ testCases: result: mergingList: - name: 2 + - name: 3 + other: a - description: add map and delete map from merging list original: merginglist: @@ -779,7 +1038,6 @@ testCases: current: merginglist: - name: 1 - other: a - name: 2 other: b - name: 4 @@ -844,9 +1102,7 @@ testCases: current: mergingList: - name: 1 - other: a - name: 2 - other: b threeWay: mergingList: - name: 1 @@ -855,7 +1111,7 @@ testCases: $patch: delete result: mergingList: [] - - description: delete all maps from partially empty merging list + - description: delete all maps from merging list with conflict original: mergingList: - name: 1 @@ -872,6 +1128,8 @@ testCases: mergingList: - name: 1 other: a + - name: 2 + other: b threeWay: mergingList: - name: 1 @@ -925,13 +1183,12 @@ testCases: value: 1 other: a - name: 2 + value: 2 other: b threeWay: mergingList: - name: 1 value: null - - name: 2 - value: 2 result: mergingList: - name: 1 @@ -960,6 +1217,74 @@ testCases: - name: 1 value: a other: a + - name: 2 + value: 2 + threeWay: + mergingList: + - name: 1 + value: null + result: + mergingList: + - name: 1 + other: a + - name: 2 + value: 2 + - description: delete missing field from map in merging list + original: + mergingList: + - name: 1 + value: 1 + - name: 2 + value: 2 + twoWay: + mergingList: + - name: 1 + value: null + modified: + mergingList: + - name: 1 + - name: 2 + value: 2 + current: + mergingList: + - name: 1 + other: a + - name: 2 + value: 2 + other: b + threeWay: + mergingList: + - name: 1 + value: null + result: + mergingList: + - name: 1 + other: a + - name: 2 + value: 2 + other: b + - description: delete missing field from map in merging list with conflict + original: + mergingList: + - name: 1 + value: 1 + - name: 2 + value: 2 + twoWay: + mergingList: + - name: 1 + value: null + modified: + mergingList: + - name: 1 + - name: 2 + value: 2 + current: + mergingList: + - name: 1 + other: a + - name: 2 + other: b threeWay: mergingList: - name: 1 @@ -972,6 +1297,7 @@ testCases: other: a - name: 2 value: 2 + other: b - description: replace non merging list nested in merging list original: mergingList: @@ -1019,6 +1345,98 @@ testCases: value: 1 - name: 2 other: b + - description: replace non merging list nested in merging list with value conflict + original: + mergingList: + - name: 1 + nonMergingList: + - name: 1 + - name: 2 + value: 2 + - name: 2 + twoWay: + mergingList: + - name: 1 + nonMergingList: + - name: 1 + value: 1 + modified: + mergingList: + - name: 1 + nonMergingList: + - name: 1 + value: 1 + - name: 2 + current: + mergingList: + - name: 1 + other: a + nonMergingList: + - name: 1 + value: c + - name: 2 + other: b + threeWay: + mergingList: + - name: 1 + nonMergingList: + - name: 1 + value: 1 + result: + mergingList: + - name: 1 + other: a + nonMergingList: + - name: 1 + value: 1 + - name: 2 + other: b + - description: replace non merging list nested in merging list with deletion conflict + original: + mergingList: + - name: 1 + nonMergingList: + - name: 1 + - name: 2 + value: 2 + - name: 2 + twoWay: + mergingList: + - name: 1 + nonMergingList: + - name: 1 + value: 1 + modified: + mergingList: + - name: 1 + nonMergingList: + - name: 1 + value: 1 + - name: 2 + current: + mergingList: + - name: 1 + other: a + nonMergingList: + - name: 2 + value: 2 + - name: 2 + other: b + threeWay: + mergingList: + - name: 1 + nonMergingList: + - name: 1 + value: 1 + result: + mergingList: + - name: 1 + other: a + nonMergingList: + - name: 1 + value: 1 + - name: 2 + other: b - description: add field to map in merging list nested in merging list original: mergingList: @@ -1101,8 +1519,10 @@ testCases: mergingList: - name: 1 value: a + other: c - name: 2 value: b + other: d - name: 2 other: b threeWay: @@ -1120,8 +1540,10 @@ testCases: mergingList: - name: 1 value: 1 + other: c - name: 2 value: 2 + other: d - name: 2 other: b - description: add field to map in merging list nested in merging list with deletion conflict @@ -1155,6 +1577,7 @@ testCases: mergingList: - name: 2 value: 2 + other: d - name: 2 other: b threeWay: @@ -1172,6 +1595,7 @@ testCases: value: 1 - name: 2 value: 2 + other: d - name: 2 other: b - description: merge empty merging lists @@ -1212,6 +1636,29 @@ testCases: other: a - name: 2 - name: 3 + - description: add map to merging list by pointer with conflict + original: + mergeItemPtr: + - name: 1 + twoWay: + mergeItemPtr: + - name: 2 + modified: + mergeItemPtr: + - name: 1 + - name: 2 + current: + mergeItemPtr: + - name: 3 + threeWay: + mergeItemPtr: + - name: 1 + - name: 2 + result: + mergeItemPtr: + - name: 1 + - name: 2 + - name: 3 - description: add field to map in merging list by pointer original: mergeItemPtr: @@ -1267,13 +1714,76 @@ testCases: other: b - name: 2 other: b + - description: add field to map in merging list by pointer with conflict + original: + mergeItemPtr: + - name: 1 + mergeItemPtr: + - name: 1 + - name: 2 + value: 2 + - name: 2 + twoWay: + mergeItemPtr: + - name: 1 + mergeItemPtr: + - name: 1 + value: 1 + modified: + mergeItemPtr: + - name: 1 + mergeItemPtr: + - name: 1 + value: 1 + - name: 2 + value: 2 + - name: 2 + current: + mergeItemPtr: + - name: 1 + other: a + mergeItemPtr: + - name: 1 + value: a + - name: 2 + value: 2 + other: b + - name: 2 + other: b + threeWay: + mergeItemPtr: + - name: 1 + mergeItemPtr: + - name: 1 + value: 1 + result: + mergeItemPtr: + - name: 1 + other: a + mergeItemPtr: + - name: 1 + value: 1 + - name: 2 + value: 2 + other: b + - name: 2 + other: b `) func TestStrategicMergePatch(t *testing.T) { + testStrategicMergePatchWithCustomArguments(t, "bad original", + "", "{}", mergeItem, errBadJSONDoc) + testStrategicMergePatchWithCustomArguments(t, "bad patch", + "{}", "", mergeItem, errBadJSONDoc) + testStrategicMergePatchWithCustomArguments(t, "bad struct", + "{}", "{}", []byte(""), fmt.Errorf(errBadArgTypeFmt, "struct", "slice")) + testStrategicMergePatchWithCustomArguments(t, "nil struct", + "{}", "{}", nil, fmt.Errorf(errBadArgTypeFmt, "struct", "nil")) + tc := StrategicMergePatchTestCases{} err := yaml.Unmarshal(createStrategicMergePatchTestCaseData, &tc) if err != nil { - t.Errorf("can't unmarshal test cases:%s\n", err) + t.Errorf("can't unmarshal test cases: %s\n", err) return } @@ -1283,13 +1793,29 @@ func TestStrategicMergePatch(t *testing.T) { } } +func testStrategicMergePatchWithCustomArguments(t *testing.T, description, original, patch string, dataStruct interface{}, err error) { + _, err2 := StrategicMergePatch([]byte(original), []byte(patch), dataStruct) + if err2 != err { + if err2 == nil { + t.Errorf("expected error: %s\ndid not occur in test case: %s", err, description) + return + } + + if err == nil || err2.Error() != err.Error() { + t.Errorf("unexpected error: %s\noccurred in test case: %s", err2, description) + return + } + } +} + func testTwoWayPatch(t *testing.T, c StrategicMergePatchTestCase) { original, expected, modified := twoWayTestCaseToJSONOrFail(t, c) actual, err := CreateTwoWayMergePatch(original, modified, mergeItem) if err != nil { - t.Errorf("error: %s in test case: %s\ncannot create two way patch:%s:\n%s\n", + t.Errorf("error: %s\nin test case: %s\ncannot create two way patch: %s:\n%s\n", err, c.Description, toYAMLOrError(c.StrategicMergePatchTestCaseData)) + return } testPatchCreation(t, expected, actual, c.Description) @@ -1304,25 +1830,39 @@ func twoWayTestCaseToJSONOrFail(t *testing.T, c StrategicMergePatchTestCase) ([] func testThreeWayPatch(t *testing.T, c StrategicMergePatchTestCase) { original, modified, current, expected, result := threeWayTestCaseToJSONOrFail(t, c) - actual, err := CreateThreeWayMergePatch(original, modified, current, mergeItem, false) if err != nil { - if IsConflict(err) { - if len(c.Result) > 0 { - t.Errorf("error in test case: %s\nunexpected conflict occurred:\n%s\n", - c.Description, toYAMLOrError(c.StrategicMergePatchTestCaseData)) - } - + if !IsConflict(err) { + t.Errorf("error: %s\nin test case: %s\ncannot create three way patch:\n%s\n", + err, c.Description, toYAMLOrError(c.StrategicMergePatchTestCaseData)) return } - t.Errorf("error: %s in test case: %s\ncannot create three way patch:\n%s\n", - err, c.Description, toYAMLOrError(c.StrategicMergePatchTestCaseData)) + if !strings.Contains(c.Description, "conflict") { + t.Errorf("unexpected conflict: %s\nin test case: %s\ncannot create three way patch:\n%s\n", + err, c.Description, toYAMLOrError(c.StrategicMergePatchTestCaseData)) + return + } + + if len(c.Result) > 0 { + actual, err := CreateThreeWayMergePatch(original, modified, current, mergeItem, true) + if err != nil { + t.Errorf("error: %s\nin test case: %s\ncannot force three way patch application:\n%s\n", + err, c.Description, toYAMLOrError(c.StrategicMergePatchTestCaseData)) + return + } + + testPatchCreation(t, expected, actual, c.Description) + testPatchApplication(t, current, actual, result, c.Description) + } + + return } - if len(c.Result) < 1 { + if strings.Contains(c.Description, "conflict") || len(c.Result) < 1 { t.Errorf("error in test case: %s\nexpected conflict did not occur:\n%s\n", c.Description, toYAMLOrError(c.StrategicMergePatchTestCaseData)) + return } testPatchCreation(t, expected, actual, c.Description) @@ -1340,27 +1880,31 @@ func threeWayTestCaseToJSONOrFail(t *testing.T, c StrategicMergePatchTestCase) ( func testPatchCreation(t *testing.T, expected, actual []byte, description string) { sorted, err := sortMergeListsByName(actual, mergeItem) if err != nil { - t.Errorf("error: %s in test case: %s\ncannot sort patch:\n%s\n", + t.Errorf("error: %s\nin test case: %s\ncannot sort patch:\n%s\n", err, description, jsonToYAMLOrError(actual)) + return } if !reflect.DeepEqual(sorted, expected) { t.Errorf("error in test case: %s\nexpected patch:\n%s\ngot:\n%s\n", description, jsonToYAMLOrError(expected), jsonToYAMLOrError(sorted)) + return } } func testPatchApplication(t *testing.T, original, patch, expected []byte, description string) { result, err := StrategicMergePatch(original, patch, mergeItem) if err != nil { - t.Errorf("error: %s in test case: %s\ncannot apply patch:\n%s\nto original:\n%s\n", + t.Errorf("error: %s\nin test case: %s\ncannot apply patch:\n%s\nto original:\n%s\n", err, description, jsonToYAMLOrError(patch), jsonToYAMLOrError(original)) + return } sorted, err := sortMergeListsByName(result, mergeItem) if err != nil { - t.Errorf("error: %s in test case: %s\ncannot sort result object:\n%s\n", + t.Errorf("error: %s\nin test case: %s\ncannot sort result object:\n%s\n", err, description, jsonToYAMLOrError(result)) + return } if !reflect.DeepEqual(sorted, expected) { @@ -1368,10 +1912,15 @@ func testPatchApplication(t *testing.T, original, patch, expected []byte, descri t.Errorf(format, description, jsonToYAMLOrError(original), jsonToYAMLOrError(patch), jsonToYAMLOrError(expected), jsonToYAMLOrError(sorted)) + return } } func testObjectToJSONOrFail(t *testing.T, o map[string]interface{}, description string) []byte { + if o == nil { + return nil + } + j, err := toJSON(o) if err != nil { t.Error(err) @@ -1379,21 +1928,13 @@ func testObjectToJSONOrFail(t *testing.T, o map[string]interface{}, description r, err := sortMergeListsByName(j, mergeItem) if err != nil { - t.Errorf("error: %s in test case: %s\ncannot sort object:\n%s\n", err, description, j) + t.Errorf("error: %s\nin test case: %s\ncannot sort object:\n%s\n", err, description, j) + return nil } return r } -func toYAMLOrError(v interface{}) string { - y, err := toYAML(v) - if err != nil { - return err.Error() - } - - return y -} - func jsonToYAMLOrError(j []byte) string { y, err := jsonToYAML(j) if err != nil { @@ -1403,19 +1944,10 @@ func jsonToYAMLOrError(j []byte) string { return string(y) } -func toYAML(v interface{}) (string, error) { - y, err := yaml.Marshal(v) - if err != nil { - return "", fmt.Errorf("yaml marshal failed:%v\n%v\n", err, spew.Sdump(v)) - } - - return string(y), nil -} - func toJSON(v interface{}) ([]byte, error) { j, err := json.Marshal(v) if err != nil { - return nil, fmt.Errorf("json marshal failed:%v\n%v\n", err, spew.Sdump(v)) + return nil, fmt.Errorf("json marshal failed: %v\n%v\n", err, spew.Sdump(v)) } return j, nil @@ -1424,7 +1956,7 @@ func toJSON(v interface{}) ([]byte, error) { func jsonToYAML(j []byte) ([]byte, error) { y, err := yaml.JSONToYAML(j) if err != nil { - return nil, fmt.Errorf("json to yaml failed:%v\n%v\n", err, j) + return nil, fmt.Errorf("json to yaml failed: %v\n%v\n", err, j) } return y, nil diff --git a/vendor/k8s.io/kubernetes/pkg/util/escape.go b/vendor/k8s.io/kubernetes/pkg/util/strings/escape.go similarity index 73% rename from vendor/k8s.io/kubernetes/pkg/util/escape.go rename to vendor/k8s.io/kubernetes/pkg/util/strings/escape.go index 3f5bc71ea..d00207bf8 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/escape.go +++ b/vendor/k8s.io/kubernetes/pkg/util/strings/escape.go @@ -14,12 +14,25 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package strings import ( "strings" ) +// EscapePluginName converts a plugin name in the format +// vendor/pluginname into a proper ondisk vendor~pluginname plugin directory +// format. +func EscapePluginName(in string) string { + return strings.Replace(in, "/", "~", -1) +} + +// EscapeQualifiedPluginName converts a plugin directory name in the format +// vendor~pluginname into a proper vendor/pluginname. +func UnescapePluginName(in string) string { + return strings.Replace(in, "~", "/", -1) +} + // EscapeQualifiedNameForDisk converts a plugin name, which might contain a / into a // string that is safe to use on-disk. This assumes that the input has already // been validates as a qualified name. we use "~" rather than ":" here in case diff --git a/vendor/k8s.io/kubernetes/pkg/util/strings/strings.go b/vendor/k8s.io/kubernetes/pkg/util/strings/strings.go new file mode 100644 index 000000000..db5abb45e --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/strings/strings.go @@ -0,0 +1,47 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package strings + +import ( + "path" + "strings" +) + +// Splits a fully qualified name and returns its namespace and name. +// Assumes that the input 'str' has been validated. +func SplitQualifiedName(str string) (string, string) { + parts := strings.Split(str, "/") + if len(parts) < 2 { + return "", str + } + return parts[0], parts[1] +} + +// Joins 'namespace' and 'name' and returns a fully qualified name +// Assumes that the input is valid. +func JoinQualifiedName(namespace, name string) string { + return path.Join(namespace, name) +} + +// Returns the first N slice of a string. +func ShortenString(str string, n int) string { + if len(str) <= n { + return str + } else { + return str[:n] + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/strings/strings_test.go b/vendor/k8s.io/kubernetes/pkg/util/strings/strings_test.go new file mode 100644 index 000000000..eefd0e68b --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/strings/strings_test.go @@ -0,0 +1,54 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package strings + +import ( + "testing" +) + +func TestSplitQualifiedName(t *testing.T) { + testCases := []struct { + input string + output []string + }{ + {"kubernetes.io/blah", []string{"kubernetes.io", "blah"}}, + {"blah", []string{"", "blah"}}, + {"kubernetes.io/blah/blah", []string{"kubernetes.io", "blah"}}, + } + for i, tc := range testCases { + namespace, name := SplitQualifiedName(tc.input) + if namespace != tc.output[0] || name != tc.output[1] { + t.Errorf("case[%d]: expected (%q, %q), got (%q, %q)", i, tc.output[0], tc.output[1], namespace, name) + } + } +} +func TestJoinQualifiedName(t *testing.T) { + testCases := []struct { + input []string + output string + }{ + {[]string{"kubernetes.io", "blah"}, "kubernetes.io/blah"}, + {[]string{"blah", ""}, "blah"}, + {[]string{"kubernetes.io", "blah"}, "kubernetes.io/blah"}, + } + for i, tc := range testCases { + res := JoinQualifiedName(tc.input[0], tc.input[1]) + if res != tc.output { + t.Errorf("case[%d]: expected %q, got %q", i, tc.output, res) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/sysctl/sysctl.go b/vendor/k8s.io/kubernetes/pkg/util/sysctl/sysctl.go index 784a20ff2..9398a7ac3 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/sysctl/sysctl.go +++ b/vendor/k8s.io/kubernetes/pkg/util/sysctl/sysctl.go @@ -27,9 +27,14 @@ const ( sysctlBase = "/proc/sys" VmOvercommitMemory = "vm/overcommit_memory" VmPanicOnOOM = "vm/panic_on_oom" + KernelPanic = "kernel/panic" + KernelPanicOnOops = "kernel/panic_on_oops" VmOvercommitMemoryAlways = 1 // kernel performs no memory over-commit handling VmPanicOnOOMInvokeOOMKiller = 0 // kernel calls the oom_killer function when OOM occurs + + KernelPanicOnOopsAlways = 1 // kernel panics on kernel oops + KernelPanicRebootTimeout = 10 // seconds after a panic for the kernel to reboot ) // GetSysctl returns the value for the specified sysctl setting diff --git a/vendor/k8s.io/kubernetes/pkg/util/fake_handler.go b/vendor/k8s.io/kubernetes/pkg/util/testing/fake_handler.go similarity index 96% rename from vendor/k8s.io/kubernetes/pkg/util/fake_handler.go rename to vendor/k8s.io/kubernetes/pkg/util/testing/fake_handler.go index dfed31a02..3fc9e3ed0 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/fake_handler.go +++ b/vendor/k8s.io/kubernetes/pkg/util/testing/fake_handler.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package testing import ( "io/ioutil" @@ -79,7 +79,7 @@ func (f *FakeHandler) ValidateRequestCount(t TestInterface, count int) bool { defer f.lock.Unlock() if f.requestCount != count { ok = false - t.Logf("Expected %d call, but got %d. Only the last call is recorded and checked.", count, f.requestCount) + t.Errorf("Expected %d call, but got %d. Only the last call is recorded and checked.", count, f.requestCount) } f.hasBeenChecked = true return ok diff --git a/vendor/k8s.io/kubernetes/pkg/util/fake_handler_test.go b/vendor/k8s.io/kubernetes/pkg/util/testing/fake_handler_test.go similarity index 91% rename from vendor/k8s.io/kubernetes/pkg/util/fake_handler_test.go rename to vendor/k8s.io/kubernetes/pkg/util/testing/fake_handler_test.go index b5a0954ee..b0b44eac1 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/fake_handler_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/testing/fake_handler_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package testing import ( "bytes" @@ -26,7 +26,8 @@ import ( func TestFakeHandlerPath(t *testing.T) { handler := FakeHandler{} server := httptest.NewServer(&handler) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() method := "GET" path := "/foo/bar" body := "somebody" @@ -48,7 +49,8 @@ func TestFakeHandlerPath(t *testing.T) { func TestFakeHandlerPathNoBody(t *testing.T) { handler := FakeHandler{} server := httptest.NewServer(&handler) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() method := "GET" path := "/foo/bar" @@ -79,7 +81,8 @@ func (f *fakeError) Logf(format string, args ...interface{}) {} func TestFakeHandlerWrongPath(t *testing.T) { handler := FakeHandler{} server := httptest.NewServer(&handler) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() method := "GET" path := "/foo/bar" fakeT := fakeError{} @@ -104,7 +107,8 @@ func TestFakeHandlerWrongPath(t *testing.T) { func TestFakeHandlerWrongMethod(t *testing.T) { handler := FakeHandler{} server := httptest.NewServer(&handler) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() method := "GET" path := "/foo/bar" fakeT := fakeError{} @@ -129,7 +133,8 @@ func TestFakeHandlerWrongMethod(t *testing.T) { func TestFakeHandlerWrongBody(t *testing.T) { handler := FakeHandler{} server := httptest.NewServer(&handler) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() method := "GET" path := "/foo/bar" body := "somebody" @@ -156,7 +161,8 @@ func TestFakeHandlerWrongBody(t *testing.T) { func TestFakeHandlerNilBody(t *testing.T) { handler := FakeHandler{} server := httptest.NewServer(&handler) - defer server.Close() + // TODO: Uncomment when fix #19254 + // defer server.Close() method := "GET" path := "/foo/bar" body := "somebody" diff --git a/vendor/k8s.io/kubernetes/pkg/util/testing/tmpdir.go b/vendor/k8s.io/kubernetes/pkg/util/testing/tmpdir.go new file mode 100644 index 000000000..8ad6733e6 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/testing/tmpdir.go @@ -0,0 +1,44 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testing + +import ( + "io/ioutil" + "os" +) + +// MkTmpdir creates a temporary directory based upon the prefix passed in. +// If successful, it returns the temporary directory path. The directory can be +// deleted with a call to "os.RemoveAll(...)". +// In case of error, it'll return an empty string and the error. +func MkTmpdir(prefix string) (string, error) { + tmpDir, err := ioutil.TempDir(os.TempDir(), prefix) + if err != nil { + return "", err + } + return tmpDir, nil +} + +// MkTmpdir does the same work as "MkTmpdir", except in case of +// errors, it'll trigger a panic. +func MkTmpdirOrDie(prefix string) string { + tmpDir, err := MkTmpdir(prefix) + if err != nil { + panic(err) + } + return tmpDir +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/throttle.go b/vendor/k8s.io/kubernetes/pkg/util/throttle.go index 43fdc0a94..c1caea099 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/throttle.go +++ b/vendor/k8s.io/kubernetes/pkg/util/throttle.go @@ -16,18 +16,28 @@ limitations under the License. package util -import "github.com/juju/ratelimit" +import ( + "sync" + + "github.com/juju/ratelimit" +) type RateLimiter interface { - // CanAccept returns true if the rate is below the limit, false otherwise - CanAccept() bool + // TryAccept returns true if a token is taken immediately. Otherwise, + // it returns false. + TryAccept() bool // Accept returns once a token becomes available. Accept() // Stop stops the rate limiter, subsequent calls to CanAccept will return false Stop() + // Saturation returns a percentage number which describes how saturated + // this rate limiter is. + // Usually we use token bucket rate limiter. In that case, + // 1.0 means no tokens are available; 0.0 means we have a full bucket of tokens to use. + Saturation() float64 } -type tickRateLimiter struct { +type tokenBucketRateLimiter struct { limiter *ratelimit.Bucket } @@ -38,31 +48,69 @@ type tickRateLimiter struct { // The maximum number of tokens in the bucket is capped at 'burst'. func NewTokenBucketRateLimiter(qps float32, burst int) RateLimiter { limiter := ratelimit.NewBucketWithRate(float64(qps), int64(burst)) - return &tickRateLimiter{limiter} + return &tokenBucketRateLimiter{limiter} } -type fakeRateLimiter struct{} - -func NewFakeRateLimiter() RateLimiter { - return &fakeRateLimiter{} -} - -func (t *tickRateLimiter) CanAccept() bool { +func (t *tokenBucketRateLimiter) TryAccept() bool { return t.limiter.TakeAvailable(1) == 1 } +func (t *tokenBucketRateLimiter) Saturation() float64 { + capacity := t.limiter.Capacity() + avail := t.limiter.Available() + return float64(capacity-avail) / float64(capacity) +} + // Accept will block until a token becomes available -func (t *tickRateLimiter) Accept() { +func (t *tokenBucketRateLimiter) Accept() { t.limiter.Wait(1) } -func (t *tickRateLimiter) Stop() { +func (t *tokenBucketRateLimiter) Stop() { } -func (t *fakeRateLimiter) CanAccept() bool { +type fakeAlwaysRateLimiter struct{} + +func NewFakeAlwaysRateLimiter() RateLimiter { + return &fakeAlwaysRateLimiter{} +} + +func (t *fakeAlwaysRateLimiter) TryAccept() bool { return true } -func (t *fakeRateLimiter) Stop() {} +func (t *fakeAlwaysRateLimiter) Saturation() float64 { + return 0 +} -func (t *fakeRateLimiter) Accept() {} +func (t *fakeAlwaysRateLimiter) Stop() {} + +func (t *fakeAlwaysRateLimiter) Accept() {} + +type fakeNeverRateLimiter struct { + wg sync.WaitGroup +} + +func NewFakeNeverRateLimiter() RateLimiter { + wg := sync.WaitGroup{} + wg.Add(1) + return &fakeNeverRateLimiter{ + wg: wg, + } +} + +func (t *fakeNeverRateLimiter) TryAccept() bool { + return false +} + +func (t *fakeNeverRateLimiter) Saturation() float64 { + return 1 +} + +func (t *fakeNeverRateLimiter) Stop() { + t.wg.Done() +} + +func (t *fakeNeverRateLimiter) Accept() { + t.wg.Wait() +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/throttle_test.go b/vendor/k8s.io/kubernetes/pkg/util/throttle_test.go index b4b145b79..ca0e9ac23 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/throttle_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/throttle_test.go @@ -17,6 +17,8 @@ limitations under the License. package util import ( + "math" + "sync" "testing" "time" ) @@ -24,28 +26,28 @@ import ( func TestBasicThrottle(t *testing.T) { r := NewTokenBucketRateLimiter(1, 3) for i := 0; i < 3; i++ { - if !r.CanAccept() { + if !r.TryAccept() { t.Error("unexpected false accept") } } - if r.CanAccept() { + if r.TryAccept() { t.Error("unexpected true accept") } } func TestIncrementThrottle(t *testing.T) { r := NewTokenBucketRateLimiter(1, 1) - if !r.CanAccept() { + if !r.TryAccept() { t.Error("unexpected false accept") } - if r.CanAccept() { + if r.TryAccept() { t.Error("unexpected true accept") } // Allow to refill time.Sleep(2 * time.Second) - if !r.CanAccept() { + if !r.TryAccept() { t.Error("unexpected false accept") } } @@ -63,3 +65,63 @@ func TestThrottle(t *testing.T) { t.Error("rate limit was not respected, finished too early") } } + +func TestRateLimiterSaturation(t *testing.T) { + const e = 0.000001 + tests := []struct { + capacity int + take int + + expectedSaturation float64 + }{ + {1, 1, 1}, + {10, 3, 0.3}, + } + for i, tt := range tests { + rl := NewTokenBucketRateLimiter(1, tt.capacity) + for i := 0; i < tt.take; i++ { + rl.Accept() + } + if math.Abs(rl.Saturation()-tt.expectedSaturation) > e { + t.Fatalf("#%d: Saturation rate difference isn't within tolerable range\n want=%f, get=%f", + i, tt.expectedSaturation, rl.Saturation()) + } + } +} + +func TestAlwaysFake(t *testing.T) { + rl := NewFakeAlwaysRateLimiter() + if !rl.TryAccept() { + t.Error("TryAccept in AlwaysFake should return true.") + } + // If this will block the test will timeout + rl.Accept() +} + +func TestNeverFake(t *testing.T) { + rl := NewFakeNeverRateLimiter() + if rl.TryAccept() { + t.Error("TryAccept in NeverFake should return false.") + } + + finished := false + wg := sync.WaitGroup{} + wg.Add(1) + go func() { + rl.Accept() + finished = true + wg.Done() + }() + + // Wait some time to make sure it never finished. + time.Sleep(time.Second) + if finished { + t.Error("Accept should block forever in NeverFake.") + } + + rl.Stop() + wg.Wait() + if !finished { + t.Error("Stop should make Accept unblock in NeverFake.") + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/util.go b/vendor/k8s.io/kubernetes/pkg/util/util.go index 519203f59..63da8ef5e 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/util.go +++ b/vendor/k8s.io/kubernetes/pkg/util/util.go @@ -17,201 +17,28 @@ limitations under the License. package util import ( - "bufio" - "encoding/hex" - "encoding/json" "fmt" - "io" "math" - "net" - "net/http" "os" - "path" "reflect" "regexp" - "runtime" "strconv" "strings" - "time" - "github.com/golang/glog" - "github.com/google/gofuzz" + "k8s.io/kubernetes/pkg/util/intstr" ) -// For testing, bypass HandleCrash. -var ReallyCrash bool - -// For any test of the style: -// ... -// <- time.After(timeout): -// t.Errorf("Timed out") -// The value for timeout should effectively be "forever." Obviously we don't want our tests to truly lock up forever, but 30s -// is long enough that it is effectively forever for the things that can slow down a run on a heavily contended machine -// (GC, seeks, etc), but not so long as to make a developer ctrl-c a test run if they do happen to break that test. -var ForeverTestTimeout = time.Second * 30 - -// PanicHandlers is a list of functions which will be invoked when a panic happens. -var PanicHandlers = []func(interface{}){logPanic} - -// HandleCrash simply catches a crash and logs an error. Meant to be called via defer. -// Additional context-specific handlers can be provided, and will be called in case of panic -func HandleCrash(additionalHandlers ...func(interface{})) { - if ReallyCrash { - return - } - if r := recover(); r != nil { - for _, fn := range PanicHandlers { - fn(r) - } - for _, fn := range additionalHandlers { - fn(r) - } - } -} - -// logPanic logs the caller tree when a panic occurs. -func logPanic(r interface{}) { - callers := "" - for i := 0; true; i++ { - _, file, line, ok := runtime.Caller(i) - if !ok { - break - } - callers = callers + fmt.Sprintf("%v:%v\n", file, line) - } - glog.Errorf("Recovered from panic: %#v (%v)\n%v", r, r, callers) -} - -// ErrorHandlers is a list of functions which will be invoked when an unreturnable -// error occurs. -var ErrorHandlers = []func(error){logError} - -// HandlerError is a method to invoke when a non-user facing piece of code cannot -// return an error and needs to indicate it has been ignored. Invoking this method -// is preferable to logging the error - the default behavior is to log but the -// errors may be sent to a remote server for analysis. -func HandleError(err error) { - for _, fn := range ErrorHandlers { - fn(err) - } -} - -// logError prints an error with the call stack of the location it was reported -func logError(err error) { - glog.ErrorDepth(2, err) -} - -// NeverStop may be passed to Until to make it never stop. -var NeverStop <-chan struct{} = make(chan struct{}) - -// Forever is syntactic sugar on top of Until -func Forever(f func(), period time.Duration) { - Until(f, period, NeverStop) -} - -// Until loops until stop channel is closed, running f every period. -// Catches any panics, and keeps going. f may not be invoked if -// stop channel is already closed. Pass NeverStop to Until if you -// don't want it stop. -func Until(f func(), period time.Duration, stopCh <-chan struct{}) { - for { - select { - case <-stopCh: - return - default: - } - func() { - defer HandleCrash() - f() - }() - time.Sleep(period) - } -} - -// IntOrString is a type that can hold an int or a string. When used in -// JSON or YAML marshalling and unmarshalling, it produces or consumes the -// inner type. This allows you to have, for example, a JSON field that can -// accept a name or number. -type IntOrString struct { - Kind IntstrKind - IntVal int - StrVal string -} - -// IntstrKind represents the stored type of IntOrString. -type IntstrKind int - -const ( - IntstrInt IntstrKind = iota // The IntOrString holds an int. - IntstrString // The IntOrString holds a string. -) - -// NewIntOrStringFromInt creates an IntOrString object with an int value. -func NewIntOrStringFromInt(val int) IntOrString { - return IntOrString{Kind: IntstrInt, IntVal: val} -} - -// NewIntOrStringFromString creates an IntOrString object with a string value. -func NewIntOrStringFromString(val string) IntOrString { - return IntOrString{Kind: IntstrString, StrVal: val} -} - -// UnmarshalJSON implements the json.Unmarshaller interface. -func (intstr *IntOrString) UnmarshalJSON(value []byte) error { - if value[0] == '"' { - intstr.Kind = IntstrString - return json.Unmarshal(value, &intstr.StrVal) - } - intstr.Kind = IntstrInt - return json.Unmarshal(value, &intstr.IntVal) -} - -// String returns the string value, or Itoa's the int value. -func (intstr *IntOrString) String() string { - if intstr.Kind == IntstrString { - return intstr.StrVal - } - return strconv.Itoa(intstr.IntVal) -} - -// MarshalJSON implements the json.Marshaller interface. -func (intstr IntOrString) MarshalJSON() ([]byte, error) { - switch intstr.Kind { - case IntstrInt: - return json.Marshal(intstr.IntVal) - case IntstrString: - return json.Marshal(intstr.StrVal) - default: - return []byte{}, fmt.Errorf("impossible IntOrString.Kind") - } -} - -func (intstr *IntOrString) Fuzz(c fuzz.Continue) { - if intstr == nil { - return - } - if c.RandBool() { - intstr.Kind = IntstrInt - c.Fuzz(&intstr.IntVal) - intstr.StrVal = "" - } else { - intstr.Kind = IntstrString - intstr.IntVal = 0 - c.Fuzz(&intstr.StrVal) - } -} - -func GetIntOrPercentValue(intStr *IntOrString) (int, bool, error) { - switch intStr.Kind { - case IntstrInt: - return intStr.IntVal, false, nil - case IntstrString: - s := strings.Replace(intStr.StrVal, "%", "", -1) +func GetIntOrPercentValue(intOrStr *intstr.IntOrString) (int, bool, error) { + switch intOrStr.Type { + case intstr.Int: + return intOrStr.IntValue(), false, nil + case intstr.String: + s := strings.Replace(intOrStr.StrVal, "%", "", -1) v, err := strconv.Atoi(s) if err != nil { - return 0, false, fmt.Errorf("invalid value %q: %v", intStr.StrVal, err) + return 0, false, fmt.Errorf("invalid value %q: %v", intOrStr.StrVal, err) } - return v, true, nil + return int(v), true, nil } return 0, false, fmt.Errorf("invalid value: neither int nor percentage") } @@ -272,274 +99,6 @@ func AllPtrFieldsNil(obj interface{}) bool { return true } -// Splits a fully qualified name and returns its namespace and name. -// Assumes that the input 'str' has been validated. -func SplitQualifiedName(str string) (string, string) { - parts := strings.Split(str, "/") - if len(parts) < 2 { - return "", str - } - - return parts[0], parts[1] -} - -// Joins 'namespace' and 'name' and returns a fully qualified name -// Assumes that the input is valid. -func JoinQualifiedName(namespace, name string) string { - return path.Join(namespace, name) -} - -type Route struct { - Interface string - Destination net.IP - Gateway net.IP - // TODO: add more fields here if needed -} - -func getRoutes(input io.Reader) ([]Route, error) { - routes := []Route{} - if input == nil { - return nil, fmt.Errorf("input is nil") - } - scanner := bufio.NewReader(input) - for { - line, err := scanner.ReadString('\n') - if err == io.EOF { - break - } - //ignore the headers in the route info - if strings.HasPrefix(line, "Iface") { - continue - } - fields := strings.Fields(line) - routes = append(routes, Route{}) - route := &routes[len(routes)-1] - route.Interface = fields[0] - ip, err := parseIP(fields[1]) - if err != nil { - return nil, err - } - route.Destination = ip - ip, err = parseIP(fields[2]) - if err != nil { - return nil, err - } - route.Gateway = ip - } - return routes, nil -} - -func parseIP(str string) (net.IP, error) { - if str == "" { - return nil, fmt.Errorf("input is nil") - } - bytes, err := hex.DecodeString(str) - if err != nil { - return nil, err - } - //TODO add ipv6 support - if len(bytes) != net.IPv4len { - return nil, fmt.Errorf("only IPv4 is supported") - } - bytes[0], bytes[1], bytes[2], bytes[3] = bytes[3], bytes[2], bytes[1], bytes[0] - return net.IP(bytes), nil -} - -func isInterfaceUp(intf *net.Interface) bool { - if intf == nil { - return false - } - if intf.Flags&net.FlagUp != 0 { - glog.V(4).Infof("Interface %v is up", intf.Name) - return true - } - return false -} - -//getFinalIP method receives all the IP addrs of a Interface -//and returns a nil if the address is Loopback, Ipv6, link-local or nil. -//It returns a valid IPv4 if an Ipv4 address is found in the array. -func getFinalIP(addrs []net.Addr) (net.IP, error) { - if len(addrs) > 0 { - for i := range addrs { - glog.V(4).Infof("Checking addr %s.", addrs[i].String()) - ip, _, err := net.ParseCIDR(addrs[i].String()) - if err != nil { - return nil, err - } - //Only IPv4 - //TODO : add IPv6 support - if ip.To4() != nil { - if !ip.IsLoopback() && !ip.IsLinkLocalMulticast() && !ip.IsLinkLocalUnicast() { - glog.V(4).Infof("IP found %v", ip) - return ip, nil - } else { - glog.V(4).Infof("Loopback/link-local found %v", ip) - } - } else { - glog.V(4).Infof("%v is not a valid IPv4 address", ip) - } - - } - } - return nil, nil -} - -func getIPFromInterface(intfName string, nw networkInterfacer) (net.IP, error) { - intf, err := nw.InterfaceByName(intfName) - if err != nil { - return nil, err - } - if isInterfaceUp(intf) { - addrs, err := nw.Addrs(intf) - if err != nil { - return nil, err - } - glog.V(4).Infof("Interface %q has %d addresses :%v.", intfName, len(addrs), addrs) - finalIP, err := getFinalIP(addrs) - if err != nil { - return nil, err - } - if finalIP != nil { - glog.V(4).Infof("valid IPv4 address for interface %q found as %v.", intfName, finalIP) - return finalIP, nil - } - } - - return nil, nil -} - -func flagsSet(flags net.Flags, test net.Flags) bool { - return flags&test != 0 -} - -func flagsClear(flags net.Flags, test net.Flags) bool { - return flags&test == 0 -} - -func chooseHostInterfaceNativeGo() (net.IP, error) { - intfs, err := net.Interfaces() - if err != nil { - return nil, err - } - i := 0 - var ip net.IP - for i = range intfs { - if flagsSet(intfs[i].Flags, net.FlagUp) && flagsClear(intfs[i].Flags, net.FlagLoopback|net.FlagPointToPoint) { - addrs, err := intfs[i].Addrs() - if err != nil { - return nil, err - } - if len(addrs) > 0 { - for _, addr := range addrs { - if addrIP, _, err := net.ParseCIDR(addr.String()); err == nil { - if addrIP.To4() != nil { - ip = addrIP.To4() - if !ip.IsLinkLocalMulticast() && !ip.IsLinkLocalUnicast() { - break - } - } - } - } - if ip != nil { - // This interface should suffice. - break - } - } - } - } - if ip == nil { - return nil, fmt.Errorf("no acceptable interface from host") - } - glog.V(4).Infof("Choosing interface %s (IP %v) as default", intfs[i].Name, ip) - return ip, nil -} - -//ChooseHostInterface is a method used fetch an IP for a daemon. -//It uses data from /proc/net/route file. -//For a node with no internet connection ,it returns error -//For a multi n/w interface node it returns the IP of the interface with gateway on it. -func ChooseHostInterface() (net.IP, error) { - inFile, err := os.Open("/proc/net/route") - if err != nil { - if os.IsNotExist(err) { - return chooseHostInterfaceNativeGo() - } - return nil, err - } - defer inFile.Close() - var nw networkInterfacer = networkInterface{} - return chooseHostInterfaceFromRoute(inFile, nw) -} - -type networkInterfacer interface { - InterfaceByName(intfName string) (*net.Interface, error) - Addrs(intf *net.Interface) ([]net.Addr, error) -} - -type networkInterface struct{} - -func (_ networkInterface) InterfaceByName(intfName string) (*net.Interface, error) { - intf, err := net.InterfaceByName(intfName) - if err != nil { - return nil, err - } - return intf, nil -} - -func (_ networkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) { - addrs, err := intf.Addrs() - if err != nil { - return nil, err - } - return addrs, nil -} - -func chooseHostInterfaceFromRoute(inFile io.Reader, nw networkInterfacer) (net.IP, error) { - routes, err := getRoutes(inFile) - if err != nil { - return nil, err - } - zero := net.IP{0, 0, 0, 0} - var finalIP net.IP - for i := range routes { - //find interface with gateway - if routes[i].Destination.Equal(zero) { - glog.V(4).Infof("Default route transits interface %q", routes[i].Interface) - finalIP, err := getIPFromInterface(routes[i].Interface, nw) - if err != nil { - return nil, err - } - if finalIP != nil { - glog.V(4).Infof("Choosing IP %v ", finalIP) - return finalIP, nil - } - } - } - glog.V(4).Infof("No valid IP found") - if finalIP == nil { - return nil, fmt.Errorf("Unable to select an IP.") - } - return nil, nil -} - -func GetClient(req *http.Request) string { - if userAgent, ok := req.Header["User-Agent"]; ok { - if len(userAgent) > 0 { - return userAgent[0] - } - } - return "unknown" -} - -func ShortenString(str string, n int) string { - if len(str) <= n { - return str - } else { - return str[:n] - } -} - func FileExists(filename string) (bool, error) { if _, err := os.Stat(filename); os.IsNotExist(err) { return false, nil @@ -580,3 +139,18 @@ func ReadDirNoExit(dirname string) ([]os.FileInfo, []error, error) { return list, errs, nil } + +// IntPtr returns a pointer to an int +func IntPtr(i int) *int { + o := i + return &o +} + +// IntPtrDerefOr derefrence the int ptr and returns it i not nil, +// else returns def. +func IntPtrDerefOr(ptr *int, def int) int { + if ptr != nil { + return *ptr + } + return def +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/util_test.go b/vendor/k8s.io/kubernetes/pkg/util/util_test.go index 997116919..7fd236e1e 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/util_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/util_test.go @@ -17,213 +17,9 @@ limitations under the License. package util import ( - "encoding/json" - "fmt" - "io" - "net" - "reflect" - "strings" "testing" - - "github.com/ghodss/yaml" ) -func TestUntil(t *testing.T) { - ch := make(chan struct{}) - close(ch) - Until(func() { - t.Fatal("should not have been invoked") - }, 0, ch) - - ch = make(chan struct{}) - called := make(chan struct{}) - go func() { - Until(func() { - called <- struct{}{} - }, 0, ch) - close(called) - }() - <-called - close(ch) - <-called -} - -func TestHandleCrash(t *testing.T) { - count := 0 - expect := 10 - for i := 0; i < expect; i = i + 1 { - defer HandleCrash() - if i%2 == 0 { - panic("Test Panic") - } - count = count + 1 - } - if count != expect { - t.Errorf("Expected %d iterations, found %d", expect, count) - } -} - -func TestCustomHandleCrash(t *testing.T) { - old := PanicHandlers - defer func() { PanicHandlers = old }() - var result interface{} - PanicHandlers = []func(interface{}){ - func(r interface{}) { - result = r - }, - } - func() { - defer HandleCrash() - panic("test") - }() - if result != "test" { - t.Errorf("did not receive custom handler") - } -} - -func TestCustomHandleError(t *testing.T) { - old := ErrorHandlers - defer func() { ErrorHandlers = old }() - var result error - ErrorHandlers = []func(error){ - func(err error) { - result = err - }, - } - err := fmt.Errorf("test") - HandleError(err) - if result != err { - t.Errorf("did not receive custom handler") - } -} - -func TestNewIntOrStringFromInt(t *testing.T) { - i := NewIntOrStringFromInt(93) - if i.Kind != IntstrInt || i.IntVal != 93 { - t.Errorf("Expected IntVal=93, got %+v", i) - } -} - -func TestNewIntOrStringFromString(t *testing.T) { - i := NewIntOrStringFromString("76") - if i.Kind != IntstrString || i.StrVal != "76" { - t.Errorf("Expected StrVal=\"76\", got %+v", i) - } -} - -type IntOrStringHolder struct { - IOrS IntOrString `json:"val"` -} - -func TestIntOrStringUnmarshalYAML(t *testing.T) { - cases := []struct { - input string - result IntOrString - }{ - {"val: 123\n", IntOrString{Kind: IntstrInt, IntVal: 123}}, - {"val: \"123\"\n", IntOrString{Kind: IntstrString, StrVal: "123"}}, - } - - for _, c := range cases { - var result IntOrStringHolder - if err := yaml.Unmarshal([]byte(c.input), &result); err != nil { - t.Errorf("Failed to unmarshal input '%v': %v", c.input, err) - } - if result.IOrS != c.result { - t.Errorf("Failed to unmarshal input '%v': expected: %+v, got %+v", c.input, c.result, result) - } - } -} - -func TestIntOrStringMarshalYAML(t *testing.T) { - cases := []struct { - input IntOrString - result string - }{ - {IntOrString{Kind: IntstrInt, IntVal: 123}, "val: 123\n"}, - {IntOrString{Kind: IntstrString, StrVal: "123"}, "val: \"123\"\n"}, - } - - for _, c := range cases { - input := IntOrStringHolder{c.input} - result, err := yaml.Marshal(&input) - if err != nil { - t.Errorf("Failed to marshal input '%v': %v", input, err) - } - if string(result) != c.result { - t.Errorf("Failed to marshal input '%v': expected: %+v, got %q", input, c.result, string(result)) - } - } -} - -func TestIntOrStringUnmarshalJSON(t *testing.T) { - cases := []struct { - input string - result IntOrString - }{ - {"{\"val\": 123}", IntOrString{Kind: IntstrInt, IntVal: 123}}, - {"{\"val\": \"123\"}", IntOrString{Kind: IntstrString, StrVal: "123"}}, - } - - for _, c := range cases { - var result IntOrStringHolder - if err := json.Unmarshal([]byte(c.input), &result); err != nil { - t.Errorf("Failed to unmarshal input '%v': %v", c.input, err) - } - if result.IOrS != c.result { - t.Errorf("Failed to unmarshal input '%v': expected %+v, got %+v", c.input, c.result, result) - } - } -} - -func TestIntOrStringMarshalJSON(t *testing.T) { - cases := []struct { - input IntOrString - result string - }{ - {IntOrString{Kind: IntstrInt, IntVal: 123}, "{\"val\":123}"}, - {IntOrString{Kind: IntstrString, StrVal: "123"}, "{\"val\":\"123\"}"}, - } - - for _, c := range cases { - input := IntOrStringHolder{c.input} - result, err := json.Marshal(&input) - if err != nil { - t.Errorf("Failed to marshal input '%v': %v", input, err) - } - if string(result) != c.result { - t.Errorf("Failed to marshal input '%v': expected: %+v, got %q", input, c.result, string(result)) - } - } -} - -func TestIntOrStringMarshalJSONUnmarshalYAML(t *testing.T) { - cases := []struct { - input IntOrString - }{ - {IntOrString{Kind: IntstrInt, IntVal: 123}}, - {IntOrString{Kind: IntstrString, StrVal: "123"}}, - } - - for _, c := range cases { - input := IntOrStringHolder{c.input} - jsonMarshalled, err := json.Marshal(&input) - if err != nil { - t.Errorf("1: Failed to marshal input: '%v': %v", input, err) - } - - var result IntOrStringHolder - err = yaml.Unmarshal(jsonMarshalled, &result) - if err != nil { - t.Errorf("2: Failed to unmarshal '%+v': %v", string(jsonMarshalled), err) - } - - if !reflect.DeepEqual(input, result) { - t.Errorf("3: Failed to marshal input '%+v': got %+v", input, result) - } - } -} - func TestStringDiff(t *testing.T) { diff := StringDiff("aaabb", "aaacc") expect := "aaa\n\nA: bb\n\nB: cc\n\n" @@ -301,312 +97,3 @@ func TestAllPtrFieldsNil(t *testing.T) { } } } - -func TestSplitQualifiedName(t *testing.T) { - testCases := []struct { - input string - output []string - }{ - {"kubernetes.io/blah", []string{"kubernetes.io", "blah"}}, - {"blah", []string{"", "blah"}}, - {"kubernetes.io/blah/blah", []string{"kubernetes.io", "blah"}}, - } - for i, tc := range testCases { - namespace, name := SplitQualifiedName(tc.input) - if namespace != tc.output[0] || name != tc.output[1] { - t.Errorf("case[%d]: expected (%q, %q), got (%q, %q)", i, tc.output[0], tc.output[1], namespace, name) - } - } -} - -func TestJoinQualifiedName(t *testing.T) { - testCases := []struct { - input []string - output string - }{ - {[]string{"kubernetes.io", "blah"}, "kubernetes.io/blah"}, - {[]string{"blah", ""}, "blah"}, - {[]string{"kubernetes.io", "blah"}, "kubernetes.io/blah"}, - } - for i, tc := range testCases { - res := JoinQualifiedName(tc.input[0], tc.input[1]) - if res != tc.output { - t.Errorf("case[%d]: expected %q, got %q", i, tc.output, res) - } - } -} - -const gatewayfirst = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT -eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0 -eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 -docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 -virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 -` -const gatewaylast = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT -docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 -virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 -eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 -eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0 -` -const gatewaymiddle = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT -eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 -docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 -eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0 -virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 -` -const noInternetConnection = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT -docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 -virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 -` -const nothing = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT -` -const gatewayfirstIpv6_1 = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT -eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0 -eth3 0000FE0AA1 00000000 0001 0 0 0 0080FFFF 0 0 0 -docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 -virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 -` -const gatewayfirstIpv6_2 = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT -eth3 00000000 0100FE0AA1 0003 0 0 1024 00000000 0 0 0 -eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 -docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 -virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 -` -const route_Invalidhex = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT -eth3 00000000 0100FE0AA 0003 0 0 1024 00000000 0 0 0 -eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0 -docker0 000011AC 00000000 0001 0 0 0 0000FFFF 0 0 0 -virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0 -` - -// Based on DigitalOcean COREOS -const gatewayfirstLinkLocal = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT -eth0 00000000 0120372D 0001 0 0 0 00000000 0 0 0 -eth0 00000000 00000000 0001 0 0 2048 00000000 0 0 0 -` - -func TestGetRoutes(t *testing.T) { - testCases := []struct { - tcase string - route string - expected int - }{ - {"gatewayfirst", gatewayfirst, 4}, - {"gatewaymiddle", gatewaymiddle, 4}, - {"gatewaylast", gatewaylast, 4}, - {"nothing", nothing, 0}, - {"gatewayfirstIpv6_1", gatewayfirstIpv6_1, 0}, - {"gatewayfirstIpv6_2", gatewayfirstIpv6_2, 0}, - {"route_Invalidhex", route_Invalidhex, 0}, - } - for _, tc := range testCases { - r := strings.NewReader(tc.route) - routes, err := getRoutes(r) - if len(routes) != tc.expected { - t.Errorf("case[%v]: expected %v, got %v .err : %v", tc.tcase, tc.expected, len(routes), err) - } - } -} - -func TestParseIP(t *testing.T) { - testCases := []struct { - tcase string - ip string - success bool - expected net.IP - }{ - {"empty", "", false, nil}, - {"too short", "AA", false, nil}, - {"too long", "0011223344", false, nil}, - {"invalid", "invalid!", false, nil}, - {"zero", "00000000", true, net.IP{0, 0, 0, 0}}, - {"ffff", "FFFFFFFF", true, net.IP{0xff, 0xff, 0xff, 0xff}}, - {"valid", "12345678", true, net.IP{120, 86, 52, 18}}, - } - for _, tc := range testCases { - ip, err := parseIP(tc.ip) - if !ip.Equal(tc.expected) { - t.Errorf("case[%v]: expected %q, got %q . err : %v", tc.tcase, tc.expected, ip, err) - } - } -} - -func TestIsInterfaceUp(t *testing.T) { - testCases := []struct { - tcase string - intf net.Interface - expected bool - }{ - {"up", net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp}, true}, - {"down", net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: 0}, false}, - {"nothing", net.Interface{}, false}, - } - for _, tc := range testCases { - it := isInterfaceUp(&tc.intf) - if it != tc.expected { - t.Errorf("case[%v]: expected %v, got %v .", tc.tcase, tc.expected, it) - } - } -} - -type addrStruct struct{ val string } - -func (a addrStruct) Network() string { - return a.val -} -func (a addrStruct) String() string { - return a.val -} - -func TestFinalIP(t *testing.T) { - testCases := []struct { - tcase string - addr []net.Addr - expected net.IP - }{ - {"ipv6", []net.Addr{addrStruct{val: "fe80::2f7:6fff:fe6e:2956/64"}}, nil}, - {"invalidCIDR", []net.Addr{addrStruct{val: "fe80::2f7:67fff:fe6e:2956/64"}}, nil}, - {"loopback", []net.Addr{addrStruct{val: "127.0.0.1/24"}}, nil}, - {"ip4", []net.Addr{addrStruct{val: "10.254.12.132/17"}}, net.ParseIP("10.254.12.132")}, - - {"nothing", []net.Addr{}, nil}, - } - for _, tc := range testCases { - ip, err := getFinalIP(tc.addr) - if !ip.Equal(tc.expected) { - t.Errorf("case[%v]: expected %v, got %v .err : %v", tc.tcase, tc.expected, ip, err) - } - } -} - -func TestAddrs(t *testing.T) { - var nw networkInterfacer = validNetworkInterface{} - intf := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: 0} - addrs, err := nw.Addrs(&intf) - if err != nil { - t.Errorf("expected no error got : %v", err) - } - if len(addrs) != 2 { - t.Errorf("expected addrs: 2 got null") - } -} - -type validNetworkInterface struct { -} - -func (_ validNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) { - c := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp} - return &c, nil -} -func (_ validNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) { - var ifat []net.Addr - ifat = []net.Addr{ - addrStruct{val: "fe80::2f7:6fff:fe6e:2956/64"}, addrStruct{val: "10.254.71.145/17"}} - return ifat, nil -} - -type validNetworkInterfaceWithLinkLocal struct { -} - -func (_ validNetworkInterfaceWithLinkLocal) InterfaceByName(intfName string) (*net.Interface, error) { - c := net.Interface{Index: 0, MTU: 0, Name: "eth0", HardwareAddr: nil, Flags: net.FlagUp} - return &c, nil -} -func (_ validNetworkInterfaceWithLinkLocal) Addrs(intf *net.Interface) ([]net.Addr, error) { - var ifat []net.Addr - ifat = []net.Addr{addrStruct{val: "169.254.162.166/16"}, addrStruct{val: "45.55.47.146/19"}} - return ifat, nil -} - -type validNetworkInterfacewithIpv6Only struct { -} - -func (_ validNetworkInterfacewithIpv6Only) InterfaceByName(intfName string) (*net.Interface, error) { - c := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp} - return &c, nil -} -func (_ validNetworkInterfacewithIpv6Only) Addrs(intf *net.Interface) ([]net.Addr, error) { - var ifat []net.Addr - ifat = []net.Addr{addrStruct{val: "fe80::2f7:6fff:fe6e:2956/64"}} - return ifat, nil -} - -type noNetworkInterface struct { -} - -func (_ noNetworkInterface) InterfaceByName(intfName string) (*net.Interface, error) { - return nil, fmt.Errorf("unable get Interface") -} -func (_ noNetworkInterface) Addrs(intf *net.Interface) ([]net.Addr, error) { - return nil, nil -} - -type networkInterfacewithNoAddrs struct { -} - -func (_ networkInterfacewithNoAddrs) InterfaceByName(intfName string) (*net.Interface, error) { - c := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp} - return &c, nil -} -func (_ networkInterfacewithNoAddrs) Addrs(intf *net.Interface) ([]net.Addr, error) { - return nil, fmt.Errorf("unable get Addrs") -} - -type networkInterfacewithIpv6addrs struct { -} - -func (_ networkInterfacewithIpv6addrs) InterfaceByName(intfName string) (*net.Interface, error) { - c := net.Interface{Index: 0, MTU: 0, Name: "eth3", HardwareAddr: nil, Flags: net.FlagUp} - return &c, nil -} -func (_ networkInterfacewithIpv6addrs) Addrs(intf *net.Interface) ([]net.Addr, error) { - var ifat []net.Addr - ifat = []net.Addr{addrStruct{val: "fe80::2f7:6ffff:fe6e:2956/64"}} - return ifat, nil -} - -func TestGetIPFromInterface(t *testing.T) { - testCases := []struct { - tcase string - nwname string - nw networkInterfacer - expected net.IP - }{ - {"valid", "eth3", validNetworkInterface{}, net.ParseIP("10.254.71.145")}, - {"ipv6", "eth3", validNetworkInterfacewithIpv6Only{}, nil}, - {"nothing", "eth3", noNetworkInterface{}, nil}, - } - for _, tc := range testCases { - ip, err := getIPFromInterface(tc.nwname, tc.nw) - if !ip.Equal(tc.expected) { - t.Errorf("case[%v]: expected %v, got %+v .err : %v", tc.tcase, tc.expected, ip, err) - } - } -} - -func TestChooseHostInterfaceFromRoute(t *testing.T) { - testCases := []struct { - tcase string - inFile io.Reader - nw networkInterfacer - expected net.IP - }{ - {"valid_routefirst", strings.NewReader(gatewayfirst), validNetworkInterface{}, net.ParseIP("10.254.71.145")}, - {"valid_routelast", strings.NewReader(gatewaylast), validNetworkInterface{}, net.ParseIP("10.254.71.145")}, - {"valid_routemiddle", strings.NewReader(gatewaymiddle), validNetworkInterface{}, net.ParseIP("10.254.71.145")}, - {"valid_routemiddle_ipv6", strings.NewReader(gatewaymiddle), validNetworkInterfacewithIpv6Only{}, nil}, - {"no internet connection", strings.NewReader(noInternetConnection), validNetworkInterface{}, nil}, - {"no non-link-local ip", strings.NewReader(gatewayfirstLinkLocal), validNetworkInterfaceWithLinkLocal{}, net.ParseIP("45.55.47.146")}, - {"no route", strings.NewReader(nothing), validNetworkInterface{}, nil}, - {"no route file", nil, validNetworkInterface{}, nil}, - {"no interfaces", nil, noNetworkInterface{}, nil}, - {"no interface Addrs", strings.NewReader(gatewaymiddle), networkInterfacewithNoAddrs{}, nil}, - {"Invalid Addrs", strings.NewReader(gatewaymiddle), networkInterfacewithIpv6addrs{}, nil}, - } - for _, tc := range testCases { - ip, err := chooseHostInterfaceFromRoute(tc.inFile, tc.nw) - if !ip.Equal(tc.expected) { - t.Errorf("case[%v]: expected %v, got %+v .err : %v", tc.tcase, tc.expected, ip, err) - } - } -} diff --git a/vendor/k8s.io/kubernetes/pkg/util/uuid.go b/vendor/k8s.io/kubernetes/pkg/util/uuid.go index bc7326d58..7e1396f12 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/uuid.go +++ b/vendor/k8s.io/kubernetes/pkg/util/uuid.go @@ -18,26 +18,25 @@ package util import ( "sync" - "time" "github.com/pborman/uuid" "k8s.io/kubernetes/pkg/types" ) var uuidLock sync.Mutex +var lastUUID uuid.UUID -/** - * The UUID package is naive and can generate identical UUIDs if the time interval is quick enough. - * Block subsequent UUIDs for 200 Nanoseconds, the UUID uses 100 ns increments, we block for 200 to be safe - * Blocks in a go routine, so that the caller doesn't have to wait. - * TODO: save old unused UUIDs so that no one has to block. - */ func NewUUID() types.UID { uuidLock.Lock() + defer uuidLock.Unlock() result := uuid.NewUUID() - go func() { - time.Sleep(200 * time.Nanosecond) - uuidLock.Unlock() - }() + // The UUID package is naive and can generate identical UUIDs if the + // time interval is quick enough. + // The UUID uses 100 ns increments so it's short enough to actively + // wait for a new value. + for uuid.Equal(lastUUID, result) == true { + result = uuid.NewUUID() + } + lastUUID = result return types.UID(result.String()) } diff --git a/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go b/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go new file mode 100644 index 000000000..203f7cc8f --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors.go @@ -0,0 +1,228 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package field + +import ( + "encoding/json" + "fmt" + "strings" + + utilerrors "k8s.io/kubernetes/pkg/util/errors" +) + +// Error is an implementation of the 'error' interface, which represents a +// field-level validation error. +type Error struct { + Type ErrorType + Field string + BadValue interface{} + Detail string +} + +var _ error = &Error{} + +// Error implements the error interface. +func (v *Error) Error() string { + return fmt.Sprintf("%s: %s", v.Field, v.ErrorBody()) +} + +// ErrorBody returns the error message without the field name. This is useful +// for building nice-looking higher-level error reporting. +func (v *Error) ErrorBody() string { + var s string + switch v.Type { + case ErrorTypeRequired, ErrorTypeForbidden, ErrorTypeTooLong, ErrorTypeInternal: + s = fmt.Sprintf("%s", v.Type) + default: + var bad string + badBytes, err := json.Marshal(v.BadValue) + if err != nil { + bad = err.Error() + } else { + bad = string(badBytes) + } + s = fmt.Sprintf("%s: %s", v.Type, bad) + } + if len(v.Detail) != 0 { + s += fmt.Sprintf(": %s", v.Detail) + } + return s +} + +// ErrorType is a machine readable value providing more detail about why +// a field is invalid. These values are expected to match 1-1 with +// CauseType in api/types.go. +type ErrorType string + +// TODO: These values are duplicated in api/types.go, but there's a circular dep. Fix it. +const ( + // ErrorTypeNotFound is used to report failure to find a requested value + // (e.g. looking up an ID). See NotFound(). + ErrorTypeNotFound ErrorType = "FieldValueNotFound" + // ErrorTypeRequired is used to report required values that are not + // provided (e.g. empty strings, null values, or empty arrays). See + // Required(). + ErrorTypeRequired ErrorType = "FieldValueRequired" + // ErrorTypeDuplicate is used to report collisions of values that must be + // unique (e.g. unique IDs). See Duplicate(). + ErrorTypeDuplicate ErrorType = "FieldValueDuplicate" + // ErrorTypeInvalid is used to report malformed values (e.g. failed regex + // match, too long, out of bounds). See Invalid(). + ErrorTypeInvalid ErrorType = "FieldValueInvalid" + // ErrorTypeNotSupported is used to report unknown values for enumerated + // fields (e.g. a list of valid values). See NotSupported(). + ErrorTypeNotSupported ErrorType = "FieldValueNotSupported" + // ErrorTypeForbidden is used to report valid (as per formatting rules) + // values which would be accepted under some conditions, but which are not + // permitted by the current conditions (such as security policy). See + // Forbidden(). + ErrorTypeForbidden ErrorType = "FieldValueForbidden" + // ErrorTypeTooLong is used to report that the given value is too long. + // This is similar to ErrorTypeInvalid, but the error will not include the + // too-long value. See TooLong(). + ErrorTypeTooLong ErrorType = "FieldValueTooLong" + // ErrorTypeInternal is used to report other errors that are not related + // to user input. See InternalError(). + ErrorTypeInternal ErrorType = "InternalError" +) + +// String converts a ErrorType into its corresponding canonical error message. +func (t ErrorType) String() string { + switch t { + case ErrorTypeNotFound: + return "Not found" + case ErrorTypeRequired: + return "Required value" + case ErrorTypeDuplicate: + return "Duplicate value" + case ErrorTypeInvalid: + return "Invalid value" + case ErrorTypeNotSupported: + return "Unsupported value" + case ErrorTypeForbidden: + return "Forbidden" + case ErrorTypeTooLong: + return "Too long" + case ErrorTypeInternal: + return "Internal error" + default: + panic(fmt.Sprintf("unrecognized validation error: %q", string(t))) + } +} + +// NotFound returns a *Error indicating "value not found". This is +// used to report failure to find a requested value (e.g. looking up an ID). +func NotFound(field *Path, value interface{}) *Error { + return &Error{ErrorTypeNotFound, field.String(), value, ""} +} + +// Required returns a *Error indicating "value required". This is used +// to report required values that are not provided (e.g. empty strings, null +// values, or empty arrays). +func Required(field *Path, detail string) *Error { + return &Error{ErrorTypeRequired, field.String(), "", detail} +} + +// Duplicate returns a *Error indicating "duplicate value". This is +// used to report collisions of values that must be unique (e.g. names or IDs). +func Duplicate(field *Path, value interface{}) *Error { + return &Error{ErrorTypeDuplicate, field.String(), value, ""} +} + +// Invalid returns a *Error indicating "invalid value". This is used +// to report malformed values (e.g. failed regex match, too long, out of bounds). +func Invalid(field *Path, value interface{}, detail string) *Error { + return &Error{ErrorTypeInvalid, field.String(), value, detail} +} + +// NotSupported returns a *Error indicating "unsupported value". +// This is used to report unknown values for enumerated fields (e.g. a list of +// valid values). +func NotSupported(field *Path, value interface{}, validValues []string) *Error { + detail := "" + if validValues != nil && len(validValues) > 0 { + detail = "supported values: " + strings.Join(validValues, ", ") + } + return &Error{ErrorTypeNotSupported, field.String(), value, detail} +} + +// Forbidden returns a *Error indicating "forbidden". This is used to +// report valid (as per formatting rules) values which would be accepted under +// some conditions, but which are not permitted by current conditions (e.g. +// security policy). +func Forbidden(field *Path, detail string) *Error { + return &Error{ErrorTypeForbidden, field.String(), "", detail} +} + +// TooLong returns a *Error indicating "too long". This is used to +// report that the given value is too long. This is similar to +// Invalid, but the returned error will not include the too-long +// value. +func TooLong(field *Path, value interface{}, maxLength int) *Error { + return &Error{ErrorTypeTooLong, field.String(), value, fmt.Sprintf("must have at most %d characters", maxLength)} +} + +// InternalError returns a *Error indicating "internal error". This is used +// to signal that an error was found that was not directly related to user +// input. The err argument must be non-nil. +func InternalError(field *Path, err error) *Error { + return &Error{ErrorTypeInternal, field.String(), nil, err.Error()} +} + +// ErrorList holds a set of Errors. It is plausible that we might one day have +// non-field errors in this same umbrella package, but for now we don't, so +// we can keep it simple and leave ErrorList here. +type ErrorList []*Error + +// NewErrorTypeMatcher returns an errors.Matcher that returns true +// if the provided error is a Error and has the provided ErrorType. +func NewErrorTypeMatcher(t ErrorType) utilerrors.Matcher { + return func(err error) bool { + if e, ok := err.(*Error); ok { + return e.Type == t + } + return false + } +} + +// ToAggregate converts the ErrorList into an errors.Aggregate. +func (list ErrorList) ToAggregate() utilerrors.Aggregate { + errs := make([]error, len(list)) + for i := range list { + errs[i] = list[i] + } + return utilerrors.NewAggregate(errs) +} + +func fromAggregate(agg utilerrors.Aggregate) ErrorList { + errs := agg.Errors() + list := make(ErrorList, len(errs)) + for i := range errs { + list[i] = errs[i].(*Error) + } + return list +} + +// Filter removes items from the ErrorList that match the provided fns. +func (list ErrorList) Filter(fns ...utilerrors.Matcher) ErrorList { + err := utilerrors.FilterOut(list.ToAggregate(), fns...) + if err == nil { + return nil + } + // FilterOut takes an Aggregate and returns an Aggregate + return fromAggregate(err.(utilerrors.Aggregate)) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors_test.go b/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors_test.go new file mode 100644 index 000000000..49c763801 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/validation/field/errors_test.go @@ -0,0 +1,134 @@ +/* +Copyright 2014 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package field + +import ( + "fmt" + "strings" + "testing" +) + +func TestMakeFuncs(t *testing.T) { + testCases := []struct { + fn func() *Error + expected ErrorType + }{ + { + func() *Error { return Invalid(NewPath("f"), "v", "d") }, + ErrorTypeInvalid, + }, + { + func() *Error { return NotSupported(NewPath("f"), "v", nil) }, + ErrorTypeNotSupported, + }, + { + func() *Error { return Duplicate(NewPath("f"), "v") }, + ErrorTypeDuplicate, + }, + { + func() *Error { return NotFound(NewPath("f"), "v") }, + ErrorTypeNotFound, + }, + { + func() *Error { return Required(NewPath("f"), "d") }, + ErrorTypeRequired, + }, + { + func() *Error { return InternalError(NewPath("f"), fmt.Errorf("e")) }, + ErrorTypeInternal, + }, + } + + for _, testCase := range testCases { + err := testCase.fn() + if err.Type != testCase.expected { + t.Errorf("expected Type %q, got %q", testCase.expected, err.Type) + } + } +} + +func TestErrorUsefulMessage(t *testing.T) { + s := Invalid(NewPath("foo"), "bar", "deet").Error() + t.Logf("message: %v", s) + for _, part := range []string{"foo", "bar", "deet", ErrorTypeInvalid.String()} { + if !strings.Contains(s, part) { + t.Errorf("error message did not contain expected part '%v'", part) + } + } + + type complicated struct { + Baz int + Qux string + Inner interface{} + KV map[string]int + } + s = Invalid( + NewPath("foo"), + &complicated{ + Baz: 1, + Qux: "aoeu", + Inner: &complicated{Qux: "asdf"}, + KV: map[string]int{"Billy": 2}, + }, + "detail", + ).Error() + t.Logf("message: %v", s) + for _, part := range []string{ + "foo", ErrorTypeInvalid.String(), + "Baz", "Qux", "Inner", "KV", "detail", + "1", "aoeu", "asdf", "Billy", "2", + } { + if !strings.Contains(s, part) { + t.Errorf("error message did not contain expected part '%v'", part) + } + } +} + +func TestToAggregate(t *testing.T) { + testCases := []ErrorList{ + nil, + {}, + {Invalid(NewPath("f"), "v", "d")}, + {Invalid(NewPath("f"), "v", "d"), InternalError(NewPath(""), fmt.Errorf("e"))}, + } + for i, tc := range testCases { + agg := tc.ToAggregate() + if len(tc) == 0 { + if agg != nil { + t.Errorf("[%d] Expected nil, got %#v", i, agg) + } + } else if agg == nil { + t.Errorf("[%d] Expected non-nil", i) + } else if len(tc) != len(agg.Errors()) { + t.Errorf("[%d] Expected %d, got %d", i, len(tc), len(agg.Errors())) + } + } +} + +func TestErrListFilter(t *testing.T) { + list := ErrorList{ + Invalid(NewPath("test.field"), "", ""), + Invalid(NewPath("field.test"), "", ""), + Duplicate(NewPath("test"), "value"), + } + if len(list.Filter(NewErrorTypeMatcher(ErrorTypeDuplicate))) != 2 { + t.Errorf("should not filter") + } + if len(list.Filter(NewErrorTypeMatcher(ErrorTypeInvalid))) != 1 { + t.Errorf("should filter") + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/validation/field/path.go b/vendor/k8s.io/kubernetes/pkg/util/validation/field/path.go new file mode 100644 index 000000000..30ff5a8f7 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/validation/field/path.go @@ -0,0 +1,91 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package field + +import ( + "bytes" + "fmt" + "strconv" +) + +// Path represents the path from some root to a particular field. +type Path struct { + name string // the name of this field or "" if this is an index + index string // if name == "", this is a subscript (index or map key) of the previous element + parent *Path // nil if this is the root element +} + +// NewPath creates a root Path object. +func NewPath(name string, moreNames ...string) *Path { + r := &Path{name: name, parent: nil} + for _, anotherName := range moreNames { + r = &Path{name: anotherName, parent: r} + } + return r +} + +// Root returns the root element of this Path. +func (p *Path) Root() *Path { + for ; p.parent != nil; p = p.parent { + // Do nothing. + } + return p +} + +// Child creates a new Path that is a child of the method receiver. +func (p *Path) Child(name string, moreNames ...string) *Path { + r := NewPath(name, moreNames...) + r.Root().parent = p + return r +} + +// Index indicates that the previous Path is to be subscripted by an int. +// This sets the same underlying value as Key. +func (p *Path) Index(index int) *Path { + return &Path{index: strconv.Itoa(index), parent: p} +} + +// Key indicates that the previous Path is to be subscripted by a string. +// This sets the same underlying value as Index. +func (p *Path) Key(key string) *Path { + return &Path{index: key, parent: p} +} + +// String produces a string representation of the Path. +func (p *Path) String() string { + // make a slice to iterate + elems := []*Path{} + for ; p != nil; p = p.parent { + elems = append(elems, p) + } + + // iterate, but it has to be backwards + buf := bytes.NewBuffer(nil) + for i := range elems { + p := elems[len(elems)-1-i] + if p.parent != nil && len(p.name) > 0 { + // This is either the root or it is a subscript. + buf.WriteString(".") + } + if len(p.name) > 0 { + buf.WriteString(p.name) + } else { + fmt.Fprintf(buf, "[%s]", p.index) + } + } + return buf.String() +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/validation/field/path_test.go b/vendor/k8s.io/kubernetes/pkg/util/validation/field/path_test.go new file mode 100644 index 000000000..42a16e4bd --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/util/validation/field/path_test.go @@ -0,0 +1,123 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package field + +import "testing" + +func TestPath(t *testing.T) { + testCases := []struct { + op func(*Path) *Path + expected string + }{ + { + func(p *Path) *Path { return p }, + "root", + }, + { + func(p *Path) *Path { return p.Child("first") }, + "root.first", + }, + { + func(p *Path) *Path { return p.Child("second") }, + "root.first.second", + }, + { + func(p *Path) *Path { return p.Index(0) }, + "root.first.second[0]", + }, + { + func(p *Path) *Path { return p.Child("third") }, + "root.first.second[0].third", + }, + { + func(p *Path) *Path { return p.Index(93) }, + "root.first.second[0].third[93]", + }, + { + func(p *Path) *Path { return p.parent }, + "root.first.second[0].third", + }, + { + func(p *Path) *Path { return p.parent }, + "root.first.second[0]", + }, + { + func(p *Path) *Path { return p.Key("key") }, + "root.first.second[0][key]", + }, + } + + root := NewPath("root") + p := root + for i, tc := range testCases { + p = tc.op(p) + if p.String() != tc.expected { + t.Errorf("[%d] Expected %q, got %q", i, tc.expected, p.String()) + } + if p.Root() != root { + t.Errorf("[%d] Wrong root: %#v", i, p.Root()) + } + } +} + +func TestPathMultiArg(t *testing.T) { + testCases := []struct { + op func(*Path) *Path + expected string + }{ + { + func(p *Path) *Path { return p }, + "root.first", + }, + { + func(p *Path) *Path { return p.Child("second", "third") }, + "root.first.second.third", + }, + { + func(p *Path) *Path { return p.Index(0) }, + "root.first.second.third[0]", + }, + { + func(p *Path) *Path { return p.parent }, + "root.first.second.third", + }, + { + func(p *Path) *Path { return p.parent }, + "root.first.second", + }, + { + func(p *Path) *Path { return p.parent }, + "root.first", + }, + { + func(p *Path) *Path { return p.parent }, + "root", + }, + } + + root := NewPath("root", "first") + p := root + for i, tc := range testCases { + p = tc.op(p) + if p.String() != tc.expected { + t.Errorf("[%d] Expected %q, got %q", i, tc.expected, p.String()) + } + if p.Root() != root.Root() { + t.Errorf("[%d] Wrong root: %#v", i, p.Root()) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/validation/validation.go b/vendor/k8s.io/kubernetes/pkg/util/validation/validation.go index 854a7ee7b..9607293b7 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/validation/validation.go +++ b/vendor/k8s.io/kubernetes/pkg/util/validation/validation.go @@ -17,6 +17,7 @@ limitations under the License. package validation import ( + "math" "net" "regexp" "strings" @@ -105,6 +106,25 @@ func IsValidPortNum(port int) bool { return 0 < port && port < 65536 } +// Now in libcontainer UID/GID limits is 0 ~ 1<<31 - 1 +// TODO: once we have a type for UID/GID we should make these that type. +const ( + minUserID = 0 + maxUserID = math.MaxInt32 + minGroupID = 0 + maxGroupID = math.MaxInt32 +) + +// IsValidGroupId tests that the argument is a valid gids. +func IsValidGroupId(gid int64) bool { + return minGroupID <= gid && gid <= maxGroupID +} + +// IsValidUserId tests that the argument is a valid uids. +func IsValidUserId(uid int64) bool { + return minUserID <= uid && uid <= maxUserID +} + const doubleHyphensFmt string = ".*(--).*" var doubleHyphensRegexp = regexp.MustCompile("^" + doubleHyphensFmt + "$") @@ -147,3 +167,13 @@ var percentRegexp = regexp.MustCompile("^" + percentFmt + "$") func IsValidPercent(percent string) bool { return percentRegexp.MatchString(percent) } + +const HTTPHeaderNameFmt string = "[-A-Za-z0-9]+" + +var httpHeaderNameRegexp = regexp.MustCompile("^" + HTTPHeaderNameFmt + "$") + +// IsHTTPHeaderName checks that a string conforms to the Go HTTP library's +// definition of a valid header field name (a stricter subset than RFC7230). +func IsHTTPHeaderName(value string) bool { + return httpHeaderNameRegexp.MatchString(value) +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/validation/validation_test.go b/vendor/k8s.io/kubernetes/pkg/util/validation/validation_test.go index f8434493e..38fc63c3f 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/validation/validation_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/validation/validation_test.go @@ -154,6 +154,38 @@ func TestIsValidPortNum(t *testing.T) { } } +func TestIsValidGroupId(t *testing.T) { + goodValues := []int64{0, 1, 1000, 65535, 2147483647} + for _, val := range goodValues { + if !IsValidGroupId(val) { + t.Errorf("expected true for '%d'", val) + } + } + + badValues := []int64{-1, -1003, 2147483648, 4147483647} + for _, val := range badValues { + if IsValidGroupId(val) { + t.Errorf("expected false for '%d'", val) + } + } +} + +func TestIsValidUserId(t *testing.T) { + goodValues := []int64{0, 1, 1000, 65535, 2147483647} + for _, val := range goodValues { + if !IsValidUserId(val) { + t.Errorf("expected true for '%d'", val) + } + } + + badValues := []int64{-1, -1003, 2147483648, 4147483647} + for _, val := range badValues { + if IsValidUserId(val) { + t.Errorf("expected false for '%d'", val) + } + } +} + func TestIsValidPortName(t *testing.T) { goodValues := []string{"telnet", "re-mail-ck", "pop3", "a", "a-1", "1-a", "a-1-b-2-c", "1-a-2-b-3"} for _, val := range goodValues { @@ -276,3 +308,30 @@ func TestIsValidIP(t *testing.T) { } } } + +func TestIsHTTPHeaderName(t *testing.T) { + goodValues := []string{ + // Common ones + "Accept-Encoding", "Host", "If-Modified-Since", "X-Forwarded-For", + // Weirdo, but still conforming names + "a", "ab", "abc", "a1", "-a", "a-", "a-b", "a-1", "a--1--2--b", "--abc-123", + "A", "AB", "AbC", "A1", "-A", "A-", "A-B", "A-1", "A--1--2--B", "--123-ABC", + } + for _, val := range goodValues { + if !IsHTTPHeaderName(val) { + t.Errorf("expected true for '%s'", val) + } + } + + badValues := []string{ + "Host:", "X-Forwarded-For:", "X-@Home", + "", "_", "a_", "_a", "1_", "1_2", ".", "a.", ".a", "a.b", "1.", ".1", "1.2", + " ", "a ", " a", "a b", "1 ", " 1", "1 2", "#a#", "^", ",", ";", "=", "<", + "?", "@", "{", + } + for _, val := range badValues { + if IsHTTPHeaderName(val) { + t.Errorf("expected false for '%s'", val) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/wait/wait.go b/vendor/k8s.io/kubernetes/pkg/util/wait/wait.go index f31349248..31c81b6c2 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/wait/wait.go +++ b/vendor/k8s.io/kubernetes/pkg/util/wait/wait.go @@ -20,8 +20,65 @@ import ( "errors" "math/rand" "time" + + "k8s.io/kubernetes/pkg/util/runtime" ) +// For any test of the style: +// ... +// <- time.After(timeout): +// t.Errorf("Timed out") +// The value for timeout should effectively be "forever." Obviously we don't want our tests to truly lock up forever, but 30s +// is long enough that it is effectively forever for the things that can slow down a run on a heavily contended machine +// (GC, seeks, etc), but not so long as to make a developer ctrl-c a test run if they do happen to break that test. +var ForeverTestTimeout = time.Second * 30 + +// NeverStop may be passed to Until to make it never stop. +var NeverStop <-chan struct{} = make(chan struct{}) + +// Forever is syntactic sugar on top of Until +func Forever(f func(), period time.Duration) { + Until(f, period, NeverStop) +} + +// Until loops until stop channel is closed, running f every period. +// Until is syntactic sugar on top of JitterUntil with zero jitter factor +func Until(f func(), period time.Duration, stopCh <-chan struct{}) { + JitterUntil(f, period, 0.0, stopCh) +} + +// JitterUntil loops until stop channel is closed, running f every period. +// If jitterFactor is positive, the period is jittered before every run of f. +// If jitterFactor is not positive, the period is unchanged. +// Catches any panics, and keeps going. f may not be invoked if +// stop channel is already closed. Pass NeverStop to Until if you +// don't want it stop. +func JitterUntil(f func(), period time.Duration, jitterFactor float64, stopCh <-chan struct{}) { + select { + case <-stopCh: + return + default: + } + + for { + func() { + defer runtime.HandleCrash() + f() + }() + + jitteredPeriod := period + if jitterFactor > 0.0 { + jitteredPeriod = Jitter(period, jitterFactor) + } + + select { + case <-stopCh: + return + case <-time.After(jitteredPeriod): + } + } +} + // Jitter returns a time.Duration between duration and duration + maxFactor * duration, // to allow clients to avoid converging on periodic behavior. If maxFactor is 0.0, a // suggested default value will be chosen. @@ -40,6 +97,37 @@ var ErrWaitTimeout = errors.New("timed out waiting for the condition") // if the loop should be aborted. type ConditionFunc func() (done bool, err error) +// Backoff is parameters applied to a Backoff function. +type Backoff struct { + Duration time.Duration + Factor float64 + Jitter float64 + Steps int +} + +// ExponentialBackoff repeats a condition check up to steps times, increasing the wait +// by multipling the previous duration by factor. If jitter is greater than zero, +// a random amount of each duration is added (between duration and duration*(1+jitter)). +// If the condition never returns true, ErrWaitTimeout is returned. All other errors +// terminate immediately. +func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error { + duration := backoff.Duration + for i := 0; i < backoff.Steps; i++ { + if i != 0 { + adjusted := duration + if backoff.Jitter > 0.0 { + adjusted = Jitter(duration, backoff.Jitter) + } + time.Sleep(adjusted) + duration = time.Duration(float64(duration) * backoff.Factor) + } + if ok, err := condition(); err != nil || ok { + return err + } + } + return ErrWaitTimeout +} + // Poll tries a condition func until it returns true, an error, or the timeout // is reached. condition will always be invoked at least once but some intervals // may be missed if the condition takes too long or the time window is too short. @@ -132,7 +220,12 @@ func poller(interval, timeout time.Duration) WaitFunc { for { select { case <-tick.C: - ch <- struct{}{} + // If the consumer isn't ready for this signal drop it and + // check the other channels. + select { + case ch <- struct{}{}: + default: + } case <-after: return case <-done: diff --git a/vendor/k8s.io/kubernetes/pkg/util/wait/wait_test.go b/vendor/k8s.io/kubernetes/pkg/util/wait/wait_test.go index 315b9b4ca..28de7e01b 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/wait/wait_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/wait/wait_test.go @@ -18,13 +18,149 @@ package wait import ( "errors" + "fmt" + "sync" "sync/atomic" "testing" "time" - - "k8s.io/kubernetes/pkg/util" ) +func TestUntil(t *testing.T) { + ch := make(chan struct{}) + close(ch) + Until(func() { + t.Fatal("should not have been invoked") + }, 0, ch) + + ch = make(chan struct{}) + called := make(chan struct{}) + go func() { + Until(func() { + called <- struct{}{} + }, 0, ch) + close(called) + }() + <-called + close(ch) + <-called +} + +func TestUntilReturnsImmediately(t *testing.T) { + now := time.Now() + ch := make(chan struct{}) + Until(func() { + close(ch) + }, 30*time.Second, ch) + if now.Add(25 * time.Second).Before(time.Now()) { + t.Errorf("Until did not return immediately when the stop chan was closed inside the func") + } +} + +func TestJitterUntil(t *testing.T) { + ch := make(chan struct{}) + // if a channel is closed JitterUntil never calls function f + // and returns imidiatelly + close(ch) + JitterUntil(func() { + t.Fatal("should not have been invoked") + }, 0, 1.0, ch) + + ch = make(chan struct{}) + called := make(chan struct{}) + go func() { + JitterUntil(func() { + called <- struct{}{} + }, 0, 1.0, ch) + close(called) + }() + <-called + close(ch) + <-called +} + +func TestJitterUntilReturnsImmediately(t *testing.T) { + now := time.Now() + ch := make(chan struct{}) + JitterUntil(func() { + close(ch) + }, 30*time.Second, 1.0, ch) + if now.Add(25 * time.Second).Before(time.Now()) { + t.Errorf("JitterUntil did not return immediately when the stop chan was closed inside the func") + } +} + +func TestJitterUntilNegativeFactor(t *testing.T) { + now := time.Now() + ch := make(chan struct{}) + called := make(chan struct{}) + received := make(chan struct{}) + go func() { + JitterUntil(func() { + called <- struct{}{} + <-received + }, time.Second, -30.0, ch) + }() + // first loop + <-called + received <- struct{}{} + // second loop + <-called + close(ch) + received <- struct{}{} + + // it should take at most 2 seconds + some overhead, not 3 + if now.Add(3 * time.Second).Before(time.Now()) { + t.Errorf("JitterUntil did not returned after predefined period with negative jitter factor when the stop chan was closed inside the func") + } + +} + +func TestExponentialBackoff(t *testing.T) { + opts := Backoff{Factor: 1.0, Steps: 3} + + // waits up to steps + i := 0 + err := ExponentialBackoff(opts, func() (bool, error) { + i++ + return false, nil + }) + if err != ErrWaitTimeout || i != opts.Steps { + t.Errorf("unexpected error: %v", err) + } + + // returns immediately + i = 0 + err = ExponentialBackoff(opts, func() (bool, error) { + i++ + return true, nil + }) + if err != nil || i != 1 { + t.Errorf("unexpected error: %v", err) + } + + // returns immediately on error + testErr := fmt.Errorf("some other error") + err = ExponentialBackoff(opts, func() (bool, error) { + return false, testErr + }) + if err != testErr { + t.Errorf("unexpected error: %v", err) + } + + // invoked multiple times + i = 1 + err = ExponentialBackoff(opts, func() (bool, error) { + if i < opts.Steps { + i++ + return false, nil + } + return true, nil + }) + if err != nil || i != opts.Steps { + t.Errorf("unexpected error: %v", err) + } +} + func TestPoller(t *testing.T) { done := make(chan struct{}) defer close(done) @@ -39,7 +175,7 @@ DRAIN: break DRAIN } count++ - case <-time.After(util.ForeverTestTimeout): + case <-time.After(ForeverTestTimeout): t.Errorf("unexpected timeout after poll") } } @@ -48,10 +184,17 @@ DRAIN: } } -func fakeTicker(max int, used *int32) WaitFunc { +type fakePoller struct { + max int + used int32 // accessed with atomics + wg sync.WaitGroup +} + +func fakeTicker(max int, used *int32, doneFunc func()) WaitFunc { return func(done <-chan struct{}) <-chan struct{} { ch := make(chan struct{}) go func() { + defer doneFunc() defer close(ch) for i := 0; i < max; i++ { select { @@ -68,13 +211,9 @@ func fakeTicker(max int, used *int32) WaitFunc { } } -type fakePoller struct { - max int - used int32 // accessed with atomics -} - -func (fp *fakePoller) GetWaitFunc(interval, timeout time.Duration) WaitFunc { - return fakeTicker(fp.max, &fp.used) +func (fp *fakePoller) GetWaitFunc() WaitFunc { + fp.wg.Add(1) + return fakeTicker(fp.max, &fp.used, fp.wg.Done) } func TestPoll(t *testing.T) { @@ -84,9 +223,10 @@ func TestPoll(t *testing.T) { return true, nil }) fp := fakePoller{max: 1} - if err := pollInternal(fp.GetWaitFunc(time.Microsecond, time.Microsecond), f); err != nil { + if err := pollInternal(fp.GetWaitFunc(), f); err != nil { t.Fatalf("unexpected error %v", err) } + fp.wg.Wait() if invocations != 1 { t.Errorf("Expected exactly one invocation, got %d", invocations) } @@ -94,19 +234,19 @@ func TestPoll(t *testing.T) { if used != 1 { t.Errorf("Expected exactly one tick, got %d", used) } +} +func TestPollError(t *testing.T) { expectedError := errors.New("Expected error") - f = ConditionFunc(func() (bool, error) { + f := ConditionFunc(func() (bool, error) { return false, expectedError }) - fp = fakePoller{max: 1} - if err := pollInternal(fp.GetWaitFunc(time.Microsecond, time.Microsecond), f); err == nil || err != expectedError { + fp := fakePoller{max: 1} + if err := pollInternal(fp.GetWaitFunc(), f); err == nil || err != expectedError { t.Fatalf("Expected error %v, got none %v", expectedError, err) } - if invocations != 1 { - t.Errorf("Expected exactly one invocation, got %d", invocations) - } - used = atomic.LoadInt32(&fp.used) + fp.wg.Wait() + used := atomic.LoadInt32(&fp.used) if used != 1 { t.Errorf("Expected exactly one tick, got %d", used) } @@ -119,9 +259,10 @@ func TestPollImmediate(t *testing.T) { return true, nil }) fp := fakePoller{max: 0} - if err := pollImmediateInternal(fp.GetWaitFunc(time.Microsecond, time.Microsecond), f); err != nil { + if err := pollImmediateInternal(fp.GetWaitFunc(), f); err != nil { t.Fatalf("unexpected error %v", err) } + // We don't need to wait for fp.wg, as pollImmediate shouldn't call WaitFunc at all. if invocations != 1 { t.Errorf("Expected exactly one invocation, got %d", invocations) } @@ -129,19 +270,19 @@ func TestPollImmediate(t *testing.T) { if used != 0 { t.Errorf("Expected exactly zero ticks, got %d", used) } +} +func TestPollImmediateError(t *testing.T) { expectedError := errors.New("Expected error") - f = ConditionFunc(func() (bool, error) { + f := ConditionFunc(func() (bool, error) { return false, expectedError }) - fp = fakePoller{max: 0} - if err := pollImmediateInternal(fp.GetWaitFunc(time.Microsecond, time.Microsecond), f); err == nil || err != expectedError { + fp := fakePoller{max: 0} + if err := pollImmediateInternal(fp.GetWaitFunc(), f); err == nil || err != expectedError { t.Fatalf("Expected error %v, got none %v", expectedError, err) } - if invocations != 1 { - t.Errorf("Expected exactly one invocation, got %d", invocations) - } - used = atomic.LoadInt32(&fp.used) + // We don't need to wait for fp.wg, as pollImmediate shouldn't call WaitFunc at all. + used := atomic.LoadInt32(&fp.used) if used != 0 { t.Errorf("Expected exactly zero ticks, got %d", used) } @@ -180,18 +321,17 @@ func TestPollForever(t *testing.T) { if !open { t.Fatalf("did not expect channel to be closed") } - case <-time.After(util.ForeverTestTimeout): + case <-time.After(ForeverTestTimeout): t.Fatalf("channel did not return at least once within the poll interval") } } - // at most two poll notifications should be sent once we return from the condition + // at most one poll notification should be sent once we return from the condition done <- struct{}{} go func() { for i := 0; i < 2; i++ { _, open := <-ch - if open { - <-complete + if !open { return } } @@ -238,7 +378,7 @@ func TestWaitFor(t *testing.T) { } for k, c := range testCases { invocations = 0 - ticker := fakeTicker(c.Ticks, nil) + ticker := fakeTicker(c.Ticks, nil, func() {}) err := func() error { done := make(chan struct{}) defer close(done) @@ -257,3 +397,18 @@ func TestWaitFor(t *testing.T) { } } } + +func TestWaitForWithDelay(t *testing.T) { + done := make(chan struct{}) + defer close(done) + WaitFor(poller(time.Millisecond, ForeverTestTimeout), func() (bool, error) { + time.Sleep(10 * time.Millisecond) + return true, nil + }, done) + // If polling goroutine doesn't see the done signal it will leak timers. + select { + case done <- struct{}{}: + case <-time.After(ForeverTestTimeout): + t.Errorf("expected an ack of the done signal.") + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/util/wsstream/conn.go b/vendor/k8s.io/kubernetes/pkg/util/wsstream/conn.go index 0c1033cd8..3934a5b5b 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/wsstream/conn.go +++ b/vendor/k8s.io/kubernetes/pkg/util/wsstream/conn.go @@ -27,7 +27,7 @@ import ( "github.com/golang/glog" "golang.org/x/net/websocket" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/runtime" ) // The Websocket subprotocol "channel.k8s.io" prepends each binary message with a byte indicating @@ -92,14 +92,12 @@ func IsWebSocketRequest(req *http.Request) bool { // ignoreReceives reads from a WebSocket until it is closed, then returns. If timeout is set, the // read and write deadlines are pushed every time a new message is received. func ignoreReceives(ws *websocket.Conn, timeout time.Duration) { - defer util.HandleCrash() + defer runtime.HandleCrash() var data []byte for { resetTimeout(ws, timeout) if err := websocket.Message.Receive(ws, &data); err != nil { - if err == io.EOF { - return - } + return } } } @@ -165,7 +163,7 @@ func (conn *Conn) SetIdleTimeout(duration time.Duration) { // Open the connection and create channels for reading and writing. func (conn *Conn) Open(w http.ResponseWriter, req *http.Request) ([]io.ReadWriteCloser, error) { go func() { - defer util.HandleCrash() + defer runtime.HandleCrash() defer conn.Close() websocket.Server{Handshake: conn.handshake, Handler: conn.handle}.ServeHTTP(w, req) }() diff --git a/vendor/k8s.io/kubernetes/pkg/util/wsstream/conn_test.go b/vendor/k8s.io/kubernetes/pkg/util/wsstream/conn_test.go index c77d037b0..7695ad81d 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/wsstream/conn_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/wsstream/conn_test.go @@ -36,8 +36,10 @@ func newServer(handler websocket.Handler) (*httptest.Server, string) { func TestRawConn(t *testing.T) { conn := NewConn(ReadWriteChannel, ReadWriteChannel, IgnoreChannel, ReadChannel, WriteChannel) - s, addr := newServer(conn.handle) - defer s.Close() + // TODO: Uncomment next two lines and remove third line when fix #19254 + // s, addr := newServer(conn.handle) + // defer s.Close() + _, addr := newServer(conn.handle) client, err := websocket.Dial("ws://"+addr, "", "http://localhost/") if err != nil { @@ -113,8 +115,10 @@ func TestRawConn(t *testing.T) { func TestBase64Conn(t *testing.T) { conn := NewConn(ReadWriteChannel, ReadWriteChannel) - s, addr := newServer(conn.handle) - defer s.Close() + // TODO: Uncomment next two lines and remove third line when fix #19254 + // s, addr := newServer(conn.handle) + // defer s.Close() + _, addr := newServer(conn.handle) config, err := websocket.NewConfig("ws://"+addr, "http://localhost/") if err != nil { diff --git a/vendor/k8s.io/kubernetes/pkg/util/wsstream/stream.go b/vendor/k8s.io/kubernetes/pkg/util/wsstream/stream.go index 5b3827f04..846d6c3a1 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/wsstream/stream.go +++ b/vendor/k8s.io/kubernetes/pkg/util/wsstream/stream.go @@ -23,7 +23,7 @@ import ( "time" "golang.org/x/net/websocket" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/runtime" ) // The WebSocket subprotocol "binary.k8s.io" will only send messages to the @@ -71,7 +71,7 @@ func (r *Reader) handshake(config *websocket.Config, req *http.Request) error { // method completes. func (r *Reader) Copy(w http.ResponseWriter, req *http.Request) error { go func() { - defer util.HandleCrash() + defer runtime.HandleCrash() websocket.Server{Handshake: r.handshake, Handler: r.handle}.ServeHTTP(w, req) }() return <-r.err diff --git a/vendor/k8s.io/kubernetes/pkg/util/wsstream/stream_test.go b/vendor/k8s.io/kubernetes/pkg/util/wsstream/stream_test.go index 0bd710c7e..6d9e88054 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/wsstream/stream_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/wsstream/stream_test.go @@ -110,28 +110,31 @@ func TestStreamSurvivesPanic(t *testing.T) { } func TestStreamClosedDuringRead(t *testing.T) { - ch := make(chan struct{}) - input := "some random text" - errs := &errorReader{ - reads: [][]byte{ - []byte("some random"), - []byte(" text"), - }, - err: fmt.Errorf("stuff"), - pause: ch, - } - r := NewReader(errs, false) + for i := 0; i < 25; i++ { + ch := make(chan struct{}) + input := "some random text" + errs := &errorReader{ + reads: [][]byte{ + []byte("some random"), + []byte(" text"), + }, + err: fmt.Errorf("stuff"), + pause: ch, + } + r := NewReader(errs, false) - data, err := readWebSocket(r, t, func(c *websocket.Conn) { - c.Close() - time.Sleep(time.Millisecond) - close(ch) - }) - if !reflect.DeepEqual(data, []byte(input)) { - t.Errorf("unexpected server read: %v", data) - } - if err == nil || !strings.Contains(err.Error(), "use of closed network connection") { - t.Fatal(err) + data, err := readWebSocket(r, t, func(c *websocket.Conn) { + c.Close() + close(ch) + }) + // verify that the data returned by the server on an early close always has a specific error + if err == nil || !strings.Contains(err.Error(), "use of closed network connection") { + t.Fatal(err) + } + // verify that the data returned is a strict subset of the input + if !bytes.HasPrefix([]byte(input), data) && len(data) != 0 { + t.Fatalf("unexpected server read: %q", string(data)) + } } } diff --git a/vendor/k8s.io/kubernetes/pkg/util/yaml/decoder.go b/vendor/k8s.io/kubernetes/pkg/util/yaml/decoder.go index 9badc1ea3..5846fc20f 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/yaml/decoder.go +++ b/vendor/k8s.io/kubernetes/pkg/util/yaml/decoder.go @@ -29,8 +29,8 @@ import ( // ToJSON converts a single YAML document into a JSON document // or returns an error. If the document appears to be JSON the -// YAML decoding path is not used (so that error messages are) -// JSON specific. +// YAML decoding path is not used (so that error messages are +// JSON specific). func ToJSON(data []byte) ([]byte, error) { if hasJSONPrefix(data) { return data, nil @@ -136,7 +136,7 @@ func NewYAMLOrJSONDecoder(r io.Reader, bufferSize int) *YAMLOrJSONDecoder { // provide object, or returns an error. func (d *YAMLOrJSONDecoder) Decode(into interface{}) error { if d.decoder == nil { - buffer, isJSON := guessJSONStream(d.r, d.bufferSize) + buffer, isJSON := GuessJSONStream(d.r, d.bufferSize) if isJSON { glog.V(4).Infof("decoding stream as JSON") d.decoder = json.NewDecoder(buffer) @@ -148,10 +148,10 @@ func (d *YAMLOrJSONDecoder) Decode(into interface{}) error { return d.decoder.Decode(into) } -// guessJSONStream scans the provided reader up to size, looking +// GuessJSONStream scans the provided reader up to size, looking // for an open brace indicating this is JSON. It will return the // bufio.Reader it creates for the consumer. -func guessJSONStream(r io.Reader, size int) (io.Reader, bool) { +func GuessJSONStream(r io.Reader, size int) (io.Reader, bool) { buffer := bufio.NewReaderSize(r, size) b, _ := buffer.Peek(size) return buffer, hasJSONPrefix(b) diff --git a/vendor/k8s.io/kubernetes/pkg/util/yaml/decoder_test.go b/vendor/k8s.io/kubernetes/pkg/util/yaml/decoder_test.go index c4658a340..e1e3f6609 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/yaml/decoder_test.go +++ b/vendor/k8s.io/kubernetes/pkg/util/yaml/decoder_test.go @@ -62,7 +62,7 @@ func TestSplitYAMLDocument(t *testing.T) { } func TestGuessJSON(t *testing.T) { - if r, isJSON := guessJSONStream(bytes.NewReader([]byte(" \n{}")), 100); !isJSON { + if r, isJSON := GuessJSONStream(bytes.NewReader([]byte(" \n{}")), 100); !isJSON { t.Fatalf("expected stream to be JSON") } else { b := make([]byte, 30) diff --git a/vendor/k8s.io/kubernetes/pkg/version/base.go b/vendor/k8s.io/kubernetes/pkg/version/base.go index b055bed4d..e00792df0 100644 --- a/vendor/k8s.io/kubernetes/pkg/version/base.go +++ b/vendor/k8s.io/kubernetes/pkg/version/base.go @@ -43,7 +43,7 @@ var ( gitMinor string = "" // minor version, numeric possibly followed by "+" // semantic version, dervied by build scripts (see - // https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/design/versioning.md + // https://github.com/kubernetes/kubernetes/blob/master/docs/design/versioning.md // for a detailed discussion of this field) // // TODO: This field is still called "gitVersion" for legacy diff --git a/vendor/k8s.io/kubernetes/pkg/version/semver.go b/vendor/k8s.io/kubernetes/pkg/version/semver.go new file mode 100644 index 000000000..1b5a845ad --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/version/semver.go @@ -0,0 +1,50 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package version + +import ( + "strings" + "unicode" + + "github.com/blang/semver" + "github.com/golang/glog" +) + +func Parse(gitversion string) (semver.Version, error) { + // optionally trim leading spaces then one v + var seen bool + gitversion = strings.TrimLeftFunc(gitversion, func(ch rune) bool { + if seen { + return false + } + if ch == 'v' { + seen = true + return true + } + return unicode.IsSpace(ch) + }) + + return semver.Make(gitversion) +} + +func MustParse(gitversion string) semver.Version { + v, err := Parse(gitversion) + if err != nil { + glog.Fatalf("failed to parse semver from gitversion %q: %v", gitversion, err) + } + return v +} diff --git a/vendor/k8s.io/kubernetes/pkg/version/semver_test.go b/vendor/k8s.io/kubernetes/pkg/version/semver_test.go new file mode 100644 index 000000000..4f4de7589 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/version/semver_test.go @@ -0,0 +1,47 @@ +/* +Copyright 2015 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package version + +import "testing" + +func TestParseVersion(t *testing.T) { + cases := []struct { + version string + expectErr bool + }{ + {version: "v1.0.1-alpha"}, + {version: "v0.19.3"}, + {version: "0.19.3"}, + {version: "v1.2.0-alpha.3.1264+0655e65b435106-dirty"}, + {version: "1.2.0-alpha.3.1264+0655e65b435106-dirty"}, + {version: "1.2.0-alpha.3.1264+0655e65b435106-dirty"}, + {version: "1.0.0"}, + {version: "\t v1.0.0"}, + {version: "vv1.0.0", expectErr: true}, + {version: "blah1.0.0", expectErr: true}, + } + + for i, c := range cases { + _, err := Parse(c.version) + if err != nil && !c.expectErr { + t.Errorf("[%v]unexpected error: %v", i, err) + } + if err == nil && c.expectErr { + t.Errorf("[%v]expected error for %s", i, c.version) + } + } +} diff --git a/vendor/k8s.io/kubernetes/pkg/version/verflag/verflag.go b/vendor/k8s.io/kubernetes/pkg/version/verflag/verflag.go index 60683214f..eed730ba4 100644 --- a/vendor/k8s.io/kubernetes/pkg/version/verflag/verflag.go +++ b/vendor/k8s.io/kubernetes/pkg/version/verflag/verflag.go @@ -74,6 +74,8 @@ func (v *versionValue) Type() string { func VersionVar(p *versionValue, name string, value versionValue, usage string) { *p = value flag.Var(p, name, usage) + // "--version" will be treated as "--version=true" + flag.Lookup(name).NoOptDefVal = "true" } func Version(name string, value versionValue, usage string) *versionValue { diff --git a/vendor/k8s.io/kubernetes/pkg/watch/iowatcher.go b/vendor/k8s.io/kubernetes/pkg/watch/iowatcher.go index 6003d0886..505e6bfca 100644 --- a/vendor/k8s.io/kubernetes/pkg/watch/iowatcher.go +++ b/vendor/k8s.io/kubernetes/pkg/watch/iowatcher.go @@ -22,7 +22,8 @@ import ( "github.com/golang/glog" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/net" + utilruntime "k8s.io/kubernetes/pkg/util/runtime" ) // Decoder allows StreamWatcher to watch any stream for which a Decoder can be written. @@ -87,7 +88,7 @@ func (sw *StreamWatcher) stopping() bool { func (sw *StreamWatcher) receive() { defer close(sw.result) defer sw.Stop() - defer util.HandleCrash() + defer utilruntime.HandleCrash() for { action, obj, err := sw.source.Decode() if err != nil { @@ -102,7 +103,7 @@ func (sw *StreamWatcher) receive() { glog.V(1).Infof("Unexpected EOF during watch stream event decoding: %v", err) default: msg := "Unable to decode an event from the watch stream: %v" - if util.IsProbableEOF(err) { + if net.IsProbableEOF(err) { glog.V(5).Infof(msg, err) } else { glog.Errorf(msg, err) diff --git a/vendor/k8s.io/kubernetes/pkg/watch/json/decoder.go b/vendor/k8s.io/kubernetes/pkg/watch/json/decoder.go index f6c0924dd..d1632336f 100644 --- a/vendor/k8s.io/kubernetes/pkg/watch/json/decoder.go +++ b/vendor/k8s.io/kubernetes/pkg/watch/json/decoder.go @@ -56,7 +56,7 @@ func (d *Decoder) Decode() (watch.EventType, runtime.Object, error) { return "", nil, fmt.Errorf("got invalid watch event type: %v", got.Type) } - obj, err := d.codec.Decode(got.Object.RawJSON) + obj, err := runtime.Decode(d.codec, got.Object.RawJSON) if err != nil { return "", nil, fmt.Errorf("unable to decode watch event: %v", err) } diff --git a/vendor/k8s.io/kubernetes/pkg/watch/json/decoder_test.go b/vendor/k8s.io/kubernetes/pkg/watch/json/decoder_test.go index 95312acb2..ceb50b2ce 100644 --- a/vendor/k8s.io/kubernetes/pkg/watch/json/decoder_test.go +++ b/vendor/k8s.io/kubernetes/pkg/watch/json/decoder_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/runtime" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/watch" ) @@ -39,7 +39,7 @@ func TestDecoder(t *testing.T) { expect := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} encoder := json.NewEncoder(in) go func() { - data, err := testapi.Default.Codec().Encode(expect) + data, err := runtime.Encode(testapi.Default.Codec(), expect) if err != nil { t.Fatalf("Unexpected error %v", err) } @@ -99,7 +99,7 @@ func TestDecoder_SourceClose(t *testing.T) { select { case <-done: break - case <-time.After(util.ForeverTestTimeout): + case <-time.After(wait.ForeverTestTimeout): t.Error("Timeout") } } diff --git a/vendor/k8s.io/kubernetes/pkg/watch/json/encoder.go b/vendor/k8s.io/kubernetes/pkg/watch/json/encoder.go index 1110e9293..1eaf6a8a0 100644 --- a/vendor/k8s.io/kubernetes/pkg/watch/json/encoder.go +++ b/vendor/k8s.io/kubernetes/pkg/watch/json/encoder.go @@ -30,11 +30,11 @@ import ( type Encoder struct { w io.Writer encoder *json.Encoder - codec runtime.Codec + codec runtime.Encoder } // NewEncoder creates an Encoder for the given writer and codec -func NewEncoder(w io.Writer, codec runtime.Codec) *Encoder { +func NewEncoder(w io.Writer, codec runtime.Encoder) *Encoder { return &Encoder{ w: w, encoder: json.NewEncoder(w), diff --git a/vendor/k8s.io/kubernetes/pkg/watch/json/types.go b/vendor/k8s.io/kubernetes/pkg/watch/json/types.go index a17a7b811..28ee0dec7 100644 --- a/vendor/k8s.io/kubernetes/pkg/watch/json/types.go +++ b/vendor/k8s.io/kubernetes/pkg/watch/json/types.go @@ -40,12 +40,12 @@ type WatchEvent struct { } // Object converts a watch.Event into an appropriately serializable JSON object -func Object(codec runtime.Codec, event *watch.Event) (interface{}, error) { +func Object(encoder runtime.Encoder, event *watch.Event) (interface{}, error) { obj, ok := event.Object.(runtime.Object) if !ok { return nil, fmt.Errorf("the event object cannot be safely converted to JSON: %v", reflect.TypeOf(event.Object).Name()) } - data, err := codec.Encode(obj) + data, err := runtime.Encode(encoder, obj) if err != nil { return nil, err } diff --git a/vendor/k8s.io/kubernetes/pkg/watch/mux.go b/vendor/k8s.io/kubernetes/pkg/watch/mux.go index c123968d8..700c26bca 100644 --- a/vendor/k8s.io/kubernetes/pkg/watch/mux.go +++ b/vendor/k8s.io/kubernetes/pkg/watch/mux.go @@ -19,6 +19,7 @@ package watch import ( "sync" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" ) @@ -80,7 +81,9 @@ const internalRunFunctionMarker = "internal-do-function" // a function type we can shoehorn into the queue. type functionFakeRuntimeObject func() -func (functionFakeRuntimeObject) IsAnAPIObject() {} +func (obj functionFakeRuntimeObject) GetObjectKind() unversioned.ObjectKind { + return unversioned.EmptyObjectKind +} // Execute f, blocking the incoming queue (and waiting for it to drain first). // The purpose of this terrible hack is so that watchers added after an event diff --git a/vendor/k8s.io/kubernetes/pkg/watch/mux_test.go b/vendor/k8s.io/kubernetes/pkg/watch/mux_test.go index 515833f36..23976c065 100644 --- a/vendor/k8s.io/kubernetes/pkg/watch/mux_test.go +++ b/vendor/k8s.io/kubernetes/pkg/watch/mux_test.go @@ -22,7 +22,8 @@ import ( "testing" "time" - "k8s.io/kubernetes/pkg/util" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/util/wait" ) type myType struct { @@ -30,7 +31,7 @@ type myType struct { Value string } -func (*myType) IsAnAPIObject() {} +func (obj *myType) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } func TestBroadcaster(t *testing.T) { table := []Event{ @@ -112,7 +113,7 @@ func TestBroadcasterWatcherStopDeadlock(t *testing.T) { }(m.Watch(), m.Watch()) m.Action(Added, &myType{}) select { - case <-time.After(util.ForeverTestTimeout): + case <-time.After(wait.ForeverTestTimeout): t.Error("timeout: deadlocked") case <-done: } diff --git a/vendor/k8s.io/kubernetes/pkg/watch/watch_test.go b/vendor/k8s.io/kubernetes/pkg/watch/watch_test.go index 7088e4f80..33b6e5cc0 100644 --- a/vendor/k8s.io/kubernetes/pkg/watch/watch_test.go +++ b/vendor/k8s.io/kubernetes/pkg/watch/watch_test.go @@ -18,11 +18,13 @@ package watch import ( "testing" + + "k8s.io/kubernetes/pkg/api/unversioned" ) type testType string -func (testType) IsAnAPIObject() {} +func (obj testType) GetObjectKind() unversioned.ObjectKind { return unversioned.EmptyObjectKind } func TestFake(t *testing.T) { f := NewFake() diff --git a/vendor/manifest b/vendor/manifest index d09ba1086..55cd672ce 100644 --- a/vendor/manifest +++ b/vendor/manifest @@ -52,6 +52,12 @@ "branch": "master", "path": "/quantile" }, + { + "importpath": "github.com/blang/semver", + "repository": "https://github.com/blang/semver", + "revision": "aea32c919a18e5ef4537bbd283ff29594b1b0165", + "branch": "master" + }, { "importpath": "github.com/bluele/gcache", "repository": "https://github.com/bluele/gcache", @@ -476,6 +482,13 @@ "branch": "master", "path": "/pkg/mount" }, + { + "importpath": "github.com/docker/docker/pkg/parsers", + "repository": "https://github.com/docker/docker", + "revision": "0f5c9d301b9b1cca66b3ea0f9dec3b5317d3686d", + "branch": "HEAD", + "path": "/pkg/parsers" + }, { "importpath": "github.com/docker/docker/pkg/units", "repository": "https://github.com/docker/docker", @@ -483,6 +496,12 @@ "branch": "master", "path": "/pkg/units" }, + { + "importpath": "github.com/docker/go-units", + "repository": "https://github.com/docker/go-units", + "revision": "5d2041e26a699eaca682e2ea41c8f891e1060444", + "branch": "master" + }, { "importpath": "github.com/docker/libcontainer/cgroups", "repository": "https://github.com/docker/libcontainer", @@ -633,7 +652,7 @@ { "importpath": "github.com/juju/ratelimit", "repository": "https://github.com/juju/ratelimit", - "revision": "772f5c38e468398c4511514f4f6aa9a4185bc0a0", + "revision": "77ed1c8a01217656d2080ad51981f6e99adaa177", "branch": "master" }, { @@ -661,6 +680,34 @@ "revision": "179d4d0c4d8d407a32af483c2354df1d2c91e6c3", "branch": "master" }, + { + "importpath": "github.com/opencontainers/runc/libcontainer/cgroups", + "repository": "https://github.com/opencontainers/runc", + "revision": "361f9b7921665b5894faef36fc8430aec573dfa4", + "branch": "master", + "path": "/libcontainer/cgroups" + }, + { + "importpath": "github.com/opencontainers/runc/libcontainer/cgroups/fs", + "repository": "https://github.com/opencontainers/runc", + "revision": "361f9b7921665b5894faef36fc8430aec573dfa4", + "branch": "master", + "path": "/libcontainer/cgroups/fs" + }, + { + "importpath": "github.com/opencontainers/runc/libcontainer/configs", + "repository": "https://github.com/opencontainers/runc", + "revision": "361f9b7921665b5894faef36fc8430aec573dfa4", + "branch": "master", + "path": "/libcontainer/configs" + }, + { + "importpath": "github.com/opencontainers/runc/libcontainer/system", + "repository": "https://github.com/opencontainers/runc", + "revision": "361f9b7921665b5894faef36fc8430aec573dfa4", + "branch": "master", + "path": "/libcontainer/system" + }, { "importpath": "github.com/opencontainers/runc/libcontainer/user", "repository": "https://github.com/opencontainers/runc", @@ -668,6 +715,13 @@ "branch": "master", "path": "/libcontainer/user" }, + { + "importpath": "github.com/opencontainers/runc/libcontainer/utils", + "repository": "https://github.com/opencontainers/runc", + "revision": "361f9b7921665b5894faef36fc8430aec573dfa4", + "branch": "master", + "path": "/libcontainer/utils" + }, { "importpath": "github.com/pborman/uuid", "repository": "https://github.com/pborman/uuid", @@ -748,7 +802,7 @@ { "importpath": "github.com/ugorji/go/codec", "repository": "https://github.com/ugorji/go", - "revision": "8a2a3a8c488c3ebd98f422a965260278267a0551", + "revision": "f4485b318aadd133842532f841dc205a8e339d74", "branch": "master", "path": "/codec" }, @@ -802,161 +856,245 @@ { "importpath": "k8s.io/kubernetes/pkg/api", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/api" }, + { + "importpath": "k8s.io/kubernetes/pkg/api/unversioned", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/api/unversioned" + }, + { + "importpath": "k8s.io/kubernetes/pkg/apimachinery", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/apimachinery" + }, + { + "importpath": "k8s.io/kubernetes/pkg/apis/authorization", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/apis/authorization" + }, + { + "importpath": "k8s.io/kubernetes/pkg/apis/authorization/install", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/apis/authorization/install" + }, + { + "importpath": "k8s.io/kubernetes/pkg/apis/componentconfig", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/apis/componentconfig" + }, + { + "importpath": "k8s.io/kubernetes/pkg/apis/componentconfig/install", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/apis/componentconfig/install" + }, { "importpath": "k8s.io/kubernetes/pkg/apis/extensions", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/apis/extensions" }, + { + "importpath": "k8s.io/kubernetes/pkg/apis/metrics", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/apis/metrics" + }, + { + "importpath": "k8s.io/kubernetes/pkg/apis/metrics/install", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/apis/metrics/install" + }, { "importpath": "k8s.io/kubernetes/pkg/auth/user", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/auth/user" }, { "importpath": "k8s.io/kubernetes/pkg/capabilities", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/capabilities" }, { "importpath": "k8s.io/kubernetes/pkg/client/cache", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/client/cache" }, + { + "importpath": "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/client/clientset_generated/internalclientset" + }, { "importpath": "k8s.io/kubernetes/pkg/client/metrics", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/client/metrics" }, + { + "importpath": "k8s.io/kubernetes/pkg/client/transport", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/client/transport" + }, + { + "importpath": "k8s.io/kubernetes/pkg/client/typed/generated/core/unversioned", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/client/typed/generated/core/unversioned" + }, + { + "importpath": "k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/client/typed/generated/extensions/unversioned" + }, { "importpath": "k8s.io/kubernetes/pkg/client/unversioned", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/client/unversioned" }, { "importpath": "k8s.io/kubernetes/pkg/conversion", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/conversion" }, + { + "importpath": "k8s.io/kubernetes/pkg/credentialprovider", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/credentialprovider" + }, { "importpath": "k8s.io/kubernetes/pkg/fieldpath", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/fieldpath" }, { "importpath": "k8s.io/kubernetes/pkg/fields", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/fields" }, { "importpath": "k8s.io/kubernetes/pkg/kubectl", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/kubectl" }, { - "importpath": "k8s.io/kubernetes/pkg/kubelet/qos/util", + "importpath": "k8s.io/kubernetes/pkg/kubelet/qos", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", - "path": "/pkg/kubelet/qos/util" + "path": "/pkg/kubelet/qos" }, { "importpath": "k8s.io/kubernetes/pkg/labels", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/labels" }, + { + "importpath": "k8s.io/kubernetes/pkg/master/ports", + "repository": "https://github.com/kubernetes/kubernetes", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", + "branch": "master", + "path": "/pkg/master/ports" + }, { "importpath": "k8s.io/kubernetes/pkg/runtime", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/runtime" }, { "importpath": "k8s.io/kubernetes/pkg/storage", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/storage" }, - { - "importpath": "k8s.io/kubernetes/pkg/storage/etcd", - "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", - "branch": "master", - "path": "/pkg/storage/etcd" - }, - { - "importpath": "k8s.io/kubernetes/pkg/tools", - "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", - "branch": "master", - "path": "/pkg/tools" - }, { "importpath": "k8s.io/kubernetes/pkg/types", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/types" }, { "importpath": "k8s.io/kubernetes/pkg/util", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/util" }, { "importpath": "k8s.io/kubernetes/pkg/version", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/version" }, { "importpath": "k8s.io/kubernetes/pkg/watch", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/pkg/watch" }, { "importpath": "k8s.io/kubernetes/third_party/forked/reflect", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/third_party/forked/reflect" }, { "importpath": "k8s.io/kubernetes/third_party/golang/template", "repository": "https://github.com/kubernetes/kubernetes", - "revision": "165169ab1c18f0a6df60505a1bdc7783e56b303e", + "revision": "47acbd62ecf7e3d15bdde0fce48cde9610666a69", "branch": "master", "path": "/third_party/golang/template" },